pydda.cost_functions.calculate_mass_continuity#
- pydda.cost_functions.calculate_mass_continuity(u, v, w, z, dx, dy, dz, coeff=1500.0, anel=1, fluid=None)[source]#
Calculates the mass continuity cost function by taking the divergence of the wind field. All arrays in the given lists must have the same dimensions and represent the same spatial coordinates. :Parameters: * u (Float array) – Float array with u component of wind field
v (Float array) – Float array with v component of wind field
w (Float array) – Float array with w component of wind field
dx (float) – Grid spacing in x direction.
dy (float) – Grid spacing in y direction.
dz (float) – Grid spacing in z direction.
z (Float array (1D)) – 1D Float array with heights of grid
coeff (float) – Constant controlling contribution of mass continuity to cost function
anel (int) – = 1 use anelastic approximation, 0=don’t
fluid (3D bool array or None) – Mask of grid points that lie above the terrain surface, as returned by
pydda.terrain.terrain_ghost_cells(). Points below the terrain do not contribute to the divergence penalty. Set to None to apply the constraint everywhere, which is the behavior without terrain.
- Returns:
J (float) – value of mass continuity cost function