TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_Ostwald.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// New fluid: a non-Newtonian incompressible fluid. It derives from
16// Fluide_Incompressible and has additional properties (K, N).
17// mu depends on K, N, and grad(U).
18
19#include <Fluide_Ostwald.h>
20#include <Probleme_base.h>
21#include <Discret_Thyd.h>
22
23#include <Navier_Stokes_std.h>
24#include <Param.h>
25
26Implemente_instanciable_sans_constructeur(Fluide_Ostwald,"Fluide_Ostwald",Fluide_Incompressible);
27// XD fluide_ostwald fluide_incompressible fluide_ostwald INHERITS_BRACE Non-Newtonian fluids governed by Ostwald\'s
28// XD_CONT law. The law applicable to stress tensor is: NL2 tau=K(T)*(D:D/2)**((n-1)/2)*D Where: NL2 D refers to the
29// XD_CONT deformation tensor NL2 K refers to fluid consistency (may be a function of the temperature T) NL2 n refers to
30// XD_CONT the fluid structure index n=1 for a Newtonian fluid, n<1 for a rheofluidifier fluid, n>1 for a rheothickening
31// XD_CONT fluid.
32// XD attr k field_base k OPT Fluid consistency.
33// XD attr n field_base n OPT Fluid structure index.
34
36
38{
39 s<<"{"<<finl;
40 s<<"K"<<K_<<finl;
41 // s<<"beta_co"<<beta_co<<finl;
42 s<<"N"<<N_<<finl;
44 s<<"}"<<finl;
45 return s;
46}
47
49{
51 return is;
52}
53
55{
57 param.ajouter_condition("is_read_rho","Density rho has not been read for a Fluide_Ostwald type medium.");
58 param.ajouter("K",&K_,Param::REQUIRED);
59 param.ajouter("n",&N_,Param::REQUIRED);
60}
61
63{
64 const Domaine_dis_base& domaine_dis=pb.equation(0).domaine_dis();
65 const Discret_Thyd& dis2=ref_cast(Discret_Thyd, dis);
66
67 // with the Ostwald signature ...
68 const Navier_Stokes_std& eqn_hydr=ref_cast(Navier_Stokes_std,pb.equation(0));
69 // Typing mu field
70 Nom dis_nam = dis.que_suis_je();
71 if (dis_nam.debute_par("VEF")) dis_nam = "VEF";
72 ch_mu_.typer(Nom("Champ_Ostwald_") + dis_nam);
73
74 dis2.proprietes_physiques_fluide_Ostwald(eqn_hydr.domaine_dis(),(*this),eqn_hydr,eqn_hydr.inconnue());
75 if (K_)
76 {
77 dis.nommer_completer_champ_physique(domaine_dis,"consistance","kg/m/s",K_.valeur(),pb);
78 champs_compris_.ajoute_champ(K_.valeur());
79 }
80
82}
83
88
90{
91 K_->mettre_a_jour(tps);
92 if (N_ )
93 N_->mettre_a_jour(tps);
95}
96
97int Fluide_Ostwald::initialiser(const double temps)
98{
100}
class Discret_Thyd This class is the base class representing a discretization
virtual void proprietes_physiques_fluide_Ostwald(const Domaine_dis_base &, Fluide_Ostwald &, const Navier_Stokes_std &, const Champ_Inc_base &) const
class Discretisation_base This class represents a spatial discretization scheme, which
void nommer_completer_champ_physique(const Domaine_dis_base &domaine_vdf, const Nom &nom_champ, const Nom &unite, Champ_base &champ, const Probleme_base &pbi) const
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
Represents an incompressible fluid and its properties:
void set_param(Param &param) const override
class Fluide_Ostwald
void set_param(Param &param) const override
void creer_champs_non_lus() override
int initialiser(const double temps) override
Initializes the fluid parameters.
void mettre_a_jour(double) override
Performs a time update of the medium and therefore of its characteristic parameters.
void discretiser(const Probleme_base &pb, const Discretisation_base &dis) override
void ecrire(Sortie &) const
Writes a medium object to an output stream.
virtual int initialiser(const double temps)
virtual void creer_champs_non_lus()
virtual void mettre_a_jour(double temps)
virtual void discretiser(const Probleme_base &pb, const Discretisation_base &dis)
Champs_compris champs_compris_
Navier_Stokes_std This class carries the terms of the momentum equation.
const Champ_Inc_base & inconnue() const override
Returns the velocity (unknown field of the equation) (const version).
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
virtual int debute_par(const char *const n) const
Definition Nom.cpp:314
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
Definition Param.cpp:496
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
class Probleme_base It is a Probleme_U that is not a coupling.
virtual const Equation_base & equation(int) const =0
Base class for output streams.
Definition Sortie.h:52