Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "actuationDiskSource.H"
00028 #include <finiteVolume/fvMesh.H>
00029 #include <finiteVolume/fvMatrices.H>
00030 #include <OpenFOAM/geometricOneField.H>
00031 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00032
00033
00034
00035 namespace Foam
00036 {
00037 defineTypeNameAndDebug(actuationDiskSource, 0);
00038 addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
00039 }
00040
00041
00042
00043
00044 void Foam::actuationDiskSource::checkData()
00045 {
00046 if (magSqr(diskArea_) <= VSMALL)
00047 {
00048 FatalErrorIn("Foam::actuationDiskSource::checkData()")
00049 << "diskArea is approximately zero"
00050 << exit(FatalIOError);
00051 }
00052 if (Cp_ <= VSMALL || Ct_ <= VSMALL)
00053 {
00054 FatalErrorIn("Foam::actuationDiskSource::checkData()")
00055 << "Cp and Ct must be greater than zero"
00056 << exit(FatalIOError);
00057 }
00058 if (mag(diskDir_) < VSMALL)
00059 {
00060 FatalErrorIn("Foam::actuationDiskSource::checkData()")
00061 << "disk direction vector is approximately zero"
00062 << exit(FatalIOError);
00063 }
00064 }
00065
00066
00067
00068
00069 Foam::actuationDiskSource::actuationDiskSource
00070 (
00071 const word& name,
00072 const dictionary& dict,
00073 const fvMesh& mesh
00074 )
00075 :
00076 basicSource(name, dict, mesh),
00077 cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
00078 dict_(dict.subDict(typeName + "Coeffs")),
00079 diskDir_(dict_.lookup("diskDir")),
00080 Cp_(readScalar(dict_.lookup("Cp"))),
00081 Ct_(readScalar(dict_.lookup("Ct"))),
00082 diskArea_(readScalar(dict_.lookup("diskArea")))
00083 {
00084 Info<< " - creating actuation disk zone: "
00085 << this->name() << endl;
00086
00087 bool foundZone = (cellZoneID_ != -1);
00088
00089 reduce(foundZone, orOp<bool>());
00090
00091 if (!foundZone && Pstream::master())
00092 {
00093 FatalErrorIn
00094 (
00095 "Foam::actuationDiskSource::actuationDiskSource"
00096 "(const word&, const dictionary&, const fvMesh&)"
00097 ) << "cannot find porous cellZone " << this->name()
00098 << exit(FatalError);
00099 }
00100
00101 checkData();
00102 }
00103
00104
00105
00106
00107 void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
00108 {
00109 if (cellZoneID_ == -1)
00110 {
00111 return;
00112 }
00113
00114 bool compressible = false;
00115 if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
00116 {
00117 compressible = true;
00118 }
00119
00120 const labelList& cells = mesh_.cellZones()[cellZoneID_];
00121 const scalarField& V = this->mesh().V();
00122 vectorField& Usource = UEqn.source();
00123 const vectorField& U = UEqn.psi();
00124
00125 if (compressible)
00126 {
00127 addActuationDiskAxialInertialResistance
00128 (
00129 Usource,
00130 cells,
00131 V,
00132 this->mesh().lookupObject<volScalarField>("rho"),
00133 U
00134 );
00135 }
00136 else
00137 {
00138 addActuationDiskAxialInertialResistance
00139 (
00140 Usource,
00141 cells,
00142 V,
00143 geometricOneField(),
00144 U
00145 );
00146 }
00147 }
00148
00149
00150 void Foam::actuationDiskSource::writeData(Ostream& os) const
00151 {
00152
00153 os << indent << token::BEGIN_BLOCK << incrIndent << nl;
00154 os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
00155
00156 if (dict_.found("note"))
00157 {
00158 os.writeKeyword("note") << string(dict_.lookup("note"))
00159 << token::END_STATEMENT << nl;
00160 }
00161
00162 os << indent << "actuationDisk";
00163
00164 dict_.write(os);
00165
00166 os << decrIndent << indent << token::END_BLOCK << endl;
00167 }
00168
00169
00170 bool Foam::actuationDiskSource::read(const dictionary& dict)
00171 {
00172 if (basicSource::read(dict))
00173 {
00174 const dictionary& sourceDict = dict.subDict(name());
00175 const dictionary& subDictCoeffs =
00176 sourceDict.subDict(typeName + "Coeffs");
00177 subDictCoeffs.readIfPresent("diskDir", diskDir_);
00178 subDictCoeffs.readIfPresent("Cp", Cp_);
00179 subDictCoeffs.readIfPresent("Ct", Ct_);
00180 subDictCoeffs.readIfPresent("diskArea", diskArea_);
00181
00182 checkData();
00183
00184 return true;
00185 }
00186 else
00187 {
00188 return false;
00189 }
00190 }
00191
00192
00193