7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for heat-conduction related proto operations"
10 #include <boost/test/unit_test.hpp>
12 #define BOOST_PROTO_MAX_ARITY 10
13 #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
14 #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
15 #define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 10
49 using namespace boost;
54 BOOST_AUTO_TEST_SUITE( ProtoSystemSuite )
65 std::vector<Real> outside_temp(2, 1.);
66 RealVector initial_temp(2); initial_temp << 100., 200.;
67 const Uint nb_segments = 10;
68 const Real end_time = 0.5;
70 const boost::proto::literal<RealVector> alpha(
RealVector2(1., 2.));
83 boost::mpl::vector1<mesh::LagrangeP1::Quad2D> allowed_elements;
86 boost::shared_ptr<UFEM::BoundaryConditions>
bc = allocate_component<UFEM::BoundaryConditions>(
"BoundaryConditions");
92 << allocate_component<math::LSS::ZeroLSS>(
"ZeroLSS")
93 << create_proto_action
105 _T(v[_i], v[_i]) += lss_action->invdt() * (
transpose(
N(v)) *
N(v))
107 lss_action->system_matrix +=
_T + 0.5 *
_A,
108 lss_action->system_rhs += -(
_A *
_x)
113 << allocate_component<math::LSS::SolveLSS>(
"SolveLSS")
120 boost::shared_ptr<MeshGenerator>
create_rectangle = build_component_abstract_type<MeshGenerator>(
"cf3.mesh.SimpleMeshGenerator",
"create_line");
121 create_rectangle->options().set(
"mesh",domain.uri()/
"Mesh");
122 std::vector<Real> lengths(2); lengths[
XX] =
length; lengths[
YY] = 0.5*
length;
123 std::vector<Uint> nb_cells(2); nb_cells[
XX] = 2*nb_segments; nb_cells[
YY] = nb_segments;
124 create_rectangle->options().set(
"lengths",lengths);
125 create_rectangle->options().set(
"nb_cells",nb_cells);
126 Mesh&
mesh = create_rectangle->generate();
128 lss_action->options().set(
"regions", std::vector<URI>(1, mesh.
topology().
uri()));
129 ic->get_child(
"Initialize")->options().set(
"regions", std::vector<URI>(1, mesh.
topology().
uri()));
131 bc->add_constant_bc(
"left",
"VectorVariable", outside_temp);
132 bc->add_constant_bc(
"right",
"VectorVariable", outside_temp);
133 bc->add_constant_bc(
"bottom",
"VectorVariable", outside_temp);
134 bc->add_constant_bc(
"top",
"VectorVariable", outside_temp);
145 domain.create_component(
"VTKwriter",
"cf3.mesh.VTKXML.Writer");
146 domain.write_mesh(
URI(
"systems.pvtu"));
168 BOOST_AUTO_TEST_SUITE_END()
boost::proto::terminal< SFOp< ShapeFunctionOp > >::type const N
Time & create_time(const std::string &name="Time")
Create Time component.
static boost::proto::terminal< ZeroTag >::type _0
Placeholder for the zero matrix.
virtual mesh::Domain & create_domain(const std::string &name)
creates a domain in this model
Safe pointer to an object. This is the supported method for referring to components.
external boost library namespace
virtual physics::PhysModel & create_physics(const std::string &builder)
static boost::proto::terminal< ElementSystemMatrix< boost::mpl::int_< 0 > > >::type const _A
Some predefined element matrices (more can be user-defined, but you have to change the number in the ...
Handle< common::Action > add_unsteady_solver(const std::string &builder_name)
static boost::proto::terminal< ElementSystemMatrix< boost::mpl::int_< 1 > > >::type const _T
Basic Classes for Solver applications used by CF.
URI uri() const
Construct the full path.
static boost::proto::terminal< ElementQuadratureTag >::type element_quadrature
Use element_quadrature(expr1, expr2, ..., exprN) to evaluate a group of expressions.
boost::shared_ptr< ElementsExpression< ExprT, ElementTypes > > elements_expression(ElementTypes, const ExprT &expr)
Manage a collection of UFEM solvers.
static boost::proto::terminal< ElementRHS >::type const _x
Terminal for the element RHS vector ("b")
Static functions for mathematical constants.
Storage for time, and time steps for unsteady simulation.
boost::proto::terminal< TransposeFunction >::type const transpose
boost::proto::terminal< SFOp< NablaOp > >::type const nabla
std::vector< std::string > StringsT
Basic Classes for Mesh applications used by COOLFluiD.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealVector
Dynamic sized column vector.
tuple model
Global confifuration.
std::vector< Uint > SizesT
Handle< Component > get_child(const std::string &name)
void init(int argc=0, char **args=0)
Top-level namespace for coolfluid.
virtual void simulate()
Simulates this model.
static boost::proto::terminal< IndexTag< boost::mpl::int_< 0 > > >::type const _i
Index looping over the dimensions of a variable.
common::Component & root() const
Gives the default root component.
static boost::proto::terminal< ExpressionGroupTag >::type group
Use group(expr1, expr2, ..., exprN) to evaluate a group of expressions.
BOOST_AUTO_TEST_CASE(InitMPI)
unsigned int Uint
typedef for unsigned int
Eigen::Matrix< Real, 2, 1 > RealVector2
Fixed size 2x1 column vector.
boost::shared_ptr< ProtoAction > create_proto_action(const std::string &name, const boost::shared_ptr< Expression > &expression)
Create a new ProtoAction, immediatly setting the expression.
Region & topology() const
boost::shared_ptr< NodesExpression< ExprT, boost::mpl::range_c< Uint, 1, 4 > > > nodes_expression(const ExprT &expr)
static Comm & instance()
Return a reference to the current PE.
void set(const std::string &pname, const boost::any &val)
Handle< Component > create_component(const std::string &name, const std::string &builder)
Build a (sub)component of this component using the extended type_name of the component.
Most basic kernel library.