TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Elem_PolyMAC_CDO.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 Champ_Elem_PolyMAC_CDO_included
17#define Champ_Elem_PolyMAC_CDO_included
18
19#include <Op_Diff_PolyMAC_CDO_base.h>
20#include <Champ_Inc_P0_base.h>
21#include <Operateur.h>
22
23// Field corresponding to a scalar unknown (e.g. temperature or pressure)
24// Degrees of freedom: value at elements + flux at faces
26{
27 Declare_instanciable(Champ_Elem_PolyMAC_CDO);
28public:
29 Champ_base& affecter_(const Champ_base& ch) override;
30 int imprime(Sortie&, int) const override;
31
32 int fixer_nb_valeurs_nodales(int n) override;
33
34 /* functions reconstructing the field at faces more precisely */
35 DoubleTab& valeur_aux_faces(DoubleTab& vals) const override;
36 inline DoubleTab& trace(const Frontiere_dis_base& fr, DoubleTab& x, double t, int distant) const override;
37
38};
39
40inline DoubleTab& Champ_Elem_PolyMAC_CDO::trace(const Frontiere_dis_base& fr, DoubleTab& x, double t, int distant) const
41{
42 /* resize the destination array x if necessary */
43 const DoubleTab& src = valeurs();
44 const Front_VF& fvf = ref_cast(Front_VF, fr);
45 const Domaine_VF& domaine = ref_cast(Domaine_VF, domaine_dis_base());
46 const IntTab& f_e = domaine.face_voisins();
47
48 DoubleTrav dst; //reconstruction of the field at faces (filled only on the relevant boundary)
49 int i, n, e, f, N = src.nb_dim() > 1 ? src.dimension(1) : 1;
50 int has_faces = polymac_flica5 ? false : src.dimension_tot(0) > domaine.nb_elem_tot();
51 if (!x.dimension(0) && !x.get_md_vector()) x.resize(fvf.nb_faces(), N);
52 dst.resize(domaine.nb_faces(), N);
53 for (i = 0; i < fvf.nb_faces(); i++)
54 for (n = 0, f = fvf.num_face(i); n < N; n++)
55 {
56 e = (f_e(f, 0) > -1) ? f_e(f, 0) : f_e(f, 1);
57 dst(f, n) = src(has_faces ? domaine.nb_elem_tot() + f : e, n);
58 }
59
60 if (distant) fr.frontiere().trace_face_distant(dst, x);
61 else fr.frontiere().trace_face_local(dst, x);
62
63 return x;
64}
65
66#endif /* Champ_Elem_PolyMAC_CDO_included */
Champ_base & affecter_(const Champ_base &ch) override
int imprime(Sortie &, int) const override
int fixer_nb_valeurs_nodales(int n) override
DoubleTab & trace(const Frontiere_dis_base &fr, DoubleTab &x, double t, int distant) const override
Computes the trace of a field on a boundary at time tps.
DoubleTab & valeur_aux_faces(DoubleTab &vals) const override
Returns the field value at the faces.
: class Champ_Inc_P0_base
const Domaine & domaine() const
const Domaine_dis_base & domaine_dis_base() const override
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Champ_base()
Default constructor of a Champ_base.
class Domaine_VF
Definition Domaine_VF.h:44
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_face(const int) const
Definition Front_VF.h:68
virtual void trace_face_distant(const DoubleTab &, DoubleTab &) const
virtual void trace_face_local(const DoubleTab &, DoubleTab &) const
class Frontiere_dis_base Class representing a discretized boundary.
const Frontiere & frontiere() const
Returns the associated geometric boundary.
Base class for output streams.
Definition Sortie.h:52
int nb_dim() const
Definition TRUSTTab.h:199
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual const MD_Vector & get_md_vector() const
Definition TRUSTVect.h:123