1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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 the
13 Free Software Foundation; either version 3 of the License, or (at your
14 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*----------------------------------------------------------------------------*/
27 #include "actuationDiskSource.H"
29 #include "fvMatrices.H"
30 #include "geometricOneField.H"
31 #include "addToRunTimeSelectionTable.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(actuationDiskSource, 0);
38 addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
42 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 void Foam::actuationDiskSource::checkData() const
46 if (magSqr(diskArea_) <= VSMALL)
48 FatalErrorIn("Foam::actuationDiskSource::checkData()")
49 << "diskArea is approximately zero"
50 << exit(FatalIOError);
52 if (Cp_ <= VSMALL || Ct_ <= VSMALL)
54 FatalErrorIn("Foam::actuationDiskSource::checkData()")
55 << "Cp and Ct must be greater than zero"
56 << exit(FatalIOError);
58 if (mag(diskDir_) < VSMALL)
60 FatalErrorIn("Foam::actuationDiskSource::checkData()")
61 << "disk direction vector is approximately zero"
62 << exit(FatalIOError);
67 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69 Foam::actuationDiskSource::actuationDiskSource
72 const word& modelType,
73 const dictionary& dict,
77 basicSource(name, modelType, dict, mesh),
78 dict_(dict.subDict(modelType + "Coeffs")),
79 diskDir_(dict_.lookup("diskDir")),
80 Cp_(readScalar(dict_.lookup("Cp"))),
81 Ct_(readScalar(dict_.lookup("Ct"))),
82 diskArea_(readScalar(dict_.lookup("diskArea")))
84 Info<< " - creating actuation disk zone: "
85 << this->name() << endl;
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
95 bool compressible = false;
96 if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
101 const scalarField& cellsV = this->mesh().V();
102 vectorField& Usource = UEqn.source();
103 const vectorField& U = UEqn.psi();
109 addActuationDiskAxialInertialResistance
114 this->mesh().lookupObject<volScalarField>("rho"),
120 addActuationDiskAxialInertialResistance
133 void Foam::actuationDiskSource::writeData(Ostream& os) const
135 os << indent << token::BEGIN_BLOCK << incrIndent << nl;
136 os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
138 if (dict_.found("note"))
140 os.writeKeyword("note") << string(dict_.lookup("note"))
141 << token::END_STATEMENT << nl;
144 os << indent << "actuationDisk";
148 os << decrIndent << indent << token::END_BLOCK << endl;
152 bool Foam::actuationDiskSource::read(const dictionary& dict)
154 if (basicSource::read(dict))
156 const dictionary& sourceDict = dict.subDict(name());
157 const dictionary& subDictCoeffs =
158 sourceDict.subDict(typeName + "Coeffs");
159 subDictCoeffs.readIfPresent("diskDir", diskDir_);
160 subDictCoeffs.readIfPresent("Cp", Cp_);
161 subDictCoeffs.readIfPresent("Ct", Ct_);
162 subDictCoeffs.readIfPresent("diskArea", diskArea_);
175 // ************************************************************************* //