#include "std_cpp_includes.hh"
#include "utils.h"
#include "except.hh"
#include "write.hh"
#include "model.h"
Go to the source code of this file.
Namespaces | |
namespace | TSOpt |
Classes | |
struct | s_field |
struct | s_iokeys |
class | IWaveInfo |
basic model definition class More... | |
struct | TSOpt::s_task_reln |
Defines | |
#define | ACTIVE_LINEAR 2 |
#define | ACTIVE_NONLINEAR 1 |
#define | IWAVEMAXDATA 256 |
Typedefs | |
typedef void(*) | FD_TIMESTEP (std::vector< RDOM * > dom, bool fwd, int iv, void *fdpars) |
Time step function. | |
typedef int(*) | FD_MODELINIT (PARARRAY pars, FILE *stream, IMODEL &model) |
FD model internals initializer - creates appropriate data structure to serve as fdpars parameter struct for IMODEL specialization, initialize data members of IMODEL::fdpars using data from pars, grid, and dt. | |
typedef void(*) | FD_MODELDEST (void **specs) |
corresponding destructor | |
typedef int(*) | FD_TIMEGRID (PARARRAY *pars, FILE *stream, grid const &g, ireal &dt, ireal &rhs) |
Computes time step for internal simulation time grid. | |
typedef int(*) | FD_STENCIL (void *specs, FILE *stream, int ndim, IPNT gtype[RDOM_MAX_NARR], STENCIL *sten) |
creates FD stencils. | |
typedef void(*) | FD_CHECK (RDOM *dom, void *specs, FILE *stream) |
sanity check for coefficient fields - called after these are initialized, at beginning of time loop. | |
typedef void(*) | FD_LOOPDEF (int const *gmin, int const *gmax, float tmax, int input, FILE *stream, void *specs) |
optional modification of loop limits, based on run-time support information | |
typedef s_field | FIELD |
typedef s_iokeys | IOKEY |
typedef TSOpt::s_task_reln | TSOpt::TASK_RELN |
Functions | |
size_t | pow2 (int) |
void | TSOpt::IOTask (std::vector< TASK_RELN * > &tr, int order, bool fwd, IWaveInfo const &ic) |
void | TSOpt::IOTaskWriter (std::vector< TASK_RELN * > const &tr, ostream &str) |
typedef void(*) FD_TIMESTEP(std::vector< RDOM * > dom, bool fwd, int iv, void *fdpars) |
Time step function.
Interface for time steps of all orders of derivatives - order inferred from structure of input. The first argument is an array of RDOM s - each RDOM contains all static and dynamic fields interacting in the simulation. For the kth derivative (or adjoint derivative), 2k RDOM s (copies of the basic field setup) are required. The fwd flag indicates whether the computation is part of a forward (true) or adjoint (false) time loop. For multistep methods (for expl leapfrog), iv indicates the substep of the overall step being computed.
An example design: this function can determine the order of derivative by taking the log base 2 of dom.size(), extract the RARR s from the RDOM s, the C arrays and array metadata from the RARR s, and pass the necessary information for time stepping to low-level C functions.
[out] | dom | - std::vector<RDOM *> storing dynamic and static fields |
[in] | fwd | - flag for forward vs. backward (adjoint) time step |
[in] | iv | - internal (sub)step index |
[in] | fdpars | - opaque FD_MODEL parameter object |
typedef int(*) FD_MODELINIT(PARARRAY pars, FILE *stream, IMODEL &model) |
FD model internals initializer - creates appropriate data structure to serve as fdpars parameter struct for IMODEL specialization, initialize data members of IMODEL::fdpars using data from pars, grid, and dt.
The data members include (for example) scheme-characteristic finite difference coefficients, parameters and arrays for absorbing boundary conditions, arrays to indicate whether boundar faces are inter-domain or external for domain decomposition, and other parameters convenient for defining time steps.
This function acts as the constructor for a concrete subclass of IMODEL.
[in] | pars | - parameter array, assumed initialized. |
[in] | stream | - verbose output stream |
[in] | g | - primal simulation grid , initialized via I/O on first IOKEY |
[in] | dt | - time step, will have been initialized on call by prior call to FD_TIMEGRID |
[out] | specs | - fd parameter struct containing app-particular info such as coefficient arrays, Courant numbers, PML damping arrays, etc. |
typedef void(*) FD_MODELDEST(void **specs) |
typedef int(*) FD_TIMEGRID(PARARRAY *pars, FILE *stream, grid const &g, ireal &dt, ireal &rhs) |
Computes time step for internal simulation time grid.
This must be possible based on information contained in pars, eg. max wave velocity, scheme type and order, etc., and primal spatial grid g, eg. space steps. Also calculates multiplier to be used on RHS fields - dt for staggered grid, dt^2 for 2nd order, 2*dt for leapfrog, etc.
[in] | pars | - parameter array, assumed initialized. |
[in] | stream | - verbose output stream |
[in] | g | - primal simulation grid , initialized via I/O on first IOKEY |
[out] | dt | - time step |
[out] | rhs | - time step multiplier for RHS |
typedef int(*) FD_STENCIL(void *specs, FILE *stream, int ndim, IPNT gtype[RDOM_MAX_NARR], STENCIL *sten) |
creates FD stencils.
A stencil describes the dependencies between arrays participating in a finite difference scheme, in detail. IWAVE uses this information to create ghost cells for boundary condition implementation, and for data exchange between processors in a domain decomposition.
See documentation for stencil for a detailed description of stencil construction.
Preconditions - output stream open, model spatial dimension available, grid type and stencil dependency arrays initialized. Follows calls to set_grid_type and build_sten_dep.
Postconditions - stencil object initialized
[in] | specs | - IMODEL .specs struct, containing model-dependent info |
[in] | stream | - verbose output stream |
[in] | ndim | - model spatial dimension |
[in] | gtype | - grid type array - assigned from FIELDS - for each dim, 0 for primal, 1 for dual (staggered) |
[out] | sten | - stencil object |
sanity check for coefficient fields - called after these are initialized, at beginning of time loop.
Should throw RVLException for bound transgression or other sin. Parameters for tests stored in model->specs. These tests a priori refer only to the reference RDOM.
called in IWaveSim::run
typedef void(*) FD_LOOPDEF(int const *gmin, int const *gmax, float tmax, int input, FILE *stream, void *specs) |
optional modification of loop limits, based on run-time support information
gmin | - left index tuple for support of rhs input or output | |
gmax | - right index tuple for support of rhs input or output | |
tmax | - time extent of simulation | |
input | - set if data is input | |
stream | - optional verbose output | |
specs | - IMODEL specs object - private data of simulator class |
size_t pow2 | ( | int | ) |