TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Diff_VDF_Face_leaves.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 Op_Diff_VDF_Face_leaves_included
17#define Op_Diff_VDF_Face_leaves_included
18
19#include <Op_Diff_VDF_Face_Axi_base.h>
20#include <Op_Diff_VDF_Face_base.h>
21#include <Eval_Diff_VDF_leaves.h>
22#include <Op_Diff_Dift_VDF.h>
23
24/// \cond DO_NOT_DOCUMENT
25class Op_Diff_VDF_Face_leaves
26{ };
27/// \endcond
28
29/*! @brief class Op_Diff_VDF_Face This class represents the diffusion operator associated with a momentum equation.
30 *
31 * The discretization is VDF. The diffused field is a Champ_Face_VDF. The diffusivity field is non-uniform.
32 * The associated iterator is of type Iterateur_VDF_Face. The associated evaluator is of type Eval_Diff_VDF_Face
33 *
34 */
35class Op_Diff_VDF_Face : public Op_Diff_VDF_Face_base, public Op_Diff_Dift_VDF<Op_Diff_VDF_Face>
36{
37 Declare_instanciable_sans_constructeur(Op_Diff_VDF_Face);
38public:
42 inline const Champ_base& diffusivite() const override { return diffusivite_impl<Eval_Diff_VDF_Face>(); }
44 inline void completer() override
45 {
48 }
49};
50
51/*! @brief class Op_Diff_VDF_Face_Axi This class represents the diffusion operator associated with momentum equations in cylindrical coordinates.
52 *
53 * The discretization is VDF. The diffused field is a Champ_Face_VDF. The diffusivity field is non-uniform.
54 * This class uses neither an iterator nor an evaluator (there were too many supplementary terms due to cylindrical coordinates)
55 *
56 */
58{
59 Declare_instanciable(Op_Diff_VDF_Face_Axi);
60public:
61 inline double nu_(const int i) const override { return diffusivite_->valeurs()(is_var_ * i); }
62 inline double nu_mean_2_pts_(const int i, const int j) const override { return 0.5 * (diffusivite_->valeurs()(is_var_ * i) + diffusivite_->valeurs()(is_var_ * j)); }
63 inline double nu_mean_4_pts_(const int , const int ) const override;
64 inline void associer_diffusivite(const Champ_base& diffu) override
65 {
66 diffusivite_ = diffu;
67 is_var_ = sub_type(Champ_Uniforme, diffu) ? 0 : 1;
68 }
69 inline const Champ_base& diffusivite() const override { return diffusivite_; }
70protected:
71 OBS_PTR(Champ_base) diffusivite_;
72 int is_var_ = 0;
73};
74
75inline double Op_Diff_VDF_Face_Axi::nu_mean_4_pts_(const int i, const int j) const
76{
77 if (!is_var_) return nu_(i); // can help here ;)
78
79 double db_diffusivite = 0;
80 int element, compteur = 0;
81
82 if ((element=face_voisins(i,0)) != -1)
83 {
84 db_diffusivite += diffusivite_->valeurs()(is_var_ * element);
85 compteur++;
86 }
87 if ((element=face_voisins(i,1)) != -1)
88 {
89 db_diffusivite += diffusivite_->valeurs()(is_var_ * element);
90 compteur++;
91 }
92 if ((element=face_voisins(j,0)) != -1)
93 {
94 db_diffusivite += diffusivite_->valeurs()(is_var_ * element);
95 compteur++;
96 }
97 if ((element=face_voisins(j,1)) != -1)
98 {
99 db_diffusivite += diffusivite_->valeurs()(is_var_ * element);
100 compteur++;
101 }
102 db_diffusivite /= compteur;
103 return db_diffusivite;
104}
105
106#endif /* Op_Diff_VDF_Face_leaves_included */
Class Champ_Inc_base.
Champ_Uniforme Represents a field that is constant in space and time.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
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.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
void associer_diffusivite_impl(const Champ_base &ch_diff)
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFF_FACE, void > mettre_a_jour_impl()
std::enable_if_t< _TYPE_==Type_Operateur::Op_DIFF_ELEM||_TYPE_==Type_Operateur::Op_DIFT_ELEM||_TYPE_==Type_Operateur::Op_DIFT_MULTIPHASE_ELEM, void > associer_impl(const Domaine_dis_base &domaine_dis, const Domaine_Cl_dis_base &domaine_cl_dis, const Champ_Inc_base &ch_diffuse)
const Champ_base & diffusivite_impl() const
void associer_pb(const Probleme_base &pb)
class Op_Diff_VDF_Face_Axi This class represents the diffusion operator associated with momentum equa...
void associer_diffusivite(const Champ_base &diffu) override
double nu_mean_2_pts_(const int i, const int j) const override
double nu_(const int i) const override
OBS_PTR(Champ_base) diffusivite_
const Champ_base & diffusivite() const override
double nu_mean_4_pts_(const int, const int) const override
Op_Diff_VDF_Face_base(const Iterateur_VDF_base &iterateur)
void mettre_a_jour(double) override
DOES NOTHING - to override in derived classes.
void associer(const Domaine_dis_base &zd, const Domaine_Cl_dis_base &zcd, const Champ_Inc_base &ch) override
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
const Champ_base & diffusivite() const override
void associer_diffusivite(const Champ_base &ch) override
virtual void completer()
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.