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