cp -r 0.orig 0
echo "Starting Meshing Process..."

# 1. Generate base mesh
blockMesh

# 2. Extract surface features from your .obj/.stl file
surfaceFeatureExtract

# 3. Snap the geometry in parallel
snappyHexMesh -overwrite


# 4. Create the cyclicAMI patches in parallel
createPatch -overwrite

# 6. Scale the mesh from millimeters to meters in parallel 
transformPoints -scale '(0.001 0.001 0.001)'

# 5. Decompose the domain into n processors 
decomposePar -force

#6. Run the simulation in parallel 
mpirun -np 8 pimpleFoam -parallel

# 7. Reconstruct the final, snapped, and scaled mesh
echo "Reconstructing mesh..."
reconstructParMesh -constant

# 8. Clean up the old processor folders so we can start the solver fresh
rm -rf processor*
