COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-lagrangep2b-triag2d.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for ETYPE"
9 
10 #include <boost/assign/list_of.hpp>
11 #include <boost/test/unit_test.hpp>
12 
13 #include "common/Log.hpp"
14 
16 
18 
19 using namespace boost::assign;
20 using namespace cf3;
21 using namespace cf3::mesh;
22 using namespace cf3::mesh::LagrangeP2B;
23 
25 
26 typedef Triag2D ETYPE;
27 
29 {
33  mapped_coords(1./6., 1./6.),
34  nodes((NodesT() <<
35  1.0, 0.0,
36  0.0, 2.0,
37  -1.0, 0.0,
38  0.5, 1.0,
39  -0.5, 1.0,
40  0.0, 0.0,
41  0.0, 2./3.).finished())
42  {}
43 
46 
49  const NodesT nodes;
50 
51 };
52 
54 
55 BOOST_FIXTURE_TEST_SUITE( LagrangeP2BTriag2DSuite, LagrangeP2BTriag2DFixture )
56 
57 
60 {
61  ETYPE::SF::ValueT reference_result;
62  reference_result << 5./18., -1./18., -1./18., 2./9., -1./9., 2./9., 0.5;
63  ETYPE::SF::ValueT result;
64  ETYPE::SF::compute_value(mapped_coords, result);
65 
66  std::cout<< reference_result << std::endl;
67  std::cout<< reference_result.sum() << std::endl;
68 
69  std::cout<< result << std::endl;
70  std::cout<< result.sum() << std::endl;
71 
72 
73  BOOST_CHECK_CLOSE ( result.sum(), 1.0, 1e-8 );
74 
75 }
76 
78 {
79 // const cf3::RealVector reference_result = list_of(5./18.)(-1./18.)(-1./18.)(2./9.)(-1./9.)(2./9.)(0.5);
80  ETYPE::SF::GradientT result;
81  ETYPE::SF::compute_gradient(mapped_coords, result);
82 
83 // std::cout<< reference_result << std::endl;
84 // std::cout<< reference_result.sum() << std::endl;
85 
86  std::cout<< result << std::endl;
87 
88  std::cout<< result(XX,0) + result(XX,1) + result(XX,2) + result(XX,3) + result(XX,4) + result(XX,5) + result(XX,6) << std::endl;
89  std::cout<< result(YY,0) + result(YY,1) + result(YY,2) + result(YY,3) + result(YY,4) + result(YY,5) + result(YY,6) << std::endl;
90 
91 
92  const ETYPE::MappedCoordsT m1(1./6., 5./6.);
93  ETYPE::SF::compute_gradient(m1, result);
94 
95  std::cout<< result << std::endl;
96 
97  std::cout<< result(XX,0) + result(XX,1) + result(XX,2) + result(XX,3) + result(XX,4) + result(XX,5) + result(XX,6) << std::endl;
98  std::cout<< result(YY,0) + result(YY,1) + result(YY,2) + result(YY,3) + result(YY,4) + result(YY,5) + result(YY,6) << std::endl;
99 
100  BOOST_CHECK_LE ( std::abs(result.sum()), 1e-14 );
101 }
102 
104 
105 BOOST_AUTO_TEST_SUITE_END()
106 
107 
namespace holding LagrangeP2B shape functions and elements
Real e()
Definition of the Unit charge [C].
Definition: Consts.hpp:30
boost::proto::terminal< SFOp< NodesOp > >::type const nodes
2D Lagrange P2B Triangular Element type This class provides the lagrangian shape function describing ...
Definition: Triag2D.hpp:37
Definition: Defs.hpp:17
Eigen::Matrix< Real, nb_nodes, Hexa3D_traits::dimension > NodesT
Basic Classes for Mesh applications used by COOLFluiD.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
const ETYPE::MappedCoordsT mapped_coords
common values accessed by all tests goes here
~LagrangeP2BTriag2DFixture()
common tear-down for each test case
Definition: Defs.hpp:17
LagrangeP2BTriag2DFixture()
common setup for each test case
BOOST_AUTO_TEST_CASE(ShapeFunction)
Send comments to:
COOLFluiD Web Admin