opendrift.models.eulerdrift.simulation
Attributes
Classes
The simulation. |
|
A simple explicit scheme for integrating the convection-equation. |
Module Contents
- opendrift.models.eulerdrift.simulation.logger
- class opendrift.models.eulerdrift.simulation.Simulation(grid)[source]
The simulation.
It contains the problem to be simulated, means to read necessary input variables, and the physics for modeling the convection of the initial conditions.
Convection:
Convection consists of advection and diffusion.
Diffusion is given by:
\[\frac{\partial U}{\partial t} = D \left( \frac{\partial^2 U}{\partial x^2} + \frac{\partial^2 U}{\partial y^2} \right)\]The convection equation is (wiki):
\[\frac{\partial c}{\partial t} = ...\]with the assumptions that:
the diffusion constant D is constant for the field,
and that the flow u is incompressible (i.e. has no divergence).
the equation simplifies to:
\[\frac{\partial c}{\partial t} = D \nabla^2 c - \mathbf{v} \cdot \nabla T\]where \(\nabla^2 = \triangle\) is the Laplacian.
- grid = None
Reference time datetime.Datetime
- t0 = None
Current time offset after t0
- t = 0.0
Diffusivity (\(m^2/s\)). E.g. between 0.01 and 0.1 for oil on the surface of the ocean (Matsuzakia et. al., 2017).
Decreasing diffusivity places stricter stability criteria on time step.
- D = 0.1
Porosity, rate of liquid volume to total volume (fraction of flux)
- rho = 1.0
List of readers
- readers = None
- classmethod new(lon0=10.0, lat0=65.0, res=10.0, shape=(100, 100))[source]
New simulation on a
grid.RegularGrid
.Args:
lon0: lower-left corner longitude
lat0: lower-left corner latitude
res: resolution (dx and dy)
shape: shape (size) of grid
- source_gaussian_blob(lon, lat, A=1.0, N=10, sigma=10.0)[source]
Source a Gaussian blob (2D normal distribution) at lon and lat with sigma (standard deviation, meters) radius.
Args:
lon, lat: Center coordinates, or \(\bar \mu\).
A: Amplitude.
N: Kernel size.
sigma: standard deviation (\(\sigma\)) in meters.
- abstract step(dt=None)[source]
Step the simulation.
Stepping the simulation involves applying diffusion and advection to the field.
Args:
dt: time delta (or use automatic).
- abstract integrate(dt=None, max_t=None, max_steps=None, observer=None)[source]
Run simulation until termination condition is met.
Args:
dt: override time step
observer: function to call after each step taking simulation object as first argument. the function may return False to stop the integration.
Termination conditions:
max_t: max time max_steps: max iterations
- class opendrift.models.eulerdrift.simulation.ExplSimulation(grid)[source]
Bases:
Simulation
A simple explicit scheme for integrating the convection-equation.
Forward difference in time
ndimage.laplace and np.gradient for spatial differences.
See also