diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.C index 37af5d7b35ecc309a729015aed3c8e58011d0a15..ab9a9e1fb9315a189d2680fcc196de17c6a4b2b9 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.C @@ -174,6 +174,8 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix ( solveScalarField& result, const bool add, + const lduAddressing& lduAddr, + const label patchId, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -188,7 +190,7 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix // solver PBiCCCG; //PBiCGStab; const labelUList& nbrFaceCells = - cyclicPeriodicAMIPatch_.neighbPatch().faceCells(); + lduAddr.patchAddr(cyclicPeriodicAMIPatch_.neighbPatchID()); solveScalarField pnf(psiInternal, nbrFaceCells); @@ -204,9 +206,11 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix // Transform according to the transformation tensors this->transformCoupleField(pnf, cmpt); + const labelUList& faceCells = lduAddr.patchAddr(patchId); + if (cyclicPeriodicAMIPatch_.applyLowWeightCorrection()) { - solveScalarField pif(psiInternal, cyclicPeriodicAMIPatch_.faceCells()); + solveScalarField pif(psiInternal, faceCells); pnf = cyclicPeriodicAMIPatch_.interpolate(pnf, pif); } else @@ -215,7 +219,7 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix } // Multiply the field by coefficients and add into the result - this->addToInternalField(result, !add, coeffs, pnf); + this->addToInternalField(result, !add, faceCells, coeffs, pnf); } @@ -224,6 +228,8 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix ( Field<Type>& result, const bool add, + const lduAddressing& lduAddr, + const label patchId, const Field<Type>& psiInternal, const scalarField& coeffs, const Pstream::commsTypes @@ -234,7 +240,7 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix // solver PBiCCCG; //PBiCGStab; const labelUList& nbrFaceCells = - cyclicPeriodicAMIPatch_.neighbPatch().faceCells(); + lduAddr.patchAddr(cyclicPeriodicAMIPatch_.neighbPatchID()); Field<Type> pnf(psiInternal, nbrFaceCells); @@ -246,12 +252,14 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix << endl; } + const labelUList& faceCells = lduAddr.patchAddr(patchId); + // Transform according to the transformation tensors this->transformCoupleField(pnf); if (cyclicPeriodicAMIPatch_.applyLowWeightCorrection()) { - Field<Type> pif(psiInternal, cyclicPeriodicAMIPatch_.faceCells()); + Field<Type> pif(psiInternal, faceCells); pnf = cyclicPeriodicAMIPatch_.interpolate(pnf, pif); } else @@ -260,7 +268,7 @@ void Foam::cyclicPeriodicAMIFvPatchField<Type>::updateInterfaceMatrix } // Multiply the field by coefficients and add into the result - this->addToInternalField(result, !add, coeffs, pnf); + this->addToInternalField(result, !add, faceCells, coeffs, pnf); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.H index f52ad4d1f12fbc20da5c8bb39d02071385a40d3d..465815c84f1d4e83497d8536ef19d6e5e5e89ce6 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatchField.H @@ -173,6 +173,8 @@ public: ( solveScalarField& result, const bool add, + const lduAddressing& lduAddr, + const label patchId, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -184,6 +186,8 @@ public: ( Field<Type>&, const bool add, + const lduAddressing& lduAddr, + const label patchId, const Field<Type>&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 6ad6ee6abcfaccc1f6677776604741d99154968a..1aa4aa9ffb68b7f2a1251e85a49ed3efc3b20b8d 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -313,10 +313,21 @@ Foam::label Foam::fvMatrix<Type>::checkImplicit(const label fieldI) { if (bpsi[patchI].useImplicit()) { + if (debug) + { + Pout<< "fvMatrix<Type>::checkImplicit " + << " fieldi:" << fieldI + << " field:" << this->psi(fieldI).name() + << " on mesh:" + << this->psi(fieldI).mesh().name() + << " patch:" << bpsi[patchI].patch().name() + << endl; + } + id += (label(2) << patchI); } } - if (id > 0) + if (id >= 0) { lduAssemblyName_ = word("lduAssembly") + name(id); useImplicit_ = true; diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index 029b0d004e7b8ff56b57a069b89c36882eb360ad..bf357b0c63c31cd0a304cafad25db60215df6bdc 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -165,8 +165,9 @@ Foam::solverPerformance Foam::fvMatrix<Foam::scalar>::solveSegregated { Info.masterStream(this->mesh().comm()) << "fvMatrix<scalar>::solveSegregated" - "(const dictionary& solverControls) : " - "solving fvMatrix<scalar>" + "(const dictionary&) : " + "solving fvMatrix<scalar> for " << psi_.name() + << " implicit:" << useImplicit_ << endl; } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.C index 1802813e41090de2b5155e3054ffecaaa7c7ac05..9086f20aa033b81eb0bf40c17b09902b472e9b9a 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.C @@ -212,6 +212,17 @@ Foam::cyclicPeriodicAMIFvPatch::interfaceInternalField } +Foam::tmp<Foam::labelField> +Foam::cyclicPeriodicAMIFvPatch::interfaceInternalField +( + const labelUList& internalData, + const labelUList& faceCells +) const +{ + return patchInternalField(internalData, faceCells); +} + + Foam::tmp<Foam::labelField> Foam::cyclicPeriodicAMIFvPatch::internalFieldTransfer ( diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.H index b1e6ea5fc54c85912e23738269aa3164149e7320..564db8eaab3cff6e7585abb719035c85b260e9c5 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicPeriodicAMI/cyclicPeriodicAMIFvPatch.H @@ -227,6 +227,14 @@ public: const labelUList& internalData ) const; + //- Return the values of the given internal data adjacent to + //- the interface as a field using a mapping faceCell + virtual tmp<labelField> interfaceInternalField + ( + const labelUList& internalData, + const labelUList& faceCells + ) const; + //- Return neighbour field virtual tmp<labelField> internalFieldTransfer ( diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.C index 76d46801c5bc2502e91666d3f65d3187bc5cd822..4af7bcb2b98d1e357cde0afb39eb23385f7ed7d2 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.C @@ -103,6 +103,8 @@ void Foam::cyclicPeriodicAMIGAMGInterfaceField::updateInterfaceMatrix ( solveScalarField& result, const bool add, + const lduAddressing& lduAddr, + const label interfacei, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt, @@ -112,13 +114,13 @@ void Foam::cyclicPeriodicAMIGAMGInterfaceField::updateInterfaceMatrix const auto& neighbPatch = cyclicPeriodicAMIInterface_.neighbPatch(); // Get neighbouring field - solveScalarField pnf - ( - neighbPatch.interfaceInternalField + const labelList& nbrFaceCells = + lduAddr.patchAddr ( - psiInternal - ) - ); + cyclicPeriodicAMIInterface_.neighbPatchID() + ); + + solveScalarField pnf(psiInternal, nbrFaceCells); // Transform according to the transformation tensors transformCoupleField(pnf, cmpt); @@ -141,7 +143,9 @@ void Foam::cyclicPeriodicAMIGAMGInterfaceField::updateInterfaceMatrix pnf = neighbPatch.AMI().interpolateToTarget(pnf); } - this->addToInternalField(result, !add, coeffs, pnf); + const labelUList& faceCells = lduAddr.patchAddr(interfacei); + + this->addToInternalField(result, !add, faceCells, coeffs, pnf); } diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.H b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.H index befed036e7ce0b7005eb1a3fc9956c27b5b27e96..d63cfbf006690b1f8a8f83486b747e00f318dafa 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.H +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicPeriodicAMIGAMGInterfaceField/cyclicPeriodicAMIGAMGInterfaceField.H @@ -125,6 +125,8 @@ public: ( solveScalarField& result, const bool add, + const lduAddressing&, + const label interfacei, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt,