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>
48 using namespace boost;
53 BOOST_AUTO_TEST_SUITE( ProtoStokesArtifDissSuite )
58 BOOST_CHECK_SMALL(a - b, threshold);
76 const Real height = 2.;
77 const Uint x_segments = 25;
78 const Uint y_segments = 10;
80 const Real start_time = 0.;
81 const Real end_time = 5.;
85 const Real invdt = 1. /
dt;
90 const std::vector<Real>
u_wall(2, 0.);
93 const Real c = 0.5*(p0 - p1) / (rho * mu * length);
97 std::stringstream parabole_str;
98 parabole_str <<
"y*(" << height <<
"-y)*" << c;
99 std::vector<std::string> parabole_functions(2,
"0");
100 parabole_functions[0] = parabole_str.str();
104 const std::vector<std::string> names = boost::assign::list_of(
"stokes_artifdiss")(
"stokes_pspg")(
"navier_stokes_pspg")(
"navier_stokes_supg");
109 for(
Uint i = 0; i != names.size(); ++i)
111 std::cout <<
"\n################################## Running test for model " << names[i] <<
"##################################\n" << std::endl;
117 lss_action->set_solution_tag(
"navier_stokes_solution");
120 boost::shared_ptr<solver::actions::Iterate> time_loop = allocate_component<solver::actions::Iterate>(
"TimeLoop");
132 boost::shared_ptr<UFEM::ParsedFunctionExpression> vel_init = allocate_component<UFEM::ParsedFunctionExpression>(
"InitializeVelocity");
133 vel_init->set_expression(
nodes_expression(u = vel_init->vector_function()));
134 vel_init->options().set(
"value", parabole_functions);
139 boost::shared_ptr<UFEM::BoundaryConditions>
bc = allocate_component<UFEM::BoundaryConditions>(
"BoundaryConditions");
140 bc->set_solution_tag(
"navier_stokes_solution");
146 << allocate_component<math::LSS::ZeroLSS>(
"ZeroLSS")
147 << factories[i](*lss_action)
149 << allocate_component<math::LSS::SolveLSS>(
"SolveLSS")
166 physical_model.
options().
set(
"dynamic_viscosity", mu);
169 boost::shared_ptr<MeshGenerator>
create_rectangle = build_component_abstract_type<MeshGenerator>(
"cf3.mesh.SimpleMeshGenerator",
"create_line");
170 create_rectangle->options().set(
"mesh",domain.uri()/
"Mesh");
171 std::vector<Real> lengths(2); lengths[
XX] =
length; lengths[
YY] = height;
172 std::vector<Uint> nb_cells(2); nb_cells[
XX] = x_segments; nb_cells[
YY] = y_segments;
173 create_rectangle->options().set(
"lengths",lengths);
174 create_rectangle->options().set(
"nb_cells",nb_cells);
175 Mesh&
mesh = create_rectangle->generate();
181 ns_solver->
options().
set(
"lss", lss_action->get_child(
"LSS"));
185 bc->add_constant_bc(
"left",
"Pressure", p0);
186 bc->add_constant_bc(
"right",
"Pressure", p1);
187 bc->add_constant_bc(
"bottom",
"Velocity", u_wall);
188 bc->add_constant_bc(
"top",
"Velocity", u_wall);
189 bc->add_function_bc(
"left",
"Velocity")->options().set(
"value", parabole_functions);
200 domain.write_mesh(
"ns-test-" + names[i] +
".pvtu");
204 BOOST_AUTO_TEST_SUITE_END()
boost::shared_ptr< solver::actions::Proto::ProtoAction > stokes_pspg(LSSActionUnsteady &solver)
Assembly for the Stokes equations, stabilized with PSPG.
Time & create_time(const std::string &name="Time")
Create Time component.
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)
Handle< common::Action > add_unsteady_solver(const std::string &builder_name)
void configure_option_recursively(const std::string &optname, const boost::any &val)
boost::shared_ptr< solver::actions::Proto::ProtoAction > navier_stokes_pspg(LSSActionUnsteady &solver)
Assembly for the Navier-Stokes equations, stabilized with PSPG.
void check_close(const Real a, const Real b, const Real threshold)
Basic Classes for Solver applications used by CF.
URI uri() const
Construct the full path.
boost::shared_ptr< solver::actions::Proto::ProtoAction > navier_stokes_supg(LSSActionUnsteady &solver)
Assembly for the Navier-Stokes equations, stabilized with SUPG.
static boost::proto::terminal< void(*)(Real, Real, Real) >::type const _check_close
Manage a collection of UFEM solvers.
Real e()
Definition of the Unit charge [C].
Static functions for mathematical constants.
std::vector< Uint > SizesT
Refers to a value from the physical model.
Storage for time, and time steps for unsteady simulation.
Basic Classes for Mesh applications used by COOLFluiD.
tuple model
Global confifuration.
Handle< Component > get_child(const std::string &name)
boost::shared_ptr< solver::actions::Proto::ProtoAction > stokes_artifdiss(LSSActionUnsteady &solver)
Assembly for the Stokes equations, stabilized with artificial dissipation.
void init(int argc=0, char **args=0)
Top-level namespace for coolfluid.
virtual void simulate()
Simulates this model.
BOOST_AUTO_TEST_CASE(InitMPI)
boost::proto::terminal< SFOp< CoordinatesOp > >::type const coordinates
common::Component & root() const
Gives the default root component.
common::Environment & environment() const
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
Handle< Component > handle()
Get a handle to the component.
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.
bool is_not_null(T ptr)
predicate for comparison to nullptr
std::vector< std::string > StringsT