TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
grad_Champ_Face_PolyMAC_MPFA.h
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#ifndef grad_Champ_Face_PolyMAC_MPFA_included
17#define grad_Champ_Face_PolyMAC_MPFA_included
18
19#include <Champ_Fonc_Face_PolyMAC_CDO.h>
20#include <Champ_Face_PolyMAC_MPFA.h>
21#include <Domaine_Cl_PolyMAC_family.h>
22#include <TRUST_Ref.h>
23
24/*! @brief class grad_Champ_Face_PolyMAC_MPFA for the calculation of the gradient.
25 *
26 * @brief This field is a Champ_Fonc_Face_PolyMAC_MPFA that calculates the gradient of a velocity field.
27 *
28 * grad_u(f, n*D + dU) returns the gradient of the dU velocity component in the phase n at face f
29 * grad_u(nf_tot + e*D + dX, n*D + dU) returns the gradient of the dU velocity component in the phase n in element e along the dX component
30 * (i.e. = dU/dX)
31 * In 2D, the gradient at the element e in phase n is equal to :
32 * | grad_u(nf_tot + e*D + 0, n*D + 0) grad_u(nf_tot + e*D + 1, n*D + 0) |
33 * grad_u = | |
34 * | grad_u(nf_tot + e*D + 0, n*D + 1) grad_u(nf_tot + e*D + 1, n*D + 1) |
35 *
36 * The gradient is calculated using past values of the velocity
37 * We compute the gradient at the faces for all velocity components, then interpolate it to obtain the gradient at the elements
38 *
39 */
41{
42 Declare_instanciable(grad_Champ_Face_PolyMAC_MPFA);
43public:
44 int fixer_nb_valeurs_nodales(int n) override;
45 void mettre_a_jour(double) override;
46 void me_calculer(double);
47
48 inline virtual Champ_Face_PolyMAC_MPFA& champ_a_deriver() { return champ_.valeur(); }
49 inline virtual const Champ_Face_PolyMAC_MPFA& champ_a_deriver() const { return champ_.valeur(); }
50 inline void associer_champ(const Champ_Face_PolyMAC_MPFA& ch) { champ_ = ch; }
51 inline void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base& le_dom_Cl_dis_base)
52 {
53 le_Dom_Cl_PolyMAC_HFV = static_cast<const Domaine_Cl_PolyMAC_family&>(le_dom_Cl_dis_base);
54 }
55
56 // Interpolation of the velocity gradient
57 mutable IntTab gradve_d, gradve_e; // Tables used in fgrad to obtain the gradient at faces of the velocity at elements
58 mutable DoubleTab gradve_w;
59 void update_tab_grad(int full_stencil); // Update the tables used in fgrad
60 void calc_gradfve(); // Update the gradient at faces of the velocity at elements
61 void update_ge(); // Compute the gradient at elements from the gradient at faces; based on the similar method of Champ_Face_PolyMAC_MPFA
62 void init_grad();
63
64protected:
65 OBS_PTR(Domaine_Cl_PolyMAC_family) le_Dom_Cl_PolyMAC_HFV;
67
68 int is_init = 0;
69 void init_ge2() const; //second-order -> using a matrix
70 mutable IntTab ve2d, ve2j, ve2bj;
71 mutable DoubleTab ve2c, ve2bc;
72 void update_ge2(DoubleTab& val, int incr = 0) const;
73};
74
75#endif /* grad_Champ_Face_PolyMAC_MPFA_included */
: class Champ_Face_PolyMAC_MPFA
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class grad_Champ_Face_PolyMAC_MPFA for the calculation of the gradient.
void associer_champ(const Champ_Face_PolyMAC_MPFA &ch)
void update_ge2(DoubleTab &val, int incr=0) const
void associer_domaine_Cl_dis_base(const Domaine_Cl_dis_base &le_dom_Cl_dis_base)
int fixer_nb_valeurs_nodales(int n) override
Sets the number of degrees of freedom per component.
OBS_PTR(Champ_Face_PolyMAC_MPFA) champ_
virtual const Champ_Face_PolyMAC_MPFA & champ_a_deriver() const
OBS_PTR(Domaine_Cl_PolyMAC_family) le_Dom_Cl_PolyMAC_HFV
void mettre_a_jour(double) override
Time update of the field.
virtual Champ_Face_PolyMAC_MPFA & champ_a_deriver()