#include <source/solvers/poisson/CartesianRobinBcHelper.h>
Inheritance diagram for SAMRAI::solv::CartesianRobinBcHelper< DIM >:
Public Member Functions | |
CartesianRobinBcHelper (std::string object_name=std::string(), RobinBcCoefStrategy< DIM > *coef_strategy=NULL) | |
Constructor using. | |
virtual | ~CartesianRobinBcHelper (void) |
Destructor. | |
virtual void | setPhysicalBoundaryConditions (hier::Patch< DIM > &patch, const double fill_time, const hier::IntVector< DIM > &ghost_width_to_fill) |
hier::IntVector< DIM > | getRefineOpStencilWidth () const |
virtual void | preprocessRefineBoxes (hier::Patch< DIM > &fine, const hier::Patch< DIM > &coarse, const hier::BoxList< DIM > &fine_boxes, const hier::IntVector< DIM > &ratio) |
virtual void | preprocessRefine (hier::Patch< DIM > &fine, const hier::Patch< DIM > &coarse, const hier::Box< DIM > &fine_box, const hier::IntVector< DIM > &ratio) |
virtual void | postprocessRefineBoxes (hier::Patch< DIM > &fine, const hier::Patch< DIM > &coarse, const hier::BoxList< DIM > &fine_boxes, const hier::IntVector< DIM > &ratio) |
virtual void | postprocessRefine (hier::Patch< DIM > &fine, const hier::Patch< DIM > &coarse, const hier::Box< DIM > &fine_box, const hier::IntVector< DIM > &ratio) |
Functions to set boundary condition values | |
void | setBoundaryValuesInCells (hier::Patch< DIM > &patch, const double fill_time, const hier::IntVector< DIM > &ghost_width_to_fill, int target_data_id, bool homogeneous_bc=false) const |
Set the physical boundary condition by setting the value of the first ghost cells. | |
void | setBoundaryValuesInCells (hier::PatchLevel< DIM > &level, const double fill_time, const hier::IntVector< DIM > &ghost_width_to_fill, int target_data_id, bool homogeneous_bc=false) const |
Set ghost cells for an entire level. | |
void | setBoundaryValuesAtNodes (hier::Patch< DIM > &patch, const double fill_time, int target_data_id, bool homogeneous_bc=false) const |
Set the physical boundary condition by setting the value of the boundary nodes. | |
Ways to provide the Robin bc coefficients | |
void | setCoefImplementation (const RobinBcCoefStrategy< DIM > *coef_strategy) |
Provide an implementation of the RobinBcCoefStrategy<DIM> for determining the boundary coefficients. | |
void | setTargetDataId (int target_data_id) |
Set the data id that should be filled when setting physical boundary conditions. | |
void | setHomogeneousBc (bool homogeneous_bc) |
Set whether boundary filling should assume homogeneous conditions. |
This class is intended as a helper for performing the tedious task of setting boundary values for scalar quantities for the general case of boundary conditions known as the Robin boundary condition.
It uses the Robin boundary condition coefficients specified by a RobinBcCoefStrategy<DIM> object to determine the boundary value to set. The exact value set depends on the allignment of the data and is derived from various discrete approximations of the Robin formula. This class currently supports cell-centered alignment and will support node-centered alignment in the future.
See RobinBcCoefStrategy<DIM> for the description of the Robin boundary condition.
This class inherits and implements virtual functions from xfer::RefinePatchStrategy<DIM> so it may be used to help create communication schedules if desired.
SAMRAI::solv::CartesianRobinBcHelper< DIM >::CartesianRobinBcHelper | ( | std::string | object_name = std::string() , |
|
RobinBcCoefStrategy< DIM > * | coef_strategy = NULL | |||
) |
Constructor using.
Requires a concrete implementation of RobinBcCoefStrategy<DIM>.
object_name | Name of the object, for general referencing. | |
coef_strategy | Coefficients strategy being helped. |
SAMRAI::solv::CartesianRobinBcHelper< DIM >::~CartesianRobinBcHelper | ( | void | ) | [virtual] |
Destructor.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setPhysicalBoundaryConditions | ( | hier::Patch< DIM > & | patch, | |
const double | fill_time, | |||
const hier::IntVector< DIM > & | ghost_width_to_fill | |||
) | [virtual] |
Pure virtual function to set data associated with the given list of patch data indices at patch boundaries that intersect the physical domain boundary. The specific boundary conditions are determined by the user. The patch data components set in this routine correspond to the "scratch" components specified in calls to the registerRefine() function in the RefineAlgorithm<DIM> class.
patch | hier::Patch on which to fill boundary data. | |
fill_time | Double simulation time for boundary filling. | |
ghost_width_to_fill | Integer vector describing maximum ghost width to fill over all registered scratch components. |
Implements SAMRAI::xfer::RefinePatchStrategy< DIM >.
hier::IntVector< DIM > SAMRAI::solv::CartesianRobinBcHelper< DIM >::getRefineOpStencilWidth | ( | ) | const [virtual] |
Pure virtual function to return maximum stencil width needed over user-defined data interpolation operations. This is needed to determine the correct interpolation data dependencies.
Implements SAMRAI::xfer::RefinePatchStrategy< DIM >.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::preprocessRefineBoxes | ( | hier::Patch< DIM > & | fine, | |
const hier::Patch< DIM > & | coarse, | |||
const hier::BoxList< DIM > & | fine_boxes, | |||
const hier::IntVector< DIM > & | ratio | |||
) | [virtual] |
Virtual function to perform user-defined refine operations. This member function is called before standard refining operations (expressed using concrete subclasses of the RefineOperator<DIM> base class). The preprocess function must refine data from the scratch components of the coarse patch into the scratch components of the fine patch on the specified fine box regions.
Typically, only the pure virtual members of this class are implemented in user-defined subclasses of this base class. This version of the preprocess function operates on an entire box list. By default, this version simply loops over the box list and calls the single-box version, which is a pure virtual function.
fine | Fine patch containing destination data. | |
coarse | Coarse patch containing source data. | |
fine_boxes | tbox::List of box regions on fine patch into which data is refined. | |
ratio | Integer vector containing ratio relating index space between coarse and fine patches. |
Reimplemented from SAMRAI::xfer::RefinePatchStrategy< DIM >.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::preprocessRefine | ( | hier::Patch< DIM > & | fine, | |
const hier::Patch< DIM > & | coarse, | |||
const hier::Box< DIM > & | fine_box, | |||
const hier::IntVector< DIM > & | ratio | |||
) | [virtual] |
Pure virtual function to perform user-defined preprocess data refine operations. This member function is called before standard refine operations (expressed using concrete subclasses of the RefineOperator<DIM> base class). The preprocess function must refine data from the scratch components of the coarse patch into the scratch components of the fine patch on the specified fine box region. Recall that the scratch components are specified in calls to the registerRefine() function in the RefineAlgorithm<DIM> class.
fine | Fine patch containing destination data. | |
coarse | Coarse patch containing source data. | |
fine_box | hier::Box region on fine patch into which data is refined. | |
ratio | Integer vector containing ratio relating index space between coarse and fine patches. |
Implements SAMRAI::xfer::RefinePatchStrategy< DIM >.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::postprocessRefineBoxes | ( | hier::Patch< DIM > & | fine, | |
const hier::Patch< DIM > & | coarse, | |||
const hier::BoxList< DIM > & | fine_boxes, | |||
const hier::IntVector< DIM > & | ratio | |||
) | [virtual] |
Virtual function to perform user-defined refine operations. This member function is called after standard refining operations (expressed using concrete subclasses of the RefineOperator<DIM> base class). The postprocess function must refine data from the scratch components of the coarse patch into the scratch components of the fine patch on the specified fine box regions.
Typically, only the pure virtual members of this class are implemented in user-defined subclasses of this base class. This version of the postprocess function operates on an entire box list. By default, this version simply loops over the box list and calls the single-box version, which is a pure virtual function.
fine | Fine patch containing destination data. | |
coarse | Coarse patch containing source data. | |
fine_boxes | tbox::List of box regions on fine patch into which data is refined. | |
ratio | Integer vector containing ratio relating index space between coarse and fine patches. |
Reimplemented from SAMRAI::xfer::RefinePatchStrategy< DIM >.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::postprocessRefine | ( | hier::Patch< DIM > & | fine, | |
const hier::Patch< DIM > & | coarse, | |||
const hier::Box< DIM > & | fine_box, | |||
const hier::IntVector< DIM > & | ratio | |||
) | [virtual] |
Pure virtual function to perform user-defined postprocess data refine operations. This member function is called after standard refine operations (expressed using concrete subclasses of the RefineOperator<DIM> base class). The postprocess function must refine data from the scratch components of the coarse patch into the scratch components of the fine patch on the specified fine box region. Recall that the scratch components are specified in calls to the registerRefine() function in the RefineAlgorithm<DIM> class.
fine | Fine patch containing destination data. | |
coarse | Coarse patch containing source data. | |
fine_box | hier::Box region on fine patch into which data is refined. | |
ratio | Integer vector containing ratio relating index space between coarse and fine patches. |
Implements SAMRAI::xfer::RefinePatchStrategy< DIM >.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setBoundaryValuesInCells | ( | hier::Patch< DIM > & | patch, | |
const double | fill_time, | |||
const hier::IntVector< DIM > & | ghost_width_to_fill, | |||
int | target_data_id, | |||
bool | homogeneous_bc = false | |||
) | const |
Set the physical boundary condition by setting the value of the first ghost cells.
This function has an interface similar to the virtual function xfer::RefinePatchStrategy<DIM>::setPhysicalBoundaryConditions(), and it may be used to help implement that function, but it does not serve the same purpose. The primary differences are:
This function calls RobinBcStrategy::setBcCoefs() to get the coefficients, then it sets the values in the first ghost cell on the boundary.
To determine the value for the ghost cell, a linear approximation in the direction normal to the boundary is assumed. We write the following discrete approximations:
where the subscript b stands for the the boundary, i stands for the first cell inside the boundary and o stands for the first cell outside the boundary and h is the grid spacing normal to the boundary. Applying this to the Robin formula gives
or equivalently
After setting the edge (face in 3D) boundary conditions, linear approximations are used to set the boundary conditions of higher boundary types (nodes in 2D, edges and nodes in 3D).
In some cases, the calling function wants to set the boundary condition homogeneously, with g=0. This is useful in problems where the the solution of the homogeneous problem is required in solving the inhomogeneous problem. This function respects such requests specified through the argument homogeneous_bc
.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setBoundaryValuesInCells | ( | hier::PatchLevel< DIM > & | level, | |
const double | fill_time, | |||
const hier::IntVector< DIM > & | ghost_width_to_fill, | |||
int | target_data_id, | |||
bool | homogeneous_bc = false | |||
) | const |
Set ghost cells for an entire level.
Loop through all patches on the given level and call setBoundaryValuesInCells(hier::Patch<DIM> &patch, const double fill_time , const hier::IntVector<DIM> &ghost_width_to_fill , int target_data_id , bool homogeneous_bc=false ) for each.
level | PatchLevel on which to set boundary condition | |
fill_time | Solution time corresponding to filling | |
ghost_width_to_fill | Max ghost width requiring fill | |
target_data_id | hier::Patch data index of data to be set. This data must be a cell-centered double. | |
homogeneous_bc | Set a homogeneous boundary condition. This means g=0 for the boundary. |
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setBoundaryValuesAtNodes | ( | hier::Patch< DIM > & | patch, | |
const double | fill_time, | |||
int | target_data_id, | |||
bool | homogeneous_bc = false | |||
) | const |
Set the physical boundary condition by setting the value of the boundary nodes.
This function is not yet implemented!
There are some decisions that must be made before the implementation can be written.
This function has an interface similar to the virtual function xfer::RefinePatchStrategy<DIM>::setPhysicalBoundaryConditions(), and it may be used to help implement that function, but it does not serve the same purpose. The primary differences are:
This function calls RobinBcStrategy::setBcCoefs() to get the coefficients, then it sets the values at the boundary nodes.
In some cases, the calling function wants to set the boundary condition homogeneously, with g=0. This is useful in problems where the the solution of the homogeneous problem is required to solving the inhomogeneous problem. This function respects such requests specified through the argument homogeneous_bc
.
patch | hier::Patch on which to set boundary condition | |
fill_time | Solution time corresponding to filling | |
target_data_id | hier::Patch data index of data to be set. | |
homogeneous_bc | Set a homogeneous boundary condition. This means g=0 for the boundary. |
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setCoefImplementation | ( | const RobinBcCoefStrategy< DIM > * | coef_strategy | ) |
Provide an implementation of the RobinBcCoefStrategy<DIM> for determining the boundary coefficients.
Provide the implementation that can be used to set the Robin bc coefficients.
coef_strategy | tbox::Pointer to a concrete inmplementation of the coefficient strategy. |
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setTargetDataId | ( | int | target_data_id | ) |
Set the data id that should be filled when setting physical boundary conditions.
When setPhysicalBoundaryConditions is called, the data specified will be set. This information is required because the it is not passed in through the argument list of setPhysicalBounaryConditions.
void SAMRAI::solv::CartesianRobinBcHelper< DIM >::setHomogeneousBc | ( | bool | homogeneous_bc | ) |
Set whether boundary filling should assume homogeneous conditions.
In certain circumstances, only the value of a is needed, while the value of g is temporarily not required and taken to be zero. (An example is in setting the boundary condition for error value in an iterative method.) In such cases, use this function to set a flag that will cause a null pointer to be given to setBcCoefs() to indicate that fact.