52 #include "Shards_CellTopology.hpp" 53 #include "Teuchos_GlobalMPISession.hpp" 59 void vField(
double& v1,
double& v2,
double& v3,
60 const double& x,
const double& y,
const double& z);
65 int main(
int argc,
char *argv[]) {
67 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
71 typedef shards::CellTopology CellTopology;
74 <<
"===============================================================================\n" \
76 <<
"| Example use of the CellTools class |\n" \
78 <<
"| 1) Computation of face flux, for a given vector field, on a face workset |\n" \
79 <<
"| 2) Computation of edge circulation, for a given vector field, on a face |\n" \
82 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov) |\n" \
83 <<
"| Denis Ridzal (dridzal@sandia.gov), or |\n" \
84 <<
"| Kara Peterson (kjpeter@sandia.gov) |\n" \
86 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
87 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
89 <<
"===============================================================================\n"\
90 <<
"| EXAMPLE 1: Computation of face flux on a face workset |\n"\
91 <<
"===============================================================================\n";
115 CellTopology hexahedron_8( shards::getCellTopologyData<shards::Hexahedron<8> >() );
119 int pCellNodeCount = hexahedron_8.getVertexCount();
120 int pCellDim = hexahedron_8.getDimension();
124 hexNodes(0, 0, 0) = 0.00; hexNodes(0, 0, 1) = 0.00, hexNodes(0, 0, 2) = 0.00;
125 hexNodes(0, 1, 0) = 1.00; hexNodes(0, 1, 1) = 0.00, hexNodes(0, 1, 2) = 0.00;
126 hexNodes(0, 2, 0) = 1.00; hexNodes(0, 2, 1) = 1.00, hexNodes(0, 2, 2) = 0.00;
127 hexNodes(0, 3, 0) = 0.00; hexNodes(0, 3, 1) = 1.00, hexNodes(0, 3, 2) = 0.00;
129 hexNodes(0, 4, 0) = 0.00; hexNodes(0, 4, 1) = 0.00, hexNodes(0, 4, 2) = 1.00;
130 hexNodes(0, 5, 0) = 1.00; hexNodes(0, 5, 1) = 0.00, hexNodes(0, 5, 2) = 1.00;
131 hexNodes(0, 6, 0) = 1.00; hexNodes(0, 6, 1) = 1.00, hexNodes(0, 6, 2) = 1.00;
132 hexNodes(0, 7, 0) = 0.00; hexNodes(0, 7, 1) = 1.00, hexNodes(0, 7, 2) = 1.00;
135 hexNodes(1, 0, 0) = 0.00; hexNodes(1, 0, 1) = 0.00, hexNodes(1, 0, 2) = 0.00;
136 hexNodes(1, 1, 0) = 1.00; hexNodes(1, 1, 1) = 0.00, hexNodes(1, 1, 2) = 0.00;
137 hexNodes(1, 2, 0) = 1.00; hexNodes(1, 2, 1) = 1.00, hexNodes(1, 2, 2) = 0.00;
138 hexNodes(1, 3, 0) = 0.00; hexNodes(1, 3, 1) = 1.00, hexNodes(1, 3, 2) = 0.00;
140 hexNodes(1, 4, 0) = 0.00; hexNodes(1, 4, 1) = 0.00, hexNodes(1, 4, 2) = 1.00;
141 hexNodes(1, 5, 0) = 1.00; hexNodes(1, 5, 1) = 0.00, hexNodes(1, 5, 2) = 1.00;
142 hexNodes(1, 6, 0) = 1.00; hexNodes(1, 6, 1) = 1.00, hexNodes(1, 6, 2) = 0.75;
143 hexNodes(1, 7, 0) = 0.00; hexNodes(1, 7, 1) = 1.00, hexNodes(1, 7, 2) = 1.00;
165 CellTopology paramQuadFace(shards::getCellTopologyData<shards::Quadrilateral<4> >() );
180 Teuchos::RCP<Cubature<double> > hexFaceCubature = cubFactory.
create(paramQuadFace, 3);
183 int cubDim = hexFaceCubature -> getDimension();
184 int numCubPoints = hexFaceCubature -> getNumPoints();
187 paramGaussPoints.
resize(numCubPoints, cubDim);
188 paramGaussWeights.
resize(numCubPoints);
189 hexFaceCubature -> getCubature(paramGaussPoints, paramGaussWeights);
194 refGaussPoints.
resize(numCubPoints, pCellDim);
197 worksetGaussPoints.
resize(worksetSize, numCubPoints, pCellDim);
200 CellTools::mapToReferenceSubcell(refGaussPoints,
207 CellTools::mapToPhysicalFrame(worksetGaussPoints,
226 CellTools::setJacobian(worksetJacobians,
239 CellTools::getPhysicalFaceTangents(worksetFaceTu,
246 RealSpaceTools::vecprod(worksetFaceN, worksetFaceTu, worksetFaceTv);
260 for(
int pCellOrd = 0; pCellOrd < worksetSize; pCellOrd++){
261 for(
int ptOrd = 0; ptOrd < numCubPoints; ptOrd++){
263 double x = worksetGaussPoints(pCellOrd, ptOrd, 0);
264 double y = worksetGaussPoints(pCellOrd, ptOrd, 1);
265 double z = worksetGaussPoints(pCellOrd, ptOrd, 2);
267 vField(worksetVFieldVals(pCellOrd, ptOrd, 0),
268 worksetVFieldVals(pCellOrd, ptOrd, 1),
269 worksetVFieldVals(pCellOrd, ptOrd, 2), x, y, z);
285 RealSpaceTools::dot(worksetFieldDotNormal, worksetVFieldVals, worksetFaceN);
293 for(
int pCellOrd = 0; pCellOrd < worksetSize; pCellOrd++){
294 worksetFluxes(pCellOrd) = 0.0;
295 for(
int pt = 0; pt < numCubPoints; pt++ ){
296 worksetFluxes(pCellOrd) += worksetFieldDotNormal(pCellOrd, pt)*paramGaussWeights(pt);
300 std::cout <<
"Face fluxes on workset faces : \n\n";
301 for(
int pCellOrd = 0; pCellOrd < worksetSize; pCellOrd++){
303 CellTools::printWorksetSubcell(hexNodes, hexahedron_8, pCellOrd, subcellDim, subcellOrd);
304 std::cout <<
" Flux = " << worksetFluxes(pCellOrd) <<
"\n\n";
318 <<
"===============================================================================\n" \
319 <<
"| Gauss points on workset faces: |\n" \
320 <<
"===============================================================================\n";
321 for(
int pCell = 0; pCell < worksetSize; pCell++){
323 CellTools::printWorksetSubcell(hexNodes, hexahedron_8, pCell, subcellDim, subcellOrd);
325 for(
int pt = 0; pt < numCubPoints; pt++){
326 std::cout <<
"\t 2D Gauss point (" 327 << std::setw(8) << std::right << paramGaussPoints(pt, 0) <<
", " 328 << std::setw(8) << std::right << paramGaussPoints(pt, 1) <<
") " 329 << std::setw(8) <<
" --> " <<
"(" 330 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 0) <<
", " 331 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 1) <<
", " 332 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 2) <<
")\n";
340 <<
"===============================================================================\n" \
341 <<
"| Face normals (non-unit) at Gauss points on workset faces: |\n" \
342 <<
"===============================================================================\n";
343 for(
int pCell = 0; pCell < worksetSize; pCell++){
345 CellTools::printWorksetSubcell(hexNodes, hexahedron_8, pCell, subcellDim, subcellOrd);
347 for(
int pt = 0; pt < numCubPoints; pt++){
348 std::cout <<
"\t 3D Gauss point: (" 349 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 0) <<
", " 350 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 1) <<
", " 351 << std::setw(8) << std::right << worksetGaussPoints(pCell, pt, 2) <<
")" 352 << std::setw(8) <<
" out. normal: " <<
"(" 353 << std::setw(8) << std::right << worksetFaceN(pCell, pt, 0) <<
", " 354 << std::setw(8) << std::right << worksetFaceN(pCell, pt, 1) <<
", " 355 << std::setw(8) << std::right << worksetFaceN(pCell, pt, 2) <<
")\n";
370 void vField(
double& v1,
double& v2,
double& v3,
const double& x,
const double& y,
const double& z)
Header file for utility class to provide multidimensional containers.
Header file for the abstract base class Intrepid::DefaultCubatureFactory.
void resize(const int dim0)
Resizes FieldContainer to a rank-1 container with the specified dimension, initialized by 0...
A factory class that generates specific instances of cubatures.
Teuchos::RCP< Cubature< Scalar, ArrayPoint, ArrayWeight > > create(const shards::CellTopology &cellTopology, const std::vector< int > °ree)
Factory method.