twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / applications / solvers / multiphase / twoPhaseEulerFoam / kineticTheoryModels / frictionalStressModel / Schaeffer / SchaefferFrictionalStress.C
blob12555e5dc5d7911d256270dedcc4c524919fd482
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2011 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 * * * * * * * * * * * * * //
31 namespace Foam
33     defineTypeNameAndDebug(SchaefferFrictionalStress, 0);
35     addToRunTimeSelectionTable
36     (
37         frictionalStressModel,
38         SchaefferFrictionalStress,
39         dictionary
40     );
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::
64 frictionalPressure
66     const volScalarField& alpha,
67     const dimensionedScalar& alphaMinFriction,
68     const dimensionedScalar& alphaMax,
69     const dimensionedScalar& Fr,
70     const dimensionedScalar& eta,
71     const dimensionedScalar& p
72 ) const
74     return
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
89 ) const
91     return
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
104 ) const
106     const scalar I2Dsmall = 1.0e-15;
108     // Creating muf assuming it should be 0 on the boundary which may not be
109     // true
110     tmp<volScalarField> tmuf
111     (
112         new volScalarField
113         (
114             IOobject
115             (
116                 "muf",
117                 alpha.mesh().time().timeName(),
118                 alpha.mesh()
119             ),
120             alpha.mesh(),
121             dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 0.0)
122         )
123     );
125     volScalarField& muff = tmuf();
127     forAll (D, celli)
128     {
129         if (alpha[celli] > alphaMax.value() - 5e-2)
130         {
131             muff[celli] =
132                 0.5*pf[celli]*sin(phi.value())
133                /(
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
139                 );
140         }
141     }
143     muff.correctBoundaryConditions();
145     return tmuf;
149 // ************************************************************************* //