ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_DustModel.H File Reference

The interface between ERF and a dust model. More...

#include <AMReX_Geometry.H>
#include <AMReX_MultiFab.H>
#include <AMReX_REAL.H>
#include <string>
Include dependency graph for ERF_DustModel.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DustInit
 What a dust model reads when it is set up. More...
 
struct  DustStep
 The state a dust model reads after each step of level 0. More...
 
class  DustModel
 A dust model behind ERF's dust coupling. More...
 

Detailed Description

The interface between ERF and a dust model.

A dust model emits dust from the ground into the dust scalars of the conserved state, settles and deposits it, and writes its own output. ERF owns the dust scalars: ERF_NUM_DUST_SCALARS (CMake; NUM_DUST_SCALARS in GNU make) of them, starting at RhoDust_comp (ERF_IndexDefines.H), advected and diffused like every passive scalar and zero at the start of a run. A model adds its tendencies to them in add_sources() and keeps everything else (its surface grid, its fields, its particles) itself.

ERF itself contains no model. A model lives in its own directory outside ERF (DUST_HOME in GNU make, ERF_DUST_MODEL_DIRS in CMake) and registers itself with ERF_REGISTER_DUST_MODEL (ERF_DustModelRegistry.H). erf.dust.enable = true turns dust on; erf.dust.model names the model, and may be left out when one model is compiled in.

ERF calls, in this order:

  • initialize() once, at the end of start-up (after the fire coupling's initialization), which on a restart also restores the model's state;
  • add_sources() at every Runge-Kutta stage of every level, right after ERF's own sources are built and before the fire coupling adds its fluxes;
  • advance() once per step of level 0, after the step;
  • write_output() at start-up (step 0, before the first plotfile), after each step and at the end of the run, each time before ERF writes a checkpoint, so a checkpoint records the model's output of that step as written;
  • write_checkpoint() each time ERF writes a checkpoint.

Memory contract, as for fire engines (ERF_FireEngine.H): every MultiFab in DustInit, DustStep and the add_sources() arguments is an ordinary AMReX MultiFab in the default arena (device memory on a GPU build) and a temporary of the call; a model keeps no pointer to it.