TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Courant_maille_Champ_Face.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Courant_maille_Champ_Face.h>
17#include <Schema_Temps_base.h>
18#include <Champ_Face_VDF.h>
19#include <Domaine_VDF.h>
20
21Implemente_instanciable(Courant_maille_Champ_Face,"Courant_maille_Champ_Face",Champ_Fonc_Face_VDF);
22
23Sortie& Courant_maille_Champ_Face::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
24
26
28{
29 vitesse_ = la_vitesse;
30 sch_ = sch;
31}
32
33// XXX : Elie Saikali : not used ... commented out
34// Method to compute the value on a face for a uniform or multi-component field
35//inline double valeur(const DoubleTab &champ, const int face, const int compo, const Domaine_VDF &le_dom_VDF)
36//{
37// if (champ.dimension(0) == 1) return champ(0, compo); // Champ uniforme
38// else
39// {
40// int elem0 = le_dom_VDF.face_voisins(face, 0);
41// int elem1 = le_dom_VDF.face_voisins(face, 1);
42// if (elem1 < 0) elem1 = elem0; // face frontiere
43// return 0.5 * (champ(elem0, compo) + champ(elem1, compo));
44// }
45//}
46
48{
49 const int nb_faces = domaine_vdf().nb_faces();
50 DoubleTab& co = valeurs(); // Cell Courant number
51 double dt = sch_->pas_de_temps();
52 for (int face = 0; face < nb_faces; face++)
53 {
54 // Compute the cell size surrounding the face
55 double taille_maille = domaine_vdf().volumes_entrelaces()(face) / domaine_vdf().face_surfaces(face);
56 // Compute the cell Courant number
57 co(face) = std::fabs(vitesse_->valeurs()(face)) * dt / taille_maille; // Courant_maille = |Uface| * dt / taille_maille
58 }
59
60 changer_temps(tps);
62}
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
class Champ_Face_VDF
class Champ_Fonc_Face_VDF
const Domaine_VDF & domaine_vdf() const override
void mettre_a_jour(double temps) override
Time update of the field.
virtual double changer_temps(const double t)
Sets the time at which the field is defined.
void mettre_a_jour(double) override
Time update of the field.
void associer_champ(const Champ_Face_VDF &, const Schema_Temps_base &)
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
int nb_faces() const
Returns the total number of faces.
Definition Domaine_VF.h:471
DoubleVect & volumes_entrelaces()
Definition Domaine_VF.h:99
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Returns the name of the field.
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Schema_Temps_base
Base class for output streams.
Definition Sortie.h:52