# Paths and settings
name="CaseTest"
dirout="${name}_out"
diroutdata="${dirout}/data"
diroutparticles="${dirout}/particles"

module load DualSPHysics

# Function for post-processing
postprocessing() {
    # Create VTK files with particles
    PartVTK_linux64 -dirdata "$diroutdata" -savevtk "$diroutparticles/PartFluid" -onlytype:-all,+fluid
    if [ $? -ne 0 ]; then fail; fi

    PartVTK_linux64 -dirdata "$diroutdata" -savevtk "$diroutparticles/PartPiston" -onlytype:-all,+moving
    if [ $? -ne 0 ]; then fail; fi

    # Create VTK files with excluded particles
    PartVTKOut_linux64 -dirdata "$diroutdata" -savevtk "$diroutparticles/PartFluidOut" -SaveResume "$diroutparticles/_ResumeFluidOut"
    if [ $? -ne 0 ]; then fail; fi
}

# Post-processing
postprocessing