TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Ostwald_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Champ_Ostwald_VDF.h>
17#include <Champ_Uniforme.h>
18#include <Fluide_Ostwald.h>
19
20Implemente_instanciable(Champ_Ostwald_VDF, "Champ_Ostwald_VDF", Champ_Ostwald);
21
22Sortie& Champ_Ostwald_VDF::printOn(Sortie& os) const { return os << valeurs()(0, 0); }
23
24Entree& Champ_Ostwald_VDF::readOn(Entree& is) { return is; }
25
32
33/*! @brief Computes the viscosity mu as a function of consistency and structural index using the Ostwald law.
34 *
35 * @brief For very low and very high viscosities, a regression is used.
36 *
37 * @param mu_tab Viscosity values at the previous time step.
38 */
39
40void Champ_Ostwald_VDF::calculer_mu(DoubleTab& mu_tab)
41{
42 const double d_n = mon_fluide_->indice_struct().valeurs()(0, 0);
43
44 for (int i = 0; i < nb_valeurs_nodales(); i++)
45 {
46 if (sub_type(Champ_Uniforme, mon_fluide_->consistance()))
47 {
48 const double d_k = mon_fluide_->consistance().valeurs()(0, 0);
49 if (mu_tab[i] < 1.E-4)
50 mu_tab[i] = d_k * pow(0.5 * 1.E-4, (d_n - 1.) / 2.);
51 else if (mu_tab[i] > 1.E16)
52 mu_tab[i] = d_k * pow(0.5 * 1.E16, (d_n - 1.) / 2.);
53 else
54 mu_tab[i] = d_k * pow(0.5 * mu_tab[i], (d_n - 1.) / 2.);
55 }
56 else // K varies as a function of temperature
57 {
58 const DoubleTab& K_tab = mon_fluide_->consistance().valeurs();
59 if (mu_tab[i] < 1.E-4)
60 mu_tab[i] = K_tab[i] * pow(0.5 * 1.E-4, (d_n - 1.) / 2.);
61 else if (mu_tab[i] > 1.E16)
62 mu_tab[i] = K_tab[i] * pow(0.5 * 1.E16, (d_n - 1.) / 2.);
63 else
64 mu_tab[i] = K_tab[i] * pow(0.5 * mu_tab[i], (d_n - 1.) / 2.);
65 }
66 }
67}
68
69/*! @brief Computes the Ostwald field: computes D::D then computes mu.
70 *
71 * @param tps Time at which the computation is performed.
72 */
73
75{
76 if (temps_ != tps)
77 {
78 // Cerr<< "Compute Mu Ostwald"<<finl;
79 mon_champ_->calculer_dscald_centre_element(valeurs());
81 }
82}
83
84/*! @brief Initializes the field.
85 *
86 * @param un_temps Initial time.
87 * @return 1 on success.
88 */
89int Champ_Ostwald_VDF::initialiser(const double un_temps)
90{
91 mettre_a_jour(un_temps);
92 return 1;
93}
void mettre_a_jour(double temps) override
Time update.
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
int nb_valeurs_nodales() const override
Returns the number of degrees of freedom per component: the number of nodes.
class Champ_Ostwald_VDF
void mettre_a_jour(double temps) override
Time update of the field.
void me_calculer(double tps) override
Computes the Ostwald field: computes D::D then computes mu.
int initialiser(const double temps) override
Initializes the field.
void calculer_mu(DoubleTab &)
Computes the viscosity mu as a function of consistency and structural index using the Ostwald law.
Champ_Ostwald Represents a field that varies as a function of consistency and.
Champ_Uniforme Represents a field that is constant in space and time.
double temps_
Definition Champ_base.h:123
virtual double changer_temps(const double t)
Sets the time at which the field is defined.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
Base class for output streams.
Definition Sortie.h:52