Forward compatibility: flex
[foam-extend-3.2.git] / src / transportModels / interfaceProperties / alphaContactAngle / timeVaryingAlphaContactAngle / timeVaryingAlphaContactAngleFvPatchScalarField.C
blobc658648204186dcc0bd4db513bcca8b7ce59561b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
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 \*---------------------------------------------------------------------------*/
26 #include "fvPatchFields.H"
27 #include "timeVaryingAlphaContactAngleFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volMesh.H"
30 #include "foamTime.H"
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
35 timeVaryingAlphaContactAngleFvPatchScalarField
37     const fvPatch& p,
38     const DimensionedField<scalar, volMesh>& iF
41     alphaContactAngleFvPatchScalarField(p, iF),
42     t0_(0.0),
43     thetaT0_(0.0),
44     te_(0.0),
45     thetaTe_(0.0)
49 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
50 timeVaryingAlphaContactAngleFvPatchScalarField
52     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
53     const fvPatch& p,
54     const DimensionedField<scalar, volMesh>& iF,
55     const fvPatchFieldMapper& mapper
58     alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper),
59     t0_(gcpsf.t0_),
60     thetaT0_(gcpsf.thetaT0_),
61     te_(gcpsf.te_),
62     thetaTe_(gcpsf.te_)
66 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
67 timeVaryingAlphaContactAngleFvPatchScalarField
69     const fvPatch& p,
70     const DimensionedField<scalar, volMesh>& iF,
71     const dictionary& dict
74     alphaContactAngleFvPatchScalarField(p, iF),
75     t0_(readScalar(dict.lookup("t0"))),
76     thetaT0_(readScalar(dict.lookup("thetaT0"))),
77     te_(readScalar(dict.lookup("te"))),
78     thetaTe_(readScalar(dict.lookup("thetaTe")))
80     evaluate();
84 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
85 timeVaryingAlphaContactAngleFvPatchScalarField
87     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
88     const DimensionedField<scalar, volMesh>& iF
91     alphaContactAngleFvPatchScalarField(gcpsf, iF),
92     t0_(gcpsf.t0_),
93     thetaT0_(gcpsf.thetaT0_),
94     te_(gcpsf.te_),
95     thetaTe_(gcpsf.thetaTe_)
99 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
101 Foam::tmp<Foam::scalarField>
102 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::theta
104     const fvPatchVectorField&,
105     const fvsPatchVectorField&
106 ) const
108     scalar t = patch().boundaryMesh().mesh().time().value();
109     scalar theta0 = thetaT0_;
111     if (t < t0_)
112     {
113         theta0 = thetaT0_;
114     }
115     else if (t > te_)
116     {
117         theta0 = thetaTe_;
118     }
119     else
120     {
121         theta0 = thetaT0_ + (t - t0_)*(thetaTe_ - thetaT0_)/(te_ - t0_);
122     }
124     return tmp<scalarField>(new scalarField(size(), theta0));
128 void Foam::timeVaryingAlphaContactAngleFvPatchScalarField::write
130     Ostream& os
131 ) const
133     fvPatchScalarField::write(os);
134     os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
135     os.writeKeyword("thetaT0") << thetaT0_ << token::END_STATEMENT << nl;
136     os.writeKeyword("te") << te_ << token::END_STATEMENT << nl;
137     os.writeKeyword("thetaTe") << thetaTe_ << token::END_STATEMENT << nl;
138     writeEntry("value", os);
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 namespace Foam
146     makePatchTypeField
147     (
148         fvPatchScalarField,
149         timeVaryingAlphaContactAngleFvPatchScalarField
150     );
153 // ************************************************************************* //