FreeFOAM The Cross-Platform CFD Toolkit
SchaefferFrictionalStress.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) 1991-2011 OpenCFD Ltd.
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 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(SchaefferFrictionalStress, 0);
34 
36  (
37  frictionalStressModel,
38  SchaefferFrictionalStress,
39  dictionary
40  );
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const dictionary& dict
49 )
50 :
51  frictionalStressModel(dict)
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
56 
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
65 (
66  const volScalarField& alpha,
67  const dimensionedScalar& alphaMinFriction,
69  const dimensionedScalar& Fr,
70  const dimensionedScalar& eta,
71  const dimensionedScalar& p
72 ) const
73 {
74  return
75  dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24)
76  *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0);
77 }
78 
79 
82 (
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
90 {
91  return
92  dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25)
93  *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0);
94 }
95 
96 
98 (
99  const volScalarField& alpha,
100  const dimensionedScalar& alphaMax,
101  const volScalarField& pf,
102  const volSymmTensorField& D,
103  const dimensionedScalar& phi
104 ) const
105 {
106  const scalar I2Dsmall = 1.0e-15;
107 
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  );
124 
125  volScalarField& muff = tmuf();
126 
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  }
142 
143  muff.correctBoundaryConditions();
144 
145  return tmuf;
146 }
147 
148 
149 // ************************ vim: set sw=4 sts=4 et: ************************ //