TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Assembleur_P_DG.h
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#ifndef Assembleur_P_DG_included
17#define Assembleur_P_DG_included
18
19#include <Matrice_Morse_Sym.h>
20#include <Assembleur_base.h>
21#include <Domaine_DG.h>
22#include <TRUST_Ref.h>
23
24class Domaine_Cl_DG;
25
26/**
27 * @brief Assembles the pressure Laplacian matrix for the DG incompressible Navier-Stokes solver.
28 *
29 * This class builds the global pressure matrix arising from the SIP (Symmetric Interior
30 * Penalty) DG discretization of the pressure Poisson problem. It is the pressure-space
31 * counterpart of the diffusion operator assembly in Op_Diff_DG_Elem, but operates
32 * directly on the pressure unknown without diffusivity weighting (nu = 1).
33 *
34 * The assembled matrix corresponds to the bilinear form:
35 * a(p_h, q_h) = sum_T integral_T grad(p_h).grad(q_h)
36 * - sum_f 0.5 * integral_f { grad(p_h) }.n * [q_h] (consistency)
37 * - sum_f 0.5 * integral_f [p_h] * { grad(q_h) }.n (symmetry)
38 * + sum_f (eta_F/h_T) * integral_f [p_h] * [q_h] (penalty)
39 *
40 * where the sums run over all elements T and all faces f (internal and Dirichlet boundary).
41 *
42 * The matrix is stored as a Matrice_Morse (unsymmetric storage, though the assembled
43 * system is symmetric by construction). The sparsity pattern couples each pressure DOF
44 * to all pressure DOFs in the same element and in all face-neighbouring elements.
45 *
46 * Additionally, the class:
47 * - Stores a velocity-reconstruction matrix rec (Matrice_Morse) used by
48 * corriger_vitesses() to apply the pressure correction -grad(dP) to the velocity.
49 * - Handles pressure referencing via modifier_solution(), which pins the minimum
50 * pressure to zero when no Dirichlet pressure condition is imposed (has_P_ref == 0).
51 * - Provides a stub for quasi-compressible flows (assembler_QC) which is not yet
52 * fully implemented and aborts at runtime.
53 *
54 * @sa Op_Diff_DG_Elem, Op_Grad_DG, Assembleur_base
55 */
57{
58 Declare_instanciable(Assembleur_P_DG);
59public:
60 void associer_domaine_dis_base(const Domaine_dis_base&) override;
62 const Domaine_dis_base& domaine_dis_base() const override;
63 const Domaine_Cl_dis_base& domaine_Cl_dis_base() const override;
64
65 int assembler(Matrice&) override;
66 int assembler_rho_variable(Matrice&, const Champ_Don_base& rho) override;
67 int assembler_QC(const DoubleTab&, Matrice&) override;
68 int assembler_mat(Matrice&, const DoubleVect&, int incr_pression, int resoudre_en_u) override;
69
70 int modifier_secmem(DoubleTab&) override;
71 int modifier_solution(DoubleTab&) override;
72
73 void completer(const Equation_base&) override;
74 inline const Equation_base& equation() const { return mon_equation.valeur(); }
75
76 /* corrige les vitesses pour une correction en pression donnee de type (-Cp, Cv) */
77 void corriger_vitesses(const DoubleTab& dP, DoubleTab& dv) const override
78 {
79 rec.ajouter_multvect(dP, dv);
81 }
82
83protected:
84 OBS_PTR(Equation_base) mon_equation;
85 OBS_PTR(Domaine_DG) le_dom_dg_;
86 OBS_PTR(Domaine_Cl_DG) le_dom_Cl_dg_;
87
89
90 int has_P_ref = 0;
91 int stencil_done = 0;
92
93 Matrice_Morse rec; //pour reconstruire les vitesses
94};
95
96#endif /* Assembleur_P_DG_included */
Assembles the pressure Laplacian matrix for the DG incompressible Navier-Stokes solver.
void associer_domaine_dis_base(const Domaine_dis_base &) override
int assembler_mat(Matrice &, const DoubleVect &, int incr_pression, int resoudre_en_u) override
Core routine that builds the SIP pressure Laplacian matrix.
const Domaine_Cl_dis_base & domaine_Cl_dis_base() const override
int modifier_secmem(DoubleTab &) override
OBS_PTR(Domaine_Cl_DG) le_dom_Cl_dg_
const Equation_base & equation() const
OBS_PTR(Equation_base) mon_equation
DoubleTab les_coeff_pression
void corriger_vitesses(const DoubleTab &dP, DoubleTab &dv) const override
void completer(const Equation_base &) override
int modifier_solution(DoubleTab &) override
Removes the arbitrary pressure constant by pinning the minimum pressure to zero.
const Domaine_dis_base & domaine_dis_base() const override
int assembler_QC(const DoubleTab &, Matrice &) override
Assemble la matrice de pression pour un fluide quasi compressible laplacein(P) est remplace par div(g...
Matrice_Morse rec
int assembler(Matrice &) override
void associer_domaine_cl_dis_base(const Domaine_Cl_dis_base &) override
OBS_PTR(Domaine_DG) le_dom_dg_
int assembler_rho_variable(Matrice &, const Champ_Don_base &rho) override
Assemblage de la matrice div( porosite/rho * grad P ) Le type du champ "rho" a fournir depend de la d...
classe Champ_Don_base classe de base des Champs donnes (non calcules)
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
Classe Matrice Classe generique de la hierarchie des matrices.
Definition Matrice.h:34
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")