View Issue Details

IDProjectCategoryView StatusLast Update
0004188OpenFOAMBugpublic2024-12-13 16:54
Reportercgoessni Assigned Tohenry  
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0004188: reorderPatch reads and writes wrong mesh in case of -overwrite and -time N
DescriptionDue to a wrongly placed "timeSelector::readIfPresent", reorderPatch would read and write the wrong mesh instance (ie., time) if -overwrite and -time N options are present.
Steps To ReproduceIn tutorials/XiFluid/kivaTest, run:

#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# Get application name
application=$(getApplication)

runApplication kivaToFoam -file otape17

runApplication createEngineZones -cylinderHead -pistonBowl
runApplication topoSet

runApplication mkdir -p 10
runApplication cp -R constant/polyMesh 10

runApplication reorderPatches -overwrite -time 10 -patchOrder '(liner piston cylinderHead)'

#runApplication $application

#------------------------------------------------------------------------------

Observed behaviour: Instead of reading (and writing) into 10/polyMesh, it reads from and writes to constant, as seen by inspecting log.reorderPatches:

/*---------------------------------------------------------------------------*\
  ========= |
  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
   \\ / O peration | Website: https://openfoam.org
    \\ / A nd | Version: dev
     \\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : dev-fdcc43233437
Exec : reorderPatches -overwrite -time 10 -patchOrder (liner piston cylinderHead)
Date : Dec 13 2024
Time : 12:15:20
Host : "fvkmb176"
PID : 100143
I/O : uncollated
Case : /opt/OpenFOAM/OpenFOAM-dev/tutorials/XiFluid/kivaTest
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Selecting userTime engine
Create mesh for time = -180

Writing mesh to "constant"
End

Same issue is also present in v12
Additional InformationThe attached patch solves the issue for us.
TagsNo tags attached.

Activities

cgoessni

2024-12-13 11:18

reporter  

reorderPatches.C.diff (759 bytes)   
diff --git a/applications/utilities/mesh/manipulation/reorderPatches/reorderPatches.C b/applications/utilities/mesh/manipulation/reorderPatches/reorderPatches.C
index 177a032..bd23db9 100644
--- a/applications/utilities/mesh/manipulation/reorderPatches/reorderPatches.C
+++ b/applications/utilities/mesh/manipulation/reorderPatches/reorderPatches.C
@@ -206,11 +206,12 @@ int main(int argc, char *argv[])
     }
 
     #include "createTimeNoFunctionObjects.H"
-    #include "createSpecifiedMeshNoChangers.H"
 
     // Select time if specified
     timeSelector::selectIfPresent(runTime, args);
 
+    #include "createSpecifiedMeshNoChangers.H"
+
     const bool overwrite = args.optionFound("overwrite");
 
     const word oldInstance = mesh.pointsInstance();
reorderPatches.C.diff (759 bytes)   

henry

2024-12-13 16:54

manager   ~0013486

Resolved by commit 5af533b0b6f41b92384bf41eeb06ae09057a5013

Issue History

Date Modified Username Field Change
2024-12-13 11:18 cgoessni New Issue
2024-12-13 11:18 cgoessni File Added: reorderPatches.C.diff
2024-12-13 16:54 henry Assigned To => henry
2024-12-13 16:54 henry Status new => resolved
2024-12-13 16:54 henry Resolution open => fixed
2024-12-13 16:54 henry Fixed in Version => dev
2024-12-13 16:54 henry Note Added: 0013486