TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Frontiere_ouverte_vitesse_vortex.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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#include <Frontiere_ouverte_vitesse_vortex.h>
16#include <EChaine.h>
17#include <Param.h>
18#include <Sous_Domaine.h>
19#include <Domaine_VF.h>
20#include <Domaine_Cl_dis_base.h>
21#include <Probleme_base.h>
22#include <Transport_Interfaces_FT_Disc.h>
23#include <Domaine.h>
24
25Implemente_instanciable(Frontiere_ouverte_vitesse_vortex,"Frontiere_ouverte_vitesse_vortex",Entree_fluide_vitesse_imposee);
26
28{
29 Param param(que_suis_je());
30 param.ajouter("sous_domaine", &nom_sous_domaine_, Param::REQUIRED);
31 param.ajouter("equation", &nom_equation_, Param::REQUIRED);
32 param.ajouter("integrale_reference", &integrale_reference_, Param::REQUIRED);
33 param.ajouter("signe", &signe_, Param::REQUIRED);
34 param.ajouter("coeff_vitesse", &coeff_vitesse_, Param::REQUIRED);
35 param.lire_avec_accolades_depuis(is);
36
37 if (coeff_vitesse_.size_array() != dimension)
38 {
39 Cerr << "Frontiere_ouverte_vitesse_vortex: wrong dimension for coeff_vitesse" << finl;
41 }
42 Nom n("Champ_Front_Uniforme ");
43 n += Nom(dimension);
44 for (int i = 0; i < dimension; i++)
45 n += " 0.";
46 EChaine s(n);
47 s >> le_champ_front;
48 return is;
49}
50
52{
53 return os;
54}
55
57{
58 // Calcul de l'integrale du champ sur la sous-domaine
59 const Domaine_Cl_dis_base& domaine_Cl_dis_base = domaine_Cl_dis();
60 const Equation_base& equation = domaine_Cl_dis_base.equation().probleme().get_equation_by_name(nom_equation_);
61 const Transport_Interfaces_FT_Disc& eq = ref_cast(Transport_Interfaces_FT_Disc, equation);
62 const DoubleTab& indic = eq.inconnue().valeurs();
63 const Sous_Domaine& sous_domaine = domaine_Cl_dis_base.domaine().ss_domaine(nom_sous_domaine_);
64 const DoubleVect& volume = ref_cast(Domaine_VF, domaine_Cl_dis_base.domaine_dis()).volumes();
65
66 double integrale = 0.;
67 const int n = sous_domaine.nb_elem_tot();
68 int i;
69 for (i = 0; i < n; i++)
70 {
71 const int elem = sous_domaine[i];
72 const double x = indic(elem);
73 const double v = volume(elem);
74 integrale += x * v;
75 }
76 DoubleTab& val = le_champ_front->valeurs();
77
78 double facteur = integrale - integrale_reference_;
79 if (facteur * signe_ < 0.)
80 facteur = 0.;
81
82 for (i = 0; i < dimension; i++)
83 val(0, i) = coeff_vitesse_[i] * facteur;
84
85 le_champ_front->mettre_a_jour(temps);
86 Cerr << "Frontiere_ouverte_vitesse_vortex integrale=" << integrale << " vitesse="
87 << val(0,0) << " " << val(0,1) << " " << ((dimension==3)?val(0,2):0.) << finl;
88}
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
const Sous_Domaine_t & ss_domaine(int i) const
Definition Domaine.h:290
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
Domaine_dis_base & domaine_dis()
Returns a reference to the discretized domain associated with the boundary conditions.
class Domaine_VF
Definition Domaine_VF.h:44
Entree_fluide_vitesse_imposee Special case of the class Dirichlet_entree_fluide.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
Probleme_base & probleme()
Returns the problem associated with the equation.
void mettre_a_jour(double temps) override
Performs a time update of the boundary condition.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:94
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
@ REQUIRED
Definition Param.h:115
virtual const Equation_base & get_equation_by_name(const Nom &) const
(B. Math): Virtual method added for problems having several equations of the same type (Probleme_FT_D...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
int_t nb_elem_tot() const
const Champ_Inc_base & inconnue() const override