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.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
background, cloPdeDiffusion, cloPdeL, cloPdeN, cloPdeSymmetric, density, dependent, diffcoeff, discretization, fitness, gwtHalt, initType, isSymmetric, linext, maxDensity, maxFitness, meanDensity, meanFitness, minDensity, minFitness, module, next, requestSymmetric, sorting, spaceFields inherited from class ODE
accuracy, cloAdjustedDynamics, cloDEAccuracy, cloDEdt, cloInit, cloTimeReversed, dependents, dstate, dt, dtTaken, dtTry, dyt, effRate, 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, markers, 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, double[][] scaledA) 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, double[] scaledD, double[][] scaledA) Dispatch diffusion to the PDE implementation appropriate for the current model type.private voiddiffuseStandard(int start, int end, double[] scaledD, double[][] scaledA, double[] minDens, double[] maxDens, double[] meanDens, double[] delta, double[] adv) Process sites in the general (asymmetric) case.private voiddiffuseSymmetric(int start, int end, double[] scaledD, double[][] scaledA, 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.double[][]getScaledAdvection(double stepSize) Compute advection scaling terms for the supplied time increment.Methods inherited from class PDE
calcInvDeltaX, check, diffuse, diffuse, diffuse, encodeFitness, encodeGeometry, encodeState, encodeTraits, getDiffusion, getDiscretization, getFitnessData, getFitnessHistogramData, getFitnessNameAt, getGeometry, getLinearExtension, getMeanFitness, getMeanFitnessAt, getMeanTraitAt, getMeanTraits, getMeanTraits, getScaledDiffusion, getStatus, getSymmetric, getTraitData, getTraitNameAt, incrementTime, init, isMonomorphic, isSymmetric, load, minmaxmean, next, normalizeMeanDensity, normalizeMeanFitness, parse, permitsTimeReversal, react, react, reset, resetDensity, resetFitness, restoreFitness, restoreGeometry, restoreState, restoreTraits, setConverged, setDensity, setDiscretization, setLinearExtension, setSymmetric, unload, update, updateDensity, updateFitnessMethods inherited from class ODE
checkConvergence, computeEffRates, deStep, getAccuracy, getDerivatives, getDt, getInitialTraits, getInitialTraits, getMaxFitness, getMaxScore, getMeanFitness, getMinFitness, getMinScore, getMonoScore, getNMean, getNMean, getOccupiedDensity, getStatus, getTimeStep, isDensity, isTimeReversed, normalizeState, setAccuracy, setAdjustedDynamics, setDt, setInitialTraits, setInitialTraits, setTimeReversed, updateBest, updateBestResponse, updateEcology, updateImitate, updateImitateBetter, updateProportional, updateThermalMethods inherited from class Model
debugStep, finishRelaxation, getCounter, getFixationData, getLogger, getMarkers, getMeanName, getMeanNames, getMode, getNextHalt, getNSamples, getNSpecies, getNStatisticsFailed, getNStatisticsSamples, getScoreNameAt, getSpecies, getTime, getTimeRelax, getTimeStop, getType, getUpdates, hasConverged, initStatisticsFailed, initStatisticsSample, isConnected, isContinuous, isDE, isIBS, isODE, isPDE, isRelaxing, isSDE, permitsDebugStep, permitsMode, permitsSampleStatistics, permitsUpdateStatistics, readStatisticsSample, relax, requestMode, resetState, resetStatisticsSample, setMode, setNSamples, setTimeRelax, setTimeStep, setTimeStop, startRelaxationMethods 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:
-
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).
- Parameters:
engine- the pacemaker for running the model- See Also:
-
-
Method Details
-
diffuse
public void diffuse(int start, int end, double[] scaledD, double[][] scaledA) Description copied from class:PDEDispatch diffusion to the PDE implementation appropriate for the current model type. -
diffuseSymmetric
private void diffuseSymmetric(int start, int end, double[] scaledD, double[][] scaledA, 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 indexscaledD- the diffusion coefficients scaled for the current time stepscaledA- the advection coefficients scaled for the current time stepminDens- 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[] scaledD, double[][] scaledA, 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 indexscaledD- the diffusion coefficients scaled for the current time stepscaledA- the advection coefficients scaled for the current time stepminDens- 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, double[][] scaledA) 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 sitescaledA- the advection coefficients scaled for the current time step
-
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
-
getScaledAdvection
public double[][] getScaledAdvection(double stepSize) Description copied from class:PDECompute advection scaling terms for the supplied time increment. Plain PDEs do not use advection and therefore returnnull.- Overrides:
getScaledAdvectionin classPDE- Parameters:
stepSize- the time increment for advection- Returns:
- the scaled advection coefficients or
null
-
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:
-