ENH: solidFoam: allow time-step control. Fixes #2415.

This commit is contained in:
mattijs
2022-04-07 13:56:54 +01:00
parent ecf8d260c4
commit 6dac06dd38
8 changed files with 92 additions and 4 deletions

View File

@ -1,3 +1,4 @@
solidRegionDiffNo.C
solidFoam.C
EXE = $(FOAM_APPBIN)/solidFoam

View File

@ -1,4 +1,6 @@
EXE_INC = \
-I../chtMultiRegionFoam/include \
-I../chtMultiRegionFoam/solid \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
CourantNo
Description
Dummy (fluid) Courant number.
\*---------------------------------------------------------------------------*/
scalar CoNum = 0.0;
// ************************************************************************* //

View File

@ -0,0 +1,31 @@
scalar DiNum = -GREAT;
{
tmp<volScalarField> magKappa;
if (thermo.isotropic())
{
magKappa = thermo.kappa();
}
else
{
magKappa = mag(thermo.Kappa());
}
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = max
(
solidRegionDiffNo
(
mesh,
runTime,
rho*cp,
magKappa()
),
DiNum
);
}

View File

@ -41,6 +41,8 @@ Description
#include "fvOptions.H"
#include "simpleControl.H"
#include "pimpleControl.H"
#include "dummyCourantNo.H"
#include "solidRegionDiffNo.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,17 +90,31 @@ int main(int argc, char *argv[])
{
pimpleControl pimple(mesh);
#include "createDyMControls.H"
while (runTime.run())
{
#include "readDyMControls.H"
#include "readSolidTimeControls.H"
#include "solidDiffusionNo.H"
#include "setMultiRegionDeltaT.H"
++runTime;
Info<< "Time = " << runTime.timeName() << nl << endl;
while (pimple.loop())
{
if (pimple.firstIter())
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
mesh.update();
// Do any mesh changes
mesh.controlledUpdate();
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
while (pimple.correct())

View File

@ -0,0 +1 @@
../chtMultiRegionFoam/solid/solidRegionDiffNo.C

View File

@ -0,0 +1 @@
../chtMultiRegionFoam/solid/solidRegionDiffNo.H