8 Particles
Ichthyop particles (Particle.java
class) contains the attributes described in Table 8.1.
Variable | Description | Type | Units |
---|---|---|---|
x | Particle x position within the grid | float, \(\in [0, N_{x} - 1]\) | |
y | Particle y position within the grid | float, \(\in [0, N_{y} - 1]\) | |
z | Particle z position within the grid | float, \(\in [0, N_{z} - 1]\) | |
dx | Particle increment/decrement of x position | float | |
dy | Particle increment/decrement of y position | float | |
dz | Particle increment/decrement of z position | float | |
lat | Particle longitude | float | Degrees East |
lon | Particle latitude | float | Degrees North |
depth | Particle depth | float, < 0 | m |
index | Particle index | int, \(\in [0, N_{part} - 1]\) | |
age | Particle age | int | seconds |
deathCause | Mortality status | ParticleMortality |
|
living | True if a particle is alive | bool | |
locked | True if a particle is locked | bool | |
layers | List of additional particle layers | List<ParticleLayer> |
When using Ichthyop with additional processes, such as growth or DEB processes, additional variables need to be tracked.
This is done by firsr creating a layer class, which should extend the ParticleLayer.java
class. An exemple if provided as follows:
package org.previmer.ichthyop.particle;
public class LengthParticleLayer extends ParticleLayer {
private double length;
public LengthParticleLayer(IParticle particle) {
super(particle);
}
@Override
public void init() {
= 0;
length }
public double getLength() {
return length;
}
public void incrementLength(double dlength) {
+= dlength;
length }
}
This class contains additional particle attributes (here, for instance length
) and methods that can return and modify these attributes.
These new variables can be accessed as follows:
= (LengthParticleLayer) particle.getLayer(LengthParticleLayer.class);
LengthParticleLayer lengthLayer .setLength(length_init); lengthLayer
During the first call to the getLayer
method applied to a given layer class, the latter will be instanciated, initialized and add to the particle’s layers
list attribute, as shown below.