Remove trailing whitespace systematically
[foam-extend-3.2.git] / applications / solvers / solidMechanics / deprecatedSolvers / materialModels / rheologyModel / rheologyLaws / PronyViscoelastic / PronyViscoelastic.C
bloba0d300ba81e9412093048216ff2de0b7d264735c
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 "PronyViscoelastic.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "zeroGradientFvPatchFields.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 namespace Foam
36     defineTypeNameAndDebug(PronyViscoelastic, 0);
37     addToRunTimeSelectionTable(rheologyLaw, PronyViscoelastic, dictionary);
41 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
44 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 // Construct from dictionary
47 Foam::PronyViscoelastic::PronyViscoelastic
49     const word& name,
50     const volSymmTensorField& sigma,
51     const dictionary& dict
54     rheologyLaw(name, sigma, dict),
55     rho_(dict.lookup("rho")),
56     k_("k", dict, readInt(dict.lookup("size"))),
57     kDimensions_(dict.lookup("kDimensions")),
58     tau_("tau", dict, readInt(dict.lookup("size"))),
59     tauDimensions_(dict.lookup("tauDimensions")),
60     nu_(dict.lookup("nu"))
64 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
66 Foam::PronyViscoelastic::~PronyViscoelastic()
70 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
72 Foam::tmp<Foam::volScalarField> Foam::PronyViscoelastic::rho(scalar t) const
74     tmp<volScalarField> tresult
75     (
76         new volScalarField
77         (
78             IOobject
79             (
80                 "rho",
81                 mesh().time().timeName(),
82                 mesh(),
83                 IOobject::NO_READ,
84                 IOobject::NO_WRITE
85             ),
86             mesh(),
87             rho_,
88             zeroGradientFvPatchScalarField::typeName
89         )
90     );
92     tresult().correctBoundaryConditions();
93     return tresult;
97 Foam::tmp<Foam::volScalarField> Foam::PronyViscoelastic::E(scalar t) const
99     scalar E = 0.0;
101     E = k_[0];
103     for(int i=1; i<k_.size(); i++)
104     {
105         E += k_[i]*exp(-t/tau_[i]);
106     }
108     if(t < 0)
109     {
110         E = 0;
111     }
113     tmp<volScalarField> tresult
114     (
115         new volScalarField
116         (
117             IOobject
118             (
119                 "E",
120                 mesh().time().timeName(),
121                 mesh(),
122                 IOobject::NO_READ,
123                 IOobject::NO_WRITE
124             ),
125             mesh(),
126             dimensionedScalar("E", kDimensions_, E),
127             zeroGradientFvPatchScalarField::typeName
128         )
129     );
131     tresult().correctBoundaryConditions();
132     return tresult;
136 Foam::tmp<Foam::volScalarField> Foam::PronyViscoelastic::nu(scalar t) const
138     tmp<volScalarField> tresult
139     (
140         new volScalarField
141         (
142             IOobject
143             (
144                 "nu",
145                 mesh().time().timeName(),
146                 mesh(),
147                 IOobject::NO_READ,
148                 IOobject::NO_WRITE
149             ),
150             mesh(),
151             nu_,
152             zeroGradientFvPatchScalarField::typeName
153         )
154     );
156     tresult().correctBoundaryConditions();
157     return tresult;
161 Foam::tmp<Foam::volScalarField> Foam::PronyViscoelastic::J(scalar t) const
163     notImplemented(type() + "::J(scalar t)");
165     return 1.0/E(t);
169 // ************************************************************************* //