diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index faa95cee43..1101d8d55f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,6 +160,20 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::rmap } +void Foam::smoluchowskiJumpTFvPatchScalarField::reset +( + const fvPatchField& ptf +) +{ + mixedFvPatchField::reset(ptf); + + const smoluchowskiJumpTFvPatchScalarField& ptpsf = + refCast(ptf); + + Twall_.reset(ptpsf.Twall_); +} + + void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H index 66d4351c6f..22f4db1b86 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -139,6 +139,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index a576d9ce36..1250edb59e 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -172,6 +172,20 @@ void Foam::maxwellSlipUFvPatchVectorField::rmap } +void Foam::maxwellSlipUFvPatchVectorField::reset +( + const fvPatchVectorField& pvf +) +{ + mixedFixedValueSlipFvPatchVectorField::reset(pvf); + + const maxwellSlipUFvPatchVectorField& mspvf = + refCast(pvf); + + Uwall_.reset(mspvf.Uwall_); +} + + void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H index 8c9b5e58c0..cdbd1833e5 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -147,6 +147,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + // Evaluation functions diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index 1aff58b001..ed425e357d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,6 +114,22 @@ void Foam::mixedFixedValueSlipFvPatchField::rmap } +template +void Foam::mixedFixedValueSlipFvPatchField::reset +( + const fvPatchField& ptf +) +{ + transformFvPatchField::reset(ptf); + + const mixedFixedValueSlipFvPatchField& dmptf = + refCast>(ptf); + + refValue_.reset(dmptf.refValue_); + valueFraction_.reset(dmptf.valueFraction_); +} + + template Foam::tmp> Foam::mixedFixedValueSlipFvPatchField::snGrad() const diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H index 7d981a4270..b3c98733e9 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Return defining fields diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index fb547ae901..0b899dc22f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -115,25 +115,6 @@ JohnsonJacksonParticleSlipFvPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::autoMap -( - const fvPatchFieldMapper& m -) -{ - partialSlipFvPatchVectorField::autoMap(m); -} - - -void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::rmap -( - const fvPatchVectorField& ptf, - const labelList& addr -) -{ - partialSlipFvPatchVectorField::rmap(ptf, addr); -} - - void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H index ba019f06f1..33c966d750 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,23 +132,11 @@ public: // Member Functions - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - // Used to update fields following mesh topology change - virtual void autoMap(const fvPatchFieldMapper&); - - //- Reverse map the given fvPatchField onto this fvPatchField - // Used to reconstruct fields - virtual void rmap(const fvPatchVectorField&, const labelList&); - - //- Update the coefficients virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; - }; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index c9725d7a0b..4b65bc4aae 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -135,25 +135,6 @@ JohnsonJacksonParticleThetaFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::autoMap -( - const fvPatchFieldMapper& m -) -{ - mixedFvPatchScalarField::autoMap(m); -} - - -void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::rmap -( - const fvPatchScalarField& ptf, - const labelList& addr -) -{ - mixedFvPatchScalarField::rmap(ptf, addr); -} - - void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H index 91800ea4a7..dd1c104fed 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,17 +135,6 @@ public: // Member Functions - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - // Used to update fields following mesh topology change - virtual void autoMap(const fvPatchFieldMapper&); - - //- Reverse map the given fvPatchField onto this fvPatchField - // Used to reconstruct fields - virtual void rmap(const fvPatchScalarField&, const labelList&); - - //- Update the coefficients virtual void updateCoeffs(); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C index e2c6df046b..30b908e049 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -192,6 +192,20 @@ void alphatPhaseChangeWallFunctionFvPatchScalarField::rmap } +void alphatPhaseChangeWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::reset(ptf); + + const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + dmdtf_.reset(tiptf.dmdtf_); +} + + void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const { alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write(os); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H index bf074d7d65..0f8c2535c2 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H @@ -142,6 +142,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index a3b163e1a0..86324df617 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -274,6 +274,23 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::rmap } +void alphatWallBoilingWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::reset(ptf); + + const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + AbyV_.reset(tiptf.AbyV_); + alphatConv_.reset(tiptf.alphatConv_); + dDep_.reset(tiptf.dDep_); + qq_.reset(tiptf.qq_); +} + + void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H index 0ab6d8556c..e7364645c3 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -286,6 +286,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C index 644440cfd9..4f0d85405b 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C @@ -176,6 +176,20 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::rmap } +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + + const fixedMultiPhaseHeatFluxFvPatchScalarField& mptf = + refCast(ptf); + + q_.reset(mptf.q_); +} + + void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H index 41cf1258e2..6dfa23faa8 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -143,6 +143,11 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 2f5f2eb4cb..37a7df4e6e 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,6 +116,20 @@ void Foam::tractionDisplacementFvPatchVectorField::rmap } +void Foam::tractionDisplacementFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedGradientFvPatchVectorField::reset(ptf); + + const tractionDisplacementFvPatchVectorField& dmptf = + refCast(ptf); + + traction_.reset(dmptf.traction_); +} + + void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.H index 326dcb22a1..b6dab7b9b0 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,6 +149,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C index ea6454f3c1..6340da5a29 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -108,7 +108,6 @@ void tractionDisplacementCorrectionFvPatchVectorField::autoMap } -// Reverse-map the given fvPatchField onto this fvPatchField void tractionDisplacementCorrectionFvPatchVectorField::rmap ( const fvPatchVectorField& ptf, @@ -125,7 +124,21 @@ void tractionDisplacementCorrectionFvPatchVectorField::rmap } -// Update the coefficients associated with the patch field +void tractionDisplacementCorrectionFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedGradientFvPatchVectorField::reset(ptf); + + const tractionDisplacementCorrectionFvPatchVectorField& dmptf = + refCast(ptf); + + traction_.reset(dmptf.traction_); + pressure_.reset(dmptf.pressure_); +} + + void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.H index a2250ba24c..222b6e53c0 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -151,6 +151,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/etc/codeTemplates/BC/BC.C b/etc/codeTemplates/BC/BC.C index 80be017503..0cbe170448 100644 --- a/etc/codeTemplates/BC/BC.C +++ b/etc/codeTemplates/BC/BC.C @@ -169,6 +169,21 @@ void Foam::CLASS::rmap } +template +void Foam::CLASS::reset +( + const FVPATCHF& ptf +) +{ + PARENT::reset(ptf); + + const CLASS& tiptf = + refCast(ptf); + + fieldData_.reset(tiptf.fieldData_); +} + + template void Foam::CLASS::updateCoeffs() { diff --git a/etc/codeTemplates/BC/BC.H b/etc/codeTemplates/BC/BC.H index 41c4ddfe81..7f4cbda482 100644 --- a/etc/codeTemplates/BC/BC.H +++ b/etc/codeTemplates/BC/BC.H @@ -199,6 +199,10 @@ public: // Used to reconstruct fields virtual void rmap(const FVPATCHF&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const FVPATCHF&); + // Evaluation functions diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C index e5ea17b1c8..a7178691bf 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -301,6 +301,21 @@ void nutURoughWallFunctionFvPatchScalarField::rmap } +void nutURoughWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + nutUWallFunctionFvPatchScalarField::reset(ptf); + + const nutURoughWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + Ks_.reset(nrwfpsf.Ks_); + Cs_.reset(nrwfpsf.Cs_); +} + + void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H index 02486baba7..dd9b1ab792 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -207,6 +207,10 @@ public: const labelList& ); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // I-O diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index 96ec4732fd..bd945b0c31 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -213,6 +213,21 @@ void nutkRoughWallFunctionFvPatchScalarField::rmap } +void nutkRoughWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + nutkWallFunctionFvPatchScalarField::reset(ptf); + + const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + Ks_.reset(nrwfpsf.Ks_); + Cs_.reset(nrwfpsf.Cs_); +} + + void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H index cd0ddfadf0..af297bb56c 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -211,6 +211,10 @@ public: const labelList& ); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // I-O diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index 13b2bb470e..b32b1b5af7 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -325,7 +325,7 @@ public: const tmp>& ) const; - //- Reset the field contents to the given field + //- Reset the field values to the given field // Used for mesh to mesh mapping void reset(const DimensionedField&); diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index b6f035bf10..a56617d7c1 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -428,6 +428,20 @@ void Foam::Field::rmap } +template +void Foam::Field::reset(const Field& rhs) +{ + if (this == &rhs) + { + FatalErrorInFunction + << "attempted assignment to self" + << abort(FatalError); + } + + List::operator=(rhs); +} + + template void Foam::Field::negate() { diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 32624a52af..f204c097f6 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -262,6 +262,10 @@ public: const UList& weights ); + //- Reset the field values to the given field + // Equivalent to operator= + void reset(const Field&); + //- Negate this field void negate(); diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 269d355ec3..5b2350bbfb 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -28,6 +28,7 @@ License #include "commSchedule.H" #include "globalMeshData.H" #include "cyclicPolyPatch.H" +#include "processorPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -629,6 +630,35 @@ scalarInterfaces() const } +template class PatchField, class GeoMesh> +void Foam::GeometricBoundaryField::reset +( + const DimensionedField& field, + const GeometricBoundaryField& btf +) +{ + // Reset the number of patches in case the decomposition changed + this->setSize(btf.size()); + + const polyBoundaryMesh& pbm = field.mesh()().boundaryMesh(); + + forAll(*this, patchi) + { + // Construct new processor patch fields in case the decomposition + // changed + if (isA(pbm[patchi])) + { + this->set(patchi, btf[patchi].clone(bmesh_[patchi], field)); + } + else + { + this->operator[](patchi).reset(btf[patchi]); + } + } +} + + + template class PatchField, class GeoMesh> void Foam::GeometricBoundaryField::writeEntry ( @@ -717,7 +747,7 @@ void Foam::GeometricBoundaryField::operator== const GeometricBoundaryField& bf ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == bf[patchi]; } @@ -731,7 +761,7 @@ operator== const FieldField& ptff ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == ptff[patchi]; } @@ -746,7 +776,7 @@ operator== const FieldField& ptff ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == ptff[patchi]; } @@ -759,7 +789,7 @@ void Foam::GeometricBoundaryField::operator== const Type& t ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == t; } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H index 3ccd762659..cf5668c1e4 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H @@ -167,6 +167,14 @@ public: // pointing to interfaces being set lduInterfaceFieldPtrsList scalarInterfaces() const; + //- Reset the boundary field contents to the given field + // Used for mesh to mesh mapping + void reset + ( + const Internal&, + const GeometricBoundaryField& + ); + //- Write boundary field as dictionary entry void writeEntry(const word& keyword, Ostream& os) const; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index f817151107..efee0f0402 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -1211,7 +1211,7 @@ void Foam::GeometricField::reset const GeometricField& gf = tgf(); Internal::reset(gf); - boundaryField_ == gf.boundaryField(); + boundaryField_.reset(*this, gf.boundaryField()); tgf.clear(); } diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C index c64bf179df..ab5a0160d1 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C @@ -146,6 +146,16 @@ void Foam::valuePointPatchField::rmap } +template +void Foam::valuePointPatchField::reset +( + const pointPatchField& ptf +) +{ + Field::reset(refCast>(ptf)); +} + + template void Foam::valuePointPatchField::updateCoeffs() { diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.H index 7dd3ae6eec..82d30b4894 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,6 +138,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + // Evaluation functions diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index a569dcfdca..49db6f1bb3 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -112,6 +112,23 @@ public: ); } + //- Construct and return a clone setting internal field reference + virtual autoPtr> clone + ( + const pointPatch& patch, + const DimensionedField& iF + ) const + { + return autoPtr> + ( + new processorPointPatchField + ( + patch, + iF + ) + ); + } + //- Destructor virtual ~processorPointPatchField(); diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index 2e8f7b9ef4..9d23846a64 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -196,6 +196,17 @@ public: const DimensionedField& iF ) const = 0; + //- Construct and return a clone setting internal field reference + virtual autoPtr> clone + ( + const pointPatch& patch, + const DimensionedField& iF + ) const + { + NotImplemented; + return autoPtr>(nullptr); + } + // Selectors @@ -397,6 +408,11 @@ public: virtual void rmap(const pointPatchField&, const labelList&) {} + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&) + {} + // Evaluation functions diff --git a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H index 67c782be32..1f561b4d1e 100644 --- a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H +++ b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,7 @@ public: // Member Operators - //- Return reference to polyMesh + //- Return reference to MESH const MESH& operator()() const { return mesh_; diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C index 7faa63ab22..6143f343f0 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C @@ -25,6 +25,7 @@ License #include "pointBoundaryMesh.H" #include "polyBoundaryMesh.H" +#include "processorPolyPatch.H" #include "facePointPatch.H" #include "pointMesh.H" #include "PstreamBuffers.H" @@ -36,13 +37,24 @@ License Foam::pointBoundaryMesh::pointBoundaryMesh ( const pointMesh& m, - const polyBoundaryMesh& basicBdry + const polyBoundaryMesh& pbm ) : - pointPatchList(basicBdry.size()), + pointPatchList(pbm.size()), mesh_(m) { - reset(basicBdry); + // Set boundary patches + pointPatchList& Patches = *this; + + forAll(Patches, patchi) + { + Patches.set + ( + patchi, + facePointPatch::New(pbm[patchi], *this).ptr() + ); + } + // reset(pbm); } @@ -202,18 +214,25 @@ void Foam::pointBoundaryMesh::topoChange() } -void Foam::pointBoundaryMesh::reset(const polyBoundaryMesh& basicBdry) +void Foam::pointBoundaryMesh::reset() { - // Set boundary patches + const polyBoundaryMesh& boundaryMesh = mesh()().boundaryMesh(); pointPatchList& Patches = *this; - forAll(Patches, patchi) + // Reset the number of patches in case the decomposition changed + Patches.setSize(boundaryMesh.size()); + + forAll(boundaryMesh, patchi) { - Patches.set - ( - patchi, - facePointPatch::New(basicBdry[patchi], *this).ptr() - ); + // Construct new processor patches in case the decomposition changed + if (isA(boundaryMesh[patchi])) + { + Patches.set + ( + patchi, + facePointPatch::New(boundaryMesh[patchi], *this).ptr() + ); + } } } diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H index bd7a27ff6e..609b9e3d16 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.H @@ -105,8 +105,9 @@ public: //- Correct pointBoundaryMesh after topology update void topoChange(); - //- Create pointBoundaryMesh from polyBoundaryMesh - void reset(const polyBoundaryMesh&); + //- Reset pointBoundaryMesh with respect to the updated polyBoundaryMesh + // For run-time mesh replacement and mesh to mesh mapping + void reset(); //- Reorders patches. Ordering does not have to be done in // ascending or descending order. Reordering has to be unique. diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index 0173f98997..d26add8de3 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -72,24 +72,6 @@ Foam::pointMesh::~pointMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::pointMesh::reset(const bool validBoundary) -{ - const polyMesh& pm = operator()(); - if (debug) - { - Pout<< "pointMesh::reset(const bool validBoundary): " - << "Resetting from polyMesh " << pm.name() << endl; - } - - boundary_.reset(pm.boundaryMesh()); - if (validBoundary) - { - // Calculate the geometry for the patches (transformation tensors etc.) - boundary_.calcGeometry(); - } -} - - bool Foam::pointMesh::movePoints() { if (debug) @@ -203,4 +185,16 @@ void Foam::pointMesh::addPatch(const label patchi) } +void Foam::pointMesh::reset() +{ + if (debug) + { + Pout<< "pointMesh::reset(): " + << "Mesh reset." << endl; + Pout<< endl; + } + boundary_.reset(); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index d12cb7d415..5cfd5fd51c 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -112,8 +112,9 @@ public: return GeoMesh::mesh_.thisDb(); } - //- Reset for changed polyMesh - void reset(const bool validBoundary); + //- Reset pointMesh with respect to the updated polyMesh + // For run-time mesh replacement and mesh to mesh mapping + void reset(); // Mesh callbacks diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index ea800d3786..2424630c75 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -769,6 +769,86 @@ void Foam::polyMesh::resetPrimitives } +void Foam::polyMesh::reset(const polyMesh& newMesh) +{ + // Clear addressing. Keep geometric props and updateable props for mapping. + clearAddressing(true); + + points_ = newMesh.points(); + bounds_ = boundBox(points_, true); + faces_ = newMesh.faces(); + owner_ = newMesh.faceOwner(); + neighbour_ = newMesh.faceNeighbour(); + + const polyPatchList& patches(newMesh.boundaryMesh()); + + boundary_.clearGeom(); + boundary_.clearAddressing(); + + // Reset the number of patches in case the decomposition changed + boundary_.setSize(patches.size()); + + forAll(boundary_, patchi) + { + // Construct new processor patches in case the decomposition changed + if (!isA(patches[patchi])) + { + boundary_[patchi] = polyPatch + ( + boundary_[patchi], + boundary_, + patchi, + patches[patchi].size(), + patches[patchi].start() + ); + } + else + { + boundary_.set(patchi, patches[patchi].clone(boundary_)); + } + } + + // parallelData depends on the processorPatch ordering so force + // recalculation. Problem: should really be done in removeBoundary but + // there is some info in parallelData which might be interesting in between + // removeBoundary and addPatches. + globalMeshDataPtr_.clear(); + + // Flags the mesh files as being changed + setInstance(time().timeName()); + + // Check if the faces and cells are valid + forAll(faces_, facei) + { + const face& curFace = faces_[facei]; + + if (min(curFace) < 0 || max(curFace) > points_.size()) + { + FatalErrorInFunction + << "Face " << facei << " contains vertex labels out of range: " + << curFace << " Max point index = " << points_.size() + << abort(FatalError); + } + } + + // Set the primitive mesh from the owner_, neighbour_. + // Works out from patch end where the active faces stop. + initMesh(); + + // Calculate topology for the patches (processor-processor comms etc.) + boundary_.topoChange(); + + // Calculate the geometry for the patches (transformation tensors etc.) + boundary_.calcGeometry(); + + // Update the optional pointMesh with respect to the updated polyMesh + if (foundObject(pointMesh::typeName)) + { + pointMesh::New(*this).reset(); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::polyMesh::~polyMesh() diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index 9074d2918a..4ea54472a5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -635,6 +635,10 @@ public: const bool validBoundary = true ); + //- Reset mesh + // For run-time mesh replacement and mesh to mesh mapping + void reset(const polyMesh&); + // Storage management diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index 17829b6b20..b5125336b8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -131,6 +131,8 @@ void Foam::polyMesh::mapMesh(const polyMeshMap& map) { meshObject::mapMesh(*this, map); meshObject::mapMesh(*this, map); + + const_cast(time()).functionObjects().mapMesh(map); } diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index a557d873e6..68e7267708 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -249,6 +249,33 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::rmap } +void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + + const externalWallHeatFluxTemperatureFvPatchScalarField& tiptf = + refCast(ptf); + + if (haveq_) + { + q_.reset(tiptf.q_); + } + + if (haveh_) + { + h_.reset(tiptf.h_); + } + + if (qrName_ != word::null) + { + qrPrevious_.reset(tiptf.qrPrevious_); + } +} + + void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 2268b57fa7..2d62f062cb 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -250,6 +250,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index b8d80a80e4..8d72e75762 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -321,6 +321,25 @@ void thermalBaffle1DFvPatchScalarField::rmap } +template +void thermalBaffle1DFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + + const thermalBaffle1DFvPatchScalarField& tiptf = + refCast(ptf); + + if (this->owner()) + { + thickness_.reset(tiptf.thickness_); + qs_.reset(tiptf.qs_); + } +} + + template void thermalBaffle1DFvPatchScalarField::updateCoeffs() { diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H index 13c5d159ca..c2357a88b7 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H @@ -230,6 +230,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C b/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C index 90b8541211..8e29edd15b 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,6 +130,15 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::rmap } +void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchField::reset(ptf); +} + + void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H b/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H index 134c7a03ad..2a93f8f2b9 100644 --- a/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H +++ b/src/ThermophysicalTransportModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,6 +142,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C index c3e19561ef..550a1fc4aa 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,6 +190,14 @@ void Foam::atmBoundaryLayer::rmap } +void Foam::atmBoundaryLayer::reset(const atmBoundaryLayer& blptf) +{ + z0_.reset(blptf.z0_); + zGround_.reset(blptf.zGround_); + Ustar_.reset(blptf.Ustar_); +} + + Foam::tmp Foam::atmBoundaryLayer::U ( const vectorField& p diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H index 4f1a8f6b67..4e375cdedc 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H @@ -252,9 +252,14 @@ public: //- Map (and resize as needed) from self given a mapping object void autoMap(const fvPatchFieldMapper&); - //- Reverse map the given fvPatchField onto this fvPatchField + //- Reverse map the given atmBoundaryLayer onto this + // atmBoundaryLayer void rmap(const atmBoundaryLayer&, const labelList&); + //- Reset the atmBoundaryLayer to the given atmBoundaryLayer + // Used for mesh to mesh mapping + void reset(const atmBoundaryLayer&); + // Evaluate functions diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index b26a71302a..3c8370ba21 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,20 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap } +void atmBoundaryLayerInletEpsilonFvPatchScalarField::reset +( + const fvPatchScalarField& psf +) +{ + inletOutletFvPatchScalarField::reset(psf); + + const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf = + refCast(psf); + + atmBoundaryLayer::reset(blpsf); +} + + void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index 284ac4dcec..93592971c4 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C index 78d5eb9110..22a854f970 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,20 @@ void atmBoundaryLayerInletKFvPatchScalarField::rmap } +void atmBoundaryLayerInletKFvPatchScalarField::reset +( + const fvPatchScalarField& psf +) +{ + inletOutletFvPatchScalarField::reset(psf); + + const atmBoundaryLayerInletKFvPatchScalarField& blpsf = + refCast(psf); + + atmBoundaryLayer::reset(blpsf); +} + + void atmBoundaryLayerInletKFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H index 2af159608a..c0bb20b84f 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index 5bd0b5ccda..96fa858ffd 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,20 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap } +void atmBoundaryLayerInletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& pvf +) +{ + inletOutletFvPatchVectorField::reset(pvf); + + const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf = + refCast(pvf); + + atmBoundaryLayer::reset(blpvf); +} + + void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index 2e446a49e7..43b6116a0c 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -141,6 +141,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index 57dfaec5a8..7186f8afbb 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,20 @@ void nutkAtmRoughWallFunctionFvPatchScalarField::rmap } +void nutkAtmRoughWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + nutkWallFunctionFvPatchScalarField::reset(ptf); + + const nutkAtmRoughWallFunctionFvPatchScalarField& nrwfpsf = + refCast(ptf); + + z0_.reset(nrwfpsf.z0_); +} + + void nutkAtmRoughWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H index cf0852abfd..01ed603a9c 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -181,6 +181,10 @@ public: const labelList& ); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // I-O diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C index fd265b6535..f8ec6443c3 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,6 +109,20 @@ void Foam::SRFVelocityFvPatchVectorField::rmap } +void Foam::SRFVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + const SRFVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + inletValue_.reset(tiptf.inletValue_); +} + + void Foam::SRFVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H index 4c97d27ac0..bd8400cc08 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,6 +190,11 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C index a73be554be..0cf7e4bf12 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,6 +95,15 @@ void Foam::SRFWallVelocityFvPatchVectorField::rmap } +void Foam::SRFWallVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); +} + + void Foam::SRFWallVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.H index e09e886427..64a26cbda6 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -156,6 +156,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C index 6236b6f82f..1d7d986033 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,6 +122,23 @@ void Foam::directionMixedFvPatchField::rmap } +template +void Foam::directionMixedFvPatchField::reset +( + const fvPatchField& ptf +) +{ + transformFvPatchField::reset(ptf); + + const directionMixedFvPatchField& dmptf = + refCast>(ptf); + + refValue_.reset(dmptf.refValue_); + refGrad_.reset(dmptf.refGrad_); + valueFraction_.reset(dmptf.valueFraction_); +} + + template Foam::tmp> Foam::directionMixedFvPatchField::snGrad() const diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H index bcff81f6be..3923767cfc 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -145,6 +145,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Return defining fields diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index 50cc5c5f0e..9b084990bb 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,6 +135,21 @@ void Foam::fixedGradientFvPatchField::rmap } +template +void Foam::fixedGradientFvPatchField::reset +( + const fvPatchField& ptf +) +{ + fvPatchField::reset(ptf); + + const fixedGradientFvPatchField& fgptf = + refCast>(ptf); + + gradient_.reset(fgptf.gradient_); +} + + template void Foam::fixedGradientFvPatchField::evaluate(const Pstream::commsTypes) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.H index b74764361c..0829e685e6 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -171,6 +171,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index 86609e4b0f..15cd29904f 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,6 +122,20 @@ void Foam::mixedFvPatchField::rmap } +template +void Foam::mixedFvPatchField::reset(const fvPatchField& ptf) +{ + fvPatchField::reset(ptf); + + const mixedFvPatchField& mptf = + refCast>(ptf); + + refValue_.reset(mptf.refValue_); + refGrad_.reset(mptf.refGrad_); + valueFraction_.reset(mptf.valueFraction_); +} + + template void Foam::mixedFvPatchField::evaluate(const Pstream::commsTypes) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H index c895ad0077..3087e25a2f 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H @@ -214,6 +214,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H index cf811fc0c5..df4f0c4139 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H @@ -134,6 +134,11 @@ public: virtual void rmap(const fvPatchField&, const labelList&) {} + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&) + {} + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index b6d600d5e0..dc71ad7cbe 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -150,6 +150,20 @@ public: ); } + //- Construct and return a clone onto a new patch + // setting internal field reference + virtual tmp> clone + ( + const fvPatch& patch, + const DimensionedField& iF + ) const + { + return tmp> + ( + new processorFvPatchField(patch, iF, *this) + ); + } + //- Destructor ~processorFvPatchField(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 61cff15c76..40d3aa5bc1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -186,6 +186,30 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap } +void Foam::activeBaffleVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + // See autoMap. + const vectorField& areas = patch().boundaryMesh().mesh().faceAreas(); + initWallSf_ = patch().patchSlice(areas); + initCyclicSf_ = patch().boundaryMesh() + [ + cyclicPatchLabel_ + ].patchSlice(areas); + nbrCyclicSf_ = refCast + ( + patch().boundaryMesh() + [ + cyclicPatchLabel_ + ] + ).neighbFvPatch().patch().patchSlice(areas); +} + + void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H index 704a5f5f5c..ca9fac17cf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -212,6 +212,10 @@ public: //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index 7060887d86..e94bf90e78 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -191,6 +191,7 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::autoMap } } + void Foam::activePressureForceBaffleVelocityFvPatchVectorField::rmap ( const fvPatchVectorField& ptf, @@ -216,6 +217,30 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::rmap } +void Foam::activePressureForceBaffleVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + // See autoMap. + const vectorField& areas = patch().boundaryMesh().mesh().faceAreas(); + initWallSf_ = patch().patchSlice(areas); + initCyclicSf_ = patch().boundaryMesh() + [ + cyclicPatchLabel_ + ].patchSlice(areas); + nbrCyclicSf_ = refCast + ( + patch().boundaryMesh() + [ + cyclicPatchLabel_ + ] + ).neighbFvPatch().patch().patchSlice(areas); +} + + void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.H index e497a547b0..651c45c685 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -229,6 +229,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.C index 6dd62c19d0..232ec2061b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.C @@ -208,6 +208,20 @@ void Foam::dynamicPressureFvPatchScalarField::rmap } +void Foam::dynamicPressureFvPatchScalarField::reset +( + const fvPatchScalarField& psf +) +{ + fixedValueFvPatchScalarField::reset(psf); + + const dynamicPressureFvPatchScalarField& dpsf = + refCast(psf); + + p0_.reset(dpsf.p0_); +} + + void Foam::dynamicPressureFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.H index 9c38c17c3b..c41e51af65 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/dynamicPressure/dynamicPressureFvPatchScalarField.H @@ -147,6 +147,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index 05e31a507b..0bba0af294 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,20 @@ void Foam::fixedJumpFvPatchField::rmap } +template +void Foam::fixedJumpFvPatchField::reset +( + const fvPatchField& ptf +) +{ + jumpCyclicFvPatchField::reset(ptf); + + const fixedJumpFvPatchField& tiptf = + refCast>(ptf); + jump_.reset(tiptf.jump_); +} + + template void Foam::fixedJumpFvPatchField::write(Ostream& os) const { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H index 578b45d7be..fc4601297a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H @@ -165,6 +165,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index 9edd3b1a9e..dc19f67899 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,6 +154,20 @@ void Foam::fixedJumpAMIFvPatchField::rmap } +template +void Foam::fixedJumpAMIFvPatchField::reset +( + const fvPatchField& ptf +) +{ + jumpCyclicAMIFvPatchField::reset(ptf); + + const fixedJumpAMIFvPatchField& tiptf = + refCast>(ptf); + jump_.reset(tiptf.jump_); +} + + template void Foam::fixedJumpAMIFvPatchField::write(Ostream& os) const { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H index 34ceb01eb7..439ed17739 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H @@ -164,6 +164,10 @@ public: //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C index be3288f55e..5266416779 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,6 +135,20 @@ void Foam::fixedNormalInletOutletVelocityFvPatchVectorField::rmap } +void Foam::fixedNormalInletOutletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + directionMixedFvPatchVectorField::reset(ptf); + + const fixedNormalInletOutletVelocityFvPatchVectorField& fniovptf = + refCast(ptf); + + normalVelocity_->reset(fniovptf.normalVelocity()); +} + + void Foam::fixedNormalInletOutletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H index 8833d1baee..50ac5cef8f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -218,6 +218,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C index 43b54e873e..7a46bbb18d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,6 +111,21 @@ void Foam::fixedNormalSlipFvPatchField::rmap } +template +void Foam::fixedNormalSlipFvPatchField::reset +( + const fvPatchField& ptf +) +{ + transformFvPatchField::reset(ptf); + + const fixedNormalSlipFvPatchField& dmptf = + refCast>(ptf); + + fixedValue_.reset(dmptf.fixedValue_); +} + + template Foam::tmp> Foam::fixedNormalSlipFvPatchField::snGrad() const diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H index df50b8c836..51415f61ba 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,6 +155,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Return defining fields diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index f0e7253cfb..a1edfcfd70 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -264,6 +264,23 @@ void Foam::flowRateInletVelocityFvPatchVectorField::rmap } +void Foam::flowRateInletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + const flowRateInletVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + if (profile_.valid()) + { + y_.reset(tiptf.y_); + } +} + + Foam::tmp Foam::flowRateInletVelocityFvPatchVectorField::profile() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index 2f6abe5d3c..179e95bca6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -252,6 +252,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Return the normalised velocity profile virtual tmp profile(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index ed63ee9284..f7fcdcc061 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -143,6 +143,20 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::rmap } +void Foam::inletOutletTotalTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + inletOutletFvPatchScalarField::reset(ptf); + + const inletOutletTotalTemperatureFvPatchScalarField& tiptf = + refCast(ptf); + + T0_.reset(tiptf.T0_); +} + + void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H index e445dd8034..5193c21b3f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,6 +182,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C index 3f7b805871..cda08a4f2a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,6 +113,20 @@ void Foam::interstitialInletVelocityFvPatchVectorField::rmap } +void Foam::interstitialInletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + const interstitialInletVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + inletVelocity_.reset(tiptf.inletVelocity_); +} + + void Foam::interstitialInletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H index 4556f02ea2..ac847bcfb9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,6 +142,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C index 99d572fecf..5c08b7ccaf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,6 +149,17 @@ void Foam::mappedFieldFvPatchField::rmap } +template +void Foam::mappedFieldFvPatchField::reset +( + const fvPatchField& ptf +) +{ + fixedValueFvPatchField::reset(ptf); + mappedPatchBase::clearOut(); +} + + template void Foam::mappedFieldFvPatchField::updateCoeffs() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H index 2d2a7bdca9..c4964b45c6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H @@ -185,6 +185,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C index 63544a5672..5ca4004ed6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,6 +110,21 @@ void Foam::partialSlipFvPatchField::rmap } +template +void Foam::partialSlipFvPatchField::reset +( + const fvPatchField& ptf +) +{ + transformFvPatchField::reset(ptf); + + const partialSlipFvPatchField& dmptf = + refCast>(ptf); + + valueFraction_.reset(dmptf.valueFraction_); +} + + template Foam::tmp> Foam::partialSlipFvPatchField::snGrad() const diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H index 814493c4c3..e185218c60 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -153,6 +153,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Return defining fields diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C index 46c4cc7f99..8b21cc4c1e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -117,6 +117,20 @@ void Foam::pressureFvPatchScalarField::rmap } +void Foam::pressureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + + const pressureFvPatchScalarField& tiptf = + refCast(ptf); + + p_.reset(tiptf.p_); +} + + void Foam::pressureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H index c9695e97ea..906e4dc4f4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index 733f514783..5f0b0678e0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -127,6 +127,21 @@ void Foam::pressureDirectedInletOutletVelocityFvPatchVectorField::rmap } +void Foam::pressureDirectedInletOutletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + mixedFvPatchVectorField::reset(ptf); + + const pressureDirectedInletOutletVelocityFvPatchVectorField& tiptf = + refCast + (ptf); + + inletDir_.reset(tiptf.inletDir_); +} + + void Foam::pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H index f7d0b2ae96..f0056a2d89 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H @@ -207,6 +207,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C index 350b3532c6..5f7c24bf28 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -118,6 +118,20 @@ void Foam::pressureDirectedInletVelocityFvPatchVectorField::rmap } +void Foam::pressureDirectedInletVelocityFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + const pressureDirectedInletVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + inletDir_.reset(tiptf.inletDir_); +} + + void Foam::pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H index 7ea92adaca..997cec1290 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H @@ -204,6 +204,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C index a26a4852bd..235df41214 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -117,6 +117,20 @@ void Foam::surfaceNormalFixedValueFvPatchVectorField::rmap } +void Foam::surfaceNormalFixedValueFvPatchVectorField::reset +( + const fvPatchVectorField& ptf +) +{ + fixedValueFvPatchVectorField::reset(ptf); + + const surfaceNormalFixedValueFvPatchVectorField& tiptf = + refCast(ptf); + + refValue_.reset(tiptf.refValue_); +} + + void Foam::surfaceNormalFixedValueFvPatchVectorField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H index ae0eb45756..71b1cb01d6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H @@ -157,6 +157,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchVectorField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchVectorField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 1865caed60..14fb73a79b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -128,6 +128,23 @@ void Foam::timeVaryingMappedFixedValueFvPatchField::rmap } +template +void Foam::timeVaryingMappedFixedValueFvPatchField::reset +( + const fvPatchField& ptf +) +{ + fixedValueFvPatchField::reset(ptf); + fieldMapper_.reset + ( + refCast + < + const timeVaryingMappedFixedValueFvPatchField + >(ptf).fieldMapper_ + ); +} + + template void Foam::timeVaryingMappedFixedValueFvPatchField::updateCoeffs() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 242b7e4472..380aa96638 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -193,6 +193,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.C index b67606470f..9ec5552f05 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -417,6 +417,22 @@ void Foam::timeVaryingMappedFvPatchField::rmap } +template +void Foam::timeVaryingMappedFvPatchField::reset +( + const timeVaryingMappedFvPatchField& tiptf +) +{ + startSampledValues_.reset(tiptf.startSampledValues_); + endSampledValues_.reset(tiptf.endSampledValues_); + + // Clear interpolator + mapperPtr_.clear(); + startSampleTime_ = -1; + endSampleTime_ = -1; +} + + template Foam::tmp> Foam::timeVaryingMappedFvPatchField::map() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.H index f86cc9d8e5..dfbb58f6a1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFvPatchField/timeVaryingMappedFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -226,6 +226,10 @@ public: const labelList& ); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + void reset(const timeVaryingMappedFvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index 734fe409eb..ec8744340a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -133,6 +133,20 @@ void Foam::totalTemperatureFvPatchScalarField::rmap } +void Foam::totalTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + + const totalTemperatureFvPatchScalarField& tiptf = + refCast(ptf); + + T0_.reset(tiptf.T0_); +} + + void Foam::totalTemperatureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H index 6990522100..0077643ce4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -176,6 +176,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.C index a5d9aed986..c4a79b8ee3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.C @@ -143,6 +143,20 @@ void Foam::transonicEntrainmentPressureFvPatchScalarField::rmap } +void Foam::transonicEntrainmentPressureFvPatchScalarField::reset +( + const fvPatchScalarField& psf +) +{ + mixedFvPatchScalarField::reset(psf); + + const transonicEntrainmentPressureFvPatchScalarField& toppsf = + refCast(psf); + + p0_.reset(toppsf.p0_); +} + + void Foam::transonicEntrainmentPressureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.H index 0a15e07425..8b1ce242d1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.H @@ -169,6 +169,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C index 0278c4d1db..efea34eedd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,6 +135,21 @@ void Foam::turbulentInletFvPatchField::rmap } +template +void Foam::turbulentInletFvPatchField::reset +( + const fvPatchField& ptf +) +{ + fixedValueFvPatchField::reset(ptf); + + const turbulentInletFvPatchField& tiptf = + refCast>(ptf); + + referenceField_.reset(tiptf.referenceField_); +} + + template void Foam::turbulentInletFvPatchField::updateCoeffs() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H index abaa9ef272..e9433055f1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -206,6 +206,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index a601443115..0be8e76f04 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -184,6 +184,20 @@ void Foam::uniformInletOutletFvPatchField::rmap } +template +void Foam::uniformInletOutletFvPatchField::reset +( + const fvPatchField& ptf +) +{ + mixedFvPatchField::reset(ptf); + + // Override + this->refValue() = + uniformInletValue_->value(this->db().time().userTimeValue()); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H index bbd33f0887..cbc9efbd43 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H @@ -174,6 +174,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 35b0bc685e..bdbcbfd421 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -205,6 +205,13 @@ void Foam::fvPatchField::rmap } +template +void Foam::fvPatchField::reset(const fvPatchField& ptf) +{ + Field::reset(ptf); +} + + template void Foam::fvPatchField::updateCoeffs() { diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 36eae7382b..a417e1c3ab 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -219,6 +219,20 @@ public: return tmp>(new fvPatchField(*this, iF)); } + //- Construct and return a clone onto a new patch + // setting internal field reference + virtual tmp> clone + ( + const fvPatch& patch, + const DimensionedField& iF + ) const + { + return tmp> + ( + new fvPatchField(patch, iF, *this) + ); + } + // Selectors @@ -375,6 +389,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H index 87d89cf335..6437e502c6 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -121,6 +121,11 @@ public: // Used to reconstruct fields virtual void rmap(const fvsPatchField&, const labelList&) {} + + //- Reset the fvsPatchField to the given fvsPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvsPatchField&) + {} }; diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H index 57460ceedb..cd3950cede 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processor/processorFvsPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,6 +123,20 @@ public: ); } + //- Construct and return a clone onto a new patch + // setting internal field reference + virtual tmp> clone + ( + const fvPatch& patch, + const DimensionedField& iF + ) const + { + return tmp> + ( + new processorFvsPatchField(patch, iF, *this) + ); + } + //- Destructor virtual ~processorFvsPatchField(); diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index b5c3658411..f4f6b0e056 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -157,6 +157,13 @@ void Foam::fvsPatchField::rmap } +template +void Foam::fvsPatchField::reset(const fvsPatchField& ptf) +{ + Field::reset(ptf); +} + + template void Foam::fvsPatchField::write(Ostream& os) const { diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index b48370f480..1ff92700cd 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -215,6 +215,20 @@ public: ); } + //- Construct and return a clone onto a new patch + // setting internal field reference + virtual tmp> clone + ( + const fvPatch& patch, + const DimensionedField& iF + ) const + { + return tmp> + ( + new fvsPatchField(patch, iF, *this) + ); + } + // Selectors @@ -374,6 +388,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvsPatchField&, const labelList&); + //- Reset the fvsPatchField to the given fvsPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvsPatchField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 8ee1e2106c..cb667371dd 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -677,25 +677,27 @@ void Foam::fvMesh::reset(const fvMesh& newMesh) // Clear any non-updateable addressing clearAddressing(true); - const polyPatchList& newBoundary = newMesh.boundaryMesh(); - labelList patchSizes(newBoundary.size()); - labelList patchStarts(newBoundary.size()); + polyMesh::reset(newMesh); - forAll(newBoundary, patchi) + // Reset the number of patches in case the decomposition changed + boundary_.setSize(boundaryMesh().size()); + + forAll(boundaryMesh(), patchi) { - patchSizes[patchi] = newBoundary[patchi].size(); - patchStarts[patchi] = newBoundary[patchi].start(); + // Construct new processor patches in case the decomposition changed + if (isA(boundaryMesh()[patchi])) + { + boundary_.set + ( + patchi, + fvPatch::New + ( + boundaryMesh()[patchi], + boundary_ + ) + ); + } } - - polyMesh::resetPrimitives - ( - pointField(newMesh.points()), - faceList(newMesh.faces()), - labelList(newMesh.faceOwner()), - labelList(newMesh.faceNeighbour()), - patchSizes, - patchStarts - ); } @@ -844,6 +846,7 @@ Foam::fvMesh::polyBFacePatches() const : boundary()[patchi].start() + patchFacei ) - nInternalFaces(); + offsets[polyBFacei + 1] ++; } } diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index b5829fa759..8a8c88ce5b 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -363,6 +363,12 @@ public: //- Return reference to boundary mesh const fvBoundaryMesh& boundary() const; + //- Return reference to polyMesh + const polyMesh& operator()() const + { + return *this; + } + //- Return ldu addressing virtual const lduAddressing& lduAddr() const; diff --git a/src/finiteVolume/surfaceMesh/surfaceMesh.H b/src/finiteVolume/surfaceMesh/surfaceMesh.H index b766c0541e..2131dfacc6 100644 --- a/src/finiteVolume/surfaceMesh/surfaceMesh.H +++ b/src/finiteVolume/surfaceMesh/surfaceMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,6 @@ Description #include "GeoMesh.H" #include "fvMesh.H" -#include "primitiveMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 066d235952..b5eb7e14e9 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ License #include "mergePoints.H" #include "indirectPrimitivePatch.H" #include "PatchTools.H" +#include "polyTopoChangeMap.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -655,6 +656,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue ) : fieldValue(name, runTime, dict, typeName), + dict_(dict), surfaceWriterPtr_(nullptr), regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), @@ -666,7 +668,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue facePatchId_(), faceSign_() { - read(dict); + read(dict_); } Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue @@ -677,6 +679,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue ) : fieldValue(name, obr, dict, typeName), + dict_(dict), surfaceWriterPtr_(nullptr), regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), @@ -688,7 +691,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue facePatchId_(), faceSign_() { - read(dict); + read(dict_); } @@ -824,4 +827,32 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write() } +void Foam::functionObjects::fieldValues::surfaceFieldValue::movePoints +( + const polyMesh& mesh +) +{ + // Moving mesh might affect patch or region area + totalArea_ = totalArea(); +} + + +void Foam::functionObjects::fieldValues::surfaceFieldValue::topoChange +( + const polyTopoChangeMap& map +) +{ + initialise(dict_); +} + + +void Foam::functionObjects::fieldValues::surfaceFieldValue::mapMesh +( + const polyMeshMap& map +) +{ + initialise(dict_); +} + + // ************************************************************************* // diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H index 86237262df..7e23d05b3e 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H @@ -259,6 +259,9 @@ protected: // Protected data + //- Input dictionary + dictionary dict_; + //- Surface writer autoPtr surfaceWriterPtr_; @@ -486,6 +489,15 @@ public: //- Calculate and write virtual bool write(); + + //- Update for mesh point-motion + virtual void movePoints(const polyMesh&); + + //- Update topology using the given map + virtual void topoChange(const polyTopoChangeMap&); + + //- Update from another mesh using the given map + virtual void mapMesh(const polyMeshMap&); }; diff --git a/src/fvMeshTopoChangers/meshToMesh/MeshToMeshMapGeometricFields.H b/src/fvMeshTopoChangers/meshToMesh/MeshToMeshMapGeometricFields.H index e3eec2cb14..88806f2367 100644 --- a/src/fvMeshTopoChangers/meshToMesh/MeshToMeshMapGeometricFields.H +++ b/src/fvMeshTopoChangers/meshToMesh/MeshToMeshMapGeometricFields.H @@ -39,6 +39,7 @@ Description #include "fvPatchFieldMapper.H" #include "pointPatchFieldMapper.H" #include "setSizeFieldMapper.H" +#include "processorPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -265,12 +266,30 @@ void NaNGeometricFields field.primitiveFieldRef().setSize(GeoMesh::size(mesh)); field.primitiveFieldRef() = NaN; + field.boundaryFieldRef().setSize(mesh.boundary().size()); + forAll(mesh.boundary(), patchi) { - typename Gfield::Patch& pf = field.boundaryFieldRef()[patchi]; + if (isA(mesh().boundaryMesh()[patchi])) + { + field.boundaryFieldRef().set + ( + patchi, + PatchField::New + ( + calculatedFvPatchField::typeName, + mesh.boundary()[patchi], + field + ) + ); + } + else + { + typename Gfield::Patch& pf = field.boundaryFieldRef()[patchi]; + pf.autoMap(patchFieldResizeMapper(pf.patch().size())); + } - pf.autoMap(patchFieldResizeMapper(pf.patch().size())); - pf == NaN; + field.boundaryFieldRef()[patchi] == NaN; } field.instance() = field.time().timeName(); diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C index 14b97773e3..bf6fe21696 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,20 @@ void angularOscillatingDisplacementPointPatchVectorField::rmap } +void angularOscillatingDisplacementPointPatchVectorField::reset +( + const pointPatchField& ptf +) +{ + const angularOscillatingDisplacementPointPatchVectorField& aODptf = + refCast(ptf); + + fixedValuePointPatchField::reset(aODptf); + + p0_.reset(aODptf.p0_); +} + + void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H index d0b29a495e..38d859f697 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + // Evaluation functions diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C index 0d5fc275e6..5d40261589 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,20 @@ void angularOscillatingVelocityPointPatchVectorField::rmap } +void angularOscillatingVelocityPointPatchVectorField::reset +( + const pointPatchField& ptf +) +{ + const angularOscillatingVelocityPointPatchVectorField& aOVptf = + refCast(ptf); + + fixedValuePointPatchField::reset(aOVptf); + + p0_.reset(aOVptf.p0_); +} + + void angularOscillatingVelocityPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H index 9b10cdb374..6ee1f9e666 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingVelocity/angularOscillatingVelocityPointPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + // Evaluation functions diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C index cea5eacc1f..ae0d777627 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -136,6 +136,20 @@ void oscillatingVelocityPointPatchVectorField::rmap } +void oscillatingVelocityPointPatchVectorField::reset +( + const pointPatchField& ptf +) +{ + const oscillatingVelocityPointPatchVectorField& oVptf = + refCast(ptf); + + fixedValuePointPatchField::reset(oVptf); + + p0_.reset(oVptf.p0_); +} + + void oscillatingVelocityPointPatchVectorField::updateCoeffs() { if (this->updated()) diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H index eb417b7067..596d8246d4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -126,6 +126,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + // Evaluation functions diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index 59d0b26678..fc2af088ae 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -218,6 +218,27 @@ void Foam::timeVaryingMappedFixedValuePointPatchField::rmap } +template +void Foam::timeVaryingMappedFixedValuePointPatchField::reset +( + const pointPatchField& ptf +) +{ + fixedValuePointPatchField::reset(ptf); + + const timeVaryingMappedFixedValuePointPatchField& tiptf = + refCast>(ptf); + + startSampledValues_.reset(tiptf.startSampledValues_); + endSampledValues_.reset(tiptf.endSampledValues_); + + // Clear interpolator + mapperPtr_.clear(); + startSampleTime_ = -1; + endSampleTime_ = -1; +} + + template void Foam::timeVaryingMappedFixedValuePointPatchField::checkTable() { diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H index 6361640978..be6bdceda4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -175,6 +175,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + // Evaluation functions diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C index 838f2fdc4e..837fd26503 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -670,6 +670,99 @@ void Foam::genericFvPatchField::rmap } +template +void Foam::genericFvPatchField::reset +( + const fvPatchField& ptf +) +{ + calculatedFvPatchField::reset(ptf); + + const genericFvPatchField& dptf = + refCast>(ptf); + + forAllIter + ( + HashPtrTable, + scalarFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.scalarFields_.find(iter.key()); + + if (dptfIter != dptf.scalarFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + vectorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.vectorFields_.find(iter.key()); + + if (dptfIter != dptf.vectorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + sphericalTensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.sphericalTensorFields_.find(iter.key()); + + if (dptfIter != dptf.sphericalTensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + symmTensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.symmTensorFields_.find(iter.key()); + + if (dptfIter != dptf.symmTensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + tensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.tensorFields_.find(iter.key()); + + if (dptfIter != dptf.tensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } +} + + template Foam::tmp> Foam::genericFvPatchField::valueInternalCoeffs diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H index c628bbd0f6..4374e2865c 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,6 +137,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchField&); + // Evaluation functions diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C index e35b8fcc9a..31bb938355 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -557,6 +557,97 @@ void Foam::genericPointPatchField::rmap } +template +void Foam::genericPointPatchField::reset +( + const pointPatchField& ptf +) +{ + const genericPointPatchField& dptf = + refCast>(ptf); + + forAllIter + ( + HashPtrTable, + scalarFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.scalarFields_.find(iter.key()); + + if (dptfIter != scalarFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + vectorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.vectorFields_.find(iter.key()); + + if (dptfIter != vectorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + sphericalTensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.sphericalTensorFields_.find(iter.key()); + + if (dptfIter != sphericalTensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + symmTensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.symmTensorFields_.find(iter.key()); + + if (dptfIter != symmTensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } + + forAllIter + ( + HashPtrTable, + tensorFields_, + iter + ) + { + HashPtrTable::const_iterator dptfIter = + dptf.tensorFields_.find(iter.key()); + + if (dptfIter != tensorFields_.end()) + { + iter()->reset(*dptfIter()); + } + } +} + + template void Foam::genericPointPatchField::write(Ostream& os) const { diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H index d8c3554c4d..20576dd885 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -134,6 +134,10 @@ public: // Used to reconstruct fields virtual void rmap(const pointPatchField&, const labelList&); + //- Reset the pointPatchField to the given pointPatchField + // Used for mesh to mesh mapping + virtual void reset(const pointPatchField&); + //- Write virtual void write(Ostream&) const; diff --git a/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C index 88fdba15b8..599b66e404 100644 --- a/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,6 +137,16 @@ void Foam::MarshakRadiationFvPatchScalarField::rmap } +void Foam::MarshakRadiationFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + radiationCoupledBase::reset(ptf); +} + + void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.H b/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.H index aabde4548c..b279eff1c9 100644 --- a/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.H +++ b/src/radiationModels/derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -170,6 +170,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C index 32c1e9e612..691cff174c 100644 --- a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,20 @@ void Foam::MarshakRadiationFixedTemperatureFvPatchScalarField::rmap } +void Foam::MarshakRadiationFixedTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + radiationCoupledBase::reset(ptf); + const MarshakRadiationFixedTemperatureFvPatchScalarField& mrptf = + refCast(ptf); + + Trad_.reset(mrptf.Trad_); +} + + void Foam::MarshakRadiationFixedTemperatureFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.H b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.H index c533b9f408..160cf9a20e 100644 --- a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.H +++ b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,6 +174,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index efaaaef972..2e8d197c1c 100644 --- a/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,16 @@ void Foam::greyDiffusiveRadiationMixedFvPatchScalarField::rmap } +void Foam::greyDiffusiveRadiationMixedFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + radiationCoupledBase::reset(ptf); +} + + void Foam::greyDiffusiveRadiationMixedFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H b/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H index a9ceb32278..f710c340a7 100644 --- a/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H +++ b/src/radiationModels/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -172,6 +172,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index b2397131ae..e38690cc95 100644 --- a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,6 +137,21 @@ void Foam::greyDiffusiveViewFactorFixedValueFvPatchScalarField::rmap qro_.rmap(mrptf.qro_, addr); } + +void Foam::greyDiffusiveViewFactorFixedValueFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + radiationCoupledBase::reset(ptf); + const greyDiffusiveViewFactorFixedValueFvPatchScalarField& mrptf = + refCast(ptf); + + qro_.reset(mrptf.qro_); +} + + void Foam::greyDiffusiveViewFactorFixedValueFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H index 8e793742b7..ac994680c0 100644 --- a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H +++ b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,6 +167,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C index 4314b54805..dfc99d31e7 100644 --- a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C +++ b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -221,6 +221,18 @@ void Foam::radiationCoupledBase::rmap } +void Foam::radiationCoupledBase::reset +( + const fvPatchScalarField& ptf +) +{ + const radiationCoupledBase& mrptf = + refCast(ptf); + + emissivity_.reset(mrptf.emissivity_); +} + + void Foam::radiationCoupledBase::write(Ostream& os) const { writeEntry(os, "emissivityMode", emissivityMethodTypeNames_[method_]); diff --git a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H index 33dc2f255f..063a8c623c 100644 --- a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H +++ b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -150,6 +150,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Write void write(Ostream&) const; diff --git a/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index c2b58fa858..fe68ad4b80 100644 --- a/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -152,6 +152,16 @@ void Foam::wideBandDiffusiveRadiationMixedFvPatchScalarField::rmap } +void Foam::wideBandDiffusiveRadiationMixedFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + radiationCoupledBase::reset(ptf); +} + + void Foam::wideBandDiffusiveRadiationMixedFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H b/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H index 405cc8ee33..c12d0a6c28 100644 --- a/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H +++ b/src/radiationModels/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C index 62f256d55d..b79e9a05f3 100644 --- a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C +++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C @@ -354,6 +354,15 @@ void thermalBaffleFvPatchScalarField::rmap } +void thermalBaffleFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + turbulentTemperatureRadCoupledMixedFvPatchScalarField::reset(ptf); +} + + void thermalBaffleFvPatchScalarField::updateCoeffs() { if (this->updated()) diff --git a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H index 295e1f7d94..053fa04084 100644 --- a/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H +++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H @@ -265,6 +265,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C index 65970e88fe..bd7d1639d6 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -185,6 +185,20 @@ void Foam::specieTransferMassFractionFvPatchScalarField::rmap } +void Foam::specieTransferMassFractionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + mixedFvPatchScalarField::reset(ptf); + + const specieTransferMassFractionFvPatchScalarField& tiptf = + refCast(ptf); + + phiYp_.reset(tiptf.phiYp_); +} + + const Foam::scalarField& Foam::specieTransferMassFractionFvPatchScalarField::phiYp() const { diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H index 09dcaf2c81..7bc99a9685 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -164,6 +164,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C index 43122b9476..fedf6fa8bd 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,4 +122,21 @@ void Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::rmap } +void Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + calculatedFvPatchScalarField::reset(ptf); + + const gradientEnergyCalculatedTemperatureFvPatchScalarField& mptf = + refCast + ( + ptf + ); + + heGradient_.reset(mptf.heGradient_); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H index af534a9ac4..95cd03ea44 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,6 +154,10 @@ public: //- Reverse map the given fvPatchField onto this fvPatchField // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); }; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C index 9151d6767b..92ce3468fd 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,4 +131,20 @@ void Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::rmap } +void Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + calculatedFvPatchScalarField::reset(ptf); + + const mixedEnergyCalculatedTemperatureFvPatchScalarField& mptf = + refCast(ptf); + + heRefValue_.reset(mptf.heRefValue_); + heRefGrad_.reset(mptf.heRefGrad_); + heValueFraction_.reset(mptf.heValueFraction_); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H index 76c7592ae2..24423a96d1 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,6 +184,10 @@ public: //- Reverse map the given fvPatchField onto this fvPatchField // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); }; diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C b/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C index d5f1b8db89..7bc6edafc3 100644 --- a/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C +++ b/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,6 +122,20 @@ void Foam::alphaFixedPressureFvPatchScalarField::rmap } +void Foam::alphaFixedPressureFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + + const alphaFixedPressureFvPatchScalarField& tiptf = + refCast(ptf); + + p_.reset(tiptf.p_); +} + + void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs() { if (updated()) diff --git a/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H b/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H index ac8c7e7653..2bf8638111 100644 --- a/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H +++ b/src/twoPhaseModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,6 +142,10 @@ public: // Used to reconstruct fields virtual void rmap(const fvPatchScalarField&, const labelList&); + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + // Evaluation functions diff --git a/tutorials/incompressible/pimpleFoam/laminar/movingCone/Allrun-parallel b/tutorials/incompressible/pimpleFoam/laminar/movingCone/Allrun-parallel index 34b74c8d65..2c6afffef0 100755 --- a/tutorials/incompressible/pimpleFoam/laminar/movingCone/Allrun-parallel +++ b/tutorials/incompressible/pimpleFoam/laminar/movingCone/Allrun-parallel @@ -10,7 +10,7 @@ mapTimes="0.0015 0.003" for mapTime in $mapTimes; do runApplication -a blockMesh -dict blockMeshDict_$mapTime - runApplication -a decomposePar -force -noFields + runApplication -a decomposePar -force -noFields -dict decomposeParDict_$mapTime rm -rf constant/meshToMesh_$mapTime mkdir constant/meshToMesh_$mapTime diff --git a/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.0015 b/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.0015 new file mode 100644 index 0000000000..9a200b8a99 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.0015 @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (4 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.003 b/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.003 new file mode 100644 index 0000000000..32f6bb75e1 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/laminar/movingCone/system/decomposeParDict_0.003 @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (2 2 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* //