pylag.boundary_conditions module
A set of classes for handling particle interactions with horizontal and vertical boundaries.
Note
boundary_conditions is implemented in Cython. Only a small portion of the API is exposed in Python with accompanying documentation.
- class pylag.boundary_conditions.AbsBotVertBoundaryConditionCalculator
Bases:
VertBoundaryConditionCalculator
Absorbing bottom boundary vertical boundary condition calculator
If a particle crosses the bottom boundary, this is flagged and the particle is left in place. The calculator is intended for use in model setups where a basic absorbing bottom boundary is required. If a particle crosses the surface boundary it is reflected back into the domain back into the domain.
- class pylag.boundary_conditions.AbsorbingHorizBoundaryConditionCalculator
Bases:
HorizBoundaryConditionCalculator
Absorbing horizontal boundary condition calculator
Absorbing horizontal boundary condition calculators simply return a flag signifying the particle has beached permanently.
- class pylag.boundary_conditions.HorizBoundaryConditionCalculator
Bases:
object
Base class for horizontal boundary condition calculators
- apply_wrapper(self, DataReader data_reader, ParticleSmartPtr particle_old, ParticleSmartPtr particle_new)
Python friendly wrapper for apply()
In the apply() method must be implemented in the derived class. It should apply the selected horizontal boundary condition in response to a particle crossing a lateral boundary, and update the position of particle_new.
- Parameters
data_reader (pylag.data_reader.DataReader) – A concrete PyLag data reader which inherits from the base class pylag.data_reader.DataReader.
particle_old (pylag.particle_cpp_wrapper.ParticleSmartPtr) – The particle before it crossed the lateral boundary. The particle should lie inside the model domain.
particle_new (pylag.particle_cpp_Wrapper.ParticleSmartPtr) – The particle after it has crossed the lateral boundary. The particle should lie outside the model domain.
- Returns
Flag signifying whether or not the application was successful.
- Return type
- class pylag.boundary_conditions.RefHorizCartesianBoundaryConditionCalculator
Bases:
HorizBoundaryConditionCalculator
Reflecting horizontal boundary condition calculator for cartesian grids
Reflecting horizontal boundary condition calculators reflect particles back into the domain should they have crossed a model boundary. A particle may be reflected multiple times if the first or a subsequent reflection also leaves it outside of the domain. The position of the reflected particle is updated in place.
- class pylag.boundary_conditions.RefHorizGeographicBoundaryConditionCalculator
Bases:
HorizBoundaryConditionCalculator
Reflecting horizontal boundary condition calculator for geographic grids
- class pylag.boundary_conditions.RefVertBoundaryConditionCalculator
Bases:
VertBoundaryConditionCalculator
Reflecting vertical boundary condition calculator
The calculator reflects the particle back into the domain. It may apply multiple reflections if required. The particle’s position is updated in place.
- class pylag.boundary_conditions.RestoringHorizBoundaryConditionCalculator
Bases:
HorizBoundaryConditionCalculator
Restoring horizontal boundary condition calculator
Restoring horizontal boundary condition calculators simply move the particle back to its last valid position. They are agnostic with respect to the coordinate system being used.
- class pylag.boundary_conditions.VertBoundaryConditionCalculator
Bases:
object
- apply_wrapper(self, DataReader data_reader, DTYPE_FLOAT_t time, ParticleSmartPtr particle)
Python friendly wrapper for apply()
The apply() method must be implemented in the derived class. It should apply the selected vertical boundary condition in response to a particle crossing a vertical boundary, and update the position of particle_new.
- Parameters
data_reader (pylag.data_reader.DataReader) – A concrete PyLag data reader which inherits from the base class pylag.data_reader.DataReader.
time (float) – The time the crossing occurred.
particle (pylag.particle_cpp_wrapper.ParticleSmartPtr) – The particle after it has crossed the vertical boundary. The particle should lie inside the model domain.
- Returns
Flag signifying whether or not the application was successful.
- Return type
- pylag.boundary_conditions.get_horiz_boundary_condition_calculator(config)
Factory method for horizontal boundary condition calculators
- Parameters
config (ConfigParser) – PyLag configuraton object
- Returns
A horizontal boundary condition calculator
- Return type
HorizontalBoundaryConditionCalculator
- pylag.boundary_conditions.get_vert_boundary_condition_calculator(config)
Factory method for vertical boundary condition calculators
- Parameters
config (ConfigParser) – PyLag configuraton object
- Returns
A vertical boundary condition calculator
- Return type
VerticalBoundaryConditionCalculator