TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Gravite_Multiphase.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Gravite_Multiphase.h>
17#include <Pb_Multiphase.h>
18#include <Discret_Thyd.h>
19
20Implemente_instanciable(Gravite_Multiphase, "Gravite_Multiphase", Correlation_base);
21
23{
24 return os;
25}
26
28{
29 OWN_PTR(Champ_Don_base) gravite_don_;
30 is >> gravite_don_;
31
32 Pb_Multiphase& pb = ref_cast(Pb_Multiphase, pb_.valeur());
33 int D = dimension;
34 const Discret_Thyd& dis=ref_cast(Discret_Thyd,pb.discretisation());
35 Noms noms(D), unites(D);
36 noms[0] = "gravite";
37 unites[0] = "m/s^2";
38 Motcle typeChamp = "champ_elem" ;
39 const Domaine_dis_base& z = pb.domaine_dis();
40 dis.discretiser_champ(typeChamp, z, scalaire, noms , unites, D, 0, gravite_);
41
42 champs_compris_.ajoute_champ(gravite_);
43
44 gravite_->affecter(gravite_don_.valeur());
45 gravite_->valeurs().echange_espace_virtuel();
46
47 return is;
48}
49
50bool Gravite_Multiphase::has_champ(const Motcle& nom, OBS_PTR(Champ_base) &ref_champ) const
51{
52 if (nom == "gravite")
53 return champs_compris_.has_champ(nom, ref_champ);
54
55 return false; /* rien trouve */
56}
57
59{
60 if (nom == "gravite")
61 return true;
62
63 return false; /* rien trouve */
64}
65
67{
68 if (nom == "gravite")
69 return champs_compris_.get_champ(nom);
70
71 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
72}
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
Champs_compris champs_compris_
OBS_PTR(Probleme_base) pb_
void discretiser_champ(const Motcle &directive, const Domaine_dis_base &z, const Nom &nom, const Nom &unite, int nb_comp, int nb_pas_dt, double temps, OWN_PTR(Champ_Inc_base)&champ, const Nom &sous_type=NOM_VIDE) const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Gravite_Multiphase Contient un champ de gravite defini par l'utilisateur
OWN_PTR(Champ_Fonc_base) gravite_
const Champ_base & get_champ(const Motcle &nom) const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
const std::string & getString() const
Definition Nom.h:92
static int dimension
Definition Objet_U.h:99
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
const Discretisation_base & discretisation() const
Renvoie la discretisation associee au probleme.
const Domaine_dis_base & domaine_dis() const
Renvoie le domaine discretise associe au probleme.
Classe de base des flux de sortie.
Definition Sortie.h:52