Skip to content

File Adaptation.h

FileList > src > Adaptation.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 "AdaptCriteria.h"
  • #include "Halo.h"
  • #include "InitialConditions.h"
  • #include "Testing.h"

Public Functions

Type Name
void Adapt (Param & XParam, Forcing< float > XForcing, Model< T > & XModel)
Applies adaptation (refinement/coarsening) to the mesh and updates variables.
void Adaptation (Param & XParam, Forcing< float > XForcing, Model< T > & XModel)
Performs mesh adaptation (refinement/coarsening) for the model.
void Adaptationcleanup (Param & XParam, BlockP< T > & XBlock, AdaptP & XAdapt)
Cleans up and updates block lists after adaptation.
int AddBlocks (int nnewblk, Param & XParam, Model< T > & XModel)
Adds new blocks to the mesh for adaptation.
int CalcAvailblk (Param & XParam, BlockP< T > XBlock, AdaptP & XAdapt)
Calculates the number of available blocks for refinement.
void InitialAdaptation (Param & XParam, Forcing< float > & XForcing, Model< T > & XModel)
Performs initial mesh adaptation and reruns initial conditions.
bool checkBUQsanity (Param XParam, BlockP< T > XBlock)
Checks the consistency and sanity of the block uniform quadtree mesh.
bool checklevel (int ib, int levelib, int neighbourib, int levelneighbour)
bool checkneighbourdistance (double dx, int ib, int levelib, T blocko, int neighbourib, int levelneighbour, T neighbourblocko, bool rightortop)
Checks if the distance between a block and its neighbor is consistent with their levels.
int checkneighbourrefine (int neighbourib, int levelib, int levelneighbour, bool *& refine, bool *& coarsen)
void coarsen (Param XParam, BlockP< T > & XBlock, AdaptP & XAdapt, EvolvingP< T > XEvo, EvolvingP< T > & XEv)
Coarsens mesh blocks and updates conserved variables.
void refine (Param XParam, BlockP< T > & XBlock, AdaptP & XAdapt, EvolvingP< T > XEvo, EvolvingP< T > & XEv)
Refines mesh blocks and interpolates conserved variables.
bool refinesanitycheck (Param XParam, BlockP< T > XBlock, bool *& refine, bool *& coarsen)

Public Functions Documentation

function Adapt

Applies adaptation (refinement/coarsening) to the mesh and updates variables.

template<class T>
void Adapt (
    Param & XParam,
    Forcing < float > XForcing,
    Model < T > & XModel
) 

Template parameters:

  • T Data type

Parameters:


function Adaptation

Performs mesh adaptation (refinement/coarsening) for the model.

template<class T>
void Adaptation (
    Param & XParam,
    Forcing < float > XForcing,
    Model < T > & XModel
) 

Template parameters:

  • T Data type

Parameters:

Iteratively refines or coarsens the mesh based on adaptation criteria, updating block info and variables.


function Adaptationcleanup

Cleans up and updates block lists after adaptation.

template<class T>
void Adaptationcleanup (
    Param & XParam,
    BlockP < T > & XBlock,
    AdaptP & XAdapt
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • XBlock Block data structure
  • XAdapt Adaptation data structure

Updates block levels, reorders active block list, and finalizes adaptation.


function AddBlocks

Adds new blocks to the mesh for adaptation.

template<class T>
int AddBlocks (
    int nnewblk,
    Param & XParam,
    Model < T > & XModel
) 

Template parameters:

  • T Data type

Parameters:

  • nnewblk Number of new blocks to add
  • XParam Model parameters
  • XModel Model structure

Returns:

New total number of blocks in memory.


function CalcAvailblk

Calculates the number of available blocks for refinement.

template<class T>
int CalcAvailblk (
    Param & XParam,
    BlockP < T > XBlock,
    AdaptP & XAdapt
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • XBlock Block data structure
  • XAdapt Adaptation data structure

Returns:

Number of available blocks for refinement.


function InitialAdaptation

Performs initial mesh adaptation and reruns initial conditions.

template<class T>
void InitialAdaptation (
    Param & XParam,
    Forcing < float > & XForcing,
    Model < T > & XModel
) 

Template parameters:

  • T Data type

Parameters:


function checkBUQsanity

Checks the consistency and sanity of the block uniform quadtree mesh.

template<class T>
bool checkBUQsanity (
    Param XParam,
    BlockP < T > XBlock
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • XBlock Block data structure

Returns:

True if mesh is sane, false otherwise.


function checklevel

bool checklevel (
    int ib,
    int levelib,
    int neighbourib,
    int levelneighbour
) 

function checkneighbourdistance

Checks if the distance between a block and its neighbor is consistent with their levels.

template<class T>
bool checkneighbourdistance (
    double dx,
    int ib,
    int levelib,
    T blocko,
    int neighbourib,
    int levelneighbour,
    T neighbourblocko,
    bool rightortop
) 

Template parameters:

  • T Data type

Parameters:

  • dx Base grid spacing
  • ib Block index
  • levelib Block level
  • blocko Block coordinate
  • neighbourib Neighbor block index
  • levelneighbour Neighbor block level
  • neighbourblocko Neighbor block coordinate
  • rightortop True if neighbor is right/top, false if left/bottom

Returns:

True if distance is consistent, false otherwise.


function checkneighbourrefine

int checkneighbourrefine (
    int neighbourib,
    int levelib,
    int levelneighbour,
    bool *& refine,
    bool *& coarsen
) 

function coarsen

Coarsens mesh blocks and updates conserved variables.

template<class T>
void coarsen (
    Param XParam,
    BlockP < T > & XBlock,
    AdaptP & XAdapt,
    EvolvingP < T > XEvo,
    EvolvingP < T > & XEv
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • XBlock Block data structure
  • XAdapt Adaptation data structure
  • XEvo Old evolving variables
  • XEv New evolving variables

function refine

Refines mesh blocks and interpolates conserved variables.

template<class T>
void refine (
    Param XParam,
    BlockP < T > & XBlock,
    AdaptP & XAdapt,
    EvolvingP < T > XEvo,
    EvolvingP < T > & XEv
) 

Template parameters:

  • T Data type

Parameters:

  • XParam Model parameters
  • XBlock Block data structure
  • XAdapt Adaptation data structure
  • XEvo Old evolving variables
  • XEv New evolving variables

function refinesanitycheck

template<class T>
bool refinesanitycheck (
    Param XParam,
    BlockP < T > XBlock,
    bool *& refine,
    bool *& coarsen
) 


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