TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Navier_Stokes_Aposteriori.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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 <Estimateur_Aposteriori_P0_VEF.h>
17#include <Navier_Stokes_Aposteriori.h>
18#include <Champ_P1_isoP1Bulle.h>
19#include <Discretisation_base.h>
20#include <Schema_Temps_base.h>
21#include <Postraitements.h>
22#include <Probleme_base.h>
23#include <Champ_P1NC.h>
24#include <EChaine.h>
25
26Implemente_instanciable(Navier_Stokes_Aposteriori,"Navier_Stokes_Aposteriori",Navier_Stokes_std);
27// XD Navier_Stokes_Aposteriori navier_stokes_standard Navier_Stokes_Aposteriori INHERITS_BRACE Modification of the
28// XD_CONT Navier_Stokes_standard class in order to accept the estimateur_aposteriori post-processing. To post-process
29// XD_CONT estimateur_aposteriori, add this keyword into the list of fields to be post-processed. This estimator whill
30// XD_CONT generate a map of aposteriori error estimators; it is defined on each mesh cell and is a measure of the local
31// XD_CONT discretisation error. This will serve for adaptive mesh refinement
32
35
37{
38 if (discretisation().que_suis_je() != "VEFPreP1B")
39 {
40 Cerr << "Error : Pb_Hydraulique_Aposteriori is currently only available for the discretization VEFPreP1B !" << finl;
41 Cerr << "Please update your data file ..." << finl;
43 }
45}
46
48{
50
51 if (motlu == "estimateur_aposteriori")
52 {
53 if (!estimateur_aposteriori_)
54 {
55 estimateur_aposteriori();
56 champs_compris_.ajoute_champ(estimateur_aposteriori_);
57
58 Nom chaine = "{ numero_source 0 sources { refChamp { pb_champ ";
59 chaine += probleme().le_nom();
60 chaine += " vitesse } } }";
61 EChaine echaine(chaine);
62 echaine >> champ_src_;
63 champ_src_.completer(probleme().postraitements().front());
64 }
65 }
66}
67
68
70{
72 Noms noms_compris = champs_compris_.liste_noms_compris();
73 noms_compris.add("estimateur_aposteriori");
74 if (opt==DESCRIPTION)
75 Cerr<<" Navier_Stokes_Aposteriori : "<< noms_compris <<finl;
76 else
77 nom.add(noms_compris);
78}
79
80bool Navier_Stokes_Aposteriori::has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const
81{
82 if (nom == "estimateur_aposteriori")
83 {
85 return true;
86 }
87 else
88 return Navier_Stokes_std::has_champ(nom, ref_champ);
89}
90
92{
93 if (nom == "estimateur_aposteriori")
94 return true;
95 else
97}
98
100{
101 const double temps_init = schema_temps().temps_init();
102
103 if (nom == "estimateur_aposteriori")
104 {
105 Champ_Fonc_base& ch = ref_cast_non_const(Champ_Fonc_base, estimateur_aposteriori_.valeur());
106 if (((ch.temps() != la_vitesse->temps()) || (ch.temps() == temps_init)) && (la_vitesse->mon_equation_non_nul()))
107 ch.mettre_a_jour(la_vitesse->temps());
108
109 return champs_compris_.get_champ(nom);
110 }
111 else
113}
114
115void Navier_Stokes_Aposteriori::estimateur_aposteriori()
116{
117 const Domaine_VEF& domaine_vef = ref_cast(Domaine_VEF, domaine_dis());
118 const Domaine_Cl_VEF& domaine_cl_vef = ref_cast(Domaine_Cl_VEF, domaine_Cl_dis());
119 estimateur_aposteriori_.typer("Estimateur_Aposteriori_P0_VEF");
120 Estimateur_Aposteriori_P0_VEF& ch = ref_cast(Estimateur_Aposteriori_P0_VEF, estimateur_aposteriori_.valeur());
121 ch.associer_domaine_dis_base(domaine_vef);
122 const Champ_P1NC& vit = ref_cast(Champ_P1NC, la_vitesse.valeur());
123 const Champ_P1_isoP1Bulle& pres = ref_cast(Champ_P1_isoP1Bulle, la_pression.valeur());
124 ch.associer_champ(vit, pres, diffusivite_pour_transport() /* viscosite_cinematique */, domaine_cl_vef);
125 ch.nommer("estimateur_aposteriori");
126 ch.fixer_nb_comp(1);
127 ch.fixer_nb_valeurs_nodales(domaine_vef.nb_elem());
128 ch.fixer_unite("sans");
129 ch.changer_temps(la_vitesse->temps());
130}
int fixer_nb_valeurs_nodales(int n) override
Fixe le nombre de degres de liberte par composante.
classe Champ_Fonc_base Classe de base des champs qui sont fonction d'une grandeur calculee
void associer_domaine_dis_base(const Domaine_dis_base &) override
void mettre_a_jour(double temps) override
Mise a jour en temps du champ.
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
virtual double changer_temps(const double t)
Fixe le temps auquel se situe le champ.
double temps() const
Renvoie le temps du champ.
class Domaine_VEF
Definition Domaine_VEF.h:54
Une entree dont la source est une chaine de caracteres.
Definition EChaine.h:31
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.
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
Probleme_base & probleme()
Renvoie le probleme associe a l'equation.
Schema_Temps_base & schema_temps()
Renvoie le schema en temps associe a l'equation.
Champs_compris champs_compris_
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
void associer_champ(const Champ_P1NC &, const Champ_P1_isoP1Bulle &, const Champ_Don_base &, const Domaine_Cl_dis_base &)
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
void nommer(const Nom &) override
Donne un nom au champ.
virtual const Nom & fixer_unite(const Nom &)
Specifie l'unite d'un champ scalaire ou dont toutes les composantes ont la meme unite.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void creer_champ(const Motcle &motlu) override
const Champ_base & get_champ(const Motcle &nom) const override
void discretiser() override
Discretise l'equation.
classe Navier_Stokes_std Cette classe porte les termes de l'equation de la dynamique
void creer_champ(const Motcle &motlu) override
const Champ_base & get_champ(const Motcle &nom) const override
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void discretiser() override
Dicretise l'equation.
virtual const Champ_Don_base & diffusivite_pour_transport() const
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
double temps_init() const
Renvoie le temps initial.
Classe de base des flux de sortie.
Definition Sortie.h:52