TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
BilanQdmVEF.cpp
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#include <BilanQdmVEF.h>
17#include <Domaine_Cl_VEF.h>
18#include <Domaine_VEF.h>
19#include <Front_VF.h>
20#include <Periodique.h>
21#include <TRUSTTab.h>
22#include <Dirichlet.h>
23#include <Dirichlet_homogene.h>
24
25void BilanQdmVEF::bilan_qdm(const DoubleTab& dudt, const Domaine_Cl_VEF& domaine_Cl_VEF, ArrOfDouble& bilan)
26{
27 int nb_bord=domaine_Cl_VEF.nb_cond_lim();
28 int face;
29 int nb_comp=bilan.size_array();
30 for (int n_bord=0; n_bord<nb_bord; n_bord++)
31 {
32 const Cond_lim& la_cl = domaine_Cl_VEF.les_conditions_limites(n_bord);
33 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
34 int num1 = le_bord.num_premiere_face();
35 int nb_faces=le_bord.nb_faces();
36 int num2 = num1 + nb_faces;
37 if (sub_type(Periodique,la_cl.valeur()))
38 {
39 const Periodique& la_cl_perio = ref_cast(Periodique,la_cl.valeur());
40 int face_associee;
41 IntVect fait(nb_faces);
42 fait = 0;
43
44 for (face=num1; face<num2; face++)
45 {
46 if (fait(face-num1) == 0)
47 {
48 fait(face-num1) = 1;
49 face_associee=la_cl_perio.face_associee(face-num1);
50 fait(face_associee) = 1;
51 for (int comp=0; comp<nb_comp; comp++)
52 {
53 if(nb_comp==1)
54 bilan[comp]+=dudt(face);
55 else
56 bilan[comp]+=dudt(face,comp);
57 }
58 }// if fait
59 }// for face
60 }// sub_type Perio
61 else if ( (sub_type(Dirichlet,la_cl.valeur())) ||
62 (sub_type(Dirichlet_homogene,la_cl.valeur())) )
63 {
64 // for (face=num1; face<num2; face++)
65 // {
66 // if(nb_comp==1)
67 // {
68 // dudt(face)=0;
69 // }
70 // else
71 // for (int comp=0; comp<nb_comp; comp++)
72 // {
73 // dudt(face,comp)=0.;
74 // }
75 // }
76 }
77 else
78 {
79 for (face=num1; face<num2; face++)
80 {
81 for (int comp=0; comp<nb_comp; comp++)
82 {
83 if(nb_comp==1)
84 bilan[comp]+=dudt(face);
85 else
86 bilan[comp]+=dudt(face,comp);
87 }
88 }// for face
89 }
90 }// for nbord
91 {
92 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, domaine_Cl_VEF.domaine_dis());
93 const int prems=domaine_VEF.premiere_face_int();
94 const int nb_faces=domaine_VEF.nb_faces_tot();
95 for(face=prems; face<nb_faces; face++)
96 {
97 for (int comp=0; comp<nb_comp; comp++)
98 {
99 if(nb_comp==1)
100 bilan[comp]+=dudt(face);
101 else
102 bilan[comp]+=dudt(face,comp);
103 }
104 }
105 }
106}
107
108void BilanQdmVEF::bilan_energie(const DoubleTab& dudt,
109 const DoubleTab& u,
110 const Domaine_Cl_VEF& domaine_Cl_VEF,
111 ArrOfDouble& bilan)
112{
113 int nb_bord=domaine_Cl_VEF.nb_cond_lim();
114 int face;
115 int nb_comp=bilan.size_array();
116 for (int n_bord=0; n_bord<nb_bord; n_bord++)
117 {
118 const Cond_lim& la_cl = domaine_Cl_VEF.les_conditions_limites(n_bord);
119 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
120 int num1 = le_bord.num_premiere_face();
121 int nb_faces=le_bord.nb_faces();
122 int num2 = num1 + nb_faces;
123 if (sub_type(Periodique,la_cl.valeur()))
124 {
125 const Periodique& la_cl_perio = ref_cast(Periodique,la_cl.valeur());
126 int face_associee;
127 IntVect fait(nb_faces);
128 fait = 0;
129
130 for (face=num1; face<num2; face++)
131 {
132 if (fait(face-num1) == 0)
133 {
134 fait(face-num1) = 1;
135 face_associee=la_cl_perio.face_associee(face-num1);
136 fait(face_associee) = 1;
137 for (int comp=0; comp<nb_comp; comp++)
138 {
139 if(nb_comp==1)
140 bilan[comp]+=dudt(face)*u(face);
141 else
142 bilan[comp]+=dudt(face,comp)*u(face,comp);
143 }
144 }// if fait
145 }// for face
146 }// sub_type Perio
147 else if ( (sub_type(Dirichlet,la_cl.valeur())) ||
148 (sub_type(Dirichlet_homogene,la_cl.valeur())) )
149 {
150 // for (face=num1; face<num2; face++)
151 // {
152 // if(nb_comp==1)
153 // {
154 // dudt(face)=0;
155 // }
156 // else
157 // for (int comp=0; comp<nb_comp; comp++)
158 // {
159 // dudt(face,comp)=0.;
160 // }
161 // }
162 }
163 else
164 {
165 for (face=num1; face<num2; face++)
166 {
167 for (int comp=0; comp<nb_comp; comp++)
168 {
169 if(nb_comp==1)
170 bilan[comp]+=dudt(face)*u(face);
171 else
172 bilan[comp]+=dudt(face,comp)*u(face,comp);
173 }
174 }// for face
175 }
176 }// for nbord
177 {
178 const Domaine_VEF& domaine_VEF=ref_cast(Domaine_VEF, domaine_Cl_VEF.domaine_dis());
179 const int prems=domaine_VEF.premiere_face_int();
180 const int nb_faces=domaine_VEF.nb_faces_tot();
181 for(face=prems; face<nb_faces; face++)
182 {
183 for (int comp=0; comp<nb_comp; comp++)
184 {
185 if(nb_comp==1)
186 bilan[comp]+=dudt(face)*u(face);
187 else
188 bilan[comp]+=dudt(face,comp)*u(face,comp);
189 }
190 }
191 }
192}
static void bilan_energie(const DoubleTab &dudt, const DoubleTab &u, const Domaine_Cl_VEF &domaine_Cl_VEF, ArrOfDouble &bilan)
static void bilan_qdm(const DoubleTab &dudt, const Domaine_Cl_VEF &domaine_Cl_VEF, ArrOfDouble &bilan)
classe Cond_lim Classe generique servant a representer n'importe quelle classe
Definition Cond_lim.h:31
Classe Dirichlet_homogene Cette classe est la classe de base de la hierarchie des conditions aux limi...
classe Dirichlet Cette classe est la classe de base de la hierarchie des conditions aux limites de ty...
Definition Dirichlet.h:31
int nb_cond_lim() const
Renvoie le nombre de conditions aux limites.
Domaine_dis_base & domaine_dis()
Renvoie une reference sur le domaine discretise associe aux conditions aux limites.
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
class Domaine_VEF
Definition Domaine_VEF.h:54
int nb_faces_tot() const
renvoie le nombre total de faces.
Definition Domaine_VF.h:481
int premiere_face_int() const
une face est interne ssi elle separe deux elements.
Definition Domaine_VF.h:463
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
classe Periodique Cette classe represente une condition aux limites periodique.
Definition Periodique.h:31
int face_associee(int i) const
Definition Periodique.h:35
_SIZE_ size_array() const