thixotropicViscosity.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "thixotropicViscosity.H"
27 #include "kinematicSingleLayer.H"
29 
30 #include "fvmDdt.H"
31 #include "fvmDiv.H"
32 #include "fvcDiv.H"
33 #include "fvmSup.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 namespace regionModels
40 {
41 namespace surfaceFilmModels
42 {
43 
44 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
45 
47 
49 (
52  dictionary
53 );
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
59 (
60  surfaceFilmModel& owner,
61  const dictionary& dict,
63 )
64 :
65  filmViscosityModel(typeName, owner, dict, mu),
66  a_("a", dimless/dimTime, coeffDict_),
67  b_("b", dimless, coeffDict_),
68  d_("d", dimless, coeffDict_),
69  c_("c", pow(dimTime, d_.value() - scalar(1)), coeffDict_),
70  mu0_("mu0", dimPressure*dimTime, coeffDict_),
71  muInf_("muInf", mu0_.dimensions(), coeffDict_),
72  K_(1.0 - Foam::sqrt(muInf_/mu0_)),
73  lambda_
74  (
75  IOobject
76  (
77  typeName + ":lambda",
78  owner.regionMesh().time().timeName(),
79  owner.regionMesh(),
82  ),
83  owner.regionMesh()
84  )
85 {
86  lambda_.min(1.0);
87  lambda_.max(0.0);
88 
89  // Initialise viscosity to inf value because it cannot be evaluated yet
90  mu_ = muInf_;
91  mu_.correctBoundaryConditions();
92 }
93 
94 
95 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
96 
98 {}
99 
100 
101 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
102 
104 (
105  const volScalarField& p,
106  const volScalarField& T
107 )
108 {
109  const kinematicSingleLayer& film = filmType<kinematicSingleLayer>();
110 
111  // references to film fields
112  const volVectorField& U = film.U();
113  const volVectorField& Uw = film.Uw();
114  const volScalarField& delta = film.delta();
115  const volScalarField& deltaRho = film.deltaRho();
116  const surfaceScalarField& phi = film.phi();
117  const volScalarField& alpha = film.alpha();
118  const Time& runTime = this->owner().regionMesh().time();
119 
120  // Shear rate
121  volScalarField gDot("gDot", alpha*mag(U - Uw)/(delta + film.deltaSmall()));
122 
123  if (debug && runTime.outputTime())
124  {
125  gDot.write();
126  }
127 
128  dimensionedScalar deltaRho0("deltaRho0", deltaRho.dimensions(), ROOTVSMALL);
129  surfaceScalarField phiU(phi/fvc::interpolate(deltaRho + deltaRho0));
130 
131  dimensionedScalar c0("c0", dimless/dimTime, ROOTVSMALL);
132  volScalarField coeff("coeff", -c_*pow(gDot, d_) + c0);
133 
134  // Limit the filmMass and deltaMass to calculate the effect of the added
135  // droplets with lambda = 0 to the film
136  const volScalarField filmMass
137  (
138  "thixotropicViscosity:filmMass",
139  film.netMass() + dimensionedScalar("SMALL", dimMass, ROOTVSMALL)
140  );
141  const volScalarField deltaMass
142  (
143  "thixotropicViscosity:deltaMass",
144  max(dimensionedScalar("zero", dimMass, 0), film.deltaMass())
145  );
146 
147  fvScalarMatrix lambdaEqn
148  (
149  fvm::ddt(lambda_)
150  + fvm::div(phiU, lambda_)
151  - fvm::Sp(fvc::div(phiU), lambda_)
152  ==
153  a_*pow((1.0 - lambda_), b_)
154  + fvm::SuSp(coeff, lambda_)
155  - fvm::Sp(deltaMass/(runTime.deltaT()*filmMass), lambda_)
156  );
157 
158  lambdaEqn.relax();
159  lambdaEqn.solve();
160 
161  lambda_.min(1.0);
162  lambda_.max(0.0);
163 
164  mu_ = muInf_/(sqr(1.0 - K_*lambda_) + ROOTVSMALL);
165  mu_.correctBoundaryConditions();
166 }
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace surfaceFilmModels
172 } // End namespace regionModels
173 } // End namespace Foam
174 
175 // ************************************************************************* //
Foam::regionModels::surfaceFilmModels::thixotropicViscosity::thixotropicViscosity
thixotropicViscosity(const thixotropicViscosity &)
Disallow default bitwise copy construct.
Foam::dimPressure
const dimensionSet dimPressure
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::TimeState::outputTime
bool outputTime() const
Return true if this is an output time (primary or secondary)
Definition: TimeState.C:91
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
p
p
Definition: pEqn.H:62
Foam::TimeState::deltaT
dimensionedScalar deltaT() const
Return time step.
Definition: TimeState.C:79
Foam::IOobject::AUTO_WRITE
@ AUTO_WRITE
Definition: IOobject.H:117
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFields.H:13
Foam::regionModels::surfaceFilmModels::thixotropicViscosity::~thixotropicViscosity
virtual ~thixotropicViscosity()
Destructor.
Definition: thixotropicViscosity.C:97
thixotropicViscosity.H
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::U
virtual const volVectorField & U() const
Return the film velocity [m/s].
Definition: kinematicSingleLayer.C:970
Foam::fvc::interpolate
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Definition: surfaceInterpolate.C:110
fvcDiv.H
Calculate the divergence of the given field.
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer
Definition: kinematicSingleLayer.H:63
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::deltaSmall
const dimensionedScalar & deltaSmall() const
Return small delta.
Definition: kinematicSingleLayerI.H:65
fvmDiv.H
Calculate the matrix for the divergence of the given field and flux.
U
U
Definition: pEqn.H:46
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::regionModels::surfaceFilmModels::filmViscosityModel
Definition: filmViscosityModel.H:55
Foam::fvMatrix::solve
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::deltaMass
tmp< volScalarField > deltaMass() const
Return the change in film mass due to sources/sinks.
Definition: kinematicSingleLayerI.H:206
Foam::regionModels::surfaceFilmModels::thixotropicViscosity::correct
virtual void correct(const volScalarField &p, const volScalarField &T)
Correct.
Definition: thixotropicViscosity.C:104
Foam::fvMatrix::relax
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:519
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::fvm::SuSp
tmp< fvMatrix< Type > > SuSp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
thixotropicViscosity
Thixotropic viscosity model based on the evolution of the structural parameter :
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::phi
virtual const surfaceScalarField & phi() const
Return the film flux [kg.m/s].
Definition: kinematicSingleLayer.C:994
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
kinematicSingleLayer.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
coeff
const scalar coeff[]
Definition: Test-Polynomial.C:38
fvmSup.H
Calculate the matrix for implicit and explicit sources.
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::regionModels::surfaceFilmModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Foam::fvm::ddt
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:46
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::Uw
virtual const volVectorField & Uw() const
Return the film wall velocity [m/s].
Definition: kinematicSingleLayer.C:982
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::delta
const volScalarField & delta() const
Return const access to the film thickness / [m].
Definition: kinematicSingleLayerI.H:83
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::alpha
const volScalarField & alpha() const
Return the film coverage, 1 = covered, 0 = uncovered / [].
Definition: kinematicSingleLayerI.H:89
Foam::regionModels::surfaceFilmModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(surfaceFilmModel, kinematicSingleLayer, mesh)
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::netMass
tmp< volScalarField > netMass() const
Return the net film mass available over the next integration.
Definition: kinematicSingleLayerI.H:197
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::regionModels::surfaceFilmModels::surfaceFilmModel
Base class for surface film models.
Definition: surfaceFilmModel.H:61
filmViscosityModel
Base class for surface film viscosity models.
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::deltaRho
virtual const volScalarField & deltaRho() const
Return the film thickness*density (helper field) [kg/m3].
Definition: kinematicSingleLayer.C:988
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::fvm::div
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:46
fvmDdt.H
Calulate the matrix for the first temporal derivative.
Foam::regionModels::regionModel::regionMesh
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:61