|
TrilinosCouplings Development
|
Example solution of a Poisson equation on a hexahedral mesh using nodal (Hgrad) elements. The system is assembled but not solved. More...
#include "TrilinosCouplings_config.h"#include "TrilinosCouplings_Pamgen_Utils.hpp"#include "Intrepid_FunctionSpaceTools.hpp"#include "Intrepid_CellTools.hpp"#include "Intrepid_ArrayTools.hpp"#include "Intrepid_HGRAD_HEX_C1_FEM.hpp"#include "Intrepid_RealSpaceTools.hpp"#include "Intrepid_DefaultCubatureFactory.hpp"#include "Intrepid_Utils.hpp"#include "Tpetra_Map.hpp"#include "Tpetra_Core.hpp"#include "Tpetra_Export.hpp"#include "Tpetra_Import.hpp"#include "Tpetra_CrsGraph.hpp"#include "Tpetra_CrsMatrix.hpp"#include "Tpetra_DistObject.hpp"#include "Tpetra_Vector.hpp"#include "Tpetra_MultiVector.hpp"#include "MatrixMarket_Tpetra.hpp"#include "Tpetra_Operator.hpp"#include "Teuchos_oblackholestream.hpp"#include "Teuchos_RCP.hpp"#include "Teuchos_BLAS.hpp"#include "Teuchos_XMLParameterListHelpers.hpp"#include "Teuchos_ArrayView.hpp"#include "Teuchos_ArrayRCP.hpp"#include "Teuchos_TimeMonitor.hpp"#include "Shards_CellTopology.hpp"#include "create_inline_mesh.h"#include "pamgen_im_exodusII_l.h"#include "pamgen_im_ne_nemesisI_l.h"#include "pamgen_extras.h"#include "RTC_FunctionRTC.hh"#include "BelosLinearProblem.hpp"#include "BelosPseudoBlockCGSolMgr.hpp"#include "BelosConfigDefs.hpp"#include "BelosTpetraAdapter.hpp"#include "Sacado_No_Kokkos.hpp"
Functions | |
| template<typename Scalar> | |
| const Scalar | exactSolution (const Scalar &x, const Scalar &y, const Scalar &z) |
| User-defined exact solution. | |
| template<typename Scalar> | |
| void | materialTensor (Scalar material[][3], const Scalar &x, const Scalar &y, const Scalar &z) |
| User-defined material tensor. | |
| template<typename Scalar> | |
| void | exactSolutionGrad (Scalar gradExact[3], const Scalar &x, const Scalar &y, const Scalar &z) |
| Computes gradient of the exact solution. Requires user-defined exact solution. | |
| template<typename Scalar> | |
| const Scalar | sourceTerm (Scalar &x, Scalar &y, Scalar &z) |
| Computes source term: f = -div(A.grad u). Requires user-defined exact solution and material tensor. | |
| template<class ArrayOut, class ArrayIn> | |
| void | evaluateMaterialTensor (ArrayOut &worksetMaterialValues, const ArrayIn &evaluationPoints) |
| Computation of the material tensor at array of points in physical space. | |
| template<class ArrayOut, class ArrayIn> | |
| void | evaluateSourceTerm (ArrayOut &sourceTermValues, const ArrayIn &evaluationPoints) |
| Computation of the source term at array of points in physical space. | |
| template<class ArrayOut, class ArrayIn> | |
| void | evaluateExactSolution (ArrayOut &exactSolutionValues, const ArrayIn &evaluationPoints) |
| Computation of the exact solution at array of points in physical space. | |
| 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. | |
| int | main (int argc, char *argv[]) |
Example solution of a Poisson equation on a hexahedral mesh using nodal (Hgrad) elements. The system is assembled but not solved.
This example uses the following Trilinos packages:
Poisson system:
div A grad u = f in Omega
u = g on Gamma
where
A is a symmetric, positive definite material tensor
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
| 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 |
References exactSolution().
| 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 |
References exactSolutionGrad().
| void evaluateMaterialTensor | ( | ArrayOut & | worksetMaterialValues, |
| const ArrayIn & | evaluationPoints ) |
Computation of the material tensor at array of points in physical space.
| worksetMaterialValues | [out] Rank-2, 3 or 4 array with dimensions (C,P), (C,P,D) or (C,P,D,D) with the values of the material tensor |
| evaluationPoints | [in] Rank-3 (C,P,D) array with the evaluation points in physical frame |
References materialTensor().
| void evaluateSourceTerm | ( | ArrayOut & | sourceTermValues, |
| const ArrayIn & | evaluationPoints ) |
Computation of the source term at array of points in physical space.
| sourceTermValues | [out] Rank-2 (C,P) array with the values of the source term |
| evaluationPoints | [in] Rank-3 (C,P,D) array with the evaluation points in physical frame |
References sourceTerm().
| const Scalar exactSolution | ( | const Scalar & | x, |
| const Scalar & | y, | ||
| const Scalar & | z ) |
User-defined exact solution.
| x | [in] x-coordinate of the evaluation point |
| y | [in] y-coordinate of the evaluation point |
| z | [in] z-coordinate of the evaluation point |
Referenced by evaluateExactSolution(), exactSolutionGrad(), and sourceTerm().
| void exactSolutionGrad | ( | Scalar | gradExact[3], |
| const Scalar & | x, | ||
| const Scalar & | y, | ||
| const Scalar & | z ) |
Computes gradient of the exact solution. Requires user-defined exact solution.
| gradExact | [out] gradient of the exact solution evaluated at (x,y,z) |
| x | [in] x-coordinate of the evaluation point |
| y | [in] y-coordinate of the evaluation point |
| z | [in] z-coordinate of the evaluation point |
References exactSolution().
Referenced by evaluateExactSolutionGrad(), and sourceTerm().
| void materialTensor | ( | Scalar | material[][3], |
| const Scalar & | x, | ||
| const Scalar & | y, | ||
| const Scalar & | z ) |
User-defined material tensor.
| material | [out] 3 x 3 material tensor evaluated at (x,y,z) |
| x | [in] x-coordinate of the evaluation point |
| y | [in] y-coordinate of the evaluation point |
| z | [in] z-coordinate of the evaluation point |
Referenced by evaluateMaterialTensor(), and sourceTerm().
| const Scalar sourceTerm | ( | Scalar & | x, |
| Scalar & | y, | ||
| Scalar & | z ) |
Computes source term: f = -div(A.grad u). Requires user-defined exact solution and material tensor.
| x | [in] x-coordinate of the evaluation point |
| y | [in] y-coordinate of the evaluation point |
| z | [in] z-coordinate of the evaluation point |
References exactSolution(), exactSolutionGrad(), and materialTensor().