Example solution of an Advection Diffusion equation on a quadrilateral or triangular mesh using the CVFEM. More...
#include "Intrepid_FunctionSpaceTools.hpp"
#include "Intrepid_CellTools.hpp"
#include "Intrepid_ArrayTools.hpp"
#include "Intrepid_Basis.hpp"
#include "Intrepid_HGRAD_QUAD_C1_FEM.hpp"
#include "Intrepid_HCURL_QUAD_I1_FEM.hpp"
#include "Intrepid_HGRAD_TRI_C1_FEM.hpp"
#include "Intrepid_HCURL_TRI_I1_FEM.hpp"
#include "Intrepid_RealSpaceTools.hpp"
#include "Intrepid_DefaultCubatureFactory.hpp"
#include "Intrepid_Cubature.hpp"
#include "Intrepid_CubatureControlVolume.hpp"
#include "Intrepid_CubatureControlVolumeSide.hpp"
#include "Intrepid_Utils.hpp"
#include "Epetra_Time.h"
#include "Epetra_Map.h"
#include "Epetra_SerialComm.h"
#include "Epetra_FECrsMatrix.h"
#include "Epetra_FEVector.h"
#include "Epetra_Import.h"
#include "Teuchos_oblackholestream.hpp"
#include "Teuchos_RCP.hpp"
#include "Teuchos_BLAS.hpp"
#include "Teuchos_GlobalMPISession.hpp"
#include "Teuchos_XMLParameterListHelpers.hpp"
#include "Shards_CellTopology.hpp"
#include "EpetraExt_RowMatrixOut.h"
#include "EpetraExt_MultiVectorOut.h"
#include "AztecOO.h"
#include "ml_MultiLevelPreconditioner.h"
#include "ml_epetra_utils.h"
#include "Sacado.hpp"
Functions | |
template<typename Scalar > | |
const Scalar | exactSolution (const Scalar &x, const Scalar &y) |
User-defined exact solution. More... | |
template<typename Scalar > | |
void | advectionVelocity (Scalar advVel[2], const Scalar &x, const Scalar &y, const std::string problem) |
User-defined advection velocity. More... | |
template<typename Scalar1 , typename Scalar2 > | |
const Scalar1 | diffusivity (const Scalar1 &x, const Scalar1 &y, const Scalar2 &epsilon, const bool variableEpsilon) |
User-defined diffusivity. More... | |
template<typename Scalar > | |
void | exactSolutionGrad (Scalar gradExact[2], const Scalar &x, const Scalar &y) |
Computes gradient of the exact solution. Requires user-defined exact solution. More... | |
template<typename Scalar1 , typename Scalar2 > | |
const Scalar1 | sourceTerm (Scalar1 &x, Scalar1 &y, Scalar2 &epsilon, const bool variableEpsilon, const std::string problem) |
Computes source term: f = -div(J_n). Requires user-defined exact solution and material parameters. More... | |
template<class ArrayOut , class ArrayIn > | |
void | evaluateExactSolution (ArrayOut &exactSolutionValues, const ArrayIn &evaluationPoints) |
Computation of the exact solution at array of points in physical space. More... | |
template<class ArrayOut , class ArrayIn > | |
void | evaluateExactSolutionGrad (ArrayOut &exactSolutionGradValues, const ArrayIn &evaluationPoints) |
Computation of the gradient of the exact solution at array of points in physical space. More... | |
template<class ArrayOut1 , class ArrayOut2 , class Scalar > | |
void | createMesh (ArrayOut1 &elemToNode, ArrayOut2 &nodeCoords, ArrayOut1 &bcLeftId, ArrayOut1 &bcRightId, ArrayOut1 &bcTopId, ArrayOut1 &bcBotId, const std::string &meshType, const Scalar &meshSize) |
Create quadrilateral or triangle mesh on the domain [0,1]x[0,1]. More... | |
int | main (int argc, char *argv[]) |
Example solution of an Advection Diffusion equation on a quadrilateral or triangular mesh using the CVFEM.
Advection diffusion system: - div (epsilon grad phi - u phi) = f in Omega phi = g on Gamma where u is the advection velocity epsilon is the diffusion coefficient f is a given source term Corresponding discrete linear system for nodal coefficients(x): Kx = b K - HGrad stiffness matrix b - right hand side vector
NOTE: This problem does not currently work on more than one core (csief 3/17/16) er@s andia .gov
void advectionVelocity | ( | Scalar | advVel[2], |
const Scalar & | x, | ||
const Scalar & | y, | ||
const std::string | problem | ||
) |
User-defined advection velocity.
advVel | [out] advection velocity evaluated at (x,y) |
x | [in] x-coordinate of the evaluation point |
y | [in] y-coordinate of the evaluation point |
Referenced by sourceTerm().
void createMesh | ( | ArrayOut1 & | elemToNode, |
ArrayOut2 & | nodeCoords, | ||
ArrayOut1 & | bcLeftId, | ||
ArrayOut1 & | bcRightId, | ||
ArrayOut1 & | bcTopId, | ||
ArrayOut1 & | bcBotId, | ||
const std::string & | meshType, | ||
const Scalar & | meshSize | ||
) |
Create quadrilateral or triangle mesh on the domain [0,1]x[0,1].
elemToNode | [out] Array with element to node mapping |
nodeCoords | [out] Array with nodal coordinates |
bcLeftId | [out] Array with ids of left boundary nodes, |
bcRightId | [out] Array with ids of right boundary nodes |
bcTopId | [out] Array with ids of top boundary nodes |
bcBotId | [out] Array with ids of bottom boundary nodes |
meshType | [in] Mesh type (quad or tri) |
meshSize | [in] Number of elements in each direction |
const Scalar1 diffusivity | ( | const Scalar1 & | x, |
const Scalar1 & | y, | ||
const Scalar2 & | epsilon, | ||
const bool | variableEpsilon | ||
) |
User-defined diffusivity.
x | [in] x-coordinate of the evaluation point |
y | [in] y-coordinate of the evaluation point |
epsilon | [in] diffusion coefficient from xml imput file |
Referenced by sourceTerm().
void evaluateExactSolution | ( | ArrayOut & | exactSolutionValues, |
const ArrayIn & | evaluationPoints | ||
) |
Computation of the exact solution at array of points in physical space.
exactSolutionValues | [out] Rank-2 (C,P) array with the values of the exact solution |
evaluationPoints | [in] Rank-3 (C,P,D) array with the evaluation points in physical frame |
void evaluateExactSolutionGrad | ( | ArrayOut & | exactSolutionGradValues, |
const ArrayIn & | evaluationPoints | ||
) |
Computation of the gradient of the exact solution at array of points in physical space.
exactSolutionGradValues | [out] Rank-3 (C,P,D) array with the values of the gradient of the exact solution |
evaluationPoints | [in] Rank-3 (C,P,D) array with the evaluation points in physical frame |
const Scalar exactSolution | ( | const Scalar & | x, |
const Scalar & | y | ||
) |
User-defined exact solution.
x | [in] x-coordinate of the evaluation point |
y | [in] y-coordinate of the evaluation point |
Referenced by exactSolutionGrad(), and sourceTerm().
void exactSolutionGrad | ( | Scalar | gradExact[2], |
const Scalar & | x, | ||
const Scalar & | y | ||
) |
Computes gradient of the exact solution. Requires user-defined exact solution.
gradExact | [out] gradient of the exact solution evaluated at (x,y) |
x | [in] x-coordinate of the evaluation point |
y | [in] y-coordinate of the evaluation point |
References exactSolution().
Referenced by sourceTerm().
const Scalar1 sourceTerm | ( | Scalar1 & | x, |
Scalar1 & | y, | ||
Scalar2 & | epsilon, | ||
const bool | variableEpsilon, | ||
const std::string | problem | ||
) |
Computes source term: f = -div(J_n). Requires user-defined exact solution and material parameters.
x | [in] x-coordinate of the evaluation point |
y | [in] y-coordinate of the evaluation point |
epsilon | [in] diffusion coefficient |
References advectionVelocity(), diffusivity(), exactSolution(), and exactSolutionGrad().