7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for the ETYPE shapefunction"
10 #include <boost/assign/list_of.hpp>
11 #include <boost/test/unit_test.hpp>
89 boost::shared_ptr<Elements> comp = allocate_component<Elements>(
"comp");
90 boost::shared_ptr<Dictionary>
nodes = allocate_component<ContinuousDictionary>(
"nodes");
91 comp->initialize(
"cf3.mesh.LagrangeP1.Quad2D",*nodes);
92 BOOST_CHECK_EQUAL(comp->element_type().shape(), GeoShape::QUAD);
93 BOOST_CHECK_EQUAL(comp->element_type().nb_faces(), (
Uint) 4);
108 const ETYPE::SF::ValueT reference_result(0.045, 0.055, 0.495, 0.405);
109 ETYPE::SF::ValueT result;
110 ETYPE::SF::compute_value(mapped_coords, result);
112 vector_test(result, reference_result, accumulator);
122 BOOST_CHECK_LT(std::abs(result[0]), 1
e-12);
123 BOOST_CHECK_LT(std::abs(result[1]), 1
e-12);
125 test_coords =
nodes.row(0);
130 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
132 test_coords =
nodes.row(1);
137 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
139 test_coords =
nodes.row(2);
144 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
146 test_coords =
nodes.row(3);
151 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
161 test_coords = nodes_2.row(0);
164 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
168 test_coords = nodes_2.row(1);
173 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
175 test_coords = nodes_2.row(2);
180 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
182 test_coords = nodes_2.row(3);
187 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
191 const Real
D=200./120.;
192 const Real
eps = 0.0000000001;
200 test_coords << -75. +
eps, 0.;
201 CFinfo <<
"test if " << test_coords.transpose() <<
" maps to (-1,-1) in element with nodes \n" << nodes_3 <<
CFendl;
204 CFinfo <<
"result[1] = " << result[1] << CFendl <<
CFendl;
213 ETYPE::SF::GradientT expected;
214 const cf3::Real ksi = mapped_coords[0];
215 const cf3::Real eta = mapped_coords[1];
216 expected(0,0) = 0.25 * (-1 + eta);
217 expected(1,0) = 0.25 * (-1 + ksi);
218 expected(0,1) = 0.25 * ( 1 - eta);
219 expected(1,1) = 0.25 * (-1 - ksi);
220 expected(0,2) = 0.25 * ( 1 + eta);
221 expected(1,2) = 0.25 * ( 1 + ksi);
222 expected(0,3) = 0.25 * (-1 - eta);
223 expected(1,3) = 0.25 * ( 1 - ksi);
224 ETYPE::SF::GradientT result;
225 ETYPE::SF::compute_gradient(mapped_coords, result);
241 expected(0,0) = 0.2775;
242 expected(0,1) = -0.045;
243 expected(1,0) = 0.13625;
244 expected(1,1) = 0.5975;
253 nodes << 0. , 0. , 1. , 0., 1. , 1. , 0. , 1.;
260 BOOST_CHECK_EQUAL( d_phys[0], 1. );
261 BOOST_CHECK_EQUAL( d_phys[1], 1. );
267 expected(0,0) = 0.5975;
268 expected(0,1) = 0.045;
269 expected(1,0) = -0.13625;
270 expected(1,1) = 0.2775;
281 ConstFunctor ftor(
nodes);
286 cf3::Real result4 = 0.0;
287 cf3::Real result8 = 0.0;
288 cf3::Real result16 = 0.0;
289 cf3::Real result32 = 0.0;
291 gauss_integrate<1, GeoShape::QUAD>(ftor, ftor.mapped_coords,
result1);
292 gauss_integrate<2, GeoShape::QUAD>(ftor, ftor.mapped_coords,
result2);
293 gauss_integrate<4, GeoShape::QUAD>(ftor, ftor.mapped_coords, result4);
294 gauss_integrate<8, GeoShape::QUAD>(ftor, ftor.mapped_coords, result8);
295 gauss_integrate<16, GeoShape::QUAD>(ftor, ftor.mapped_coords, result16);
296 gauss_integrate<32, GeoShape::QUAD>(ftor, ftor.mapped_coords, result32);
308 BOOST_AUTO_TEST_SUITE_END()
boost::proto::terminal< SFOp< JacobianOp > >::type const jacobian
#define CFinfo
these are always defined
static void compute_jacobian_adjoint(const MappedCoordsT &mapped_coord, const NodesT &nodes, JacobianT &result)
ETYPE::MappedCoordsT mapped_coords
BOOST_AUTO_TEST_CASE(Volume)
static void compute_jacobian(const MappedCoordsT &mapped_coord, const NodesT &nodes, MatrixType &jacobian)
static Real jacobian_determinant(const MappedCoordsT &mapped_coord, const NodesT &nodes)
Real max(const Real a, const Real b)
Maximum between two scalars.
Real e()
Definition of the Unit charge [C].
boost::proto::terminal< SFOp< NodesOp > >::type const nodes
Eigen::Matrix< Real, nb_nodes, Hexa3D_traits::dimension > NodesT
Basic Classes for Mesh applications used by COOLFluiD.
namespace holding LagrangeP1 shape functions and elements
Top-level namespace for coolfluid.
static void compute_mapped_coordinate(const CoordsT &coord, const NodesT &nodes, MappedCoordsT &mapped_coord)
Eigen::Matrix< Real, Hexa3D_traits::dimension, 1 > CoordsT
Functions to provide integration over elements.
const ETYPE::MappedCoordsT mapped_coords
common values accessed by all tests goes here
Hexa3D_traits::SF::MappedCoordsT MappedCoordsT
~LagrangeP1Quad2DFixture()
common tear-down for each test case
unsigned int Uint
typedef for unsigned int
static Real volume(const NodesT &nodes)
Eigen::Matrix< Real, 2, 1 > RealVector2
Fixed size 2x1 column vector.
ConstFunctor(const NodesT &node_list)
LagrangeP1Quad2DFixture()
common setup for each test case
Eigen::Matrix< Real, Hexa3D_traits::SF::dimensionality, Hexa3D_traits::dimension > JacobianT
Most basic kernel library.
2D Lagrange P1 Quadrilateral Element type This class provides the lagrangian shape function describin...