Ember
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | List of all members
OneDimGrid Class Reference

Representation of an adaptive, non-uniform one-dimensional grid. More...

#include <grid.h>

Public Member Functions

 OneDimGrid ()
 
void adapt (vector< dvector > &y)
 Update the grid based on the solution state y to satisfy all refinement criteria for internal grid points.
 
void regrid (vector< dvector > &y)
 Add and remove points at the boundaries of the domain to satisfy boundary tolerances.
 
void regridUnstrained (vector< dvector > &y, dvec &qdot)
 Add and remove points at the boundaries of the domain to satisfy boundary tolerances for unstrained flames.
 
void setOptions (const ConfigOptions &options)
 Set adaptation and regridding tolerances specified in a ConfigOptions object.
 
void updateValues (void)
 Recompute derived mesh parameters after the grid has changed.
 
void setSize (const size_t N)
 Set the size of the grid after making changes to the grid.
 
void updateBoundaryIndices (void)
 Update values of ju and jb after regridding.
 

Public Attributes

dvec x
 The coordinates of the grid points [m].
 
dvec dampVal
 Ratio of convective to diffusive coefficients (e.g. nu/v).
 
int alpha
 Domain curvature parameter.
 
int beta
 Domain curvature parameter.
 
size_t ju
 Index corresponding to the unburned mixture.
 
size_t jb
 Index corresponding to the burned mixture.
 
double vtol_in
 Default relative solution variable tolerance for point insertion.
 
double dvtol_in
 Default derivative tolerance for point insertion.
 
dvec vtol
 Relative solution variable tolerance for point insertion for each solution component.
 
dvec dvtol
 solution variable derivative tolerance for point insertion for each solution component.
 
double absvtol
 Absolute tolerance for point insertion.
 
double rmTol
 Relative grid point removal tolerance.
 
double uniformityTol
 Maximum ratio of adjacent grid point separation distances.
 
double gridMin
 Minimum grid point separation.
 
double gridMax
 Maximum grid point separation.
 
double dampConst
 Relative allowable numerical damping. Compared with dampVal.
 
double centerGridMin
 
bool fixedBurnedVal
 true if the composition and temperature of the burned gas should be held constant.
 
bool unburnedLeft
 true if the unburned mixture is on the left side of the domain.
 
bool fixedLeftLoc
 true if the coordinate of the leftmost grid point is fixed.
 
bool twinFlame
 true if the left boundary condition is a symmetry condition.
 
bool cylindricalFlame
 true if the flame is curved (corresponding to alpha = 1)
 
bool discFlame
 true if the flame is opposed axisymmetric jets (corresponding to beta = 2)
 
double boundaryTol
 Relative tolerance used to extend the domain in order to satisfy zero- gradient boundary conditions.
 
double boundaryTolRm
 Relative tolerance used to remove boundary grid points satisfying zero-gradient boundary conditions.
 
double unstrainedDownstreamWidth
 Maximum extent of the domain downstream of the flame for unstrained flames.
 
size_t addPointCount
 number of points to add when regridding
 
dvec cfm
 Coefficient for y[j-1] in first centered difference.
 
dvec cf
 Coefficient for y[j] in first centered difference.
 
dvec cfp
 Coefficient for y[j+1] in first centered difference.
 
dvec dlj
 Average of left and right grid spacing.
 
dvec hh
 Grid spacing between x[j] and x[j+1].
 
dvec rphalf
 "radius" at x[j+1/2].
 
dvec r
 "radius" at x[j].
 
size_t nVars
 number of variables at each grid point
 
size_t nAdapt
 Only the first nAdapt variables at each point are used for adaptation.
 
size_t nPoints
 number of grid point
 
size_t jj
 index of last grid point (== nPoints-1)
 
bool updated
 true if the grid changed on the last call to adapt() or regrid()
 
BoundaryCondition::BC leftBC
 Boundary condition applied at j = 0
 
BoundaryCondition::BC rightBC
 Boundary condition applied at j = jj
 

Private Member Functions

void removePoint (int jRemove, vector< dvector > &y)
 Remove the point jRemove and update the solution vector y.
 
void addPoint (int jInsert, vector< dvector > &y)
 Add a point to the right of jInsert and update the solution vector y.
 
bool removeRight (vector< dvector > &y)
 Remove any unnecessary points from the right side of the domain and update the solution vector y.
 
bool removeLeft (vector< dvector > &y)
 Remove any unnecessary points from the left side of the domain and update the solution vector y.
 
bool addRight (vector< dvector > &y)
 Add points to the right side of the domain if necessary and update the solution vector y.
 
bool addLeft (vector< dvector > &y)
 Add points to the left side of the domain if necessary and update the solution vector y.
 
bool addRightUnstrained (vector< dvector > &y, dvec &q)
 Add points to the right side of an unstrained flame if necessary and update the solution vector y.
 
bool removeRightUnstrained (vector< dvector > &y, dvec &q)
 Remove unnecessary points from the right side of an unstrained flame and update the solution vector y.
 

Detailed Description

Representation of an adaptive, non-uniform one-dimensional grid.

Constructor & Destructor Documentation

◆ OneDimGrid()

OneDimGrid::OneDimGrid ( )

Member Function Documentation

◆ adapt()

void OneDimGrid::adapt ( vector< dvector > &  y)

Update the grid based on the solution state y to satisfy all refinement criteria for internal grid points.

Also adjusts the solution to fit on the new grid. The first nAdapt elements of y are vector containing the values of a state variable at each grid point. Subsequent elements are arrays (such as the time derivative of a state variable) which needs to be updated to fit on the new grid but are not required to meet adaptation tolerances.

This function tries to remove unnecessary grid points located in the regions of small gradients, insert new grid points in the regions of large gradients, and, at the same time maintain relative uniformity of the grid.

Adaptation algorithm

The insertion of the grid points is performed first. For each component of the solution vector:

  1. Find its range and the range of its derivative.
  2. Apply four criteria and and find where insertions are needed. the criteria for a component f(j) are:
    • |f[j+1]-f[j]| < vtol*range(f)
    • |dfdy[j+1]-dfdy[j]| < dvtol*range(dfdy)
    • 1/uniformityTol < hh[j]/hh[j-1] < uniformityTol
  3. If any of these criteria is not satisfied, a grid point j is inserted.

Next, the unnecessary grid points are removed, and the algorithm is applied in reverse. If the criteria:

  • |f[j]-f[j-1]| > rmTol*vtol*range(f)
  • |dfdy[j]-dfdy[j-1]| > rmTol*dvtol*range(dfdy)
  • hh[j]+hh[j-1] < uniformityTol*hh[j-2]
  • hh[j]+hh[j-1] < uniformityTol*hh[j+1]

are satisfied for all components at a point, it is removed.

◆ regrid()

void OneDimGrid::regrid ( vector< dvector > &  y)

Add and remove points at the boundaries of the domain to satisfy boundary tolerances.

The structure of y is the same as for adapt().

◆ regridUnstrained()

void OneDimGrid::regridUnstrained ( vector< dvector > &  y,
dvec qdot 
)

Add and remove points at the boundaries of the domain to satisfy boundary tolerances for unstrained flames.

The structure of y is the same as for adapt().

◆ setOptions()

void OneDimGrid::setOptions ( const ConfigOptions options)

Set adaptation and regridding tolerances specified in a ConfigOptions object.

◆ updateValues()

void OneDimGrid::updateValues ( void  )

Recompute derived mesh parameters after the grid has changed.

◆ setSize()

void OneDimGrid::setSize ( const size_t  N)

Set the size of the grid after making changes to the grid.

◆ updateBoundaryIndices()

void OneDimGrid::updateBoundaryIndices ( void  )

Update values of ju and jb after regridding.

◆ removePoint()

void OneDimGrid::removePoint ( int  jRemove,
vector< dvector > &  y 
)
private

Remove the point jRemove and update the solution vector y.

◆ addPoint()

void OneDimGrid::addPoint ( int  jInsert,
vector< dvector > &  y 
)
private

Add a point to the right of jInsert and update the solution vector y.

◆ removeRight()

bool OneDimGrid::removeRight ( vector< dvector > &  y)
private

Remove any unnecessary points from the right side of the domain and update the solution vector y.

◆ removeLeft()

bool OneDimGrid::removeLeft ( vector< dvector > &  y)
private

Remove any unnecessary points from the left side of the domain and update the solution vector y.

◆ addRight()

bool OneDimGrid::addRight ( vector< dvector > &  y)
private

Add points to the right side of the domain if necessary and update the solution vector y.

◆ addLeft()

bool OneDimGrid::addLeft ( vector< dvector > &  y)
private

Add points to the left side of the domain if necessary and update the solution vector y.

◆ addRightUnstrained()

bool OneDimGrid::addRightUnstrained ( vector< dvector > &  y,
dvec q 
)
private

Add points to the right side of an unstrained flame if necessary and update the solution vector y.

q is the local heat release rate.

◆ removeRightUnstrained()

bool OneDimGrid::removeRightUnstrained ( vector< dvector > &  y,
dvec q 
)
private

Remove unnecessary points from the right side of an unstrained flame and update the solution vector y.

q is the local heat release rate.

Member Data Documentation

◆ x

dvec OneDimGrid::x

The coordinates of the grid points [m].

◆ dampVal

dvec OneDimGrid::dampVal

Ratio of convective to diffusive coefficients (e.g. nu/v).

Used to set an upper bound on grid spacing to control numerical diffusion.

◆ alpha

int OneDimGrid::alpha

Domain curvature parameter.

0: planar / disc, 1: cylindrical

◆ beta

int OneDimGrid::beta

Domain curvature parameter.

1: planar / cylindrical; 2: disc

◆ ju

size_t OneDimGrid::ju

Index corresponding to the unburned mixture.

◆ jb

size_t OneDimGrid::jb

Index corresponding to the burned mixture.

◆ vtol_in

double OneDimGrid::vtol_in

Default relative solution variable tolerance for point insertion.

Set from ConfigOptions in setOptions().

◆ dvtol_in

double OneDimGrid::dvtol_in

Default derivative tolerance for point insertion.

Set from ConfigOptions in setOptions().

◆ vtol

dvec OneDimGrid::vtol

Relative solution variable tolerance for point insertion for each solution component.

Length nVars.

◆ dvtol

dvec OneDimGrid::dvtol

solution variable derivative tolerance for point insertion for each solution component.

Length nVars.

◆ absvtol

double OneDimGrid::absvtol

Absolute tolerance for point insertion.

Components with ranges smaller than this value are not considered during grid adaptation.

◆ rmTol

double OneDimGrid::rmTol

Relative grid point removal tolerance.

Grid points can be removed if all criteria are satisfied to this multiplier on the insertion tolerances.

◆ uniformityTol

double OneDimGrid::uniformityTol

Maximum ratio of adjacent grid point separation distances.

◆ gridMin

double OneDimGrid::gridMin

Minimum grid point separation.

◆ gridMax

double OneDimGrid::gridMax

Maximum grid point separation.

◆ dampConst

double OneDimGrid::dampConst

Relative allowable numerical damping. Compared with dampVal.

Minimum separation of center grid points for curved flames.

◆ centerGridMin

double OneDimGrid::centerGridMin

◆ fixedBurnedVal

bool OneDimGrid::fixedBurnedVal

true if the composition and temperature of the burned gas should be held constant.

◆ unburnedLeft

bool OneDimGrid::unburnedLeft

true if the unburned mixture is on the left side of the domain.

◆ fixedLeftLoc

bool OneDimGrid::fixedLeftLoc

true if the coordinate of the leftmost grid point is fixed.

Prevents addition or removal of grid points at the left boundary.

◆ twinFlame

bool OneDimGrid::twinFlame

true if the left boundary condition is a symmetry condition.

◆ cylindricalFlame

bool OneDimGrid::cylindricalFlame

true if the flame is curved (corresponding to alpha = 1)

◆ discFlame

bool OneDimGrid::discFlame

true if the flame is opposed axisymmetric jets (corresponding to beta = 2)

◆ boundaryTol

double OneDimGrid::boundaryTol

Relative tolerance used to extend the domain in order to satisfy zero- gradient boundary conditions.

◆ boundaryTolRm

double OneDimGrid::boundaryTolRm

Relative tolerance used to remove boundary grid points satisfying zero-gradient boundary conditions.

◆ unstrainedDownstreamWidth

double OneDimGrid::unstrainedDownstreamWidth

Maximum extent of the domain downstream of the flame for unstrained flames.

Expressed as a multiple of the flame thickness.

◆ addPointCount

size_t OneDimGrid::addPointCount

number of points to add when regridding

◆ cfm

dvec OneDimGrid::cfm

Coefficient for y[j-1] in first centered difference.

◆ cf

dvec OneDimGrid::cf

Coefficient for y[j] in first centered difference.

◆ cfp

dvec OneDimGrid::cfp

Coefficient for y[j+1] in first centered difference.

◆ dlj

dvec OneDimGrid::dlj

Average of left and right grid spacing.

◆ hh

dvec OneDimGrid::hh

Grid spacing between x[j] and x[j+1].

◆ rphalf

dvec OneDimGrid::rphalf

"radius" at x[j+1/2].

Equal to 1 for planar geometries.

◆ r

dvec OneDimGrid::r

"radius" at x[j].

Equal to 1 for planar geometries.

◆ nVars

size_t OneDimGrid::nVars

number of variables at each grid point

◆ nAdapt

size_t OneDimGrid::nAdapt

Only the first nAdapt variables at each point are used for adaptation.

◆ nPoints

size_t OneDimGrid::nPoints

number of grid point

◆ jj

size_t OneDimGrid::jj

index of last grid point (== nPoints-1)

◆ updated

bool OneDimGrid::updated

true if the grid changed on the last call to adapt() or regrid()

◆ leftBC

BoundaryCondition::BC OneDimGrid::leftBC

Boundary condition applied at j = 0

◆ rightBC

BoundaryCondition::BC OneDimGrid::rightBC

Boundary condition applied at j = jj


The documentation for this class was generated from the following files: