Wiki

Clone wiki

krome_bootcamp_2016_ex / files_description

Back to main

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, size ncells;
  • energy: array of specific gas energies (erg/g), one element per cell, size ncells;
  • radius: array of radius (cm), the distance from the protostar, one element per cell, size ncells;
  • x: passive scalars array of chemical species mass fractions (dimensionless), 2D ncells x nchemistry;
  • dr: dimension of a cell (cm), size ncells;
  • adiabaticIndex: adiabatic index (dimensionless), size ncells;
  • mu: mean molecular weight (dimensionless), size ncells;
  • Jflux: radiation flux array (eV/cm2), 2D, size ncells x nenergy;
  • TeffStar: the effective temperature of the protostar (K);
  • energyLeft and energyRight: left and right limits of each radiation bin (eV), size ncells;
  • energyDelta: energy bin size (eV), i.e. energyRight-energyLeft, size ncells;
  • energyMid: mid point of the energy bin (eV), size ncells;
  • opacity: energy-dependent opacity for each cell (g/cm^2), 2D, size ncells x nenergy;
  • xdust: dust number density array for each cell and dust bin (cm^-3), 2D, size ncells x ndust;
  • Tdust: dust temperature array for each cell and dust bin (K), 2D, size ncells x ndust;
  • 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 of proto is created);
  • init: load parameters from the namelist file fileName and initialize using init_density_profile, set_Teff_star, and set_radiation_metric (see below);
  • load_parameters_from_file: load parameters from the namelist file fileName;
  • 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 size ncells with the total density of each cell (g/cm3);
  • get_radius: get an array of size ncells 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 with nenergy bins and using the limits read from the namelist;
  • set_radiation_source: set the radiation source as a star with temperature Teff (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 number fileNumber;
  • dump_radiation_flux: dump a file with the radiation flux (eV/cm2) for each energy bin and cell. Note that an independent variable xvariable 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