Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
01791a5
Refactored mms-mixed-2D
iBatistic Mar 25, 2026
2a7d093
Refactored cantolever2D
iBatistic Mar 25, 2026
1c4a87a
Refactored Cooks membrane
iBatistic Mar 26, 2026
e5c78e0
refactored pressurised cylinder
iBatistic Mar 26, 2026
6d6cabe
Updated solidProperties in refactored cases
iBatistic Mar 30, 2026
7e78ade
Refactor fix for cantilever and cooksMembrane
iBatistic Apr 2, 2026
61158ca
plateHole refactored
iBatistic Apr 3, 2026
92713eb
Added plateHole analytical function object
iBatistic Apr 3, 2026
8b9dcbe
Refactored mms 3D case
iBatistic Apr 20, 2026
d95f28b
Refactoring mms case
iBatistic Apr 21, 2026
d790122
Added calcOOC scrit for 2dmms and cantilever
iBatistic Apr 21, 2026
7e46f33
Refactoring updates
iBatistic Apr 28, 2026
f3a3869
Refactoring updates
iBatistic Apr 28, 2026
c7ba5d7
Merge branch 'main' of github.com:iBatistic/solid-benchmarks into JFN…
iBatistic May 14, 2026
14ee381
Added membraneRoof2d case
iBatistic May 18, 2026
54f8ff8
Merge branch 'solids4foam:main' into JFNK-HO_paper-updates
iBatistic May 18, 2026
9442f4f
Fix for .H file
iBatistic May 18, 2026
bd80b0a
Merge branch 'JFNK-HO_paper-updates' of github.com:iBatistic/solid-be…
iBatistic May 18, 2026
87d0d2c
Added deflection and force gnuplot scripts
iBatistic May 18, 2026
0529004
Fix for physicsPC
iBatistic May 18, 2026
9597e6a
Merge branch 'main' of github.com:iBatistic/solid-benchmarks into JFN…
iBatistic May 20, 2026
7f752d1
Added parallel scaling script
iBatistic Aug 2, 2026
6b25186
removed sphericalCavity redundand files
iBatistic Aug 2, 2026
76efaf5
fix for Allrun paralle
iBatistic Aug 2, 2026
0456cd6
Merge branch 'JFNK-HO_parallel_scaling_script' of github.com:iBatisti…
iBatistic Aug 2, 2026
130eb65
Updated mixed MMS 2D for kExact framework
iBatistic Aug 21, 2026
48192f7
Merge branch 'JFNK-HO_parallel_scaling_script' of github.com:iBatisti…
iBatistic Aug 21, 2026
589e9f9
Added kExact to 3D MMS case
iBatistic Aug 21, 2026
0adf2f9
Updated linearElastic cases scripts for kExact comparison
iBatistic Aug 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions papers/JFNK_highOrder/linearElastic/cantilever/Allrun
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ source solids4FoamScripts.sh
solids4Foam::caseDoesNotRunWithFoamExtend

# solids4Foam location path
export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder
export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412/
echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR"

# Compile the cantileverBeam library
(cd analyticalCantilever && ./Allwmake -j -s)
(cd src && ./Allwmake -j -s)

# Segregated version require a lot of time to converge, I will skip it for
# now. Tet mesh is not working with snes becouse of gradient at corner cells
Expand All @@ -22,15 +22,15 @@ configs=(
# "BASE=base/segregated NAME=hex.struct.seg GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0"
# "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0"
# "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0"
# "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.ksponly HOJAC=false HORES=true"
# "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
# "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
"BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true"
# "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.ksponly HOJAC=false HORES=true TYPE=movingLeastSquares"
# "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
# "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares"
)

# Define start and end mesh indices
Expand Down Expand Up @@ -68,7 +68,7 @@ cd "${RUN_DIR}"
for config in "${configs[@]}"
do
# Reset variables in the case some variable is not used
unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES
unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES TYPE

# Parse the configuration string
eval $config
Expand Down Expand Up @@ -118,6 +118,11 @@ do
sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties
fi

# Update the least squares type
if [ -n "${TYPE}" ]; then
sed -i "/^\s*type \(movingLeastSquares\|kExactLeastSquares\);/s|^.*| type ${TYPE};|" constant/solidProperties
fi

# Update how Jacobian is calculated
if [ -n "${HOJAC}" ]; then
sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties
Expand Down
218 changes: 218 additions & 0 deletions papers/JFNK_highOrder/linearElastic/cantilever/Allrun.kExact
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
#!/bin/bash

# Source required functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
source solids4FoamScripts.sh
# Extend version not supported
solids4Foam::caseDoesNotRunWithFoamExtend

# solids4Foam location path
export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412/
echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR"

# Compile the cantileverBeam library
(cd src && ./Allwmake -j -s)

# Segregated version require a lot of time to converge, I will skip it for
# now. Tet mesh is not working with snes becouse of gradient at corner cells

# Define configurations as space-separated strings
configs=(
# "BASE=base/snes NAME=hex.struct.hypre-snes GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu"
# "BASE=base/segregated NAME=hex.struct.seg GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0"
# "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0"
# "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0"
# "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.ksponly HOJAC=false HORES=true TYPE=kExactLeastSquares"
# "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
# "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
"BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares"
)

# Define start and end mesh indices
# Mesh input files are defined from 1 to 15
# END_MESH should be greater than START_MESH
START_MESH=1
END_MESH=15


# Detect the CPU type: we append this to the case name
if [[ "$OSTYPE" == "darwin"* ]]
then
# macOS
CPU_TYPE=$(sysctl -n machdep.cpu.brand_string | sed 's/[^a-zA-Z0-9]/_/g')
elif [[ -f /proc/cpuinfo ]]
then
# Linux
CPU_TYPE=$(grep -m 1 "model name" /proc/cpuinfo | awk -F': ' '{print $2}' | sed 's/[^a-zA-Z0-9]/_/g')
else
# Fallback if neither method works
CPU_TYPE="Unknown_CPU"
fi


# Create timestamped working directory for this run
DATE=$(date +%Y-%m-%d_%H-%M-%S)
RUN_DIR="run_${CPU_TYPE}_${DATE}"
echo "Creating ${RUN_DIR}"
mkdir "${RUN_DIR}"

# Enter the run directory
cd "${RUN_DIR}"

# Iterate through configurations
for config in "${configs[@]}"
do
# Reset variables in the case some variable is not used
unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES TYPE

# Parse the configuration string
eval $config
echo; echo "***************************************"
echo "Running configuration: $config"
echo "***************************************"

# Define results summary file name
SUMMARY="${NAME}.summary.txt"
echo "# Mesh Time Mem CellsNumber D_L2 D_Linf S_L2 S_Linf" > "${SUMMARY}"

# Loop over mesh densities in each configuration
for i in `seq $START_MESH $END_MESH`
do
CASE="${NAME}.$i"
echo; echo "Processing case: $CASE"

# Prepare the case
cp -rL "../${BASE}" "${CASE}"
cd "$CASE"

# GMSH Mesh generation
cp "gmsh/meshSpacing/meshSpacing$i.geo" "gmsh/meshSpacing/meshSpacing.geo"
solids4Foam::runApplication gmsh -3 -format msh2 gmsh/"${GMSH_FILE}.geo"
solids4Foam::runApplication gmshToFoam gmsh/"${GMSH_FILE}.msh"
solids4Foam::runApplication changeDictionary

# Optional mesh distortion
if [ "$USE_PERTURBMESHPOINTS" -eq 1 ]
then
solids4Foam::runApplication perturbMeshPoints
fi
solids4Foam::runApplication checkMesh

# Update the PETSc options file
if [ -n "${PETSC_FILE}" ]; then
sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties
fi

# Update the order
if [ -n "${polyOrder}" ]; then
sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties
fi

# Update number of stencil cells
if [ -n "${extraCells}" ]; then
sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties
fi

# Update the least squares type
if [ -n "${TYPE}" ]; then
sed -i "/^\s*type \(movingLeastSquares\|kExactLeastSquares\);/s|^.*| type ${TYPE};|" constant/solidProperties
fi

# Update how Jacobian is calculated
if [ -n "${HOJAC}" ]; then
sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties
fi

# Update how Residual is calculated
if [ -n "${HORES}" ]; then
sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties
fi

# Run the solver
# If "gtime" is available (could be called "time" on Linux), use it to
# record the max memory usage
if command -v gtime &> /dev/null
then
echo "Running solids4Foam on ${CASE} with gtime"
gtime -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" solids4Foam &> log.solids4Foam

elif [ -x /usr/bin/time ]
then
echo "Running solids4Foam on ${CASE} with /usr/bin/time"
/usr/bin/time -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" solids4Foam &> log.solids4Foam

elif command -v time &> /dev/null
then
echo "Running solids4Foam on ${CASE} with shell builtin time (no max memory)"
time solids4Foam &> log.solids4Foam

else
echo "Running solids4Foam on ${CASE}"
solids4Foam::runApplication solids4Foam
fi

# Extract results from solver log and append them to a summary file
echo; echo "Appending results to ${SUMMARY}"
if grep -q "gtime/time" log.solids4Foam; then
CLOCK_TIME=$(grep "gtime/time" log.solids4Foam | awk '{print $5}')
else
# Record the time
CLOCK_TIME=$(grep "ClockTime" log.solids4Foam | awk '{print $7}')
fi

# Extract results from solver log and append them to a summary file
if grep -q "Maximum resident" log.solids4Foam; then
MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}')
else
MAX_MEMORY="NaN"
fi

# Number of cells
CELLS=$(grep "cells:" log.checkMesh | awk '{print $2}')

# Extract the L2 (average) error for displacement
DISP_L2_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}')

# Extract the LInfinity (max) error for displacement
DISP_LINF_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $4}')

# Extract the L2 (average) error for mag(sigma)
STRESS_L2_ERROR=$(grep "Writing sigmaDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}')

# Extract the LInfinity (max) error for mag(sigma)
STRESS_LINF_ERROR=$(grep "Writing sigmaDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $4}')

# Write data to file
echo "$i $CLOCK_TIME $MAX_MEMORY $CELLS $DISP_L2_ERROR $DISP_LINF_ERROR $STRESS_L2_ERROR $STRESS_LINF_ERROR" >> ../"${SUMMARY}"

cd ..
done

# Print summary file
echo; echo "${SUMMARY} file:"; cat "${SUMMARY}"; echo

done

# Create plots if gnuplot in installed
if command -v gnuplot &>/dev/null
then
# Copy gnuplot scripts
cp ../plotScripts/*gnuplot .

# Run all scripts
for f in *gnuplot
do
echo "Running gnuplot on $f"
gnuplot "$f" 2>/dev/null
done
fi

echo; echo; echo "Done!"; echo
echo "View the PDF files in ${RUN_DIR}"
echo; echo $(date)
echo; echo
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs

displacement
{
type movingLeastSquares;
polynomialOrder 2;
faceStencilExtraCells 10;

Expand Down
Loading