1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "SchaefferFrictionalStress.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 defineTypeNameAndDebug(SchaefferFrictionalStress, 0);
35 addToRunTimeSelectionTable
37 frictionalStressModel,
38 SchaefferFrictionalStress,
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 Foam::SchaefferFrictionalStress::SchaefferFrictionalStress
48 const dictionary& dict
51 frictionalStressModel(dict)
55 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
57 Foam::SchaefferFrictionalStress::~SchaefferFrictionalStress()
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::
66 const volScalarField& alpha,
67 const dimensionedScalar& alphaMinFriction,
68 const dimensionedScalar& alphaMax,
69 const dimensionedScalar& Fr,
70 const dimensionedScalar& eta,
71 const dimensionedScalar& p
75 dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24)
76 *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0);
80 Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::
81 frictionalPressurePrime
83 const volScalarField& alpha,
84 const dimensionedScalar& alphaMinFriction,
85 const dimensionedScalar& alphaMax,
86 const dimensionedScalar& Fr,
87 const dimensionedScalar& eta,
88 const dimensionedScalar& p
92 dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25)
93 *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0);
97 Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf
99 const volScalarField& alpha,
100 const dimensionedScalar& alphaMax,
101 const volScalarField& pf,
102 const volSymmTensorField& D,
103 const dimensionedScalar& phi
106 const scalar I2Dsmall = 1.0e-15;
108 // Creating muf assuming it should be 0 on the boundary which may not be
110 tmp<volScalarField> tmuf
117 alpha.mesh().time().timeName(),
121 dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 0.0)
125 volScalarField& muff = tmuf();
129 if (alpha[celli] > alphaMax.value() - 5e-2)
132 0.5*pf[celli]*sin(phi.value())
134 sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
135 + sqr(D[celli].yy() - D[celli].zz())
136 + sqr(D[celli].zz() - D[celli].xx()))
137 + sqr(D[celli].xy()) + sqr(D[celli].xz())
138 + sqr(D[celli].yz())) + I2Dsmall
143 muff.correctBoundaryConditions();
149 // ************************************************************************* //