diff --git a/CfdOF/CfdPreferencePage.py b/CfdOF/CfdPreferencePage.py index 13fa9c2d..28801dbe 100644 --- a/CfdOF/CfdPreferencePage.py +++ b/CfdOF/CfdPreferencePage.py @@ -48,10 +48,10 @@ # Constants OPENFOAM_URL = \ - "https://sourceforge.net/projects/openfoam/files/v2012/OpenCFD-OpenFOAM-v2012-DP-mingw-crosscompiled-WindowsInstaller.exe/download" + "https://sourceforge.net/projects/openfoam/files/v2206/OpenFOAM-v2206-windows-mingw.exe/download" OPENFOAM_FILE_EXT = ".exe" PARAVIEW_URL = \ - "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.5&type=binary&os=Windows&downloadFile=ParaView-5.5.2-Qt5-Windows-64bit.exe" + "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.10&type=binary&os=Windows&downloadFile=ParaView-5.10.1-Windows-Python3.9-msvc2017-AMD64.exe" PARAVIEW_FILE_EXT = ".exe" CFMESH_URL = \ "https://sourceforge.net/projects/cfmesh-cfdof/files/cfmesh-cfdof.zip/download" diff --git a/CfdOF/CfdTools.py b/CfdOF/CfdTools.py index 7c1143f4..c3a58af4 100644 --- a/CfdOF/CfdTools.py +++ b/CfdOF/CfdTools.py @@ -724,6 +724,8 @@ def makeRunCommand(cmd, dir, source_env=True): if installation_path is None: raise IOError("OpenFOAM installation directory not found") + FreeCAD.Console.PrintMessage('Executing: {} in {}\n'.format(cmd, dir)) + source = "" if source_env and len(installation_path): env_setup_script = "{}/etc/bashrc".format(installation_path) @@ -981,9 +983,9 @@ def checkCfdDependencies(): foam_ver = foam_ver.lstrip('v') foam_ver = int(foam_ver.split('.')[0]) if getFoamRuntime() == "MinGW": - if foam_ver != 2012: - vermsg = "OpenFOAM version " + str(foam_ver) + " is not supported:\n" + \ - "Only version 2012 supported for MinGW installation" + if foam_ver < 2012 or foam_ver > 2206: + vermsg = "OpenFOAM version " + str(foam_ver) + \ + " is not currently supported with MinGW installation" message += vermsg + "\n" print(vermsg) if foam_ver >= 1000: # Plus version @@ -992,9 +994,9 @@ def checkCfdDependencies(): "Minimum version 1706 or 5 required" message += vermsg + "\n" print(vermsg) - if foam_ver > 2112: + if foam_ver > 2206: vermsg = "OpenFOAM version " + str(foam_ver) + " is not yet supported:\n" + \ - "Last tested version is 2112" + "Last tested version is 2206" message += vermsg + "\n" print(vermsg) else: # Foundation version @@ -1633,6 +1635,7 @@ def enableLayoutRows(layout, selected_rows): if isinstance(item, QtGui.QWidgetItem): item.widget().setVisible(selected_rows is None or rowi in selected_rows) + def clearCase(case_path, backup_path=None): """ Remove and recreate contents of the case directory, optionally backing up @@ -1648,9 +1651,12 @@ def clearCase(case_path, backup_path=None): else: if entry.is_dir(): shutil.rmtree(entry.path) + else: + os.remove(entry.path) else: os.makedirs(case_path) # mkdir -p + def executeMacro(macro_name): macro_contents = "import FreeCAD\nimport FreeCADGui\nimport FreeCAD as App\nimport FreeCADGui as Gui\n" macro_contents += open(macro_name).read() diff --git a/CfdOF/Mesh/CfdMesh.py b/CfdOF/Mesh/CfdMesh.py index 4da35ade..e5445483 100644 --- a/CfdOF/Mesh/CfdMesh.py +++ b/CfdOF/Mesh/CfdMesh.py @@ -96,7 +96,7 @@ def initProperties(self, obj): "Name of directory in which the mesh is created") # Setup and utility - addObjectProperty(obj, 'STLRelativeLinearDeflection', 1, "App::PropertyFloat", "Surface triangulation", + addObjectProperty(obj, 'STLRelativeLinearDeflection', 0.001, "App::PropertyFloat", "Surface triangulation", "Maximum relative linear deflection for built-in surface triangulation") addObjectProperty(obj, 'STLAngularMeshDensity', 100, "App::PropertyFloat", "Surface triangulation", "Mesh elements per 360 degrees for surface triangulation with GMSH") diff --git a/CfdOF/Mesh/CfdMeshTools.py b/CfdOF/Mesh/CfdMeshTools.py index e6fdd1b2..a5dbd70e 100644 --- a/CfdOF/Mesh/CfdMeshTools.py +++ b/CfdOF/Mesh/CfdMeshTools.py @@ -147,7 +147,7 @@ def processExtrusions(self): raise RuntimeError("Extrusion patch for '{}' could not be found in the shape being meshed.".format( extrusion_obj.Label)) this_extrusion_settings['FrontFaceList'] = tuple(efl) - this_extrusion_settings['BackFace'] = efl[0]+'_back' + this_extrusion_settings['BackFace'] = efl[0] this_extrusion_settings['Distance'] = extrusion_obj.ExtrusionThickness.getValueAs('m') this_extrusion_settings['Angle'] = extrusion_obj.ExtrusionAngle.getValueAs('deg') diff --git a/CfdOF/Mesh/TaskPanelCfdMesh.py b/CfdOF/Mesh/TaskPanelCfdMesh.py index dc080800..239bab80 100644 --- a/CfdOF/Mesh/TaskPanelCfdMesh.py +++ b/CfdOF/Mesh/TaskPanelCfdMesh.py @@ -251,7 +251,6 @@ def checkMeshClicked(self): FreeCADGui.doCommand("proxy.cart_mesh = cart_mesh") FreeCADGui.doCommand("cart_mesh.error = False") FreeCADGui.doCommand("cmd = CfdTools.makeRunCommand('checkMesh', cart_mesh.meshCaseDir)") - FreeCADGui.doCommand("FreeCAD.Console.PrintMessage('Executing: ' + ' '.join(cmd) + '\\n')") FreeCADGui.doCommand("env_vars = CfdTools.getRunEnvironment()") FreeCADGui.doCommand("proxy.running_from_macro = True") self.mesh_obj.Proxy.running_from_macro = False @@ -313,7 +312,6 @@ def runMesh(self): FreeCADGui.doCommand("proxy.cart_mesh = cart_mesh") FreeCADGui.doCommand("cart_mesh.error = False") FreeCADGui.doCommand("cmd = CfdTools.makeRunCommand('./Allmesh', cart_mesh.meshCaseDir, source_env=False)") - FreeCADGui.doCommand("FreeCAD.Console.PrintMessage('Executing: ' + ' '.join(cmd) + '\\n')") FreeCADGui.doCommand("env_vars = CfdTools.getRunEnvironment()") FreeCADGui.doCommand("proxy.running_from_macro = True") self.mesh_obj.Proxy.running_from_macro = False diff --git a/CfdOF/Solve/CfdCaseWriterFoam.py b/CfdOF/Solve/CfdCaseWriterFoam.py index b9e7d1da..91aaab5b 100644 --- a/CfdOF/Solve/CfdCaseWriterFoam.py +++ b/CfdOF/Solve/CfdCaseWriterFoam.py @@ -124,15 +124,15 @@ def writeCase(self): self.processInitialisationZoneProperties() if self.reporting_functions: - cfdMessage(f'Reporting functions present') + cfdMessage('Reporting functions present') self.processReportingFunctions() if self.scalar_transport_objs: - cfdMessage(f'Scalar transport functions present') + cfdMessage('Scalar transport functions present') self.processScalarTransportFunctions() if self.dynamic_mesh_refinement_obj: - cfdMessage(f'Dynamic mesh adaptation rule present') + cfdMessage('Dynamic mesh adaptation rule present') self.processDynamicMeshRefinement() self.settings['createPatchesFromSnappyBaffles'] = False @@ -745,19 +745,11 @@ def setupPatchNames(self): 'PatchNamesList': '"patch_.*_'+str(mr_id+1)+'"', 'PatchType': "empty" } - settings['createPatches'][mr_obj.Label+'BackFace'] = { - 'PatchNamesList': '"patch_.*_'+str(mr_id+1)+'_back"', - 'PatchType': "empty" - } elif mr_obj.Extrusion and mr_obj.ExtrusionType == "2DWedge": settings['createPatches'][mr_obj.Label] = { 'PatchNamesList': '"patch_.*_'+str(mr_id+1)+'"', 'PatchType': "symmetry" } - settings['createPatches'][mr_obj.Label+'BackFace'] = { - 'PatchNamesList': '"patch_.*_'+str(mr_id+1)+'_back"', - 'PatchType': "symmetry" - } else: # Add others to default faces list settings['createPatches']['defaultFaces']['PatchNamesList'] += ' "patch_0_'+str(mr_id+1) + '"' diff --git a/CfdOF/Solve/CfdRunnableFoam.py b/CfdOF/Solve/CfdRunnableFoam.py index 9560bbc5..ab398fa1 100644 --- a/CfdOF/Solve/CfdRunnableFoam.py +++ b/CfdOF/Solve/CfdRunnableFoam.py @@ -148,7 +148,6 @@ def get_solver_cmd(self, case_dir): # Environment is sourced in run script, so no need to include in run command cmd = CfdTools.makeRunCommand('./Allrun', case_dir, source_env=False) - FreeCAD.Console.PrintMessage("Solver run command: " + ' '.join(cmd) + "\n") return cmd def getRunEnvironment(self): @@ -273,9 +272,9 @@ def process_output(self, text): # Force coefficient monitors if self.in_forcecoeffs_section: fc = self.force_coeffs[self.in_forcecoeffs_section] - if "Cd" in split and self.niter-1 > len(fc['cdCoeffs']): + if (("Cd" in split) or ("Cd:" in split)) and self.niter-1 > len(fc['cdCoeffs']): fc['cdCoeffs'].append(float(split[2])) - if "Cl" in split and self.niter-1 > len(fc['clCoeffs']): + if (("Cl" in split) or ("Cl:" in split)) and self.niter-1 > len(fc['clCoeffs']): fc['clCoeffs'].append(float(split[2])) # Update plots diff --git a/CfdOF/Solve/TaskPanelCfdSolverControl.py b/CfdOF/Solve/TaskPanelCfdSolverControl.py index d0f55344..1b4c345a 100644 --- a/CfdOF/Solve/TaskPanelCfdSolverControl.py +++ b/CfdOF/Solve/TaskPanelCfdSolverControl.py @@ -201,7 +201,6 @@ def runSolverProcess(self): cart_mesh.error = False cmd = CfdTools.makeRunCommand('./Allmesh', cart_mesh.meshCaseDir, source_env=False) - FreeCAD.Console.PrintMessage('Executing: ' + ' '.join(cmd) + '\\n') env_vars = CfdTools.getRunEnvironment() self.solver_object.Proxy.solver_process.start(cmd, env_vars=env_vars) if self.solver_object.Proxy.solver_process.waitForStarted(): @@ -233,7 +232,6 @@ def runSolverProcess(self): " import CfdRunnableFoam\n" + " solver_runner = CfdRunnableFoam.CfdRunnableFoam(analysis_object, solver_object)\n" + " cmd = solver_runner.get_solver_cmd(solver_directory)\n" + - " FreeCAD.Console.PrintMessage(' '.join(cmd) + '\\n')\n" + " env_vars = solver_runner.getRunEnvironment()\n" + " solver_process = CfdConsoleProcess.CfdConsoleProcess(stdout_hook=solver_runner.process_output)\n" + " solver_process.start(cmd, env_vars=env_vars)\n" + @@ -242,7 +240,6 @@ def runSolverProcess(self): case_name = self.solver_object.InputCaseName solver_directory = os.path.abspath(os.path.join(working_dir, case_name)) cmd = self.solver_runner.get_solver_cmd(solver_directory) - FreeCAD.Console.PrintMessage(' '.join(cmd) + '\\n') env_vars = self.solver_runner.getRunEnvironment() self.solver_object.Proxy.solver_process = CfdConsoleProcess(finished_hook=self.solverFinished, stdout_hook=self.gotOutputLines, diff --git a/Data/Templates/case/Allrun b/Data/Templates/case/Allrun index 7b518952..f4aca11d 100644 --- a/Data/Templates/case/Allrun +++ b/Data/Templates/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -26,7 +39,7 @@ fi MESHDIR="%(meshDir%)" if [ -f "$MESHDIR"/constant/polyMesh/faces ] then - rm -r constant/polyMesh 2> /dev/null + rm -rf constant/polyMesh cp -r "$MESHDIR"/constant/polyMesh constant/polyMesh elif [ ! -f constant/polyMesh/faces ] then @@ -90,8 +103,11 @@ PNAME=p # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np %(solver/ParallelCores%) renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite %{%(initialValues/PotentialFlow%) %:True @@ -99,24 +115,24 @@ runCommand mpiexec -np %(solver/ParallelCores%) renumberMesh -parallel -overwrit %{%(bafflesPresent%) %:True # Baffle BC does not work with potentialFoam; do not initialise p -runCommand mpiexec -np %(solver/ParallelCores%) potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME %:default %{%(initialValues/PotentialFlowP%) %:True -runCommand mpiexec -np %(solver/ParallelCores%) potentialFoam -parallel -initialiseUBCs -pName $PNAME -writep +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME -writep %:default -runCommand mpiexec -np %(solver/ParallelCores%) potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME %} %} %{%(solver/SolverName%) %:buoyantSimpleFoam buoyantPimpleFoam interFoam multiphaseInterFoam # Remove phi with wrong units -rm processor*/0/phi +rm -f processor*/0/phi %} %} # Run application in parallel -runCommand mpiexec -np %(solver/ParallelCores%) %(solver/SolverName%) -parallel +runParallel $NPROC %(solver/SolverName%) %:False # Mesh renumbering runCommand renumberMesh -overwrite @@ -139,7 +155,7 @@ runCommand potentialFoam -initialiseUBCs -pName $PNAME %{%(solver/SolverName%) %:buoyantSimpleFoam buoyantPimpleFoam interFoam multiphaseInterFoam # Remove phi with wrong units -rm 0/phi +rm -f 0/phi %} %} diff --git a/Data/Templates/case/pvScript.py b/Data/Templates/case/pvScript.py index d09e214b..ee433fd5 100644 --- a/Data/Templates/case/pvScript.py +++ b/Data/Templates/case/pvScript.py @@ -16,19 +16,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -42,7 +49,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/Templates/case/system/fvSchemes b/Data/Templates/case/system/fvSchemes index 78d3bffe..e3b060e7 100644 --- a/Data/Templates/case/system/fvSchemes +++ b/Data/Templates/case/system/fvSchemes @@ -115,7 +115,7 @@ divSchemes %{%(physics/Turbulence%) %:DES LES div(phi,U) Gauss LUST grad(U); - div(phi,h) Gauss LUST grad(U); + div(phi,h) Gauss LUST grad(h); div(phi,K) Gauss LUST grad(K); %:default div(phi,U) Gauss linearUpwindV grad(U); diff --git a/Data/Templates/mesh/Allmesh b/Data/Templates/mesh/Allmesh index e97276fc..e979def7 100644 --- a/Data/Templates/mesh/Allmesh +++ b/Data/Templates/mesh/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -34,6 +47,12 @@ then source "$FOAMDIR/etc/bashrc" fi +%{%(ParallelMesh%) +%:True +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + +%} %{%(MeshUtility%) %:cfMesh # Extract feature edges @@ -49,7 +68,7 @@ export OMP_NUM_THREADS=%(NumberOfThreads%) %} runCommand preparePar export MPI_BUFFER_SIZE=200000000 -runCommand mpiexec -np %(NumberOfProcesses%) cartesianMesh -parallel +runParallel $NPROC cartesianMesh runCommand reconstructParMesh -constant -fullMatch %:False %{%(NumberOfThreads%) @@ -74,7 +93,7 @@ fi %{%(ParallelMesh%) %:True runCommand decomposePar -runCommand mpiexec -np %(NumberOfProcesses%) snappyHexMesh -overwrite -parallel +runParallel $NPROC snappyHexMesh -overwrite runCommand reconstructParMesh -constant %:False runCommand snappyHexMesh -overwrite @@ -98,10 +117,13 @@ fi %{%(ExtrusionSettings/ExtrusionsPresent%) %:True -# Create extrusions -runCommand createPatch -overwrite %{%(ExtrusionSettings/Extrusions%) cp system/extrudeMeshDict.%(0%) system/extrudeMeshDict +%{%(ExtrusionSettings/Extrusions/%(0%)/KeepExistingMesh%) +%:False +# Refinement history is not processed by extrudeMesh +rm -f constant/polyMesh/{cellLevel,pointLevel,level0Edge,refinementHistory} +%} runCommand extrudeMesh mv log.extrudeMesh log.extrudeMesh.%(0%) rm system/extrudeMeshDict diff --git a/Data/TestFiles/cases/DamBreak3D/case/Allrun b/Data/TestFiles/cases/DamBreak3D/case/Allrun index aabf291f..76d5ecb5 100755 --- a/Data/TestFiles/cases/DamBreak3D/case/Allrun +++ b/Data/TestFiles/cases/DamBreak3D/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -51,9 +64,12 @@ runCommand setFields # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Run application in parallel -runCommand mpiexec -np 4 interFoam -parallel +runParallel $NPROC interFoam diff --git a/Data/TestFiles/cases/DamBreak3D/case/pvScript.py b/Data/TestFiles/cases/DamBreak3D/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/DamBreak3D/case/pvScript.py +++ b/Data/TestFiles/cases/DamBreak3D/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/DamBreak3D/meshCase/Allmesh b/Data/TestFiles/cases/DamBreak3D/meshCase/Allmesh index 89649909..9a2c0a4c 100755 --- a/Data/TestFiles/cases/DamBreak3D/meshCase/Allmesh +++ b/Data/TestFiles/cases/DamBreak3D/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,13 +25,16 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null source "$FOAMDIR/etc/bashrc" fi +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + runCommand blockMesh # Extract feature edges @@ -31,7 +47,7 @@ else fi runCommand decomposePar -runCommand mpiexec -np 4 snappyHexMesh -overwrite -parallel +runParallel $NPROC snappyHexMesh -overwrite runCommand reconstructParMesh -constant # Extract surface mesh and convert to mm for visualisation in FreeCAD diff --git a/Data/TestFiles/cases/Duct/case/Allrun b/Data/TestFiles/cases/Duct/case/Allrun index 18417c04..97a9b0f0 100755 --- a/Data/TestFiles/cases/Duct/case/Allrun +++ b/Data/TestFiles/cases/Duct/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -50,13 +63,16 @@ PNAME=p # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Initialise flow # Baffle BC does not work with potentialFoam; do not initialise p -runCommand mpiexec -np 4 potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME # Run application in parallel -runCommand mpiexec -np 4 porousSimpleFoam -parallel +runParallel $NPROC porousSimpleFoam diff --git a/Data/TestFiles/cases/Duct/case/pvScript.py b/Data/TestFiles/cases/Duct/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/Duct/case/pvScript.py +++ b/Data/TestFiles/cases/Duct/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/Duct/meshCase/Allmesh b/Data/TestFiles/cases/Duct/meshCase/Allmesh index d4d45400..4647760b 100755 --- a/Data/TestFiles/cases/Duct/meshCase/Allmesh +++ b/Data/TestFiles/cases/Duct/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/Data/TestFiles/cases/Elbow/case/Allrun b/Data/TestFiles/cases/Elbow/case/Allrun index 47c9bf71..e0ff089a 100755 --- a/Data/TestFiles/cases/Elbow/case/Allrun +++ b/Data/TestFiles/cases/Elbow/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -47,12 +60,15 @@ PNAME=p # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Initialise flow -runCommand mpiexec -np 4 potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME # Run application in parallel -runCommand mpiexec -np 4 simpleFoam -parallel +runParallel $NPROC simpleFoam diff --git a/Data/TestFiles/cases/Elbow/case/pvScript.py b/Data/TestFiles/cases/Elbow/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/Elbow/case/pvScript.py +++ b/Data/TestFiles/cases/Elbow/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/Elbow/case/system/createPatchDict b/Data/TestFiles/cases/Elbow/case/system/createPatchDict index a27f83f7..0e420c93 100644 --- a/Data/TestFiles/cases/Elbow/case/system/createPatchDict +++ b/Data/TestFiles/cases/Elbow/case/system/createPatchDict @@ -78,16 +78,6 @@ patches patches ( "patch_.*_1" ); } - { - name MeshRefinementBackFace; - patchInfo - { - type empty; - } - constructFrom patches; - patches ( "patch_.*_1_back" ); - } - ); diff --git a/Data/TestFiles/cases/Elbow/meshCase/Allmesh b/Data/TestFiles/cases/Elbow/meshCase/Allmesh index 4147d565..7536720d 100755 --- a/Data/TestFiles/cases/Elbow/meshCase/Allmesh +++ b/Data/TestFiles/cases/Elbow/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -24,8 +37,6 @@ runCommand surfaceFeatureEdges -angle 60 "constant/triSurface/Pad_Geometry.stl" runCommand cartesianMesh -# Create extrusions -runCommand createPatch -overwrite cp system/extrudeMeshDict.0 system/extrudeMeshDict runCommand extrudeMesh mv log.extrudeMesh log.extrudeMesh.0 diff --git a/Data/TestFiles/cases/Elbow/meshCase/system/createPatchDict b/Data/TestFiles/cases/Elbow/meshCase/system/createPatchDict deleted file mode 100644 index 0c603c76..00000000 --- a/Data/TestFiles/cases/Elbow/meshCase/system/createPatchDict +++ /dev/null @@ -1,32 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| | -| Generated by the CfdOF workbench for FreeCAD | -| https://gitlab.com/opensimproject/CfdOF | -| | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object createPatchDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -pointSync false; - -patches -( - { - name patch_0_1_back; - patchInfo - { - type patch; - } - constructFrom patches; - patches ( ); - } -); - - -// ************************************************************************* // diff --git a/Data/TestFiles/cases/Elbow/meshCase/system/extrudeMeshDict.0 b/Data/TestFiles/cases/Elbow/meshCase/system/extrudeMeshDict.0 index 9fc9581d..550be087 100644 --- a/Data/TestFiles/cases/Elbow/meshCase/system/extrudeMeshDict.0 +++ b/Data/TestFiles/cases/Elbow/meshCase/system/extrudeMeshDict.0 @@ -17,7 +17,7 @@ FoamFile sourceCase "./"; sourcePatches (patch_0_1); constructFrom patch; -exposedPatchName patch_0_1_back; +exposedPatchName patch_0_1; flipNormals false; diff --git a/Data/TestFiles/cases/LESStep/case/Allrun b/Data/TestFiles/cases/LESStep/case/Allrun index bca3c2ba..644a413e 100644 --- a/Data/TestFiles/cases/LESStep/case/Allrun +++ b/Data/TestFiles/cases/LESStep/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,6 +25,7 @@ runCommand() } # Unset and source bashrc +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -44,9 +58,12 @@ runCommand createPatch -overwrite # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Run application in parallel -runCommand mpiexec -np 4 pimpleFoam -parallel +runParallel $NPROC pimpleFoam diff --git a/Data/TestFiles/cases/LESStep/case/pvScript.py b/Data/TestFiles/cases/LESStep/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/LESStep/case/pvScript.py +++ b/Data/TestFiles/cases/LESStep/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/LESStep/meshCase/Allmesh b/Data/TestFiles/cases/LESStep/meshCase/Allmesh index 5301e7e6..ec2ba4f1 100644 --- a/Data/TestFiles/cases/LESStep/meshCase/Allmesh +++ b/Data/TestFiles/cases/LESStep/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -11,11 +24,12 @@ runCommand() if [ ! $err -eq 0 ]; then exit $err; fi } -GMSH_EXE='/c/Program Files/FreeCAD 0.19/bin/gmsh.exe' +GMSH_EXE='/usr/local/bin/gmsh' export NTHREADS=$(nproc) runCommand "$GMSH_EXE" -nt $NTHREADS - "gmsh/Pad_Geometry.geo" # Unset and source bashrc +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/Data/TestFiles/cases/Projectile/case/Allrun b/Data/TestFiles/cases/Projectile/case/Allrun index 66924fd5..23260cde 100755 --- a/Data/TestFiles/cases/Projectile/case/Allrun +++ b/Data/TestFiles/cases/Projectile/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -45,9 +58,12 @@ runCommand createPatch -overwrite # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Run application in parallel -runCommand mpiexec -np 4 hisa -parallel +runParallel $NPROC hisa diff --git a/Data/TestFiles/cases/Projectile/case/pvScript.py b/Data/TestFiles/cases/Projectile/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/Projectile/case/pvScript.py +++ b/Data/TestFiles/cases/Projectile/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/Projectile/meshCase/Allmesh b/Data/TestFiles/cases/Projectile/meshCase/Allmesh index 72146d88..41feda5d 100755 --- a/Data/TestFiles/cases/Projectile/meshCase/Allmesh +++ b/Data/TestFiles/cases/Projectile/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/Data/TestFiles/cases/UAV/case/Allrun b/Data/TestFiles/cases/UAV/case/Allrun index b440cb45..496dbb95 100755 --- a/Data/TestFiles/cases/UAV/case/Allrun +++ b/Data/TestFiles/cases/UAV/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -47,12 +60,15 @@ PNAME=p # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Initialise flow -runCommand mpiexec -np 4 potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME # Run application in parallel -runCommand mpiexec -np 4 simpleFoam -parallel +runParallel $NPROC simpleFoam diff --git a/Data/TestFiles/cases/UAV/case/pvScript.py b/Data/TestFiles/cases/UAV/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/UAV/case/pvScript.py +++ b/Data/TestFiles/cases/UAV/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/UAV/meshCase/Allmesh b/Data/TestFiles/cases/UAV/meshCase/Allmesh index 72146d88..41feda5d 100755 --- a/Data/TestFiles/cases/UAV/meshCase/Allmesh +++ b/Data/TestFiles/cases/UAV/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/Data/TestFiles/cases/ViscousTubeBundle/case/Allrun b/Data/TestFiles/cases/ViscousTubeBundle/case/Allrun index b2312bce..94dd774f 100755 --- a/Data/TestFiles/cases/ViscousTubeBundle/case/Allrun +++ b/Data/TestFiles/cases/ViscousTubeBundle/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -47,12 +60,15 @@ PNAME=p # Parallel decomposition runCommand decomposePar -force +# Pick up number of parallel processes +NPROC=$(foamDictionary -entry "numberOfSubdomains" -value system/decomposeParDict) + # Mesh renumbering -runCommand mpiexec -np 4 renumberMesh -parallel -overwrite +runParallel $NPROC renumberMesh -overwrite # Initialise flow -runCommand mpiexec -np 4 potentialFoam -parallel -initialiseUBCs -pName $PNAME +runParallel $NPROC potentialFoam -initialiseUBCs -pName $PNAME # Run application in parallel -runCommand mpiexec -np 4 simpleFoam -parallel +runParallel $NPROC simpleFoam diff --git a/Data/TestFiles/cases/ViscousTubeBundle/case/pvScript.py b/Data/TestFiles/cases/ViscousTubeBundle/case/pvScript.py index ac07fc6a..a214e77d 100644 --- a/Data/TestFiles/cases/ViscousTubeBundle/case/pvScript.py +++ b/Data/TestFiles/cases/ViscousTubeBundle/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/ViscousTubeBundle/case/system/createPatchDict b/Data/TestFiles/cases/ViscousTubeBundle/case/system/createPatchDict index 85943587..aa6de61e 100644 --- a/Data/TestFiles/cases/ViscousTubeBundle/case/system/createPatchDict +++ b/Data/TestFiles/cases/ViscousTubeBundle/case/system/createPatchDict @@ -68,16 +68,6 @@ patches patches ( "patch_.*_2" ); } - { - name MeshRefinement001BackFace; - patchInfo - { - type empty; - } - constructFrom patches; - patches ( "patch_.*_2_back" ); - } - ); diff --git a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/Allmesh b/Data/TestFiles/cases/ViscousTubeBundle/meshCase/Allmesh index ed8ea545..750fb445 100755 --- a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/Allmesh +++ b/Data/TestFiles/cases/ViscousTubeBundle/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null @@ -24,8 +37,6 @@ runCommand surfaceFeatureEdges -angle 60 "constant/triSurface/Cut_Geometry.stl" runCommand cartesianMesh -# Create extrusions -runCommand createPatch -overwrite cp system/extrudeMeshDict.0 system/extrudeMeshDict runCommand extrudeMesh mv log.extrudeMesh log.extrudeMesh.0 diff --git a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/createPatchDict b/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/createPatchDict deleted file mode 100644 index 321acac0..00000000 --- a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/createPatchDict +++ /dev/null @@ -1,32 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| | -| Generated by the CfdOF workbench for FreeCAD | -| https://gitlab.com/opensimproject/CfdOF | -| | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object createPatchDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -pointSync false; - -patches -( - { - name patch_0_2_back; - patchInfo - { - type patch; - } - constructFrom patches; - patches ( ); - } -); - - -// ************************************************************************* // diff --git a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/extrudeMeshDict.0 b/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/extrudeMeshDict.0 index a33ac2a9..7b85ad45 100644 --- a/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/extrudeMeshDict.0 +++ b/Data/TestFiles/cases/ViscousTubeBundle/meshCase/system/extrudeMeshDict.0 @@ -17,7 +17,7 @@ FoamFile sourceCase "./"; sourcePatches (patch_0_2); constructFrom patch; -exposedPatchName patch_0_2_back; +exposedPatchName patch_0_2; flipNormals false; diff --git a/Data/TestFiles/cases/block/case/Allrun b/Data/TestFiles/cases/block/case/Allrun index 141b3160..e13668c3 100755 --- a/Data/TestFiles/cases/block/case/Allrun +++ b/Data/TestFiles/cases/block/case/Allrun @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -12,7 +25,7 @@ runCommand() } # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/Data/TestFiles/cases/block/case/pvScript.py b/Data/TestFiles/cases/block/case/pvScript.py index 9a0ffe8a..0b55b42c 100644 --- a/Data/TestFiles/cases/block/case/pvScript.py +++ b/Data/TestFiles/cases/block/case/pvScript.py @@ -11,19 +11,26 @@ # get active view renderView1 = GetActiveViewOrCreate('RenderView') -# get color transfer function/color map for 'p' -ULUT = GetColorTransferFunction('U') +# reset view to fit data +renderView1.ResetCamera() + +# create a new 'Clean to Grid' +cleantoGrid1 = CleantoGrid(Input=pfoam) # show data in view -pfoamDisplay = Show(pfoam, renderView1) -# trace defaults for the display properties. -pfoamDisplay.ColorArrayName = ['POINTS', 'U'] -pfoamDisplay.LookupTable = ULUT -pfoamDisplay.EdgeColor = [0.0, 0.0, 0.5] -pfoamDisplay.ScalarOpacityUnitDistance = 0.05 +cleantoGrid1Display = Show(cleantoGrid1, renderView1) -# reset view to fit data -renderView1.ResetCamera() +# hide data in view +Hide(pfoam, renderView1) + +# get color transfer function/color map for 'U' +ULUT = GetColorTransferFunction('U') + +# trace defaults for the display properties. +cleantoGrid1Display.ColorArrayName = ['POINTS', 'U'] +cleantoGrid1Display.LookupTable = ULUT +cleantoGrid1Display.EdgeColor = [0.0, 0.0, 0.5] +cleantoGrid1Display.ScalarOpacityUnitDistance = 0.05 # get animation scene animationScene1 = GetAnimationScene() @@ -37,7 +44,11 @@ animationScene1.AnimationTime = finalTime # rescale color and/or opacity maps used to exactly fit the current data range -pfoamDisplay.RescaleTransferFunctionToDataRange(False, True) +cleantoGrid1Display.RescaleTransferFunctionToDataRange(False, True) # update the view to ensure updated data information -renderView1.Update() \ No newline at end of file +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera(False) + diff --git a/Data/TestFiles/cases/block/meshCase/Allmesh b/Data/TestFiles/cases/block/meshCase/Allmesh index b0eb397c..ac681f7d 100755 --- a/Data/TestFiles/cases/block/meshCase/Allmesh +++ b/Data/TestFiles/cases/block/meshCase/Allmesh @@ -1,9 +1,22 @@ #!/bin/bash +runParallel() +{ + nproc="$1" + shift + exe="$(which $1)" + sol=$(basename -- "$1") + sol="${sol%.*}" + shift + if [ -f log."$sol" ]; then rm log."$sol"; fi + mpiexec -np $nproc "$exe" -parallel "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) + err=$? + if [ ! $err -eq 0 ]; then exit $err; fi +} + runCommand() { - if [ "$1" == "mpiexec" ]; then sol="$4"; else sol="$1"; fi - sol=$(basename -- "$sol") + sol=$(basename -- "$1") sol="${sol%.*}" if [ -f log."$sol" ]; then rm log."$sol"; fi "$@" 1> >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2) @@ -11,12 +24,12 @@ runCommand() if [ ! $err -eq 0 ]; then exit $err; fi } -GMSH_EXE='/home/oliver/software/gmsh-4.8.4-Linux64/bin/gmsh' +GMSH_EXE='/usr/local/bin/gmsh' export NTHREADS=$(nproc) runCommand "$GMSH_EXE" -nt $NTHREADS - "gmsh/Box_Geometry.geo" # Unset and source bashrc -FOAMDIR="/usr/lib/openfoam/openfoam2112" +FOAMDIR="/usr/lib/openfoam/openfoam2206" if [ ! -z "$FOAMDIR" ] then source "$FOAMDIR/etc/config.sh/unset" 2> /dev/null diff --git a/metadata.txt b/metadata.txt index 5bc67462..f0dfb690 100644 --- a/metadata.txt +++ b/metadata.txt @@ -8,7 +8,7 @@ description=Computational Fluid Dynamics (CFD) analysis based on OpenFOAM about=Simple workflow to get started with CFD analysis. Supports incompressible laminar and turbulent flow, basic multiphase flow, and cut-cell cartesian meshing -version=1.17.0 +version=1.17.4 tracker=https://forum.freecadweb.org/viewforum.php?f=37&sid=3d90858d2ff441bd10475a693b55643a repository=https://gitlab.com/opensimproject/cfdof license=LGPL diff --git a/package.xml b/package.xml index 16afb542..8ca8e8ab 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ CfdOF Computational Fluid Dynamics (CFD) for FreeCAD based on OpenFOAM - 1.17.0 + 1.17.4 Oliver Oxtoby LGPL-2 https://gitlab.com/opensimproject/CfdOF