TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Op_Diff_DG_Elem.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_DG_Elem_included
17#define Op_Diff_DG_Elem_included
18
19#include <Op_Diff_DG_base.h>
20class Matrice_Morse;
21
22/**
23 * @brief Concrete DG diffusion operator acting on element-based unknowns.
24 *
25 * This class implements the Symmetric Interior Penalty (SIP) Galerkin discretization
26 * of the diffusion operator for scalar and vector fields discretized on DG elements.
27 * It assembles both the global stiffness matrix and the right-hand side contribution
28 * through the interface_blocs mechanism (has_interface_blocs() returns 1).
29 *
30 * The SIP formulation introduces three families of face integrals at every internal face
31 * shared by elements T0 and T1:
32 * - **Consistency term**: -0.5 * integral of { nu * grad(phi_i) } . n * [phi_j]
33 * - **Symmetry term**: -0.5 * integral of { nu * grad(phi_j) } . n * [phi_i] (transpose of consistency)
34 * - **Penalty term**: gamma * (eta_F / h_T) * integral of [phi_i] * [phi_j]
35 *
36 * where gamma = 2*nu_0*nu_1/(nu_0+nu_1) is the harmonic mean of the diffusivities on
37 * each side, eta_F is the element-local penalty coefficient, and h_T is the minimum
38 * characteristic size of the two adjacent elements.
39 *
40 * At boundary faces the same three terms are applied to a single element, with the
41 * boundary condition value contributing to the right-hand side through
42 * contribuer_au_second_membre(). Supported boundary conditions are:
43 * - Neumann / Neumann_paroi: flux is added directly to the RHS.
44 * - Dirichlet / Dirichlet_homogene: enforced weakly via SIP penalty + symmetry terms.
45 *
46 * The stencil (sparsity pattern) of the assembled matrix couples every element to all
47 * its face-neighbours, as computed by dimensionner() and dimensionner_blocs().
48 *
49 * Cross-problem coupling (dimensionner_termes_croises, ajouter_termes_croises,
50 * contribuer_termes_croises) is declared but not yet implemented (throws at runtime).
51 *
52 * @note The ordering of degrees of freedom inside an element follows:
53 * phi0.ex, phi1.ex, ..., phi_{nb_bfunc-1}.ex,
54 * phi0.ey, phi1.ey, ..., phi_{nb_bfunc-1}.ey, ...
55 * for vector fields, and phi0, phi1, ..., phi_{nb_bfunc-1} for scalar fields.
56 */
58{
59 Declare_instanciable( Op_Diff_DG_Elem );
60
61public:
62 virtual void calculer_flux_bord(const DoubleTab& inco) const = delete; //TODO DG a calculer dans interface_blocs
63
64 void modifier_pour_Cl(Matrice_Morse& la_matrice, DoubleTab& secmem) const override { }
65 void completer() override;
66
67 void dimensionner(Matrice_Morse& mat) const override;
68
69 inline int has_interface_blocs() const override { return 1; }
70 void dimensionner_blocs(matrices_t matrices, const tabs_t& semi_impl = {}) const override;
71 void ajouter_blocs(matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl = {}) const override;
72
73 void dimensionner_termes_croises(Matrice_Morse&, const Probleme_base& autre_pb, int nl, int nc) const override;
74 void ajouter_termes_croises(const DoubleTab& inco, const Probleme_base& autre_pb, const DoubleTab& autre_inco, DoubleTab& resu) const override;
75 void contribuer_termes_croises(const DoubleTab& inco, const Probleme_base& autre_pb, const DoubleTab& autre_inco, Matrice_Morse& matrice) const override;
76 void contribuer_au_second_membre(DoubleTab& resu ) const override;
77
78};
79
80
81#endif /* Op_Diff_DG_Elem_included */
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
Concrete DG diffusion operator acting on element-based unknowns.
void contribuer_termes_croises(const DoubleTab &inco, const Probleme_base &autre_pb, const DoubleTab &autre_inco, Matrice_Morse &matrice) const override
virtual void calculer_flux_bord(const DoubleTab &inco) const =delete
void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={}) const override
Assembles the SIP diffusion operator into the matrix and right-hand side.
void ajouter_termes_croises(const DoubleTab &inco, const Probleme_base &autre_pb, const DoubleTab &autre_inco, DoubleTab &resu) const override
void completer() override
Finalizes operator setup after all associations have been made.
void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={}) const override
Sizes the block matrices used by the interface_blocs assembly mechanism.
void contribuer_au_second_membre(DoubleTab &resu) const override
Adds boundary condition contributions to the right-hand side.
int has_interface_blocs() const override
void modifier_pour_Cl(Matrice_Morse &la_matrice, DoubleTab &secmem) const override
DOES NOTHING - to override in derived classes.
void dimensionner_termes_croises(Matrice_Morse &, const Probleme_base &autre_pb, int nl, int nc) const override
void dimensionner(Matrice_Morse &mat) const override
Builds the sparsity pattern of the DG diffusion matrix in a Matrice_Morse.
This class provides the common infrastructure shared by all DG diffusion operators in TRUST....