clippedLinear.H
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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef clippedLinear_H
00038 #define clippedLinear_H
00039
00040 #include "surfaceInterpolationScheme.H"
00041 #include "volFields.H"
00042
00043
00044
00045 namespace Foam
00046 {
00047
00048
00049
00050
00051
00052 template<class Type>
00053 class clippedLinear
00054 :
00055 public surfaceInterpolationScheme<Type>
00056 {
00057
00058
00059 const scalar cellSizeRatio_;
00060 scalar wfLimit_;
00061
00062
00063
00064
00065 void calcWfLimit()
00066 {
00067 if (cellSizeRatio_ <= 0 || cellSizeRatio_ > 1)
00068 {
00069 FatalErrorIn("clippedLinear::calcWfLimit()")
00070 << "Given cellSizeRatio of " << cellSizeRatio_
00071 << " is not between 0 and 1"
00072 << exit(FatalError);
00073 }
00074
00075 wfLimit_ = cellSizeRatio_/(1.0 + cellSizeRatio_);
00076 }
00077
00078
00079
00080 void operator=(const clippedLinear&);
00081
00082
00083 public:
00084
00085
00086 TypeName("clippedLinear");
00087
00088
00089
00090
00091
00092 clippedLinear(const fvMesh& mesh, const scalar cellSizeRatio)
00093 :
00094 surfaceInterpolationScheme<Type>(mesh),
00095 cellSizeRatio_(cellSizeRatio)
00096 {
00097 calcWfLimit();
00098 }
00099
00100
00101 clippedLinear(const fvMesh& mesh, Istream& is)
00102 :
00103 surfaceInterpolationScheme<Type>(mesh),
00104 cellSizeRatio_(readScalar(is))
00105 {
00106 calcWfLimit();
00107 }
00108
00109
00110 clippedLinear
00111 (
00112 const fvMesh& mesh,
00113 const surfaceScalarField&,
00114 Istream& is
00115 )
00116 :
00117 surfaceInterpolationScheme<Type>(mesh),
00118 cellSizeRatio_(readScalar(is))
00119 {
00120 calcWfLimit();
00121 }
00122
00123
00124
00125
00126
00127 tmp<surfaceScalarField> weights
00128 (
00129 const GeometricField<Type, fvPatchField, volMesh>&
00130 ) const
00131 {
00132 const fvMesh& mesh = this->mesh();
00133
00134 tmp<surfaceScalarField> tcdWeights
00135 (
00136 mesh.surfaceInterpolation::weights()
00137 );
00138 const surfaceScalarField& cdWeights = tcdWeights();
00139
00140 tmp<surfaceScalarField> tclippedLinearWeights
00141 (
00142 new surfaceScalarField
00143 (
00144 IOobject
00145 (
00146 "clippedLinearWeights",
00147 mesh.time().timeName(),
00148 mesh
00149 ),
00150 mesh,
00151 dimless
00152 )
00153 );
00154 surfaceScalarField& clippedLinearWeights = tclippedLinearWeights();
00155
00156 clippedLinearWeights.internalField() =
00157 max(min(cdWeights.internalField(), 1 - wfLimit_), wfLimit_);
00158
00159 forAll (mesh.boundary(), patchi)
00160 {
00161 if (mesh.boundary()[patchi].coupled())
00162 {
00163 clippedLinearWeights.boundaryField()[patchi] =
00164 max
00165 (
00166 min
00167 (
00168 cdWeights.boundaryField()[patchi],
00169 1 - wfLimit_
00170 ),
00171 wfLimit_
00172 );
00173 }
00174 else
00175 {
00176 clippedLinearWeights.boundaryField()[patchi] =
00177 cdWeights.boundaryField()[patchi];
00178 }
00179 }
00180
00181 return tclippedLinearWeights;
00182 }
00183 };
00184
00185
00186
00187
00188 }
00189
00190
00191
00192 #endif
00193
00194
Copyright © 2000-2009 OpenCFD Ltd