#include <Convection.hpp>


Public Types | |
| enum | Type { cfunction, constant, convection, dgfunction, femfunction, linearBasis, spectral, unaryMinus, modulo, sum, difference, product, division, power, min, max, gt, ge, lt, le, ne, eq, and_, or_, xor_, not_, derivate, integrate, normal, domainCharacteristic, meshCharacteristic, objectCharacteristic, composed, references, FEM0, undefined } |
Public Member Functions | |
| real_t | operator() (const TinyVector< 3 > &X) const |
| Ealuates the convected function at position X. | |
| bool | canBeSimplified () const |
| Convection (const Convection< MeshOfTetrahedra > &C) | |
| Convection (const ScalarFunctionBase &phi, const FieldOfScalarFunction &u, const real_t &dt, const MeshOfTetrahedra &M) | |
| ~Convection () | |
| void | setName (const std::string &name) |
| const std::string & | name () const |
| const Type & | type () const |
| real_t | operator() (const real_t &x, const real_t &y, const real_t &z) const |
| virtual real_t | operator() (const TinyVector< 3, real_t > &X) const =0 |
| virtual real_t | dx (const TinyVector< 3, real_t > &x) const |
| virtual real_t | dy (const TinyVector< 3, real_t > &x) const |
| virtual real_t | dz (const TinyVector< 3, real_t > &x) const |
Protected Attributes | |
| const Type | __type |
| std::string | __name |
Private Member Functions | |
| std::ostream & | __put (std::ostream &os) const |
Private Attributes | |
| const real_t | __deltaT |
| The time interval for the equation integration. | |
| const MeshOfTetrahedra & | __mesh |
| __mesh where to convect v. | |
| const FieldOfScalarFunction & | __u |
The function. | |
| const ScalarFunctionBase & | __phi |
| __phi The scalar function that is to convect. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const ScalarFunctionBase &scalarFunction) |
Definition at line 251 of file Convection.hpp.
enum ScalarFunctionBase::Type [inherited] |
Definition at line 40 of file ScalarFunctionBase.hpp.
00040 { 00041 cfunction, 00042 constant, 00043 convection, 00044 dgfunction, 00045 femfunction, 00046 linearBasis, 00047 spectral, 00048 unaryMinus, 00049 00050 modulo, 00051 sum, 00052 difference, 00053 product, 00054 division, 00055 power, 00056 00057 min, 00058 max, 00059 00060 gt, 00061 ge, 00062 lt, 00063 le, 00064 ne, 00065 eq, 00066 and_, 00067 or_, 00068 xor_, 00069 00070 not_, 00071 00072 derivate, 00073 integrate, 00074 00075 normal, 00076 00077 domainCharacteristic, 00078 meshCharacteristic, 00079 objectCharacteristic, 00080 00081 composed, 00082 references, 00083 00084 FEM0, 00085 00086 undefined 00087 };
| Convection< MeshOfTetrahedra >::Convection | ( | const Convection< MeshOfTetrahedra > & | C | ) | [inline] |
Copy constructor
| C | given convection function |
Definition at line 354 of file Convection.hpp.
00355 : ScalarFunctionBase(ScalarFunctionBase::convection), 00356 __deltaT(C.__deltaT), 00357 __mesh(C.__mesh), 00358 __u(C.__u), 00359 __phi(C.__phi) 00360 { 00361 ; 00362 }
| Convection< MeshOfTetrahedra >::Convection | ( | const ScalarFunctionBase & | phi, | |
| const FieldOfScalarFunction & | u, | |||
| const real_t & | dt, | |||
| const MeshOfTetrahedra & | M | |||
| ) | [inline] |
Constructor
| phi | the function to convect | |
| u | the velocity field | |
| dt | the time step | |
| M | the mesh |
Definition at line 372 of file Convection.hpp.
00376 : ScalarFunctionBase(ScalarFunctionBase::convection), 00377 __deltaT(dt), 00378 __mesh(M), 00379 __u(u), 00380 __phi(phi) 00381 { 00382 ; 00383 }
| Convection< MeshOfTetrahedra >::~Convection | ( | ) | [inline] |
| std::ostream& Convection< MeshOfTetrahedra >::__put | ( | std::ostream & | os | ) | const [inline, private, virtual] |
Writes the function to a stream
| os | output stream |
Implements ScalarFunctionBase.
Definition at line 255 of file Convection.hpp.
00256 { 00257 os << "convect(" << __u << "," 00258 << __deltaT << ',' << __phi << ')'; 00259 return os; 00260 }
| real_t Convection< MeshOfTetrahedra >::operator() | ( | const TinyVector< 3 > & | X | ) | const [inline] |
Ealuates the convected function at position X.
Definition at line 275 of file Convection.hpp.
References Connectivity< MeshType >::cells(), Mesh::T_iterator< MeshType, CellType >::end(), ConnectivityBuilder< MeshType >::generates(), Tetrahedron::getBarycentricCoordinates(), and Connectivity< MeshType >::hasCellToCells().
00276 { 00277 const real_t epsilon = 1E-6; 00278 MeshOfTetrahedra::const_iterator t = __mesh.find(X[0], X[1], X[2]); 00279 if (t.end()) return 0; // we are outside the mesh 00280 00281 const ScalarFunctionBase& u0 = *__u.function(0); 00282 const ScalarFunctionBase& u1 = *__u.function(1); 00283 const ScalarFunctionBase& u2 = *__u.function(2); 00284 00285 const Connectivity<MeshOfTetrahedra>& connectivity = __mesh.connectivity(); 00286 if (not(connectivity.hasCellToCells())) { 00287 ConnectivityBuilder<MeshOfTetrahedra> c(__mesh); 00288 c.generates(Connectivity<MeshOfTetrahedra>::CellToCells); 00289 } 00290 00291 TinyVector<3, real_t> X0 = X; 00292 00293 real_t dt0 = __deltaT; 00294 do { 00295 TinyVector<3, real_t> X1; 00296 X1[0] = X0[0]-u0(X0)*dt0; 00297 X1[1] = X0[1]-u1(X0)*dt0; 00298 X1[2] = X0[2]-u2(X0)*dt0; 00299 00300 TinyVector<4, real_t> lambda1; 00301 const Tetrahedron& T = (*t); 00302 T.getBarycentricCoordinates(X1, lambda1); 00303 if((lambda1[0]>-epsilon) 00304 and(lambda1[1]>-epsilon) 00305 and(lambda1[2]>-epsilon) 00306 and(lambda1[3]>-epsilon)) { 00307 dt0 = 0; 00308 X0 = X1; 00309 } else { 00310 TinyVector<4, real_t> lambda0; 00311 T.getBarycentricCoordinates(X0, lambda0); 00312 00313 TinyVector<4, real_t> deltaLambda = lambda1-lambda0; 00314 real_t coeff = std::numeric_limits<real_t>::max(); 00315 size_t outGoingFace=std::numeric_limits<size_t>::max(); 00316 for (size_t i=0; i<4; ++i) { 00317 if (lambda1[i] <= -epsilon) { 00318 real_t tmp = -lambda0[i]/deltaLambda[i]; 00319 if ((std::abs(tmp) < std::abs(coeff))) { 00320 coeff = tmp; 00321 outGoingFace = i; 00322 } 00323 } 00324 } 00325 if (not(std::abs(lambda0[outGoingFace]) < epsilon)) { // we are not going back to the previous element 00326 const real_t dt = dt0*coeff; 00327 dt0-=dt; 00328 X0 += coeff * (X1-X0); 00329 T.getBarycentricCoordinates(X0, lambda0); 00330 } 00331 00332 t = connectivity.cells(*t)[outGoingFace]; 00333 if (t.end()) { dt0=0; } // takes the value on the border when going outside 00334 } 00335 } while (dt0>0); 00336 return __phi(X0); 00337 }

| bool Convection< MeshOfTetrahedra >::canBeSimplified | ( | ) | const [inline, virtual] |
Checks if the function can be simplified
Implements ScalarFunctionBase.
Definition at line 344 of file Convection.hpp.
| void ScalarFunctionBase::setName | ( | const std::string & | name | ) | [inline, inherited] |
Sets the name of the function
| name | name to give to this function |
Definition at line 109 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__name.
Referenced by FunctionExpressionVariable::execute().
| const std::string& ScalarFunctionBase::name | ( | ) | const [inline, inherited] |
Gets the name of the function
Definition at line 119 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__name.
00120 { 00121 return __name; 00122 }
| const Type& ScalarFunctionBase::type | ( | ) | const [inline, inherited] |
Read-only access to the type of the function
Definition at line 129 of file ScalarFunctionBase.hpp.
References ScalarFunctionBase::__type.
Referenced by WriterVTK::__fillCrossedComponent(), WriterMedit::__fillCrossedComponent(), ScalarFunctionBuilder::Simplifier::__getOperatorF1SimplifiedFunction(), ScalarFunctionBuilder::Simplifier::__getOperatorSimplifiedFunction(), WriterVTK::__proceed(), WriterMedit::__proceedData(), WriterRaw::__saveScalarFunction(), FEMDiscretization< Structured3DMesh, TypeOfDiscretization >::assembleSecondMember(), InstructionAffectation< FunctionExpression, FunctionVariable >::execute(), FEMFunction< MeshType, FiniteElementTraits >::operator=(), and DGFunction< MeshType, FiniteElementTraits >::operator=().
00130 { 00131 return __type; 00132 }
| real_t ScalarFunctionBase::operator() | ( | const real_t & | x, | |
| const real_t & | y, | |||
| const real_t & | z | |||
| ) | const [inline, inherited] |
Evaluates the function at point 
| x | | |
| y | | |
| z | ![]() |
Definition at line 162 of file ScalarFunctionBase.hpp.
00165 { 00166 return this->operator()(TinyVector<3, real_t>(x,y,z)); 00167 }
| virtual real_t ScalarFunctionBase::operator() | ( | const TinyVector< 3, real_t > & | X | ) | const [pure virtual, inherited] |
Evaluates the gunction at point 
| X | point of evaluation of the function |
Implemented in DGFunction< MeshType, FiniteElementTraits >, FEMFunction< MeshType, FiniteElementTraits >, ScalarFunctionAnd, ScalarFunctionCFunction, ScalarFunctionComposed, ScalarFunctionConstant, ScalarFunctionDerivative, ScalarFunctionDifference, ScalarFunctionDivision, ScalarFunctionDomainCharacteristic, ScalarFunctionEqual, ScalarFunctionGreaterEqual, ScalarFunctionGreaterThan, ScalarFunctionIntegrate, ScalarFunctionLinearBasis, ScalarFunctionLowerEqual, ScalarFunctionLowerThan, ScalarFunctionMax, ScalarFunctionMeshCharacteristic, ScalarFunctionMeshElementsReferences, ScalarFunctionMin, ScalarFunctionModulo, ScalarFunctionNormal, ScalarFunctionNot, ScalarFunctionNotEqual, ScalarFunctionObjectCharacteristic, ScalarFunctionOr, ScalarFunctionPower, ScalarFunctionProduct, ScalarFunctionSum, ScalarFunctionUnaryMinus, ScalarFunctionXor, and SpectralFunction.
| virtual real_t ScalarFunctionBase::dx | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates first derivative of the function
| x | position of evaluation |
at position
Definition at line 185 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00186 { 00187 std::stringstream errorMsg; 00188 00189 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00190 errorMsg << "the function " << (*this) << " is not of that kind" 00191 << std::ends; 00192 00193 throw ErrorHandler(__FILE__,__LINE__, 00194 errorMsg.str(), 00195 ErrorHandler::normal); 00196 return 0; 00197 }
| virtual real_t ScalarFunctionBase::dy | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates second derivative of the function
| x | position of evaluation |
at position
Definition at line 206 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00207 { 00208 std::stringstream errorMsg; 00209 00210 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00211 errorMsg << "the function " << (*this) << " is not of that kind" 00212 << std::ends; 00213 00214 throw ErrorHandler(__FILE__,__LINE__, 00215 errorMsg.str(), 00216 ErrorHandler::normal); 00217 return 0; 00218 }
| virtual real_t ScalarFunctionBase::dz | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, virtual, inherited] |
Evaluates third derivative of the function
| x | position of evaluation |
at position
Definition at line 227 of file ScalarFunctionBase.hpp.
References ErrorHandler::normal.
00228 { 00229 std::stringstream errorMsg; 00230 00231 errorMsg << "cannot compute derivative of non discrete functions :-(\n"; 00232 errorMsg << "the function " << (*this) << " is not of that kind" 00233 << std::ends; 00234 00235 throw ErrorHandler(__FILE__,__LINE__, 00236 errorMsg.str(), 00237 ErrorHandler::normal); 00238 return 0; 00239 }
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const ScalarFunctionBase & | scalarFunction | |||
| ) | [friend, inherited] |
Writes the function scalarFunction to the stream os
| os | the output stream | |
| scalarFunction | the function to write |
Definition at line 142 of file ScalarFunctionBase.hpp.
00144 { 00145 if (scalarFunction.__name.size()>0) { 00146 os << scalarFunction.__name; 00147 return os; 00148 } else { 00149 return scalarFunction.__put(os); 00150 } 00151 }
const real_t Convection< MeshOfTetrahedra >::__deltaT [private] |
const MeshOfTetrahedra& Convection< MeshOfTetrahedra >::__mesh [private] |
const FieldOfScalarFunction& Convection< MeshOfTetrahedra >::__u [private] |
const ScalarFunctionBase& Convection< MeshOfTetrahedra >::__phi [private] |
const Type ScalarFunctionBase::__type [protected, inherited] |
type of the function
Definition at line 90 of file ScalarFunctionBase.hpp.
Referenced by ScalarFunctionBase::type().
std::string ScalarFunctionBase::__name [protected, inherited] |
name of the function
Definition at line 92 of file ScalarFunctionBase.hpp.
Referenced by ScalarFunctionBase::name(), and ScalarFunctionBase::setName().
1.5.6