Class Advection
- All Implemented Interfaces:
DModel, CLOProvider
Important: Currently multi-species modules are not supported by PDE models.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from class Model
Model.HasDE, Model.HasIBS -
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 CLOptionCommand line option to set the advection coefficients of every trait against all others.protected booleanThe flag to indicate whether advection coefficients are non-vanishing.Fields inherited from class PDE
alpha, background, cloPdeDiffusion, cloPdeL, cloPdeN, cloPdeSymmetric, density, dependent, diffcoeff, discretization, fitness, gwtHalt, initType, isSymmetric, linext, maxDensity, maxFitness, meanDensity, meanFitness, minDensity, minFitness, module, next, requestSymmetric, sorting, space, supervisorFields inherited from class ODE
accuracy, cloAdjustedDynamics, cloDEAccuracy, cloDEdt, cloInit, cloTimeReversed, dependents, dstate, dt, dtTaken, dtTry, dyt, forward, ft, idxSpecies, invFitRange, isAdjustedDynamics, isDensity, monoStop, mutation, names, nDim, staticfit, y0, yout, ytFields 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 TypeMethodDescriptionprivate voidaddAdvectionContribution(double[] sn, double[] si, double[] delta, double[] adv) Adds the advection contribution of a single neighbor (si) to the accumulator adv for the focal site with state sn using precomputed delta = 1 + si - sn.protected voidcheckDt()Helper method to check whether the time increment,ODE.dt, is acceptable.voidcollectCLO(CLOParser parser) All providers of command line options must implement this method to collect their options.voiddiffuse(int start, int end) / GWT.log("react: meanDensity="+meanDensity);private voiddiffuseStandard(int start, int end, double[] minDens, double[] maxDens, double[] meanDens, double[] delta, double[] adv) Process sites in the general (asymmetric) case.private voiddiffuseSymmetric(int start, int end, double[] minDens, double[] maxDens, double[] meanDens, double[] delta, double[] adv) Process sites in the symmetric case (neighbour ordering must be sorted).double[][]Gets the 2D advection array for the advection coefficients of each trait against every other one.voidinitDiffusion(double deltat) Helper method to initialize the effective rate of diffusion for the time incrementdt.Methods inherited from class PDE
calcInvDeltaX, check, encodeFitness, encodeGeometry, encodeState, encodeTraits, 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, restoreTraits, setConverged, setDensity, setDiscretization, setLinearExtension, setSymmetric, unload, update, updateDensity, updateFitness, useSchedulingMethods inherited from class ODE
checkConvergence, deStep, getAccuracy, getDerivatives, getDt, getInitialTraits, getInitialTraits, getMaxFitness, getMaxScore, getMeanFitness, getMinFitness, getMinScore, getMonoScore, getNMean, getNMean, getStatus, isDensity, isTimeReversed, normalizeState, setAccuracy, setAdjustedDynamics, setDt, setInitialTraits, setInitialTraits, setTimeReversed, updateBest, updateBestResponse, updateEcology, updateImitate, updateImitateBetter, updateProportional, updateThermalMethods inherited from class Model
debugStep, getCounter, getFixationData, getLogger, getMeanName, getMeanNames, getMode, getNextHalt, getNSamples, getNSpecies, getNStatisticsFailed, getNStatisticsSamples, getScoreNameAt, getSpecies, getTime, getTimeRelax, getTimeStep, getTimeStop, getType, getUpdates, hasConverged, initStatisticsFailed, initStatisticsSample, isConnected, isContinuous, isRelaxing, permitsDebugStep, permitsMode, permitsSampleStatistics, permitsUpdateStatistics, readStatisticsSample, relax, requestMode, resetState, resetStatisticsSample, setMode, setNSamples, setTimeRelax, setTimeStep, setTimeStopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 coefficientsadvcoeffut also on the time incrementdtand the linear extension,PDE.linext.- See Also:
-
doAdvection
protected boolean doAdvectionThe flag to indicate whether advection coefficients are non-vanishing. Iffalsesimply delegate numerical calculations tosuper. -
cloPdeAdvection
Command line option to set the advection coefficients of every trait against all others.
-
-
Constructor Details
-
Advection
Constructs a new model for the numerical integration of the system of partial differential equations representing the dynamics specified by theModulemoduleusing theEvoLudopacemakerengineto 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
-
diffuseSymmetric
private void diffuseSymmetric(int start, int end, double[] minDens, double[] maxDens, double[] meanDens, double[] delta, double[] adv) Process sites in the symmetric case (neighbour ordering must be sorted).- Parameters:
start- the starting site indexend- the ending site indexminDens- the minimum densities (updated)maxDens- the maximum densities (updated)meanDens- the mean densities (updated)delta- helper array to store differencesadv- helper array to store advection contributions
-
diffuseStandard
private void diffuseStandard(int start, int end, double[] minDens, double[] maxDens, double[] meanDens, double[] delta, double[] adv) Process sites in the general (asymmetric) case.- Parameters:
start- the starting site indexend- the ending site indexminDens- the minimum densities (updated)maxDens- the maximum densities (updated)meanDens- the mean densities (updated)delta- helper array to store differencesadv- helper array to store advection contributions
-
addAdvectionContribution
private void addAdvectionContribution(double[] sn, double[] si, double[] delta, double[] adv) Adds the advection contribution of a single neighbor (si) to the accumulator adv for the focal site with state sn using precomputed delta = 1 + si - sn.- Parameters:
sn- the state of the focal sitesi- the state of the neighboring sitedelta- the precomputed delta = 1 + si - snadv- the advection accumulator for the focal site
-
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
-
initDiffusion
public void initDiffusion(double deltat) Description copied from class:PDEHelper method to initialize the effective rate of diffusion for the time incrementdt.Note: This method needs to be public to permit access by
PDESupervisorGWTandPDESupervisorJRE- Overrides:
initDiffusionin classPDE- Parameters:
deltat- the time increment for diffusion
-
checkDt
-
collectCLO
Description copied from interface:CLOProviderAll 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, theparserissues 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:
collectCLOin interfaceCLOProvider- Overrides:
collectCLOin classPDE- Parameters:
parser- the reference to parser that manages command line options- See Also:
-