## Computing the entropy generation rate

In my previous post, I ran an r-process calculation at constant entropy. In this post, I will begin to consider to what extent the entropy would really be constant in such an expansion by computing the entropy generation rate (in units of Boltzmann's constant) during the calculation.

To make this calculation, I will use a NucNet Tools example code compute_sdot. The entropy per nucleon is often denoted s and the time derivative is denoted with a dot , so the entropy generation rate can be considered , or "s dot". The code is in the examples/thermo directory, so I type

cd nucnet-tools-code/examples/thermo

./examples_make

If you are compiling with clang, you may run into trouble because some of the thermo examples use OpenMP. If this is the case, simply type

make compute_sdot

To get the basic usage, I type

./compute_sdot

which returns

```Usage: ./compute_sdot xml_file [options]

Purpose: compute the entropy generation rate per nucleon for the input xml_file for the selected nuclei, reactions, and zones.

Allowed options:
--help                print out this help message and exit
--nuc_xpath arg       XPath to select nuclides (default: all nuclides)
--reac_xpath arg      XPath to select reaction (default: all reactions)
--zone_xpath arg      XPath to select zones (default: all zones)
```

This usage statement is of a different form than in previous examples. The code uses the Boost program options library. It requires a flag for all options, which are indeed optional. I thus compute the entropy generation rate in all timesteps of my previous calculation by typing

./compute_sdot ../../my_examples/network/my_output1.xml > sdot_all.txt

This calculation takes a few minutes. The output sdot_all.txt has four columns giving the three zone lables (the timestep number and two zeroes in this case) and the rate at which entropy is generated per nucleon for the step. For the purposes of future discussion, I will also compute the entropy generate rate due only to weak reactions. To do this, I note that the weak decay reactions will all have some kind of neutrino as a product; thus, I can select reactions that have a product containing the string neutrino. I type

./compute_sdot ../../my_examples/network/my_output1.xml --reac_xpath "[product[contains(.,'neutrino')]]" > sdot_weak_only.txt

Notice I use the option reac_xpath followed by the reaction XPath expression to select out weak rates. Again the output is four columns with the fourth being the entropy generation rate, but this time only for the weak reactions. I next get the appropriate physical conditions by typing

cd ../analysis

make print_properties

cd ../thermo

../analysis/print_properties ../../my_examples/network/my_output1.xml time t9 rho > props.txt

If I plot column 4 of sdot_all.txt and sdot_weak_only.txt versus column 3 of props.txt, I get this figure:

From the figure I see that, at certain points in the calculation, the entropy generation rate gets fairly substantial relative to the constant entropy per nucleon of 250 kB. I also note that the entropy generation is largely from the weak rates. Finally, I point out that use of the Boost program options library means that NucNet Tools now relies on shared Boost libraries instead of just the Boost header files. I will expand on all these points in upcoming posts.

Posted by 2016-04-25

Anonymous