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 "processorFvPatchField.H"
00028 #include "processorFvPatch.H"
00029 #include "IPstream.H"
00030 #include "OPstream.H"
00031 #include "demandDrivenData.H"
00032 #include "transformField.H"
00033
00034
00035
00036 namespace Foam
00037 {
00038
00039
00040
00041 template<class Type>
00042 processorFvPatchField<Type>::processorFvPatchField
00043 (
00044 const fvPatch& p,
00045 const DimensionedField<Type, volMesh>& iF
00046 )
00047 :
00048 coupledFvPatchField<Type>(p, iF),
00049 procPatch_(refCast<const processorFvPatch>(p))
00050 {}
00051
00052
00053 template<class Type>
00054 processorFvPatchField<Type>::processorFvPatchField
00055 (
00056 const fvPatch& p,
00057 const DimensionedField<Type, volMesh>& iF,
00058 const Field<Type>& f
00059 )
00060 :
00061 coupledFvPatchField<Type>(p, iF, f),
00062 procPatch_(refCast<const processorFvPatch>(p))
00063 {}
00064
00065
00066
00067 template<class Type>
00068 processorFvPatchField<Type>::processorFvPatchField
00069 (
00070 const processorFvPatchField<Type>& ptf,
00071 const fvPatch& p,
00072 const DimensionedField<Type, volMesh>& iF,
00073 const fvPatchFieldMapper& mapper
00074 )
00075 :
00076 coupledFvPatchField<Type>(ptf, p, iF, mapper),
00077 procPatch_(refCast<const processorFvPatch>(p))
00078 {
00079 if (!isType<processorFvPatch>(this->patch()))
00080 {
00081 FatalErrorIn
00082 (
00083 "processorFvPatchField<Type>::processorFvPatchField\n"
00084 "(\n"
00085 " const processorFvPatchField<Type>& ptf,\n"
00086 " const fvPatch& p,\n"
00087 " const DimensionedField<Type, volMesh>& iF,\n"
00088 " const fvPatchFieldMapper& mapper\n"
00089 ")\n"
00090 ) << "\n patch type '" << p.type()
00091 << "' not constraint type '" << typeName << "'"
00092 << "\n for patch " << p.name()
00093 << " of field " << this->dimensionedInternalField().name()
00094 << " in file " << this->dimensionedInternalField().objectPath()
00095 << exit(FatalIOError);
00096 }
00097 }
00098
00099
00100 template<class Type>
00101 processorFvPatchField<Type>::processorFvPatchField
00102 (
00103 const fvPatch& p,
00104 const DimensionedField<Type, volMesh>& iF,
00105 const dictionary& dict
00106 )
00107 :
00108 coupledFvPatchField<Type>(p, iF, dict),
00109 procPatch_(refCast<const processorFvPatch>(p))
00110 {
00111 if (!isType<processorFvPatch>(p))
00112 {
00113 FatalIOErrorIn
00114 (
00115 "processorFvPatchField<Type>::processorFvPatchField\n"
00116 "(\n"
00117 " const fvPatch& p,\n"
00118 " const Field<Type>& field,\n"
00119 " const dictionary& dict\n"
00120 ")\n",
00121 dict
00122 ) << "\n patch type '" << p.type()
00123 << "' not constraint type '" << typeName << "'"
00124 << "\n for patch " << p.name()
00125 << " of field " << this->dimensionedInternalField().name()
00126 << " in file " << this->dimensionedInternalField().objectPath()
00127 << exit(FatalIOError);
00128 }
00129 }
00130
00131
00132 template<class Type>
00133 processorFvPatchField<Type>::processorFvPatchField
00134 (
00135 const processorFvPatchField<Type>& ptf
00136 )
00137 :
00138 processorLduInterfaceField(),
00139 coupledFvPatchField<Type>(ptf),
00140 procPatch_(refCast<const processorFvPatch>(ptf.patch()))
00141 {}
00142
00143
00144 template<class Type>
00145 processorFvPatchField<Type>::processorFvPatchField
00146 (
00147 const processorFvPatchField<Type>& ptf,
00148 const DimensionedField<Type, volMesh>& iF
00149 )
00150 :
00151 coupledFvPatchField<Type>(ptf, iF),
00152 procPatch_(refCast<const processorFvPatch>(ptf.patch()))
00153 {}
00154
00155
00156
00157
00158 template<class Type>
00159 processorFvPatchField<Type>::~processorFvPatchField()
00160 {}
00161
00162
00163
00164
00165 template<class Type>
00166 tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
00167 {
00168 return *this;
00169 }
00170
00171
00172 template<class Type>
00173 void processorFvPatchField<Type>::initEvaluate
00174 (
00175 const Pstream::commsTypes commsType
00176 )
00177 {
00178 if (Pstream::parRun())
00179 {
00180 procPatch_.compressedSend(commsType, this->patchInternalField()());
00181 }
00182 }
00183
00184
00185 template<class Type>
00186 void processorFvPatchField<Type>::evaluate
00187 (
00188 const Pstream::commsTypes commsType
00189 )
00190 {
00191 if (Pstream::parRun())
00192 {
00193 procPatch_.compressedReceive<Type>(commsType, *this);
00194
00195 if (doTransform())
00196 {
00197 transform(*this, procPatch_.forwardT(), *this);
00198 }
00199 }
00200 }
00201
00202
00203 template<class Type>
00204 tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
00205 {
00206 return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
00207 }
00208
00209
00210 template<class Type>
00211 void processorFvPatchField<Type>::initInterfaceMatrixUpdate
00212 (
00213 const scalarField& psiInternal,
00214 scalarField&,
00215 const lduMatrix&,
00216 const scalarField&,
00217 const direction,
00218 const Pstream::commsTypes commsType
00219 ) const
00220 {
00221 procPatch_.compressedSend
00222 (
00223 commsType,
00224 this->patch().patchInternalField(psiInternal)()
00225 );
00226 }
00227
00228
00229 template<class Type>
00230 void processorFvPatchField<Type>::updateInterfaceMatrix
00231 (
00232 const scalarField&,
00233 scalarField& result,
00234 const lduMatrix&,
00235 const scalarField& coeffs,
00236 const direction cmpt,
00237 const Pstream::commsTypes commsType
00238 ) const
00239 {
00240 scalarField pnf
00241 (
00242 procPatch_.compressedReceive<scalar>(commsType, this->size())()
00243 );
00244
00245
00246 transformCoupleField(pnf, cmpt);
00247
00248
00249
00250 const unallocLabelList& faceCells = this->patch().faceCells();
00251
00252 forAll(faceCells, elemI)
00253 {
00254 result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
00255 }
00256 }
00257
00258
00259
00260
00261 }
00262
00263