TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Face_VDF.h
1
2/****************************************************************************
3* Copyright (c) 2023, CEA
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8* 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.
9* 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.
10*
11* 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.
12* 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;
13* 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.
14*
15*****************************************************************************/
16
17#ifndef Champ_Face_VDF_included
18#define Champ_Face_VDF_included
19
20#include <Champ_Face_VDF_implementation.h>
21#include <Champ_Face_base.h>
22#include <Domaine_VDF.h>
23
24class Domaine_Cl_VDF;
25
26/*! @brief class Champ_Face_VDF
27 *
28 * @brief This class represents a vector field for which only the normal components
29 * to the faces are computed in VDF. There is therefore only one degree of
30 * freedom per face and the nb_comp_ attribute of a Champ_Face object
31 * equals 1. All components of the field can nevertheless be imposed on
32 * the boundary. If n is the total number of faces in the domain and nb_faces_bord
33 * is the number of boundary faces, the value array associated with the field
34 * is built as follows:
35 * - n values to represent the normal components at faces
36 * - nb_faces_bord*dimension to store the imposed values
37 * on the boundary faces
38 * Note: this class is specific to the VDF module.
39 *
40 * @sa Champ_Inc_base
41 */
43{
44 Declare_instanciable(Champ_Face_VDF);
45public:
46 int fixer_nb_valeurs_nodales(int) override;
47
48 inline const Domaine_VDF& domaine_vdf() const override { return ref_cast(Domaine_VDF, le_dom_VF.valeur()); }
49 Champ_base& affecter_(const Champ_base&) override;
50 virtual const Champ_Proto& affecter(const double x1, const double x2);
51 virtual const Champ_Proto& affecter(const double x1, const double x2, const double x3);
52 virtual const Champ_Proto& affecter(const DoubleTab&);
53 void verifie_valeurs_cl() override;
54 int compo_normale_sortante(int) const;
55
56 inline const DoubleTab& tau_diag() const { return tau_diag_; }
57 inline const DoubleTab& tau_croises() const { return tau_croises_; }
58 inline DoubleTab& tau_diag() { return tau_diag_; }
59 inline DoubleTab& tau_croises() { return tau_croises_; }
61 void calculer_rotationnel_ordre2_centre_element(DoubleTab&) const;
62 int imprime(Sortie&, int) const override;
63 DoubleTab& trace(const Frontiere_dis_base&, DoubleTab&, double, int distant) const override;
64 void mettre_a_jour(double temps) override;
65
66 void calculer_dscald_centre_element(DoubleTab&) const;
67
68 void calcul_critere_Q(DoubleTab&, const Domaine_Cl_VDF&);
69 void calcul_grad_u(const DoubleTab&, DoubleTab&, const Domaine_Cl_VDF&);
70 void calcul_y_plus(DoubleTab&, const Domaine_Cl_VDF&);
71 void calcul_y_plus_diphasique(DoubleTab& , const Domaine_Cl_VDF& );
72
73 DoubleTab& calcul_duidxj(const DoubleTab&, DoubleTab&) const;
74 DoubleTab& calcul_duidxj(const DoubleTab&, DoubleTab&, const Domaine_Cl_VDF&) const;
75 DoubleVect& calcul_S_barre(const DoubleTab&, DoubleVect&, const Domaine_Cl_VDF&) const;
76 DoubleTab& calcul_S_barre_Multiphase(const DoubleTab&, DoubleTab&, const Domaine_Cl_VDF&) const;
77 DoubleVect& calcul_S_barre_sans_contrib_paroi(const DoubleTab&, DoubleVect&, const Domaine_Cl_VDF&) const;
79
80 // inline methods
81 inline DoubleTab& valeur_aux_faces_post(DoubleTab& result) const override
82 {
84 }
85
86 inline DoubleVect& valeur_a_elem(const DoubleVect& position, DoubleVect& val, int le_poly) const override
87 {
88 return Champ_Face_VDF_implementation::valeur_a_elem(position, val, le_poly);
89 }
90
91 inline double valeur_a_elem_compo(const DoubleVect& position, int le_poly, int ncomp) const override
92 {
93 return Champ_Face_VDF_implementation::valeur_a_elem_compo(position, le_poly, ncomp);
94 }
95
96 inline DoubleTab& valeur_aux_elems(const DoubleTab& positions, const IntVect& les_polys, DoubleTab& tab_valeurs) const override
97 {
98 return Champ_Face_VDF_implementation::valeur_aux_elems(positions, les_polys, tab_valeurs);
99 }
100
101 inline DoubleTab& valeur_aux_elems_passe(const DoubleTab& positions, const IntVect& les_polys, DoubleTab& tab_valeurs) const override
102 {
103 return Champ_Face_VDF_implementation::valeur_aux_elems_passe(positions, les_polys, tab_valeurs);
104 }
105
106 inline DoubleVect& valeur_aux_elems_compo(const DoubleTab& positions, const IntVect& les_polys, DoubleVect& tab_valeurs, int ncomp) const override
107 {
108 return Champ_Face_VDF_implementation::valeur_aux_elems_compo(positions, les_polys, tab_valeurs, ncomp);
109 }
110
111 inline DoubleTab& valeur_aux_sommets(const Domaine& dom, DoubleTab& val) const override
112 {
114 }
115
116 inline DoubleVect& valeur_aux_sommets_compo(const Domaine& dom, DoubleVect& val, int comp) const override
117 {
119 }
120
121 inline DoubleTab& remplir_coord_noeuds(DoubleTab& positions) const override
122 {
124 }
125
126 inline int remplir_coord_noeuds_et_polys(DoubleTab& positions, IntVect& polys) const override
127 {
129 }
130
131 /* utility for computing source terms: computes the vector v_e + n_f (v_f - v_e. n_f)
132 returns: the vector, its norm and the derivatives of the latter with respect to v_e and v_f
133 */
134 inline double v_norm(const DoubleTab& val, const DoubleTab& val_f, int e, int f, int k, int l, double *v_ext, double *dnv) const
135 {
137 int d, D = dimension, N = val_f.line_size();
138 const DoubleTab& nf = domaine.face_normales();
139 const DoubleVect& fs = domaine.face_surfaces();
140
141 double scal = 0, vf = f >= 0 ? val_f(f, k) - (l >= 0 ? val_f(f, l) : 0) : 0, v_temp[3], *v = v_ext ? v_ext : v_temp;
142 for (d = 0; d < D; d++)
143 v[d] = val(e, N*d+k ) - (l >= 0 ? val(e, N*d+l ) : 0);
144
145 if (f >= 0)
146 for (d = 0, scal = domaine.dot(v, &nf(f, 0)) / fs(f); d < D; d++) v[d] += (vf - scal) * nf(f, d) / fs(f);
147
148 double nv = sqrt(domaine.dot(v, v));
149
150 if (dnv)
151 for (d = 0; d < D; d++) dnv[d] = nv ? (v[d] - (f >= 0 ? vf * nf(f, d) / fs(f) : 0)) / nv : 0;
152
153#ifdef _COMPILE_AVEC_PGCC
154 if (dnv) dnv[3] = f >= 0 && nv ? vf / (nv+DMINFLOAT) : 0; // nvc++ sucks
155#else
156 if (dnv) dnv[3] = f >= 0 && nv ? vf / nv : 0;
157#endif
158 return nv;
159 }
160
161private:
162 double val_imp_face_bord_private(int face, int comp) const;
163 double val_imp_face_bord_private(int face, int comp1, int comp2) const;
164 inline const Champ_base& le_champ() const override { return *this; }
165 inline Champ_base& le_champ() override { return *this; }
166
167 DoubleTab tau_diag_; // diagonal terms of the Grad tensor
168 DoubleTab tau_croises_; // off-diagonal terms of the Grad tensor
169};
170
171double Champ_Face_coeff_frottement_face_bord(const int, const int , const Domaine_Cl_VDF& zclo);
172double Champ_Face_coeff_frottement_grad_face_bord(const int, const int , const Domaine_Cl_VDF& zclo);
173double Champ_Face_get_val_imp_face_bord_sym(const DoubleTab& tab_valeurs, const double temp,int face,int comp, const Domaine_Cl_VDF& zclo);
174double Champ_Face_get_val_imp_face_bord( const double temp,int face,int comp, const Domaine_Cl_VDF& zclo) ;
175double Champ_Face_get_val_imp_face_bord( const double temp,int face,int comp, int comp2, const Domaine_Cl_VDF& zclo) ;
176
177#endif /* Champ_Face_VDF_included */
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
DoubleTab & valeur_aux_faces_post_impl(const Domaine_VDF &, DoubleTab &result) const
DoubleTab & valeur_aux_sommets(const Domaine &, DoubleTab &) const override
DoubleTab & remplir_coord_noeuds(DoubleTab &positions) const override
DoubleVect & valeur_aux_elems_compo(const DoubleTab &positions, const IntVect &les_polys, DoubleVect &valeurs, int ncomp) const override
DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &val, int le_poly) const override
int remplir_coord_noeuds_et_polys(DoubleTab &positions, IntVect &polys) const override
DoubleTab & valeur_aux_elems_passe(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const
DoubleVect & valeur_aux_sommets_compo(const Domaine &, DoubleVect &, int) const override
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const override
class Champ_Face_VDF
DoubleTab & valeur_aux_elems_passe(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &tab_valeurs) const override
DoubleVect & calcul_S_barre(const DoubleTab &, DoubleVect &, const Domaine_Cl_VDF &) const
int imprime(Sortie &, int) const override
int compo_normale_sortante(int) const
void calcul_critere_Q(DoubleTab &, const Domaine_Cl_VDF &)
DoubleTab & remplir_coord_noeuds(DoubleTab &positions) const override
DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &val, int le_poly) const override
Causes an error! Must be overridden by derived classes.
DoubleVect & calcul_S_barre_sans_contrib_paroi(const DoubleTab &, DoubleVect &, const Domaine_Cl_VDF &) const
Returns SMA_barre at elements from the face velocity.
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
Causes an error! Must be overridden by derived classes.
DoubleTab & tau_croises()
DoubleTab & valeur_aux_faces_post(DoubleTab &result) const override
void calculer_dercov_axi(const Domaine_Cl_VDF &)
void mettre_a_jour(double temps) override
Update of the base class Champ_base: does nothing!
double v_norm(const DoubleTab &val, const DoubleTab &val_f, int e, int f, int k, int l, double *v_ext, double *dnv) const
void calculer_dscald_centre_element(DoubleTab &) const
void calcul_y_plus(DoubleTab &, const Domaine_Cl_VDF &)
void verifie_valeurs_cl() override
void calcul_grad_u(const DoubleTab &, DoubleTab &, const Domaine_Cl_VDF &)
DoubleTab & valeur_aux_sommets(const Domaine &dom, DoubleTab &val) const override
Returns the values at the vertices of the Domain dom.
int remplir_coord_noeuds_et_polys(DoubleTab &positions, IntVect &polys) const override
DOES NOTHING. Method to override.
DoubleVect & valeur_aux_elems_compo(const DoubleTab &positions, const IntVect &les_polys, DoubleVect &tab_valeurs, int ncomp) const override
Causes an error! Must be overridden by derived classes.
DoubleTab & tau_diag()
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &tab_valeurs) const override
Causes an error! Must be overridden by derived classes.
virtual const Champ_Proto & affecter(const double x1, const double x2)
const Domaine_VDF & domaine_vdf() const override
int fixer_nb_valeurs_nodales(int) override
const DoubleTab & tau_croises() const
DoubleTab & calcul_duidxj(const DoubleTab &, DoubleTab &) const
Returns gij at elements from the element velocity (gij represents the partial derivative dui/dxj).
void calculer_rotationnel_ordre2_centre_element(DoubleTab &) const
DoubleTab & trace(const Frontiere_dis_base &, DoubleTab &, double, int distant) const override
Computes the trace of a field on a boundary at time tps.
DoubleVect & valeur_aux_sommets_compo(const Domaine &dom, DoubleVect &val, int comp) const override
Returns the compo-th value at the vertices of dom.
Champ_base & affecter_(const Champ_base &) override
DoubleTab & calcul_S_barre_Multiphase(const DoubleTab &, DoubleTab &, const Domaine_Cl_VDF &) const
void dimensionner_tenseur_Grad()
void calcul_y_plus_diphasique(DoubleTab &, const Domaine_Cl_VDF &)
const DoubleTab & tau_diag() const
const Domaine & domaine() const
class Champ_Proto Class representing a Field prototype.
Definition Champ_Proto.h:37
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Champ_base()
Default constructor of a Champ_base.
virtual Champ_base & le_champ()=0
class Domaine_Cl_VDF
class Domaine_VDF
Definition Domaine_VDF.h:61
class Frontiere_dis_base Class representing a discretized boundary.
static int dimension
Definition Objet_U.h:94
Base class for output streams.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67