TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Convection_Diffusion_Fluide_Dilatable_Proto.cpp
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#include <Convection_Diffusion_Fluide_Dilatable_base.h>
17#include <Convection_Diffusion_Fluide_Dilatable_Proto.h>
18#include <Navier_Stokes_Fluide_Dilatable_base.h>
19#include <Fluide_Weakly_Compressible.h>
20#include <Convection_Diffusion_std.h>
21#include <EcritureLectureSpecial.h>
22#include <Op_Conv_negligeable.h>
23#include <Discretisation_base.h>
24#include <Schema_Temps_base.h>
25#include <Champ_Uniforme.h>
26#include <Probleme_base.h>
27#include <Matrice_Morse.h>
28#include <TRUST_2_PDI.h>
29#include <TRUSTTrav.h>
30#include <Operateur.h>
31#include <Domaine.h>
32#include <Avanc.h>
33#include <Device.h>
34#include <Perf_counters.h>
35
37(DoubleTab& Div, const Convection_Diffusion_Fluide_Dilatable_base& eqn) const
38{
39 const Operateur& op_conv = eqn.operateur(1);
40 // No convective operator:
41 if (sub_type(Op_Conv_negligeable,op_conv.l_op_base()))
42 {
43 Div=0;
44 return;
45 }
46
47 // temporarily swap the domain boundary conditions
48 if (!ch_unite_)
49 {
50 ch_unite_ = eqn.inconnue();
51 ch_unite_->valeurs() = 1.0;
52 }
53 ref_cast_non_const(Operateur_Conv_base,op_conv.l_op_base()).associer_champ_temp(ch_unite_, true);
54
55 if (eqn.discretisation().que_suis_je() != "VDF")
56 ref_cast_non_const(Operateur_base,op_conv.l_op_base()).associer_domaine_cl_dis(eqn.domaine_cl_modif());
57
58 op_conv.ajouter(ch_unite_->valeurs(), Div);
59 ref_cast_non_const(Operateur_Conv_base,op_conv.l_op_base()).associer_champ_temp(eqn.inconnue(), false);
60
61 if (eqn.discretisation().que_suis_je() != "VDF")
62 ref_cast_non_const(Operateur_base,op_conv.l_op_base()).associer_domaine_cl_dis(eqn.domaine_Cl_dis());
63}
64
65/*! @brief Returns the time derivative of the equation's unknown.
66 *
67 * The computation is: d(unknown)/dt = M^{-1} * (sources - sum(Op_i(unknown))) / rho
68 *
69 * @param derivee Array of time-derivative values of the unknown field.
70 * @return Array of time-derivative values of the unknown field.
71 */
73(Convection_Diffusion_Fluide_Dilatable_base& eqn, DoubleTab& derivee, const bool is_expl)
74{
75 /*
76 * ATTENTION : THIS IS A GENERIC METHOD THAT IS USED TO SOLVE EXPLICITLY (OR DIFFUSION IMPLICIT)
77 * A THERMAL OR SPECIES CONV/DIFF EQUATION. SO THE VARIABLE CAN EITHER BE THE TEMPERATURE T OR
78 * THE MASS FRACTION Y.
79 *
80 * For the species equation for example, we have :
81 * d(rho Y)/dt + div( rho*u*Y ) = div( rho*D*grad(Y) )
82 *
83 * With a non conservative formulation we write:
84 * rho d(Y)/dt + Y d(rho)/dt + Y div (rho*u) + rho*u grad(Y) = div( rho*D*grad(Y) )
85 *
86 * Using the mass equation, we get :
87 * rho d(Y)/dt + rho*u grad(Y) = div( rho*D*grad(Y) )
88 *
89 * divide by rho => d(Y)/dt = ( div( rho*D*grad(Y) ) + S ) / rho - u grad(Y)
90 *
91 * This is what we code here with derivee = d(Y)/dt
92 *
93 *
94 * Similarly for the temperature equation, we code
95 *
96 * derivee = d(T)/dt = ( div( lambda*grad(T) ) + S ) / (rho*Cp) - u grad(T)
97 */
98
99 const Schema_Temps_base& sch = eqn.schema_temps();
100 int diffusion_implicite=sch.diffusion_implicite();
101 eqn.domaine_Cl_dis().les_conditions_limites().set_modifier_val_imp(0);
102
103 /*
104 * FIRST TERM : diffusive
105 * derivee = div( rho*D*grad(Y) ) or div( lambda*grad(T) )
106 */
107 Fluide_Dilatable_base& fluide_dil = eqn.fluide();
108 if ( !is_thermal() /* species equation */ || (is_thermal() && fluide_dil.type_fluide()=="Gaz_Parfait" ))
109 {
110 if (!diffusion_implicite) eqn.operateur(0).ajouter(derivee);
111 }
112 else // Thermal equation + Gaz reel => No diffusion implicit ...
113 {
114 eqn.operateur(0).ajouter(fluide_dil.temperature(),derivee);
115 if (diffusion_implicite)
116 {
117 Cerr << "Error: diffusion implicit not implemented in Convection_Diffusion_Chaleur_Fluide_Dilatable_base" << finl;
119 }
120 }
121
122 eqn.domaine_Cl_dis().les_conditions_limites().set_modifier_val_imp(1);
123 derivee.echange_espace_virtuel();
124
125 // Add source term (if any, but for temperatur eit is sure !!! )
126 eqn.sources().ajouter(derivee);
127
128 // Divide derivee by rho if species or real gas... otherwise divide by rho*Cp!
129 bool flag = is_thermal() && fluide_dil.type_fluide()=="Gaz_Parfait";
130 if (flag) fluide_dil.update_rho_cp(sch.temps_courant());
131 const DoubleTab& array = flag ? eqn.get_champ("rho_cp_comme_T").valeurs() : fluide_dil.masse_volumique().valeurs();
132 tab_divide_any_shape(derivee, array);
133 derivee.echange_espace_virtuel();
134
135 /*
136 * SECOND TERM : convective
137 * = - u grad(Y) = [ Y div (rho*u) - div( rho*u*Y ) ] / rho
138 * or
139 * = - u grad(T) = [ T div (rho*u) - div( rho*u*T ) ] / rho*Cp
140 */
141 DoubleTrav convection(derivee);
142
143 // Add Y div (rho*u) or T div (rho*u)
144 const DoubleTab& inco = eqn.inconnue().valeurs();
145 calculer_div_u_ou_div_rhou(convection);
146
147 tab_multiply_any_shape(convection, inco);
148 convection*=-1;
149
150 // Add convection operator: - div( rho*u*Y ) or -div ( rho*u*T )
151 eqn.operateur(1).ajouter(convection);
152
153 // Divide by rho if necessary
154 if (is_generic())
155 {
156 const DoubleTab& tab_rho = fluide_dil.masse_volumique().valeurs();
157 tab_divide_any_shape(convection, tab_rho);
158 }
159
160 // Complete with special source terms from mass equation (if any)
161 DoubleTrav mass_source_term(derivee);
162 mass_source_term = 0.0;
163
164 const bool has_mass_flux = (sub_type(Navier_Stokes_Fluide_Dilatable_base, fluide_dil.vitesse().equation())) ?
165 ref_cast(Navier_Stokes_Fluide_Dilatable_base, fluide_dil.vitesse().equation()).has_source_masse() : false;
166
167 if (!is_thermal() && has_mass_flux) /* species equation */
168 {
169 const Source_Masse_Fluide_Dilatable_base& src_masse = ref_cast(Navier_Stokes_Fluide_Dilatable_base, fluide_dil.vitesse().equation()).source_masse();
170 src_masse.ajouter_eq_espece(eqn, fluide_dil, is_expl, mass_source_term);
171 }
172
173 /*
174 * TOTAL TERM : diffusive + convective + sources
175 */
176 derivee+=convection;
177
178 // if implicit scheme
179 if (!is_expl && has_mass_flux)
180 derivee += mass_source_term; // for this, the volume is handled by the mass solver later...
181
182 if (diffusion_implicite)
183 {
184 const DoubleTab& Tfutur=eqn.inconnue().futur();
185 DoubleTrav secmem(derivee);
186 secmem=derivee; // without source term contribution
187 eqn.solv_masse().appliquer(secmem);
188
189 if (has_mass_flux)
190 secmem += mass_source_term ; // add source term contribution (already divided by V)
191
192 derivee = Tfutur;
193
194 is_thermal() ? eqn.solv_masse().set_name_of_coefficient_temporel("rho_cp_comme_T") :
195 eqn.solv_masse().set_name_of_coefficient_temporel("masse_volumique");
196
197 eqn.Gradient_conjugue_diff_impl(secmem,derivee);
199 }
200
201 // 100% explicit
202 if (!sch.diffusion_implicite() && is_expl)
203 {
204 eqn.solv_masse().appliquer(derivee);
205
206 if (has_mass_flux)
207 derivee += mass_source_term; // add source term contribution (already divided by V)
208
209 derivee.echange_espace_virtuel();
210 }
211
212 return derivee;
213} /* END derivee_en_temps_inco_sans_solveur_masse_impl */
214
217 Matrice_Morse& matrice_morse, const DoubleTab& inco, DoubleTab& resu)
218{
219 /*
220 * ATEENTION : THIS IS A GENERIC METHOD THAT IS USED TO SOLVE IMPLICITLY A THERMAL OR SPECIES
221 * CONV/DIFF EQUATION. SO THE VARIABLE CAN EITHER BE THE TEMPERATURE T OR THE MASS FRACTION Y.
222 *
223 * See the previous method derivee_en_temps_inco_sans_solveur_masse_impl for more description
224 * of the treated equations.
225 */
226
227 // Elie Saikali
228 // Keep this test for debug ... TODO: check if all this can be removed...
229 int test_op=0;
230 {
231 char* theValue = getenv("TRUST_TEST_OPERATEUR_IMPLICITE");
232 if (theValue != nullptr) test_op=2;
233 }
234 {
235 char* theValue = getenv("TRUST_TEST_OPERATEUR_IMPLICITE_BLOQUANT");
236 if (theValue != nullptr) test_op=1;
237 }
238
239 Fluide_Dilatable_base& fluide_dil = eqn.fluide();
240 const DoubleTab& tab_rho = fluide_dil.masse_volumique().valeurs();
241 const int n = tab_rho.dimension(0);
242
243 // add diffusion (with rho, D and Y / or lambda and T)
244 eqn.operateur(0).l_op_base().contribuer_a_avec(inco, matrice_morse);
245
246 // Add source term (if any)
247 eqn.sources().contribuer_a_avec(inco,matrice_morse);
248
249 // Really we need to copy ?
250 tab_coeff_diffusif_ = matrice_morse.get_set_coeff();
251
252 // compute convection operator coefficients to get coefficients of div(rho*u*Y)
253 // or div(rho*u*T). In the thermal case, multiply by cp then divide by rho*cp all at once.
254 matrice_morse.get_set_coeff()=0.;
255 eqn.operateur(1).l_op_base().contribuer_a_avec(inco, matrice_morse);
256
257 // compute div(rho * u)
258 DoubleTrav tab_derivee2(resu);
259 calculer_div_u_ou_div_rhou(tab_derivee2);
260
261 if (!is_thermal()) //espece
262 {
263 ToDo_Kokkos("critical");
264 const auto& tab1 = matrice_morse.get_tab1();
265 auto& coeff = matrice_morse.get_set_coeff();
266 for (int som=0 ; som<n ; som++)
267 {
268 double inv_rho = 1. / tab_rho(som);
269 for (auto k=tab1(som)-1; k<tab1(som+1)-1; k++)
270 coeff(k)= (coeff(k)*inv_rho+tab_coeff_diffusif_(k)*inv_rho);
271
272 matrice_morse(som,som)+=tab_derivee2(som)*inv_rho;
273 }
274 }
275 else if (is_thermal() && fluide_dil.type_fluide()=="Gaz_Parfait")
276 {
277 fluide_dil.update_rho_cp(eqn.schema_temps().temps_courant());
278 // ToDo add tab1, tab2, coeff() methods to Matrice_morse_View avoid list of accessors...
279 CDoubleArrView rhoCp = static_cast<const ArrOfDouble&>(eqn.get_champ("rho_cp_comme_T").valeurs()).view_ro();
280 CDoubleArrView rho = static_cast<const ArrOfDouble&>(tab_rho).view_ro();
281 CDoubleArrView derivee2 = static_cast<const ArrOfDouble&>(tab_derivee2).view_ro();
282 auto tab1 = matrice_morse.get_tab1().view_ro();
283 CDoubleArrView coeff_diffusif = tab_coeff_diffusif_.view_ro();
284 DoubleArrView coeff = matrice_morse.get_set_coeff().view_wo();
285 bool is_not_generic = !is_generic();
286 Matrice_Morse_View matrice;
287 matrice.set(matrice_morse);
288 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), range_1D(0, n), KOKKOS_LAMBDA(const int som)
289 {
290 double inv_rho = 1. / rho(som);
291 if (is_not_generic) inv_rho = 1.;
292 double rapport = 1. / rhoCp(som);
293
294 // multiply the whole matrix row by the ratio
295 for (auto k=tab1(som)-1; k<tab1(som+1)-1; k++)
296 coeff(k)= (coeff(k)*inv_rho+coeff_diffusif(k)*rapport);
297
298 // add T*div(rho*u)/rho
299 matrice.add(som,som,derivee2(som)*inv_rho);
300 });
301 end_gpu_timer(__KERNEL_NAME__);
302 }
303 else
304 {
305 Cerr<<"The implicit algorithm is available only for perfect gas."<<finl;
307 }
308
309 // we have the approximate matrix, now recompute the residual;
310 resu=0;
311 derivee_en_temps_inco_sans_solveur_masse_impl(eqn,resu,false /* implicit */);
312 matrice_morse.ajouter_multvect(inco,resu);
313
314 if (test_op)
315 {
316 DoubleTrav diff(resu), conv(resu);
319 eqn.sources().ajouter(diff);
320 double Cp = -5.;
321 int is_cp_unif= sub_type(Champ_Uniforme,fluide_dil.capacite_calorifique());
322 const DoubleTab& tab_cp = fluide_dil.capacite_calorifique().valeurs();
323 if (is_cp_unif) Cp=tab_cp(0,0);
324
325 for (int som=0 ; som<n ; som++)
326 {
327 if (!is_cp_unif) Cp=tab_cp(som);
328 double inv_rho=1./tab_rho(som);
329 if (!is_generic()) inv_rho=1;
330 double rapport=1./(tab_rho(som)*Cp);
331 diff(som)=resu(som)-conv(som)*inv_rho-diff(som)*rapport;
332 }
333 eqn.solv_masse().appliquer(diff);
334 double err=mp_max_abs_vect(diff);
335 Cerr << eqn.que_suis_je() <<" : Assembly error = " << err << finl;
336
337 if (err > 1.e-5)
338 {
339 DoubleVect& diff_=diff;
340 Cerr<<" size "<< diff_.size()<<finl;
341 for (int i=0; i<diff_.size(); i++)
342 if (std::fabs(diff_(i))>1e-5) Cerr<<i << " "<< diff_(i)<< " "<<finl;
343
344 if (test_op==1)
345 {
346 Cerr<<" problem max cell "<<imin_array(diff)<<" or " <<imax_array(diff)<<finl;
348 }
349 }
350 }
351} /* END assembler_impl */
352
353void Convection_Diffusion_Fluide_Dilatable_Proto::assembler_blocs(Convection_Diffusion_Fluide_Dilatable_base& eqn,matrices_t matrices, DoubleTab& secmem, const tabs_t& semi_impl)
354{
355 const std::string& nom_inco = eqn.inconnue().le_nom().getString();
356 Matrice_Morse *mat = matrices.count(nom_inco)?matrices.at(nom_inco):nullptr;
357
358 Fluide_Dilatable_base& fluide_dil = eqn.fluide();
359 const DoubleTab& tab_rho = fluide_dil.masse_volumique().valeurs();
360 const int n = tab_rho.dimension(0);
361
362 Matrice_Morse mat_diff(*mat);
363 DoubleTab secmem_tmp(secmem);
364 eqn.operateur(0).l_op_base().ajouter_blocs({{nom_inco, &mat_diff}}, secmem_tmp, semi_impl);
365 statistics().end_count(STD_COUNTERS::ajouter_blocs);
366
367 statistics().begin_count(STD_COUNTERS::source_terms,statistics().get_last_opened_counter_level()+1);
368 for (int i = 0; i < eqn.sources().size(); i++)
369 eqn.sources()(i)->ajouter_blocs({{nom_inco, &mat_diff}}, secmem_tmp, semi_impl);
370 statistics().end_count(STD_COUNTERS::source_terms);
371
372 statistics().begin_count(STD_COUNTERS::ajouter_blocs,statistics().get_last_opened_counter_level()+1);
373 auto& coeff_diffusif = mat_diff.get_set_coeff();
374
375 const auto& tab1 = mat->get_tab1();
376 auto& coeff = mat->get_set_coeff();
377 coeff = 0;
378 eqn.operateur(1).l_op_base().ajouter_blocs(matrices, secmem_tmp, semi_impl);
379
380 // compute div(rho * u)
382
383 if (!is_thermal()) //espece
384 {
385 for (int som=0 ; som<n ; som++)
386 {
387 double inv_rho = 1. / tab_rho(som);
388 for (auto k=tab1(som)-1; k<tab1(som+1)-1; k++) coeff(k)= (coeff(k)*inv_rho+coeff_diffusif(k)*inv_rho);
389
390 if(mat) (*mat)(som,som)+=secmem(som)*inv_rho;
391 }
392 }
393 else if (is_thermal() && fluide_dil.type_fluide()=="Gaz_Parfait")
394 {
395 fluide_dil.update_rho_cp(eqn.schema_temps().temps_courant());
396 const DoubleTab& rhoCp = eqn.get_champ("rho_cp_comme_T").valeurs();
397
398 for (int som=0 ; som<n ; som++)
399 {
400 double inv_rho = 1. / tab_rho(som);
401 if (!is_generic()) inv_rho = 1.;
402 double rapport = 1. / rhoCp(som);
403
404 // multiply the whole matrix row by the ratio
405 for (auto k=tab1(som)-1; k<tab1(som+1)-1; k++) coeff(k)= (coeff(k)*inv_rho+coeff_diffusif(k)*rapport);
406
407 // add T*div(rho*u)/rho
408 if(mat) (*mat)(som,som) += secmem(som)*inv_rho;
409 }
410 }
411 else
412 {
413 Cerr<<"The implicit algorithm is available only for perfect gas."<<finl;
415 }
416
417 // we have the approximate matrix, now recompute the residual;
418 secmem=0;
419 derivee_en_temps_inco_sans_solveur_masse_impl(eqn,secmem,false /* implicit */);
420 if(mat) mat->ajouter_multvect(eqn.inconnue().valeurs(),secmem);
421}
422
423/*
424 * Methodes statiques
425 */
426
428{
429 std::vector<YAML_data> data = eq.data_a_sauvegarder_base();
430
431 Fluide_Weakly_Compressible& FWC = ref_cast_non_const(Fluide_Weakly_Compressible,fld);
432 OWN_PTR(Champ_Inc_base) p_tab = FWC.inco_chaleur(); // Initialize with same discretization
433 std::string name = eq.probleme().le_nom().getString() + "_Pression_EOS";
434 int nb_dim = p_tab->valeurs().nb_dim();
435 YAML_data pressure(name, "double", nb_dim);
436 data.push_back(pressure);
437 return data;
438}
439
441 const Convection_Diffusion_std& eq,
442 const Fluide_Dilatable_base& fld)
443{
444 int bytes=0,a_faire,special;
445 bytes += eq.sauvegarder_base(os); // XXX: see Convection_Diffusion_std
447
448 Fluide_Weakly_Compressible& FWC = ref_cast_non_const(Fluide_Weakly_Compressible,fld);
449 if (a_faire)
450 {
451 OWN_PTR(Champ_Inc_base) p_tab = FWC.inco_chaleur(); // Initialize with same discretization
452 p_tab->nommer("Pression_EOS");
453 p_tab->valeurs() = FWC.pression_th_tab(); // Use good values
454 if (special && Process::is_parallel())
455 Cerr << "ATTENTION : For a parallel calculation, the field Pression_EOS is not saved in xyz format ... " << finl;
456 else
457 bytes += p_tab->sauvegarder(os);
458 }
460 {
461 // Different treatment with PDI as the backup will be triggered later, so we can't share a temporary pointer...
462 const DoubleTab& p_th_tab = FWC.pression_th_tab();
463 std::string name = eq.probleme().le_nom().getString() + "_Pression_EOS";
464
465 // Sharing the dimensions of the unknown field with PDI
466 TRUST_2_PDI pdi_interface;
467 pdi_interface.share_TRUSTTab_dimensions(p_th_tab, name, 1 /*write mode*/);
468 // Sharing the unknown field with PDI
469 if( p_th_tab.dimension_tot(0) )
470 pdi_interface.TRUST_start_sharing(name, p_th_tab.addr());
471 else
472 {
473 ArrOfDouble garbage( p_th_tab.nb_dim() );
474 pdi_interface.TRUST_start_sharing(name, garbage.addr());
475 }
476
477 bytes = 8 * p_th_tab.size_array();
478 }
479
480 return bytes;
481}
482
484 double temps,
487 Champ_Inc_base& inco,
488 Probleme_base& pb)
489{
490 // start resuming
491 eq.reprendre_base(is); // XXX: see Convection_Diffusion_std
492
493 // XXX : should be set so that Pression_EOS is read and not initialized from data file
495 FWC.set_resume_flag();
496 // resume EOS pressure field
497 OWN_PTR(Champ_Inc_base) p_tab = FWC.inco_chaleur(); // Initialize with same discretization
498
499 p_tab->nommer("Pression_EOS");
501 {
502 Cerr << "Error in Convection_Diffusion_Espece_Binaire_WC::reprendre !" << finl;
503 Cerr << "Use the sauv file to resume a parallel WC calculation (Pression_EOS is required) ... " << finl;
505 }
506 else
507 {
509 {
510 Nom field_tag(p_tab->le_nom());
511 field_tag += p_tab->que_suis_je();
512 field_tag += pb.domaine().le_nom();
513 field_tag += Nom(temps,pb.reprise_format_temps());
515 {
516 Nom field_tag_syno = eq.create_polymacfamily_syno(field_tag);
517 avancer_fichier_with_syno(is,field_tag,field_tag_syno);
518 }
519 // end of the backward compatibility
520 else
521 avancer_fichier(is,field_tag);
522 }
523 p_tab->reprendre(is);
524 }
525
526 // set good field
527 FWC.set_pression_th_tab(p_tab->valeurs());
528
529 return 1;
530}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
Class Champ_Inc_base.
DoubleTab & futur(int i=1) override
Returns field values at instant t+i.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
virtual DoubleTab & valeurs()=0
Champ_Uniforme Represents a field that is constant in space and time.
void calculer_div_rho_u_impl(DoubleTab &res, const Convection_Diffusion_Fluide_Dilatable_base &eqn) const
static std::vector< YAML_data > data_a_sauvegarder(const Convection_Diffusion_std &eq, const Fluide_Dilatable_base &fld)
DoubleTab & derivee_en_temps_inco_sans_solveur_masse_impl(Convection_Diffusion_Fluide_Dilatable_base &eqn, DoubleTab &derivee, const bool is_expl)
Returns the time derivative of the equation's unknown.
public_for_cuda void assembler_impl(Convection_Diffusion_Fluide_Dilatable_base &eqn, Matrice_Morse &mat_morse, const DoubleTab &present, DoubleTab &secmem)
static int Reprendre_WC(Entree &is, double temps, Convection_Diffusion_std &eq, Fluide_Dilatable_base &fld, Champ_Inc_base &inco, Probleme_base &pb)
virtual void calculer_div_u_ou_div_rhou(DoubleTab &res) const =0
static int Sauvegarder_WC(Sortie &os, const Convection_Diffusion_std &eq, const Fluide_Dilatable_base &fld)
void assembler_blocs(Convection_Diffusion_Fluide_Dilatable_base &eqn, matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl)
Base class for convection-diffusion equations for a dilatable fluid.
Convection_Diffusion_std This class is the base for equations modelling the transport.
std::vector< YAML_data > data_a_sauvegarder_base() const
const Operateur & operateur(int) const override
Returns the operator at the given index: returns terme_diffusif if i = 0,.
virtual bool is_poly_family() const
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
static int is_ecriture_special(int &special, int &a_faire)
Indicates whether the special format was requested in active writing by xyz save.
static int is_lecture_special()
Indicates whether the special format was requested in active reading by xyz restart.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Sources & sources()
Returns the source terms associated with the equation.
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
Solveur_Masse_base & solv_masse()
Returns the mass solver associated with the equation.
Nom create_polymacfamily_syno(const Nom &field_tag) const
Create a synonym of a field name in order to ensure backward compatibility with old names of the Poly...
const Champ_base & get_champ(const Motcle &nom) const override
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the discretized boundary condition domain associated with the equation.
Probleme_base & probleme()
Returns the problem associated with the equation.
Schema_Temps_base & schema_temps()
Returns the time scheme associated with the equation.
void Gradient_conjugue_diff_impl(DoubleTrav &secmem, DoubleTab &solution)
const Nom & le_nom() const override
Returns the name of the field.
void nommer(const Nom &) override
Gives a name to the field.
Base class for a dilatable fluid, inheriting from Fluide_base.
const DoubleTab & temperature() const
Returns the array of temperature values.
const Champ_Inc_base & inco_chaleur() const
void update_rho_cp(double temps) override
const Champ_Inc_base & vitesse() const
const Nom type_fluide() const
Fluide_Weakly_Compressible class This class represents a weakly compressible fluid,...
const DoubleTab & pression_th_tab() const
void set_pression_th_tab(DoubleTab &Pth_tab)
virtual DoubleVect & ajouter_multvect(const DoubleVect &x, DoubleVect &r) const
Matrix-vector multiply-accumulate operation (saxpy).
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
const auto & get_tab1() const
auto & get_set_coeff()
virtual const Champ_Don_base & capacite_calorifique() const
Returns the heat capacity of the medium (const version).
virtual const Champ_base & masse_volumique() const
Returns the mass density of the medium (const version).
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
Base class carrying the terms of the momentum equation for a fluid without turbulence modelling under...
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
const std::string & getString() const
Definition Nom.h:92
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual int sauvegarder(Sortie &) const
Saves an Objet_U to an output stream. Virtual method to override.
Definition Objet_U.cpp:350
Classe Op_Conv_negligeable This class represents a negligible convection operator.
Operateur_Conv_base This class is the base of the hierarchy of operators representing.
class Operateur_base This class is the base of the hierarchy of objects representing an
virtual void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const
DOES NOTHING - to override in derived classes.
virtual void contribuer_au_second_membre(DoubleTab &) const
DOES NOTHING - to override in derived classes.
virtual void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={ }) const
class Operateur Generic class of the operator hierarchy.
Definition Operateur.h:39
virtual Operateur_base & l_op_base()=0
virtual DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const =0
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
class Probleme_base It is a Probleme_U that is not a coupling.
const Domaine & domaine() const
Returns the domain associated with the problem.
const Discretisation_base & discretisation() const
Returns the discretization associated with the problem.
const char * reprise_format_temps() const
static bool is_parallel()
Definition Process.cpp:108
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
class Schema_Temps_base
int diffusion_implicite() const
Returns 1 if the time scheme has been read with diffusion_implicite.
double temps_courant() const
Returns the current time.
virtual DoubleTab & appliquer(DoubleTab &) const
Returns appliquer_impl(x/temporal_coefficient) if a temporal coefficient is set, otherwise returns ap...
void set_name_of_coefficient_temporel(const Nom &)
Allows choosing the name of the temporal coefficient to use for apply.
Base class for output streams.
Definition Sortie.h:52
Special mass source term for the mass equation (used only during the projection/correction step).
virtual void ajouter_eq_espece(const Convection_Diffusion_Fluide_Dilatable_base &eqn, const Fluide_Dilatable_base &fluide, const bool is_expl, DoubleVect &resu) const =0
void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const
Contribution to the implicit matrix of source terms. By default, no contribution.
Definition Sources.cpp:201
DoubleTab & ajouter(DoubleTab &) const
Adds the contribution of all sources in the list to the array passed as parameter,...
Definition Sources.cpp:85
_SIZE_ size_array() const
_TYPE_ * addr()
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
TRUST_2_PDI Encapsulation of PDI methods (library used for IO operations). See the website pdi....
Definition TRUST_2_PDI.h:59
static int is_PDI_checkpoint()
static int is_PDI_restart()
void share_TRUSTTab_dimensions(const DoubleTab &tab, const Nom &name, int write)
Generic method to share the dimensions of a TRUST DoubleTab with PDI.
void TRUST_start_sharing(const std::string &name, const void *data)
YAML_data class: collection of all needed information for data to save/restore in order to write the ...
Definition YAML_data.h:26