ENH: createPatch: late adding patchfields. Fixes #3410

Thanks to Alexey Matveichev
This commit is contained in:
mattijs
2025-08-18 13:36:50 +01:00
parent 45f34f558b
commit 14b68a7f05

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2024 OpenCFD Ltd.
Copyright (C) 2016-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1476,14 +1476,11 @@ int main(int argc, char *argv[])
{
++runTime;
}
else
{
forAll(meshes, meshi)
{
fvMesh& mesh = meshes[meshi];
mesh.setInstance(oldInstances[meshi]);
}
forAll(meshes, meshi)
{
fvMesh& mesh = meshes[meshi];
mesh.setInstance(overwrite ? oldInstances[meshi] : runTime.timeName());
}
// More precision (for points data)
@ -1493,6 +1490,21 @@ int main(int argc, char *argv[])
forAll(meshes, meshi)
{
fvMesh& mesh = meshes[meshi];
// Override bcs with explicitly provided info. Done late so there
// are already patch faces
forAll(patchInfoDicts[meshi], sourcei)
{
const dictionary& patchDict = patchInfoDicts[meshi][sourcei];
const word& patchName = patchNames[meshi][sourcei];
const label patchID = mesh.boundary().findPatchID(patchName);
if (patchID != -1 && patchDict.found("patchFields"))
{
const dictionary& pfd = patchDict.subDict("patchFields");
fvMeshTools::setPatchFields(mesh, patchID, pfd);
}
}
Info<< "\n\nWriting repatched mesh " << mesh.name()
<< " to " << runTime.timeName() << nl << endl;
mesh.clearOut(); // remove meshPhi