Class Advection
- All Implemented Interfaces:
Discrete
,CLOProvider
Important: Currently multi-species modules are not supported by PDE models.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from class PDE
PDE.HasPDE, PDE.InitType
Nested classes/interfaces inherited from class ODE
ODE.HasDE, ODE.HasODE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[][]
The 2D array of advection coefficients for each trait against all others.protected double[][]
Helper variable to store the effective advection coefficients.final CLOption
Command line option to set the advection coefficients of every trait against all others.protected boolean
The flag to indicate whether advection coefficients are non-vanishing.Fields inherited from class PDE
alpha, cloPdeDiffusion, cloPdeL, cloPdeN, cloPdeSymmetric, density, dependent, diffcoeff, discretization, fitness, gwtHalt, initType, isSymmetric, linext, maxDensity, maxFitness, meanDensity, meanFitness, minDensity, minFitness, module, next, requestSymmetric, sorting, space, supervisor
Fields inherited from class ODE
accuracy, cloAdjustedDynamics, cloDEAccuracy, cloDEdt, cloInit, cloTimeReversed, dependents, dstate, dt, dtTaken, dtTry, dyt, forward, ft, idxSpecies, invFitRange, isAdjustedDynamics, monoStop, mutation, names, nDim, rates, staticfit, y0, yout, yt
Fields inherited from class Model
cloSamples, cloTimeRelax, cloTimeStep, cloTimeStop, connect, converged, engine, fixData, isMultispecies, isRelaxing, logger, mode, nSamples, nSpecies, nStatisticsFailed, nStatisticsSamples, rng, species, statisticsSampleNew, time, timeRelax, timeStep, timeStop, type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkDt()
Helper method to check whether the time increment,ODE.dt
, is acceptable.void
collectCLO
(CLOParser parser) All providers of command line options must implement this method to collect their options.void
diffuse
(int start, int end) Diffusion step.boolean
Gets whether the model has non-vanishing advection coefficients.double[][]
Gets the 2D advection array for the advection coefficients of each trait against every other one.void
initDiffusion
(double deltat) Helper method to initialize the effective rate of diffusion for the time incrementdt
.void
setAdvection
(double[][] ac) Sets the advection coefficients for each trait against every other one.Methods inherited from class PDE
calcInvDeltaX, check, encodeFitness, encodeGeometry, encodeState, encodeStrategies, getDiffusion, getDiscretization, getFitnessData, getFitnessHistogramData, getFitnessNameAt, getGeometry, getLinearExtension, getMeanFitness, getMeanFitnessAt, getMeanTraitAt, getMeanTraits, getMeanTraits, getStatus, getSymmetric, getTraitData, getTraitNameAt, incrementTime, init, isMonomorphic, isSymmetric, load, minmaxmean, next, normalizeMeanDensity, normalizeMeanFitness, parse, permitsTimeReversal, react, reset, resetDensity, resetFitness, restoreFitness, restoreGeometry, restoreState, restoreStrategies, setConverged, setDensity, setDiffusion, setDiscretization, setLinearExtension, setSymmetric, unload, update, updateDensity, updateFitness, useScheduling
Methods inherited from class ODE
checkConvergence, deStep, getAccuracy, getDerivatives, getDt, getInitialTraits, getInitialTraits, getMaxFitness, getMaxScore, getMeanFitness, getMinFitness, getMinScore, getMonoScore, getNMean, getNMean, isDensity, isTimeReversed, normalizeState, setAccuracy, setAdjustedDynamics, setDt, setInitialTraits, setInitialTraits, setTimeReversed, updateBest, updateBestResponse, updateEcology, updateImitate, updateImitateBetter, updateProportional, updateThermal
Methods inherited from class Model
debugStep, getCounter, getFixationData, getLogger, getMeanName, getMeanNames, getMode, getNextHalt, getNSamples, getNSpecies, getNStatisticsFailed, getNStatisticsSamples, getScoreNameAt, getSpecies, getTime, getTimeRelax, getTimeStep, getTimeStop, getType, hasConverged, initStatisticsFailed, initStatisticsSample, isConnected, isContinuous, isDE, isIBS, isODE, isPDE, isRelaxing, isSDE, isType, permitsDebugStep, permitsMode, permitsSampleStatistics, permitsUpdateStatistics, readStatisticsSample, relax, requestMode, resetStatisticsSample, setMode, setNSamples, setTimeRelax, setTimeStep, setTimeStop
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface CLOProvider
adjustCLO
-
Field Details
-
advcoeff
protected double[][] advcoeffThe 2D array of advection coefficients for each trait against all others.- See Also:
-
beta
protected double[][] betaHelper variable to store the effective advection coefficients. This depends not only on the advection coefficientsadvcoeff
ut also on the time incrementdt
and the linear extension,PDE.linext
.- See Also:
-
doAdvection
protected boolean doAdvectionThe flag to indicate whether advection coefficients are non-vanishing. Iffalse
simply delegate numerical calculations tosuper
. -
cloPdeAdvection
Command line option to set the advection coefficients of every trait against all others.- See Also:
-
-
Constructor Details
-
Advection
Constructs a new model for the numerical integration of the system of partial differential equations representing the dynamics specified by theModule
module
using theEvoLudo
pacemakerengine
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 betweenstart
(including) andend
(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 indensity
and the fitness is untouched/unused.Important: must be thread safe for JRE. In particular, no memory can be shared with anyone else!
-
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 tosuper
.- 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 incrementdt
.Note: This method needs to be public to permit access by
PDESupervisorGWT
andPDESupervisorJRE
- Overrides:
initDiffusion
in classPDE
- 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. Ifdt
needs to be decreased a warning is emitted. -
collectCLO
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, theparser
issues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and callsuper.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 interfaceCLOProvider
- Overrides:
collectCLO
in classPDE
- Parameters:
parser
- the reference to parser that manages command line options- See Also:
-