Remove trailing whitespace systematically
[foam-extend-3.2.git] / applications / solvers / solidMechanics / deprecatedSolvers / materialModels / rheologyModel / rheologyLaws / MaxwellViscoelastic / MaxwellViscoelastic.C
blobbf7ba5cd3c430b18dfa89e281beb8c7a77fe88cd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Description
26 \*---------------------------------------------------------------------------*/
28 #include "MaxwellViscoelastic.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "zeroGradientFvPatchFields.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 namespace Foam
36     defineTypeNameAndDebug(MaxwellViscoelastic, 0);
37     addToRunTimeSelectionTable(rheologyLaw, MaxwellViscoelastic, dictionary);
41 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
44 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 // Construct from dictionary
47 Foam::MaxwellViscoelastic::MaxwellViscoelastic
49     const word& name,
50     const volSymmTensorField& sigma,
51     const dictionary& dict
54     rheologyLaw(name, sigma, dict),
55     rho_(dict.lookup("rho")),
56     k_(dict.lookup("k")),
57     eta_(dict.lookup("eta")),
58     nu_(dict.lookup("nu"))
62 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
64 Foam::MaxwellViscoelastic::~MaxwellViscoelastic()
68 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
70 Foam::tmp<Foam::volScalarField> Foam::MaxwellViscoelastic::rho(scalar t) const
72     tmp<volScalarField> tresult
73     (
74         new volScalarField
75         (
76             IOobject
77             (
78                 "rho",
79                 mesh().time().timeName(),
80                 mesh(),
81                 IOobject::NO_READ,
82                 IOobject::NO_WRITE
83             ),
84             mesh(),
85             rho_,
86             zeroGradientFvPatchScalarField::typeName
87         )
88     );
90     tresult().correctBoundaryConditions();
92     return tresult;
96 Foam::tmp<Foam::volScalarField> Foam::MaxwellViscoelastic::E(scalar t) const
98     scalar tau = eta_.value()/k_.value();
100     tmp<volScalarField> tE
101     (
102         new volScalarField
103         (
104             IOobject
105             (
106                 "E",
107                 mesh().time().timeName(),
108                 mesh(),
109                 IOobject::NO_READ,
110                 IOobject::NO_WRITE
111             ),
112             mesh(),
113             k_*exp(-t/tau),
114             zeroGradientFvPatchScalarField::typeName
115         )
116     );
118     if (t < 0)
119     {
120         tE().internalField() = 0.0;
121         tE().correctBoundaryConditions();
122     }
124     return tE;
128 Foam::tmp<Foam::volScalarField> Foam::MaxwellViscoelastic::nu(scalar t) const
130     tmp<volScalarField> tresult
131     (
132         new volScalarField
133         (
134             IOobject
135             (
136                 "nu",
137                 mesh().time().timeName(),
138                 mesh(),
139                 IOobject::NO_READ,
140                 IOobject::NO_WRITE
141             ),
142             mesh(),
143             nu_,
144             zeroGradientFvPatchScalarField::typeName
145         )
146     );
148     tresult().correctBoundaryConditions();
150     return tresult;
154 Foam::tmp<Foam::volScalarField> Foam::MaxwellViscoelastic::J(scalar t) const
156     tmp<volScalarField> tJ
157     (
158         new volScalarField
159         (
160             IOobject
161             (
162                 "J",
163                 mesh().time().timeName(),
164                 mesh(),
165                 IOobject::NO_READ,
166                 IOobject::NO_WRITE
167             ),
168             mesh(),
169             dimensionedScalar
170             (
171                 "J",
172                 dimless/k_.dimensions(),
173                 1.0/k_.value() + t/eta_.value()
174             ),
175             zeroGradientFvPatchScalarField::typeName
176         )
177     );
179     if (t < 0)
180     {
181         tJ().internalField() = 0.0;
182         tJ().correctBoundaryConditions();
183     }
185     return tJ;
189 // ************************************************************************* //