Recon1d_type module reference

A generic type for vertical 1D reconstructions

Data Types

Recon1d

The base class for implementations of 1D reconstructions

Procedure Interfaces

i_init

Initialize a 1D reconstruction for n cells

i_reconstruct

Calculate a 1D reconstructions based on h(:) and u(:)

i_average

Average between xa and xb for cell k of a 1D reconstruction [A]

i_f

Point-wise value of reconstruction [A]

i_dfdx

Point-wise value of derivative reconstruction [A]

i_x

Point-wise solver for x: f(x)=t [nondim]

i_check_reconstruction

Returns true if some inconsistency is detected, false otherwise

i_destroy

Deallocate a 1D reconstruction

i_init_parent

Second interface to init(), or to parent init()

i_reconstruct_parent

Second interface to reconstruct(), or to parent reconstruct()

i_unit_tests

Runs reconstruction unit tests and returns True for any fails, False otherwise

Functions/Subroutines

x

Solve for x such that f(x)=t

remap_to_sub_grid

Remaps the column to subgrid h_sub

a_set_debug

Turns on debugging

Detailed Description

Generic vertical reconstruction type

A class to describe generic reconstruction in 1-D. This module has no implementations but defines the interfaces for members that implement a reconstruction.

e.g. a chain of derived reconstructions might look like Recon1d_type <- Recond1d_XYZ <- Recon1d_XYZ_v2 where Recon1d_type - defines the interfaces (this module) Recon1d_XYZ - extends Recon1d_type, implements the XYZ reconstruction in reconstruct(), and reconstruc_parent() -> reconstruct() of the same Recon1d_XYZ module Recon1d_XYZ_v2 - implements a slight variant of Recon1d_XYZ via reconstruct() but reconstruc_parent() is not redefined so that it still is defined by Recon1d_XYZ

The schemes that use this structure are described in Vertical Reconstruction

Type Documentation

type, abstract :: Recon1d

The base class for implementations of 1D reconstructions

Parameters
  • n

    Number of cells in column

  • u_mean

    Cell mean [A]

  • h_neglect

    A negligibly small width used in cell reconstructions in the same units as h [H]

  • x_tolerance

    Solver tolerance for x in element (0,1) [nondim]

  • check

    If true, enable some consistency checking

  • debug

    If true, dump info as calculations are made (do not enable)

Procedure Interface Documentation

subroutine i_init(this, n, h_neglect, check)

Initialize a 1D reconstruction for n cells

Parameters
  • this [out]

    This reconstruction

  • n [in]

    Number of cells in this column

  • h_neglect [in]

    A negligibly small width used in cell reconstructions [H]

  • check [in]

    If true, enable some consistency checking

subroutine i_reconstruct(this, h, u)

Calculate a 1D reconstructions based on h(:) and u(:)

Parameters
  • this [inout]

    This reconstruction

  • h [in]

    Grid spacing (thickness), typically in [H]

  • u [in]

    Cell mean values [A]

real function i_average(this, k, xa, xb)

Average between xa and xb for cell k of a 1D reconstruction [A]

It is assumed that 0<=xa<=1, 0<=xb<=1, and xa<=xb

Parameters
  • this [in]

    This reconstruction

  • k [in]

    Cell number

  • xa [in]

    Start of averaging interval on element (0 to 1)

  • xb [in]

    End of averaging interval on element (0 to 1)

real function i_f(this, k, x)

Point-wise value of reconstruction [A]

The function is only valid for 0 <= x <= 1. x is effectively clipped to this range.

Parameters
  • this [in]

    This reconstruction

  • k [in]

    Cell number

  • x [in]

    Non-dimensional position within element [nondim]

real function i_dfdx(this, k, x)

Point-wise value of derivative reconstruction [A]

The function is only valid for 0 <= x <= 1. x is effectively clipped to this range.

Parameters
  • this [in]

    This reconstruction

  • k [in]

    Cell number

  • x [in]

    Non-dimensional position within element [nondim]

real function i_x(this, k, t)

Point-wise solver for x: f(x)=t [nondim]

The function solves for the non-dimensional position x within the cell where the reconstruction f(x)=t. The solver returns x=0 or x=1 if the target, t, is outside of the cell.

Parameters
  • this [in]

    This reconstruction

  • k [in]

    Cell number

  • t [in]

    Value to solve for [A]

logical function i_check_reconstruction(this, h, u)

Returns true if some inconsistency is detected, false otherwise

The nature of "consistency" is defined by the implementations and might be no-ops.

Parameters
  • this [in]

    This reconstruction

  • h [in]

    Grid spacing (thickness), typically in [H]

  • u [in]

    Cell mean values [A]

subroutine i_destroy(this)

Deallocate a 1D reconstruction

Parameters
  • this [inout]

    This reconstruction

subroutine i_init_parent(this, n, h_neglect, check)

Second interface to init(), or to parent init()

Parameters
  • this [out]

    This reconstruction

  • n [in]

    Number of cells in this column

  • h_neglect [in]

    A negligibly small width used in cell reconstructions [H]

  • check [in]

    If true, enable some consistency checking

subroutine i_reconstruct_parent(this, h, u)

Second interface to reconstruct(), or to parent reconstruct()

Parameters
  • this [inout]

    This reconstruction

  • h [in]

    Grid spacing (thickness), typically in [H]

  • u [in]

    Cell mean values [A]

logical function i_unit_tests(this, verbose, stdout, stderr)

Runs reconstruction unit tests and returns True for any fails, False otherwise

Assumes single process/thread context

Parameters
  • this [inout]

    This reconstruction

  • verbose [in]

    True, if verbose

  • stdout [in]

    I/O channel for stdout

  • stderr [in]

    I/O channel for stderr

Functions/Subroutine Documentation

real function x(this, k, t)

Solve for x such that f(x)=t

This solver uses bounded Newton-Raphson method with a fixed number of iterations

Parameters
  • this [in]

    This reconstruction

  • k [in]

    Cell number

  • t [in]

    Value to solve for [A]

subroutine remap_to_sub_grid(this, h0, u0, n1, h_sub, isrc_start, isrc_end, isrc_max, isub_src, u_sub, uh_sub, u02_err)

Remaps the column to subgrid h_sub

It is assumed that h_sub is a perfect sub-grid of h0, meaning each h0 cell can be constructed by joining a contiguous set of h_sub cells. The integer indices isrc_start, isrc_end, isub_src provide this mapping, and are calculated in MOM_remapping

Parameters
  • this [in]

    1-D reconstruction type

  • h0 [in]

    Source grid widths (size n0) [H]

  • u0 [in]

    Source grid widths (size n0) [H]

  • n1 [in]

    Number of cells in target grid

  • h_sub [in]

    Overlapping sub-cell thicknesses, h_sub [H]

  • isrc_start [in]

    Index of first sub-cell within each source cell

  • isrc_end [in]

    Index of last sub-cell within each source cell

  • isrc_max [in]

    Index of thickest sub-cell within each source cell

  • isub_src [in]

    Index of source cell for each sub-cell

  • u_sub [out]

    Sub-cell cell averages (size n1) [A]

  • uh_sub [out]

    Sub-cell cell integrals (size n1) [A H]

  • u02_err [out]

    Integrated reconstruction error estimates [A H]

subroutine a_set_debug(this)

Turns on debugging

Parameters
  • this [inout]

    1-D reconstruction type

API generated with Flint · Rendered from reStructuredText