TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_val_tot_sur_vol_VDF.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_val_tot_sur_vol_VDF.h>
17#include <Domaine_Cl_dis_base.h>
18#include <Equation_base.h>
19#include <Sous_Domaine.h>
20#include <Milieu_base.h>
21#include <Domaine_VF.h>
22
23Implemente_instanciable(Champ_val_tot_sur_vol_VDF,"Valeur_totale_sur_volume_VDF",Champ_val_tot_sur_vol_base);
24
25
27{
29}
30
32{
34}
35
36DoubleVect& Champ_val_tot_sur_vol_VDF::eval_contrib_loc(const Domaine_dis_base& zdis,const Domaine_Cl_dis_base& zcldis,DoubleVect& vol_glob_pond)
37{
38 const Domaine_VF& zvf = ref_cast(Domaine_VF,zdis);
39 const int nb_elem = zvf.nb_elem();
40 int size_vol = les_sous_domaines.size()+1;
41 vol_glob_pond.resize(size_vol);
42
43 const DoubleVect& vol = zvf.volumes();
44 const DoubleVect& por_elem = zcldis.equation().milieu().porosite_elem();
45
46 int cpt=1;
47 for (auto& itr : les_sous_domaines)
48 {
49 const Sous_Domaine& sz = itr.valeur();
50 int size_sz = sz.nb_elem_tot();
51 int el;
52
53 for (int elem=0; elem<size_sz; elem++)
54 {
55 el = sz(elem);
56 //Only real elements are retained
57 if (el<nb_elem)
58 vol_glob_pond(cpt) += vol(el)*por_elem(el);
59 }
60 cpt++;
61 }
62
63 for (int elem=0; elem<nb_elem; elem++)
64 vol_glob_pond(0) += vol(elem)*por_elem(elem);
65
66 vol_glob_pond(0) = mp_sum(vol_glob_pond(0));
67
68 for (int i=1; i<size_vol; i++)
69 {
70 vol_glob_pond(i) = mp_sum(vol_glob_pond(i));
71 vol_glob_pond(0) -= vol_glob_pond(i);
72 }
73
74 return vol_glob_pond;
75}
class Champ_val_tot_sur_vol_VDF
DoubleVect & eval_contrib_loc(const Domaine_dis_base &zdis, const Domaine_Cl_dis_base &zcldis, DoubleVect &vol) override
Champ_val_tot_sur_vol_base Base class derived from Champ_Uniforme_Morceaux representing fields.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VF
Definition Domaine_VF.h:44
double volumes(int i) const
Definition Domaine_VF.h:113
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
virtual const Milieu_base & milieu() const =0
DoubleVect & porosite_elem()
Definition Milieu_base.h:58
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
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
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
Definition Process.cpp:145
Base class for output streams.
Definition Sortie.h:52
int_t nb_elem_tot() const
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91