Skip to content

File AdaptCriteria.h

FileList > src > AdaptCriteria.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Write_txtlog.h"
  • #include "Util_CPU.h"
  • #include "Arrays.h"
  • #include "Mesh.h"
  • #include "Halo.h"
  • #include "GridManip.h"

Public Functions

Type Name
int AdaptCriteria (Param XParam, Forcing< float > XForcing, Model< T > XModel)
Selects and applies the adaptation criteria for mesh refinement/coarsening.
int Thresholdcriteria (Param XParam, T threshold, T * z, BlockP< T > XBlock, bool * refine, bool * coarsen)
Applies threshold-based adaptation criteria for mesh refinement/coarsening.
int inrangecriteria (Param XParam, T zmin, T zmax, T * z, BlockP< T > XBlock, bool * refine, bool * coarsen)
Applies in-range adaptation criteria for mesh refinement/coarsening.

Public Functions Documentation

function AdaptCriteria

Selects and applies the adaptation criteria for mesh refinement/coarsening.

template<class T>
int AdaptCriteria (
    Param XParam,
    Forcing < float > XForcing,
    Model < T > XModel
) 

Template parameters:

  • T Data type

Parameters:

Returns:

Success flag (0 or 1)

This function chooses the adaptation method ("Threshold", "Inrange", "Targetlevel") based on XParam.AdaptCrit, and applies it to the mesh using the corresponding criteria function. It sets the refine/coarsen flags for each block according to the selected method and arguments. For "Targetlevel", it loops over all target adaptation maps.


function Thresholdcriteria

Applies threshold-based adaptation criteria for mesh refinement/coarsening.

template<class T>
int Thresholdcriteria (
    Param XParam,
    T threshold,
    T * z,
    BlockP < T > XBlock,
    bool * refine,
    bool * coarsen
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • threshold Threshold value for adaptation
  • z Array of variable values (e.g., water depth)
  • XBlock Block data structure
  • refine Array of refinement flags
  • coarsen Array of coarsening flags

Returns:

Success flag (0 or 1)

Refines blocks where any cell value exceeds the threshold, coarsens otherwise.

Threshold criteria is a general form of wet dry criteria. Simple wet/dry refining criteria. If the block is wet -> refine is true. If the block is dry -> coarsen is true.

Warning:

the refinement sanity check is meant to be done after running this function.


function inrangecriteria

Applies in-range adaptation criteria for mesh refinement/coarsening.

template<class T>
int inrangecriteria (
    Param XParam,
    T zmin,
    T zmax,
    T * z,
    BlockP < T > XBlock,
    bool * refine,
    bool * coarsen
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • zmin Minimum value for refinement
  • zmax Maximum value for refinement
  • z Array of variable values
  • XBlock Block data structure
  • refine Array of refinement flags
  • coarsen Array of coarsening flags

Returns:

Success flag (0 or 1)

Refines blocks where any cell value is within [zmin, zmax], coarsens otherwise.

Simple in-range refining criteria. If any value of z (could be any variable) is zmin <= z <= zmax the block will try to refine. Otherwise, the block will try to coarsen.

Warning:

the refinement sanity check is meant to be done after running this function.



The documentation for this class was generated from the following file src/AdaptCriteria.h