mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: chtMultiRegionFoam: support for -dry-run. Fixes #2446
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
Copyright (C) 2017-2019,2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,6 +70,7 @@ int main(int argc, char *argv[])
|
|||||||
#define CREATE_MESH createMeshesPostProcess.H
|
#define CREATE_MESH createMeshesPostProcess.H
|
||||||
#include "postProcess.H"
|
#include "postProcess.H"
|
||||||
|
|
||||||
|
#include "addCheckCaseOptions.H"
|
||||||
#include "setRootCaseLists.H"
|
#include "setRootCaseLists.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMeshes.H"
|
#include "createMeshes.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
Copyright (C) 2017-2019,2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,6 +62,7 @@ int main(int argc, char *argv[])
|
|||||||
#define CREATE_MESH createMeshesPostProcess.H
|
#define CREATE_MESH createMeshesPostProcess.H
|
||||||
#include "postProcess.H"
|
#include "postProcess.H"
|
||||||
|
|
||||||
|
#include "addCheckCaseOptions.H"
|
||||||
#include "setRootCaseLists.H"
|
#include "setRootCaseLists.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMeshes.H"
|
#include "createMeshes.H"
|
||||||
|
|||||||
@ -4,21 +4,61 @@
|
|||||||
|
|
||||||
forAll(fluidNames, i)
|
forAll(fluidNames, i)
|
||||||
{
|
{
|
||||||
Info<< "Create fluid mesh for region " << fluidNames[i]
|
if (args.dryRun() || args.found("dry-run-write"))
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
{
|
||||||
|
Info
|
||||||
|
<< "Operating in 'dry-run' mode:"
|
||||||
|
<< " case will run for 1 time step. "
|
||||||
|
<< "All checks assumed OK on a clean exit" << endl;
|
||||||
|
|
||||||
fluidRegions.set
|
FieldBase::allowConstructFromLargerSize = true;
|
||||||
(
|
|
||||||
i,
|
// Create a simplified 1D mesh and attempt to re-create boundary
|
||||||
new fvMesh
|
// conditions
|
||||||
|
fluidRegions.set
|
||||||
(
|
(
|
||||||
IOobject
|
i,
|
||||||
|
new simplifiedMeshes::columnFvMesh(runTime, fluidNames[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
// Stop after 1 iteration of the simplified mesh
|
||||||
|
|
||||||
|
if (args.found("dry-run-write"))
|
||||||
|
{
|
||||||
|
// Using saWriteNow triggers function objects execute(), write()
|
||||||
|
runTime.stopAt(Time::saWriteNow);
|
||||||
|
|
||||||
|
// Make sure mesh gets output to the current time (since
|
||||||
|
// instance no longer constant)
|
||||||
|
fluidRegions[i].setInstance(runTime.timeName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Using saNoWriteNow triggers function objects execute(),
|
||||||
|
// but not write()
|
||||||
|
runTime.stopAt(Time::saNoWriteNow);
|
||||||
|
}
|
||||||
|
|
||||||
|
functionObject::outputPrefix = "postProcessing-dry-run";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Create fluid mesh for region " << fluidNames[i]
|
||||||
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
fluidRegions.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new fvMesh
|
||||||
(
|
(
|
||||||
fluidNames[i],
|
IOobject
|
||||||
runTime.timeName(),
|
(
|
||||||
runTime,
|
fluidNames[i],
|
||||||
IOobject::MUST_READ
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,6 +67,7 @@ int main(int argc, char *argv[])
|
|||||||
#define CREATE_MESH createMeshesPostProcess.H
|
#define CREATE_MESH createMeshesPostProcess.H
|
||||||
#include "postProcess.H"
|
#include "postProcess.H"
|
||||||
|
|
||||||
|
#include "addCheckCaseOptions.H"
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMeshes.H"
|
#include "createMeshes.H"
|
||||||
|
|||||||
@ -4,21 +4,61 @@
|
|||||||
|
|
||||||
forAll(fluidNames, i)
|
forAll(fluidNames, i)
|
||||||
{
|
{
|
||||||
Info<< "Create fluid mesh for region " << fluidNames[i]
|
if (args.dryRun() || args.found("dry-run-write"))
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
{
|
||||||
|
Info
|
||||||
|
<< "Operating in 'dry-run' mode:"
|
||||||
|
<< " case will run for 1 time step. "
|
||||||
|
<< "All checks assumed OK on a clean exit" << endl;
|
||||||
|
|
||||||
fluidRegions.set
|
FieldBase::allowConstructFromLargerSize = true;
|
||||||
(
|
|
||||||
i,
|
// Create a simplified 1D mesh and attempt to re-create boundary
|
||||||
new fvMesh
|
// conditions
|
||||||
|
fluidRegions.set
|
||||||
(
|
(
|
||||||
IOobject
|
i,
|
||||||
|
new simplifiedMeshes::columnFvMesh(runTime, fluidNames[i])
|
||||||
|
);
|
||||||
|
|
||||||
|
// Stop after 1 iteration of the simplified mesh
|
||||||
|
|
||||||
|
if (args.found("dry-run-write"))
|
||||||
|
{
|
||||||
|
// Using saWriteNow triggers function objects execute(), write()
|
||||||
|
runTime.stopAt(Time::saWriteNow);
|
||||||
|
|
||||||
|
// Make sure mesh gets output to the current time (since
|
||||||
|
// instance no longer constant)
|
||||||
|
fluidRegions[i].setInstance(runTime.timeName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Using saNoWriteNow triggers function objects execute(),
|
||||||
|
// but not write()
|
||||||
|
runTime.stopAt(Time::saNoWriteNow);
|
||||||
|
}
|
||||||
|
|
||||||
|
functionObject::outputPrefix = "postProcessing-dry-run";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Create fluid mesh for region " << fluidNames[i]
|
||||||
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
fluidRegions.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new fvMesh
|
||||||
(
|
(
|
||||||
fluidNames[i],
|
IOobject
|
||||||
runTime.timeName(),
|
(
|
||||||
runTime,
|
fluidNames[i],
|
||||||
IOobject::MUST_READ
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,26 +4,67 @@
|
|||||||
|
|
||||||
forAll(solidNames, i)
|
forAll(solidNames, i)
|
||||||
{
|
{
|
||||||
Info<< "Create solid mesh for region " << solidNames[i]
|
if (args.dryRun() || args.found("dry-run-write"))
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
{
|
||||||
|
Info
|
||||||
|
<< "Operating in 'dry-run' mode:"
|
||||||
|
<< " case will run for 1 time step. "
|
||||||
|
<< "All checks assumed OK on a clean exit" << endl;
|
||||||
|
|
||||||
solidRegions.set
|
FieldBase::allowConstructFromLargerSize = true;
|
||||||
(
|
|
||||||
i,
|
// Create a simplified 1D mesh and attempt to re-create boundary
|
||||||
new fvMesh
|
// conditions
|
||||||
|
solidRegions.set
|
||||||
(
|
(
|
||||||
IOobject
|
i,
|
||||||
(
|
new simplifiedMeshes::columnFvMesh(runTime, solidNames[i])
|
||||||
solidNames[i],
|
);
|
||||||
runTime.timeName(),
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Force calculation of geometric properties to prevent it being done
|
// Stop after 1 iteration of the simplified mesh
|
||||||
// later in e.g. some boundary evaluation
|
|
||||||
//(void)solidRegions[i].weights();
|
if (args.found("dry-run-write"))
|
||||||
//(void)solidRegions[i].deltaCoeffs();
|
{
|
||||||
|
// Using saWriteNow triggers function objects execute(), write()
|
||||||
|
runTime.stopAt(Time::saWriteNow);
|
||||||
|
|
||||||
|
// Make sure mesh gets output to the current time (since
|
||||||
|
// instance no longer constant)
|
||||||
|
solidRegions[i].setInstance(runTime.timeName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Using saNoWriteNow triggers function objects execute(),
|
||||||
|
// but not write()
|
||||||
|
runTime.stopAt(Time::saNoWriteNow);
|
||||||
|
}
|
||||||
|
|
||||||
|
functionObject::outputPrefix = "postProcessing-dry-run";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Create solid mesh for region " << solidNames[i]
|
||||||
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
solidRegions.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new fvMesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
solidNames[i],
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force calculation of geometric properties to prevent it being
|
||||||
|
// done
|
||||||
|
// later in e.g. some boundary evaluation
|
||||||
|
//(void)solidRegions[i].weights();
|
||||||
|
//(void)solidRegions[i].deltaCoeffs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user