Ember
|
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 . | |
Representation of an adaptive, non-uniform one-dimensional grid.
OneDimGrid::OneDimGrid | ( | ) |
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:
|f[j+1]-f[j]| < vtol*range(f)
|dfdy[j+1]-dfdy[j]| < dvtol*range(dfdy)
1/uniformityTol < hh[j]/hh[j-1] < uniformityTol
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.
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().
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().
void OneDimGrid::setOptions | ( | const ConfigOptions & | options | ) |
Set adaptation and regridding tolerances specified in a ConfigOptions object.
void OneDimGrid::updateValues | ( | void | ) |
Recompute derived mesh parameters after the grid has changed.
void OneDimGrid::setSize | ( | const size_t | N | ) |
Set the size of the grid after making changes to the grid.
|
private |
Remove the point jRemove
and update the solution vector y
.
|
private |
Add a point to the right of jInsert
and update the solution vector y
.
|
private |
Remove any unnecessary points from the right side of the domain and update the solution vector y
.
|
private |
Remove any unnecessary points from the left side of the domain and update the solution vector y
.
|
private |
Add points to the right side of the domain if necessary and update the solution vector y
.
|
private |
Add points to the left side of the domain if necessary and update the solution vector y
.
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.
Remove unnecessary points from the right side of an unstrained flame and update the solution vector y
.
q
is the local heat release rate.
dvec OneDimGrid::x |
The coordinates of the grid points [m].
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.
int OneDimGrid::alpha |
Domain curvature parameter.
0: planar / disc, 1: cylindrical
int OneDimGrid::beta |
Domain curvature parameter.
1: planar / cylindrical; 2: disc
size_t OneDimGrid::ju |
Index corresponding to the unburned mixture.
size_t OneDimGrid::jb |
Index corresponding to the burned mixture.
double OneDimGrid::vtol_in |
Default relative solution variable tolerance for point insertion.
Set from ConfigOptions in setOptions().
double OneDimGrid::dvtol_in |
Default derivative tolerance for point insertion.
Set from ConfigOptions in setOptions().
dvec OneDimGrid::vtol |
Relative solution variable tolerance for point insertion for each solution component.
Length nVars.
dvec OneDimGrid::dvtol |
solution variable derivative tolerance for point insertion for each solution component.
Length nVars.
double OneDimGrid::absvtol |
Absolute tolerance for point insertion.
Components with ranges smaller than this value are not considered during grid adaptation.
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.
double OneDimGrid::uniformityTol |
Maximum ratio of adjacent grid point separation distances.
double OneDimGrid::gridMin |
Minimum grid point separation.
double OneDimGrid::gridMax |
Maximum grid point separation.
double OneDimGrid::dampConst |
Relative allowable numerical damping. Compared with dampVal.
Minimum separation of center grid points for curved flames.
double OneDimGrid::centerGridMin |
bool OneDimGrid::fixedBurnedVal |
true
if the composition and temperature of the burned gas should be held constant.
bool OneDimGrid::unburnedLeft |
true
if the unburned mixture is on the left side of the domain.
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.
bool OneDimGrid::twinFlame |
true
if the left boundary condition is a symmetry condition.
bool OneDimGrid::cylindricalFlame |
true
if the flame is curved (corresponding to alpha = 1)
bool OneDimGrid::discFlame |
true
if the flame is opposed axisymmetric jets (corresponding to beta = 2)
double OneDimGrid::boundaryTol |
Relative tolerance used to extend the domain in order to satisfy zero- gradient boundary conditions.
double OneDimGrid::boundaryTolRm |
Relative tolerance used to remove boundary grid points satisfying zero-gradient boundary conditions.
double OneDimGrid::unstrainedDownstreamWidth |
Maximum extent of the domain downstream of the flame for unstrained flames.
Expressed as a multiple of the flame thickness.
size_t OneDimGrid::addPointCount |
number of points to add when regridding
dvec OneDimGrid::cfm |
Coefficient for y[j-1] in first centered difference.
dvec OneDimGrid::cf |
Coefficient for y[j] in first centered difference.
dvec OneDimGrid::cfp |
Coefficient for y[j+1] in first centered difference.
dvec OneDimGrid::dlj |
Average of left and right grid spacing.
dvec OneDimGrid::hh |
Grid spacing between x[j] and x[j+1].
dvec OneDimGrid::rphalf |
"radius" at x[j+1/2].
Equal to 1 for planar geometries.
dvec OneDimGrid::r |
"radius" at x[j].
Equal to 1 for planar geometries.
size_t OneDimGrid::nVars |
number of variables at each grid point
size_t OneDimGrid::nAdapt |
Only the first nAdapt variables at each point are used for adaptation.
size_t OneDimGrid::nPoints |
number of grid point
size_t OneDimGrid::jj |
index of last grid point (== nPoints-1
)
BoundaryCondition::BC OneDimGrid::leftBC |
Boundary condition applied at j = 0
BoundaryCondition::BC OneDimGrid::rightBC |
Boundary condition applied at j = jj