COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-solver-physics-static.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 cf3::physics::PhysModel"
9 
10 #include <iostream>
11 
12 #include <boost/test/unit_test.hpp>
13 #include <boost/mpl/void.hpp>
14 
15 #include "common/CF.hpp"
16 
17 using namespace cf3;
18 
20 
21 BOOST_AUTO_TEST_SUITE( PhysicsStaticSuite )
22 
23 template<typename T1=boost::mpl::void_, typename T2=boost::mpl::void_, typename T3=boost::mpl::void_, typename T4=boost::mpl::void_, typename T5=boost::mpl::void_>
26 
28 template<typename T1, typename T2>
29 struct ComposedPhysics<T1, T2, boost::mpl::void_, boost::mpl::void_, boost::mpl::void_> : T1, T2
30 {
32  template<typename PhysicsT>
33  void compute(PhysicsT& physics)
34  {
35  T1::compute(physics);
36  T2::compute(physics);
37  };
38 
40  void compute()
41  {
42  T1::compute(*this);
43  T2::compute(*this);
44  }
45 };
46 
48 template<typename T1, typename T2, typename T3>
49 struct ComposedPhysics<T1, T2, T3, boost::mpl::void_, boost::mpl::void_> : T1, T2, T3
50 {
52  template<typename PhysicsT>
53  void compute(PhysicsT& physics)
54  {
55  T1::compute(physics);
56  T2::compute(physics);
57  T3::compute(physics);
58  };
59 
61  void compute()
62  {
63  T1::compute(*this);
64  T2::compute(*this);
65  T3::compute(*this);
66  }
67 };
68 
70 template<typename T1, typename T2, typename T3, typename T4>
71 struct ComposedPhysics<T1, T2, T3, T4, boost::mpl::void_> : T1, T2, T3, T4
72 {
74  template<typename PhysicsT>
75  void compute(PhysicsT& physics)
76  {
77  T1::compute(physics);
78  T2::compute(physics);
79  T3::compute(physics);
80  T4::compute(physics);
81  };
82 
84  void compute()
85  {
86  T1::compute(*this);
87  T2::compute(*this);
88  T3::compute(*this);
89  T4::compute(*this);
90  }
91 };
92 
95 {
97  Real p;
98 
100  Real u;
101 
103  Real v;
104 
106  template<typename T>
107  void compute(T&)
108  {
109  }
110 };
111 
114 {
116 
117  template<typename T>
118  void compute(T&)
119  {
120  }
121 };
122 
124 struct Air
125 {
127  Real cp;
128 
130  Real gamma;
131 
133  Real r;
134 
136  template<typename T>
138  {
139  physics.cp = 1010. * (physics.temperature + 1.) / physics.temperature; // dummy dependency on temperature
140  physics.gamma = 1.4;
141  physics.r = physics.cp - physics.cp / physics.gamma;
142  }
143 };
144 
147 {
149  Real rho;
150 
151  template<typename T>
153  {
154  physics.rho = physics.p / (physics.r * physics.temperature);
155  }
156 };
157 
158 
160 
161 BOOST_AUTO_TEST_CASE( PhysicsStatic )
162 {
164  physics.p = 101325.;
165  physics.temperature = 288.;
166  physics.compute();
167  BOOST_CHECK_CLOSE(physics.rho, 1.21497, 0.01);
168 }
169 
171 
172 BOOST_AUTO_TEST_SUITE_END()
173 
174 
Non-isothermal fluid (assume we get the temperature from somewhere else)
external boost library namespace
void compute(PhysicsT &physics)
Compute the physics in the supplied argument (used mainly for recursion)
BOOST_AUTO_TEST_CASE(PhysicsStatic)
Real cp
Heat capacity.
Real gamma
Isentropic coefficient.
Real r
Ideal gas constant.
void compute(PhysicsT &physics)
Compute the physics in the supplied argument (used mainly for recursion)
Store local fluid properties.
Properties of air that depend on temperature.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
void compute(T &)
Empty computation, properties come from the solution.
void compute(T &physics)
void compute(PhysicsT &physics)
Compute the physics in the supplied argument (used mainly for recursion)
coolfluid3 header, included almost everywhere
Prototype implementation of a static physics model. Compose up to 5 physical models.
void compute(T &physics)
Compute the properties from the temperature.
Use the perfect gas law to get density.
Send comments to:
COOLFluiD Web Admin