TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_MED.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 <Champ_front_MED.h>
17#include <Champ_Don_base.h>
18#include <Domaine.h>
19#include <Frontiere_dis_base.h>
20#include <Param.h>
21
22Implemente_instanciable(Champ_front_MED,"Champ_front_MED",Champ_front_txyz);
23// XD champ_front_MED front_field_base champ_front_MED NO_BRACE Field allowing the loading of a boundary condition from
24// XD_CONT a MED file using Champ_fonc_med
25
27{
28 assert(0);
29 return os;
30}
31
33{
34 Param param(que_suis_je());
35 param.ajouter("champ_volumique",&champ_volumique_,Param::REQUIRED); // XD attr champ_fonc_med field_base champ_fonc_med REQ a champ_fonc_med loading the values of the unknown on a domain boundary
36 param.lire_sans_accolade(is);
37
38 fixer_nb_comp(champ_volumique_->nb_comp());
39 pos_.resize(1,dimension);
40 val_.resize(1,nb_comp());
41 return is;
42}
43
44void Champ_front_MED::remplir_tab(DoubleTab& tab,double temps) const
45{
46 int dim=tab.dimension(1);
47 const Frontiere_dis_base& fr_dis=frontiere_dis();
48 const Frontiere& frontiere=fr_dis.frontiere();
49 const Domaine& domaine=frontiere.domaine();
50 const Faces& faces=frontiere.faces();
51 int nb_faces=frontiere.nb_faces();
52 double x,y,z;
53 int nbsf=faces.nb_som_faces();
54 int i,k;
55
56 for( i=0; i<nb_faces; i++)
57 {
58 x=y=z=0;
59 for( k=0; k<nbsf; k++)
60 {
61 x+=domaine.coord(faces.sommet(i,k),0);
62 if(dimension>1)
63 y+=domaine.coord(faces.sommet(i,k),1);
64 if(dimension>2)
65 z+=domaine.coord(faces.sommet(i,k),2);
66 }
67 x/=nbsf;
68 y/=nbsf;
69 z/=nbsf;
70 for( k=0; k<dim; k++)
71 {
72 tab(i,k)=valeur_au_temps_et_au_point(temps,-1,x,y,z,k);
73 }
74 }
76}
78{
79 double temps=0;
80 DoubleTab& tab=valeurs_au_temps(temps);
81 remplir_tab(tab,temps);
82 return *this;
83}
84
86{
87 champ_volumique_->mettre_a_jour(temps);
88 DoubleTab& tab=valeurs_au_temps(temps);
89 remplir_tab(tab,temps);
90// Cerr<<" VIN MAX" <<mp_max_abs_vect(valeurs_au_temps(temps))<<finl;
91 return;
92}
93double Champ_front_MED::valeur_au_temps_et_au_point(double temps,int som,double x,double y, double z,int comp) const
94{
95 pos_(0,0)=x;
96 pos_(0,1)=y;
97 if (dimension>2)
98 pos_(0,2)=z;
99 champ_volumique_->valeur_aux(pos_,val_);
100 return val_(0,comp);
101}
Champ_front_base & affecter_(const Champ_front_base &ch) override
void remplir_tab(DoubleTab &, double) const
double valeur_au_temps_et_au_point(double temps, int som, double x, double y, double z, int comp) const override
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
virtual const Frontiere_dis_base & frontiere_dis() const
Renvoie la frontiere discretisee associee au champ.
classe Champ_front_txyz Classe derivee de Champ_front_var qui represente les
DoubleTab & valeurs_au_temps(double temps) override
Renvoie les valeurs au temps desire.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int_t sommet(int_t, int) const
Renvoie le numero du j-ieme sommet de la i-ieme face.
Definition Faces.h:130
int nb_som_faces() const
Renvoie le nombre de sommet par face.
Definition Faces.h:149
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
virtual int nb_comp() const
Definition Field_base.h:56
const Domaine_t & domaine() const
Renvoie le domaine associe a la frontiere.
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
classe Frontiere_dis_base Classe representant une frontiere discretisee.
const Frontiere & frontiere() const
Renvoie la frontiere geometrique associee.
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
@ REQUIRED
Definition Param.h:115
Classe de base des flux de sortie.
Definition Sortie.h:52
_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")