Class Advection

Object
Model
ODE
PDE
Advection
All Implemented Interfaces:
Discrete, CLOProvider

public class Advection extends PDE
Numerical integration of partial differential equations for reaction-diffusion-advection systems based on Euler's method (fixed step size).

Important: Currently multi-species modules are not supported by PDE models.

Author:
Christoph Hauert
  • Field Details

    • advcoeff

      protected double[][] advcoeff
      The 2D array of advection coefficients for each trait against all others.
      See Also:
    • beta

      protected double[][] beta
      Helper variable to store the effective advection coefficients. This depends not only on the advection coefficients advcoeff ut also on the time increment dt and the linear extension, PDE.linext.
      See Also:
    • doAdvection

      protected boolean doAdvection
      The flag to indicate whether advection coefficients are non-vanishing. If false simply delegate numerical calculations to super.
    • cloPdeAdvection

      public final CLOption cloPdeAdvection
      Command line option to set the advection coefficients of every trait against all others.
      See Also:
  • Constructor Details

    • Advection

      public Advection(EvoLudo engine)
      Constructs a new model for the numerical integration of the system of partial differential equations representing the dynamics specified by the Module module using the EvoLudo pacemaker engine to control the numerical evaluations. The integrator implements reaction-diffusion-advection steps based on Euler's method (fixed step size).

      Important: for reproducibility the shared random number generator should be used (here only used to generate random initial configurations).

      Note: requires a supervisor that matches the implementation, i.e. JRE or GWT, respectively, to properly deal with multiple threads or scheduling.

      Parameters:
      engine - the pacemaker for running the model
      See Also:
  • Method Details

    • diffuse

      public void diffuse(int start, int end)
      Description copied from class: PDE
      Diffusion step. Update cells with indices between start (including) and end (excluding). In order to preserve symmetry, if requested and possible, the neighbouring cells are sorted according to their density before the diffusion step is performed. The sorting is fairly expensive in terms of CPU time but it doesn't matter whether the sorting is ascending or descending.

      Note: At the end, the state in next is unchanged, the new density distribution is in density and the fitness is untouched/unused.

      Important: must be thread safe for JRE. In particular, no memory can be shared with anyone else!

      Overrides:
      diffuse in class PDE
      Parameters:
      start - the index of the first cell (including)
      end - the index of the last cell (excluding)
    • setAdvection

      public void setAdvection(double[][] ac)
      Sets the advection coefficients for each trait against every other one.
      Parameters:
      ac - the 2D array of advection coefficients
      See Also:
    • getAdvection

      public double[][] getAdvection()
      Gets the 2D advection array for the advection coefficients of each trait against every other one.
      Returns:
      the 2D array of advection coefficients
    • doAdvection

      public boolean doAdvection()
      Gets whether the model has non-vanishing advection coefficients. Otherwise the numerical integration is simply delegated to super.
      Returns:
      true if advection includes non-zero coefficients
    • initDiffusion

      public void initDiffusion(double deltat)
      Description copied from class: PDE
      Helper method to initialize the effective rate of diffusion for the time increment dt.

      Note: This method needs to be public to permit access by PDESupervisorGWT and PDESupervisorJRE

      Overrides:
      initDiffusion in class PDE
      Parameters:
      deltat - the time increment for diffusion
    • checkDt

      protected void checkDt()
      Description copied from class: PDE
      Helper method to check whether the time increment, ODE.dt, is acceptable. If it is too large the diffusion step runs into numerical issues. If dt needs to be decreased a warning is emitted.
      Overrides:
      checkDt in class PDE
    • collectCLO

      public void collectCLO(CLOParser parser)
      Description copied from interface: CLOProvider
      All providers of command line options must implement this method to collect their options.

      Each command line option is (uniquely) identified by it's name (see CLOption.getName()), which corresponds to the long version of the option. If an attempt is made to add an option with a name that already exists, the parser issues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and call super.collectCLO(CLOParser) at the end such that subclasses are able to override command line options specified in a parental class.

      Override this method in subclasses to add further command line options. Subclasses must make sure that they include a call to super.

      Specified by:
      collectCLO in interface CLOProvider
      Overrides:
      collectCLO in class PDE
      Parameters:
      parser - the reference to parser that manages command line options
      See Also: