cyclicFvPatchField.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 "cyclicFvPatchField.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 template<class Type>
00037 cyclicFvPatchField<Type>::cyclicFvPatchField
00038 (
00039 const fvPatch& p,
00040 const DimensionedField<Type, volMesh>& iF
00041 )
00042 :
00043 coupledFvPatchField<Type>(p, iF),
00044 cyclicPatch_(refCast<const cyclicFvPatch>(p))
00045 {}
00046
00047
00048 template<class Type>
00049 cyclicFvPatchField<Type>::cyclicFvPatchField
00050 (
00051 const cyclicFvPatchField<Type>& ptf,
00052 const fvPatch& p,
00053 const DimensionedField<Type, volMesh>& iF,
00054 const fvPatchFieldMapper& mapper
00055 )
00056 :
00057 coupledFvPatchField<Type>(ptf, p, iF, mapper),
00058 cyclicPatch_(refCast<const cyclicFvPatch>(p))
00059 {
00060 if (!isType<cyclicFvPatch>(this->patch()))
00061 {
00062 FatalErrorIn
00063 (
00064 "cyclicFvPatchField<Type>::cyclicFvPatchField\n"
00065 "(\n"
00066 " const cyclicFvPatchField<Type>& ptf,\n"
00067 " const fvPatch& p,\n"
00068 " const DimensionedField<Type, volMesh>& iF,\n"
00069 " const fvPatchFieldMapper& mapper\n"
00070 ")\n"
00071 ) << "\n patch type '" << p.type()
00072 << "' not constraint type '" << typeName << "'"
00073 << "\n for patch " << p.name()
00074 << " of field " << this->dimensionedInternalField().name()
00075 << " in file " << this->dimensionedInternalField().objectPath()
00076 << exit(FatalIOError);
00077 }
00078 }
00079
00080
00081 template<class Type>
00082 cyclicFvPatchField<Type>::cyclicFvPatchField
00083 (
00084 const fvPatch& p,
00085 const DimensionedField<Type, volMesh>& iF,
00086 const dictionary& dict
00087 )
00088 :
00089 coupledFvPatchField<Type>(p, iF, dict),
00090 cyclicPatch_(refCast<const cyclicFvPatch>(p))
00091 {
00092 if (!isType<cyclicFvPatch>(p))
00093 {
00094 FatalIOErrorIn
00095 (
00096 "cyclicFvPatchField<Type>::cyclicFvPatchField\n"
00097 "(\n"
00098 " const fvPatch& p,\n"
00099 " const Field<Type>& field,\n"
00100 " const dictionary& dict\n"
00101 ")\n",
00102 dict
00103 ) << "\n patch type '" << p.type()
00104 << "' not constraint type '" << typeName << "'"
00105 << "\n for patch " << p.name()
00106 << " of field " << this->dimensionedInternalField().name()
00107 << " in file " << this->dimensionedInternalField().objectPath()
00108 << exit(FatalIOError);
00109 }
00110
00111 this->evaluate(Pstream::blocking);
00112 }
00113
00114
00115 template<class Type>
00116 cyclicFvPatchField<Type>::cyclicFvPatchField
00117 (
00118 const cyclicFvPatchField<Type>& ptf
00119 )
00120 :
00121 cyclicLduInterfaceField(),
00122 coupledFvPatchField<Type>(ptf),
00123 cyclicPatch_(ptf.cyclicPatch_)
00124 {}
00125
00126
00127 template<class Type>
00128 cyclicFvPatchField<Type>::cyclicFvPatchField
00129 (
00130 const cyclicFvPatchField<Type>& ptf,
00131 const DimensionedField<Type, volMesh>& iF
00132 )
00133 :
00134 coupledFvPatchField<Type>(ptf, iF),
00135 cyclicPatch_(ptf.cyclicPatch_)
00136 {}
00137
00138
00139
00140
00141 template<class Type>
00142 tmp<Field<Type> > cyclicFvPatchField<Type>::patchNeighbourField() const
00143 {
00144 const Field<Type>& iField = this->internalField();
00145 const unallocLabelList& faceCells = cyclicPatch_.faceCells();
00146
00147 tmp<Field<Type> > tpnf(new Field<Type>(this->size()));
00148 Field<Type>& pnf = tpnf();
00149
00150 label sizeby2 = this->size()/2;
00151
00152 if (doTransform())
00153 {
00154 for (label facei=0; facei<sizeby2; facei++)
00155 {
00156 pnf[facei] = transform
00157 (
00158 forwardT()[0], iField[faceCells[facei + sizeby2]]
00159 );
00160
00161 pnf[facei + sizeby2] = transform
00162 (
00163 reverseT()[0], iField[faceCells[facei]]
00164 );
00165 }
00166 }
00167 else
00168 {
00169 for (label facei=0; facei<sizeby2; facei++)
00170 {
00171 pnf[facei] = iField[faceCells[facei + sizeby2]];
00172 pnf[facei + sizeby2] = iField[faceCells[facei]];
00173 }
00174 }
00175
00176 return tpnf;
00177 }
00178
00179
00180 template<class Type>
00181 void cyclicFvPatchField<Type>::updateInterfaceMatrix
00182 (
00183 const scalarField& psiInternal,
00184 scalarField& result,
00185 const lduMatrix&,
00186 const scalarField& coeffs,
00187 const direction cmpt,
00188 const Pstream::commsTypes
00189 ) const
00190 {
00191 scalarField pnf(this->size());
00192
00193 label sizeby2 = this->size()/2;
00194 const unallocLabelList& faceCells = cyclicPatch_.faceCells();
00195
00196 for (label facei=0; facei<sizeby2; facei++)
00197 {
00198 pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
00199 pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
00200 }
00201
00202
00203 transformCoupleField(pnf, cmpt);
00204
00205
00206 forAll(faceCells, elemI)
00207 {
00208 result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
00209 }
00210 }
00211
00212
00213
00214
00215 }
00216
00217
Copyright © 2000-2009 OpenCFD Ltd