TrioCFD 1.9.8
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}
classe Champ_Don_base classe de base des Champs donnes (non calcules)
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
virtual const Champ_Don_base & gravite() const
Renvoie la gravite du milieu si elle a ete associe provoque une erreur sinon.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
virtual const Milieu_base & milieu() const
Renvoie le milieu physique associe au probleme.
Classe de base des flux de sortie.
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