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.
Documentation from the file
Table of Contents
-
Structures
-
User-Supplied Routines
-
Routines
| Structures |
|---|
Name: WnSimpleGceDescription: A structure storing information for a GCE model. The contents of the structure are not made public by the API but rather are accessed through API routines. |
|
|
Name: WnSimpleGce__SpeciesDescription: A structure storing information for a species in a GCE model. The contents of the structure are not made public by the API but rather are accessed through API routines. |
|
|
| User-Supplied Routines |
|---|
Name: WnSimpleGce__Species__infall_mass_fraction_function()Description: User-supplied routine to calculate the mass fraction of a species in the infalling material. Syntax:
double
WnSimpleGce__Species__infall_mass_fraction_function(
double d_time,
void *p_user_data
);
Input:
User's routine must return a double giving the mass fraction of the species in the infalling material at the input time. The user sets the infall mass fraction function for the species for a model with WnSimpleGce__Species__setInfallMassFractionFunction(). The default is that the species has zero mass fraction in the infalling matter. |
|
|
Name: WnSimpleGce__infallPrimaryMetallicityFunction()Description: User-supplied routine to calculate the primary metallicity in the infalling material. Syntax:
double
WnSimpleGce__infall_primary_metallicity_function(
double d_time,
void *p_user_data
);
Input:
User's routine must return a double giving the primary metallicity in the infalling material at the input time. The user sets the infall primary metallicity function for a model with WnSimpleGce__setInfallPrimaryMetallicityFunction(). The default is that the infalling material has zero metallicity. |
|
|
Name: WnSimpleGce__infallRateFunction()Description: User-supplied routine to calculate the infall rate to the disk. Syntax:
double
WnSimpleGce__infall_rate_function(
double d_time,
void *p_user_data
);
Input:
User's routine must return a double giving the infall rate at the input time. The user sets the infall rate function for a model with WnSimpleGce__setInfallRateFunction(). The default function is standard model 1 by Clayton (1984). |
|
|
| Routines |
|---|
Name: WnSimpleGce__Species__clearInfallMassFractionFunction()Description: Clear the infall mass fraction function for the species. The routine is reset to the default--that is, zero mass fraction for the species in the infall. Syntax:
void
WnSimpleGce__Species__clearInfallMassFractionFunction(
WnSimpleGce *self
);
Input:
WnSimpleGce__Species__clearInfallMassFractionFunction(
p_model
);
|
|
|
Name: WnSimpleGce__Species__free()Description: Free the memory for a species in a simple GCE model. Syntax:
void
WnSimpleGce__Species__free( WnSimpleGce__Species *self );
Input:
Upon successful return, the memory for the species has been freed. Example: Free the memory for the species pointed to by p_species:
WnSimpleGce__Species__free( p_species );
|
|
|
Name: WnSimpleGce__Species__getName()Description: Retrieve the name of a species. Syntax:
const char *
WnSimpleGce__Species__getName(
WnSimpleGce__Species *self
);
Input:
Routine returns the name of the species. If the input species is invalid, error handling is invoked. Example: Print the name of the species pointed to by p_species:
printf(
"The name of the species is %s\n",
WnSimpleGce__Species__getName( p_species )
);
|
|
|
Name: WnSimpleGce__Species__new()Description: Create a new species for a simple GCE model. Syntax:
WnSimpleGce__Species *
WnSimpleGce__Species__new( const char *s_name );
Input:
The routine returns a pointer to a new WnSimpleGce__Species structure, that is, a new species in a simple GCE model. The newly created species has a decay rate of zero. The decay rate can be updated with the routine WnSimpleGce__Species__updateDecayRate(). The newly created species also has yield coefficients of zero. These can be update with the routine WnSimpleGce__Species__updateYieldCoefficient(). If it is not possible to allocate memory for the new structure, WnSimpleGce error handling is invoked. Example: Create a new species, oxygen-16, in a simple GCE model pointed to by p_my_model:
p_o16 = WnSimpleGce__Species__new( "o16" );
|
|
|
Name: WnSimpleGce__Species__setInfallMassFractionFunction()Description: Set the infall mass fraction function for the species for the model. If the user does not set this function, the species is assumed to have zero mass fraction in the infalling matter. Syntax:
void
WnSimpleGce__Species__setInfallMassFractionFunction(
WnSimpleGce__Species *self,
WnSimpleGce__Species__infall_mass_fraction_function pf_func,
void *p_user_data
);
Input:
WnSimpleGce__Species__setInfallMassFractionFunction(
p_species,
(WnSimpleGce__Species__infall_mass_fraction_function)
my_infall_mass_fraction_function,
&my_data
);
|
|
|
Name: WnSimpleGce__Species__updateDecayRate()Description: Update the decay rate (per Gyr) for a species in a simple GCE model. Syntax:
void
WnSimpleGce__Species__updateDecayRate(
WnSimpleGce__Species *self,
double d_decay_rate
);
Input:
Upon successful return, the decay rate of the species has been updated to the input value. If the species or the decay rate is invalid, error handling is invoked. Example: Update the decay rate of al26 (pointed to by p_al26) to 1000. per Gyr:
WnSimpleGce__Species__updateDecayRate( p_al26, 1000. );
|
|
|
Name: WnSimpleGce__Species__updateYieldCoefficient()Description: Update the yield coefficient for a species. Syntax:
int
WnSimpleGce__Species__updateYieldCoefficient(
WnSimpleGce__Species *self,
unsigned int i_n,
double d_coefficient
);
Input:
Routine returns 0 if successful, -1 if not. Upon successful return, the yield coefficient for the term in the yield that is the primary metallicity raised to the power i_n has been updated to the input value. If the species is invalid, error handling is invoked. Example: Update the primary metallicity part (n=0) of the yield of al27 (pointed to by p_al27) to 0.0034:
WnSimpleGce__Species__updateYieldCoefficient( p_al27, 0, 0.0034 );
|
|
|
Name: WnSimpleGce__clearInfallPrimaryMetallicityFunction()Description: Clear the infall primary metallicity function for the model. The routine is reset to the default--that is, zero infall primary metallicity. Syntax:
void
WnSimpleGce__clearInfallPrimaryMetallicityFunction(
WnSimpleGce *self
);
Input:
WnSimpleGce__clearInfallPrimaryMetallicityFunction(
p_model
);
|
|
|
Name: WnSimpleGce__computeGasMass()Description: Compute the gas mass in the disk (or Solar annulus) for the given model at the input time. Syntax:
double
WnSimpleGce__computeGasMass(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the total mass at the input time for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the gas mass at 4.5 Gyr:
d_time = 4.5;
printf(
"At %g Gyr, the gas mass is %g.\n",
d_time,
WnSimpleGce__computeGasMass( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__computeInfallCycleNumber()Description: Compute the infall cycle number (integral of the infall rate divided by the gas mass from zero to the input time) for the given model at the input time. Syntax:
double
WnSimpleGce__computeInfallCycleNumber(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the infall cycle number at the input time for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the infall cycle number at 7.3 Gyr:
d_time = 7.3;
printf(
"At %g Gyr, the infall cycle number is %g.\n",
d_time,
WnSimpleGce__computeCycleNumber( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__computeInfallRate()Description: Compute the infall rate for the given model at the input time. Syntax:
double
WnSimpleGce__computeInfallRate(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the infall rate at the input time for the input model. for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the infall rate at 8.5 Gyr:
d_time = 8.5;
printf(
"At %g Gyr, the infall rate is %g.\n",
d_time,
WnSimpleGce__computeInfallRate( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__computeOmegaFromGasFraction()Description: Compute the omega (in per Gyr) that gives the input gas fraction (ratio of gas mass to total mass) at the input time. Syntax:
int
WnSimpleGce__computeOmegaFromGasFraction(
WnSimpleGce *self,
double d_time,
double d_gas_fraction
);
Input:
Upon successful return, the omega for the model has been updated to the value that gives the desired gas fraction at the input time. and the routine returns 1 (true). The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model, time, or gas fraction is invalid, error handling is invoked. If the routine is unable to find the omega, the routine returns 0 (false). Example: For the simple GCE model pointed to by p_model, find the omega that gives a gas fraction of 0.091 at 13 Gyr:
d_time = 13.;
d_gas_fraction = 0.091;
WnSimpleGce__computeOmegaFromGasFraction(
p_model, d_time, d_gas_fraction
);
printf(
"To get a gas fraction of %g at %g Gyr, omega must be %g per Gyr.\n",
d_gas_fraction,
d_time,
WnSimpleGce__getOmega( p_model )
);
|
|
|
Name: WnSimpleGce__computePrimaryMetallicity()Description: Compute the primary metallicity for the given model at the input time. Syntax:
double
WnSimpleGce__computePrimaryMetallicity(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the primary metallicity at the input time for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the primary metallicity at 7.3 Gyr:
d_time = 7.3;
printf(
"At %g Gyr, the primary metallicity is %g.\n",
d_time,
WnSimpleGce__computePrimaryMetallicity( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__computeSpeciesMassFraction()Description: Compute the mass fraction for the input species in the gas for the input model at the given time. Syntax:
double
WnSimpleGce__computeSpeciesMassFraction(
WnSimpleGce *self,
WnSimpleGce__Species *p_species,
double d_time
);
Input:
Routine returns the mass fraction of the species at the input time for the input model. If the model, species, or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model and the WnSimpleGce__Species p_species, print the mass fraction at 11 Gyr:
d_time = 11.;
printf(
"At %g Gyr, the mass fraction of %s is %g.\n",
d_time,
WnSimpleGce__Species__getName( p_species ),
WnSimpleGce__computeSpeciesMassFraction( p_model, p_species, d_time )
);
|
|
|
Name: WnSimpleGce__computeSpeciesYield()Description: Compute the yield for the input species for the input model at the given time. Syntax:
double
WnSimpleGce__computeSpeciesYield(
WnSimpleGce *self,
WnSimpleGce__Species *p_species,
double d_time
);
Input:
Routine returns the yield of the species at the input time for the input model. If the model, species, or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model and the WnSimpleGce__Species p_species, print the yield at 11 Gyr:
d_time = 11.;
printf(
"At %g Gyr, the yield of %s is %g.\n",
d_time,
WnSimpleGce__Species__getName( p_species ),
WnSimpleGce__computeSpeciesYield( p_model, p_species, d_time )
);
|
|
|
Name: WnSimpleGce__computeStarMass()Description: Compute the mass in the disk (or Solar annulus) locked up in stars (and stellar remnants) for the given model at the input time. Syntax:
double
WnSimpleGce__computeStarMass(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the mass in stars and remnants at the input time for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the star mass at 3.2 Gyr:
d_time = 3.2;
printf(
"At %g Gyr, the mass locked in stars is %g.\n",
d_time,
WnSimpleGce__computeStarMass( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__computeTotalMass()Description: Compute the total mass in the disk (or Solar annulus) for the given model at the input time. Syntax:
double
WnSimpleGce__computeTotalMass(
WnSimpleGce *self,
double d_time
);
Input:
Routine returns the total mass at the input time for the input model. The routine uses the default infall rate to compute this value unless the user has specified a different infall rate function with WnSimpleGce__setInfallRateFunction(). If the model or time is invalid, error handling is invoked. Example: For the simple GCE model pointed to by p_model, print the total mass at 4.5 Gyr:
d_time = 4.5;
printf(
"At %g Gyr, the total mass is %g.\n",
d_time,
WnSimpleGce__computeTotalMass( p_model, d_time )
);
|
|
|
Name: WnSimpleGce__free()Description: Free the memory for a simple GCE model. Syntax:
void
WnSimpleGce__free( WnSimpleGce *self );
Input:
Upon successful return, the memory for the model has been freed. Example: Free the memory for the WnSimpleGce model pointed to by p_my_model:
WnSimpleGce__free( p_my_model );
|
|
|
Name: WnSimpleGce__getInfallDelta()Description: Retrieve the current value of Delta (in Gyr) for the input model. Syntax:
double
WnSimpleGce__getInfallDelta(
WnSimpleGce *self
);
Input:
printf(
"Delta for the model is %g per Gyr.\n",
WnSimpleGce__getInfallDelta( p_model )
);
|
|
|
Name: WnSimpleGce__getInfallKValue()Description: Retrieve the current value of the infall k for the input model. Syntax:
unsigned int
WnSimpleGce__getInfallKValue(
WnSimpleGce *self
);
Input:
printf(
"The infall k for the model is %d per Gyr.\n",
WnSimpleGce__getInfallKValue( p_model )
);
|
|
|
Name: WnSimpleGce__getInitialGasMass()Description: Retrieve the current value of the initial mass. Syntax:
double
WnSimpleGce__getInitialGasMass(
WnSimpleGce *self
);
Input:
printf(
"The initial mass for the model is %g solar masses.\n",
WnSimpleGce__getInitialGasMass( p_model )
);
|
|
|
Name: WnSimpleGce__getOmega()Description: Retrieve the current value of omega (per Gyr) for the input model. Syntax:
double
WnSimpleGce__getOmega(
WnSimpleGce *self
);
Input:
printf(
"Omega for the model is %g per Gyr.\n",
WnSimpleGce__getOmega( p_model )
);
|
|
|
Name: WnSimpleGce__new()Description: Create a new simple GCE model. Syntax:
WnSimpleGce * WnSimpleGce__new( );
Output:The routine returns a pointer to a new WnSimpleGce structure, that is, a new simple GCE model. If it is not possible to allocate memory for the new structure, WnSimpleGce error handling is invoked. Example: Create a new simple GCE model pointed to by p_my_model:
p_my_model = WnSimpleGce__new( );
|
|
|
Name: WnSimpleGce__setInfallPrimaryMetallicityFunction()Description: Set the infall primary metallicity function for the model. If the user does not set this function, the infalling material is assumed to have zero metallicity. Syntax:
void
WnSimpleGce__setInfallPrimaryMetallicityFunction(
WnSimpleGce *self,
WnSimpleGce__infall_primary_metallicity_function pf_func,
void *p_user_data
);
Input:
WnSimpleGce__setInfallPrimaryMetallicityFunction(
p_model,
(WnSimpleGce__infall_primary_metallicity_function)
my_infall_primary_metallicity_function,
&my_data
);
|
|
|
Name: WnSimpleGce__setInfallRateFunction()Description: Set the infall rate function for the model. If the user does not set this function, the model uses the default infall function (Clayton's standard model 1). Syntax:
void
WnSimpleGce__setInfallRateFunction(
WnSimpleGce *self,
WnSimpleGce__infall_rate_function pf_func,
void *p_user_data
);
Input:
WnSimpleGce__setInfallRateFunction(
p_model,
(WnSimpleGce__infall_rate_function) my_infall_function,
&my_data
);
|
|
|
Name: WnSimpleGce__updateInfallDelta()Description: Update the Delta (the time offset) for the default infall rate function (Clayton's standard model 1). Syntax:
void
WnSimpleGce__updateInfallDelta(
WnSimpleGce *self,
double d_Delta
);
Input:
Upon successful return, the infall Delta value of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the infall Delta value of the simple GCE model p_my_model to 0.2 Gyr:
WnSimpleGce__updateInfallDelta( p_my_model, 0.2 );
|
|
|
Name: WnSimpleGce__updateInfallKValue()Description: Update the k value for the default infall rate function (Clayton's standard model 1). Syntax:
void
WnSimpleGce__updateInfallKValue(
WnSimpleGce *self,
unsigned int i_k
);
Input:
Upon successful return, the infall k value of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the infall k value of the simple GCE model p_my_model to 2:
WnSimpleGce__updateInfallKValue( p_my_model, 2 );
|
|
|
Name: WnSimpleGce__updateInfallPrimaryMetallicity()Description: Update the infall primary metallicity for the input model. Syntax:
void
WnSimpleGce__updateInfallPrimaryMetallicity(
WnSimpleGce *self,
double d_infall_primary_metallicity
);
Input:
Upon successful return, the infall primary metallicity of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the infall primary metallicity of the simple GCE model p_my_model to 0.005:
WnSimpleGce__updateInfallPrimaryMetallicity( p_my_model, 0.005 );
|
|
|
Name: WnSimpleGce__updateInitialGasMass()Description: Update the initial gas mass for the input model. Syntax:
void
WnSimpleGce__updateInitialGasMass(
WnSimpleGce *self,
double d_initial_gas_mass
);
Input:
Upon successful return, the initial gas mass of the model has been updated to the input value. If the model or the initial gas mass is invalid, error handling is invoked. Example: Update the initial gas mass of the simple GCE model p_my_model to 1.e5 (Solar masses):
WnSimpleGce__updateInitialGasMass( p_my_model, 1.e5 );
|
|
|
Name: WnSimpleGce__updateInitialPrimaryMetallicity()Description: Update the initialprimary metallicity for the input model. Syntax:
void
WnSimpleGce__updateInitialPrimaryMetallicity(
WnSimpleGce *self,
double d_initial_primary_metallicity
);
Input:
Upon successful return, the initial primary metallicity of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the initial primary metallicity of the simple GCE model p_my_model to 0.015:
WnSimpleGce__updateInitialPrimaryMetallicity( p_my_model, 0.015 );
|
|
|
Name: WnSimpleGce__updateOmega()Description: Update the omega (the gas consumption rate--in per Gyr) for the input model. Syntax:
void
WnSimpleGce__updateOmega(
WnSimpleGce *self,
double d_omega
);
Input:
Upon successful return, the omega of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the omega of the simple GCE model p_my_model to 0.5 per Gyr:
WnSimpleGce__updateOmega( p_my_model, 0.5 );
|
|
|
Name: WnSimpleGce__updatePrimaryMetallicityYield()Description: Update the primary metallicity yield for the input model. Syntax:
void
WnSimpleGce__updatePrimaryMetallicityYield(
WnSimpleGce *self,
double d_primary_metallicity_yield
);
Input:
Upon successful return, the primary metallicity yield of the model has been updated to the input value. If the model is invalid, error handling is invoked. Example: Update the primary metallicity yield of the simple GCE model p_my_model to 0.015:
WnSimpleGce__updatePrimaryMetallicityYield( p_my_model, 0.015 );
|
|
|