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 #include <finiteVolume/jumpCyclicFvPatchField.H>
00027
00028
00029
00030 namespace Foam
00031 {
00032
00033
00034
00035 template<class Type>
00036 jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
00037 (
00038 const fvPatch& p,
00039 const DimensionedField<Type, volMesh>& iF
00040 )
00041 :
00042 cyclicFvPatchField<Type>(p, iF)
00043 {}
00044
00045
00046 template<class Type>
00047 jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
00048 (
00049 const jumpCyclicFvPatchField<Type>& ptf,
00050 const fvPatch& p,
00051 const DimensionedField<Type, volMesh>& iF,
00052 const fvPatchFieldMapper& mapper
00053 )
00054 :
00055 cyclicFvPatchField<Type>(ptf, p, iF, mapper)
00056 {}
00057
00058
00059 template<class Type>
00060 jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
00061 (
00062 const fvPatch& p,
00063 const DimensionedField<Type, volMesh>& iF,
00064 const dictionary& dict
00065 )
00066 :
00067 cyclicFvPatchField<Type>(p, iF, dict)
00068 {
00069
00070
00071 }
00072
00073
00074 template<class Type>
00075 jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
00076 (
00077 const jumpCyclicFvPatchField<Type>& ptf
00078 )
00079 :
00080 cyclicLduInterfaceField(),
00081 cyclicFvPatchField<Type>(ptf)
00082 {}
00083
00084
00085 template<class Type>
00086 jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
00087 (
00088 const jumpCyclicFvPatchField<Type>& ptf,
00089 const DimensionedField<Type, volMesh>& iF
00090 )
00091 :
00092 cyclicFvPatchField<Type>(ptf, iF)
00093 {}
00094
00095
00096
00097
00098 template<class Type>
00099 tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
00100 {
00101 const Field<Type>& iField = this->internalField();
00102 const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
00103
00104 tmp<Field<Type> > tpnf(new Field<Type>(this->size()));
00105 Field<Type>& pnf = tpnf();
00106
00107 tmp<Field<scalar> > tjf = jump();
00108 const Field<scalar>& jf = tjf();
00109
00110 label sizeby2 = this->size()/2;
00111
00112 if (this->doTransform())
00113 {
00114 for (label facei=0; facei<sizeby2; facei++)
00115 {
00116 pnf[facei] = transform
00117 (
00118 this->forwardT()[0], iField[faceCells[facei + sizeby2]]
00119 ) - jf[facei];
00120
00121 pnf[facei + sizeby2] = transform
00122 (
00123 this->reverseT()[0], iField[faceCells[facei]] + jf[facei]
00124 );
00125 }
00126 }
00127 else
00128 {
00129 for (label facei=0; facei<sizeby2; facei++)
00130 {
00131 pnf[facei] = iField[faceCells[facei + sizeby2]] - jf[facei];
00132 pnf[facei + sizeby2] = iField[faceCells[facei]] + jf[facei];
00133 }
00134 }
00135
00136 return tpnf;
00137 }
00138
00139
00140 template<class Type>
00141 void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
00142 (
00143 const scalarField& psiInternal,
00144 scalarField& result,
00145 const lduMatrix&,
00146 const scalarField& coeffs,
00147 const direction cmpt,
00148 const Pstream::commsTypes
00149 ) const
00150 {
00151 scalarField pnf(this->size());
00152
00153 label sizeby2 = this->size()/2;
00154 const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
00155
00156 if (&psiInternal == &this->internalField())
00157 {
00158 tmp<Field<scalar> > tjf = jump();
00159 const Field<scalar>& jf = tjf();
00160
00161 for (label facei=0; facei<sizeby2; facei++)
00162 {
00163 pnf[facei] = psiInternal[faceCells[facei + sizeby2]] - jf[facei];
00164 pnf[facei + sizeby2] = psiInternal[faceCells[facei]] + jf[facei];
00165 }
00166 }
00167 else
00168 {
00169 for (label facei=0; facei<sizeby2; facei++)
00170 {
00171 pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
00172 pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
00173 }
00174 }
00175
00176
00177 this->transformCoupleField(pnf, cmpt);
00178
00179
00180 forAll(faceCells, elemI)
00181 {
00182 result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
00183 }
00184 }
00185
00186
00187
00188
00189 }
00190
00191