TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Terme_Derivee_Forme_base.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Champ_val_tot_sur_vol_base.h>
17#include <Terme_Derivee_Forme_base.h>
18#include <Discretisation_base.h>
19#include <Champ_Fonc_Tabule.h>
20#include <Champ_Uniforme.h>
21#include <Probleme_base.h>
22#include <Equation_base.h>
23#include <Milieu_base.h>
24
25Implemente_base(Terme_Derivee_Forme_base,"Terme_Derivee_Forme_base",Source_base);
26// XD derivee_forme source_base derivee_forme NO_BRACE Class to define a source term corresponding to the shape
27// XD_CONT derivative in the projection equation.
28
30{
31 Cerr << "Derived shape reading" << finl;
32
33 equation().discretisation().discretiser_champ(equation().discretisation().is_poly_family() ? "temperature" : "champ_elem", equation().domaine_dis(), "derivee_forme", ",",1,0., source_derivee_forme);
34 source_derivee_forme->nommer("derivee_forme");
35 source_derivee_forme->valeurs() = 0.;
36 champs_compris_.ajoute_champ(source_derivee_forme);
37 return s;
38}
39
41{
42 return s << que_suis_je() ;
43}
44
46{
47 if (source_derivee_forme->le_nom()!="derivee_forme")
48 {
49 fichier+="_";
50 fichier+=source_derivee_forme->le_nom();
51 }
52}
53
55{
56 DoubleTab& chpval = ref_cast_non_const(DoubleTab, source_derivee_forme->valeurs());
57 assert(chpval.dimension(0) == chp.dimension(0));
58 assert(chpval.dimension(1) == chp.dimension(1));
59 for (int i=0; i<chpval.dimension(0); i++)
60 {
61 for (int j=0; j<chpval.dimension(1); j++)
62 {
63 chpval(i,j) = chp(i,j);
64 }
65 }
66}
67
69{
70 source_derivee_forme->mettre_a_jour(temps);
71}
72
73DoubleTab& Terme_Derivee_Forme_base::calculer(DoubleTab& resu) const
74{
75 resu = 0;
76 return ajouter(resu);
77}
78
80{
81 const Domaine_dis_base& le_dom_dis = equation().domaine_dis();
82 const Probleme_base& pb = equation().probleme();
83 if (motlu=="source_from_shape_deriv" && !champ_derivee_forme_)
84 {
85 Noms noms(1);
86 noms[0]="source_from_shape_deriv";
87 Noms unites(1);
88 unites[0] = "-";
89 pb.discretisation().discretiser_champ("champ_elem",le_dom_dis,scalaire,noms,unites,1,0.,champ_derivee_forme_);
90 champs_compris_.ajoute_champ(champ_derivee_forme_);
91 }
92}
93
95{
96 Noms noms_compris = champs_compris_.liste_noms_compris();
97 noms_compris.add("source_from_shape_deriv");
98 if (opt==DESCRIPTION)
99 Cerr<<" Terme_Derivee_Forme_base : "<< noms_compris <<finl;
100 else
101 nom.add(noms_compris);
102}
103
105{
106 if (nom == "source_from_shape_deriv" && champ_derivee_forme_)
107 {
108 ref_champ = get_champ(nom);
109 return true;
110 }
111 else if (champs_compris_.has_champ(nom, ref_champ))
112 return true;
113 else
114 return false;
115}
116
118{
119 if (nom == "source_from_shape_deriv" && champ_derivee_forme_)
120 return true;
121 else
122 return champs_compris_.has_champ(nom);
123}
124
126{
127 if (nom=="source_from_shape_deriv")
128 {
129 if (!champ_derivee_forme_)
130 throw std::runtime_error(std::string("Field ") + nom.getString() + std::string(" not found !"));
131
132 // Initialisation a 0 du champ_derivee_forme_
133 DoubleTab& valeurs = champ_derivee_forme_->valeurs();
134 valeurs=0.;
135 const DoubleTab& derivee_forme_Array = source_derivee_forme->valeurs();
136 if (derivee_forme_Array.size_array()>0)
137 {
138 int nb_d0 = derivee_forme_Array.dimension(0);
139 int nb_d1 = derivee_forme_Array.dimension(1);
140 for (int num0=0; num0<nb_d0; num0++)
141 for (int num1=0; num1<nb_d1; num1++)
142 valeurs(num0,num1)=derivee_forme_Array(num0,num1);
143 }
144 valeurs.echange_espace_virtuel();
145 champ_derivee_forme_ ->mettre_a_jour(equation().probleme().schema_temps().temps_courant());
146 return champs_compris_.get_champ(nom);
147 }
148 else
149 return champs_compris_.get_champ(nom);
150}
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
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
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
OBS_PTR(Equation_base) mon_equation
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const std::string & getString() const
Definition Nom.h:92
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
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
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
const Discretisation_base & discretisation() const
Renvoie la discretisation associee au probleme.
Classe de base des flux de sortie.
Definition Sortie.h:52
classe Source_base Un objet Source_base est un terme apparaissant au second membre d'une
Definition Source_base.h:42
Champs_compris champs_compris_
const Nom fichier() const
Definition Source_base.h:85
virtual DoubleTab & ajouter(DoubleTab &) const
_SIZE_ size_array() const
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
Classe Terme_Derivee_Forme_base Cette classe represente un terme source de l'equation de projection e...
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
const Champ_base & get_champ(const Motcle &) const override
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void mettre_a_jour(double) override
DOES NOTHING - to override in derived classes.
void set_source_derivee_forme(DoubleTab &) const
void creer_champ(const Motcle &motlu) override
DoubleTab & calculer(DoubleTab &) const override