TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Pb_Phase_field.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
16#include <Milieu_Phase_field.h>
17#include <Pb_Phase_field.h>
18#include <Verif_Cl.h>
19
20Implemente_instanciable(Pb_Phase_field,"Pb_Phase_field",Pb_Fluide_base);
21// XD pb_phase_field Pb_base pb_phase_field INHERITS_BRACE Problem to solve local instantaneous
22// XD_CONT incompressible-two-phase-flows. Complete description of the Phase Field model for incompressible and
23// XD_CONT immiscible fluids can be found into this PDF: TRUST_ROOT/doc/TRUST/phase_field_non_miscible_manuel.pdf
24// XD attr milieu_phase_field milieu_phase_field milieu_phase_field REQ The fluid medium associated with the problem.
25// XD attr navier_stokes_phase_field navier_stokes_phase_field navier_stokes_phase_field OPT Navier Stokes equation for
26// XD_CONT the Phase Field problem.
27// XD attr convection_diffusion_phase_field convection_diffusion_phase_field convection_diffusion_phase_field OPT
28// XD_CONT Cahn-Hilliard equation of the Phase Field problem. The unknown of this equation is the concentration C.
29
31{
32 return Pb_Fluide_base::printOn(os);
33}
34
36{
37 return Pb_Fluide_base::readOn(is);
38}
39
40/*! @brief Renvoie l'equation d'hydraulique de type Navier_Stokes_std si i=0 Renvoie l'equation de convection-diffusion de type
41 *
42 * Convection_Diffusion_Concentration si i=1
43 * (l'equation de convection diffusion peut-etre vectorielle)
44 * (version const)
45 *
46 * @param (int i) l'index de l'equation a renvoyer
47 * @return (Equation_base&) l'equation correspondante a l'index
48 */
50{
51 assert((i == 0) || (i == 1));
52 if (i == 0)
53 return eq_hydraulique_;
54 else
55 return eq_concentration_;
56}
57
58/*! @brief Renvoie l'equation d'hydraulique de type Navier_Stokes si i=0 Renvoie l'equation de convection-diffusion de type
59 *
60 * Convection_Diffusion_Concentration si i=1
61 * (l'equation de convection diffusion peut-etre vectorielle)
62 *
63 * @param (int i) l'index de l'equation a renvoyer
64 * @return (Equation_base&) l'equation correspondante a l'index
65 */
67{
68 assert((i == 0) || (i == 1));
69 if (i == 0)
70 return eq_hydraulique_;
71 else
72 return eq_concentration_;
73}
74
75/*! @brief Associe un milieu au probleme, Si le milieu est de type
76 *
77 * - Fluide_Incompressible, il sera associe a l'equation de l'hydraulique
78 * - Constituant, il sera associe a l'equation de convection-diffusion
79 * Un autre type de milieu provoque une erreur
80 *
81 * @param (Milieu_base& mil) le milieu physique a associer au probleme
82 * @throws mauvais type de milieu physique
83 */
85{
86 if (sub_type(Milieu_Phase_field, mil))
87 {
88 eq_hydraulique_.associer_milieu_base(mil);
89 eq_concentration_.associer_milieu_base(mil);
90 }
91 else
92 {
93 Cerr << "A medium of type " << mil.que_suis_je() << " can not be used with " << finl;
94 Cerr << "a problem of type Pb_Phase_field. Use Milieu_Phase_field !!!" << finl;
96 }
97}
98
100{
101 le_milieu_.resize(1); // 1 medium only : Milieu_Phase_field
102 is >> le_milieu_.back(); // On commence par la lecture du milieu
103 associer_milieu_base(le_milieu_.back().valeur()); // On l'associe a chaque equations (methode virtuelle pour chaque pb ...)
104
106
107 // remontee de l'inconnue vers le milieu
108 for (int i = 0; i < nombre_d_equations(); i++)
110
111 equation(0).milieu().discretiser((*this), la_discretisation_.valeur()); /* meme milieu */
112}
113
114/*! @brief Teste la compatibilite des equations de convection-diffusion et de l'hydraulique.
115 *
116 * Le test se fait sur les conditions
117 * aux limites discretisees de chaque equation.
118 * Appel la fonction de librairie hors classe:
119 * tester_compatibilite_hydr_concentration(const Domaine_Cl_dis_base&,const Domaine_Cl_dis_base&)
120 *
121 * @return (int) code de retour propage
122 */
124{
125 const Domaine_Cl_dis_base& domaine_Cl_hydr = eq_hydraulique_.domaine_Cl_dis();
126 const Domaine_Cl_dis_base& domaine_Cl_co = eq_concentration_.domaine_Cl_dis();
127 return tester_compatibilite_hydr_concentration(domaine_Cl_hydr, domaine_Cl_co);
128}
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual void associer_milieu_equation()
virtual const Milieu_base & milieu() const =0
classe Milieu_base Cette classe est la base de la hierarchie des milieux (physiques)
Definition Milieu_base.h:50
virtual void discretiser(const Probleme_base &pb, const Discretisation_base &dis)
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Pb_Fluide_base Cette classe a pour but de disposer d une classe amont pour
Classe Pb_Phase_field Cette classe represente un probleme d'hydraulique avec transport.
int nombre_d_equations() const override
Navier_Stokes_phase_field eq_hydraulique_
void associer_milieu_base(const Milieu_base &) override
Associe un milieu au probleme, Si le milieu est de type.
void typer_lire_milieu(Entree &is) override
Convection_Diffusion_Phase_field eq_concentration_
int verifier() override
Teste la compatibilite des equations de convection-diffusion et de l'hydraulique.
const Equation_base & equation(int) const override
Renvoie l'equation d'hydraulique de type Navier_Stokes_std si i=0 Renvoie l'equation de convection-di...
virtual void discretiser_equations()
std::vector< OWN_PTR(Milieu_base)> le_milieu_
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52