In this post, I will demonstrate how to select out a zone from output from a single-zone calculation and use that as input for a new calculation. A user might find that useful if he or she would like to change the network after some point in the initial calculation or would like to try different sets of reaction rates or thermodynamic trajectories.
To begin, I repeat the steps to run my previous r-process calculation. This time, however, I will first run with a network only up to proton number Z = 50. This means that I run the calculation with the execution call
./run_single_zone ../../data_pub/my_net.xml ../../data_pub/zone.xml my_output1.xml "[z <= 50]"
Once that calculation has finished, I follow the steps in this post to create this movie of the abundances as a function of time. Because the network only included species with Z <= 50, the abundances "piled up" at the top of the network. To follow the evolution correctly, I need to run the calculation with a larger network. Instead of rerunning the calculation, I will pick up the calculation at an appropriate point with the larger network.
I do this by finding a point in the calculation where the network still adequately models the abundances. I note from the movie that when the temperature T9 = T / 109 K is about 1.2, the abundances have not yet been affected by the cutoff of the network at Z = 50. To confirm this, I select out the abundances from the single timestep between a T9 of 1.19 and 1.21 by typing
../../examples/analysis/print_abundances_vs_nucleon_number my_output1.xml a '[optional_properties[property[@name='t9'] < 1.21 and property[@name='t9'] > 1.19]]" > a1.txt
By plotting the abundances in column 2, I get this figure:
Here I see that, at this temperature, the network still handles the abundances appropriately. I now select out this timestep to use as input for the new calculation. I type
xsltproc --param zone_xpath "//zone[optional_properties[property[@name='t9'] < 1.21 and property[@name='t9'] > 1.19]]" http://nucnet-tools.sourceforge.net/xsl_pub/2016-03-05/select_zone.xsl my_output.xml > ../../data_pub/zone2.xml
This creates the file ../../data_pub/zone2.xml which I can now use as input for my next calculation. I now type
./run_single_zone ../../data_pub/my_net.xml ../../data_pub/zone2.xml my_output2.xml "[z <= 90]"
This calculation begins with the conditions and abundances from the first calculation at T9 = 1.2 . By doing this, I save the time required to run the calculation with the full network down to this point. Once this calculation has finish, I can make this movie. The movie of course starts at T9 = 1.2 with abundances evolved by the Z = 50 network up to that point. The larger network then allows the full evolution of the abundances through the second and third r-process peaks, as in the previous calculation.
At this point, I would like to combine the output from the first calculation with that from the second to make a full movie. I do this by selecting the zones (timesteps) from the first calculation down to the beginning of the second calculation and then all the zones (timesteps) from the second calculation. To do this, I first note the absolute path of my directory by typing
which, in my case, returns
The absolute path to my second output file is then /Users/bradleymeyer/nucnet-tools-code/my_examples/network/my_output2.xml. I need the absolute path for the XSLT processor since I will use a stylesheet over the web. The processor will seek this file by a relative path from the stylesheet unless I provide an absolute URI. This means I append the absolute path to the file:// resource locator. I type
xsltproc --stringparam doc2 file:///Users/bradleymeyer/nucnet-tools-code/my_examples/network/my_output2.xml --param zone_xpath "//zone[optional_properties/property[@name='t9'] >= 1.21]" http://nucnet-tools.sourceforge.net/xsl_pub/2016-03-05/merge_zones.xsl my_output1.xml > new.xml
The output file new.xml is now a zone_data xml file with zones from the second calculation appended to the zones from the first calculation down to the point of the beginning of the second calculation. I now combine this file with the network input file by using a libnucnet example code. I type
../../libnucnet/merge_full ../../data_pub/my_net.xml new.xml "" "" "" combined.xml
I can create a full movie with the combined xml file (combined.xml), which has the results of the first calculation down to T9 = 1.2 and the results of the second calculation for the rest of the evolution.