Warning: This is no longer the latest available version of this module. Please see the releases page for the most recent version. The Webnucleo group strongly recommends the use of the latest version of any of its online modules.
This tutorial demonstrates how to use example codes in the libnucnet distribution src/examples directory. The sample input files used in the tutorial are included in the distribution release and may be located in the data_pub directory.
Example 24: Create a nuclear reaction network from an input xml file and print the valid reactions (those between nuclei in the network) and the invalid reactions (those between nuclei not in the network).
libnucnet routines demonstrated in example24.c are:
- Line 82: Libnucnet__Net__is_valid_input_xml()
- Line 96: Libnucnet__Net__new_from_xml()
- Line 144: Libnucnet__Nuc__getNumberOfSpecies()
- Line 145: Libnucnet__Net__getNuc()
- Line 153: Libnucnet__Net__getReac()
- Line 162: Libnucnet__Net__getNumberOfValidReactions()
- Line 170: Libnucnet__Reac__setReactionCompareFunction()
- Line 179: Libnucnet__Reac__iterateReactions()
- Line 192: Libnucnet__Reac__getNumberOfReactions()
- Line 208: Libnucnet__Net__free()
- Line 225: Libnucnet__Net__isValidReaction()
- Line 226: Libnucnet__Reaction__getString()
The first thing you need to do is to merge the nuclear data xml file and the reaction data xml file into a single network data xml file. Use xsltproc (which you should have installed as described in the compile tutorial):
xsltproc --stringparam reac_doc ../data_pub/example_reac.xml ../../xsl_pub/merge_net.xsl ../../data_pub/example_nuc.xml > ../../data_pub/example_net.xml
To run example24, type the following on the command line:
./example24 ../../data_pub/example_net.xml > ex24_output.txt
The result is ex24_output.txt
Example 25: Create a nuclear reaction network from input xml files and print the reaction Q values for the valid reactions.
libnucnet routines demonstrated in example25.c are:
- Line 81: Libnucnet__Net__new()
- Line 84: Libnucnet__Nuc__updateFromXml()
- Line 85: Libnucnet__Net__getNuc()
- Line 94: Libnucnet__Reac__updateFromXml()
- Line 95: Libnucnet__Net__getReac()
- Line 107: Libnucnet__Reac__setReactionCompareFunction()
- Line 112: Libnucnet__Reac__iterateReactions()
- Line 124: Libnucnet__Net__free()
- Line 140: Libnucnet__Net__isValidReaction()
- Line 145: Libnucnet__Reaction__getString()
- Line 151: Libnucnet__Net__computeReactionQValue()
To run example25, type the following on the command line:
./example25 ../../data_pub/example_nuc.xml ../../data_pub/example_reac.xml > ex25_output.txt
The result is ex25_output.txt
Example 26: Create a nuclear reaction network from an input xml file and print the forward and reverse rates for all valid reactions at the input temperature.
libnucnet routines demonstrated in example26.c are:
- Line 90: Libnucnet__Net__new_from_xml()
- Line 136: Libnucnet__Net__getReac()
- Line 139: Libnucnet__Reac__setUserRateFunctions()
- Line 167: Libnucnet__Reac__setReactionCompareFunction()
- Line 172: Libnucnet__Reac__iterateReactions()
- Line 184: Libnucnet__Net__free()
- Line 202: Libnucnet__Net__isValidReaction()
- Line 204: Libnucnet__Net__computeRatesForReaction()
- Line 216: Libnucnet__Reaction__getString()
To print out the forward and reverse rates at t9 = 1, type:
./example26 ../../data_pub/example_net.xml 1. > ex26_output.txt
The result is ex26_output.txt
Example 27: Create a nuclear reaction network from an input xml file and print the forward and reverse rates for a particular reaction (chosen by its string) at a variety of temperatures.
libnucnet routines demonstrated in example27.c are:
- Line 76: Libnucnet__Net__new_from_xml()
- Line 82: Libnucnet__Net__getReac()
- Line 92: Libnucnet__Reac__setUserRateFunctions()
- Line 101: Libnucnet__Reac__getReactionByString()
- Line 111: Libnucnet__Net__isValidReaction()
- Line 114: Libnucnet__Reaction__getString()
- Line 122: Libnucnet__Net__computeRatesForReaction()
- Line 143: Libnucnet__Net__free()
Choose a particular reaction with a string. For example, try:
./example27 ../../data_pub/example_net.xml "c12 + he4 -> o16 + gamma" > ex27_output.txt
The result is ex27_output.txt
Example 28: Create a nuclear reaction network from an input xml file and print the forward and reverse rates for a particular reaction or set of reactions (chosen by an xpath expression) at a variety of temperatures.
libnucnet routines demonstrated in example28.c are:
- Line 75: Libnucnet__Net__new_from_xml()
- Line 81: Libnucnet__Net__getReac()
- Line 87: Libnucnet__Reac__setUserRateFunctions()
- Line 96: Libnucnet__Reac__setReactionCompareFunction()
- Line 101: Libnucnet__Reac__iterateReactions()
- Line 111: Libnucnet__Net__free()
- Line 133: Libnucnet__Net__isValidReaction()
- Line 138: Libnucnet__Reaction__getString()
- Line 146: Libnucnet__Net__computeRatesForReaction()
Choose a reaction or set of reactions with an xpath expression. For example, try:
./example28 ../../data_pub/example_net.xml "[reactant = 'ne21']" > ex28_output.txt
The result is ex28_output.txt
Example 29: Create a nuclear reaction network from an input xml file and check that the forward and reverse rates lie within lower and upper bounds for a given temperature range.
libnucnet routines demonstrated in example29.c are:
- Line 142: Libnucnet__Net__new_from_xml()
- Line 151: Libnucnet__Net__getReac()
- Line 154: Libnucnet__Reac__setUserRateFunctions()
- Line 167: Libnucnet__Reac__getDuplicateReactions()
- Line 171: Libnucnet__Reac__iterateReactions()
- Line 177: Libnucnet__Reac__free()
- Line 193: Libnucnet__Net__free()
- Line 211: Libnucnet__Net__isValidReaction()
- Line 223: Libnucnet__Net__computeRatesForReaction()
- Line 236: Libnucnet__Reaction__getString()
To find the forward and reverse rates (for the network in the input file) that are less than 0 or greater than 1.e14 in the temperature range 1.e-3 to 10 billion Kelvins, type:
./example29 ../../data_pub/example_net.xml 1.e-3 10. 0. 1.e14 > ex29_output.txt
The result is ex29_output.txt
Example 30: Create a nuclear reaction network from an input xml file and print the forward and reverse rates at the input temperature and then double the rates and print them out again.
libnucnet routines demonstrated in example30.c are:
- Line 84: Libnucnet__Net__new()
- Line 86: Libnucnet__Nuc__updateFromXml()
- Line 87: Libnucnet__Net__getNuc()
- Line 93: Libnucnet__Reac__updateFromXml()
- Line 94: Libnucnet__Net__getReac()
- Line 116: Libnucnet__Zone__new()
- Line 131: Libnucnet__Zone__computeRates()
- Line 138: Libnucnet__Reac__setReactionCompareFunction()
- Line 153: Libnucnet__Reac__iterateReactions()
- Line 155: Libnucnet__Zone__getNet()
- Line 169: Libnucnet__Reac__clearReactionCompareFunction()
- Line 215: Libnucnet__Zone__free()
- Line 216: Libnucnet__Net__free()
- Line 235: Libnucnet__Net__isValidReaction()
- Line 241: Libnucnet__Zone__getRatesForReaction()
- Line 246: Libnucnet__Reaction__getString()
- Line 282: Libnucnet__Zone__updateRatesForReaction()
To print and double the forward and reverse rates at t9 = 3, type:
./example30 ../../data_pub/example_net.xml 3. > ex30_output.txt
The result is ex30_output.txt
You can also select out certain reactions with an xpath expression. For example, try:
./example30 ../../data_pub/example_net.xml 3. "[product = 'mg25']" > ex30_xpath_output.txt
The result is ex30_xpath_output.txt
Example 31: Create a nuclear reaction network from an input xml file and for rates selected by an XPath expression, print out the forward and reverse rates, the forward screening factor, the reverse ratio correction, and the screened rates.
libnucnet routines demonstrated in example31.c are:
- Line 115: Libnucnet__Net__new_from_xml()
- Line 123: Libnucnet__Net__getReac()
- Line 125: Libnucnet__Reac__setUserRateFunctions()
- Line 178: Libnucnet__Reac__iterateReactions()
- Line 188: Libnucnet__Net__free()
- Line 203: Libnucnet__Net__isValidReaction()
- Line 205: Libnucnet__Net__computeRatesForReaction()
- Line 215: Libnucnet__Net__computeScreeningFactorForReaction()
- Line 226: Libnucnet__Net__computeReverseRatioCorrectionFactorForReaction()
- Line 237: Libnucnet__Reaction__getString()
To print the correction factor and screened rates for reactions involving n15 as a reactant at t9 = 3, a mass density of 1.e8 g/cc, an electron-to-baryon ratio of 0.5, and a second moment of the abundances with respect to atomic number of 0.15, type:
./example31 ../../data_pub/example_net.xml 3. 1.e8 0.5 0.15 "[reactant = 'n15']" > ex31_output.txt
The result is ex31_output.txt
Example 32: Create a full libnucnet nuclear reaction network structure (nuclei plus reactions among them) from an input xml file print out data about the input zones, remove the zones, and add a zone.
libnucnet routines demonstrated in example32.c are:
- Line 74: Libnucnet__is_valid_input_xml()
- Line 83: Libnucnet__new_from_xml()
- Line 93: Libnucnet__getNumberOfZones()
- Line 103: Libnucnet__setZoneCompareFunction()
- Line 108: Libnucnet__iterateZones()
- Line 120: Libnucnet__freeAllZones()
- Line 134: Libnucnet__Zone__new()
- Line 135: Libnucnet__getNet()
- Line 141: Libnucnet__addZone()
- Line 148: Libnucnet__Nuc__getSpeciesByName()
- Line 149: Libnucnet__Net__getNuc()
- Line 155: Libnucnet__Zone__updateSpeciesAbundance()
- Line 156: Libnucnet__Species__getA()
- Line 190: Libnucnet__relabelZone()
- Line 228: Libnucnet__free()
- Line 251: Libnucnet__Zone__getLabel()
- Line 259: Libnucnet__Nuc__iterateSpecies()
- Line 261: Libnucnet__Zone__getNet()
- Line 270: Libnucnet__Zone__computeAMoment()
- Line 293: Libnucnet__Zone__getSpeciesAbundance()
- Line 299: Libnucnet__Species__getName()
The first thing you need to do is to merge the nuclear network xml file and an input mass fractions data xml file into a single xml file appropriate as a libnucnet input file. Use xsltproc (which you should have installed during the compilation tutorial):
xsltproc --stringparam initial_mass_frac_doc ../data_pub/initial_mass_fractions_3d.xml ../../xsl_pub/merge_full.xsl ../../data_pub/example_net.xml > ../../data_pub/example_3d.xml
To run example32, type the following on the command line:
./example32 ../../data_pub/example_3d.xml > ex32_output.txt
The result is ex32_output.txt
Example 33: Create a full libnucnet structure (network plus zones) and print out data about the zones.
libnucnet routines demonstrated in example33.c are:
- Line 81: Libnucnet__new_from_xml()
- Line 89: Libnucnet__getNumberOfZones()
- Line 96: Libnucnet__setZoneCompareFunction()
- Line 101: Libnucnet__iterateZones()
- Line 111: Libnucnet__free()
- Line 127: Libnucnet__Zone__getLabel()
- Line 135: Libnucnet__Nuc__iterateSpecies()
- Line 136: Libnucnet__Net__getNuc()
- Line 137: Libnucnet__Zone__getNet()
- Line 164: Libnucnet__Zone__getSpeciesAbundance()
- Line 169: Libnucnet__Species__getName()
To run example33, type the following on the command line:
./example33 ../../data_pub/example_3d.xml > ex33_output.txt
The result is ex33_output.txt
Example 34: Create a full libnucnet structure (network plus zones) and print out mass fractions for a zone chosen by its labels.
libnucnet routines demonstrated in example34.c are:
- Line 74: Libnucnet__new()
- Line 76: Libnucnet__Nuc__updateFromXml()
- Line 77: Libnucnet__Net__getNuc()
- Line 78: Libnucnet__getNet()
- Line 84: Libnucnet__assignZoneDataFromXml()
- Line 92: Libnucnet__getZoneByLabels()
- Line 104: Libnucnet__Zone__getLabel()
- Line 113: Libnucnet__free()
- Line 127: Libnucnet__Nuc__iterateSpecies()
- Line 129: Libnucnet__Zone__getNet()
- Line 137: Libnucnet__Zone__computeAMoment()
- Line 152: Libnucnet__Zone__getSpeciesAbundance()
- Line 157: Libnucnet__Species__getName()
- Line 159: Libnucnet__Species__getA()
To run example34, type the following on the command line:
./example34 ../../data_pub/example_net.xml ../../data_pub/initial_mass_fractions_3d.xml x1 y1 z1 > ex34_output.txt
The result is ex34_output.txt
Example 35: Create a full libnucnet structure (network plus zones) and print out mass fractions for a given species in all zones.
libnucnet routines demonstrated in example35.c are:
- Line 74: Libnucnet__new_from_xml()
- Line 79: Libnucnet__new()
- Line 81: Libnucnet__Nuc__updateFromXml()
- Line 82: Libnucnet__Net__getNuc()
- Line 83: Libnucnet__getNet()
- Line 89: Libnucnet__assignZoneDataFromXml()
- Line 96: Libnucnet__Nuc__getSpeciesByName()
- Line 130: Libnucnet__setZoneCompareFunction()
- Line 135: Libnucnet__iterateZones()
- Line 145: Libnucnet__free()
- Line 165: Libnucnet__Zone__getSpeciesAbundance()
- Line 170: Libnucnet__Zone__getLabel()
- Line 173: Libnucnet__Species__getA()
To run example35, type the following on the command line:
./example35 ../../data_pub/example_nuc.xml ../../data_pub/initial_mass_fractions_stooges.xml he4 > ex35_output.txt
The result is ex35_output.txt
Example 36: Create a zone mass fractions file from a Rauscher et al. (2002) stellar model data file.
libnucnet routines demonstrated in example36.c are:
- Line 83: Libnucnet__new()
- Line 85: Libnucnet__Nuc__updateFromXml()
- Line 86: Libnucnet__Net__getNuc()
- Line 87: Libnucnet__getNet()
- Line 178: Libnucnet__Zone__new()
- Line 185: Libnucnet__Zone__updateProperty()
- Line 207: Libnucnet__Nuc__getSpeciesByName()
- Line 210: Libnucnet__Zone__updateSpeciesAbundance()
- Line 211: Libnucnet__Species__getA()
- Line 216: Libnucnet__addZone()
- Line 230: Libnucnet__writeZoneDataToXmlFile()
- Line 241: Libnucnet__free()
To run example36, type the following on the command line:
./example36 ../../data_pub/star_read_nuc.xml ../../data_pub/star_data.txt ex36_output.xml
The result is ex36_output.xml
Example 37: Extract a subset of zones containing a subset of nuclei from the original zone xml file and dump to a new xml.
libnucnet routines demonstrated in example37.c are:
- Line 88: Libnucnet__new()
- Line 94: Libnucnet__Nuc__updateFromXml()
- Line 95: Libnucnet__Net__getNuc()
- Line 96: Libnucnet__getNet()
- Line 106: Libnucnet__assignZoneDataFromXml()
- Line 114: Libnucnet__Net__updateFromXml()
- Line 125: Libnucnet__iterateZones()
- Line 135: Libnucnet__writeZoneDataToXmlFile()
- Line 141: Libnucnet__free()
- Line 169: Libnucnet__Zone__getLabel()
- Line 174: Libnucnet__Zone__new()
- Line 190: Libnucnet__Zone__iterateOptionalProperties()
- Line 200: Libnucnet__Nuc__iterateSpecies()
- Line 206: Libnucnet__addZone()
- Line 233: Libnucnet__Nuc__getSpeciesByName()
- Line 235: Libnucnet__Zone__getNet()
- Line 237: Libnucnet__Species__getName()
- Line 240: Libnucnet__Zone__updateSpeciesAbundance()
- Line 243: Libnucnet__Zone__getSpeciesAbundance()
- Line 266: Libnucnet__Zone__updateProperty()
To run example37, type the following on the command line:
./example37 ../../data_pub/star_read_nuc.xml ../../data_pub/s25a28d_expl.xml "[(@label1 >= '214' and @label1 <= '216') or @label1 = 'wind']" "[ z <= 30 ]" ex37_output.xml
The result is ex37_output.xml
More complicated xpath expressions are possible. For example to extract zones for which the the mass fraction of iron-60 is greater than 1.e-10 and include them in a file that includes only species with z < 30, type:
./example37 ../../data_pub/star_read_nuc.xml ../../data_pub/s25a28d_expl.xml "[mass_fractions/nuclide[@name='fe60' and x > 1.e-10]]" "[ z <= 30 ]" ex37_output_xpath2.xml
The result is ex37_output_xpath2.xml
Example 38: Average the abundances in the zones.
libnucnet routines demonstrated in example38.c are:
- Line 71: Libnucnet__new()
- Line 77: Libnucnet__Nuc__updateFromXml()
- Line 78: Libnucnet__Net__getNuc()
- Line 79: Libnucnet__getNet()
- Line 89: Libnucnet__assignZoneDataFromXml()
- Line 97: Libnucnet__Nuc__getNumberOfSpecies()
- Line 128: Libnucnet__getZoneByLabels()
- Line 135: Libnucnet__Zone__getAbundances()
- Line 168: Libnucnet__Zone__new()
- Line 175: Libnucnet__addZone()
- Line 177: Libnucnet__Zone__updateAbundances()
- Line 183: Libnucnet__writeZoneDataToXmlFile()
- Line 191: Libnucnet__free()
To run example38, type the following on the command line:
./example38 ../../data_pub/star_read_nuc.xml ../../data_pub/s25a28d_expl.xml ../../data_pub/average.txt ex38_output.xml
The result is ex38_output.xml
Example 39: Create a full libnucnet structure (network plus zones) and print out the screening and correction factors for the reactions in a zone.
libnucnet routines demonstrated in example39.c are:
- Line 105: Libnucnet__new_from_xml()
- Line 114: Libnucnet__Net__getReac()
- Line 123: Libnucnet__getZoneByLabels()
- Line 139: Libnucnet__Zone__computeZMoment()
- Line 141: Libnucnet__Zone__setScreeningFunction()
- Line 154: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 174: Libnucnet__Zone__computeRates()
- Line 181: Libnucnet__Zone__clearScreeningFunction()
- Line 182: Libnucnet__Zone__clearNseCorrectionFactorFunction()
- Line 193: Libnucnet__Reac__setReactionCompareFunction()
- Line 195: Libnucnet__Zone__getNet()
- Line 200: Libnucnet__Reac__iterateReactions()
- Line 215: Libnucnet__free()
- Line 230: Libnucnet__Net__isValidReaction()
- Line 239: Libnucnet__Reaction__getString()
- Line 240: Libnucnet__Zone__getScreeningFactorForReaction()
- Line 241: Libnucnet__Zone__getReverseRatioCorrectionFactorForReaction()
The first thing you need to do is to merge the nuclear network xml file and an input mass fractions data xml file appropriate for a single zone calculation into a single xml file appropriate as a libnucnet input file. Use xsltproc (which you should have installed during the compilation tutorial):
xsltproc --stringparam initial_mass_frac_doc ../data_pub/initial_mass_fractions_single_zone.xml ../../xsl_pub/merge_full.xsl ../../data_pub/example_net.xml > ../../data_pub/example_single_zone.xml
To print out the screening and reverse ratio correction factors for the zone with labels 0, 0, 0 at t9 = 1 and mass density = 1.e8 g/cc, type:
./example39 ../../data_pub/example_single_zone.xml 1. 1.e8 0 0 0 > ex39_output.txt
The result is ex39_output.txt
Example 40: Create a full libnucnet structure (network plus zones) and generate the Jacobian matrix.
libnucnet routines demonstrated in example40.c are:
- Line 112: Libnucnet__new_from_xml()
- Line 119: Libnucnet__Net__getReac()
- Line 127: Libnucnet__getZoneByLabels()
- Line 139: Libnucnet__Reac__getDuplicateReactions()
- Line 141: Libnucnet__Zone__getNet()
- Line 145: Libnucnet__Reac__iterateReactions()
- Line 151: Libnucnet__Reac__free()
- Line 164: Libnucnet__Zone__computeZMoment()
- Line 166: Libnucnet__Zone__setScreeningFunction()
- Line 179: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 201: Libnucnet__Zone__computeRates()
- Line 208: Libnucnet__Zone__computeJacobianMatrix()
- Line 225: Libnucnet__free()
To print out the Jacobian matrix for the abundances in the zone with labels 0, 0, 0 at t9 = 1 and mass density = 1000 g/cc, type:
./example40 ../../data_pub/example_single_zone.xml 0 0 0 1. 1.e3 ex40_output.txt
The result is ex40_output.txt
Example 41: Create a full libnucnet structure (network plus zones) and run a single-zone network calculation for the input temperature, density, and duration.
libnucnet routines demonstrated in example41.c are:
- Line 153: Libnucnet__is_valid_input_xml()
- Line 163: Libnucnet__new_from_xml()
- Line 178: Libnucnet__Net__getReac()
- Line 193: Libnucnet__getZoneByLabels()
- Line 200: Libnucnet__Reac__getDuplicateReactions()
- Line 202: Libnucnet__Zone__getNet()
- Line 206: Libnucnet__Reac__iterateReactions()
- Line 212: Libnucnet__Reac__free()
- Line 221: Libnucnet__Nuc__setSpeciesCompareFunction()
- Line 222: Libnucnet__Net__getNuc()
- Line 226: Libnucnet__Nuc__sortSpecies()
- Line 236: Libnucnet__Zone__updateProperty()
- Line 291: Libnucnet__Zone__updateTimeStep()
- Line 307: Libnucnet__free()
- Line 330: Libnucnet__Nuc__getNumberOfSpecies()
- Line 340: Libnucnet__Zone__getAbundances()
- Line 355: Libnucnet__Zone__getProperty()
- Line 357: Libnucnet__Zone__computeZMoment()
- Line 371: Libnucnet__Zone__setScreeningFunction()
- Line 377: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 389: Libnucnet__Zone__computeRates()
- Line 403: Libnucnet__Zone__computeFlowVector()
- Line 416: Libnucnet__Zone__computeJacobianMatrix()
- Line 450: Libnucnet__Zone__updateAbundances()
- Line 481: Libnucnet__Zone__updateAbundanceChanges()
- Line 516: Libnucnet__Nuc__iterateSpecies()
- Line 527: Libnucnet__Zone__computeAMoment()
- Line 544: Libnucnet__Zone__getSpeciesAbundance()
- Line 549: Libnucnet__Species__getZ()
- Line 550: Libnucnet__Species__getA()
- Line 552: Libnucnet__Zone__getSpeciesAbundanceChange()
- Line 574: Libnucnet__Species__getName()
Use a network of nuclei with Z <= 10 to compute the evolution of the abundances of species with initial abundances in the input file at an initial T9 = 10 and density of 1.e8 g/cc expanding with a density e-folding timescale of 0.1 seconds for 10 seconds, printing out the abundances every 20 time steps:
./example41 ../../data_pub/example_single_zone.xml 0 0 0 10. 1.e8 0.1 10. 20 "[z <= 10]" > ex41_output.txt
The result is ex41_output.txt
Example 42: Create a full libnucnet structure (network plus zones) and run a single-zone network calculation but with the forward and reverse rates for a particular reaction at all temperatures multipled by a constant factor.
libnucnet routines demonstrated in example42.c are:
- Line 150: Libnucnet__is_valid_input_xml()
- Line 160: Libnucnet__new_from_xml()
- Line 172: Libnucnet__Net__getReac()
- Line 187: Libnucnet__getZoneByLabels()
- Line 199: Libnucnet__Reac__getDuplicateReactions()
- Line 201: Libnucnet__Zone__getNet()
- Line 205: Libnucnet__Reac__iterateReactions()
- Line 211: Libnucnet__Reac__free()
- Line 220: Libnucnet__Nuc__setSpeciesCompareFunction()
- Line 221: Libnucnet__Net__getNuc()
- Line 225: Libnucnet__Nuc__sortSpecies()
- Line 235: Libnucnet__Zone__updateProperty()
- Line 295: Libnucnet__Zone__updateTimeStep()
- Line 311: Libnucnet__free()
- Line 348: Libnucnet__Nuc__getNumberOfSpecies()
- Line 358: Libnucnet__Zone__getAbundances()
- Line 365: Libnucnet__Reac__getReactionByString()
- Line 390: Libnucnet__Zone__getProperty()
- Line 392: Libnucnet__Zone__computeZMoment()
- Line 408: Libnucnet__Zone__setScreeningFunction()
- Line 418: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 430: Libnucnet__Zone__computeRates()
- Line 444: Libnucnet__Zone__getRatesForReaction()
- Line 451: Libnucnet__Zone__updateRatesForReaction()
- Line 459: Libnucnet__Zone__computeFlowVector()
- Line 472: Libnucnet__Zone__computeJacobianMatrix()
- Line 506: Libnucnet__Zone__updateAbundances()
- Line 537: Libnucnet__Zone__updateAbundanceChanges()
- Line 572: Libnucnet__Nuc__iterateSpecies()
- Line 583: Libnucnet__Zone__computeAMoment()
- Line 600: Libnucnet__Zone__getSpeciesAbundance()
- Line 605: Libnucnet__Species__getZ()
- Line 606: Libnucnet__Species__getA()
- Line 608: Libnucnet__Zone__getSpeciesAbundanceChange()
- Line 631: Libnucnet__Species__getName()
Use a network of nuclei with Z <= 10 to compute the evolution of the abundances of species with initial abundances in the input file at an initial T9 = 10 and density of 1.e8 g/cc expanding with a density e-folding timescale of 0.1 seconds for 10 seconds but with the forward and reverse rates for the reaction he4 + he4 + he4 -> c12 + gamma increased by a factor of 10 at all temperatures, printing out the abundances every 20 time steps:
./example42 ../../data_pub/example_single_zone.xml 10. 1.e8 0.1 10. 20 "he4 + he4 + he4 -> c12 + gamma" 10 "[z <= 10]" > ex42_output.txt
The result is ex42_output.txt
Example 43: Create a full libnucnet structure (network plus zones) and run a single-zone network calculation for the input temperature, density, and initial mass fractions from text files.
libnucnet routines demonstrated in example43.c are:
- Line 158: Libnucnet__Net__is_valid_input_xml()
- Line 167: Libnucnet__new()
- Line 170: Libnucnet__Net__updateFromXml()
- Line 171: Libnucnet__getNet()
- Line 196: Libnucnet__Net__getReac()
- Line 204: Libnucnet__Zone__new()
- Line 206: Libnucnet__addZone()
- Line 271: Libnucnet__Nuc__getSpeciesByName()
- Line 272: Libnucnet__Net__getNuc()
- Line 278: Libnucnet__Zone__updateSpeciesAbundance()
- Line 281: Libnucnet__Species__getA()
- Line 301: Libnucnet__getZoneByLabels()
- Line 308: Libnucnet__Reac__getDuplicateReactions()
- Line 310: Libnucnet__Zone__getNet()
- Line 314: Libnucnet__Reac__iterateReactions()
- Line 320: Libnucnet__Reac__free()
- Line 329: Libnucnet__Nuc__setSpeciesCompareFunction()
- Line 334: Libnucnet__Nuc__sortSpecies()
- Line 385: Libnucnet__Zone__updateTimeStep()
- Line 405: Libnucnet__free()
- Line 438: Libnucnet__Nuc__getNumberOfSpecies()
- Line 448: Libnucnet__Zone__getAbundances()
- Line 463: Libnucnet__Zone__getProperty()
- Line 465: Libnucnet__Zone__computeZMoment()
- Line 481: Libnucnet__Zone__setScreeningFunction()
- Line 491: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 505: Libnucnet__Zone__computeRates()
- Line 519: Libnucnet__Zone__computeFlowVector()
- Line 532: Libnucnet__Zone__computeJacobianMatrix()
- Line 566: Libnucnet__Zone__updateAbundances()
- Line 597: Libnucnet__Zone__updateAbundanceChanges()
- Line 632: Libnucnet__Nuc__iterateSpecies()
- Line 643: Libnucnet__Zone__computeAMoment()
- Line 660: Libnucnet__Zone__getSpeciesAbundance()
- Line 665: Libnucnet__Species__getZ()
- Line 668: Libnucnet__Zone__getSpeciesAbundanceChange()
- Line 690: Libnucnet__Species__getName()
- Line 858: Libnucnet__Zone__updateProperty()
Use a network of nuclei with Z <= 10 to compute the evolution of the abundances of species with initial abundances in an input file text file using a thermodynamics trajectory from an input text file evolving for 30 seconds and printing out the abundances every 20 time steps:
./example43 ../../data_pub/example_net.xml ../../data_pub/zone_ascii.txt ../../data_pub/mass_fractions.txt 30. 20 "[z <= 10]" > ex43_output.txt
The result is ex43_output.txt
Example 44: Create a full libnucnet structure (network plus zones) and run a multi-zone network calculation for the input conditions.
libnucnet routines demonstrated in example44.c are:
- Line 153: Libnucnet__is_valid_input_xml()
- Line 163: Libnucnet__new_from_xml()
- Line 175: Libnucnet__Net__getReac()
- Line 182: Libnucnet__iterateZones()
- Line 257: Libnucnet__setZoneCompareFunction()
- Line 268: Libnucnet__clearZoneCompareFunction()
- Line 308: Libnucnet__free()
- Line 331: Libnucnet__Nuc__getNumberOfSpecies()
- Line 332: Libnucnet__Net__getNuc()
- Line 333: Libnucnet__getNet()
- Line 337: Libnucnet__getNumberOfZones()
- Line 488: Libnucnet__Zone__getLabel()
- Line 506: Libnucnet__Nuc__iterateSpecies()
- Line 508: Libnucnet__Zone__getNet()
- Line 517: Libnucnet__Zone__computeAMoment()
- Line 532: Libnucnet__Zone__getSpeciesAbundance()
- Line 538: Libnucnet__Species__getZ()
- Line 539: Libnucnet__Species__getA()
- Line 541: Libnucnet__Zone__getSpeciesAbundanceChange()
- Line 558: Libnucnet__Zone__updateTimeStep()
- Line 585: Libnucnet__Zone__getAbundances()
- Line 626: Libnucnet__Zone__getProperty()
- Line 639: Libnucnet__Zone__computeZMoment()
- Line 655: Libnucnet__Zone__setScreeningFunction()
- Line 665: Libnucnet__Zone__setNseCorrectionFactorFunction()
- Line 677: Libnucnet__Zone__computeRates()
- Line 691: Libnucnet__Zone__computeFlowVector()
- Line 730: Libnucnet__Zone__computeJacobianMatrix()
- Line 793: Libnucnet__getZoneByLabels()
- Line 928: Libnucnet__Zone__updateAbundances()
- Line 973: Libnucnet__Zone__updateAbundanceChanges()
- Line 1039: Libnucnet__Zone__updateProperty()
- Line 1069: Libnucnet__Reac__getDuplicateReactions()
- Line 1075: Libnucnet__Reac__iterateReactions()
- Line 1081: Libnucnet__Reac__free()
The first thing you need to do is to merge the nuclear network xml file and an input mass fractions data xml file appropriate for a 1-D multi-zone calculation into a single xml file appropriate as a libnucnet input file. Use xsltproc (which you should have installed during the compilation tutorial):
xsltproc --stringparam initial_mass_frac_doc ../data_pub/initial_mass_fractions_1d.xml ../../xsl_pub/merge_full.xsl ../../data_pub/example_net.xml > ../../data_pub/example_1d.xml
For a network of nuclei with Z <= 10, compute the evolution of the abundances of species in the three input zones for a duration of 100 seconds with a mixing time between zones of 0.01 seconds:
./example44 ../../data_pub/example_1d.xml 0.01 100. 1 "[z <= 10]" > ex44_output.txt
The result is ex44_output.txt
To run without mixing, use a mixing timescale of zero:
./example44 ../../data_pub/example_1d.xml 0. 100. 1 "[z <= 10]" > ex44_no_mixing_output.txt
The result is ex44_no_mixing_output.txt
To run with only mixing, use the mix_flag to set all zone temperatures to zero:
./example44 ../../data_pub/example_1d.xml 0.1 100. 0 "[z <= 10]" > ex44_mixing_only_output.txt
The result is ex44_mixing_only_output.txt