Postprocessing commands
I'm new to DualSPHysics and I'm trying to postprocess my testcase using the .xml and .bat files. My testcase is basically two rotating gears, one fluidbox and an In/Outlet. When I run the .bat file I only generate the Part_All_vtk files. so I'm trying to add the commands to generate the boundary_vtk and isosurface_vtk to visualize my rotating gears and add a surface to my fluid. I already saw that the boundaryvtk.exe and isosurface.exe are set in the .bat file but not listed in the commards. Can you guys tell me how the command to generate the boundary_vtk and isosurface_vtk files should look like? Thanks in advance!
Here is the code from the .bat
@echo off
setlocal EnableDelayedExpansion
rem Don't remove the two jump line after than the next line [set NL=^]
set NL=^
rem "name" and "dirout" are named according to the testcase
set name=casegearbox
set dirout=%name%_out
set diroutdata=%dirout%\data
rem "executables" are renamed and called from their directory
set dirbin=../../../bin/windows
set gencase="%dirbin%/GenCase_win64.exe"
set dualsphysicscpu="%dirbin%/DualSPHysics5.0CPU_win64.exe"
set dualsphysicsgpu="%dirbin%/DualSPHysics5.0_win64.exe"
set boundaryvtk="%dirbin%/BoundaryVTK_win64.exe"
set partvtk="%dirbin%/PartVTK_win64.exe"
set partvtkout="%dirbin%/PartVTKOut_win64.exe"
set measuretool="%dirbin%/MeasureTool_win64.exe"
set computeforces="%dirbin%/ComputeForces_win64.exe"
set isosurface="%dirbin%/IsoSurface_win64.exe"
set flowtool="%dirbin%/FlowTool_win64.exe"
set floatinginfo="%dirbin%/FloatingInfo_win64.exe"
:menu
if exist %dirout% (
set /p option="The folder "%dirout%" already exists. Choose an option.!NL! [1]- Delete it and continue.!NL! [2]- Execute post-processing.!NL! [3]- Abort and exit.!NL!"
if "!option!" == "1" goto run else (
if "!option!" == "2" goto postprocessing else (
if "!option!" == "3" goto fail else (
goto menu
)
)
)
)
:run
rem "dirout" to store results is removed if it already exists
if exist %dirout% rd /s /q %dirout%
REM CODES are executed according the selected parameters of execution in this testcase
REM Executes GenCase4 to create initial files for simulation.
%gencase% %name%_Def %dirout%/%name% -save:all
if not "%ERRORLEVEL%" == "0" goto fail
REM Executes DualSPHysics to simulate SPH method.
%dualsphysicscpu% %dirout%/%name% %dirout% -dirdataout data -svres
if not "%ERRORLEVEL%" == "0" goto fail
:postprocessing
REM Executes PartVTK4 to create VTK files with particles.
set dirout2=%dirout%\particles
%partvtk% -dirin %diroutdata% -savevtk %dirout2%/PartAll
if not "%ERRORLEVEL%" == "0" goto fail
REM Executes PartVTKOut4 to create VTK files with excluded particles.
%partvtkout% -dirin %diroutdata% -savevtk %dirout2%/PartFluidOut -SaveResume %dirout2%/_ResumeFluidOut
if not "%ERRORLEVEL%" == "0" goto fail
REM Measures pressure value at point close to the boundary and 1.5h away.
set dirout2=%dirout%\measuretool
REM Executes BoundaryVTK4 to create a CSV file with positions where pressure is measured using MeasureTool4.
%boundaryvtk% -motiondata %diroutdata% -saveposmotion:10:-0.4461:0:0.093 %dirout2%/PosCorrect -saveposmotion:10:-0.45:0:0.093 %dirout2%/PosIncorrect
if not "%ERRORLEVEL%" == "0" goto fail
REM Executes MeasureTool4 to create a CSV file with pressure information at point close to the boundary and 1.5h away.
%measuretool% -dirin %diroutdata% -pointspos %dirout2%/PosCorrect_mk0010.csv -onlytype:-all,+fluid -vars:-all,+press,+kcorr -kcusedummy:0 -kclimit:0.5 -savevtk %dirout2%/PointsPressure_Correct -savecsv %dirout2%/_PointsPressure_Correct
if not "%ERRORLEVEL%" == "0" goto fail
%measuretool% -dirin %diroutdata% -pointspos %dirout2%/PosIncorrect_mk0010.csv -onlytype:-all,+fluid -vars:-all,+press,+kcorr -kcusedummy:0 -kclimit:0.5 -savevtk %dirout2%/PointsPressure_Incorrect -savecsv %dirout2%/_PointsPressure_Incorrect
if not "%ERRORLEVEL%" == "0" goto fail
REM Computes forces and moment about an axis
set dirout2=%dirout%\forces
%computeforces% -dirin %diroutdata% -savecsv %dirout2%/_TankM0 -onlymk:10 -momentaxis:0:0.1:0.0:0:-0.1:0.0
if not "%ERRORLEVEL%" == "0" goto fail
set dirout2=%dirout%\boundary
%boundaryvtk% -loadvtk %dirout%/%name%__Dp.vtk -motiondata %diroutdata% -savevtkdata %dirout2%/Domain.vtk -onlymk:1
if not "%ERRORLEVEL%" == "0" goto fail
:success
echo All done
goto end
:fail
echo Execution aborted.
:end
pause
Debug Trace
Notice |
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead. #0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array) #1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384) #2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...') #3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"I'm...') #4 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(197): Gdn_Format::to('[{"insert":"I'm...', 'Rich') #5 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2359', 'postprocessing-...', '') #6 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array) #7 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch() #8 {main} |
Notice |
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead. #0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array) #1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384) #2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...') #3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"I'm...') #4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"I'm...', 'Rich') #5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/discussion.php(89): formatBody(Object(stdClass)) #6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(31): include('/var/www/forums...') #7 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...') #8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false) #9 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender() #10 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array) #11 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2359', 'postprocessing-...', '') #12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array) #13 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch() #14 {main} |
Notice |
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead. #0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array) #1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384) #2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...') #3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Sol...') #4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"Sol...', 'Rich') #5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(170): formatBody(Object(stdClass)) #6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/comments.php(19): writeComment(Object(stdClass), Object(DiscussionController), Object(Gdn_Session), 1) #7 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(53): include('/var/www/forums...') #8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...') #9 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false) #10 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender() #11 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array) #12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2359', 'postprocessing-...', '') #13 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array) #14 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch() #15 {main} |
Notice |
rich is deprecated. Use FormatService::renderHtml($content, Formats\RichFormat::FORMAT_KEY) instead. #0 [internal function]: gdn_ErrorHandler(16384, 'rich is depreca...', '/var/www/forums...', 950, Array) #1 /var/www/forums-dual-sphysics-org/library/core/functions.general.php(950): trigger_error('rich is depreca...', 16384) #2 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1729): deprecated('rich', 'FormatService::...') #3 /var/www/forums-dual-sphysics-org/library/core/class.format.php(1479): Gdn_Format::rich('[{"insert":"Nic...') #4 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(24): Gdn_Format::to('[{"insert":"Nic...', 'Rich') #5 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/helper_functions.php(170): formatBody(Object(stdClass)) #6 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/comments.php(19): writeComment(Object(stdClass), Object(DiscussionController), Object(Gdn_Session), 2) #7 /var/www/forums-dual-sphysics-org/applications/vanilla/views/discussion/index.php(53): include('/var/www/forums...') #8 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(778): include('/var/www/forums...') #9 /var/www/forums-dual-sphysics-org/library/core/class.controller.php(1382): Gdn_Controller->fetchView('', false, false) #10 /var/www/forums-dual-sphysics-org/library/core/class.pluggable.php(217): Gdn_Controller->xRender() #11 /var/www/forums-dual-sphysics-org/applications/vanilla/controllers/class.discussioncontroller.php(310): Gdn_Pluggable->__call('render', Array) #12 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(862): DiscussionController->index('2359', 'postprocessing-...', '') #13 /var/www/forums-dual-sphysics-org/library/core/class.dispatcher.php(279): Gdn_Dispatcher->dispatchController(Object(Gdn_Request), Array) #14 /var/www/forums-dual-sphysics-org/index.php(29): Gdn_Dispatcher->dispatch() #15 {main} |
Comments
Solved it, here is the code for the curious people who stumble over this :D
@echo off
setlocal EnableDelayedExpansion
rem Don't remove the two jump line after than the next line [set NL=^]
set NL=^
rem "name" and "dirout" are named according to the testcase
set name=casegearbox
set dirout=%name%_out
set diroutdata=%dirout%\data
rem "executables" are renamed and called from their directory
set dirbin=../../../bin/windows
set gencase="%dirbin%/GenCase_win64.exe"
set dualsphysicscpu="%dirbin%/DualSPHysics5.0CPU_win64.exe"
set dualsphysicsgpu="%dirbin%/DualSPHysics5.0_win64.exe"
set boundaryvtk="%dirbin%/BoundaryVTK_win64.exe"
set partvtk="%dirbin%/PartVTK_win64.exe"
set partvtkout="%dirbin%/PartVTKOut_win64.exe"
set measuretool="%dirbin%/MeasureTool_win64.exe"
set computeforces="%dirbin%/ComputeForces_win64.exe"
set isosurface="%dirbin%/IsoSurface_win64.exe"
set flowtool="%dirbin%/FlowTool_win64.exe"
set floatinginfo="%dirbin%/FloatingInfo_win64.exe"
:menu
if exist %dirout% (
set /p option="The folder "%dirout%" already exists. Choose an option.!NL! [1]- Delete it and continue.!NL! [2]- Execute post-processing.!NL! [3]- Abort and exit.!NL!"
if "!option!" == "1" goto run else (
if "!option!" == "2" goto postprocessing else (
if "!option!" == "3" goto fail else (
goto menu
)
)
)
)
:run
rem "dirout" to store results is removed if it already exists
if exist %dirout% rd /s /q %dirout%
REM CODES are executed according the selected parameters of execution in this testcase
REM Executes GenCase4 to create initial files for simulation.
%gencase% %name%_Def %dirout%/%name% -save:all
if not "%ERRORLEVEL%" == "0" goto fail
REM Executes DualSPHysics to simulate SPH method.
%dualsphysicscpu% %dirout%/%name% %dirout% -dirdataout data -svres
if not "%ERRORLEVEL%" == "0" goto fail
:postprocessing
REM Executes PartVTK4 to create VTK files with particles.
set dirout2=%dirout%\particles
%partvtk% -dirin %diroutdata% -savevtk %dirout2%/PartAll
if not "%ERRORLEVEL%" == "0" goto fail
REM Executes PartVTKOut4 to create VTK files with excluded particles.
%partvtkout% -dirin %diroutdata% -savevtk %dirout2%/PartFluidOut -SaveResume %dirout2%/_ResumeFluidOut
if not "%ERRORLEVEL%" == "0" goto fail
rem Executes IsoSurface to create VTK files with slices of surface.
set dirout2=%dirout%\surface
%isosurface% -dirin %diroutdata% -saveiso %dirout2%/Slices
if not "%ERRORLEVEL%" == "0" goto fail
set dirout2=%dirout%\boundary
%boundaryvtk% -loadvtk AutoActual -motiondatatime %diroutdata% -savevtkdata %dirout2%/MotionGear -onlytype:moving -savevtkdata %dirout2%/Gearfixed.vtk -onlytype:fixed
if not "%ERRORLEVEL%" == "0" goto fail
:success
echo All done
goto end
:fail
echo Execution aborted.
:end
pause
Nice that you solved it!
Please consider putting your code in code block section next time, to make it a bit easier to digest, like this@echo off