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 the example codes in the wn_simple_gce distribution src/examples directory.
Example 1: Create a simple GCE model and compute the total mass, the mass in stars, and the mass in gas.
wn_simple_gce routines demonstrated in example1.c are:
- Line 78: WnSimpleGce__new()
- Line 84: WnSimpleGce__updateInitialGasMass()
- Line 86: WnSimpleGce__updateInfallKValue()
- Line 88: WnSimpleGce__updateInfallDelta()
- Line 90: WnSimpleGce__updateOmega()
- Line 109: WnSimpleGce__computeInfallRate()
- Line 110: WnSimpleGce__computeTotalMass()
- Line 111: WnSimpleGce__computeStarMass()
- Line 112: WnSimpleGce__computeGasMass()
- Line 123: WnSimpleGce__free()
To compute the total mass, the star mass, and the gas mass for a simple GCE model with initial gas mass of 1.0e10, infall parameters k = 1 and Delta = 0.1, and a gas consumption rate of 0.299 per Gyr, type:
./example1 1.e10 1 0.1 0.299 > ex1_output.txt
The result is ex1_output.txt
Example 2: Compute the gas consumption rate omega from the gas fraction at a given time.
wn_simple_gce routines demonstrated in example2.c are:
- Line 74: WnSimpleGce__new()
- Line 76: WnSimpleGce__updateInfallKValue()
- Line 77: WnSimpleGce__updateInfallDelta()
- Line 84: WnSimpleGce__computeOmegaFromGasFraction()
- Line 96: WnSimpleGce__getInfallKValue()
- Line 97: WnSimpleGce__getInfallDelta()
- Line 104: WnSimpleGce__getOmega()
- Line 111: WnSimpleGce__free()
To run example2, type the following on the command line:
./example2 1 0.5 0.1 12. > ex2_output.txt
The result is ex2_output.txt
Example 3: Use a supplied infall function in place of the default.
wn_simple_gce routines demonstrated in example3.c are:
- Line 82: WnSimpleGce__new()
- Line 88: WnSimpleGce__updateInitialGasMass()
- Line 90: WnSimpleGce__updateInfallKValue()
- Line 92: WnSimpleGce__updateInfallDelta()
- Line 94: WnSimpleGce__updateOmega()
- Line 109: WnSimpleGce__setInfallRateFunction()
- Line 128: WnSimpleGce__computeTotalMass()
- Line 129: WnSimpleGce__computeGasMass()
- Line 130: WnSimpleGce__computeStarMass()
- Line 151: WnSimpleGce__free()
To compute the total mass, gas mass, star mass, and gas fraction for a simple GCE model with initial gas mass 1.e10, infall parameters k = 1 and Delta = 0.1, a gas consumption rate 0.299 per Gyr, and an omega1 [see Eq. (14) of Clayton (1984)], type:
./example3 1.e10 1 0.1 0.299 0.15 > ex3_output.txt
The result is ex3_output.txt
Example 4: Compute the primary metallicity as a function of time in a simple GCE model.
wn_simple_gce routines demonstrated in example4.c are:
- Line 80: WnSimpleGce__new()
- Line 86: WnSimpleGce__updateInfallKValue()
- Line 88: WnSimpleGce__updateInfallDelta()
- Line 90: WnSimpleGce__updateOmega()
- Line 92: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 132: WnSimpleGce__computePrimaryMetallicity()
- Line 134: WnSimpleGce__setInfallPrimaryMetallicityFunction()
- Line 144: WnSimpleGce__clearInfallPrimaryMetallicityFunction()
- Line 150: WnSimpleGce__computeGasMass()
- Line 165: WnSimpleGce__free()
To compute the primary metallicity in a simple GCE model with infall parameters k = 1 and Delta = 0.1, a gas consumption rate of 0.299 per Gyr, and a primary metallicity yield of 0.012, type:
./example4 1 0.1 0.299 0.012 > ex4_output.txt
The result is ex4_output.txt
Example 5: Compute a species yield as a function of time.
wn_simple_gce routines demonstrated in example5.c are:
- Line 92: WnSimpleGce__new()
- Line 98: WnSimpleGce__updateInitialGasMass()
- Line 100: WnSimpleGce__updateInfallKValue()
- Line 102: WnSimpleGce__updateInfallDelta()
- Line 104: WnSimpleGce__updateOmega()
- Line 106: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 112: WnSimpleGce__Species__new()
- Line 121: WnSimpleGce__Species__updateYieldCoefficient()
- Line 149: WnSimpleGce__computePrimaryMetallicity()
- Line 150: WnSimpleGce__computeSpeciesYield()
- Line 161: WnSimpleGce__Species__free()
- Line 162: WnSimpleGce__free()
To compute the yield of al27 for a simple GCE model with infall parameters k = 1 and Delta = 0.1, a gas consumption rate of 0.299 per Gyr, a primary metallicity yield of 0.012, and a species primary yield of 1.7e-5, type:
./example5 1.e10 1 0.1 0.299 0.012 al27 1.7e-5 > ex5_output.txt
The result is ex5_output.txt
To run with a secondary component to the yield (the beta term), add that to the command line:
./example5 1.e10 1 0.1 0.299 0.012 al27 1.7e-5 2.1e-3 > ex5_output_beta.txt
The result is ex5_output_beta.txt
It is also possible to add higher order terms:
./example5 1.e10 1 0.1 0.299 0.012 al27 1.7e-5 2.1e-3 -1.e-2 > ex5_output_gamma.txt
The result is ex5_output_gamma.txt
Example 6: Compute the mass fraction of a species in the gas as a function of time.
wn_simple_gce routines demonstrated in example6.c are:
- Line 91: WnSimpleGce__new()
- Line 97: WnSimpleGce__updateInfallKValue()
- Line 99: WnSimpleGce__updateInfallDelta()
- Line 101: WnSimpleGce__updateOmega()
- Line 103: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 109: WnSimpleGce__Species__new()
- Line 115: WnSimpleGce__Species__updateDecayRate()
- Line 124: WnSimpleGce__Species__updateYieldCoefficient()
- Line 142: WnSimpleGce__Species__getName()
- Line 153: WnSimpleGce__computeSpeciesMassFraction()
- Line 164: WnSimpleGce__Species__free()
- Line 165: WnSimpleGce__free()
To compute the gas mass fraction of al27 for a simple GCE model with infall parameters k = 1 and Delta = 0.1, a gas consumption rate of 0.299 per Gyr, a primary metallicity yield of 0.012, and a species primary yield of 1.7e-5, type:
./example6 1 0.1 0.299 0.012 al27 0. 1.7e-5 > ex6_output.txt
The result is ex6_output.txt
To run with a secondary component to the yield (the beta term), add that to the command line:
./example6 1 0.1 0.299 0.012 al27 0. 1.7e-5 2.1e-3 > ex6_output_beta.txt
The result is ex6_output_beta.txt
To run with a species that is radioactive, add the non-zero decay rate to the command line:
./example6 1 0.1 0.299 0.012 al26 967. 2.2e-7 6.5e-6 > ex6_output_rad.txt
The result is ex6_output_rad.txt
Example 7: Compute the ISM mass fraction ratio of a radioactive species relative to that of a reference (stable or radioactive) isotope as a function of time.
wn_simple_gce routines demonstrated in example7.c are:
- Line 111: WnSimpleGce__new()
- Line 117: WnSimpleGce__updateInfallKValue()
- Line 119: WnSimpleGce__updateInfallDelta()
- Line 121: WnSimpleGce__updateOmega()
- Line 123: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 129: WnSimpleGce__Species__new()
- Line 131: WnSimpleGce__Species__updateDecayRate()
- Line 133: WnSimpleGce__Species__updateYieldCoefficient()
- Line 156: WnSimpleGce__Species__getName()
- Line 172: WnSimpleGce__computeSpeciesMassFraction()
- Line 184: WnSimpleGce__Species__free()
- Line 186: WnSimpleGce__free()
To run example7, type the following on the command line:
./example7 1 0.1 0.299 0.012 al26 967. 2.2e-7 6.5e-6 al27 0. 1.7e-5 2.1e-3 > ex7_output.txt
The result is ex7_output.txt
Example 8: Compute the remainder of a radioactive species (mass fraction in the gas relative to that if the species were stable) as a function of time.
wn_simple_gce routines demonstrated in example8.c are:
- Line 96: WnSimpleGce__new()
- Line 102: WnSimpleGce__updateInfallKValue()
- Line 104: WnSimpleGce__updateInfallDelta()
- Line 106: WnSimpleGce__updateOmega()
- Line 108: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 114: WnSimpleGce__Species__new()
- Line 116: WnSimpleGce__Species__updateYieldCoefficient()
- Line 138: WnSimpleGce__Species__updateDecayRate()
- Line 147: WnSimpleGce__Species__getName()
- Line 154: WnSimpleGce__computeSpeciesMassFraction()
- Line 178: WnSimpleGce__Species__free()
- Line 180: WnSimpleGce__free()
To compute the remainder of al26 for a simple GCE model with infall parameters k = 1 and Delta = 0.1, a gas consumption rate of 0.299 per Gyr, a primary yield alpha = 0.012, and species yield parameters alpha = 2.2e-7 and beta = 6.5e-6, type:
./example8 1 0.1 0.299 0.012 al26 967. 2.2e-7 6.5e-6 > ex8_output.txt
The result is ex8_output.txt
Example 9: Compute the mass fraction of a species in multiple GCE zones at a given time simultaneously.
wn_simple_gce routines demonstrated in example9.c are:
- Line 86: WnSimpleGce__Species__new()
- Line 93: WnSimpleGce__Species__updateYieldCoefficient()
- Line 102: WnSimpleGce__Species__updateDecayRate()
- Line 134: WnSimpleGce__new()
- Line 136: WnSimpleGce__updateInitialGasMass()
- Line 138: WnSimpleGce__updateInfallKValue()
- Line 140: WnSimpleGce__updateInfallDelta()
- Line 142: WnSimpleGce__updateOmega()
- Line 144: WnSimpleGce__updatePrimaryMetallicityYield()
- Line 165: WnSimpleGce__Species__getName()
- Line 166: WnSimpleGce__computeSpeciesMassFraction()
- Line 179: WnSimpleGce__Species__free()
- Line 182: WnSimpleGce__free()
To run example9, type the following on the command line:
./example9 ../../data_pub/zones.txt 7.7 > ex9_output.txt
The result is ex9_output.txt