ChemicalDrift is an OpenDrift module for drift and fate of chemicals. The module is under development within the scope of the Horizon2020 project EMERGE Manuel Aghito. Norwegian Meteorological Institute. 2021. The initial version is based on Radionuclides module by Magne Simonsen

Module Contents



Extending Lagrangian3DArray with specific properties for chemicals


Chemical particle trajectory model based on the OpenDrift framework.



class opendrift.models.chemicaldrift.Chemical(**kwargs)[source]

Bases: opendrift.models.oceandrift.Lagrangian3DArray

Extending Lagrangian3DArray with specific properties for chemicals

Initialises a LagrangianArray with given properties.


Keyword arguments (kwargs) with names corresponding to the OrderedDict ‘variables’ of the class, and corresponding values. The values must be ndarrays of equal length, or scalars. All (or none) variables must be given, unless a default value is specified in the OrderedDict ‘variables’ An empty object may be created by giving no input.

class opendrift.models.chemicaldrift.ChemicalDrift(*args, **kwargs)[source]

Bases: opendrift.models.oceandrift.OceanDrift

Chemical particle trajectory model based on the OpenDrift framework.

Developed at MET Norway

Generic module for particles that are subject to vertical turbulent mixing with the possibility for positive or negative buoyancy

Particles could be e.g. oil droplets, plankton, or sediments

Chemical functionality include interactions with solid matter (particles and sediments) through transformation processes, implemented with stochastic approach for dynamic partitioning.

Under construction.

Initialise OpenDriftSimulation

seed: integer or None. A given integer will yield identical

random numbers drawn each simulation. Random numbers are e.g. used to distribute particles spatially when seeding, and may be used by modules (subclasses) for e.g. diffusion. Specifying a fixed value (default: 0) is useful for sensitivity tests. With seed = None, different random numbers will be drawn for subsequent runs, even with identical configuration/input.

iomodule: name of module used to export data

default: netcdf, see for more alternatives. iomodule is module/filename without preceeding io_

loglevel: set to 0 (default) to retrieve all debug information.

Provide a higher value (e.g. 20) to receive less output. Use the string ‘custom’ to configure logging from outside.

logtime: if True, a time stamp is given for each logging line.

logtime can also be given as a python time specifier (e.g. ‘%H:%M:%S’)


Alias of seed_from_DataArray method for backward compatibility

seed_elements(*args, **kwargs)[source]

Seed elements with given position(s), time and properties.

lon: scalar or array

central longitude(s).

lat: scalar or array

central latitude(s).

radius: scalar or array

radius in meters around each lon-lat pair, within which particles will be randomly seeded.

number: integer, total number of particles to be seeded

If number is None, the number of elements is the length of lon/lat or time if these are arrays. Otherwise the number of elements are obtained from the config-default.

time: datenum or list

The time at which particles are seeded/released. If time is a list with two elements, elements are seeded continously from start/first to end/last time. If time is a list with more than two elements, the number of elements is equal to len(time) and are seeded as a time series.

radius_type: string

If ‘gaussian’ (default), the radius is the standard deviation in x-y-directions. If ‘uniform’, elements are spread evenly and always inside a circle with the given radius.


keyword arguments containing properties/attributes and values corresponding to the actual particle type (ElementType). These are forwarded to the ElementType class. All properties for which there are no default value must be specified.

tempcorr(mode, DeltaH, T_C, Tref_C)[source]

Temperature correction using Arrhenius or Q10 method

salinitycorr(Setschenow, Temperature, Salinity)[source]

Salinity correction

calc_KOC_sedcorr(KOC_sed_initial, KOC_sed_n, pKa_acid, pKa_base, KOW, pH_sed, diss)[source]

Calculate correction of KOC due to pH of sediments

calc_KOC_watcorrSPM(KOC_SPM_initial, KOC_sed_n, pKa_acid, pKa_base, KOW, pH_water_SPM, diss)[source]

Calculate correction of KOC due to pH of water for SPM

calc_KOC_watcorrDOM(KOC_DOM_initial, KOC_DOM_n, pKa_acid, pKa_base, KOW, pH_water_DOM, diss)[source]

Calculate correction of KOC due to pH of water for DOM


Initialization of background values in the transfer rates 2D array.

update_terminal_velocity(Tprofiles=None, Sprofiles=None, z_index=None)[source]

Calculate terminal velocity for Pelagic Egg

according to S. Sundby (1983): A one-dimensional model for the vertical distribution of pelagic fish eggs in the mixed layer Deep Sea Research (30) pp. 645-661

Method copied from ibm.f90 module of LADIM: Vikebo, F., S. Sundby, B. Aadlandsvik and O. Otteraa (2007), Fish. Oceanogr. (16) pp. 216-228


Pick out the correct row from transfer_rates for each element. Modify the transfer rates according to local environmental conditions


Check if transformation processes shall occur Do transformation (change value of self.elements.specie) Update element properties for the transformed elements

sorption_to_sediments(sp_in=None, sp_out=None)[source]

Update Chemical properties when sorption to sediments occurs

desorption_from_sediments(sp_in=None, sp_out=None)[source]

Update Chemical properties when desorption from sediments occurs

update_chemical_diameter(sp_in=None, sp_out=None)[source]

Update the diameter of the chemicals when specie is changed


Change partitioning of chemicals that reach bottom due to settling. particle specie -> sediment specie


Simple method to estimate the resuspension of sedimented particles, checking whether the current speed near the bottom is above a critical velocity Sediment species -> Particle specie




Update positions and properties of Chemical particles.


Print a summary of the simulation: number of elements, number of transformations and final speciation

write_netcdf_chemical_density_map(filename, pixelsize_m='auto', zlevels=None, deltat=None, density_proj=None, llcrnrlon=None, llcrnrlat=None, urcrnrlon=None, urcrnrlat=None, mass_unit=None, time_avg_conc=False, horizontal_smoothing=False, smoothing_cells=0, reader_sea_depth=None, landmask_shapefile=None, origin_marker=None)[source]

Write netCDF file with map of Chemical species densities and concentrations

get_chemical_density_array(pixelsize_m, z_array, density_proj=None, llcrnrlon=None, llcrnrlat=None, urcrnrlon=None, urcrnrlat=None, weight=None, origin_marker=None)[source]

compute a particle concentration map from particle positions Use user defined projection (density_proj=<proj4_string>) or create a lon/lat grid (density_proj=None)

get_pixel_mean_depth(lons, lats)[source]
horizontal_smooth(a, n=0)[source]
emission_factors(scrubber_type, chemical_compound)[source]

Emission factors for heavy metals and PAHs in open loop and closed loop scrubbers

Hermansson et al 2021

bilge water, gray water, anti fouling paint, sewage, food waster

from EMERGE Deliverable 2.1

ash (atmospheric depositions) from EMERGE Deliverable 3.2

seed_from_DataArray(steam, lowerbound=0, higherbound=np.inf, radius=0, scrubber_type='open_loop', chemical_compound='Copper', mass_element_ug=100000.0, number_of_elements=None, **kwargs)[source]

Seed elements based on a dataarray with STEAM emission data

steam: dataarray with steam emission data, with coordinates
  • latitude (latitude) float32

  • longitude (longitude) float32

  • time (time) datetime64[ns]

radius: scalar, unit: meters lowerbound: scalar, elements with lower values are discarded


Chemical parameters for a selection of PAHs: Naphthalene, Phenanthrene, Fluorene, Benzo-a-anthracene, Benzo-a-pyrene, Dibenzo-ah-anthracene

Data collected from literature by Isabel Hanstein (University of Heidelberg / Norwegian Meteorological Insitute) Mattia Boscherini, Loris Calgaro (University Ca’ Foscari, Venezia) Manuel Aghito (Norwegian Meteorological Institute / University of Bergen)

plot_mass(legend=['dissolved', 'SPM', 'sediment'], mass_unit='g', time_unit='hours', title=None, filename=None, start_date=None)[source]

Plot chemical mass distribution between the different species legend list of specie labels, for example [‘dissolved’,’SPM’,’sediment’] mass_unit ‘g’,’mg’,’ug’ time_unit ‘seconds’, ‘minutes’, ‘hours’ , ‘days’ title figure title string