TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Evanescence_Homogene_VDF_Face.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 <Op_Evanescence_Homogene_VDF_Face.h>
17#include <Vitesse_relative_base.h>
18#include <Pb_Multiphase.h>
19
20Implemente_instanciable(Op_Evanescence_Homogene_VDF_Face, "Op_Evanescence_HOMOGENE_VDF_Face", Op_Evanescence_Homogene_Face_base);
21
24
26{
28
29 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
30 const Vitesse_relative_base* correlation_vd = pbm.has_correlation("vitesse_relative") ? &ref_cast(Vitesse_relative_base, pbm.get_correlation("vitesse_relative")) : nullptr;
31
32 if (correlation_vd && correlation_vd->needs_grad_alpha())
33 {
34 Cerr << "Typing gradient operator useful for the correlation " << correlation_vd->que_suis_je() << finl;
35 const Equation_base& eq_masse = pbm.equation_masse();
36 grad_vdf_faces_.associer_eqn(eq_masse);
37 grad_vdf_faces_.typer();
38 grad_vdf_faces_.l_op_base().associer_eqn(eq_masse);
39 const Domaine_dis_base& zdis = eq_masse.domaine_dis();
40 const Domaine_Cl_dis_base& zcl = eq_masse.domaine_Cl_dis();
41 const Champ_Inc_base& inco = eq_masse.inconnue();
42 grad_vdf_faces_->associer(zdis, zcl, inco);
43 }
44}
45
47{
48 assert (grad_vdf_faces_);
49
50 const Pb_Multiphase& pbm = ref_cast(Pb_Multiphase, equation().probleme());
51 const DoubleTab& alpha = pbm.equation_masse().inconnue().passe();
52 const Domaine_VF& domaine = ref_cast(Domaine_VF, equation().domaine_dis());
53 const DoubleTab& xp = domaine.xp(), &xv = domaine.xv();
54 const DoubleTab& n_f = domaine.face_normales(), &vf_dir = domaine.volumes_entrelaces_dir();
55 const DoubleVect& vf = domaine.volumes_entrelaces(), &fs = domaine.face_surfaces(), &ve = domaine.volumes();
56 const IntTab& f_e = domaine.face_voisins(), &e_f = domaine.elem_faces();
57 const int N = alpha.line_size(), nf_tot = domaine.nb_faces_tot(), D = dimension, ne_tot = domaine.nb_elem_tot(), nf = domaine.nb_faces();
58
59 /* calculaiton of the gradient of alpha at the face */
60 DoubleTrav grad_f_a(nf_tot, N);
61 grad_vdf_faces_->calculer(alpha, grad_f_a);
62
63 DoubleTrav gradAlphaElem(ne_tot, D, N);
64 /* Calcul du grad aux elems */
65 for (int n = 0; n < N; n++)
66 for (int e = 0; e < ne_tot; e++)
67 for (int d = 0; d < D; d++)
68 for (int j = 0 ; j < e_f.dimension(1); j++)
69 {
70 const int f = e_f(e, j);
71
72 if (f < 0 ) continue;
73
74 gradAlphaElem(e, d, n) += (e == f_e(f, 0) ? 1 : -1) * fs(f) * (xv(f, d) - xp(e, d)) / ve(e) * grad_f_a(f, n);
75 }
76
77 /* Calcul du grad vectoriel aux faces */
78 double scalGradElem = 0.;
79 for (int n = 0; n < N; n++)
80 for (int f = 0; f < nf; f++)
81 {
82 for (int c = 0; c < 2; c++)
83 for (int d = 0; d < D; d++)
84 {
85 const int e = f_e(f, c);
86
87 if (e < 0) continue;
88
89 gradAlphaFaces(f, d, n) += vf_dir(f, c) / vf(f) * gradAlphaElem(e, d, n);
90 }
91
92 scalGradElem = 0.;
93 for (int d = 0; d < D; d++)
94 scalGradElem += gradAlphaFaces(f, d, n) * n_f(f, d) / fs(f);
95
96 for (int d = 0; d < D; d++)
97 gradAlphaFaces(f, d, n) += (grad_f_a(f, n) - scalGradElem) * n_f(f, d) / fs(f);
98 }
99}
Class Champ_Inc_base.
DoubleTab & passe(int i=1) override
Returns field values at instant t-i.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_VF
Definition Domaine_VF.h:44
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
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Champ_Inc_base & inconnue() const =0
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
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
Manages evanescence in a face-based equation (-> QDM).
void calc_grad_alpha_faces(DoubleTab &) const override
virtual void preparer_calcul()
Multiphase thermohydraulics problem of type "3*N equations":
virtual Equation_base & equation_masse()
int has_correlation(std::string nom_correlation) const
const Correlation_base & get_correlation(std::string nom_correlation) const
Base class for output streams.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67
Relative velocity correlations of the form ur = (v_k - v_l).
virtual bool needs_grad_alpha() const