ddtScheme.C
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 "fv.H"
00028 #include "HashTable.H"
00029 #include "surfaceInterpolate.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 namespace fv
00039 {
00040
00041
00042
00043 template<class Type>
00044 tmp<ddtScheme<Type> > ddtScheme<Type>::New
00045 (
00046 const fvMesh& mesh,
00047 Istream& schemeData
00048 )
00049 {
00050 if (fv::debug)
00051 {
00052 Info<< "ddtScheme<Type>::New(const fvMesh&, Istream&) : "
00053 "constructing ddtScheme<Type>"
00054 << endl;
00055 }
00056
00057 if (schemeData.eof())
00058 {
00059 FatalIOErrorIn
00060 (
00061 "ddtScheme<Type>::New(const fvMesh&, Istream&)",
00062 schemeData
00063 ) << "Ddt scheme not specified" << endl << endl
00064 << "Valid ddt schemes are :" << endl
00065 << IstreamConstructorTablePtr_->toc()
00066 << exit(FatalIOError);
00067 }
00068
00069 word schemeName(schemeData);
00070
00071 typename IstreamConstructorTable::iterator cstrIter =
00072 IstreamConstructorTablePtr_->find(schemeName);
00073
00074 if (cstrIter == IstreamConstructorTablePtr_->end())
00075 {
00076 FatalIOErrorIn
00077 (
00078 "ddtScheme<Type>::New(const fvMesh&, Istream&)",
00079 schemeData
00080 ) << "unknown ddt scheme " << schemeName << endl << endl
00081 << "Valid ddt schemes are :" << endl
00082 << IstreamConstructorTablePtr_->toc()
00083 << exit(FatalIOError);
00084 }
00085
00086 return cstrIter()(mesh, schemeData);
00087 }
00088
00089
00090
00091
00092 template<class Type>
00093 ddtScheme<Type>::~ddtScheme()
00094 {}
00095
00096
00097
00098
00099 template<class Type>
00100 tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
00101 (
00102 const GeometricField<Type, fvPatchField, volMesh>& U,
00103 const fluxFieldType& phi,
00104 const fluxFieldType& phiCorr
00105 )
00106 {
00107 tmp<surfaceScalarField> tddtCouplingCoeff = scalar(1)
00108 - min
00109 (
00110 mag(phiCorr)
00111 /(mag(phi) + dimensionedScalar("small", phi.dimensions(), SMALL)),
00112 scalar(1)
00113 );
00114
00115 surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff();
00116
00117 forAll (U.boundaryField(), patchi)
00118 {
00119 if (U.boundaryField()[patchi].fixesValue())
00120 {
00121 ddtCouplingCoeff.boundaryField()[patchi] = 0.0;
00122 }
00123 }
00124
00125 if (debug > 1)
00126 {
00127 Info<< "ddtCouplingCoeff mean max min = "
00128 << gAverage(ddtCouplingCoeff.internalField())
00129 << " " << gMax(ddtCouplingCoeff.internalField())
00130 << " " << gMin(ddtCouplingCoeff.internalField())
00131 << endl;
00132 }
00133
00134 return tddtCouplingCoeff;
00135 }
00136
00137
00138 template<class Type>
00139 tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
00140 (
00141 const GeometricField<Type, fvPatchField, volMesh>& U,
00142 const fluxFieldType& phi
00143 )
00144 {
00145 dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
00146
00147 tmp<surfaceScalarField> tddtCouplingCoeff = scalar(1)
00148 - min
00149 (
00150 mag(phi - (mesh().Sf() & fvc::interpolate(U)))
00151 /(mag(phi) + dimensionedScalar("small", phi.dimensions(), VSMALL)),
00152
00153 scalar(1)
00154 );
00155
00156 surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff();
00157
00158 forAll (U.boundaryField(), patchi)
00159 {
00160 if (U.boundaryField()[patchi].fixesValue())
00161 {
00162 ddtCouplingCoeff.boundaryField()[patchi] = 0.0;
00163 }
00164 }
00165
00166 if (debug > 1)
00167 {
00168 Info<< "ddtCouplingCoeff mean max min = "
00169 << gAverage(ddtCouplingCoeff.internalField())
00170 << " " << gMax(ddtCouplingCoeff.internalField())
00171 << " " << gMin(ddtCouplingCoeff.internalField())
00172 << endl;
00173 }
00174
00175 return tddtCouplingCoeff;
00176 }
00177
00178
00179 template<class Type>
00180 tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff
00181 (
00182 const volScalarField& rho,
00183 const GeometricField<Type, fvPatchField, volMesh>& rhoU,
00184 const fluxFieldType& phi
00185 )
00186 {
00187 dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
00188
00189 tmp<surfaceScalarField> tddtCouplingCoeff = scalar(1)
00190 - min
00191 (
00192 mag(phi - (mesh().Sf() & fvc::interpolate(rhoU)))
00193 /(
00194 mag(phi) + dimensionedScalar("small", phi.dimensions(), VSMALL)
00195
00196
00197 ),
00198 scalar(1)
00199 );
00200
00201 surfaceScalarField& ddtCouplingCoeff = tddtCouplingCoeff();
00202
00203 forAll (rhoU.boundaryField(), patchi)
00204 {
00205 if (rhoU.boundaryField()[patchi].fixesValue())
00206 {
00207 ddtCouplingCoeff.boundaryField()[patchi] = 0.0;
00208 }
00209 }
00210
00211 if (debug > 1)
00212 {
00213 Info<< "ddtCouplingCoeff mean max min = "
00214 << gAverage(ddtCouplingCoeff.internalField())
00215 << " " << gMax(ddtCouplingCoeff.internalField())
00216 << " " << gMin(ddtCouplingCoeff.internalField())
00217 << endl;
00218 }
00219
00220 return tddtCouplingCoeff;
00221 }
00222
00223
00224
00225
00226 }
00227
00228
00229
00230 }
00231
00232
Copyright © 2000-2009 OpenCFD Ltd