namespace mom_ale

Overview

This module contains the main regridding routines. More…

namespace mom_ale {

// global functions

subroutine, public ale_init(
    param_file param_file,
    GV GV,
    US US,
    max_depth max_depth,
    CS CS
    );

subroutine, public ale_register_diags(Time Time, G G, GV GV, US US, diag diag, CS CS);
subroutine, public adjustgridforintegrity(CS CS, G G, GV GV, h h);
subroutine, public ale_end(CS CS);

subroutine, public ale_main(
    G G,
    GV GV,
    US US,
    h h,
    u u,
    v v,
    tv tv,
    Reg Reg,
    CS CS,
    dt dt,
    frac_shelf_h frac_shelf_h
    );

subroutine, public ale_main_offline(G G, GV GV, h h, tv tv, Reg Reg, CS CS, dt dt);

subroutine, public ale_offline_inputs(
    CS CS,
    G G,
    GV GV,
    h h,
    tv tv,
    Reg Reg,
    uhtr uhtr,
    vhtr vhtr,
    Kd Kd,
    debug debug
    );

subroutine, public ale_offline_tracer_final(G G, GV GV, h h, tv tv, h_target h_target, Reg Reg, CS CS);

subroutine, public ale_build_grid(
    G G,
    GV GV,
    regridCS regridCS,
    remapCS remapCS,
    h h,
    tv tv,
    debug debug,
    frac_shelf_h frac_shelf_h
    );

subroutine, public ale_regrid_accelerated(
    CS CS,
    G G,
    GV GV,
    h h,
    tv tv,
    n n,
    u u,
    v v,
    Reg Reg,
    dt dt,
    dzRegrid dzRegrid,
    initial initial
    );

subroutine, public ale_remap_scalar(
    CS CS,
    G G,
    GV GV,
    nk_src nk_src,
    h_src h_src,
    s_src s_src,
    h_dst h_dst,
    s_dst s_dst,
    all_cells all_cells,
    old_remap old_remap
    );

subroutine, public pressure_gradient_plm(
    CS CS,
    S_t S_t,
    S_b S_b,
    T_t T_t,
    T_b T_b,
    G G,
    GV GV,
    tv tv,
    h h,
    bdry_extrap bdry_extrap
    );

subroutine, public pressure_gradient_ppm(
    CS CS,
    S_t S_t,
    S_b S_b,
    T_t T_t,
    T_b T_b,
    G G,
    GV GV,
    tv tv,
    h h,
    bdry_extrap bdry_extrap
    );

subroutine, public ale_initregridding(
    GV GV,
    US US,
    max_depth max_depth,
    param_file param_file,
    mdl mdl,
    regridCS regridCS
    );

real function, dimension(cs%nk+1), public ale_getcoordinate(CS CS);
character(len=20) function, public ale_getcoordinateunits(CS CS);
logical function, public ale_remap_init_conds(CS CS);
subroutine, public ale_update_regrid_weights(dt dt, CS CS);
subroutine, public ale_updateverticalgridtype(CS CS, GV GV);
subroutine, public ale_writecoordinatefile(CS CS, GV GV, directory directory);
subroutine, public ale_initthicknesstocoord(CS CS, G G, GV GV, h h);

} // namespace mom_ale

Detailed Documentation

This module contains the main regridding routines.

Regridding comprises two steps:

  1. Interpolation and creation of a new grid based on target interface densities (or any other criterion).

  2. Remapping of quantities between old grid and new grid.

Original module written by Laurent White, 2008.06.09

Global Functions

subroutine, public ale_init(
    param_file param_file,
    GV GV,
    US US,
    max_depth max_depth,
    CS CS
    )

This routine is typically called (from initialize_MOM in file MOM.F90) before the main time integration loop to initialize the regridding stuff. We read the MOM_input file to register the values of different regridding/remapping parameters.

Parameters:

param_file

Parameter file

gv

Ocean vertical grid structure

us

A dimensional unit scaling type

max_depth

The maximum depth of the ocean [Z ~> m].

cs

Module control structure

subroutine, public ale_register_diags(
    Time Time,
    G G,
    GV GV,
    US US,
    diag diag,
    CS CS
    )

Initialize diagnostics for the ALE module.

Parameters:

time

Time structure

g

Grid structure

us

A dimensional unit scaling type

gv

Ocean vertical grid structure

diag

Diagnostics control structure

cs

Module control structure

subroutine, public adjustgridforintegrity(CS CS, G G, GV GV, h h)

Crudely adjust (initial) grid for integrity. This routine is typically called (from initialize_MOM in file MOM.F90) before the main time integration loop to initialize the regridding stuff. We read the MOM_input file to register the values of different regridding/remapping parameters.

Parameters:

cs

Regridding parameters and options

g

Ocean grid informations

gv

Ocean vertical grid structure

h

Current 3D grid thickness that are to be adjusted [H ~> m or kg-2]

subroutine, public ale_end(CS CS)

End of regridding (memory deallocation). This routine is typically called (from MOM_end in file MOM.F90) after the main time integration loop to deallocate the regridding stuff.

Parameters:

cs

module control structure

subroutine, public ale_main(
    G G,
    GV GV,
    US US,
    h h,
    u u,
    v v,
    tv tv,
    Reg Reg,
    CS CS,
    dt dt,
    frac_shelf_h frac_shelf_h
    )

Takes care of (1) building a new grid and (2) remapping all variables between the old grid and the new grid. The creation of the new grid can be based on z coordinates, target interface densities, sigma coordinates or any arbitrary coordinate system.

Parameters:

g

Ocean grid informations

gv

Ocean vertical grid structure

us

A dimensional unit scaling type

h

Current 3D grid obtained after the last time step [H ~> m or kg m-2]

u

Zonal velocity field [L T-1 ~> m s-1]

v

Meridional velocity field [L T-1 ~> m s-1]

tv

Thermodynamic variable structure

reg

Tracer registry structure

cs

Regridding parameters and options

dt

Time step between calls to ALE_main()

frac_shelf_h

Fractional ice shelf coverage

subroutine, public ale_main_offline(
    G G,
    GV GV,
    h h,
    tv tv,
    Reg Reg,
    CS CS,
    dt dt
    )

Takes care of (1) building a new grid and (2) remapping all variables between the old grid and the new grid. The creation of the new grid can be based on z coordinates, target interface densities, sigma coordinates or any arbitrary coordinate system.

Parameters:

g

Ocean grid informations

gv

Ocean vertical grid structure

h

Current 3D grid obtained after the last time step [H ~> m or kg-2]

tv

Thermodynamic variable structure

reg

Tracer registry structure

cs

Regridding parameters and options

dt

Time step between calls to ALE_main()

subroutine, public ale_offline_inputs(
    CS CS,
    G G,
    GV GV,
    h h,
    tv tv,
    Reg Reg,
    uhtr uhtr,
    vhtr vhtr,
    Kd Kd,
    debug debug
    )

Regrid/remap stored fields used for offline tracer integrations. These input fields are assumed to have the same layer thicknesses at the end of the last offline interval (which should be a Zstar grid). This routine builds a grid on the runtime specified vertical coordinate.

Parameters:

cs

Regridding parameters and options

g

Ocean grid informations

gv

Ocean vertical grid structure

h

Layer thicknesses

tv

Thermodynamic variable structure

reg

Tracer registry structure

uhtr

Zonal mass fluxes

vhtr

Meridional mass fluxes

kd

Input diffusivites

debug

If true, then turn checksums

subroutine, public ale_offline_tracer_final(
    G G,
    GV GV,
    h h,
    tv tv,
    h_target h_target,
    Reg Reg,
    CS CS
    )

Remaps all tracers from h onto h_target. This is intended to be called when tracers are done offline. In the case where transports don’t quite conserve, we still want to make sure that layer thicknesses offline do not drift too far away from the online model.

Parameters:

g

Ocean grid informations

gv

Ocean vertical grid structure

h

Current 3D grid obtained after the last time step [H ~> m or kg-2]

tv

Thermodynamic variable structure

h_target

Current 3D grid obtained after last time step [H ~> m or kg-2]

reg

Tracer registry structure

cs

Regridding parameters and options

subroutine, public ale_build_grid(
    G G,
    GV GV,
    regridCS regridCS,
    remapCS remapCS,
    h h,
    tv tv,
    debug debug,
    frac_shelf_h frac_shelf_h
    )

Generates new grid.

Parameters:

g

Ocean grid structure

gv

Ocean vertical grid structure

regridcs

Regridding parameters and options

remapcs

Remapping parameters and options

tv

Thermodynamical variable structure

h

Current 3D grid obtained after the last time step [H ~> m or kg-2]

debug

If true, show the call tree

frac_shelf_h

Fractional ice shelf coverage

subroutine, public ale_regrid_accelerated(
    CS CS,
    G G,
    GV GV,
    h h,
    tv tv,
    n n,
    u u,
    v v,
    Reg Reg,
    dt dt,
    dzRegrid dzRegrid,
    initial initial
    )

For a state-based coordinate, accelerate the process of regridding by repeatedly applying the grid calculation algorithm.

Parameters:

cs

ALE control structure

g

Ocean grid

gv

Vertical grid

h

Original thicknesses [H ~> m or kg-2]

tv

Thermo vars (T/S/EOS)

n

Number of times to regrid

u

Zonal velocity [L T-1 ~> m s-1]

v

Meridional velocity [L T-1 ~> m s-1]

reg

Tracer registry to remap onto new grid

dt

Model timestep to provide a timescale for regridding [s]

dzregrid

Final change in interface positions

initial

Whether we’re being called from an initialization routine (and expect diagnostics to work)

subroutine, public ale_remap_scalar(
    CS CS,
    G G,
    GV GV,
    nk_src nk_src,
    h_src h_src,
    s_src s_src,
    h_dst h_dst,
    s_dst s_dst,
    all_cells all_cells,
    old_remap old_remap
    )

Remaps a single scalar between grids described by thicknesses h_src and h_dst. h_dst must be dimensioned as a model array with GVke layers while h_src can have an arbitrary number of layers specified by nk_src.

Parameters:

cs

Remapping control structure

g

Ocean grid structure

gv

Ocean vertical grid structure

nk_src

Number of levels on source grid

h_src

Level thickness of source grid [H ~> m or kg-2]

s_src

Scalar on source grid

h_dst

Level thickness of destination grid [H ~> m or kg-2]

s_dst

Scalar on destination grid

all_cells

If false, only reconstruct for non-vanished cells. Use all vanished layers otherwise (default).

old_remap

If true, use the old “remapping_core_w” method, otherwise use “remapping_core_h”.

subroutine, public pressure_gradient_plm(
    CS CS,
    S_t S_t,
    S_b S_b,
    T_t T_t,
    T_b T_b,
    G G,
    GV GV,
    tv tv,
    h h,
    bdry_extrap bdry_extrap
    )

Use plm reconstruction for pressure gradient (determine edge values) By using a PLM (limited piecewise linear method) reconstruction, this routine determines the edge values for the salinity and temperature within each layer. These edge values are returned and are used to compute the pressure gradient (by computing the densities).

Parameters:

g

ocean grid structure

gv

Ocean vertical grid structure

cs

module control structure

s_t

Salinity at the top edge of each layer

s_b

Salinity at the bottom edge of each layer

t_t

Temperature at the top edge of each layer

t_b

Temperature at the bottom edge of each layer

tv

thermodynamics structure

h

layer thickness [H ~> m or kg m-2]

bdry_extrap

If true, use high-order boundary extrapolation within boundary cells

subroutine, public pressure_gradient_ppm(
    CS CS,
    S_t S_t,
    S_b S_b,
    T_t T_t,
    T_b T_b,
    G G,
    GV GV,
    tv tv,
    h h,
    bdry_extrap bdry_extrap
    )

Use ppm reconstruction for pressure gradient (determine edge values) By using a PPM (limited piecewise linear method) reconstruction, this routine determines the edge values for the salinity and temperature within each layer. These edge values are returned and are used to compute the pressure gradient (by computing the densities).

Parameters:

g

ocean grid structure

gv

Ocean vertical grid structure

cs

module control structure

s_t

Salinity at the top edge of each layer

s_b

Salinity at the bottom edge of each layer

t_t

Temperature at the top edge of each layer

t_b

Temperature at the bottom edge of each layer

tv

thermodynamics structure

h

layer thicknesses [H ~> m or kg m-2]

bdry_extrap

If true, use high-order boundary extrapolation within boundary cells

subroutine, public ale_initregridding(
    GV GV,
    US US,
    max_depth max_depth,
    param_file param_file,
    mdl mdl,
    regridCS regridCS
    )

Initializes regridding for the main ALE algorithm.

Parameters:

gv

Ocean vertical grid structure

us

A dimensional unit scaling type

max_depth

The maximum depth of the ocean [Z ~> m].

param_file

parameter file

mdl

Name of calling module

regridcs

Regridding parameters and work arrays

real function, dimension(cs%nk+1), public ale_getcoordinate(CS CS)

Query the target coordinate interfaces positions.

Parameters:

cs

module control structure

character(len=20) function, public ale_getcoordinateunits(CS CS)

Query the target coordinate units.

Parameters:

cs

module control structure

logical function, public ale_remap_init_conds(CS CS)

Returns true if initial conditions should be regridded and remapped.

Parameters:

cs

module control structure

subroutine, public ale_update_regrid_weights(dt dt, CS CS)

Updates the weights for time filtering the new grid generated in regridding.

Parameters:

dt

Time-step used between ALE calls

cs

ALE control structure

subroutine, public ale_updateverticalgridtype(CS CS, GV GV)

Update the vertical grid type with ALE information. This subroutine sets information in the verticalGrid_type to be consistent with the use of ALE mode.

Parameters:

cs

ALE control structure

gv

vertical grid information

subroutine, public ale_writecoordinatefile(CS CS, GV GV, directory directory)

Write the vertical coordinate information into a file. This subroutine writes out a file containing any available data related to the vertical grid used by the MOM ocean model when in ALE mode.

Parameters:

cs

module control structure

gv

ocean vertical grid structure

directory

directory for writing grid info

subroutine, public ale_initthicknesstocoord(CS CS, G G, GV GV, h h)

Set h to coordinate values for fixed coordinate systems.

Parameters:

cs

module control structure

g

module grid structure

gv

Ocean vertical grid structure

h

layer thickness [H ~> m or kg m-2]