TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_val_tot_sur_vol_base.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Interprete.h>
18#include <Domaine.h>
19#include <Domaine_VF.h>
20#include <Sous_Domaine.h>
21
22Implemente_base(Champ_val_tot_sur_vol_base,"Champ_val_tot_sur_vol_base",Champ_Uniforme_Morceaux);
23// XD valeur_totale_sur_volume champ_uniforme_morceaux valeur_totale_sur_volume INHERITS_BRACE Similar as
24// XD_CONT Champ_Uniforme_Morceaux with the same syntax. Used for source terms when we want to specify a source term
25// XD_CONT with a value given for the volume (eg: heat in Watts) and not a value per volume unit (eg: heat in Watts/m3).
26
28
30
31//Evaluation of the field on the default domain and the specified sub-domains
32//-For each sub-domain and for the full domain, CONTRIB_loc is computed:
33// loc designates a localisation (sub-domain i or default domain)
34// VDF case: CONTRIB_loc = sum of volume(elem)*porosity(elem) for elements in loc
35// VEF case: CONTRIB_loc = sum of vol_entrelaces(face)*por_face(face) for faces in loc
36//-CONTRIB_loc of each sub-domain is subtracted from that of the full domain
37//-Estimate of the power at elements for each localisation by the relation:
38// P(elem,compo) = P_lue/CONTRIB_loc
39//
41{
42 const int nb_elem = zdis.nb_elem();
43 DoubleVect vol_glob_pond;
44 vol_glob_pond = eval_contrib_loc(zdis,zcldis,vol_glob_pond);
45
46 for(int elem=0; elem<nb_elem; elem++)
47 for (int k=0; k<nb_compo_; k++)
48 valeurs_(elem,k) /= vol_glob_pond(0);
49
50 int cpt=1;
51
52 for (auto& itr : les_sous_domaines)
53 {
54 const Sous_Domaine& sz = itr.valeur();
55 int size_sz = sz.nb_elem_tot();
56 int el;
57 for (int elem=0; elem<size_sz; elem++)
58 {
59 el = sz(elem);
60 for (int k=0; k<nb_compo_; k++)
61 {
62 valeurs_(el,k) *= vol_glob_pond(0);
63 valeurs_(el,k) /= vol_glob_pond(cpt);
64 }
65 }
66
67 cpt++;
68 }
69
71}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
DoubleTab valeurs_
Champ_Uniforme_Morceaux This class represents a piecewise constant-in-space field.
Champ_val_tot_sur_vol_base Base class derived from Champ_Uniforme_Morceaux representing fields.
void evaluer(const Domaine_dis_base &zdis, const Domaine_Cl_dis_base &zcldis)
virtual DoubleVect & eval_contrib_loc(const Domaine_dis_base &zdis, const Domaine_Cl_dis_base &zcldis, DoubleVect &vol)=0
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int nb_compo_
Definition Field_base.h:95
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Base class for output streams.
Definition Sortie.h:52
int_t nb_elem_tot() const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")