View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001732 | OpenFOAM | Bug | public | 2015-06-07 07:50 | 2016-01-17 12:22 |
Reporter | richard | Assigned To | henry | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux | OS | Ubuntu | OS Version | 14.04 |
Summary | 0001732: mapFields processor patches incorrectly mapped | ||||
Description | When mapping one decomposed case to another the processor patches are incorrectly mapped. There are two fail modes: 1. For a field that existed on the target processors before mapping, it's processor patches are not altered by mapFields (where they should be) 2. For a field that did not exist on the target processors before mapping, it's processor patches get zeros, very small numbers (~1e-300) or nan's This occurs in 2.3.x, 2.4.x (and in dev with mapFieldsPar) | ||||
Steps To Reproduce | 1. source case = run any case in parallel (e.g. interFoam/laminar/damBreak) 2. target case = decompose the same case but don't run the solver 3. mapFields from source to target in parallel with -consistent -sourceTime latestTime 4. compare source and target field processor patches There are automated PASS/FAIL tests in the attached script... | ||||
Tags | No tags attached. | ||||
|
mapFieldsPar_processorPatchTest (3,135 bytes)
#!/bin/sh cd ${0%/*} || exit 1 # run from this directory # 'source' case is interFoam laminar damBreak tutorial, run in parallel # 'target' case is interFoam laminar damBreak tutorial decomposed but not run # mapFieldsPar from source latestTime to target # processor boundaries on source and target are compared. # - p_rgh existed on the target before mapping, it's processor0to1 patch is tested # - p did not exist on the target before mapping, it's processor0to1 patch is tested # pass if patches are identical, fail if not. # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions red=$(tput setaf 1) green=$(tput setaf 2) reset=$(tput sgr0) extractPatch() { awk '$0 ~ /'"$1"'/,/}/ { print }' $2 } # MAIN if [ -d source ]; then printf "Source case already exists, no need to recreate.\n" else printf "Creating and running source case...\n" cp -r $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak source ( cd source runApplication blockMesh > /dev/null cp 0/alpha.water.org 0/alpha.water runApplication setFields > /dev/null runApplication decomposePar > /dev/null runParallel interFoam 4 > /dev/null ) fi printf "Creating target case\n" rm -rf target mkdir target cp -r source/[0cs]* target ( cd target runApplication decomposePar > /dev/null if [ "$WM_PROJECT_VERSION" = "dev" ]; then runParallel mapFieldsPar 4 -consistent -sourceTime latestTime ../source else runParallel mapFields 4 -consistent -sourceTime latestTime ../source fi ) printf "Testing processor patch mapping:\n" # test processor patch on a field that existed in target before mapping sourceDir="source/processor0/1" targetDir="target/processor0/0" sourceField="${sourceDir}/p_rgh" targetField="${targetDir}/p_rgh" sourcePatch=$(mktemp) targetPatch=$(mktemp) extractPatch procBoundary0to1 $sourceField > $sourcePatch extractPatch procBoundary0to1 $targetField > $targetPatch if ( diff $sourcePatch $targetPatch > /dev/null ); then printf "Pre-existing target field (p_rgh): ${green}PASS${reset}\n" else printf "Pre-existing target field (p_rgh): ${red}FAIL${reset} (see log.preExistingField)\n" printf "${sourceField}:\n\n" > log.preExistingField cat $sourcePatch >> log.preExistingField printf "\n\n${targetField}:\n\n" >> log.preExistingField cat $targetPatch >> log.preExistingField fi # test processor patch on a field that didn't exist in target before mapping sourceField="${sourceDir}/p" targetField="${targetDir}/p" extractPatch procBoundary0to1 $sourceField > $sourcePatch extractPatch procBoundary0to1 $targetField > $targetPatch if ( diff $sourcePatch $targetPatch > /dev/null ); then printf "NON pre-existing target field (p): ${green}PASS${reset}\n" else printf "NON pre-existing target field (p): ${red}FAIL${reset} (see log.nonPreExistingField)\n" printf "${sourceField}:\n\n" > log.nonPreExistingField cat $sourcePatch >> log.nonPreExistingField printf "\n\n${targetField}:\n\n" >> log.nonPreExistingField cat $targetPatch >> log.nonPreExistingField fi # clean up temp files rm $sourcePatch $targetPatch |
|
Does it work without -consistent? Have a full patchMap, empty cuttingPatches. |
|
Ah, yes it does. There are still slight differences between source and target processor patches but the behaviour is the same/similar to 2.2.x mapFields A note for others who read this, a full patchMap for the damBreak case means mapFieldsDict looks like: patchMap ( leftWall leftWall rightWall rightWall lowerWall lowerWall atmosphere atmosphere ); cuttingPatches (); Is this unavoidable? This behaviour is a little unexpected for users and it would be nice to remove a hoop they have to jump through. |
|
Agree. The processor patches are not cuttingPatches - they couple cells and should be evaluated instead. |
|
Does mapFields in OpenFOAM-dev work correctly? My understanding is that all these issues relate to the many bugs in the parallel version of mapFields (now named mapFieldPar in OpenFOAM-dev) and the reinstated serial mapFields does not suffer from them. |
|
Sorry for the delay. As far as I can test so far the reinstated serial mapFields behaves the same in dev as in 2.2.x. There is however IMO an unexpected behaviour: -parallelSource is incompatible with -consistent. If the target case is meant to be consistent with the source: do not use the consistent option and instead have an empty mapFieldsDict in the system directory. I've added a test script, parallelSourceConsistentTest. Perhaps I have made a contrived case though - parallel to serial shouldn't technically be consistent (?) and it is not guaranteed that two decomposed cases would have identical patch names on each processor (?) Possible fix: Test if both options are selected and output an error message to say they are incompatible. |
|
parallelSourceConsistentTest (1,613 bytes)
#!/bin/sh cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions rm -rf source target targetPar cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity source cd source cp $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak/system/decomposeParDict system/ runApplication blockMesh runApplication decomposePar runApplication icoFoam cd .. cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity target cd target runApplication blockMesh # parallelSource, serial target, consistent: fail runApplication mapFields -sourceTime latestTime -parallelSource -consistent ../source mv log.mapFields log.mapFields-fail # parallelSource, serial target, empty mapFieldsDict: pass cp $FOAM_TUTORIALS/incompressible/icoFoam/cavityGrade/system/mapFieldsDict system/ runApplication mapFields -sourceTime latestTime -parallelSource ../source mv log.mapFields log.mapFields-pass cd ../ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity targetPar cd targetPar cp $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak/system/decomposeParDict system/ runApplication blockMesh runApplication decomposePar # parallelSource, parallelTarget, consistent: fail runApplication mapFields -sourceTime latestTime -parallelSource -parallelTarget -consistent ../source mv log.mapFields log.mapFields-fail # parallelSource, parallelTarget, empty mapFieldsDict: pass cp $FOAM_TUTORIALS/incompressible/icoFoam/cavityGrade/system/mapFieldsDict system/ runApplication mapFields -sourceTime latestTime -parallelSource -parallelTarget ../source mv log.mapFields log.mapFields-pass |
|
Resolved by reinstating mapFields in OpenFOAM-dev |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-06-07 07:50 | richard | New Issue | |
2015-06-07 07:50 | richard | File Added: mapFieldsPar_processorPatchTest | |
2015-06-07 19:34 |
|
Note Added: 0004894 | |
2015-06-08 02:56 | richard | Note Added: 0004895 | |
2015-06-09 16:44 |
|
Note Added: 0004901 | |
2015-10-22 10:24 | henry | Note Added: 0005468 | |
2015-11-02 03:25 | richard | Note Added: 0005540 | |
2015-11-02 03:26 | richard | File Added: parallelSourceConsistentTest | |
2016-01-17 12:22 | henry | Note Added: 0005843 | |
2016-01-17 12:22 | henry | Status | new => resolved |
2016-01-17 12:22 | henry | Resolution | open => fixed |
2016-01-17 12:22 | henry | Assigned To | => henry |