Wiki
Clone wikikrome_bootcamp_2016_ex / files_description
List of files (including at least some description)
See also connections within PROTO and to KROME (schematic).
main.f90
This is the main program file that contains:
- a call to the class constructor;
- various calls to initialization procedures;
- the loop over time;
- calls to output procedures.
proto_commons.f90
This contains common variables used by the class and by the main program. All variables are parameters.
ncells
: the number of cells (i.e. grid points);nchemistry
: the number of chemical species (passive scalars);ndust
: the number of dust bins (passive scalars);nenergy
: the number of photo bins (in energy).
proto_class.f90
The class file. It contains attributes and procedures. Both are explained below.
List of class attributes (i.e. common variables of the class):
density
: array of mass densities (g/cm^3), one element per cell, sizencells
;energy
: array of specific gas energies (erg/g), one element per cell, sizencells
;radius
: array of radius (cm), the distance from the protostar, one element per cell, sizencells
;x
: passive scalars array of chemical species mass fractions (dimensionless), 2Dncells
xnchemistry
;dr
: dimension of a cell (cm), sizencells
;adiabaticIndex
: adiabatic index (dimensionless), sizencells
;mu
: mean molecular weight (dimensionless), sizencells
;Jflux
: radiation flux array (eV/cm2), 2D, sizencells
xnenergy
;TeffStar
: the effective temperature of the protostar (K);energyLeft
andenergyRight
: left and right limits of each radiation bin (eV), sizencells
;energyDelta
: energy bin size (eV), i.e.energyRight
-energyLeft
, sizencells
;energyMid
: mid point of the energy bin (eV), sizencells
;opacity
: energy-dependent opacity for each cell (g/cm^2), 2D, sizencells
xnenergy
;xdust
: dust number density array for each cell and dust bin (cm^-3), 2D, sizencells
xndust
;Tdust
: dust temperature array for each cell and dust bin (K), 2D, sizencells
xndust
;accretionRate
: accretion rate (g/s);starMass
: mass of the star (g);radiusMin
,radiusMax
: min. and max. radius of the simulation box (cm);starRadius
: radius of the star (cm);energyMin
,energyMax
: bounds of the radiation energy (eV);dust2gas
: dust to gas mass ratio.
List of class procedures (i.e. functions and subroutines of the class):
new_proto
: class constructor (i.e. the function called when a new instance ofproto
is created);init
: load parameters from the namelist filefileName
and initialize usinginit_density_profile
,set_Teff_star
, andset_radiation_metric
(see below);load_parameters_from_file
: load parameters from the namelist filefileName
;init_density_profile
: initialize logarithmic grid spacing and density profile using options loaded from namelist (density follows eqn. 10.34 of Stahler & Palla, 2005);get_density
: get an array of sizencells
with the total density of each cell (g/cm3);get_radius
: get an array of sizencells
with the radius (position from the protostar) of each cell (cm);set_Teff_star
: set effective temperature of the protostar using data loaded from the namelist (eqn.11.8 Stahler+Palla, 2005);set_radiation_metric
: define a logarithmic radiation binning withnenergy
bins and using the limits read from the namelist;set_radiation_source
: set the radiation source as a star with temperatureTeff
(set with the appropriate function). Note that this assumes radiation is propagated to the first cell;evolve_radiation
: propagates radiation for all energy bins from the first cell to the last, assuming geometrical attenuation (1/r^2) and a given opacity;fluxBB
: returns the spectral radiance (eV/cm2/sr) at a given energy (eV) of a blackbody with temperature Tbb (K).
Additional/"missing" class procedures are described in proto_mod.f90
(see below).
Note that internal class procedure names are of the style my_awesome_names
, but the publicly visible procedures are called something like myClass%myAwesomeNames
because they are set to procedure::myAwesomeNames=>my_awesome_names
in the class definition.
proto_mod.f90
This is where the user should add most of the modifications.
Note that this file is just an extension of proto_class.f90
and, in principle, the same modifications could be done there.
Some function prototypes are included:
dump_density_profile
: dump a position-dependent density profile to the file with unit numberfileNumber
;dump_radiation_flux
: dump a file with the radiation flux (eV/cm2) for each energy bin and cell. Note that an independent variablexvariable
must be provided; usually this is time;init_chemistry
: empty prototype subroutine to initialize chemistry (before the loop over time in main.f90);solve_chemistry
: empty prototype subroutine to solve chemistry (inside the loop over time).
namelist.dat
The input and option file where from the class takes all the required data.
The options are:
gasEnergy
: energy per gas mass (specific energy), erg/g;accretionRate
: accretion rate, Msun/yr;starMass
: mass of protostar, Msun;starRadius
: radius of protostar, Rsun;radiusMin
: simulation domain lower bound, AU;radiusMax
: simulation domain upper bound, AU;energyMin
: radiation energy lower bound, eV;energyMax
: radiation energy upper bound, eV;dust2gas
: dust to gas mass ratio.
Updated