TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Source_Flottabilite.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Source_Flottabilite.h>
17#include <Probleme_base.h>
18#include <Milieu_base.h>
19
20Implemente_instanciable(Source_Flottabilite,"Flottabilite",Source_Action_Particules);
21
22
24{
25 return s << que_suis_je() ;
26}
27
28
30{
31 return s;
32}
33
34//L expression codee est precisee dans l entete de la classe
35DoubleTab& Source_Flottabilite::ajouter(DoubleTab& resu) const
36{
37 const DoubleTab& gradient_p = grad_pression();
38 ///const DoubleTab& rho_f = rho_fluide();
39 const Champ_Don_base& champ_gravite = equation().probleme().milieu().gravite();
40 const DoubleTab& gravite = champ_gravite.valeurs();
41 const DoubleTab& rho_p = rho_particules();
42 const DoubleTab& volume_p = volumes_particules();
43
44 const int dim0 = rho_p .dimension(0);
45 const int dim1 = Objet_U::dimension;
46 double masse_particule, terme_pression;
47
48 for (int i=0; i<dim0; i++)
49 {
50 for (int j=0; j<dim1; j++)
51 {
52 masse_particule = rho_p(i,0)*volume_p(i,0)*gravite(0,j);
53 terme_pression = gradient_p(i,j)*volume_p(i,0);
54 resu(i,j) += masse_particule-terme_pression;
55 }
56 }
57
58 return resu;
59}
60
61
62DoubleTab& Source_Flottabilite::calculer(DoubleTab& resu) const
63{
64 resu = 0;
65 return ajouter(resu);
66}
class Champ_Don_base base class of Given Fields (not calculated)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Probleme_base & probleme()
Returns the problem associated with the equation.
virtual const Champ_Don_base & gravite() const
Returns the gravity of the medium if it has been associated, raises an error otherwise (const version...
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
virtual const Milieu_base & milieu() const
Returns the physical medium associated with the problem (const version).
Base class for output streams.
Definition Sortie.h:52
Classe Source_Action_Particules Classe mere des classes designant une force exercee par le fluide sur...
const DoubleTab & rho_particules() const
const DoubleTab & volumes_particules() const
const DoubleTab & grad_pression() const
class Source_Flottabilite Calcul de la force de flottabilite (expression vectorielle) :
DoubleTab & ajouter(DoubleTab &) const override
DoubleTab & calculer(DoubleTab &) const override
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133