From 19bdfa969f276ee3fcb033bf891aea23bf814414 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 12 Aug 2021 13:26:53 +0100 Subject: [PATCH] fvModels, fvConstraints: Update as a result of mesh motion --- .../VoFSolidificationMeltingSource.C | 7 ++++ .../VoFSolidificationMeltingSource.H | 3 ++ .../dynamicCode/codedFvModelTemplate.C | 12 ++++++ .../dynamicCode/codedFvModelTemplate.H | 9 +++++ src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C | 27 ++++++++++++-- src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H | 10 ++++- .../fixedTemperatureConstraint.C | 7 ++++ .../fixedTemperatureConstraint.H | 3 ++ .../fixedValueConstraint.C | 7 ++++ .../fixedValueConstraint.H | 3 ++ .../limitTemperature/limitTemperature.C | 7 ++++ .../limitTemperature/limitTemperature.H | 3 ++ .../limitVelocity/limitVelocity.C | 7 ++++ .../limitVelocity/limitVelocity.H | 3 ++ .../meanVelocityForce/meanVelocityForce.C | 7 ++++ .../meanVelocityForce/meanVelocityForce.H | 3 ++ .../accelerationSource/accelerationSource.C | 7 ++++ .../accelerationSource/accelerationSource.H | 3 ++ .../actuationDiskSource/actuationDiskSource.C | 7 ++++ .../actuationDiskSource/actuationDiskSource.H | 3 ++ .../effectivenessHeatExchangerSource.C | 7 ++++ .../effectivenessHeatExchangerSource.H | 3 ++ .../explicitPorositySource.C | 7 ++++ .../explicitPorositySource.H | 3 ++ src/fvModels/derived/heatSource/heatSource.C | 13 +++++++ src/fvModels/derived/heatSource/heatSource.H | 9 +++++ .../derived/heatTransfer/heatTransfer.C | 13 +++++++ .../derived/heatTransfer/heatTransfer.H | 9 +++++ src/fvModels/derived/massSource/massSource.C | 7 ++++ src/fvModels/derived/massSource/massSource.H | 3 ++ .../derived/rotorDiskSource/rotorDiskSource.C | 7 ++++ .../derived/rotorDiskSource/rotorDiskSource.H | 3 ++ .../solidificationMeltingSource.C | 7 ++++ .../solidificationMeltingSource.H | 3 ++ .../general/codedFvModel/codedFvModel.C | 10 +++-- .../general/codedFvModel/codedFvModel.H | 6 +-- .../semiImplicitSource/semiImplicitSource.C | 37 +++++++++++-------- .../semiImplicitSource/semiImplicitSource.H | 6 +-- 38 files changed, 261 insertions(+), 30 deletions(-) diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C index d0833a7cc9..701e3ed551 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C +++ b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C @@ -191,6 +191,13 @@ void Foam::fv::VoFSolidificationMeltingSource::updateMesh } +bool Foam::fv::VoFSolidificationMeltingSource::movePoints() +{ + set_.movePoints(); + return true; +} + + void Foam::fv::VoFSolidificationMeltingSource::correct() { if (debug) diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H index b77a604a93..0c3dad7bf1 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H +++ b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H @@ -193,6 +193,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Correct the model virtual void correct(); diff --git a/etc/codeTemplates/dynamicCode/codedFvModelTemplate.C b/etc/codeTemplates/dynamicCode/codedFvModelTemplate.C index 81428de119..db4f157308 100644 --- a/etc/codeTemplates/dynamicCode/codedFvModelTemplate.C +++ b/etc/codeTemplates/dynamicCode/codedFvModelTemplate.C @@ -179,6 +179,18 @@ void ${typeName}FvModel${SourceType}::addSup } +void ${typeName}FvModel${SourceType}::updateMesh(const mapPolyMesh& mpm) +{ + set_.updateMesh(mpm); +} + + +bool ${typeName}FvModel${SourceType}::movePoints() +{ + set_.movePoints(); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/etc/codeTemplates/dynamicCode/codedFvModelTemplate.H b/etc/codeTemplates/dynamicCode/codedFvModelTemplate.H index 1748c3510d..db75f4fe92 100644 --- a/etc/codeTemplates/dynamicCode/codedFvModelTemplate.H +++ b/etc/codeTemplates/dynamicCode/codedFvModelTemplate.H @@ -110,6 +110,15 @@ public: fvMatrix<${TemplateType}>& eqn, const word& fieldName ) const; + + + // Mesh motion + + //- Update for mesh changes + virtual void updateMesh(const mapPolyMesh&); + + //- Update for mesh motion + virtual bool movePoints(); }; diff --git a/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C b/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C index 2ac623ac88..3a4c370e97 100644 --- a/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C +++ b/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C @@ -49,7 +49,7 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::fvCellSet::setCellSet() +void Foam::fvCellSet::setCells() { Info<< incrIndent; @@ -119,7 +119,14 @@ void Foam::fvCellSet::setCellSet() } } - // Set volume information + Info<< decrIndent; +} + + +void Foam::fvCellSet::setV() +{ + Info<< incrIndent; + V_ = 0; forAll(cells_, i) { @@ -162,7 +169,18 @@ Foam::fvCellSet::~fvCellSet() void Foam::fvCellSet::updateMesh(const mapPolyMesh&) { - setCellSet(); + setCells(); + setV(); +} + + +void Foam::fvCellSet::movePoints() +{ + if (selectionMode_ == selectionModeType::points) + { + setCells(); + } + setV(); } @@ -202,7 +220,8 @@ bool Foam::fvCellSet::read(const dictionary& dict) } } - setCellSet(); + setCells(); + setV(); return true; } diff --git a/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H b/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H index 7df869fd88..6725f5fd5d 100644 --- a/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H +++ b/src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H @@ -122,8 +122,11 @@ private: //- Read the coefficients from the given dictionary void readCoeffs(const dictionary& dict); - //- Set the cell set based on the user input selection mode - void setCellSet(); + //- Set the cells + void setCells(); + + //- Set the sum of scalar volumes + void setV(); public: @@ -165,6 +168,9 @@ public: //- Update for mesh changes void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + void movePoints(); + // IO diff --git a/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.C b/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.C index 03e4388e83..3b3d03d574 100644 --- a/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.C +++ b/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.C @@ -162,6 +162,13 @@ void Foam::fv::fixedTemperatureConstraint::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::fixedTemperatureConstraint::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::fixedTemperatureConstraint::read(const dictionary& dict) { if (fvConstraint::read(dict)) diff --git a/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.H index c1cae424e7..d82ca482cb 100644 --- a/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.H +++ b/src/fvConstraints/fixedTemperatureConstraint/fixedTemperatureConstraint.H @@ -158,6 +158,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.C b/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.C index fd6beef6b8..31e9cece6f 100644 --- a/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.C +++ b/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.C @@ -126,6 +126,13 @@ void Foam::fv::fixedValueConstraint::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::fixedValueConstraint::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::fixedValueConstraint::read(const dictionary& dict) { if (fvConstraint::read(dict)) diff --git a/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.H b/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.H index 411f5ad93d..a18d4a38f2 100644 --- a/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.H +++ b/src/fvConstraints/fixedValueConstraint/fixedValueConstraint.H @@ -121,6 +121,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read source dictionary virtual bool read(const dictionary& dict); }; diff --git a/src/fvConstraints/limitTemperature/limitTemperature.C b/src/fvConstraints/limitTemperature/limitTemperature.C index 6da7894e61..98415b7539 100644 --- a/src/fvConstraints/limitTemperature/limitTemperature.C +++ b/src/fvConstraints/limitTemperature/limitTemperature.C @@ -148,6 +148,13 @@ void Foam::fv::limitTemperature::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::limitTemperature::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::limitTemperature::read(const dictionary& dict) { if (fvConstraint::read(dict)) diff --git a/src/fvConstraints/limitTemperature/limitTemperature.H b/src/fvConstraints/limitTemperature/limitTemperature.H index e5cd8b533c..db493398db 100644 --- a/src/fvConstraints/limitTemperature/limitTemperature.H +++ b/src/fvConstraints/limitTemperature/limitTemperature.H @@ -127,6 +127,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvConstraints/limitVelocity/limitVelocity.C b/src/fvConstraints/limitVelocity/limitVelocity.C index e68d001cbc..e1ab94a2ac 100644 --- a/src/fvConstraints/limitVelocity/limitVelocity.C +++ b/src/fvConstraints/limitVelocity/limitVelocity.C @@ -134,6 +134,13 @@ void Foam::fv::limitVelocity::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::limitVelocity::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::limitVelocity::read(const dictionary& dict) { if (fvConstraint::read(dict)) diff --git a/src/fvConstraints/limitVelocity/limitVelocity.H b/src/fvConstraints/limitVelocity/limitVelocity.H index dec7b4f807..ac963a49ea 100644 --- a/src/fvConstraints/limitVelocity/limitVelocity.H +++ b/src/fvConstraints/limitVelocity/limitVelocity.H @@ -121,6 +121,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvConstraints/meanVelocityForce/meanVelocityForce.C b/src/fvConstraints/meanVelocityForce/meanVelocityForce.C index 1a7fd81db2..2cf4e771da 100644 --- a/src/fvConstraints/meanVelocityForce/meanVelocityForce.C +++ b/src/fvConstraints/meanVelocityForce/meanVelocityForce.C @@ -254,6 +254,13 @@ void Foam::fv::meanVelocityForce::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::meanVelocityForce::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::meanVelocityForce::read(const dictionary& dict) { if (fvConstraint::read(dict)) diff --git a/src/fvConstraints/meanVelocityForce/meanVelocityForce.H b/src/fvConstraints/meanVelocityForce/meanVelocityForce.H index 8ccdbe7d37..1280d9971e 100644 --- a/src/fvConstraints/meanVelocityForce/meanVelocityForce.H +++ b/src/fvConstraints/meanVelocityForce/meanVelocityForce.H @@ -158,6 +158,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read source dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvModels/derived/accelerationSource/accelerationSource.C b/src/fvModels/derived/accelerationSource/accelerationSource.C index 4673348a87..1745281688 100644 --- a/src/fvModels/derived/accelerationSource/accelerationSource.C +++ b/src/fvModels/derived/accelerationSource/accelerationSource.C @@ -117,6 +117,13 @@ void Foam::fv::accelerationSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::accelerationSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::accelerationSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/accelerationSource/accelerationSource.H b/src/fvModels/derived/accelerationSource/accelerationSource.H index a201f686ca..192d9996ea 100644 --- a/src/fvModels/derived/accelerationSource/accelerationSource.H +++ b/src/fvModels/derived/accelerationSource/accelerationSource.H @@ -168,6 +168,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/derived/actuationDiskSource/actuationDiskSource.C b/src/fvModels/derived/actuationDiskSource/actuationDiskSource.C index 2b30b39155..cbe468cad3 100644 --- a/src/fvModels/derived/actuationDiskSource/actuationDiskSource.C +++ b/src/fvModels/derived/actuationDiskSource/actuationDiskSource.C @@ -175,6 +175,13 @@ void Foam::fv::actuationDiskSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::actuationDiskSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::actuationDiskSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/actuationDiskSource/actuationDiskSource.H b/src/fvModels/derived/actuationDiskSource/actuationDiskSource.H index c83e3a9237..4e8dd0cbd3 100644 --- a/src/fvModels/derived/actuationDiskSource/actuationDiskSource.H +++ b/src/fvModels/derived/actuationDiskSource/actuationDiskSource.H @@ -198,6 +198,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C b/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C index 0a4bd96d43..a9c6e998ff 100644 --- a/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C +++ b/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C @@ -320,6 +320,13 @@ void Foam::fv::effectivenessHeatExchangerSource::updateMesh } +bool Foam::fv::effectivenessHeatExchangerSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H b/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H index f25ea3129f..0eadf51494 100644 --- a/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H +++ b/src/fvModels/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H @@ -220,6 +220,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + //- Read dictionary virtual bool read(const dictionary& dict); diff --git a/src/fvModels/derived/explicitPorositySource/explicitPorositySource.C b/src/fvModels/derived/explicitPorositySource/explicitPorositySource.C index 01841042f0..1ba5347401 100644 --- a/src/fvModels/derived/explicitPorositySource/explicitPorositySource.C +++ b/src/fvModels/derived/explicitPorositySource/explicitPorositySource.C @@ -145,6 +145,13 @@ void Foam::fv::explicitPorositySource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::explicitPorositySource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::explicitPorositySource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/explicitPorositySource/explicitPorositySource.H b/src/fvModels/derived/explicitPorositySource/explicitPorositySource.H index e4931b16e1..db76b174b6 100644 --- a/src/fvModels/derived/explicitPorositySource/explicitPorositySource.H +++ b/src/fvModels/derived/explicitPorositySource/explicitPorositySource.H @@ -181,6 +181,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/derived/heatSource/heatSource.C b/src/fvModels/derived/heatSource/heatSource.C index 64f6216516..f97483b4ad 100644 --- a/src/fvModels/derived/heatSource/heatSource.C +++ b/src/fvModels/derived/heatSource/heatSource.C @@ -150,6 +150,19 @@ void Foam::fv::heatSource::addSup } +void Foam::fv::heatSource::updateMesh(const mapPolyMesh& mpm) +{ + set_.updateMesh(mpm); +} + + +bool Foam::fv::heatSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::heatSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/heatSource/heatSource.H b/src/fvModels/derived/heatSource/heatSource.H index 5080507b29..634d75734e 100644 --- a/src/fvModels/derived/heatSource/heatSource.H +++ b/src/fvModels/derived/heatSource/heatSource.H @@ -130,6 +130,15 @@ public: ) const; + // Mesh motion + + //- Update for mesh changes + virtual void updateMesh(const mapPolyMesh&); + + //- Update for mesh motion + virtual bool movePoints(); + + // IO //- Read dictionary diff --git a/src/fvModels/derived/heatTransfer/heatTransfer.C b/src/fvModels/derived/heatTransfer/heatTransfer.C index cc01408655..99ae7b703c 100644 --- a/src/fvModels/derived/heatTransfer/heatTransfer.C +++ b/src/fvModels/derived/heatTransfer/heatTransfer.C @@ -159,6 +159,19 @@ void Foam::fv::heatTransfer::correct() } +void Foam::fv::heatTransfer::updateMesh(const mapPolyMesh& mpm) +{ + set_.updateMesh(mpm); +} + + +bool Foam::fv::heatTransfer::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::heatTransfer::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/heatTransfer/heatTransfer.H b/src/fvModels/derived/heatTransfer/heatTransfer.H index 4267779801..52b4c40725 100644 --- a/src/fvModels/derived/heatTransfer/heatTransfer.H +++ b/src/fvModels/derived/heatTransfer/heatTransfer.H @@ -173,6 +173,15 @@ public: virtual void correct(); + // Mesh motion + + //- Update for mesh changes + virtual void updateMesh(const mapPolyMesh&); + + //- Update for mesh motion + virtual bool movePoints(); + + // IO //- Read dictionary diff --git a/src/fvModels/derived/massSource/massSource.C b/src/fvModels/derived/massSource/massSource.C index 5c31aee61d..ac9ec72510 100644 --- a/src/fvModels/derived/massSource/massSource.C +++ b/src/fvModels/derived/massSource/massSource.C @@ -300,6 +300,13 @@ void Foam::fv::massSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::massSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::massSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/massSource/massSource.H b/src/fvModels/derived/massSource/massSource.H index 547d5b24e7..4f0ca449a0 100644 --- a/src/fvModels/derived/massSource/massSource.H +++ b/src/fvModels/derived/massSource/massSource.H @@ -214,6 +214,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/derived/rotorDiskSource/rotorDiskSource.C b/src/fvModels/derived/rotorDiskSource/rotorDiskSource.C index 3e9817cab7..eee3eb922e 100644 --- a/src/fvModels/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvModels/derived/rotorDiskSource/rotorDiskSource.C @@ -636,6 +636,13 @@ void Foam::fv::rotorDiskSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::rotorDiskSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::rotorDiskSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/rotorDiskSource/rotorDiskSource.H b/src/fvModels/derived/rotorDiskSource/rotorDiskSource.H index a7d603b298..21662a9b0a 100644 --- a/src/fvModels/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvModels/derived/rotorDiskSource/rotorDiskSource.H @@ -341,6 +341,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.C b/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.C index 2c01a72c79..be277e0667 100644 --- a/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.C +++ b/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.C @@ -362,6 +362,13 @@ void Foam::fv::solidificationMeltingSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::solidificationMeltingSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::solidificationMeltingSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.H b/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.H index a5613f0758..21682003ec 100644 --- a/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.H +++ b/src/fvModels/derived/solidificationMeltingSource/solidificationMeltingSource.H @@ -307,6 +307,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/general/codedFvModel/codedFvModel.C b/src/fvModels/general/codedFvModel/codedFvModel.C index 61a8d11230..d50da55607 100644 --- a/src/fvModels/general/codedFvModel/codedFvModel.C +++ b/src/fvModels/general/codedFvModel/codedFvModel.C @@ -233,7 +233,6 @@ Foam::fv::codedFvModel::codedFvModel ) : fvModel(name, modelType, dict, mesh), - set_(coeffs(), mesh), fieldName_(word::null) { readCoeffs(); @@ -259,7 +258,13 @@ FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_ALPHA_RHO_SUP, fv::codedFvModel); void Foam::fv::codedFvModel::updateMesh(const mapPolyMesh& mpm) { - set_.updateMesh(mpm); + redirectFvModel().updateMesh(mpm); +} + + +bool Foam::fv::codedFvModel::movePoints() +{ + return redirectFvModel().movePoints(); } @@ -267,7 +272,6 @@ bool Foam::fv::codedFvModel::read(const dictionary& dict) { if (fvModel::read(dict)) { - set_.read(coeffs()); readCoeffs(); return true; } diff --git a/src/fvModels/general/codedFvModel/codedFvModel.H b/src/fvModels/general/codedFvModel/codedFvModel.H index 7deae0e5d2..ca4b68f523 100644 --- a/src/fvModels/general/codedFvModel/codedFvModel.H +++ b/src/fvModels/general/codedFvModel/codedFvModel.H @@ -94,9 +94,6 @@ class codedFvModel { // Private data - //- The set of cells the fvConstraint applies to - fvCellSet set_; - //- The name of the field that this fvModel applies to word fieldName_; @@ -208,6 +205,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO diff --git a/src/fvModels/general/semiImplicitSource/semiImplicitSource.C b/src/fvModels/general/semiImplicitSource/semiImplicitSource.C index 367900a223..38e5420c0c 100644 --- a/src/fvModels/general/semiImplicitSource/semiImplicitSource.C +++ b/src/fvModels/general/semiImplicitSource/semiImplicitSource.C @@ -64,17 +64,6 @@ void Foam::fv::semiImplicitSource::readCoeffs() // Get the volume mode volumeMode_ = volumeModeNames_.read(coeffs().lookup("volumeMode")); - // Set volume normalisation - switch (volumeMode_) - { - case volumeMode::absolute: - VDash_ = set_.V(); - break; - case volumeMode::specific: - VDash_ = 1; - break; - } - // Set field source terms fieldSp_.clear(); fieldSu_.clear(); @@ -142,9 +131,21 @@ void Foam::fv::semiImplicitSource::addSupType false ); + // Set volume normalisation + scalar VDash = NaN; + switch (volumeMode_) + { + case volumeMode::absolute: + VDash = set_.V(); + break; + case volumeMode::specific: + VDash = 1; + break; + } + // Explicit source function for the field UIndirectList(Su, set_.cells()) = - fieldSu_[fieldName]->value(t)/VDash_; + fieldSu_[fieldName]->value(t)/VDash; volScalarField::Internal Sp ( @@ -168,7 +169,7 @@ void Foam::fv::semiImplicitSource::addSupType // Implicit source function for the field UIndirectList(Sp, set_.cells()) = - fieldSp_[fieldName]->value(t)/VDash_; + fieldSp_[fieldName]->value(t)/VDash; eqn += Su + fvm::SuSp(Sp, psi); } @@ -211,8 +212,7 @@ Foam::fv::semiImplicitSource::semiImplicitSource : fvModel(name, modelType, dict, mesh), set_(coeffs(), mesh), - volumeMode_(volumeMode::absolute), - VDash_(1) + volumeMode_(volumeMode::absolute) { readCoeffs(); } @@ -251,6 +251,13 @@ void Foam::fv::semiImplicitSource::updateMesh(const mapPolyMesh& mpm) } +bool Foam::fv::semiImplicitSource::movePoints() +{ + set_.movePoints(); + return true; +} + + bool Foam::fv::semiImplicitSource::read(const dictionary& dict) { if (fvModel::read(dict)) diff --git a/src/fvModels/general/semiImplicitSource/semiImplicitSource.H b/src/fvModels/general/semiImplicitSource/semiImplicitSource.H index db020caca4..96e59603fb 100644 --- a/src/fvModels/general/semiImplicitSource/semiImplicitSource.H +++ b/src/fvModels/general/semiImplicitSource/semiImplicitSource.H @@ -137,9 +137,6 @@ private: //- Volume mode volumeMode volumeMode_; - //- Volume normalisation - scalar VDash_; - //- Explicit parts of the sources HashPtrTable fieldSu_; @@ -226,6 +223,9 @@ public: //- Update for mesh changes virtual void updateMesh(const mapPolyMesh&); + //- Update for mesh motion + virtual bool movePoints(); + // IO