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

The interface between ERF and a model of structures in the flow. More...

#include <AMReX.H>
#include <AMReX_FArrayBox.H>
#include <AMReX_Geometry.H>
#include <AMReX_MultiFab.H>
#include <AMReX_REAL.H>
#include <AMReX_RealBox.H>
#include <functional>
#include <string>
#include <vector>
Include dependency graph for ERF_StructureModel.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  StructureInit
 What a structure model reads once, at start-up. More...
 
struct  StructureFire
 What a structure model may read from the fire, when the run has one. More...
 
struct  StructureStep
 The flow a structure model reads at the start of each step of its level. More...
 
class  StructureModel
 A model of structures in the flow, behind ERF's structure coupling. More...
 

Detailed Description

The interface between ERF and a model of structures in the flow.

A structure model represents bodies that the air loads and that push back on the air: power-line conductors and their towers, for example. It samples the wind at its own points, advances its own dynamics, and returns a momentum source that ERF adds to the air at every Runge-Kutta stage. The velocity sampler and the force spreading of the actuator core (Source/MovingBodies/Core, ERF_ActuatorSampling.H and ERF_ActuatorSpreading.H) are the tools a model is expected to use for both.

ERF itself contains no structure model. A model lives in its own directory outside ERF (STRUCTURE_HOME in GNU make, ERF_STRUCTURE_MODEL_DIRS in CMake) and registers itself with ERF_REGISTER_STRUCTURE_MODEL (ERF_StructureModelRegistry.H); erf.structures.model selects it by name. Tests/StructureModelExample is a complete model directory.

ERF calls, in this order:

  • the registered creator once, in the ERF constructor (the model reads its own inputs there, under its own prefix);
  • level() each time ERF needs the level the model couples to;
  • initialize() once, after the initial data (or the checkpoint) exist and before the step-0 plotfile; on a restart the model restores its own state there, from StructureInit::restart_chkfile. It is not called again after a regrid: what the model needs of the mesh it reads from StructureStep each step;
  • advance() once per step of level(), with the state at the start of the step, before that step's Runge-Kutta stages;
  • support() right after each advance(): when a finer level than level() exists, ERF stops the run if that level's boxes overlap the support (the force would be lost there, see level());
  • add_momentum_sources() at every Runge-Kutta stage of level(), and, with erf.coupling_type = TwoWay, once at the start of each step of every coarser level, into zeroed MultiFabs on the grids of level(), which ERF restricts onto that level (see add_momentum_sources());
  • write_checkpoint() each time ERF writes a checkpoint;
  • finalize() once, when the run ends normally, after the last plotfile and checkpoint;
  • plot_var_names() each time ERF builds its plotfile variable list, and fill_plot_var() for each listed name on every level of each plotfile.

Memory contract. Every MultiFab ERF hands a model is an ordinary AMReX MultiFab in the default arena (device memory on a GPU build) and is valid only during the call. A model keeps no pointer to it after the call returns.