class LeewayObj(LagrangianArray): """Extending LagrangianArray with variables relevant for leeway objects. """ variables = LagrangianArray.add_variables([ ('objectType', {'dtype': np.int16, 'unit': '1', 'default': 0}), ('orientation', {'dtype': np.int16, 'unit': '1', 'default': 1}), ('jibeProbability', {'dtype': np.float32, 'unit': '1/h', 'default': 0.04}), ('downwindSlope', {'dtype': np.float32, 'unit': '%', 'default': 1}), ('crosswindSlope', {'dtype': np.float32, 'unit': '1', 'default': 1}), ('downwindOffset', {'dtype': np.float32, 'unit': 'cm/s', 'default': 0}), ('crosswindOffset', {'dtype': np.float32, 'unit': 'cm/s', 'default': 0}), ('downwindEps', {'dtype': np.float32, 'unit': 'cm/s', 'default': 0}), ('crosswindEps', {'dtype': np.float32, 'unit': 'cm/s', 'default': 0}) ])
class PelagicEgg(Lagrangian3DArray): """Extending Lagrangian3DArray with specific properties for pelagic eggs """ variables = LagrangianArray.add_variables([ ('diameter', { 'dtype': np.float32, 'units': 'm', 'default': 0.0014 }), # for NEA Cod ('neutral_buoyancy_salinity', { 'dtype': np.float32, 'units': '[]', 'default': 31.25 }), # for NEA Cod ('density', { 'dtype': np.float32, 'units': 'kg/m^3', 'default': 1028. }), ('hatched', { 'dtype': np.float32, 'units': '', 'default': 0. }) ])
class Radionuclide(Lagrangian3DArray): """Extending Lagrangian3DArray with specific properties for radionuclides """ variables = LagrangianArray.add_variables([ ('diameter', { 'dtype': np.float32, 'units': 'm', 'default': 0. }), ('neutral_buoyancy_salinity', { 'dtype': np.float32, 'units': '[]', 'default': 31.25 }), # for NEA Cod ('density', { 'dtype': np.float32, 'units': 'kg/m^3', 'default': 2650. }), # Mineral particles ('specie', { 'dtype': np.int32, 'units': '', 'default': 0 }) #, # ('transfer_rates1D', {'dtype':np.array(3, dtype=np.float32), # 'units': '1/s', # 'default': 0.}) ])
class Lagrangian3DArray(LagrangianArray): """Extending LagrangianArray for elements moving in 3 dimensions The Particle may be buoyant and/or subject to vertical mixing buoyant bahaviour is described by terminal velocity """ variables = LagrangianArray.add_variables([ ('wind_drift_factor', { 'dtype': np.float32, 'units': '1', 'description': 'Elements at surface are moved with this ' 'fraction of the vind vector, in addition to currents ' 'and Stokes drift', 'default': 0.02 }), ('terminal_velocity', { 'dtype': np.float32, 'units': 'm/s', 'description': 'Terminal rise/sinking velocity (buoyancy) ' 'in the ocean column', 'default': 0. }) ])
class ShipObject(LagrangianArray): """Extending LagrangianArray with variables relevant for leeway objects. """ variables = LagrangianArray.add_variables([ ('orientation', {'dtype': np.int16, 'unit': '1', 'default': 1}), ('length', {'dtype': np.float32, 'unit': 'm', 'default': 80}), ('height', {'dtype': np.float32, 'unit': 'm', 'default': 9}), ('draft', {'dtype': np.float32, # wet part of ship [m] 'unit': 'm', 'default': 4.0}), ('beam', {'dtype': np.float32, # width of ship 'unit': 'm', 'default': 10}), ('wind_drag_coeff', {'dtype': np.float32, # Cf 'unit': '1', 'default': 1}), ('water_drag_coeff', {'dtype': np.float32, # Cd 'unit': '1', 'default': 1}), ('jibeProbability', {'dtype': np.float32, 'unit': '1/h', 'default': 0.04}), ])
class Lagrangian3DArray(LagrangianArray): """Extending LagrangianArray for elements moving in 3 dimensions The Particle may be buoyant and/or subject to vertical mixing buoyant bahaviour is described by terminal velocity """ variables = LagrangianArray.add_variables([ ('terminal_velocity', {'dtype': np.float32, 'units': 'm/s', 'default': 0.})])
class PelagicPlankton(Lagrangian3DArray): """Extending Lagrangian3DArray with specific properties for pelagic eggs """ variables = LagrangianArray.add_variables([ ('diameter', {'dtype': np.float32, 'units': 'm', 'default': 0.0014}), # for NEA Cod ('neutral_buoyancy_salinity', {'dtype': np.float32, 'units': '[]', 'default': 31.25}), # for NEA Cod ('density', {'dtype': np.float32, 'units': 'kg/m^3', 'default': 1028.}), ('age_seconds', {'dtype': np.float32, 'units': 's', 'default': 0.}), ('hatched', {'dtype': np.int64, 'units': '', 'default': 0}), ('stage_fraction', {'dtype': np.float32, #KK: Added to track percentage of development time completed 'units': '', 'default': 0.}), ('length', {'dtype': np.float32, 'units': 'mm', 'default': 4.0}), ('weight', {'dtype': np.float32, 'units': 'mg', 'default': 0.08}), ('Eb', {'dtype': np.float32, 'units': 'ugEm2', 'default': 0.}), ('light', {'dtype': np.float32, 'units': 'ugEm2', 'default': 0.}), ('growth_rate', {'dtype': np.float32, 'units': '%', 'default': 0.}), ('ingestion_rate', {'dtype': np.float32, 'units': '%', 'default': 0.}), ('stomach_fullness', {'dtype': np.float32, 'units': '%', 'default': 0.}), ('stomach', {'dtype': np.float32, 'units': '', 'default': 0.}), ('survival', {'dtype': np.float32, 'units': '', 'default': 1.})])
class Oil(LagrangianArray): """Extending LagrangianArray with variables relevant for oil particles.""" variables = LagrangianArray.add_variables([ ('mass_oil', {'dtype': np.float32, 'units': 'kg', 'default': 1}), ('viscosity', {'dtype': np.float32, #'unit': 'mm2/s (centiStokes)', 'units': 'N s/m2 (Pa s)', 'default': 0.005}), ('density', {'dtype': np.float32, 'units': 'kg/m^3', 'default': 880}), ('wind_drift_factor', {'dtype': np.float32, 'units': '%', 'default': 0.03}), ('age_exposure_seconds', {'dtype': np.float32, 'units': 's', 'default': 0}), ('age_emulsion_seconds', {'dtype': np.float32, 'units': 's', 'default': 0}), ('bulltime', {'dtype': np.float32, 'units': 's', 'default': 0}), ('interfacial_area', {'dtype': np.float32, 'units': 'm2', 'default': 0}), ('mass_dispersed', {'dtype': np.float32, 'units': 'kg', 'default': 0}), ('mass_evaporated', {'dtype': np.float32, 'units': 'kg', 'default': 0}), ('mass_biodegraded', {'dtype': np.float32, 'units': 'kg', 'default': 0}), ('fraction_evaporated', {'dtype': np.float32, 'units': '%', 'default': 0}), ('water_fraction', {'dtype': np.float32, 'units': '%', 'default': 0}), ('oil_film_thickness', {'dtype': np.float32, 'units': 'm', 'default': 0.001})])
class ShipObject(LagrangianArray): """Extending LagrangianArray with variables relevant for leeway objects. """ variables = LagrangianArray.add_variables([ ('orientation', {'dtype': np.int16, 'units': '1', 'default': 1}), ('length', {'dtype': np.float32, 'units': 'm', 'min': 1, 'max': 500, 'description': 'Length of ship', 'level': OpenDriftSimulation.CONFIG_LEVEL_ESSENTIAL, 'default': 80}), ('height', {'dtype': np.float32, 'units': 'm', 'min': 1, 'max': 100, 'description': 'Total height of ship', 'level': OpenDriftSimulation.CONFIG_LEVEL_ESSENTIAL, 'default': 8}), ('draft', {'dtype': np.float32, # wet part of ship [m] 'units': 'm', 'min': 1, 'max': 20, 'description': 'Draft of ship (depth below water)', 'level': OpenDriftSimulation.CONFIG_LEVEL_ESSENTIAL, 'default': 4.0}), ('beam', {'dtype': np.float32, # width of ship 'min': 1, 'max': 50, 'units': 'm', 'description': 'Beam (width) of ship', 'level': OpenDriftSimulation.CONFIG_LEVEL_ESSENTIAL, 'default': 10}), ('wind_drag_coeff', {'dtype': np.float32, # Cf 'units': '1', 'default': 1}), ('water_drag_coeff', {'dtype': np.float32, # Cd 'units': '1', 'default': 1}), ('jibeProbability', {'dtype': np.float32, 'units': '1/h', 'default': 0.04}), ])
class LeewayObj(LagrangianArray): """Extending LagrangianArray with variables relevant for leeway objects. """ variables = LagrangianArray.add_variables([ ('object_type', {'dtype': np.uint16, 'units': '1', 'seed': False, 'default': 0}), ('orientation', {'dtype': np.uint8, 'units': '1', 'description': '0/1 is left/right of downwind. Randomly chosen at seed time', 'seed': False, 'default': 1}), ('jibe_probability', {'dtype': np.float32, 'units': '1/h', 'description': 'Probability per hour that an object may change orientation (jibing)', 'default': 0.04}), ('downwind_slope', {'dtype': np.float32, 'units': '%', 'seed': False, 'default': 1}), ('crosswind_slope', {'dtype': np.float32, 'units': '1', 'seed': False, 'default': 1}), ('downwind_offset', {'dtype': np.float32, 'units': 'cm/s', 'seed': False, 'default': 0}), ('crosswind_offset', {'dtype': np.float32, 'units': 'cm/s', 'seed': False, 'default': 0}), ('downwind_eps', {'dtype': np.float32, 'units': 'cm/s', 'seed': False, 'default': 0}), ('crosswind_eps', {'dtype': np.float32, 'units': 'cm/s', 'seed': False, 'default': 0}) ])
class TemplateElementType(LagrangianArray): """Extending LagrangianArray with relevant properties.""" # Define and name the properties which the elements shall have. # These are added to the four core properties (ID, lon, lat, z) # inherited from the basic/generic LagrangianArray class. # Property names may be freely chosen, but the "update" function (below) # will refer to the names in the specifications of the processes. variables = LagrangianArray.add_variables([('mass_oil', { 'dtype': np.float32, 'unit': 'kg' }), ('mass_evaporated', { 'dtype': np.float32, 'unit': 'kg', 'default': 0 }), ('mass_emulsion', { 'dtype': np.float32, 'unit': 'kg', 'default': 0 })])
class PelagicPlankton(Lagrangian3DArray): """Extending Lagrangian3DArray with specific properties for pelagic eggs """ variables = LagrangianArray.add_variables([('area', { 'dtype': np.float32, 'units': 'm2', 'default': 0. }), ('length', { 'dtype': np.float32, 'units': 'm', 'default': 0. }), ('diameter', { 'dtype': np.float32, 'units': 'm', 'default': 0. }), ('age_seconds', { 'dtype': np.float32, 'units': 's', 'default': 0. }), ('plantpart', { 'dtype': np.int32, 'units': '', 'default': 0 }), ('weight', { 'dtype': np.float32, 'units': 'kg', 'default': 0. }), ('volume', { 'dtype': np.float32, 'units': 'm3', 'default': 0. }), ('density', { 'dtype': np.float32, 'units': 'kg/m3', 'default': 0. })])
class PelagicShrimp(Lagrangian3DArray): """Extending Lagrangian3DArray with specific properties for pelagic eggs """ variables = LagrangianArray.add_variables([ ('diameter', { 'dtype': np.float32, 'units': 'm', 'default': 0.0003 }), # size eggs shrimps ('density', { 'dtype': np.float32, 'units': 'kg/m^3', 'default': 1028. }), # density eggs/larvae of shrimp ('age_seconds', { 'dtype': np.float32, 'units': 's', 'default': 0. }), ( 'duration', { 'dtype': np.float32, # Duration of the crustacean stages 'units': 's', 'default': 1.74 * 86400 }), ( 'stages_end_buoyancy', { 'dtype': np. int16, # Precise the stage when the buoyancy is no more efficient 'units': '[]', 'default': 2 }), ( 'TotalLength', { 'dtype': np. float32, # Size of the Post Larvae to use for the swimming /!\ could be explored for younger stages 'units': 'mm', 'default': 4.26 }), ( 'particles_velocity', { 'dtype': np. float32, # Swimming velocity used or not according to the configuration (see later) 'units': 'm/s', 'default': 0. }), ( 'stages', { 'dtype': np. int16, # Stages of the larvae (0 = eggs, e.g.:0=eggs, 1= Nauplius, 2=Protozoea, 3=Mysis, 4= Postlarvae) 'units': '[]', 'default': 0 }) ]) # Function to change the stages of the larvae if the 'duration' is lower than the time of drift def updateEggStages(self): self.elements.stages[ self.elements.age_seconds >= self.elements.duration] += 1 self.elements.stages[self.elements.stages >= 4] = 4 # Function to compute the duration of the stages according to Temperature of Water. The new duration will be added to the previous, # in order to have UpdateEggStages working well. def updateEggDuration(self): Temperature = self.environment.sea_water_temperature[np.all([ self.elements.age_seconds >= self.elements.duration, self.elements.stages < 4 ], 0)] B = np.array([1.59, 2.76, 3.77, 3.76]) stages = np.int16(self.elements.stages[np.all([ self.elements.age_seconds >= self.elements.duration, self.elements.stages < 4 ], 0)]) self.elements.duration[np.all([ self.elements.age_seconds >= self.elements.duration, self.elements.stages < 4 ], 0)] += ( np.exp(-0.076 * Temperature + B[stages]) ) * 86400 # Equation can be modified to fit other coefficients in case of PLD = a+b*Temperature. Could be modified to include Salinity
class LarvalFish(Lagrangian3DArray): """ Extending Lagrangian3DArray with specific properties for larval and juvenile stages of fish """ variables = LagrangianArray.add_variables([ ('diameter', { 'dtype': np.float32, 'units': 'm', 'default': 0.0014 }), # for NEA Cod ('neutral_buoyancy_salinity', { 'dtype': np.float32, 'units': '[]', 'default': 31.25 }), # for NEA Cod ('density', { 'dtype': np.float32, 'units': 'kg/m^3', 'default': 1028. }), ('survival', { 'dtype': np.float32, 'units': 'rate', 'default': 1.0 }), ('development', { 'dtype': np.float32, 'units': 'rate', 'default': 0.0 }), ('age_seconds', { 'dtype': np.float32, 'units': 's', 'default': 0. }), ('hatched', { 'dtype': np.int64, 'units': '', 'default': 0 }), ( 'age', { 'dtype': np. float32, # Added to track percentage of competency time completed 'units': '', 'default': 0. }), ('length', { 'dtype': np.float32, 'units': 'mm', 'default': 10.0 }), ('weight', { 'dtype': np.float32, 'units': 'mg', 'default': 0.08 }), ('light', { 'dtype': np.float32, 'units': 'ugEm2', 'default': 0. }), ('light_surface', { 'dtype': np.float32, 'units': 'ugEm2', 'default': 0. }), ('growth_rate', { 'dtype': np.float32, 'units': '%/dt', 'default': 0. }), ('survival', { 'dtype': np.float32, 'units': '', 'default': 1. }) ])