From 01791a50ebcc126f8321bc9931969a102ae32676 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Wed, 25 Mar 2026 13:31:51 +0100 Subject: [PATCH 01/23] Refactored mms-mixed-2D --- .../manufacturedSolution/mixed/2D/Allrun | 95 ++++++++++--------- .../base/highOrder/constant/solidProperties | 21 ++-- .../manufacturedSolution.C | 3 +- 3 files changed, 62 insertions(+), 57 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun index 56b3ca3..db234b2 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun @@ -4,40 +4,43 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh -# Working only with .com version +# Not working with extend version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +# solids4Foam location path +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder +echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" # Compile the manucafturedSolution library (cd manufacturedSolution && wclean libso && ./Allwmake -j -s) # 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/snes NAME=tet.struct.hypre-snes GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" - "BASE=base/snes NAME=tet.unstruct_v1.hypre-snes GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" - "BASE=base/snes NAME=tet.unstruct_v2.hypre-snes GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" - "BASE=base/snes NAME=poly.struct.hypre-snes GMSH_FILE=poly-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_v1.seg GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0" - "BASE=base/segregated NAME=tet.unstruct_v2.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0" - "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0" - "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 N=1 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 N=2 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 N=3 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 N=1 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 N=2 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 N=3 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=hex.struct.hypre-snes GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=tet.struct.hypre-snes GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=tet.unstruct_v1.hypre-snes GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=tet.unstruct_v2.hypre-snes GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=poly.struct.hypre-snes GMSH_FILE=poly-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_v1.seg GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0" + # "BASE=base/segregated NAME=tet.unstruct_v2.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0" + # "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" ) # SNES segregated approach @@ -104,24 +107,24 @@ do # GMSH Mesh generation if [[ "$GMSH_FILE" == "poly-structured" ]] - then - # Special prcedure for generating polyhedral mesh + then + # Special prcedure for generating polyhedral mesh 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" - mv 0/ 0.tmp - solids4Foam::runApplication polyDualMesh 30 -overwrite - solids4Foam::runApplication combinePatchFaces 45 -overwrite - solids4Foam::runApplication extrudeMesh - solids4Foam::runApplication createPatch -overwrite - mv 0.tmp/ 0 - else - # Other types of meshes - cp "gmsh/meshSpacing/meshSpacing$i.geo" "gmsh/meshSpacing/meshSpacing.geo" + mv 0/ 0.tmp + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + solids4Foam::runApplication extrudeMesh + solids4Foam::runApplication createPatch -overwrite + mv 0.tmp/ 0 + else + # Other types of meshes + 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 - fi + fi # Optional mesh distortion if [ "$USE_PERTURBMESHPOINTS" -eq 1 ] @@ -136,21 +139,21 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${order}" ]; then + sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -175,7 +178,7 @@ do else solids4Foam::runApplication solids4Foam - fi + fi # Extract results from solver log and append them to a summary file echo; echo "Appending results to ${SUMMARY}" diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties index 2f5f021..f376492 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties @@ -31,23 +31,24 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + order 3; + faceStencilExtraCells 10; + + weightFunctionCoeffs { - N 1; - Nn 45; - weightFunction radiallySymmetricExponential; + type radiallySymmetricExponential; k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; - calcConditionNumber false; } + calcConditionNumber false; } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C index ed21cc4..2e22c29 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C @@ -74,7 +74,7 @@ void Foam::manufacturedSolution::calcBodyForces() const // Get interpolation order const dictionary& hoDict = solidModelDict().subDict("highOrderCoeffs"); - const label N = readInt(hoDict.subDict("LRECoeffs").lookup("N")); + const label N = readInt(hoDict.lookup("order")); Info<<"Body force is integrated exactly for polynomials of order: " << N << endl; @@ -144,6 +144,7 @@ void Foam::manufacturedSolution::calcBodyForces() const // Get triangle quadrature points and their weight const triQuadrature tq(triangle, N); + const List& triangleQP = tq.points(); const List& triangleQPweights = tq.weights(); From 2a7d093e563750da05cb61a166117aac48d5780e Mon Sep 17 00:00:00 2001 From: iBatistic Date: Wed, 25 Mar 2026 15:59:19 +0100 Subject: [PATCH 02/23] Refactored cantolever2D --- .../linearElastic/cantilever/Allrun | 40 +- .../analyticalCantilever/Make/files | 4 +- .../analyticalCantilever/Make/options | 17 +- ...CantileverDisplacementFvPatchVectorField.C | 11 +- ...CantileverDisplacementFvPatchVectorField.H | 5 +- ...icalCantileverTractionFvPatchVectorField.C | 13 +- ...icalCantileverTractionFvPatchVectorField.H | 5 +- .../cantileverAnalyticalSolution.C | 416 ++++++++++++++++++ .../cantileverAnalyticalSolution.H | 180 ++++++++ .../cantileverStressDisplacement.C | 71 +++ .../cantileverStressDisplacement.H | 61 +++ .../base/highOrder/constant/solidProperties | 21 +- .../cantilever/plotScripts/dispErrors.gnuplot | 20 +- .../plotScripts/stressErrors.gnuplot | 16 +- 14 files changed, 818 insertions(+), 62 deletions(-) create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index 77490ae..b462656 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -4,15 +4,18 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh -# Working only with .com version +# Not working with extend version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +# solids4Foam location path +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder +echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" # Compile the cantileverBeam library (cd analyticalCantilever && ./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. +# now. Tet mesh is not working with snes becouse of gradient at corner cells # Define configurations as space-separated strings configs=( @@ -20,15 +23,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 N=1 Nn=10 PETSC_FILE=petscOptions.ksponly HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=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 N=1 Nn=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 N=2 Nn=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 N=3 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=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 order=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 order=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 order=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 order=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 order=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 order=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 order=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 order=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -107,21 +110,21 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${order}" ]; then + sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraNeiCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraNeiCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -159,7 +162,6 @@ do fi # Extract results from solver log and append them to a summary file - echo; echo "Appending results to ${SUMMARY}" if grep -q "Maximum resident" log.solids4Foam; then MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}') else diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files index 0585fb7..2922ff1 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files @@ -1,4 +1,6 @@ +cantileverStressDisplacement.C +cantileverAnalyticalSolution.C analyticalCantileverDisplacementFvPatchVectorField.C analyticalCantileverTractionFvPatchVectorField.C -LIB = $(FOAM_USER_LIBBIN)/libanalyticalCantilever \ No newline at end of file +LIB = $(FOAM_USER_LIBBIN)/libanalyticalCantilever diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options index c5b1801..0397381 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options @@ -2,11 +2,26 @@ sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -lmeshTools + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C index 4d4b0a5..2db7898 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C @@ -125,10 +125,15 @@ void analyticalCantileverDisplacementFvPatchVectorField::updateCoeffs() autoPtr> analyticalCantileverDisplacementFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const +() const { + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.MLSQuadrature().faceQuadPoints(); + // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H index e757838..bab7782 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H @@ -36,6 +36,7 @@ Author #include "fixedDisplacementFvPatchVectorField.H" #include "cantileverStressDisplacement.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -137,9 +138,7 @@ public: //- Return face quadrature values. // Used for high order solvers, input is position of points virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; + () const; //- Write virtual void write(Ostream&) const; diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C index f6b0327..6dd1cb1 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C @@ -150,11 +150,16 @@ void analyticalCantileverTractionFvPatchVectorField::updateCoeffs() autoPtr> analyticalCantileverTractionFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const +() const { - // faceQuadPoints is list for whole mesh. + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.MLSQuadrature().faceQuadPoints(); + + // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); forAll(nQpPerFace, faceI) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H index 6e44ecc..47417d0 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H @@ -35,6 +35,7 @@ SourceFiles #include "fvPatchFields.H" #include "solidTractionFvPatchVectorField.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -134,9 +135,7 @@ public: //- Return face quadrature values. // Used for high order solvers, input is position of points virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; + () const; // Mapping functions diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C new file mode 100644 index 0000000..11707cf --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C @@ -0,0 +1,416 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*----------------------------------------------------------------------------*/ + +#include "cantileverAnalyticalSolution.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "pointFields.H" +#include "cantileverStressDisplacement.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cantileverAnalyticalSolution, 0); + + addToRunTimeSelectionTable + ( + functionObject, + cantileverAnalyticalSolution, + dictionary + ); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::cantileverAnalyticalSolution::writeData() +{ + // Lookup the solid mesh + const fvMesh* meshPtr = NULL; + if (time_.foundObject("solid")) + { + meshPtr = &(time_.lookupObject("solid")); + } + else + { + meshPtr = &(time_.lookupObject("region0")); + } + const fvMesh& mesh = *meshPtr; + + // Lookup the point mesh + const pointMesh& pMesh = mesh.lookupObject("pointMesh"); + + // Cell-centres coordinates + const volVectorField& C = mesh.C(); + const vectorField& CI = C.internalField(); + + // Point coordinates + const pointField& points = mesh.points(); + + // Cell analytical fields + if (cellDisplacement_ || cellStress_) + { + // Analytical stress field + volSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalCellStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero), + "calculated" + ); + + // Analytical displacement field + volVectorField analyticalD + ( + IOobject + ( + "analyticalD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimLength, vector::zero), + "calculated" + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, cellI) + { + if (cellStress_) + { + sI[cellI] = + cantileverStress(CI[cellI], P_, E_, nu_, L_, D_, I_); + } + + if (cellDisplacement_) + { + aDI[cellI] = + cantileverDisplacement(CI[cellI], P_, E_, nu_, L_, D_, I_); + } + } + + forAll(analyticalStress.boundaryField(), patchI) + { + if (mesh.boundary()[patchI].type() != "empty") + { +#ifdef OPENFOAM_NOT_EXTEND + symmTensorField& sP = analyticalStress.boundaryFieldRef()[patchI]; + vectorField& aDP = analyticalD.boundaryFieldRef()[patchI]; +#else + symmTensorField& sP = analyticalStress.boundaryField()[patchI]; + vectorField& aDP = analyticalD.boundaryField()[patchI]; +#endif + const vectorField& CP = C.boundaryField()[patchI]; + + forAll(sP, faceI) + { + if (cellStress_) + { + sP[faceI] = + cantileverStress + ( + CP[faceI], P_, E_, nu_, L_, D_, I_ + ); + } + + if (cellDisplacement_) + { + aDP[faceI] = + cantileverDisplacement + ( + CP[faceI], P_, E_, nu_, L_, D_, I_ + ); + } + } + } + } + + // Write out the cell analytical fields + if (cellStress_) + { + Info<< "Writing analyticalCellStress field" + << nl << endl; + analyticalStress.write(); + } + + if (cellDisplacement_) + { + Info<< "Writing analyticalD field" + << nl << endl; + analyticalD.write(); + } + + if (cellDisplacement_ && mesh.foundObject("D")) + { + const volVectorField& D = + mesh.lookupObject("D"); + + const volVectorField diff + ( + "DDifference", analyticalD - D + ); + Info<< "Writing DDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff.internalField(); + Info<< " Displacement error norms: mean L1, mean L2, LInf: " << nl + << " Magnitude: " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << endl; + for (int cmptI = 0; cmptI < 3; cmptI++) + { + Info<< " " << cmptI << " " + << gAverage(mag(diffI.component(cmptI))) + << " " << Foam::sqrt(gAverage(magSqr(diffI.component(cmptI)))) + << " " << gMax(mag(diffI.component(cmptI))) + << endl; + } + } + + if (cellStress_ && mesh.foundObject("sigma")) + { + const volSymmTensorField& sigma = + mesh.lookupObject("sigma"); + + volSymmTensorField diff + ( + "cellStressDifference", analyticalStress - sigma + ); + + forAll(diff, cellI) + { + diff[cellI].zz() = 0.0; + diff[cellI].yz() = 0.0; + diff[cellI].xz() = 0.0; + } + + Info<< "Writing sigmaDifference field" << endl; + diff.write(); + + const symmTensorField& diffI = diff; + Info<< " Stress error norms: mean L1, mean L2, LInf: " << nl + << " Magnitude: " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << endl; + + for (int cmptI = 0; cmptI < 6; cmptI++) + { + Info<< " " << cmptI << " " + << gAverage(mag(diffI.component(cmptI))) + << " " << Foam::sqrt(gAverage(magSqr(diffI.component(cmptI)))) + << " " << gMax(mag(diffI.component(cmptI))) + << endl; + } + } + } + + // Point analytical fields + if (pointDisplacement_ || pointStress_) + { + pointSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalPointStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero) + ); + + pointVectorField analyticalD + ( + IOobject + ( + "analyticalPointD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero) + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, pointI) + { + if (pointStress_) + { + sI[pointI] = + cantileverStress(points[pointI], P_, E_, nu_, L_, D_, I_); + } + + if (pointDisplacement_) + { + aDI[pointI] = + cantileverDisplacement + ( + points[pointI], P_, E_, nu_, L_, D_, I_ + ); + } + } + + // Write point analytical fields + if (pointStress_) + { + Info<< "Writing analyticalPointStress field" + << nl << endl; + analyticalStress.write(); + } + + if (pointDisplacement_) + { + Info<< "Writing analyticalPointDisplacement field" + << nl << endl; + analyticalD.write(); + } + + if + ( + pointDisplacement_ + && mesh.foundObject("pointD") + ) + { + const pointVectorField& pointD = + mesh.lookupObject("pointD"); + + const pointVectorField diff + ( + "pointDDifference", analyticalD - pointD + ); + Info<< "Writing pointDDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff.internalField(); + Info<< " Norms: mean L1, mean L2, LInf: " << nl + << " " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << nl << endl; + } + } + + return true; +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cantileverAnalyticalSolution::cantileverAnalyticalSolution +( + const word& name, + const Time& t, + const dictionary& dict +) +: + functionObject(name), + name_(name), + time_(t), + P_(readScalar(dict.lookup("P"))), + E_(readScalar(dict.lookup("E"))), + nu_(readScalar(dict.lookup("nu"))), + L_(readScalar(dict.lookup("L"))), + D_(readScalar(dict.lookup("D"))), + I_(Foam::pow(D_, 3.0)/12.0), + cellDisplacement_ + ( + dict.lookupOrDefault("cellDisplacement", true) + ), + pointDisplacement_ + ( + dict.lookupOrDefault("pointDisplacement", true) + ), + cellStress_ + ( + dict.lookupOrDefault("cellStress", true) + ), + pointStress_ + ( + dict.lookupOrDefault("pointStress", true) + ) +{ + Info<< "Creating " << this->name() << " function object" << endl; + + if (L_ < SMALL || D_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "L and D should both be greater than 0!" + << abort(FatalError); + } + + if (E_ < SMALL || nu_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "E and nu should be positive!" + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::cantileverAnalyticalSolution::start() +{ + return true; +} + + +#ifdef FOAMEXTEND +bool Foam::cantileverAnalyticalSolution::execute(const bool forceWrite) +#else +bool Foam::cantileverAnalyticalSolution::execute() +#endif +{ + return writeData(); +} + + +bool Foam::cantileverAnalyticalSolution::read(const dictionary& dict) +{ + return true; +} + + +#ifdef OPENFOAM_NOT_EXTEND +bool Foam::cantileverAnalyticalSolution::write() +{ + return false; +} +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H new file mode 100644 index 0000000..43a313b --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + cantileverAnalyticalSolution + +Description + FunctionObject that generates the analytical fields for the bending slender + cantilever problem. + + The solution is taken from: + C.E. Augarde, A.J. Deeks, The use of Timoshenko’s exact solution for a + cantilever beam in adaptive analysis. Finite Elements in Analysis and + Design, 44, 2008, 595–601, 10.1016/j.finel.2008.01.010. + + It is assumed that the origin is at the centre of the fixed patch. + + The beam is L long and D deep (thick). + +Author + Philip Cardiff, UCD. All rights reserved. + +SourceFiles + cantileverAnalyticalSolution.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cantileverAnalyticalSolution_H +#define cantileverAnalyticalSolution_H + +#include "functionObject.H" +#include "dictionary.H" +#include "fvMesh.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class cantileverAnalyticalSolution Declaration +\*---------------------------------------------------------------------------*/ + +class cantileverAnalyticalSolution +: + public functionObject +{ + // Private data + + //- Name + const word name_; + + //- Reference to main object registry + const Time& time_; + + //- Load applied in the minus y direction at the other end of the beam + const scalar P_; + + //- Young's modulus + const scalar E_; + + //- Poisson's ratio + const scalar nu_; + + //- Length of the beam + const scalar L_; + + //- Depth of the beam + const scalar D_; + + //- Second moment of area + const scalar I_; + + //- Calculate cell displacement fields + const Switch cellDisplacement_; + + //- Calculate point displacement fields + const Switch pointDisplacement_; + + //- Calculate cell stress fields + const Switch cellStress_; + + //- Calculate point stress fields + const Switch pointStress_; + + + // Private Member Functions + + //- Write data + bool writeData(); + + //- Disallow default bitwise copy construct + cantileverAnalyticalSolution + ( + const cantileverAnalyticalSolution& + ); + + //- Disallow default bitwise assignment + void operator=(const cantileverAnalyticalSolution&); + + +public: + + //- Runtime type information + TypeName("cantileverAnalyticalSolution"); + + + // Constructors + + //- Construct from components + cantileverAnalyticalSolution + ( + const word& name, + const Time&, + const dictionary& + ); + + + // Member Functions + + //- start is called at the start of the time-loop + virtual bool start(); + + //- execute is called at each ++ or += of the time-loop +#ifdef FOAMEXTEND + virtual bool execute(const bool forceWrite); +#else + virtual bool execute(); +#endif + + //- Called when time was set at the end of the Time::operator++ + virtual bool timeSet() + { + return true; + } + + //- Read and set the function object if its data has changed + virtual bool read(const dictionary& dict); + +#ifdef OPENFOAM_NOT_EXTEND + //- Write + virtual bool write(); +#endif + +#ifndef OPENFOAM_NOT_EXTEND + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +#endif +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C new file mode 100644 index 0000000..ce2817d --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . +\*---------------------------------------------------------------------------*/ + +#include "cantileverStressDisplacement.H" + +Foam::symmTensor Foam::cantileverStress +( + const vector& C, + const scalar P, + const scalar E, + const scalar nu, + const scalar L, + const scalar D, + const scalar I +) +{ + symmTensor sigma = symmTensor::zero; + + const scalar x = C.x(); + const scalar y = C.y(); + + sigma.xx() = P*(L - x)*y/I; + sigma.xy() = -(P/(2*I))*(D*D/4 - y*y); + + return sigma; +} + + +Foam::vector Foam::cantileverDisplacement +( + const vector& C, + const scalar P, + const scalar E, + const scalar nu, + const scalar L, + const scalar D, + const scalar I +) +{ + vector disp = vector::zero; + + const scalar x = C.x(); + const scalar y = C.y(); + + disp.x() = (P*y/(6*E*I))*((6*L - 3*x)*x + (2 + nu)*(y*y - D*D/4)); + + disp.y() = + -(P/(6*E*I)) + *( + 3*nu*y*y*(L - x) + (4 + 5*nu)*D*D*x/4 + (3*L - x)*x*x + ); + + return disp; +} + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H new file mode 100644 index 0000000..06fae3d --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + cantileverStressDisplacement + +Description + Functions that calculate the analytical stress and displacement for a + bending slender cantilever problem. +\*---------------------------------------------------------------------------*/ + +#ifndef cantileverStressDisplacement_H +#define cantileverStressDisplacement_H + +#include "symmTensor.H" +#include "vector.H" + +namespace Foam +{ + +symmTensor cantileverStress +( + const vector& C, + const scalar P, + const scalar E, + const scalar nu, + const scalar L, + const scalar D, + const scalar I +); + +vector cantileverDisplacement +( + const vector& C, + const scalar P, + const scalar E, + const scalar nu, + const scalar L, + const scalar D, + const scalar I +); + +} // End namespace Foam + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties index fffeedf..f376492 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties @@ -31,23 +31,24 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + order 3; + faceStencilExtraCells 10; + + weightFunctionCoeffs { - N 1; - Nn 40; - weightFunction radiallySymmetricExponential; + type radiallySymmetricExponential; k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; - calcConditionNumber false; } + calcConditionNumber false; } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/dispErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/dispErrors.gnuplot index 3e91c11..875fe31 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/dispErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/dispErrors.gnuplot @@ -33,16 +33,16 @@ set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 -set output "cantilever_dispErrors-hex.pdf" -plot \ - (2e-6 * x**2) w l ls 1 title "2^{nd} order", \ - (4e-8 * x**3) w l ls 2 title "3^{rd} order", \ - "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ - "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ - "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ - "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ - "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ - "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" +# set output "cantilever_dispErrors-hex.pdf" +# plot \ +# (2e-6 * x**2) w l ls 1 title "2^{nd} order", \ +# (4e-8 * x**3) w l ls 2 title "3^{rd} order", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ +# "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" set output "cantilever_dispErrors_tet-struct.pdf" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/stressErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/stressErrors.gnuplot index e0f82da..1bafc28 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/stressErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/stressErrors.gnuplot @@ -33,14 +33,14 @@ set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 -set output "cantilever_stressErrors_hex.pdf" -plot \ - (0.2 * x**1) w l ls 1 title "1^{st} order", \ - (2e-5 * x**2) w l ls 2 title "2^{nd} order", \ - "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ - "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ - "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ - "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)" +# set output "cantilever_stressErrors_hex.pdf" +# plot \ +# (0.2 * x**1) w l ls 1 title "1^{st} order", \ +# (2e-5 * x**2) w l ls 2 title "2^{nd} order", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)" set output "cantilever_stressErrors_tet-struct.pdf" From 1c4a87ab52fb1905861edab253b60836396c6b14 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Thu, 26 Mar 2026 21:51:46 +0100 Subject: [PATCH 03/23] Refactored Cooks membrane --- .../linearElastic/cooksMembrane/Allrun | 18 +++++++-------- .../base/highOrder/constant/solidProperties | 21 +++++++++--------- .../base/segregated/system/fvSchemes | 2 +- ...ooksMembrane-hookeanTipDispConvergence.pdf | Bin 4 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 papers/JFNK_highOrder/linearElastic/cooksMembrane/plotScripts/cooksMembrane-hookeanTipDispConvergence.pdf diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index 6bd33b0..633eb39 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -8,9 +8,9 @@ source solids4FoamScripts.sh configs=( #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" "BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" - "BASE=base/highOrder NAME=tet.ho.N1 N=1 Nn=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N2 N=2 Nn=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N3 N=3 Nn=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N1 order=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N2 order=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N3 order=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" ) # SNES segregated approach # "BASE=base/snes NAME=hex.seg.lu PETSC_FILE=petscOptions.seg.lu" @@ -107,24 +107,24 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${order}" ]; then + sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraNeiCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraNeiCells};|" constant/solidProperties fi # Run the solver diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties index 6fc7679..5cd1371 100644 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties @@ -31,23 +31,24 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + order 3; + faceStencilExtraCells 10; + + weightFunctionCoeffs { - N 1; - Nn 10; - weightFunction radiallySymmetricExponential; + type radiallySymmetricExponential; k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; - calcConditionNumber false; } + calcConditionNumber false; } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/segregated/system/fvSchemes b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/segregated/system/fvSchemes index c7f10ad..437910f 100644 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/segregated/system/fvSchemes +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/segregated/system/fvSchemes @@ -30,7 +30,7 @@ ddtSchemes gradSchemes { //default extendedLeastSquares 0; - default leastSquares; + default pointCellsLeastSquares; } divSchemes diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/plotScripts/cooksMembrane-hookeanTipDispConvergence.pdf b/papers/JFNK_highOrder/linearElastic/cooksMembrane/plotScripts/cooksMembrane-hookeanTipDispConvergence.pdf deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 From e5c78e05054fd5cdd958d3ff22ba20751f2d848a Mon Sep 17 00:00:00 2001 From: iBatistic Date: Thu, 26 Mar 2026 22:30:27 +0100 Subject: [PATCH 04/23] refactored pressurised cylinder --- .../linearElastic/cantilever/Allrun | 4 +-- .../linearElastic/cooksMembrane/Allrun | 7 +++-- .../linearElastic/pressurisedCylinder/Allrun | 28 +++++++++---------- .../base/highOrder/constant/solidProperties | 21 +++++++------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index b462656..23f4e4f 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -115,8 +115,8 @@ do fi # Update number of stencil cells in the LRECoeffs - if [ -n "${extraNeiCells}" ]; then - sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraNeiCells};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi # Update how Jacobian is calculated diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index 633eb39..35d0a65 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -4,6 +4,9 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Not working with extend version +solids4Foam::caseDoesNotRunWithFoamExtend + # Define configurations as space-separated strings configs=( #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" @@ -123,8 +126,8 @@ do fi # Update number of stencil cells in the LRECoeffs - if [ -n "${extraNeiCells}" ]; then - sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraNeiCells};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi # Run the solver diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun index 7e1d933..7a21475 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun @@ -4,9 +4,8 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh -# Working only with .com version +# Not working with foam-extend solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Compile the cantileverBeam library (cd analyticalPressurisedCylinder && ./Allwmake -j -s) @@ -16,12 +15,12 @@ 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.unstruct.seg GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0" - #"BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 N=3 Nn=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 N=3 Nn=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -97,21 +96,21 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${order}" ]; then + sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -149,7 +148,6 @@ do fi # Extract results from solver log and append them to a summary file - echo; echo "Appending results to ${SUMMARY}" if grep -q "Maximum resident" log.solids4Foam; then MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}') else diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties index 68d6bfa..f376492 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties @@ -31,23 +31,24 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + order 3; + faceStencilExtraCells 10; + + weightFunctionCoeffs { - N 1; - Nn 10; - weightFunction radiallySymmetricExponential; + type radiallySymmetricExponential; k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; - calcConditionNumber false; } + calcConditionNumber false; } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } From 6d6cabe4b85b8343698caa6261cdd873a04cc4d6 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 30 Mar 2026 14:21:47 +0200 Subject: [PATCH 05/23] Updated solidProperties in refactored cases --- .../base/highOrder/constant/solidProperties | 17 ++++++++++------- .../base/highOrder/constant/solidProperties | 17 ++++++++++------- .../2D/base/highOrder/constant/solidProperties | 18 +++++++++++------- .../base/highOrder/constant/solidProperties | 17 ++++++++++------- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties index f376492..4717048 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties @@ -31,15 +31,18 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - order 3; - faceStencilExtraCells 10; - - weightFunctionCoeffs + displacement { - type radiallySymmetricExponential; - k 6; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } + calcConditionNumber false; } - calcConditionNumber false; } stabilisation diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties index 5cd1371..fc91a36 100644 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties @@ -31,15 +31,18 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - order 3; - faceStencilExtraCells 10; - - weightFunctionCoeffs + displacement { - type radiallySymmetricExponential; - k 6; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } + calcConditionNumber false; } - calcConditionNumber false; } stabilisation diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties index f376492..05c3502 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties @@ -31,15 +31,19 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - order 3; - faceStencilExtraCells 10; - - weightFunctionCoeffs + displacement { - type radiallySymmetricExponential; - k 6; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } + calcConditionNumber false; } - calcConditionNumber false; + } stabilisation diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties index f376492..4717048 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties @@ -31,15 +31,18 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - order 3; - faceStencilExtraCells 10; - - weightFunctionCoeffs + displacement { - type radiallySymmetricExponential; - k 6; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } + calcConditionNumber false; } - calcConditionNumber false; } stabilisation From 7e78ade108d8122e7527c23ca62fd8efcdbeca08 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Thu, 2 Apr 2026 22:44:36 +0200 Subject: [PATCH 06/23] Refactor fix for cantilever and cooksMembrane --- .../linearElastic/cantilever/Allrun | 22 +++++++++---------- ...CantileverDisplacementFvPatchVectorField.C | 2 +- ...icalCantileverTractionFvPatchVectorField.C | 2 +- .../linearElastic/cooksMembrane/Allrun | 10 ++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index 23f4e4f..8e010b4 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -23,15 +23,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 order=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 order=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 order=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 order=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 order=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 order=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 order=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 order=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 order=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" + # "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" ) # Define start and end mesh indices @@ -110,8 +110,8 @@ do fi # Update the order in the LRECoeffs - if [ -n "${order}" ]; then - sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C index 2db7898..2d10789 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C @@ -132,7 +132,7 @@ analyticalCantileverDisplacementFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.MLSQuadrature().faceQuadPoints(); + solMod.displacementMLS().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C index 6dd1cb1..3dd3c92 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C @@ -157,7 +157,7 @@ analyticalCantileverTractionFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.MLSQuadrature().faceQuadPoints(); + solMod.displacementMLS().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index 35d0a65..adb95fa 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -11,9 +11,9 @@ solids4Foam::caseDoesNotRunWithFoamExtend configs=( #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" "BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" - "BASE=base/highOrder NAME=tet.ho.N1 order=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N2 order=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N3 order=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N1 polyOrder=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N2 polyOrder=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N3 polyOrder=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" ) # SNES segregated approach # "BASE=base/snes NAME=hex.seg.lu PETSC_FILE=petscOptions.seg.lu" @@ -121,8 +121,8 @@ do fi # Update the order in the LRECoeffs - if [ -n "${order}" ]; then - sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs From 61158ca3aa76319795ef67d7c0ce0d2b0276e99c Mon Sep 17 00:00:00 2001 From: iBatistic Date: Fri, 3 Apr 2026 12:46:26 +0200 Subject: [PATCH 07/23] plateHole refactored --- .../linearElastic/plateHole/Allrun | 35 ++++++++++--------- .../base/highOrder/constant/solidProperties | 24 +++++++------ .../base/segregated/system/controlDict | 5 ++- .../base/segregated/system/fvSchemes | 4 +-- .../linearElastic/pressurisedCylinder/Allrun | 16 ++++----- 5 files changed, 45 insertions(+), 39 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun index 2346891..53aacf3 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun @@ -4,9 +4,10 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh -# Working only with .com version +# Not working with extend version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +(cd analyticalPlateHole && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -17,15 +18,15 @@ configs=( #"BASE=base/segregated NAME=hex.seg USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" #"BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" #"BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" - #"BASE=base/highOrder NAME=hex.ho.N1 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.ho.N2 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.ho.N3 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=20 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.ho.N1 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.ho.N2 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.ho.N3 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 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 USE_DUALMESH=0 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 USE_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -118,21 +119,21 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties index fffeedf..4717048 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties @@ -31,23 +31,27 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 40; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/controlDict b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/controlDict index bc30813..a76ec05 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/controlDict +++ b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/controlDict @@ -16,6 +16,9 @@ FoamFile application solids4Foam; + + +libs ("libanalyticalPlateHole.so"); startFrom startTime; startTime 0; @@ -48,7 +51,7 @@ functions { analyticalSolution { - type plateHoleAnalyticalSolution; + type analyticalPlateHole; farFieldTractionX 1e6; holeRadius 0.5; E 200e+9; diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/fvSchemes b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/fvSchemes index c700d3c..b0951e6 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/fvSchemes +++ b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/system/fvSchemes @@ -36,9 +36,7 @@ divSchemes laplacianSchemes { - default none; - laplacian(DD,D) Gauss linear corrected; - laplacian(DDD,DD) Gauss linear corrected; + default Gauss linear corrected; } snGradSchemes diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun index 7a21475..3d34837 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun @@ -15,12 +15,12 @@ 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.unstruct.seg GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0" - #"BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 PETSC_FILE=petscOptions.snes 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.snes 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.snes HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -96,8 +96,8 @@ do fi # Update the order in the LRECoeffs - if [ -n "${order}" ]; then - sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs From 92713eb7cf56e57955110ea860a0d49f23759b45 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Fri, 3 Apr 2026 12:46:55 +0200 Subject: [PATCH 08/23] Added plateHole analytical function object --- .../plateHole/analyticalPlateHole/Allwmake | 42 ++ .../plateHole/analyticalPlateHole/Make/files | 3 + .../analyticalPlateHole/Make/options | 12 + .../analyticalPlateHoleFunctionObject.C | 489 ++++++++++++++++++ .../analyticalPlateHoleFunctionObject.H | 178 +++++++ 5 files changed, 724 insertions(+) create mode 100755 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake new file mode 100755 index 0000000..5a57e73 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake @@ -0,0 +1,42 @@ +#!/bin/bash +cd "${0%/*}" || exit # Run from this directory + +# Stop at first error +set -e + +# Check if OpenFOAM/FOAM has been sourced +if [[ -z "${WM_PROJECT}" ]] +then + echo "Please source the OpenFOAM/FOAM bashrc first!" + exit 1 +fi + +# Check if the solids4foam installation directory has been set +if [[ -z "${SOLIDS4FOAM_DIR}" ]] +then + echo "Please set SOLIDS4FOAM_DIR, e.g." + echo " export SOLIDS4FOAM_DIR=/Users/philipc/OpenFOAM/philipc-v2312/solids4foam" + exit 1 +fi + +# Compile library +wmake $* libso 2>&1 | tee log.wmake + +# Check if the build succeeded +echo "Checking if the installation was a success:" +N_ERRORS_1=$(find . -name log.wmake | xargs grep " Error " | wc -l) +N_ERRORS_2=$(find . -name log.wmake | xargs grep " Stop." | wc -l) +if [[ $N_ERRORS_1 -gt 0 ]] || [[ $N_ERRORS_2 -gt 0 ]] +then + echo "** BUILD ERROR **" + echo "There were build errors in the following logs:" + echo $(find . -name log.wmake | xargs grep -l " Error ") + echo $(find . -name log.wmake | xargs grep -l " Stop.") + echo; echo "Please examine these logs for additional details"; echo + exit 1 +else + echo "There were no build errors: enjoy!"; echo +fi +echo + +#------------------------------------------------------------------------------ diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files new file mode 100644 index 0000000..02d9700 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files @@ -0,0 +1,3 @@ +analyticalPlateHoleFunctionObject.C + +LIB = $(FOAM_USER_LIBBIN)/libanalyticalPlateHole diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options new file mode 100644 index 0000000..c5b1801 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options @@ -0,0 +1,12 @@ +sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options +sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options + +EXE_INC = \ + $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C new file mode 100644 index 0000000..9bc11ac --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C @@ -0,0 +1,489 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*----------------------------------------------------------------------------*/ + +#include "analyticalPlateHoleFunctionObject.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "pointFields.H" +#include "coordinateSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(analyticalPlateHole, 0); + + addToRunTimeSelectionTable + ( + functionObject, + analyticalPlateHole, + dictionary + ); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::symmTensor Foam::analyticalPlateHole::plateHoleStress +( + const vector& C +) +{ + tensor sigma = tensor::zero; + + // Calculate radial coordinate + const scalar r = ::sqrt(sqr(C.x()) + sqr(C.y())); + + // Calculate circumferential coordinate + const scalar theta = Foam::atan2(C.y(), C.x()); + + const coordinateSystem cs("polarCS", C, vector(0, 0, 1), C/mag(C)); + + sigma.xx() = + T_*(1 - sqr(holeR_)/sqr(r))/2 + + T_ + *(1 + 3*pow(holeR_,4)/pow(r,4) - 4*sqr(holeR_)/sqr(r))*::cos(2*theta)/2; + + sigma.xy() = + - T_ + *(1 - 3*pow(holeR_,4)/pow(r,4) + 2*sqr(holeR_)/sqr(r))*::sin(2*theta)/2; + + sigma.yx() = sigma.xy(); + + sigma.yy() = + T_*(1 + sqr(holeR_)/sqr(r))/2 + - T_*(1 + 3*pow(holeR_,4)/pow(r,4))*::cos(2*theta)/2; + + + // Transformation to Cartesian coordinate system +#ifdef OPENFOAM_ORG + sigma = ((cs.R().R() & sigma) & cs.R().R().T()); +#else + sigma = ((cs.R() & sigma) & cs.R().T()); +#endif + + symmTensor S = symmTensor::zero; + + S.xx() = sigma.xx(); + S.xy() = sigma.xy(); + S.yy() = sigma.yy(); + + return S; +} + + +Foam::vector Foam::analyticalPlateHole::plateHoleDisplacement +( + const vector& C, const symmTensor& sigma +) +{ + // Shear modulus + const scalar mu = E_/(2*(1 + nu_)); + + // Kappa parameter + const scalar kappa = 3 - 4*nu_; + + // Polar coordinates + const scalar r = ::sqrt(sqr(C.x()) + sqr(C.y())); + const scalar theta = atan2(C.y(), C.x()); + + return vector + ( + (holeR_*T_/(8*mu)) + *( + (r/holeR_)*(kappa + 1)*cos(theta) + + (2*holeR_/r)*((1 + kappa)*cos(theta) + cos(3*theta)) + - (2*pow(holeR_, 3)/pow(r,3))*cos(3*theta) + ), + (holeR_*T_/(8*mu)) + *( + (r/holeR_)*(kappa - 3)*sin(theta) + + (2*holeR_/r)*((1 - kappa)*sin(theta) + sin(3*theta)) + - (2*pow(holeR_, 3)/pow(r,3))*sin(3*theta) + ), + 0.0 + ); +} + +bool Foam::analyticalPlateHole::writeData() +{ + // Lookup the solid mesh + const fvMesh* meshPtr = NULL; + if (time_.foundObject("solid")) + { + meshPtr = &(time_.lookupObject("solid")); + } + else + { + meshPtr = &(time_.lookupObject("region0")); + } + const fvMesh& mesh = *meshPtr; + + // Lookup the point mesh + const pointMesh& pMesh = mesh.lookupObject("pointMesh"); + + // Cell-centres coordinates + const volVectorField& C = mesh.C(); + const vectorField& CI = C; + + // Point coordinates + const pointField& points = mesh.points(); + + if (gMin(mag(points)) < SMALL) + { + FatalErrorIn("bool Foam::analyticalPlateHole::writeData()") + << "The hole should be centred on the origin!" + << abort(FatalError); + } + + // Cell analytical fields + if (cellDisplacement_ || cellStress_) + { + // Analytical stress field + volSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalCellStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero), + "calculated" + ); + + // Analytical displacement field + volVectorField analyticalD + ( + IOobject + ( + "analyticalD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimLength, vector::zero), + "calculated" + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, cellI) + { + if (cellStress_) + { + sI[cellI] = plateHoleStress(CI[cellI]); + } + + if (cellDisplacement_) + { + aDI[cellI] = plateHoleDisplacement(CI[cellI], sI[cellI]); + } + } + + forAll(analyticalStress.boundaryField(), patchI) + { + if (mesh.boundary()[patchI].type() != "empty") + { +#ifdef OPENFOAM_NOT_EXTEND + symmTensorField& sP = analyticalStress.boundaryFieldRef()[patchI]; + vectorField& aDP = analyticalD.boundaryFieldRef()[patchI]; +#else + symmTensorField& sP = analyticalStress.boundaryField()[patchI]; + vectorField& aDP = analyticalD.boundaryField()[patchI]; +#endif + const vectorField& CP = C.boundaryField()[patchI]; + + forAll(sP, faceI) + { + if (cellStress_) + { + sP[faceI] = plateHoleStress(CP[faceI]); + } + + if (cellDisplacement_) + { + aDP[faceI] = + plateHoleDisplacement(CP[faceI], sP[faceI]); + } + } + } + } + + // Write out the cell analytical field + if (cellStress_) + { + Info<< "Writing analyticalCellStress field" + << nl << endl; + analyticalStress.write(); + } + + if (cellDisplacement_) + { + Info<< "Writing analyticalD field" + << nl << endl; + analyticalD.write(); + } + + + if (cellStress_ && mesh.foundObject("sigma")) + { + const volSymmTensorField& sigma = + mesh.lookupObject("sigma"); + + volSymmTensorField diff + ( + "cellStressDifference", analyticalStress - sigma + ); + + forAll(diff, cellI) + { + diff[cellI].zz() = 0.0; + diff[cellI].yz() = 0.0; + diff[cellI].xz() = 0.0; + } + + Info<< "Writing sigmaDifference field" << endl; + diff.write(); + + const symmTensorField& diffI = diff; + Info<< " Stress error norms: mean L1, mean L2, LInf: " << nl + << " Magnitude: " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << endl; + + for (int cmptI = 0; cmptI < 6; cmptI++) + { + Info<< " " << cmptI << " " + << gAverage(mag(diffI.component(cmptI))) + << " " << Foam::sqrt(gAverage(magSqr(diffI.component(cmptI)))) + << " " << gMax(mag(diffI.component(cmptI))) + << endl; + } + } + + if (cellDisplacement_ && mesh.foundObject("D")) + { + const volVectorField& D = + mesh.lookupObject("D"); + + const volVectorField diff + ( + "DDifference", analyticalD - D + ); + Info<< "Writing DDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff; + Info<< " Displacement error norms: mean L1, mean L2, LInf: " << nl + << " Magnitude: " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << endl; + for (int cmptI = 0; cmptI < 3; cmptI++) + { + Info<< " " << cmptI << " " + << gAverage(mag(diffI.component(cmptI))) + << " " << Foam::sqrt(gAverage(magSqr(diffI.component(cmptI)))) + << " " << gMax(mag(diffI.component(cmptI))) + << endl; + } + } + } + + // Point analytical fields + if (pointDisplacement_ || pointStress_) + { + pointSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalPointStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero) + ); + + pointVectorField analyticalD + ( + IOobject + ( + "analyticalPointD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero) + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, pointI) + { + if (pointStress_) + { + sI[pointI] = plateHoleStress(points[pointI]); + } + + if (pointDisplacement_) + { + aDI[pointI] = plateHoleDisplacement(points[pointI], sI[pointI]); + } + } + + // Write point analytical fields + if (pointStress_) + { + Info<< "Writing analyticalPointStress" + << nl << endl; + analyticalStress.write(); + } + + if (pointDisplacement_) + { + Info<< "Writing analyticalPointDisplacement" + << nl << endl; + analyticalD.write(); + } + + if + ( + pointDisplacement_ + && mesh.foundObject("pointD") + ) + { + const pointVectorField& pointD = + mesh.lookupObject("pointD"); + + const pointVectorField diff + ( + "pointDDifference", analyticalD - pointD + ); + Info<< "Writing pointDDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff; + Info<< " Norms: mean L1, mean L2, LInf: " << nl + << " " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << nl << endl; + } + } + + return true; +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::analyticalPlateHole::analyticalPlateHole +( + const word& name, + const Time& t, + const dictionary& dict +) +: + functionObject(name), + name_(name), + time_(t), + T_(readScalar(dict.lookup("farFieldTractionX"))), + holeR_(readScalar(dict.lookup("holeRadius"))), + E_(readScalar(dict.lookup("E"))), + nu_(readScalar(dict.lookup("nu"))), + cellDisplacement_ + ( + dict.lookupOrDefault("cellDisplacement", true) + ), + pointDisplacement_ + ( + dict.lookupOrDefault("pointDisplacement", true) + ), + cellStress_ + ( + dict.lookupOrDefault("cellStress", true) + ), + pointStress_ + ( + dict.lookupOrDefault("pointStress", true) + ) +{ + Info<< "Creating " << this->name() << " function object" << endl; + + if (holeR_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "holeRadius should be greater than 0!" + << abort(FatalError); + } + + if (E_ < SMALL || nu_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "E and nu should be positive!" + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::analyticalPlateHole::start() +{ + return true; +} + + +#if FOAMEXTEND + bool Foam::analyticalPlateHole::execute(const bool forceWrite) +#else + bool Foam::analyticalPlateHole::execute() +#endif +{ + return writeData(); +} + + +bool Foam::analyticalPlateHole::read(const dictionary& dict) +{ + return true; +} + + +#ifdef OPENFOAM_NOT_EXTEND +bool Foam::analyticalPlateHole::write() +{ + return false; +} +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H new file mode 100644 index 0000000..f64d112 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H @@ -0,0 +1,178 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + analyticalPlateHole + +Description + FunctionObject that generates the analytical displacement and stress fields + for the "hole in a plate" case. + + The solution is taken from Timoshenko, Theory of Elasticity. + + The analytical solution requires the following inputs: + - farFieldTractionX : far-field traction in the X direction + - holeRadius : radius of the hole centred on the origin + - E : Young's modulus + - nu : Poisson's ratio + +Author + Philip Cardiff, UCD. All rights reserved. + +SourceFiles + analyticalPlateHole.C + +\*---------------------------------------------------------------------------*/ + +#ifndef analyticalPlateHole_H +#define analyticalPlateHole_H + +#include "functionObject.H" +#include "dictionary.H" +#include "fvMesh.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class analyticalPlateHole Declaration +\*---------------------------------------------------------------------------*/ + +class analyticalPlateHole +: + public functionObject +{ + // Private data + + //- Name + const word name_; + + //- Reference to main object registry + const Time& time_; + + //- Far field traction + // It is assumed that it acts in the positive X direction + const scalar T_; + + //- Hole radius + const scalar holeR_; + + //- Young's modulus + const scalar E_; + + //- Poisson's ratio + const scalar nu_; + + //- Calculate cell displacement fields + const Switch cellDisplacement_; + + //- Calculate point displacement fields + const Switch pointDisplacement_; + + //- Calculate cell stress fields + const Switch cellStress_; + + //- Calculate point stress fields + const Switch pointStress_; + + + // Private Member Functions + + //- Analytical stress solution + symmTensor plateHoleStress(const vector& C); + + //- Analytical displacement solution + vector plateHoleDisplacement(const vector& C, const symmTensor& sigma); + + //- Write data + bool writeData(); + + //- Disallow default bitwise copy construct + analyticalPlateHole + ( + const analyticalPlateHole& + ); + + //- Disallow default bitwise assignment + void operator=(const analyticalPlateHole&); + + +public: + + //- Runtime type information + TypeName("analyticalPlateHole"); + + + // Constructors + + //- Construct from components + analyticalPlateHole + ( + const word& name, + const Time&, + const dictionary& + ); + + + // Member Functions + + //- start is called at the start of the time-loop + virtual bool start(); + + //- execute is called at each ++ or += of the time-loop +#if FOAMEXTEND + virtual bool execute(const bool forceWrite); +#else + virtual bool execute(); +#endif + + //- Called when time was set at the end of the Time::operator++ + virtual bool timeSet() + { + return true; + } + + //- Read and set the function object if its data has changed + virtual bool read(const dictionary& dict); + +#ifdef OPENFOAM_NOT_EXTEND + //- Write + virtual bool write(); +#else + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +#endif +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 8b9dcbe6005cc2d4be7ed571e6e55f7dee6b6f01 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 20 Apr 2026 23:14:23 +0200 Subject: [PATCH 09/23] Refactored mms 3D case --- .../manufacturedSolution/mixed/2D/Allrun | 34 ++-- .../manufacturedSolution/trigonometric/Allrun | 46 +++--- .../base/highOrder/constant/solidProperties | 24 +-- .../manufacturedSolution/Make/options | 17 +- .../manufacturedSolution.C | 155 ++---------------- .../manufacturedSolution.H | 17 -- .../manufacturedSolutionFvPatchVectorField.C | 11 +- .../manufacturedSolutionFvPatchVectorField.H | 6 +- 8 files changed, 102 insertions(+), 208 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun index db234b2..42073e8 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun @@ -26,21 +26,21 @@ configs=( # "BASE=base/segregated NAME=tet.unstruct_v1.seg GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=tet.unstruct_v2.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0" - "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 order=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" ) # SNES segregated approach @@ -139,8 +139,8 @@ do fi # Update the order in the LRECoeffs - if [ -n "${order}" ]; then - sed -i "/^\s*order /s|^.*| order ${order};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun index f1ae65d..1166e9c 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun @@ -6,7 +6,10 @@ source solids4FoamScripts.sh # Working only with .com version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +# solids4Foam location path +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder +echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" # Compile the manucafturedSolution library (cd manufacturedSolution && wclean libso && ./Allwmake -j -s) @@ -20,18 +23,18 @@ configs=( "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0" - "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -97,8 +100,11 @@ do solids4Foam::runApplication gmshToFoam gmsh/"${GMSH_FILE}.msh" solids4Foam::runApplication createPatch -overwrite if [ "$USE_DUALMESH" -eq 1 ]; then + cp 0 0.org solids4Foam::runApplication polyDualMesh 30 -overwrite solids4Foam::runApplication combinePatchFaces 45 -overwrite + rm -rf 0 + mv 0.org 0 fi # Optional mesh distortion @@ -115,21 +121,21 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -166,7 +172,7 @@ do CLOCK_TIME=$(grep "ClockTime" log.solids4Foam | awk '{print $7}') fi - if grep -q "Maximum resident" log.solids4Foam; then + if grep -q "Maximum resident" log.solids4Foam; then MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}') else MAX_MEMORY="NaN" diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties index fffeedf..4717048 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties @@ -31,23 +31,27 @@ linearGeometryTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 40; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options index c5b1801..0397381 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options @@ -2,11 +2,26 @@ sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -lmeshTools + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C index b8152bc..b58c528 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C @@ -19,9 +19,7 @@ License #include "manufacturedSolution.H" #include "mathematicalConstants.H" -#include "tetPoints.H" -#include "tetQuadrature.H" -#include "polyMeshTetDecomposition.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -67,123 +65,28 @@ void Foam::manufacturedSolution::calcBodyForces() const if (highOrderIntegration_) { - // Get interpolation order - const dictionary& hoDict = solidModelDict().subDict("highOrderCoeffs"); + const solidModel& solMod = lookupSolidModel(mesh); + const fvMeshQuadrature& quadrature = + solMod.displacementMLS().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); - const label N = readInt(hoDict.subDict("LRECoeffs").lookup("N")); - - const fvMesh& mesh = mesh_; - const List& cells = mesh.cells(); - const pointField& pts = mesh.points(); - //const scalarField& V = mesh.V(); - - // Loop over cells - forAll (cells, cellI) + forAll(bodyForcesI, cellI) { - const cellShape& shape = mesh.cellShapes()[cellI]; - - // Get the vertices (points) of the current cell - const labelList& cellPoints = mesh.cellPoints()[cellI]; - const point& cellC = mesh.C()[cellI]; - const cell& c = mesh.cells()[cellI]; + const List& quadPoints = cellQuadPoints[cellI]; + const List& quadWeights = cellQuadWeights[cellI]; - // Handle tetrahedral cells - if (shape.model() == cellModel::ref(cellModel::TET)) + forAll(quadPoints, pointI) { - const tetPoints tet = - tetPoints - ( - pts[cellPoints[0]], - pts[cellPoints[1]], - pts[cellPoints[2]], - pts[cellPoints[3]] - ); - - // Get tet quadrature points and their weight - const tetQuadrature tq(tet, N); - const List& tetQP = tq.points(); - const List& tetQW = tq.weights(); - - // Loop over quadrature points and calculate contribution to - // cell body force vector - forAll(tetQP, i) - { - const vector& quadPoint = tetQP[i]; - const scalar& weight = tetQW[i]; - const vector bodyForce = calculateBodyForce(quadPoint); - - bodyForcesI[cellI] += weight * bodyForce; - } - } - else - { - scalar cellV = 0.0; - - // Storage for per-cell tets - DynamicList cellTets; - - // Loop over faces of the cell - forAll(c, fI) - { - const label faceI = c[fI]; - const face& f = mesh.faces()[faceI]; - const label nTri = f.nTriangles(); - - faceList triFaces(nTri); - label t2 = 0; - const label t1 = f.triangles(mesh.points(), t2, triFaces); - - if (nTri != t1 || nTri != t2) - { - FatalErrorInFunction - << "Face triangulation mismatch on cell " << cellI - << exit(FatalError); - } - - // For each triangular face, make a tet with the cell centroid - forAll(triFaces, triI) - { - const face& triF = triFaces[triI]; - - // Build tet: (cell centroid + triangle) - tetPoints t - ( - cellC, - mesh.points()[triF[0]], - mesh.points()[triF[1]], - mesh.points()[triF[2]] - ); - tetPointRef tet(t); - cellV += mag(tet.mag()); - - cellTets.append(t); - } - } - - // Now integrate over quadrature points inside each tet - forAll(cellTets, tetI) - { - const tetPoints& subTet = cellTets[tetI]; - tetPointRef subRef(subTet); - - tetQuadrature tq(subTet, N); - const List& tetQP = tq.points(); - const List& tetQW = tq.weights(); - - // Scale weights by tet volume relative to cell volume - //const scalar scaleW = subTet.mag() / cellV; - const scalar scaleW = mag(subRef.mag()) / cellV; - - forAll(tetQP, i) - { - const vector& quadPoint = tetQP[i]; - const scalar& weight = tetQW[i]; - const vector bodyForce = calculateBodyForce(quadPoint); - - bodyForcesI[cellI] += scaleW * weight * bodyForce; - } - } + bodyForcesI[cellI] += + quadWeights[pointI] + *calculateBodyForce(quadPoints[pointI]); } + + bodyForcesI[cellI] /= cellVolumes[cellI]; } } else @@ -223,17 +126,6 @@ Foam::manufacturedSolution::manufacturedSolution mu_(E_/(2.0*(1.0 + nu_))), lambda_((E_*nu_)/((1.0 + nu_)*(1.0 - 2.0*nu_))), highOrderIntegration_(highOrderIntegration), - solidProperties_ - ( - IOobject - ( - "solidProperties", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ), bodyForcesPtr_(nullptr) { if (E_ < SMALL || nu_ < SMALL) @@ -263,17 +155,6 @@ Foam::manufacturedSolution::manufacturedSolution ( dict.lookupOrDefault("highOrderIntegration", false) ), - solidProperties_ - ( - IOobject - ( - "solidProperties", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ), bodyForcesPtr_(nullptr) { if (E_ < SMALL || nu_ < SMALL) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H index f18122d..6e459c1 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H @@ -91,9 +91,6 @@ class manufacturedSolution //- High order volume integration for body force calculation const Switch highOrderIntegration_; - //- Solid properties dictionary - mutable IOdictionary solidProperties_; - //- Body forces mutable autoPtr bodyForcesPtr_; @@ -102,20 +99,6 @@ class manufacturedSolution //- Calculate the body forces field void calcBodyForces() const; - //- Return reference to solid properties dictionary - const dictionary& solidProperties() const - { - return solidProperties_; - } - - //- Return reference to solidModelCoeffs dictionary - const dictionary& solidModelDict() const - { - const word t = word(solidProperties().lookup("solidModel")); - - return solidProperties().subDict(t + "Coeffs"); - } - //- Disallow default bitwise copy construct manufacturedSolution ( diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C index 70b080f..a486349 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C @@ -122,10 +122,15 @@ void manufacturedSolutionFvPatchVectorField::updateCoeffs() autoPtr> manufacturedSolutionFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const +() const { + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.displacementMLS().quadrature().faceQuadPoints(); + // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H index d5f4f7f..b9e6e39 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H @@ -37,6 +37,7 @@ Author #include "fixedDisplacementFvPatchVectorField.H" #include "manufacturedSolution.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -144,9 +145,8 @@ public: //- Return face quadrature values. // Used for high order solvers, input is position of points virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; + () const; + //- Write virtual void write(Ostream&) const; From d95f28b5c3923f1143613a5d8fdcaa1a0baad8a2 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Tue, 21 Apr 2026 12:06:29 +0200 Subject: [PATCH 10/23] Refactoring mms case --- .../base/snes/constant/solidProperties | 14 +- .../manufacturedSolution/mixed/2D/.gitignore | 1 - .../2D/manufacturedSolution/Make/options | 12 -- .../mixed/{2D => }/Allrun | 0 .../mixed/{2D => }/base/highOrder/0 | 0 .../mixed/{2D => }/base/highOrder/Allclean | 0 .../mixed/{2D => }/base/highOrder/Allrun | 0 .../base/highOrder/constant/dynamicMeshDict | 0 .../base/highOrder/constant/fvOptions | 0 .../mixed/{2D => }/base/highOrder/constant/g | 0 .../highOrder/constant/mechanicalProperties | 0 .../base/highOrder/constant/physicsProperties | 0 .../base/highOrder/constant/solidProperties | 0 .../mixed/{2D => }/base/highOrder/gmsh | 0 .../base/highOrder/petscOptions.ksponly | 0 .../{2D => }/base/highOrder/petscOptions.lu | 0 .../{2D => }/base/highOrder/solidProperties | 0 .../highOrder/system/changeDictionaryDict | 0 .../base/highOrder/system/controlDict | 0 .../base/highOrder/system/createPatchDict | 0 .../base/highOrder/system/decomposeParDict | 0 .../base/highOrder/system/extrudeMeshDict | 0 .../{2D => }/base/highOrder/system/fvSchemes | 0 .../{2D => }/base/highOrder/system/fvSolution | 0 .../highOrder/system/perturbMeshPointsDict | 0 .../mixed/{2D => }/base/segregated/0/D | 0 .../mixed/{2D => }/base/segregated/Allclean | 0 .../mixed/{2D => }/base/segregated/Allrun | 0 .../base/segregated/constant/dynamicMeshDict | 0 .../base/segregated/constant/fvOptions | 0 .../mixed/{2D => }/base/segregated/constant/g | 0 .../segregated/constant/mechanicalProperties | 0 .../segregated/constant/physicsProperties | 0 .../base/segregated/constant/solidProperties | 0 .../mixed/{2D => }/base/segregated/gmsh | 0 .../segregated/system/changeDictionaryDict | 0 .../base/segregated/system/controlDict | 0 .../base/segregated/system/createPatchDict | 0 .../base/segregated/system/decomposeParDict | 0 .../base/segregated/system/extrudeMeshDict | 0 .../{2D => }/base/segregated/system/fvSchemes | 0 .../base/segregated/system/fvSolution | 0 .../segregated/system/perturbMeshPointsDict | 0 .../mixed/{2D => }/base/snes/0/D | 0 .../mixed/{2D => }/base/snes/Allclean | 0 .../mixed/{2D => }/base/snes/Allrun | 0 .../base/snes/constant/dynamicMeshDict | 0 .../{2D => }/base/snes/constant/fvOptions | 0 .../mixed/{2D => }/base/snes/constant/g | 0 .../base/snes/constant/mechanicalProperties | 0 .../base/snes/constant/physicsProperties | 0 .../base/snes/constant/solidProperties | 0 .../base/snes/gmsh/hex-structured.geo | 0 .../mixed/{2D => }/base/snes/gmsh/mesh.geo | 0 .../mixed/{2D => }/base/snes/gmsh/mesh.msh | 0 .../snes/gmsh/meshSpacing/meshSpacing.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing1.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing10.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing11.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing12.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing13.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing14.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing15.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing16.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing17.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing18.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing19.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing2.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing20.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing21.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing22.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing23.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing24.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing25.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing26.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing27.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing28.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing29.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing3.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing30.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing31.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing32.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing4.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing5.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing6.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing7.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing8.geo | 0 .../snes/gmsh/meshSpacing/meshSpacing9.geo | 0 .../base/snes/gmsh/poly-structured.geo | 0 .../base/snes/gmsh/tet-structured.geo | 0 .../base/snes/gmsh/tet-unstructured_v1.geo | 0 .../base/snes/gmsh/tet-unstructured_v2.geo | 0 .../{2D => }/base/snes/petscOptions.hypre | 0 .../mixed/{2D => }/base/snes/petscOptions.ilu | 0 .../mixed/{2D => }/base/snes/petscOptions.lu | 0 .../{2D => }/base/snes/petscOptions.seg.hypre | 0 .../base/snes/system/changeDictionaryDict | 0 .../{2D => }/base/snes/system/controlDict | 0 .../{2D => }/base/snes/system/createPatchDict | 0 .../base/snes/system/decomposeParDict | 0 .../{2D => }/base/snes/system/extrudeMeshDict | 0 .../mixed/{2D => }/base/snes/system/fvSchemes | 0 .../{2D => }/base/snes/system/fvSolution | 0 .../base/snes/system/perturbMeshPointsDict | 0 .../{2D => }/manufacturedSolution/Allwmake | 0 .../{2D => }/manufacturedSolution/Make/files | 0 .../mixed/manufacturedSolution/Make/options | 27 ++++ .../manufacturedSolution.C | 122 +++--------------- .../manufacturedSolution.H | 20 --- .../manufacturedSolutionFunctionObject.C | 0 .../manufacturedSolutionFunctionObject.H | 0 .../manufacturedSolutionFvPatchVectorField.C | 11 +- .../manufacturedSolutionFvPatchVectorField.H | 5 +- .../manufacturedSolutionSource.C | 0 .../manufacturedSolutionSource.H | 0 .../Pablo_matlab/hex.struct.N1.txt | 0 .../Pablo_matlab/hex.struct.N2.txt | 0 .../Pablo_matlab/hex.struct.N3.txt | 0 .../Pablo_matlab/tet.struct.N1.txt | 0 .../Pablo_matlab/tet.struct.N2.txt | 0 .../Pablo_matlab/tet.struct.N3.txt | 0 .../Pablo_matlab/tet.unstruct_v1.N1.txt | 0 .../Pablo_matlab/tet.unstruct_v1.N2.txt | 0 .../Pablo_matlab/tet.unstruct_v1.N3.txt | 0 .../Pablo_matlab/tet.unstruct_v2.N1.txt | 0 .../Pablo_matlab/tet.unstruct_v2.N2.txt | 0 .../Pablo_matlab/tet.unstruct_v2.N3.txt | 0 .../{2D => }/plotScripts/dispErrors.gnuplot | 0 .../plotScripts/dispErrorsComparison.gnuplot | 0 .../{2D => }/plotScripts/stressErrors.gnuplot | 0 .../stressErrorsComparison.gnuplot | 0 .../manufacturedSolution/trigonometric/Allrun | 2 +- .../base/snes/constant/solidProperties | 14 +- .../base/snes/constant/solidProperties | 14 +- 134 files changed, 94 insertions(+), 148 deletions(-) delete mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/.gitignore delete mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/options rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/Allrun (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/0 (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/Allclean (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/Allrun (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/dynamicMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/fvOptions (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/g (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/mechanicalProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/physicsProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/constant/solidProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/gmsh (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/petscOptions.ksponly (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/petscOptions.lu (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/solidProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/changeDictionaryDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/controlDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/createPatchDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/decomposeParDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/extrudeMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/fvSchemes (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/fvSolution (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/highOrder/system/perturbMeshPointsDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/0/D (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/Allclean (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/Allrun (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/dynamicMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/fvOptions (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/g (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/mechanicalProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/physicsProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/constant/solidProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/gmsh (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/changeDictionaryDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/controlDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/createPatchDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/decomposeParDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/extrudeMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/fvSchemes (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/fvSolution (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/segregated/system/perturbMeshPointsDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/0/D (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/Allclean (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/Allrun (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/dynamicMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/fvOptions (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/g (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/mechanicalProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/physicsProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/constant/solidProperties (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/hex-structured.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/mesh.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/mesh.msh (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing1.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing10.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing11.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing12.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing13.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing14.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing15.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing16.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing17.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing18.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing19.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing2.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing20.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing21.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing22.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing23.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing24.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing25.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing26.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing27.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing28.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing29.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing3.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing30.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing31.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing32.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing4.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing5.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing6.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing7.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing8.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/meshSpacing/meshSpacing9.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/poly-structured.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/tet-structured.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/tet-unstructured_v1.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/gmsh/tet-unstructured_v2.geo (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/petscOptions.hypre (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/petscOptions.ilu (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/petscOptions.lu (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/petscOptions.seg.hypre (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/changeDictionaryDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/controlDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/createPatchDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/decomposeParDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/extrudeMeshDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/fvSchemes (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/fvSolution (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/base/snes/system/perturbMeshPointsDict (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/Make/files (100%) create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolution.C (67%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolution.H (88%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionFunctionObject.C (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionFunctionObject.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C (94%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H (97%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionSource.C (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/manufacturedSolution/manufacturedSolutionSource.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/hex.struct.N1.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/hex.struct.N2.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/hex.struct.N3.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.struct.N1.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.struct.N2.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.struct.N3.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v1.N1.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v1.N2.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v1.N3.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v2.N1.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v2.N2.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/Pablo_matlab/tet.unstruct_v2.N3.txt (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/dispErrors.gnuplot (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/dispErrorsComparison.gnuplot (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/stressErrors.gnuplot (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{2D => }/plotScripts/stressErrorsComparison.gnuplot (100%) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/constant/solidProperties index 9e17284..5c2d14a 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/constant/solidProperties @@ -32,10 +32,20 @@ linearGeometryTotalDisplacementCoeffs //optionsFile petscOptions.ilu; //optionsFile petscOptions.seg.hypre; + // Stabilisation stabilisation { - type RhieChow; - scaleFactor 0.1; + momentum + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + + pressure + { + type diffStencilLaplacian; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/.gitignore b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/.gitignore deleted file mode 100644 index d009987..0000000 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/.gitignore +++ /dev/null @@ -1 +0,0 @@ -run_* \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/options deleted file mode 100644 index c5b1801..0000000 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/options +++ /dev/null @@ -1,12 +0,0 @@ -sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options -sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options - -EXE_INC = \ - $(VERSION_SPECIFIC_INC) \ - -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/Allrun rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/0 b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/0 similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/0 rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/0 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/Allclean b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/Allclean similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/Allclean rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/Allclean diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/Allrun similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/Allrun rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/Allrun diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/dynamicMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/dynamicMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/dynamicMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/dynamicMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/fvOptions b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/fvOptions similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/fvOptions rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/fvOptions diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/g b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/g similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/g rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/g diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/mechanicalProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/mechanicalProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/mechanicalProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/mechanicalProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/physicsProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/physicsProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/physicsProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/physicsProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/constant/solidProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/gmsh b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/gmsh similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/gmsh rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/gmsh diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/petscOptions.ksponly b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/petscOptions.ksponly rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/petscOptions.lu b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/petscOptions.lu rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/solidProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/changeDictionaryDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/changeDictionaryDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/changeDictionaryDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/changeDictionaryDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/controlDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/controlDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/controlDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/controlDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/createPatchDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/createPatchDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/createPatchDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/createPatchDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/decomposeParDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/decomposeParDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/decomposeParDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/decomposeParDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/extrudeMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/extrudeMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/extrudeMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/extrudeMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/fvSchemes b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/fvSchemes similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/fvSchemes rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/fvSchemes diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/fvSolution b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/fvSolution similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/fvSolution rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/fvSolution diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/perturbMeshPointsDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/perturbMeshPointsDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/highOrder/system/perturbMeshPointsDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/system/perturbMeshPointsDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/0/D b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/0/D similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/0/D rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/0/D diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/Allclean b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/Allclean similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/Allclean rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/Allclean diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/Allrun similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/Allrun rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/Allrun diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/dynamicMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/dynamicMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/dynamicMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/dynamicMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/fvOptions b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/fvOptions similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/fvOptions rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/fvOptions diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/g b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/g similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/g rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/g diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/mechanicalProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/mechanicalProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/mechanicalProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/mechanicalProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/physicsProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/physicsProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/physicsProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/physicsProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/solidProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/constant/solidProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/constant/solidProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/gmsh b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/gmsh similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/gmsh rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/gmsh diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/changeDictionaryDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/changeDictionaryDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/changeDictionaryDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/changeDictionaryDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/controlDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/controlDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/controlDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/controlDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/createPatchDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/createPatchDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/createPatchDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/createPatchDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/decomposeParDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/decomposeParDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/decomposeParDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/decomposeParDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/extrudeMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/extrudeMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/extrudeMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/extrudeMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/fvSchemes b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/fvSchemes similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/fvSchemes rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/fvSchemes diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/fvSolution b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/fvSolution similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/fvSolution rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/fvSolution diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/perturbMeshPointsDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/perturbMeshPointsDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/segregated/system/perturbMeshPointsDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/segregated/system/perturbMeshPointsDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/0/D b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/0/D similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/0/D rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/0/D diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/Allclean b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allclean similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/Allclean rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allclean diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/Allrun rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/dynamicMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/dynamicMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/dynamicMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/dynamicMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/fvOptions b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/fvOptions similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/fvOptions rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/fvOptions diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/g b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/g similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/g rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/g diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/mechanicalProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/mechanicalProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/mechanicalProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/mechanicalProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/physicsProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/physicsProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/physicsProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/physicsProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/solidProperties similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/constant/solidProperties rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/constant/solidProperties diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/hex-structured.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/hex-structured.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/hex-structured.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/hex-structured.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/mesh.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/mesh.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/mesh.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/mesh.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/mesh.msh b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/mesh.msh similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/mesh.msh rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/mesh.msh diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing1.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing1.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing1.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing1.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing10.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing10.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing10.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing10.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing11.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing11.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing11.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing11.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing12.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing12.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing12.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing12.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing13.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing13.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing13.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing13.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing14.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing14.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing14.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing14.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing15.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing15.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing15.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing15.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing16.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing16.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing16.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing16.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing17.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing17.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing17.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing17.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing18.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing18.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing18.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing18.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing19.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing19.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing19.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing19.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing2.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing2.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing2.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing2.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing20.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing20.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing20.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing20.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing21.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing21.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing21.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing21.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing22.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing22.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing22.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing22.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing23.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing23.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing23.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing23.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing24.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing24.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing24.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing24.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing25.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing25.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing25.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing25.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing26.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing26.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing26.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing26.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing27.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing27.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing27.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing27.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing28.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing28.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing28.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing28.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing29.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing29.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing29.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing29.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing3.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing3.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing3.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing3.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing30.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing30.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing30.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing30.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing31.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing31.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing31.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing31.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing32.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing32.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing32.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing32.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing4.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing4.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing4.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing4.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing5.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing5.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing5.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing5.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing6.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing6.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing6.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing6.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing7.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing7.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing7.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing7.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing8.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing8.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing8.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing8.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing9.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing9.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/meshSpacing/meshSpacing9.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/meshSpacing/meshSpacing9.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/poly-structured.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/poly-structured.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/poly-structured.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/poly-structured.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-structured.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-structured.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-structured.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-structured.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-unstructured_v1.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-unstructured_v1.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-unstructured_v1.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-unstructured_v1.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-unstructured_v2.geo b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-unstructured_v2.geo similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/gmsh/tet-unstructured_v2.geo rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/gmsh/tet-unstructured_v2.geo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.hypre b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.hypre similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.hypre rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.hypre diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.ilu b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.ilu similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.ilu rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.ilu diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.lu b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.lu similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.lu rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.lu diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.seg.hypre b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.seg.hypre similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/petscOptions.seg.hypre rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/petscOptions.seg.hypre diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/changeDictionaryDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/changeDictionaryDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/changeDictionaryDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/changeDictionaryDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/controlDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/controlDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/controlDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/controlDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/createPatchDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/createPatchDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/createPatchDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/createPatchDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/decomposeParDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/decomposeParDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/decomposeParDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/decomposeParDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/extrudeMeshDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/extrudeMeshDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/extrudeMeshDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/extrudeMeshDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/fvSchemes b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSchemes similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/fvSchemes rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSchemes diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/fvSolution b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/fvSolution rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/perturbMeshPointsDict b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/perturbMeshPointsDict similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/base/snes/system/perturbMeshPointsDict rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/perturbMeshPointsDict diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Allwmake b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Allwmake rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/files b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/Make/files rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options new file mode 100644 index 0000000..0397381 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options @@ -0,0 +1,27 @@ +sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options +sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options + +EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ + $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ + -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C similarity index 67% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C index 2e22c29..b79fd45 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C @@ -19,6 +19,7 @@ License #include "manufacturedSolution.H" #include "mathematicalConstants.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -71,94 +72,31 @@ void Foam::manufacturedSolution::calcBodyForces() const << abort(FatalError); } - // Get interpolation order - const dictionary& hoDict = solidModelDict().subDict("highOrderCoeffs"); - - const label N = readInt(hoDict.lookup("order")); + const solidModel& solMod = lookupSolidModel(mesh); + const fvMeshQuadrature& quadrature = + solMod.displacementMLS().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); Info<<"Body force is integrated exactly for polynomials of order: " - << N << endl; - - const fvMesh& mesh = mesh_; - const pointField& pts = mesh.points(); - const faceList& faces = mesh.faces(); - const surfaceVectorField Sn(mesh.Sf()/mesh.magSf()); + << quadrature.cellOrder() << endl; - // Loop over cells - forAll (mesh.cells(), cellI) + forAll(bodyForcesI, cellI) { - const cell& c = mesh.cells()[cellI]; + const List& quadPoints = cellQuadPoints[cellI]; + const List& quadWeights = cellQuadWeights[cellI]; - // Get index of face with positive z normal - label faceI = -1; - forAll(c, i) + forAll(quadPoints, pointI) { - label faceIndex = c[i]; - - if (faceIndex > mesh.nInternalFaces()) - { - const label patchID = - mesh.boundaryMesh().whichPatch(faceIndex); - - if (mesh.boundaryMesh()[patchID].type() == "empty") - { - faceI = faceIndex; - break; - } - } + bodyForcesI[cellI] += + quadWeights[pointI] + *calculateBodyForce(quadPoints[pointI]); } - if (faceI == -1) - { - FatalErrorInFunction - << "Inavalid face index, something went wrong!" - << exit(FatalError); - } - - const scalar& faceArea = mag(mesh.faceAreas()[faceI]); - const face& f = faces[faceI]; - const label nTri = f.nTriangles(); - - // Have face triangulate itself (results in faceList) - faceList triFaces(nTri); - label nTmp = 0; - - f.triangles(pts, nTmp, triFaces); - - // Loop over face triangles - forAll(triFaces, triFaceI) - { - const face& triF = triFaces[triFaceI]; - - // Triangle points, forcing z=0 becouse we can have face on - // poitive or negative empty direction - const point a = point(pts[triF[0]].x(), pts[triF[0]].y(), 0.0); - const point b = point(pts[triF[1]].x(), pts[triF[1]].y(), 0.0); - const point c = point(pts[triF[2]].x(), pts[triF[2]].y(), 0.0); - - // Construct triPoints (triangle) - const triPoints triangle = triPoints(a, b, c); - const scalar triArea = triangle.mag(); - - const scalar scaleW = triArea / faceArea; - - // Get triangle quadrature points and their weight - const triQuadrature tq(triangle, N); - - const List& triangleQP = tq.points(); - const List& triangleQPweights = tq.weights(); - - // Loop over quadrature points and calculate contribution to - // cell body force vector - forAll(triangleQP, i) - { - const vector& quadPoint = triangleQP[i]; - const scalar& weight = triangleQPweights[i]; - const vector bodyForce = calculateBodyForce(quadPoint); - - bodyForcesI[cellI] += scaleW * weight * bodyForce; - } - } + bodyForcesI[cellI] /= cellVolumes[cellI]; } } else @@ -193,17 +131,7 @@ Foam::manufacturedSolution::manufacturedSolution mu_(E_/(2.0*(1.0 + nu_))), lambda_((E_*nu_)/((1.0 + nu_)*(1.0 - 2.0*nu_))), highOrderIntegration_(highOrderIntegration), - solidProperties_ - ( - IOobject - ( - "solidProperties", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ) + bodyForcesPtr_(nullptr) { if (E_ < SMALL || nu_ < SMALL) { @@ -229,17 +157,7 @@ Foam::manufacturedSolution::manufacturedSolution ( dict.lookupOrDefault("highOrderIntegration", false) ), - solidProperties_ - ( - IOobject - ( - "solidProperties", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ) + bodyForcesPtr_(nullptr) { if (E_ < SMALL || nu_ < SMALL) { diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.H similarity index 88% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.H index 3c8cc86..8d6f1f8 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolution.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.H @@ -55,9 +55,6 @@ SourceFiles #include "vector.H" #include "fvMesh.H" #include "volFields.H" -#include "triQuadrature.H" -#include "surfaceFields.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -87,9 +84,6 @@ class manufacturedSolution //- High order volume integration for body force calculation const Switch highOrderIntegration_; - //- Solid properties dictionary - mutable IOdictionary solidProperties_; - //- Body forces mutable autoPtr bodyForcesPtr_; @@ -98,20 +92,6 @@ class manufacturedSolution //- Calculate the body forces field void calcBodyForces() const; - //- Return reference to solid properties dictionary - const dictionary& solidProperties() const - { - return solidProperties_; - } - - //- Return reference to solidModelCoeffs dictionary - const dictionary& solidModelDict() const - { - const word t = word(solidProperties().lookup("solidModel")); - - return solidProperties().subDict(t + "Coeffs"); - } - //- Disallow default bitwise copy construct manufacturedSolution ( diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFunctionObject.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.C diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFunctionObject.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C similarity index 94% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C index eef05a4..241bcc1 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C @@ -122,10 +122,15 @@ void manufacturedSolutionFvPatchVectorField::updateCoeffs() autoPtr> manufacturedSolutionFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const +() const { + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.displacementMLS().quadrature().faceQuadPoints(); + // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H similarity index 97% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H index 296bb36..51708a8 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H @@ -38,6 +38,7 @@ Author #include "fixedDisplacementFvPatchVectorField.H" #include "manufacturedSolution.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -143,9 +144,7 @@ public: //- Return face quadrature values. // Used for high order solvers, input is position of points virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; + () const; }; diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionSource.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionSource.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.C diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionSource.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/manufacturedSolution/manufacturedSolutionSource.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N1.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N1.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N1.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N1.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N2.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N2.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N2.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N2.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N3.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N3.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/hex.struct.N3.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/hex.struct.N3.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N1.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N1.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N1.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N1.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N2.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N2.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N2.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N2.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N3.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N3.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.struct.N3.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.struct.N3.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N1.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N1.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N1.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N1.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N2.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N2.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N2.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N2.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N3.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N3.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v1.N3.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v1.N3.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N1.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N1.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N1.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N1.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N2.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N2.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N2.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N2.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N3.txt b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N3.txt similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/Pablo_matlab/tet.unstruct_v2.N3.txt rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/Pablo_matlab/tet.unstruct_v2.N3.txt diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/dispErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/dispErrors.gnuplot rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/dispErrorsComparison.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrorsComparison.gnuplot similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/dispErrorsComparison.gnuplot rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrorsComparison.gnuplot diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/stressErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/stressErrors.gnuplot rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/stressErrorsComparison.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrorsComparison.gnuplot similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/2D/plotScripts/stressErrorsComparison.gnuplot rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrorsComparison.gnuplot diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun index 1166e9c..f640ecf 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun @@ -100,7 +100,7 @@ do solids4Foam::runApplication gmshToFoam gmsh/"${GMSH_FILE}.msh" solids4Foam::runApplication createPatch -overwrite if [ "$USE_DUALMESH" -eq 1 ]; then - cp 0 0.org + cp -r 0 0.org solids4Foam::runApplication polyDualMesh 30 -overwrite solids4Foam::runApplication combinePatchFaces 45 -overwrite rm -rf 0 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/constant/solidProperties index d8b695a..ba2d7ae 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/constant/solidProperties @@ -32,10 +32,20 @@ linearGeometryTotalDisplacementCoeffs //optionsFile petscOptions.ilu; //optionsFile petscOptions.seg.hypre; + // Stabilisation stabilisation { - type RhieChow; - scaleFactor 0.1; + momentum + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + + pressure + { + type diffStencilLaplacian; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/constant/solidProperties index 9e17284..5c2d14a 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/constant/solidProperties @@ -32,10 +32,20 @@ linearGeometryTotalDisplacementCoeffs //optionsFile petscOptions.ilu; //optionsFile petscOptions.seg.hypre; + // Stabilisation stabilisation { - type RhieChow; - scaleFactor 0.1; + momentum + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + + pressure + { + type diffStencilLaplacian; + scaleFactor 0.1; + } } } From d790122fab6c6313a36ca422fa28ad4f9a862367 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Tue, 21 Apr 2026 15:35:07 +0200 Subject: [PATCH 11/23] Added calcOOC scrit for 2dmms and cantilever --- .../cantilever/plotScripts/calcOOC.py | 206 +++++++++++++++ .../mixed/plotScripts/calcOOC.py | 239 ++++++++++++++++++ .../mixed/plotScripts/dispErrors.gnuplot | 12 +- .../mixed/plotScripts/stressErrors.gnuplot | 12 +- .../manufacturedSolution/polynomial/Allrun | 49 ++-- .../base/highOrder/petscOptions.hypre | 1 + .../manufacturedSolution/Make/options | 17 +- .../manufacturedSolution.C | 140 ++-------- .../manufacturedSolutionFvPatchVectorField.C | 12 +- .../manufacturedSolutionFvPatchVectorField.H | 4 +- .../linearElastic/plateHole/Allrun | 5 + 11 files changed, 541 insertions(+), 156 deletions(-) create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/calcOOC.py create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/calcOOC.py create mode 120000 papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/petscOptions.hypre diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/calcOOC.py new file mode 100644 index 0000000..c1a38d0 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/plotScripts/calcOOC.py @@ -0,0 +1,206 @@ +import os +import numpy as np +import pandas as pd + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(2, 10) +# Use None to fit all rows +fit_subset = slice(-10, None) + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 0.2 + +# List of cases +cases = [ + { + "input_file": "tet.unstruct.ho.N1.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N2.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N3.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.struct.ho.N1.summary.txt", + "mesh_type": "struct-tri2d", + }, + { + "input_file": "tet.struct.ho.N2.summary.txt", + "mesh_type": "struct-tri2d", + }, + { + "input_file": "tet.struct.ho.N3.summary.txt", + "mesh_type": "struct-tri2d", + }, +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + return pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/calcOOC.py new file mode 100644 index 0000000..6b3d531 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/calcOOC.py @@ -0,0 +1,239 @@ +import os +import numpy as np +import pandas as pd + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(-10, None) for last 10 +# Use None to fit all rows +fit_subset = None + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 1 + +# List of cases +cases = [ + { + "input_file": "hex.struct.ho.N1.summary.txt", + "mesh_type": "struct-hex2d", + }, + { + "input_file": "hex.struct.ho.N2.summary.txt", + "mesh_type": "struct-hex2d", + }, + { + "input_file": "hex.struct.ho.N3.summary.txt", + "mesh_type": "struct-hex2d", + }, + { + "input_file": "tet.struct.ho.N1.summary.txt", + "mesh_type": "struct-tri2d", + }, + { + "input_file": "tet.struct.ho.N2.summary.txt", + "mesh_type": "struct-tri2d", + }, + { + "input_file": "tet.struct.ho.N3.summary.txt", + "mesh_type": "struct-tri2d", + }, + { + "input_file": "tet.unstruct_v2.ho.N1.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct_v2.ho.N2.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct_v2.ho.N3.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "poly.struct.ho.N1.summary.txt", + "mesh_type": "struct-poly2d", + }, + { + "input_file": "poly.struct.ho.N2.summary.txt", + "mesh_type": "struct-poly2d", + }, + { + "input_file": "poly.struct.ho.N3.summary.txt", + "mesh_type": "struct-poly2d", + }, +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + data = pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + # Convert everything to numeric where possible + for col in ["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"]: + data[col] = pd.to_numeric(data[col], errors="coerce") + + # Remove rows with missing mandatory values + data = data.dropna(subset=["Mesh", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"]) + + return data + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot index cd370cb..746ee1e 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/dispErrors.gnuplot @@ -83,9 +83,9 @@ plot \ (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ - "poly.struct.ho.N1.summary.txt" u (1*(1/$4)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ - "poly.struct.ho.N1.summary.txt" u (1*(1/$4)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ - "poly.struct.ho.N2.summary.txt" u (1*(1/$4)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ - "poly.struct.ho.N2.summary.txt" u (1*(1/$4)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ - "poly.struct.ho.N3.summary.txt" u (1*(1/$4)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ - "poly.struct.ho.N3.summary.txt" u (1*(1/$4)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot index 2faa6e4..6b8fb00 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/plotScripts/stressErrors.gnuplot @@ -83,9 +83,9 @@ plot \ (5e-3 * x) w l ls 1 title "1^{st} order", \ (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ - "poly.struct.ho.N1.summary.txt" u (1*(1/$4)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ - "poly.struct.ho.N1.summary.txt" u (1*(1/$4)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ - "poly.struct.ho.N2.summary.txt" u (1*(1/$4)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ - "poly.struct.ho.N2.summary.txt" u (1*(1/$4)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ - "poly.struct.ho.N3.summary.txt" u (1*(1/$4)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ - "poly.struct.ho.N3.summary.txt" u (1*(1/$4)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun index f082c6c..6aa62c0 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun @@ -1,4 +1,4 @@ -#!/bin/bash +3;170;20M#!/bin/bash # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions @@ -6,7 +6,10 @@ source solids4FoamScripts.sh # Working only with .com version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +# solids4Foam location path +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder +echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" # Compile the manucafturedSolution library (cd manufacturedSolution && wclean libso && ./Allwmake -j -s) @@ -21,18 +24,18 @@ configs=( # "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=poly.seg GMSH_FILE=tet-unstructured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0" - # "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=25 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=25 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.ksponly" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=25 PETSC_FILE=petscOptions.ksponly" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.ksponly" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=poly.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=1 Nn=25 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=poly.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.ksponly" - # "BASE=base/highOrder NAME=poly.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.ksponly" + # "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=poly.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=poly.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=poly.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -113,13 +116,23 @@ do fi # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" 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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/petscOptions.hypre b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/petscOptions.hypre new file mode 120000 index 0000000..48294a3 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/petscOptions.hypre @@ -0,0 +1 @@ +../snes/petscOptions.hypre \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options index c5b1801..0397381 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options @@ -2,11 +2,26 @@ sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -lmeshTools + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C index 96f7c54..b98df17 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C @@ -64,144 +64,48 @@ void Foam::manufacturedSolution::calcBodyForces() const // Set the body force term vectorField& bodyForcesI = bodyForcesPtr_(); - //scalar gV = 0.0; + vector totalBodyForce = vector::zero; if (highOrderIntegration_) { - // Get interpolation order - const dictionary& hoDict = solidModelDict().subDict("highOrderCoeffs"); - - const label N = readInt(hoDict.subDict("LRECoeffs").lookup("N")); - - const fvMesh& mesh = mesh_; - const List& cells = mesh.cells(); - const pointField& pts = mesh.points(); - //const scalarField& V = mesh.V(); + const solidModel& solMod = lookupSolidModel(mesh); + const fvMeshQuadrature& quadrature = + solMod.displacementMLS().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); - // Loop over cells - forAll (cells, cellI) + forAll(bodyForcesI, cellI) { - const cellShape& shape = mesh.cellShapes()[cellI]; - - // Get the vertices (points) of the current cell - const labelList& cellPoints = mesh.cellPoints()[cellI]; - const point& cellC = mesh.C()[cellI]; - const cell& c = mesh.cells()[cellI]; + const List& quadPoints = cellQuadPoints[cellI]; + const List& quadWeights = cellQuadWeights[cellI]; - // // Handle tetrahedral cells - if (shape.model() == cellModel::ref(cellModel::TET)) + forAll(quadPoints, pointI) { - const tetPoints tet = - tetPoints - ( - pts[cellPoints[0]], - pts[cellPoints[1]], - pts[cellPoints[2]], - pts[cellPoints[3]] - ); - - // Get tet quadrature points and their weight - const tetQuadrature tq(tet, N); - const List& tetQP = tq.points(); - const List& tetQW = tq.weights(); - - // Loop over quadrature points and calculate contribution to - // cell body force vector - forAll(tetQP, i) - { - const vector& quadPoint = tetQP[i]; - const scalar& weight = tetQW[i]; - const vector bodyForce = calculateBodyForce(quadPoint); - - bodyForcesI[cellI] += weight * bodyForce; - } - } - else - { - scalar cellV = 0.0; - - // Storage for per-cell tets - DynamicList cellTets; - - // Loop over faces of the cell - forAll(c, fI) - { - const label faceI = c[fI]; - const face& f = mesh.faces()[faceI]; - const label nTri = f.nTriangles(); - - faceList triFaces(nTri); - label t2 = 0; - const label t1 = f.triangles(mesh.points(), t2, triFaces); - - if (nTri != t1 || nTri != t2) - { - FatalErrorInFunction - << "Face triangulation mismatch on cell " << cellI - << exit(FatalError); - } - - // For each triangular face, make a tet with the cell centroid - forAll(triFaces, triI) - { - const face& triF = triFaces[triI]; - - // Build tet: (cell centroid + triangle) - tetPoints t( - cellC, - mesh.points()[triF[0]], - mesh.points()[triF[1]], - mesh.points()[triF[2]] - ); - tetPointRef tet(t); - cellV += mag(tet.mag()); - //gV += mag(tet.mag()); - cellTets.append(t); - } - } - - //Info<< cellV << endl; - //Info<< mesh.V()[cellI] << endl; - //Info << nl << endl; - - // Now integrate over quadrature points inside each tet - forAll(cellTets, tetI) - { - const tetPoints& subTet = cellTets[tetI]; - tetPointRef subRef(subTet); - - tetQuadrature tq(subTet, N); - const List& tetQP = tq.points(); - const List& tetQW = tq.weights(); - - // Scale weights by tet volume relative to cell volume - //const scalar scaleW = subTet.mag() / cellV; - //const scalar scaleW = mag(subRef.mag()) / cellV; - forAll(tetQP, i) - { - const vector& quadPoint = tetQP[i]; - const scalar& weight = tetQW[i]; - const vector bodyForce = calculateBodyForce(quadPoint); - - //bodyForcesI[cellI] += scaleW * weight * bodyForce; - bodyForcesI[cellI] += weight * bodyForce * mag(subRef.mag()); - } - } - bodyForcesI[cellI] /= cellV; - totalBodyForce += cellV*bodyForcesI[cellI]; + bodyForcesI[cellI] += + quadWeights[pointI] + *calculateBodyForce(quadPoints[pointI]); } + + bodyForcesI[cellI] /= cellVolumes[cellI]; + totalBodyForce += cellVolumes[cellI]*bodyForcesI[cellI]; } } else { // second order volume integration using mid-point rule const vectorField& cellCentres = mesh.C(); + const scalarField& cellVolumes = mesh.V(); + forAll(bodyForcesI, cellI) { const vector& cellCentre = cellCentres[cellI]; bodyForcesI[cellI] = calculateBodyForce(cellCentre); + totalBodyForce += cellVolumes[cellI]*bodyForcesI[cellI]; } } diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C index 70b080f..5bc15c7 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C @@ -122,11 +122,15 @@ void manufacturedSolutionFvPatchVectorField::updateCoeffs() autoPtr> manufacturedSolutionFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const +() const { - // faceQuadPoints is list for whole mesh. + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.displacementMLS().quadrature().faceQuadPoints(); + labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); forAll(nQpPerFace, faceI) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H index d5f4f7f..5b99628 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H @@ -144,9 +144,7 @@ public: //- Return face quadrature values. // Used for high order solvers, input is position of points virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; + () const; //- Write virtual void write(Ostream&) const; diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun index 53aacf3..ad6752e 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun @@ -7,6 +7,11 @@ source solids4FoamScripts.sh # Not working with extend version solids4Foam::caseDoesNotRunWithFoamExtend +# solids4Foam location path +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib-highOrder +echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" + +# Compile the analyticalPlateHole library (cd analyticalPlateHole && ./Allwmake -j -s) # Define configurations as space-separated strings From 7e46f33d4bd1225bef5f8502052d1264097c3c89 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Tue, 28 Apr 2026 21:54:59 +0200 Subject: [PATCH 12/23] Refactoring updates --- .../linearElastic/cantilever/Allrun | 4 +- .../linearElastic/cooksMembrane/Allrun | 4 +- .../manufacturedSolution.C | 6 +- .../manufacturedSolution/polynomial/Allrun | 2 +- .../base/highOrder/constant/solidProperties | 26 +- .../manufacturedSolution.C | 7 +- .../manufacturedSolution/trigonometric/Allrun | 4 +- .../trigonometric/Allrun.alphaAnalysis | 13 +- .../manufacturedSolution.C | 9 +- .../trigonometric/plotScripts/calcOOC.py | 239 ++++++++++++++++ .../plotScripts/efficiency.gnuplot | 2 +- .../linearElastic/plateHole/Allrun | 4 +- .../plateHole/plotScripts/calcOOC.py | 257 ++++++++++++++++++ .../linearElastic/pressurisedCylinder/Allrun | 4 +- .../plotScripts/calcOOC.py | 257 ++++++++++++++++++ .../linearElastic/sphericalCavity/Allrun | 30 +- .../base/highOrder/constant/solidProperties | 26 +- .../sphericalCavity/base/snes/0/D | 13 +- .../sphericalCavity/plotScripts/calcOOC.py | 257 ++++++++++++++++++ .../plotScripts/dispErrors.gnuplot | 3 +- .../plotScripts/stressErrors.gnuplot | 1 + 21 files changed, 1084 insertions(+), 84 deletions(-) create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/calcOOC.py create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/plotScripts/calcOOC.py create mode 100644 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/plotScripts/calcOOC.py create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/calcOOC.py diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index 8e010b4..d235f9e 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -109,12 +109,12 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index adb95fa..8768354 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -120,12 +120,12 @@ do sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi - # Update the order in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C index b79fd45..ab9b679 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C @@ -79,7 +79,6 @@ void Foam::manufacturedSolution::calcBodyForces() const quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = quadrature.cellQuadWeights(); - const scalarField& cellVolumes = mesh.V(); Info<<"Body force is integrated exactly for polynomials of order: " << quadrature.cellOrder() << endl; @@ -92,11 +91,8 @@ void Foam::manufacturedSolution::calcBodyForces() const forAll(quadPoints, pointI) { bodyForcesI[cellI] += - quadWeights[pointI] - *calculateBodyForce(quadPoints[pointI]); + quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } - - bodyForcesI[cellI] /= cellVolumes[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun index 6aa62c0..85b51a0 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun @@ -1,4 +1,4 @@ -3;170;20M#!/bin/bash +#!/bin/bash # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties index c67ee34..4717048 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties @@ -28,26 +28,30 @@ linearGeometryTotalDisplacementCoeffs highOrderCoeffs { - highOrderJacobian true; + highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 40; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type RhieChow; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C index b98df17..3940409 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C @@ -76,7 +76,6 @@ void Foam::manufacturedSolution::calcBodyForces() const quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = quadrature.cellQuadWeights(); - const scalarField& cellVolumes = mesh.V(); forAll(bodyForcesI, cellI) { @@ -86,12 +85,10 @@ void Foam::manufacturedSolution::calcBodyForces() const forAll(quadPoints, pointI) { bodyForcesI[cellI] += - quadWeights[pointI] - *calculateBodyForce(quadPoints[pointI]); + quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } - bodyForcesI[cellI] /= cellVolumes[cellI]; - totalBodyForce += cellVolumes[cellI]*bodyForcesI[cellI]; + totalBodyForce += quadVolume*bodyForcesI[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun index f640ecf..c99fc1b 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun @@ -120,12 +120,12 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis index b3c14da..508adbe 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis @@ -6,7 +6,6 @@ source solids4FoamScripts.sh # Working only with .com version solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Compile the manucafturedSolution library (cd manufacturedSolution && wclean libso && ./Allwmake -j -s) @@ -121,26 +120,26 @@ do # Update the order in the LRECoeffs if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${N};|" constant/solidProperties fi # Update number of stencil cells in the LRECoeffs if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${Nn};|" constant/solidProperties fi scaleFactor 0.1; - # Update alpha factor + # Update alpha factor if [ -n "${ALPHA}" ]; then sed -i "/^\s*scaleFactor /s|^.*| scaleFactor ${ALPHA};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -177,7 +176,7 @@ do CLOCK_TIME=$(grep "ClockTime" log.solids4Foam | awk '{print $7}') fi - if grep -q "Maximum resident" log.solids4Foam; then + if grep -q "Maximum resident" log.solids4Foam; then MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}') else MAX_MEMORY="NaN" diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C index b58c528..1fd6d5e 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C @@ -20,6 +20,9 @@ License #include "manufacturedSolution.H" #include "mathematicalConstants.H" #include "lookupSolidModel.H" +#include "tetPoints.H" +#include "tetQuadrature.H" +#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -72,7 +75,6 @@ void Foam::manufacturedSolution::calcBodyForces() const quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = quadrature.cellQuadWeights(); - const scalarField& cellVolumes = mesh.V(); forAll(bodyForcesI, cellI) { @@ -82,11 +84,8 @@ void Foam::manufacturedSolution::calcBodyForces() const forAll(quadPoints, pointI) { bodyForcesI[cellI] += - quadWeights[pointI] - *calculateBodyForce(quadPoints[pointI]); + quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } - - bodyForcesI[cellI] /= cellVolumes[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/calcOOC.py new file mode 100644 index 0000000..6d55ee8 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/calcOOC.py @@ -0,0 +1,239 @@ +import os +import numpy as np +import pandas as pd + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(-10, None) for last 10 +# Use None to fit all rows +fit_subset = None + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 0.008 + +# List of cases +cases = [ + { + "input_file": "hex.struct.ho.N1.summary.txt", + "mesh_type": "struct-hex", + }, + { + "input_file": "hex.struct.ho.N2.summary.txt", + "mesh_type": "struct-hex", + }, + { + "input_file": "hex.struct.ho.N3.summary.txt", + "mesh_type": "struct-hex", + }, + { + "input_file": "tet.struct.ho.N1.summary.txt", + "mesh_type": "struct-tet", + }, + { + "input_file": "tet.struct.ho.N2.summary.txt", + "mesh_type": "struct-tet", + }, + { + "input_file": "tet.struct.ho.N3.summary.txt", + "mesh_type": "struct-tet", + }, + { + "input_file": "tet.unstruct.ho.N1.summary.txt", + "mesh_type": "unstruct-tet", + }, + { + "input_file": "tet.unstruct.ho.N2.summary.txt", + "mesh_type": "unstruct-tet", + }, + { + "input_file": "tet.unstruct.ho.N3.summary.txt", + "mesh_type": "unstruct-tet", + }, + { + "input_file": "poly.struct.ho.N1.summary.txt", + "mesh_type": "struct-poly", + }, + { + "input_file": "poly.struct.ho.N2.summary.txt", + "mesh_type": "struct-poly", + }, + { + "input_file": "poly.struct.ho.N3.summary.txt", + "mesh_type": "struct-poly", + }, +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + data = pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + # Convert everything to numeric where possible + for col in ["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"]: + data[col] = pd.to_numeric(data[col], errors="coerce") + + # Remove rows with missing mandatory values + data = data.dropna(subset=["Mesh", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"]) + + return data + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/efficiency.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/efficiency.gnuplot index 4988be5..06d1b42 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/efficiency.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/plotScripts/efficiency.gnuplot @@ -99,7 +99,7 @@ plot \ "poly.struct.ho.N3.summary.txt" u 2:($7*1e-6) w lp ls 31 title "{/Times-Italic p}_{ }=3" set output "mms_3D_memoryEfficiency_hex_struct.pdf" -set xrange [0.1:10] +set xrange [0.05:10] set xlabel "Memory (in MB)" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun index ad6752e..9d930f3 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun @@ -123,12 +123,12 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/plateHole/plotScripts/calcOOC.py new file mode 100644 index 0000000..735747c --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/plotScripts/calcOOC.py @@ -0,0 +1,257 @@ +import os +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(2, 10) +# Use None to fit all rows +fit_subset = None + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 3.803650459 + +# List of cases +cases = [ + { + "input_file": "tet.unstruct.ho.N1.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N2.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N3.summary.txt", + "mesh_type": "unstruct-tri2d", + } +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + return pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + plot_convergence( + h=fit_data["h"], + error=fit_data["D_L2"], + label="D_L2", + fit_subset=None, + title=f"{input_file} - D_L2", + save_path=f"{input_file}_D_L2.png" + ) + + +def plot_convergence(h, error, label, fit_subset=None, title=None, save_path=None): + h = np.asarray(h, dtype=float) + error = np.asarray(error, dtype=float) + + # Filter valid values + mask = np.isfinite(h) & np.isfinite(error) & (h > 0) & (error > 0) + h = h[mask] + error = error[mask] + + logh = np.log(h) + loge = np.log(error) + + # Fit on full data + p_all, c_all = np.polyfit(logh, loge, 1) + + # Fit on subset (optional) + if fit_subset is not None: + h_sub = h[fit_subset] + e_sub = error[fit_subset] + p_sub, c_sub = np.polyfit(np.log(h_sub), np.log(e_sub), 1) + else: + p_sub, c_sub = None, None + + # Generate smooth line for plotting + h_fit = np.linspace(min(h), max(h), 200) + e_fit_all = np.exp(c_all) * h_fit**p_all + + plt.figure(figsize=(6, 5)) + + # Raw data + plt.loglog(h, error, 'o-', label=f"{label} (data)") + + # Full fit + plt.loglog(h_fit, e_fit_all, '--', label=f"fit (all): p={p_all:.2f}") + + # Subset fit + if fit_subset is not None: + e_fit_sub = np.exp(c_sub) * h_fit**p_sub + plt.loglog(h_fit, e_fit_sub, ':', label=f"fit (subset): p={p_sub:.2f}") + + plt.xlabel("h") + plt.ylabel("Error") + if title: + plt.title(title) + + plt.grid(True, which="both", ls="--", alpha=0.5) + plt.legend() + + if save_path: + plt.savefig(save_path, dpi=300, bbox_inches="tight") + + plt.show() + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun index 3d34837..a447ab2 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun @@ -95,12 +95,12 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/plotScripts/calcOOC.py new file mode 100644 index 0000000..735747c --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/plotScripts/calcOOC.py @@ -0,0 +1,257 @@ +import os +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(2, 10) +# Use None to fit all rows +fit_subset = None + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 3.803650459 + +# List of cases +cases = [ + { + "input_file": "tet.unstruct.ho.N1.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N2.summary.txt", + "mesh_type": "unstruct-tri2d", + }, + { + "input_file": "tet.unstruct.ho.N3.summary.txt", + "mesh_type": "unstruct-tri2d", + } +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + return pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + plot_convergence( + h=fit_data["h"], + error=fit_data["D_L2"], + label="D_L2", + fit_subset=None, + title=f"{input_file} - D_L2", + save_path=f"{input_file}_D_L2.png" + ) + + +def plot_convergence(h, error, label, fit_subset=None, title=None, save_path=None): + h = np.asarray(h, dtype=float) + error = np.asarray(error, dtype=float) + + # Filter valid values + mask = np.isfinite(h) & np.isfinite(error) & (h > 0) & (error > 0) + h = h[mask] + error = error[mask] + + logh = np.log(h) + loge = np.log(error) + + # Fit on full data + p_all, c_all = np.polyfit(logh, loge, 1) + + # Fit on subset (optional) + if fit_subset is not None: + h_sub = h[fit_subset] + e_sub = error[fit_subset] + p_sub, c_sub = np.polyfit(np.log(h_sub), np.log(e_sub), 1) + else: + p_sub, c_sub = None, None + + # Generate smooth line for plotting + h_fit = np.linspace(min(h), max(h), 200) + e_fit_all = np.exp(c_all) * h_fit**p_all + + plt.figure(figsize=(6, 5)) + + # Raw data + plt.loglog(h, error, 'o-', label=f"{label} (data)") + + # Full fit + plt.loglog(h_fit, e_fit_all, '--', label=f"fit (all): p={p_all:.2f}") + + # Subset fit + if fit_subset is not None: + e_fit_sub = np.exp(c_sub) * h_fit**p_sub + plt.loglog(h_fit, e_fit_sub, ':', label=f"fit (subset): p={p_sub:.2f}") + + plt.xlabel("h") + plt.ylabel("Error") + if title: + plt.title(title) + + plt.grid(True, which="both", ls="--", alpha=0.5) + plt.legend() + + if save_path: + plt.savefig(save_path, dpi=300, bbox_inches="tight") + + plt.show() + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun index 7cb2f76..d7b68db 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun @@ -8,14 +8,14 @@ source solids4FoamScripts.sh configs=( #"BASE=base/snes NAME=tet.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=tet" "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/snes NAME=poly.unstruct.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=poly" "BASE=base/segregated NAME=poly.unstruct.seg GMSH_FILE=poly" - "BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/snes NAME=poly.unstruct.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=poly" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" ) # Define start and end mesh indices @@ -122,22 +122,22 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + # Update the order + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + # Update number of stencil cells + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties index 2f5f021..dfa3965 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties @@ -24,30 +24,34 @@ linearGeometryTotalDisplacementCoeffs // Solution algorithm //solutionAlgorithm implicitCoupled; solutionAlgorithm PETScSNES; - optionsFile petscOptions.ksponly; + optionsFile petscOptions.hypre; highOrderCoeffs { highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 45; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/0/D b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/0/D index 851961c..f1182b5 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/0/D +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/0/D @@ -74,22 +74,11 @@ boundaryField } cavity { - //type analyticalSphericalCavityTraction; + type analyticalSphericalCavityTraction; farFieldTractionZ 1e6; cavityRadius 0.2; E 200e+09; nu 0.3; - // value uniform (0 0 0); - type solidTraction; - traction uniform ( 0 0 0 ); - pressure uniform 0; - value uniform (0 0 0); - // type analyticalSphericalCavityDisplacement; - // farFieldTractionZ 1e6; - // cavityRadius 0.2; - // E 200e+09; - // nu 0.3; - // value uniform (0 0 0); } posX { diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/calcOOC.py b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/calcOOC.py new file mode 100644 index 0000000..eff5c86 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/calcOOC.py @@ -0,0 +1,257 @@ +import os +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +# ============================================================ +# INPUTS +# ============================================================ + +# Set to True if you want pairwise orders +print_pairwise_orders = False + +# Optional: restrict fit to a subset of rows, e.g. slice(2, 10) +# Use None to fit all rows +fit_subset = None + +# Directory containing the txt files +script_dir = os.path.dirname(os.path.abspath(__file__)) + +# Domain size (area in 2D, volume in 3D) +domain_measure = 0.104056049 + +# List of cases +cases = [ + { + "input_file": "tet.unstruct.ho.N1.summary.txt", + "mesh_type": "unstruct-tet", + }, + { + "input_file": "tet.unstruct.ho.N2.summary.txt", + "mesh_type": "unstruct-tet", + }, + { + "input_file": "tet.unstruct.ho.N3.summary.txt", + "mesh_type": "unstruct-tet", + } +] + +error_columns = ["D_L2", "D_Linf", "S_L2", "S_Linf"] + +# ============================================================ +# FUNCTIONS +# ============================================================ + +def compute_characteristic_h(cells_number, mesh_type): + """ + Compute characteristic mesh size h from total area/volume and number of cells. + + Definitions used: + + 2D: + struct-hex2D : h = sqrt(A / N) + struct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + unstruct-tri2D : h = sqrt(4 * (A / N) / sqrt(3)) + struct-poly2D : h = sqrt(4 * (A / N) / pi) + + 3D: + struct-hex : h = (V / N)^(1/3) + struct-poly : h = (6 * (V / N) / pi)^(1/3) + struct-tet : h = (8.48528 * (V / N))^(1/3) + unstruct-tet : h = (8.48528 * (V / N))^(1/3) + """ + mesh_type = mesh_type.lower() + avg_measure = domain_measure / cells_number + + if mesh_type == "struct-hex2d": + return avg_measure ** 0.5 + + elif mesh_type in ["struct-tri2d", "unstruct-tri2d"]: + return (4.0 * avg_measure / np.sqrt(3.0)) ** 0.5 + + elif mesh_type == "struct-poly2d": + return (4.0 * avg_measure / np.pi) ** 0.5 + + elif mesh_type == "struct-hex": + return avg_measure ** (1.0 / 3.0) + + elif mesh_type == "struct-poly": + return (6.0 * avg_measure / np.pi) ** (1.0 / 3.0) + + elif mesh_type in ["struct-tet", "unstruct-tet"]: + return (8.48528 * avg_measure) ** (1.0 / 3.0) + + else: + raise ValueError(f"Unsupported mesh type: {mesh_type}") + + +def fit_loglog_slope(h, error): + """ + Fit log(error) = p*log(h) + c + + Returns: + p -> observed order of convergence + c -> intercept + r2 -> coefficient of determination + """ + logh = np.log(h) + loge = np.log(error) + + p, c = np.polyfit(logh, loge, 1) + + fitted = p * logh + c + ss_res = np.sum((loge - fitted) ** 2) + ss_tot = np.sum((loge - np.mean(loge)) ** 2) + r2 = 1.0 - ss_res / ss_tot if ss_tot > 0.0 else np.nan + + return p, c, r2 + + +def pairwise_orders(h, error): + """ + Compute pairwise observed orders: + p_i = log(e_i/e_{i-1}) / log(h_i/h_{i-1}) + """ + pvals = [] + for i in range(1, len(error)): + if error[i] <= 0.0 or error[i - 1] <= 0.0: + pvals.append(np.nan) + else: + pvals.append(np.log(error[i] / error[i - 1]) / np.log(h[i] / h[i - 1])) + return np.array(pvals) + + +def read_summary_file(file_path): + return pd.read_csv( + file_path, + sep=r"\s+", + comment="#", + header=None, + names=["Mesh", "Time", "Mem", "CellsNumber", "D_L2", "D_Linf", "S_L2", "S_Linf"], + engine="python" + ) + + +def process_case(case, fit_subset=None, print_pairwise_orders=False): + input_file = case["input_file"] + mesh_type = case["mesh_type"] + + file_path = os.path.join(script_dir, input_file) + + if not os.path.isfile(file_path): + print(f"\nSkipping case: file not found -> {file_path}") + return + + data = read_summary_file(file_path) + + data["h"] = compute_characteristic_h( + data["CellsNumber"].to_numpy(dtype=float), + mesh_type + ) + + fit_data = data if fit_subset is None else data.iloc[fit_subset].copy() + + print("\n\n\n\n" + "=" * 72) + print(f"File : {input_file}") + print(f"Mesh type : {mesh_type}") + print(f"Measure : {domain_measure}") + print("=" * 72) + + print("\nObserved orders of convergence from log-log fit:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + if np.any(errors <= 0.0): + print(f"{col:8s}: skipped (contains non-positive values)") + continue + + p, c, r2 = fit_loglog_slope(hvals, errors) + print(f"{col:8s}: p = {p:10.6f}, R^2 = {r2:10.6f}") + + if print_pairwise_orders: + print("\nPairwise orders:") + for col in error_columns: + errors = fit_data[col].to_numpy(dtype=float) + hvals = fit_data["h"].to_numpy(dtype=float) + + pvals = pairwise_orders(hvals, errors) + print(f"\n{col}:") + for i, p in enumerate(pvals, start=1): + m1 = fit_data["Mesh"].iloc[i - 1] + m2 = fit_data["Mesh"].iloc[i] + print(f" between Mesh {m1} and {m2}: p = {p:10.6f}") + + plot_convergence( + h=fit_data["h"], + error=fit_data["D_L2"], + label="D_L2", + fit_subset=None, + title=f"{input_file} - D_L2", + save_path=f"{input_file}_D_L2.png" + ) + + +def plot_convergence(h, error, label, fit_subset=None, title=None, save_path=None): + h = np.asarray(h, dtype=float) + error = np.asarray(error, dtype=float) + + # Filter valid values + mask = np.isfinite(h) & np.isfinite(error) & (h > 0) & (error > 0) + h = h[mask] + error = error[mask] + + logh = np.log(h) + loge = np.log(error) + + # Fit on full data + p_all, c_all = np.polyfit(logh, loge, 1) + + # Fit on subset (optional) + if fit_subset is not None: + h_sub = h[fit_subset] + e_sub = error[fit_subset] + p_sub, c_sub = np.polyfit(np.log(h_sub), np.log(e_sub), 1) + else: + p_sub, c_sub = None, None + + # Generate smooth line for plotting + h_fit = np.linspace(min(h), max(h), 200) + e_fit_all = np.exp(c_all) * h_fit**p_all + + plt.figure(figsize=(6, 5)) + + # Raw data + plt.loglog(h, error, 'o-', label=f"{label} (data)") + + # Full fit + plt.loglog(h_fit, e_fit_all, '--', label=f"fit (all): p={p_all:.2f}") + + # Subset fit + if fit_subset is not None: + e_fit_sub = np.exp(c_sub) * h_fit**p_sub + plt.loglog(h_fit, e_fit_sub, ':', label=f"fit (subset): p={p_sub:.2f}") + + plt.xlabel("h") + plt.ylabel("Error") + if title: + plt.title(title) + + plt.grid(True, which="both", ls="--", alpha=0.5) + plt.legend() + + if save_path: + plt.savefig(save_path, dpi=300, bbox_inches="tight") + + plt.show() + +# ============================================================ +# MAIN +# ============================================================ + +for case in cases: + process_case( + case, + fit_subset=fit_subset, + print_pairwise_orders=print_pairwise_orders + ) diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/dispErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/dispErrors.gnuplot index 2ea5998..ada6e06 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/dispErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/dispErrors.gnuplot @@ -46,7 +46,8 @@ plot \ "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" -set output "sphericalCavity_dispErrors_poly.pdf" +set output "sphericalCavity_dispErrors_poly.pdf +set xrange [15:80] plot \ (5e-12 * x**2) w l ls 1 title "2^{nd} order",\ (0.8e-14 * x**3) w l ls 2 title "3^{rd} order",\ diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/stressErrors.gnuplot b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/stressErrors.gnuplot index aa8aa04..702f9d7 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/stressErrors.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/stressErrors.gnuplot @@ -49,6 +49,7 @@ plot \ "tet.unstruct.ho.N3.summary.zeroTraction.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 50 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}^{_*}_{ }=3)" set output "sphericalCavity_stressErrors_poly.pdf" +set xrange [15:80] plot \ (5e-4 * x) w l ls 1 title "1^{st} order",\ (11e-7 * x**2) w l ls 2 title "2^{nd} order",\ From f3a38694ae874edf40344b500d6d5d31eed46fe1 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Tue, 28 Apr 2026 22:19:27 +0200 Subject: [PATCH 13/23] Refactoring updates --- .../cantileverVibration/Allrun | 30 ++++++------ .../base/highOrder/constant/solidProperties | 26 ++++++----- .../hyperElasticity/cooksMembrane/Allrun | 30 ++++++------ .../base/highOrder/constant/solidProperties | 24 ++++++---- .../cooksMembrane/base/snes/Allrun | 2 +- .../pressurisedCylinder/Allrun | 46 ++++++++++--------- .../pressurisedCylinder/base/highOrder/Allrun | 3 +- .../base/highOrder/constant/solidProperties | 24 ++++++---- .../pressurisedCylinder/base/snes/Allrun | 3 +- .../linearElastic/cantilever/Allrun | 5 +- .../linearElastic/cantilever/base/snes/Allrun | 3 +- .../linearElastic/cooksMembrane/Allrun | 3 +- .../cooksMembrane/base/snes/Allrun | 2 +- .../manufacturedSolution/mixed/Allrun | 5 +- .../mixed/base/snes/Allrun | 3 +- .../manufacturedSolution/polynomial/Allrun | 3 +- .../polynomial/base/snes/Allrun | 3 +- .../manufacturedSolution/trigonometric/Allrun | 5 +- .../trigonometric/Allrun.alphaAnalysis | 5 +- .../base/highOrder/constant/solidProperties | 2 +- .../trigonometric/base/snes/Allrun | 3 +- .../linearElastic/plateHole/Allrun | 3 +- .../plateHole/Allrun.conditioning | 3 +- .../plateHole/base/segregated/Allrun | 2 +- .../linearElastic/pressurisedCylinder/Allrun | 3 +- .../pressurisedCylinder/base/snes/Allrun | 3 +- .../linearElastic/sphericalCavity/Allrun | 4 +- .../sphericalCavity/Allrun.jacChoice | 4 +- .../sphericalCavity/base/snes/Allrun | 2 +- 29 files changed, 137 insertions(+), 117 deletions(-) diff --git a/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/Allrun b/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/Allrun index d7a8779..916f8c7 100755 --- a/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/Allrun @@ -3,13 +3,15 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings configs=( "BASE=base/snes NAME=hex.struct.snes PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N1 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=1 Nn=45" - "BASE=base/highOrder NAME=hex.struct.ho.N2 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=2 Nn=55" - "BASE=base/highOrder NAME=hex.struct.ho.N3 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=3 Nn=65" + "BASE=base/highOrder NAME=hex.struct.ho.N1 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=1 extraCells=45" + "BASE=base/highOrder NAME=hex.struct.ho.N2 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=2 extraCells=55" + "BASE=base/highOrder NAME=hex.struct.ho.N3 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=3 extraCells=65" ) # Approaches # "BASE=base/hex.snes NAME=hex.lu PETSC_FILE=petscOptions.lu" @@ -50,7 +52,7 @@ cd "${RUN_DIR}" # Iterate through configurations for config in "${configs[@]}" do - unset PETSC_FILE N Nn HOJAC HORES + unset PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config @@ -85,29 +87,29 @@ do # Create the mesh solids4Foam::runApplication blockMesh - solids4Foam::runApplication checkMesh + 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 in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + # Update the order + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + # Update number of stencil cells + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -135,7 +137,7 @@ do solids4Foam::runApplication solids4Foam fi - # Extract results from solver log and append them to a summary file + # 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}') diff --git a/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/base/highOrder/constant/solidProperties index 5dead91..6977b22 100644 --- a/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/hyperElasticity/cantileverVibration/base/highOrder/constant/solidProperties @@ -21,7 +21,6 @@ solidModel nonLinearGeometryTotalLagrangianTotalDisplacement; nonLinearGeometryTotalLagrangianTotalDisplacementCoeffs { - // Solution algorithm //solutionAlgorithm implicitCoupled; solutionAlgorithm PETScSNES; optionsFile petscOptions.lu; @@ -31,24 +30,29 @@ nonLinearGeometryTotalLagrangianTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 45; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } + predictor yes; } diff --git a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/Allrun b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/Allrun index 78b7138..af65705 100755 --- a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/Allrun @@ -3,18 +3,20 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings configs=( #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" #"BASE=base/segregated NAME=hex.seg" "BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" - #"BASE=base/highOrder NAME=hex.ho.N1 N=1 Nn=7 PETSC_FILE=petscOptions.lu" - #"BASE=base/highOrder NAME=hex.ho.N2 N=2 Nn=20 PETSC_FILE=petscOptions.lu" - #"BASE=base/highOrder NAME=hex.ho.N3 N=3 Nn=30 PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.ho.N1 N=1 Nn=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N2 N=2 Nn=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N3 N=3 Nn=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.ho.N1 order=1 extraCells=7 PETSC_FILE=petscOptions.lu" + #"BASE=base/highOrder NAME=hex.ho.N2 order=2 extraCells=20 PETSC_FILE=petscOptions.lu" + #"BASE=base/highOrder NAME=hex.ho.N3 order=3 extraCells=30 PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=tet.ho.N1 order=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N2 order=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.ho.N3 order=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" ) # SNES segregated approach # "BASE=base/snes NAME=hex.seg.lu PETSC_FILE=petscOptions.seg.lu" @@ -111,22 +113,22 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties fi - # Update the order in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + # Update the order + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + # Update number of stencil cells + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/highOrder/constant/solidProperties index 345e4d5..69d2bb2 100644 --- a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/highOrder/constant/solidProperties @@ -31,23 +31,27 @@ nonLinearGeometryTotalLagrangianTotalDisplacementCoeffs highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 10; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/snes/Allrun b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/snes/Allrun index 9cd3b15..db2176f 100755 --- a/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/snes/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/cooksMembrane/base/snes/Allrun @@ -5,7 +5,7 @@ # Source solids4Foam scripts source solids4FoamScripts.sh - +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg diff --git a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/Allrun index 6918fd9..eed9b9c 100755 --- a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/Allrun @@ -3,12 +3,14 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings configs=( - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=1 Nn=10 TOL=0.6" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=2 Nn=10 TOL=0.4" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true N=3 Nn=10 TOL=0.3" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=1 extraCells=10 TOL=0.6" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=2 extraCells=10 TOL=0.4" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true order=3 extraCells=10 TOL=0.3" ) # Define start and end mesh indices @@ -76,29 +78,29 @@ do solids4Foam::runApplication gmsh -3 -format msh2 gmsh/"${GMSH_FILE}.geo" solids4Foam::runApplication gmshToFoam gmsh/"${GMSH_FILE}.msh" solids4Foam::runApplication changeDictionary - solids4Foam::runApplication checkMesh + 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 in the LRECoeffs - if [ -n "${N}" ]; then - sed -i "/^\s*N /s|^.*| N ${N};|" constant/solidProperties + # Update the order + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs - if [ -n "${Nn}" ]; then - sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties + # Update number of stencil cells + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi @@ -126,19 +128,19 @@ do solids4Foam::runApplication solids4Foam fi - solids4Foam::runApplication postProcess -func sampleDict -latestTime + solids4Foam::runApplication postProcess -func sampleDict -latestTime - if ! command -v python3 &> /dev/null - then - echo "python3 not found. Load python environment, aborting..." - exit 1 - fi + if ! command -v python3 &> /dev/null + then + echo "python3 not found. Load python environment, aborting..." + exit 1 + fi - INPUT_FILE="postProcessing/sampleDict/100/line_D_sigma:Transformed.xy" - OUTPUT_FILE="../filteredSigmaTransformed_p${N}.$i.dat" - ./filterHoopAndRadialStress.py "$INPUT_FILE" "$OUTPUT_FILE" --tol "$TOL" + INPUT_FILE="postProcessing/sampleDict/100/line_D_sigma:Transformed.xy" + OUTPUT_FILE="../filteredSigmaTransformed_p${N}.$i.dat" + ./filterHoopAndRadialStress.py "$INPUT_FILE" "$OUTPUT_FILE" --tol "$TOL" - # Extract results from solver log and append them to a summary file + # 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}') diff --git a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/Allrun b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/Allrun index 9e17679..bd97ffe 100755 --- a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/Allrun @@ -5,11 +5,12 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use tet (1) or hex (0) volumes USE_TET=1 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/constant/solidProperties index 2f7a356..ba5e235 100644 --- a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/highOrder/constant/solidProperties @@ -33,23 +33,27 @@ solidModel nonLinearGeometryTotalLagrangianTotalDisplacement; highOrderJacobian false; highOrderResidual true; - LRECoeffs + displacement { - N 1; - Nn 10; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; + polynomialOrder 2; + faceStencilExtraCells 10; + + weightFunctionCoeffs + { + type radiallySymmetricExponential; + k 6; + } calcConditionNumber false; } } stabilisation { - type alpha; - scaleFactor 0.1; + momentum + { + type alpha; + scaleFactor 0.1; + } } } diff --git a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/snes/Allrun b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/snes/Allrun index ff830fe..12988a2 100755 --- a/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/snes/Allrun +++ b/papers/JFNK_highOrder/hyperElasticity/pressurisedCylinder/base/snes/Allrun @@ -5,11 +5,12 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use tet (1) or hex (0) volumes USE_TET=0 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index d235f9e..0858ade 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Not working with extend version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path @@ -69,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 N Nn HOJAC HORES + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/Allrun index 8e324c0..39e9e7c 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/base/snes/Allrun @@ -5,6 +5,8 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use structural type (1) or unstructural type (0) of mesh USE_STRUCTURAL_MESH=1 @@ -15,7 +17,6 @@ USE_TET=0 # Unstructured version (1=v1, 2=v2), v2 is more structured UNS_VER=1 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index 8768354..79b7089 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Not working with extend version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/snes/Allrun index 9cd3b15..db2176f 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/snes/Allrun @@ -5,7 +5,7 @@ # Source solids4Foam scripts source solids4FoamScripts.sh - +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun index 42073e8..b1ff03f 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Not working with extend version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path @@ -83,7 +82,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn HOJAC HORES + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun index 37e75fa..c809282 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/Allrun @@ -5,6 +5,8 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use structural type (1) or unstructural type (0) of mesh USE_STRUCTURAL_MESH=0 @@ -15,7 +17,6 @@ USE_TET=1 # Unstructured version (1=v1, 2=v2), v2 is more structured UNS_VER=2 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun index 85b51a0..72c35ed 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Working only with .com version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/snes/Allrun index b0370bf..2ab715c 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/snes/Allrun @@ -5,6 +5,8 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use structural type (1) or unstructural type (0) of mesh USE_STRUCTURAL_MESH=1 @@ -12,7 +14,6 @@ USE_STRUCTURAL_MESH=1 # Use tet (1) or hex (0) volumes USE_TET=1 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun index c99fc1b..0030f44 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Working only with .com version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path @@ -72,7 +71,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn HOJAC HORES + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis index 508adbe..25b5df1 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Working only with .com version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # Compile the manucafturedSolution library @@ -73,7 +72,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn HOJAC HORES ALPHA + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES ALPHA # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties index 4717048..fc91a36 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties @@ -24,7 +24,7 @@ linearGeometryTotalDisplacementCoeffs // Solution algorithm //solutionAlgorithm implicitCoupled; solutionAlgorithm PETScSNES; - optionsFile petscOptions.ksponly; + optionsFile petscOptions.lu; highOrderCoeffs { diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/Allrun index b0370bf..2ab715c 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/snes/Allrun @@ -5,6 +5,8 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use structural type (1) or unstructural type (0) of mesh USE_STRUCTURAL_MESH=1 @@ -12,7 +14,6 @@ USE_STRUCTURAL_MESH=1 # Use tet (1) or hex (0) volumes USE_TET=1 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun index 9d930f3..9a7cc9e 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Not working with extend version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning index 24b1f00..81b59e5 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Working only with .com version +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/Allrun index f717a9a..b989f1d 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/base/segregated/Allrun @@ -5,7 +5,7 @@ # Source solids4Foam scripts source solids4FoamScripts.sh - +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun index a447ab2..7623105 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun @@ -3,8 +3,7 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh - -# Not working with foam-extend +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend # Compile the cantileverBeam library diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/Allrun index b2144b4..b182732 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/snes/Allrun @@ -5,11 +5,12 @@ # Source solids4Foam scripts source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Use tet (1) or hex (0) volumes USE_TET=0 -solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg # Create the mesh diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun index d7b68db..a6189d4 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun @@ -3,6 +3,8 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings configs=( @@ -58,7 +60,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn HOJAC HORES + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice index db5f2f8..c73fd39 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice @@ -3,6 +3,8 @@ # Source required functions . $WM_PROJECT_DIR/bin/tools/RunFunctions source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend # Define configurations as space-separated strings configs=( @@ -54,7 +56,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn HOJAC HORES + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES # Parse the configuration string eval $config diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun index 38ded22..4026d58 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun @@ -5,7 +5,7 @@ # Source solids4Foam scripts source solids4FoamScripts.sh - +# Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg From 14ee381cb7f77f39169ddc67fd7a6a9b62ac8166 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 18 May 2026 14:24:12 +0200 Subject: [PATCH 14/23] Added membraneRoof2d case --- .../membraneRoof2d/Allrun | 710 ++++++++++++++++++ .../membraneRoof2d/README.md | 211 ++++++ .../base/partitioned/0/fluid/U.partitioned | 65 ++ .../base/partitioned/0/fluid/org/motionU | 68 ++ .../membraneRoof2d/base/partitioned/0/fluid/p | 62 ++ .../base/partitioned/0/fluid/pointMotionU | 67 ++ .../membraneRoof2d/base/partitioned/0/solid/D | 53 ++ .../base/partitioned/0/solid/pointD | 49 ++ .../membraneRoof2d/base/partitioned/Allclean | 28 + .../fluid/dynamicMeshDict.partitioned | 25 + .../fluid/fluidProperties.partitioned | 26 + .../base/partitioned/constant/fluid/g | 23 + .../constant/fluid/momentumTransport | 24 + .../constant/fluid/transportProperties | 25 + .../constant/fluid/turbulenceProperties | 21 + .../constant/fsiProperties.partitioned | 64 ++ .../base/partitioned/constant/g | 23 + .../partitioned/constant/physicsProperties | 24 + .../constant/solid/dynamicMeshDict | 21 + .../base/partitioned/constant/solid/g | 23 + .../constant/solid/mechanicalProperties | 32 + .../solid/solidProperties.partitioned | 48 ++ .../base/partitioned/setSet1.batch | 1 + .../base/partitioned/setSet2.batch | 1 + .../base/partitioned/system/controlDict | 86 +++ .../partitioned/system/fluid/blockMeshDict.1 | 150 ++++ .../partitioned/system/fluid/blockMeshDict.2 | 150 ++++ .../partitioned/system/fluid/blockMeshDict.3 | 150 ++++ .../partitioned/system/fluid/decomposeParDict | 23 + .../system/fluid/fvSchemes.partitioned | 58 ++ .../system/fluid/fvSolution.partitioned | 92 +++ .../partitioned/system/fluid/refineMeshDict.1 | 41 + .../partitioned/system/fluid/refineMeshDict.2 | 41 + .../partitioned/system/solid/blockMeshDict.1 | 98 +++ .../partitioned/system/solid/blockMeshDict.2 | 98 +++ .../partitioned/system/solid/blockMeshDict.3 | 98 +++ .../base/partitioned/system/solid/controlDict | 53 ++ .../system/solid/fvSchemes.partitioned | 58 ++ .../system/solid/fvSolution.partitioned | 77 ++ .../base/quasiMonolithic/0/fluid/D.monolithic | 71 ++ .../base/quasiMonolithic/0/fluid/U.monolithic | 66 ++ .../base/quasiMonolithic/0/fluid/org/motionU | 68 ++ .../base/quasiMonolithic/0/fluid/p | 62 ++ .../quasiMonolithic/0/fluid/pointD.monolithic | 67 ++ .../0/fluid/pointDisplacement.monolithic | 67 ++ .../base/quasiMonolithic/0/fluid/pointMotionU | 67 ++ .../base/quasiMonolithic/0/solid/D | 53 ++ .../0/solid/DFutureTime.monolithic | 51 ++ .../base/quasiMonolithic/0/solid/U.monolithic | 47 ++ .../base/quasiMonolithic/0/solid/pointD | 49 ++ .../base/quasiMonolithic/Allclean | 28 + .../constant/fluid/dynamicMeshDict.monolithic | 25 + .../constant/fluid/fluidProperties.monolithic | 47 ++ .../base/quasiMonolithic/constant/fluid/g | 23 + .../fluid/mechanicalProperties.monolithic | 35 + .../constant/fluid/momentumTransport | 24 + .../constant/fluid/solidProperties.monolithic | 25 + .../constant/fluid/transportProperties | 25 + .../constant/fluid/turbulenceProperties | 21 + .../constant/fsiProperties.monolithic | 45 ++ .../base/quasiMonolithic/constant/g | 23 + .../constant/physicsProperties | 24 + .../constant/solid/dynamicMeshDict | 21 + .../base/quasiMonolithic/constant/solid/g | 23 + .../constant/solid/mechanicalProperties | 32 + .../constant/solid/solidProperties.monolithic | 35 + .../base/quasiMonolithic/setSet1.batch | 1 + .../base/quasiMonolithic/setSet2.batch | 1 + .../base/quasiMonolithic/system/controlDict | 86 +++ .../quasiMonolithic/system/decomposeParDict | 25 + .../system/fluid/blockMeshDict.1 | 150 ++++ .../system/fluid/blockMeshDict.2 | 150 ++++ .../system/fluid/blockMeshDict.3 | 150 ++++ .../system/fluid/decomposeParDict | 23 + .../system/fluid/fvSchemes.monolithic | 72 ++ .../system/fluid/fvSolution.monolithic | 121 +++ .../system/fluid/refineMeshDict.1 | 41 + .../system/fluid/refineMeshDict.2 | 41 + .../system/fvSolution.monolithic | 87 +++ .../system/fvSolution.monolithic.physicsPC | 82 ++ .../system/fvSolution.monolithic.schurTuned | 88 +++ .../system/solid/blockMeshDict.1 | 98 +++ .../system/solid/blockMeshDict.2 | 98 +++ .../system/solid/blockMeshDict.3 | 98 +++ .../quasiMonolithic/system/solid/controlDict | 53 ++ .../system/solid/decomposeParDict | 23 + .../quasiMonolithic/system/solid/fvSchemes | 58 ++ .../system/solid/fvSchemes.monolithic | 54 ++ .../system/solid/fvSolution.monolithic | 28 + .../membraneRoof2d/run.slurm | 20 + .../membraneRoof2d/src/Allwmake | 4 + .../Make/files | 3 + .../Make/options | 25 + ...membraneRoofVelocity2dFvPatchVectorField.C | 153 ++++ ...membraneRoofVelocity2dFvPatchVectorField.H | 158 ++++ 95 files changed, 6082 insertions(+) create mode 100755 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/Allrun create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/README.md create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/U.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/org/motionU create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/p create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/pointMotionU create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/D create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/pointD create mode 100755 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/Allclean create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/dynamicMeshDict.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/fluidProperties.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/momentumTransport create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/transportProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/turbulenceProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fsiProperties.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/physicsProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/dynamicMeshDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/mechanicalProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/solidProperties.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet1.batch create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet2.batch create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/controlDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.3 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/decomposeParDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSchemes.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSolution.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.3 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/controlDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSchemes.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSolution.partitioned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/D.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/U.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/org/motionU create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/p create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointD.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointDisplacement.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointMotionU create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/D create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/DFutureTime.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/U.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/pointD create mode 100755 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/Allclean create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/dynamicMeshDict.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/fluidProperties.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/mechanicalProperties.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/momentumTransport create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/solidProperties.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/transportProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/turbulenceProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fsiProperties.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/physicsProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/dynamicMeshDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/g create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/mechanicalProperties create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/solidProperties.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet1.batch create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet2.batch create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/controlDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/decomposeParDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.3 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/decomposeParDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.physicsPC create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.schurTuned create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.1 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.2 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.3 create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/controlDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/decomposeParDict create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes.monolithic create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSolution.monolithic create mode 100755 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/run.slurm create mode 100755 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/Allwmake create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/files create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/options create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.C create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/Allrun b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/Allrun new file mode 100755 index 0000000..5a336f1 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/Allrun @@ -0,0 +1,710 @@ +#!/bin/bash + +# Source tutorial run functions +. "$WM_PROJECT_DIR/bin/tools/RunFunctions" + +set -u + +# Usage: +# ./Allrun [mesh|time|all|smoke] +# +# - smoke: small quick check, currently mesh 1, dt 0.005, reduced methods. +# - mesh: mesh-convergence study, currently meshes 1 2 3 at dt 0.005. +# - time: time-step study, currently mesh 1 with dt 0.01 0.005 0.0025. +# - all: all mesh levels and all time steps. +# +# Environment overrides: +# METHODS="quasiMonolithic:default quasiMonolithic:schurTuned partitioned:IQNILS" +# MESH_LEVELS="1 2 3" +# DT_VALUES="0.01 0.005 0.0025" +# END_TIME=2 +# WRITE_INTERVAL=0.1 +# TOTAL_CORES=10 # total MPI ranks available across all concurrent cases +# MESH_CORES=(1 4 10) # processor counts for mesh levels 1, 2, 3 + +SOLIDS4FOAM_ROOT="${SOLIDS4FOAM_ROOT:-/Users/ivanbatistic/work/solids4foam-ib-monolitic-v2406}" +SOLIDS4FOAM_SCRIPTS="${SOLIDS4FOAM_ROOT}/applications/scripts/solids4FoamScripts.sh" + +if [[ -f "$SOLIDS4FOAM_SCRIPTS" ]] +then + source "$SOLIDS4FOAM_SCRIPTS" +else + source solids4FoamScripts.sh +fi + +TOTAL_CORES="${TOTAL_CORES:-$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)}" +MESH_CORES=(1 1 1) + +if ! [[ "$TOTAL_CORES" =~ ^[0-9]+$ ]] || [[ "$TOTAL_CORES" -lt 1 ]] +then + echo "TOTAL_CORES must be a positive integer, got '$TOTAL_CORES'" >&2 + exit 1 +fi + +STUDY="${1:-${STUDY:-mesh}}" +if [[ -n "${END_TIME+x}" ]] +then + USER_SET_END_TIME=true +else + USER_SET_END_TIME=false + END_TIME=2 +fi +if [[ -n "${WRITE_INTERVAL+x}" ]] +then + USER_SET_WRITE_INTERVAL=true +else + USER_SET_WRITE_INTERVAL=false + WRITE_INTERVAL=0.1 +fi + +DEFAULT_METHODS="quasiMonolithic:default quasiMonolithic:schurTuned quasiMonolithic:physicsPC partitioned:IQNILS partitioned:Aitken" +if [[ -n "${METHODS+x}" ]] +then + USER_SET_METHODS=true +else + USER_SET_METHODS=false + METHODS="$DEFAULT_METHODS" +fi + +case "$STUDY" in + mesh) + MESH_LEVELS="${MESH_LEVELS:-1 2 3}" + DT_VALUES="${DT_VALUES:-0.005}" + ;; + time) + MESH_LEVELS="${MESH_LEVELS:-1}" + DT_VALUES="${DT_VALUES:-0.01 0.005 0.0025}" + ;; + all) + MESH_LEVELS="${MESH_LEVELS:-1 2 3}" + DT_VALUES="${DT_VALUES:-0.01 0.005 0.0025}" + ;; + smoke) + MESH_LEVELS="${MESH_LEVELS:-1}" + DT_VALUES="${DT_VALUES:-0.005}" + if ! $USER_SET_END_TIME + then + END_TIME=0.1 + fi + if ! $USER_SET_WRITE_INTERVAL + then + WRITE_INTERVAL=0.1 + fi + if ! $USER_SET_METHODS + then + METHODS="quasiMonolithic:default partitioned:Aitken" + fi + ;; + *) + echo "Unknown study '$STUDY'; expected mesh, time, all, or smoke" + exit 1 + ;; +esac + +setControlEntry() +{ + local key="$1" + local value="$2" + local file="$3" + + sed -i "/^[[:space:]]*${key}[[:space:]]/s|^.*|${key} ${value};|" "$file" +} + +methodBase() +{ + local method="$1" + + if [[ "$method" == "quasiMonolithic" ]] + then + echo "base/quasiMonolithic" + else + echo "base/partitioned" + fi +} + +caseName() +{ + local method="$1" + local variant="$2" + local mesh="$3" + local dt="$4" + + echo "${method}_${variant}.m${mesh}.dt${dt//./p}" +} + +meshCores() +{ + local mesh="$1" + local index=$((mesh - 1)) + + if (( index < 0 || index >= ${#MESH_CORES[@]} )) + then + echo "No processor count configured for mesh level ${mesh}" >&2 + return 1 + fi + + echo "${MESH_CORES[$index]}" +} + +validatePositiveInteger() +{ + local name="$1" + local value="$2" + + if ! [[ "$value" =~ ^[0-9]+$ ]] || [[ "$value" -lt 1 ]] + then + echo "${name} must be a positive integer, got '${value}'" >&2 + return 1 + fi +} + +queueCase() +{ + local method="$1" + local variant="$2" + local mesh="$3" + local dt="$4" + local base="$5" + local caseName="$6" + local cores="$7" + + QUEUE_METHODS+=("$method") + QUEUE_VARIANTS+=("$variant") + QUEUE_BASES+=("$base") + QUEUE_CASES+=("$caseName") + QUEUE_MESHES+=("$mesh") + QUEUE_DTS+=("$dt") + QUEUE_CORES+=("$cores") + QUEUE_DIRS+=("${RUN_ROOT}/${caseName}") + QUEUE_LOGS+=("${RUN_ROOT}/log.${caseName}") + QUEUE_STATUS_FILES+=("${RUN_ROOT}/${caseName}.status") +} + +activateMethod() +{ + local method="$1" + local variant="$2" + + if [[ "$method" == "quasiMonolithic" ]] + then + for file in $(find ./0 ./constant ./system -name '*.monolithic') + do + ln -vnsf "${file##*/}" "${file%.*}" + done + + if [[ "$variant" != "default" ]] + then + local variantFile="system/fvSolution.monolithic.${variant}" + + if [[ -f "$variantFile" ]] + then + ln -vnsf "fvSolution.monolithic.${variant}" system/fvSolution + else + echo "Cannot find $variantFile" + return 1 + fi + fi + else + for file in $(find ./0 ./constant ./system -name '*.partitioned') + do + ln -vnsf "${file##*/}" "${file%.partitioned}" + done + + sed -i \ + "/^[[:space:]]*fluidSolidInterface[[:space:]]/s|^.*|fluidSolidInterface ${variant};|" \ + constant/fsiProperties + fi +} + +setNumberOfSubdomains() +{ + local dict="$1" + local cores="$2" + + if [[ ! -f "$dict" ]] + then + echo "Cannot find $dict" + return 1 + fi + + if ! grep -q "^[[:space:]]*numberOfSubdomains[[:space:]]" "$dict" + then + echo "Cannot find numberOfSubdomains in $dict" + return 1 + fi + + sed -i \ + "/^[[:space:]]*numberOfSubdomains[[:space:]]/s|^.*|numberOfSubdomains ${cores};|" \ + "$dict" +} + +runTimed() +{ + local logFile="$1" + local tmpLog="${logFile}.tmp" + shift + rm -f "$tmpLog" + + if command -v gtime &> /dev/null + then + gtime -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" \ + "$@" &> "$tmpLog" + elif [ -x /usr/bin/time ] + then + /usr/bin/time -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" \ + "$@" &> "$tmpLog" + else + "$@" &> "$tmpLog" + fi + + local rc=$? + mv -f "$tmpLog" "$logFile" + return $rc +} + +runSolver() +{ + runTimed log.solids4Foam solids4Foam +} + +runParallelSolver() +{ + set +u + solids4Foam::runParallel solids4Foam + local rc=$? + set -u + return $rc +} + +findForceFile() +{ + for candidate in \ + postProcessing/fluid/forces/0/force.dat \ + postProcessing/fluid/forces/0/forces.dat \ + postProcessing/forces/0/force.dat \ + postProcessing/forces/0/forces.dat + do + if [[ -f "$candidate" ]] + then + echo "$candidate" + return 0 + fi + done + + return 1 +} + +extractSeriesStats() +{ + local file="$1" + local column="$2" + + awk -v col="$column" ' + NF && $1 !~ /^#/ { + gsub(/[()]/, "", $0) + value = $col + if (n == 0 || value < min) min = value + if (n == 0 || value > max) max = value + final = value + n++ + } + END { + if (n == 0) + { + print "NaN NaN NaN" + } + else + { + print final, min, max + } + }' "$file" +} + +appendSummary() +{ + local summary="$1" + local caseDir="$2" + local study="$3" + local method="$4" + local variant="$5" + local case="$6" + local mesh="$7" + local dt="$8" + local status="$9" + + local clockTime="NaN" + local maxMemory="NaN" + local cellsFluid="NaN" + local cellsSolid="NaN" + local finalUx="NaN" + local minUx="NaN" + local maxUx="NaN" + local finalUy="NaN" + local minUy="NaN" + local maxUy="NaN" + local finalFx="NaN" + local minFx="NaN" + local maxFx="NaN" + local finalFy="NaN" + local minFy="NaN" + local maxFy="NaN" + + if grep -q "gtime/time" "${caseDir}/log.solids4Foam" 2>/dev/null + then + clockTime=$(grep "gtime/time" "${caseDir}/log.solids4Foam" | tail -1 | awk '{print $5}') + elif [[ -f "${caseDir}/log.solids4Foam" ]] + then + clockTime=$(grep "ClockTime" "${caseDir}/log.solids4Foam" | tail -1 | awk '{print $7}') + fi + + if grep -q "Maximum resident" "${caseDir}/log.solids4Foam" 2>/dev/null + then + maxMemory=$(grep "Maximum resident" "${caseDir}/log.solids4Foam" | tail -1 | awk '{print int($6 / 1000)}') + fi + + if [[ -f "${caseDir}/log.checkMesh.fluid" ]] + then + cellsFluid=$(grep "cells:" "${caseDir}/log.checkMesh.fluid" | tail -1 | awk '{print $2}') + fi + + if [[ -f "${caseDir}/log.checkMesh.solid" ]] + then + cellsSolid=$(grep "cells:" "${caseDir}/log.checkMesh.solid" | tail -1 | awk '{print $2}') + fi + + local dispFile="${caseDir}/postProcessing/0/solidPointDisplacement_pointDisp.dat" + + if [[ -f "$dispFile" ]] + then + read -r finalUx minUx maxUx <<< "$(extractSeriesStats "$dispFile" 2)" + read -r finalUy minUy maxUy <<< "$(extractSeriesStats "$dispFile" 3)" + fi + + local forceFile + + if forceFile=$(cd "$caseDir" && findForceFile) + then + forceFile="${caseDir}/${forceFile}" + read -r finalFx minFx maxFx <<< "$(extractSeriesStats "$forceFile" 2)" + read -r finalFy minFy maxFy <<< "$(extractSeriesStats "$forceFile" 3)" + fi + + printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" \ + "$study" "$method" "$variant" "$case" "$mesh" "$dt" "$status" \ + "$cellsFluid" "$cellsSolid" "$clockTime" "$maxMemory" \ + "$finalUx" "$minUx" "$maxUx" "$finalUy" "$minUy" "$maxUy" \ + "$finalFx" "$minFx" "$maxFx" "$finalFy" "$minFy" "$maxFy" \ + >> "$summary" +} + +runCaseWorker() +{ + local caseDir="$1" + local logFile="$2" + local statusFile="$3" + local method="$4" + local variant="$5" + local mesh="$6" + local dt="$7" + local base="$8" + local caseName="$9" + local totalCores="${10}" + + ( + local caseStatus="failed" + local solverStatus=0 + trap 'printf "%s\n" "${caseStatus}" > "${statusFile}"' EXIT + + rm -rf "${caseDir}" + mkdir -p "${caseDir}" + cp -rL "../${base}/." "${caseDir}" + + cd "${caseDir}" || exit 1 + + if activateMethod "$method" "$variant" + then + cp "system/solid/blockMeshDict.${mesh}" system/solid/blockMeshDict + cp "system/fluid/blockMeshDict.${mesh}" system/fluid/blockMeshDict + + setControlEntry deltaT "$dt" system/controlDict + setControlEntry endTime "$END_TIME" system/controlDict + setControlEntry writeInterval "$WRITE_INTERVAL" system/controlDict + + solids4Foam::runApplication -s solid blockMesh -region solid + solids4Foam::runApplication -s fluid blockMesh -region fluid + + solids4Foam::runApplication -o -s fluid.1 setSet -batch setSet1.batch -region fluid + solids4Foam::runApplication -o -s fluid.1 refineMesh -region fluid -dict ./system/fluid/refineMeshDict.1 -overwrite + solids4Foam::runApplication -o -s fluid.2 setSet -batch setSet2.batch -region fluid + solids4Foam::runApplication -o -s fluid.2 refineMesh -region fluid -dict ./system/fluid/refineMeshDict.2 -overwrite + + solids4Foam::runApplication -s fluid checkMesh -region fluid + solids4Foam::runApplication -s solid checkMesh -region solid + + local cores + cores=$(meshCores "$mesh") || solverStatus=$? + + if [[ "$solverStatus" -eq 0 ]] + then + validatePositiveInteger "core demand for mesh ${mesh}" "$cores" || solverStatus=$? + fi + + if [[ "$solverStatus" -eq 0 ]] + then + if (( cores > totalCores )) + then + echo "Case ${caseName} requires ${cores} cores, but TOTAL_CORES=${totalCores}" + solverStatus=1 + elif (( cores > 1 )) + then + setNumberOfSubdomains system/decomposeParDict "$cores" || solverStatus=$? + if [[ "$solverStatus" -eq 0 ]] + then + setNumberOfSubdomains system/solid/decomposeParDict "$cores" || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + setNumberOfSubdomains system/fluid/decomposeParDict "$cores" || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + solids4Foam::runApplication -s fluid decomposePar -region fluid || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + solids4Foam::runApplication -s solid decomposePar -region solid || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + runParallelSolver || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + solids4Foam::runApplication -s fluid reconstructPar -region fluid || solverStatus=$? + fi + if [[ "$solverStatus" -eq 0 ]] + then + solids4Foam::runApplication -s solid reconstructPar -region solid || solverStatus=$? + fi + else + runSolver || solverStatus=$? + fi + + if [[ "$solverStatus" -eq 0 ]] + then + caseStatus="ranToEnd" + fi + fi + fi + ) > "${logFile}" 2>&1 +} + +reapFinishedJobs() +{ + local alivePids=() + local aliveCores=() + local pid core rc + + for ((idx=0; idx<${#ACTIVE_PIDS[@]}; ++idx)) + do + pid="${ACTIVE_PIDS[$idx]}" + core="${ACTIVE_CORES[$idx]}" + + if kill -0 "${pid}" 2>/dev/null + then + alivePids+=("${pid}") + aliveCores+=("${core}") + else + wait "${pid}" + rc=$? + ACTIVE_CORE_USAGE=$((ACTIVE_CORE_USAGE - core)) + if [[ "${rc}" -ne 0 ]] + then + ACTIVE_FAILURES=$((ACTIVE_FAILURES + 1)) + fi + fi + done + + if (( ${#alivePids[@]} > 0 )) + then + ACTIVE_PIDS=("${alivePids[@]}") + else + ACTIVE_PIDS=() + fi + + if (( ${#aliveCores[@]} > 0 )) + then + ACTIVE_CORES=("${aliveCores[@]}") + else + ACTIVE_CORES=() + fi +} + +waitForCoreBudget() +{ + local required="$1" + + while true + do + reapFinishedJobs + + if (( ACTIVE_CORE_USAGE + required <= TOTAL_CORES )) + then + return 0 + fi + + sleep 1 + done +} + +if [[ "$OSTYPE" == "darwin"* ]] +then + CPU_TYPE=$(sysctl -n machdep.cpu.brand_string | sed 's/[^a-zA-Z0-9]/_/g') +elif [[ -f /proc/cpuinfo ]] +then + CPU_TYPE=$(grep -m 1 "model name" /proc/cpuinfo | awk -F': ' '{print $2}' | sed 's/[^a-zA-Z0-9]/_/g') +else + CPU_TYPE="Unknown_CPU" +fi + +echo "Compiling membraneRoof2d tutorial libraries" +if ! (cd src && ./Allwmake) +then + echo "Failed to compile membraneRoof2d tutorial libraries" + exit 1 +fi + +DATE=$(date +%Y-%m-%d_%H-%M-%S) +RUN_DIR="run_${STUDY}_${CPU_TYPE}_${DATE}" +SUMMARY="campaignSummary.tsv" +QUEUE_METHODS=() +QUEUE_VARIANTS=() +QUEUE_BASES=() +QUEUE_CASES=() +QUEUE_MESHES=() +QUEUE_DTS=() +QUEUE_CORES=() +QUEUE_DIRS=() +QUEUE_LOGS=() +QUEUE_STATUS_FILES=() +ACTIVE_PIDS=() +ACTIVE_CORES=() +ACTIVE_CORE_USAGE=0 +ACTIVE_FAILURES=0 + +echo "Creating ${RUN_DIR}" +mkdir "${RUN_DIR}" +cd "${RUN_DIR}" +RUN_ROOT="$(pwd)" + +printf "# Study\tMethod\tVariant\tCase\tMeshFactor\tDeltaT\tStatus\tCellsFluid\tCellsSolid\tWallTime\tMaxMemoryMb\tFinalUx\tMinUx\tMaxUx\tFinalUy\tMinUy\tMaxUy\tFinalFx\tMinFx\tMaxFx\tFinalFy\tMinFy\tMaxFy\n" \ + > "$SUMMARY" + +for methodVariant in $METHODS +do + METHOD="${methodVariant%%:*}" + VARIANT="${methodVariant#*:}" + BASE="$(methodBase "$METHOD")" + + for mesh in $MESH_LEVELS + do + CORES=$(meshCores "$mesh") || exit 1 + validatePositiveInteger "core demand for mesh ${mesh}" "$CORES" || exit 1 + if (( CORES > TOTAL_CORES )) + then + echo "Case mesh ${mesh} requires ${CORES} cores, but TOTAL_CORES=${TOTAL_CORES}" >&2 + exit 1 + fi + + for dt in $DT_VALUES + do + CASE="$(caseName "$METHOD" "$VARIANT" "$mesh" "$dt")" + queueCase "$METHOD" "$VARIANT" "$mesh" "$dt" "$BASE" "$CASE" "$CORES" + done + done +done + +for idx in "${!QUEUE_CASES[@]}" +do + CASE="${QUEUE_CASES[$idx]}" + METHOD="${QUEUE_METHODS[$idx]}" + VARIANT="${QUEUE_VARIANTS[$idx]}" + MESH="${QUEUE_MESHES[$idx]}" + DT="${QUEUE_DTS[$idx]}" + BASE="${QUEUE_BASES[$idx]}" + LOG_FILE="${QUEUE_LOGS[$idx]}" + STATUS_FILE="${QUEUE_STATUS_FILES[$idx]}" + CORES="${QUEUE_CORES[$idx]}" + CASE_DIR="${QUEUE_DIRS[$idx]}" + + waitForCoreBudget "${CORES}" + + echo + echo "***************************************" + echo "Launching case: ${CASE}" + echo "Method: ${METHOD}, variant: ${VARIANT}, mesh factor: ${MESH}, deltaT: ${DT}, endTime: ${END_TIME}, cores: ${CORES}" + echo "***************************************" + + runCaseWorker "${CASE_DIR}" "${LOG_FILE}" "${STATUS_FILE}" "${METHOD}" "${VARIANT}" "${MESH}" "${DT}" "${BASE}" "${CASE}" "${TOTAL_CORES}" & + ACTIVE_PIDS+=("$!") + ACTIVE_CORES+=("${CORES}") + ACTIVE_CORE_USAGE=$((ACTIVE_CORE_USAGE + CORES)) +done + +while (( ${#ACTIVE_PIDS[@]} > 0 )) +do + reapFinishedJobs + + if (( ${#ACTIVE_PIDS[@]} > 0 )) + then + sleep 1 + fi +done + +FAILED_CASES=0 +for idx in "${!QUEUE_CASES[@]}" +do + CASE="${QUEUE_CASES[$idx]}" + METHOD="${QUEUE_METHODS[$idx]}" + VARIANT="${QUEUE_VARIANTS[$idx]}" + MESH="${QUEUE_MESHES[$idx]}" + DT="${QUEUE_DTS[$idx]}" + STATUS_FILE="${QUEUE_STATUS_FILES[$idx]}" + CASE_DIR="${QUEUE_DIRS[$idx]}" + STATUS="failed" + + if [[ -f "${STATUS_FILE}" ]] + then + read -r STATUS < "${STATUS_FILE}" + fi + + if [[ -z "${STATUS}" ]] + then + STATUS="failed" + fi + + appendSummary "$SUMMARY" "$CASE_DIR" "$STUDY" "$METHOD" "$VARIANT" "$CASE" "$MESH" "$DT" "$STATUS" + + if [[ "$STATUS" != "ranToEnd" ]] + then + FAILED_CASES=$((FAILED_CASES + 1)) + fi +done + +if (( FAILED_CASES > 0 )) +then + echo + echo "Completed with ${FAILED_CASES} failed case(s)" +fi + +cd .. + +echo +echo "Done" +echo "Run directory: ${RUN_DIR}" +echo "Summary: ${RUN_DIR}/${SUMMARY}" +echo +echo "To see summary in column aligned readable version use:" +echo "column -t -s $'\t' ${RUN_DIR}/${SUMMARY}" +echo +echo "$(date)" diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/README.md b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/README.md new file mode 100644 index 0000000..f77712e --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/README.md @@ -0,0 +1,211 @@ +# Flow over a rectangle building with a flexible membrane roof: `membraneRoof2d` + +Prepared by Ivan Batistić, Philip Cardiff + +## Tutorial Aims + +- Demonstrate a two-dimensional fluid-structure interaction benchmark with a + very slender membrane roof. +- Show the partitioned Dirichlet-Neumann coupling and the monolithic + fluid-solid interaction solver. + +## Case Overview + +This tutorial studies a rectangle building covered by a flexible +membrane roof and exposed to an incoming +parabolic profile flow. The case is 2D version of the `membraneRoof` case. +The setup follows the membrane-roof example described in Section 4.1 of the +paper by von Scheven and Ramm [1], with some slight changes in velocity profile, +membrane thickness, domain size and membrane Young modulus. + +The physical parameters of the problem are: + +- **Geometry** + - Building width: $0.4$ m + - Building height: $0.2$ m + - Overall domain size ($L \times W$): $2.2 \times 1$ m + - Membrane thickness: $0.005$ m + - Gravity ($g$): $0$ $\mathrm{m/s}^2$ +- **Solid** + - St. Venant-Kirchhoff material model + - Density ($\rho_s$): $500$ $\mathrm{kg/m}^3$ + - Young’s modulus ($E_s$): $500$ Pa + - Poisson’s ratio ($\nu_s$): $0$ +- **Fluid** + - Laminar flow + - Density ($\rho_f$): $1$ $\mathrm{kg/m}^3$ + - Kinematic viscosity ($\nu_f$): $0.01$ $\mathrm{m}^2$/s + +As in the reference paper [1], the case is solved using $400$ uniform +time steps of $\Delta t = 0.005$ s. + +At the inlet boundary ($x = 0$), the paper prescribes the streamwise +velocity $\mathbf{u}(y,t) =U_{\max} r(t)\left(2\eta - \eta^2\right)\mathbf{e}_x, \qquad \eta = \mathrm{clip}\left(\frac{y}{H},0,1\right)$ +with $U_{\max}=0.6, H=1.0$, and $r(t)= t/2 \text{ for } t < 2$ and $r(t)=1$ otherwise. + +Compared to [1] where authors +use linear velocity profile, herein used parabolic profile is chosen +becouse it is more consistent with slip boundary condition at the +top surface. + +The inlet condition is implemented as a tutorial-local library in +`src/membraneRoofVelocity2dFvPatchVectorField` +and loaded through `system/controlDict`. This avoids `codedFixedValue`, which +is not portable across all supported OpenFOAM forks. + +The library is compiled automatically by `./Allrun` through `src/Allwmake`. + +## Mesh Generation + +The tutorial uses a coarser mesh intended for routine testing and demonstration. +The fluid mesh consists of $6804$ cells, and the solid mesh consists +of $288$ cells. + +For the fluid region, the mesh is generated with `blockMesh` and then refined +two times locally above and around the roof using `setSet` and `refineMesh`. +The `setSet` command creates the `cellsToRefine` cell set from the selection specified in +`setSet1.batch` and `setSet2.batch`, while `refineMesh`, +using `system/fluid/refineMeshDict1` and `system/fluid/refineMeshDict2`. +`refineMesh` utility uniformly splits each selected cell into eight cells. + +## Campaign Layout + +The case is organised as a transient comparison campaign: + +- `base/quasiMonolithic`: Newton/PETSc quasi-monolithic template case +- `base/partitioned`: partitioned FSI template case +- `Allrun`: top-level campaign driver +- `run.slurm`: Slurm entry point +- `src/`: tutorial-local inlet velocity boundary condition + +The base templates contain three mesh levels: + +- `1`: original blockMesh cell counts +- `2`: twice the number of cells in each block direction +- `4`: four times the number of cells in each block direction + +Each run still applies the local fluid refinement above and around the roof via +`setSet` and `refineMesh`. + +The main quantities of interest are: + +- displacement of the solid interface centre point `(0.6 0.2 0)` versus time +- total interface force components `Fx` and `Fy` on the fluid patch + `membrane-fluid` versus time + +These are written by the `solidPointDisplacement` and `forces` function objects +in `system/controlDict`. + +## Running With Slurm + +Submit the default mesh study with: + +```bash +sbatch run.slurm +``` + +The Slurm script sources OpenFOAM-v2512: + +```bash +. /usr/lib/openfoam/openfoam2512/etc/bashrc +``` + +and uses: + +```bash +SOLIDS4FOAM_ROOT=/home/philipc/OpenFOAM/philipc-v2512/solids4foam.monolithic +``` + +By default, `STUDY=mesh`. Other studies can be selected at submission: + +```bash +sbatch --export=ALL,STUDY=time run.slurm +sbatch --export=ALL,STUDY=mesh run.slurm +sbatch --export=ALL,STUDY=all run.slurm +sbatch --export=ALL,STUDY=smoke run.slurm +``` + +Common overrides can be passed through Slurm: + +```bash +export METHODS="quasiMonolithic:default partitioned:IQNILS" +sbatch --export=ALL,STUDY=time,DT_VALUES="0.04 0.02 0.01" run.slurm +``` + +## Running Allrun Directly + +From the case directory, run + +```bash +. /usr/lib/openfoam/openfoam2512/etc/bashrc +./Allrun mesh +./Allrun time +./Allrun smoke +``` + +```note +The monolithic approach requires OpenFOAM.com (ESI) and a PETSc installation +with `PETSC_DIR` set. It does not run with foam-extend or OpenFOAM.org. +``` + +Available study modes: + +- `mesh`: mesh factors `1 2 4` at `deltaT=0.02` +- `time`: mesh factor `1` with `deltaT = 0.04 0.02 0.01` +- `all`: all mesh factors and all default time steps +- `smoke`: one short two-step check on the original mesh + +The campaign driver will: + +1. Compile the local inlet boundary-condition library. +2. Clone the selected base template into a timestamped run directory. +3. Link the selected quasi-monolithic or partitioned dictionary files. +4. Select the requested mesh level. +5. Generate and check the fluid and solid meshes. +6. Refine the fluid mesh. +7. Run `solids4Foam`. +8. Append run status, mesh size, cost, displacement, `Fx`, and `Fy` data to + `campaignSummary.tsv`. + +Each campaign creates: + +```text +run___/ +``` + +The main output table is: + +```text +run___/campaignSummary.tsv +``` + +The default method/variant set is: + +- `quasiMonolithic:default` +- `quasiMonolithic:schurTuned` +- `quasiMonolithic:physicsPC` +- `partitioned:IQNILS` +- `partitioned:Aitken` + +Useful controls: + +- `METHODS` +- `MESH_LEVELS` +- `DT_VALUES` +- `END_TIME` +- `WRITE_INTERVAL` + +Example direct runs: + +```bash +METHODS="quasiMonolithic:default partitioned:Aitken" ./Allrun mesh +MESH_LEVELS="2" DT_VALUES="0.04 0.02 0.01" ./Allrun time +END_TIME=2 WRITE_INTERVAL=0.02 ./Allrun smoke +``` + +## References + +[1] [M. von Scheven and E. Ramm, "Strong coupling schemes for interaction of +thin-walled structures and incompressible flows," *International Journal for +Numerical Methods in Engineering*, 87(1-5), 2011, pp. 214-231]( +https://doi.org/10.1002/nme.3033) diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/U.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/U.partitioned new file mode 100644 index 0000000..6c68236 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/U.partitioned @@ -0,0 +1,65 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type membraneRoofVelocity2d; + value uniform (0 0 0); + } + + outlet + { + type zeroGradient; + } + + membrane-fluid + { + type newMovingWallVelocity; + value uniform (0 0 0); + } + + bottom + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type slip; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/org/motionU b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/org/motionU new file mode 100644 index 0000000..3fb7bc5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/org/motionU @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class tetPointVectorField; + object motionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type slip; + value uniform (0 0 0); + } + + frontAndBack + { + type slip; + value uniform (0 0 0); + } + + building + { + type slip; + value uniform (0 0 0); + } + + top + { + type slip; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/p b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/p new file mode 100644 index 0000000..561ffc2 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/p @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + membrane-fluid + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } + + building + { + type zeroGradient; + } + + top + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/pointMotionU b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/pointMotionU new file mode 100644 index 0000000..def51fc --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/fluid/pointMotionU @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointMotionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type slip; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type slip; + value uniform (0 0 0); + } + + top + { + type slip; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/D b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/D new file mode 100644 index 0000000..09d845f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/D @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object D; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + sides + { + type fixedDisplacement; + value uniform (0 0 0); + } + + membrane-solid + { + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 0; + value uniform (0 0 0); + } + + bottom + { + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 0; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/pointD b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/pointD new file mode 100644 index 0000000..607d57f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/0/solid/pointD @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointD; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + membrane-solid + { + type calculated; + value uniform (0 0 0); + } + + bottom + { + type calculated; + value uniform (0 0 0); + } + + sides + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/Allclean b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/Allclean new file mode 100755 index 0000000..c0cce5c --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/Allclean @@ -0,0 +1,28 @@ +#!/bin/bash + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +# Source solids4Foam scripts +source solids4FoamScripts.sh + +[ -f constant/solid/polyMesh/blockMeshDict ] && cp constant/solid/polyMesh/blockMeshDict system/solid/ +[ -f constant/fluid/polyMesh/blockMeshDict ] && cp constant/fluid/polyMesh/blockMeshDict system/fluid +cleanCase +if [[ $WM_PROJECT = "foam" ]]; then + foamClearPolyMesh -region fluid + foamClearPolyMesh -region solid +elif [[ $WM_PROJECT_VERSION == v* ]]; then + foamCleanPolyMesh -region fluid + foamCleanPolyMesh -region solid +fi +[ -f system/solid/blockMeshDict ] && mkdir constant/solid/polyMesh && cp system/solid/blockMeshDict constant/solid/polyMesh/ +[ -f system/fluid/blockMeshDict ] && mkdir constant/fluid/polyMesh && cp system/fluid/blockMeshDict constant/fluid/polyMesh/ + +rm -rf 0 case.foam residuals force.pdf deflection.pdf postProcessing iterations.pdf + +# Remove symlinks created by Allrun for monolithic/partitioned switching +find ./0.orig ./constant ./system -maxdepth 3 -type l -exec rm -f {} \; 2>/dev/null + +# Convert case version to FOAM EXTEND +solids4Foam::convertCaseFormatFoamExtend . diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/dynamicMeshDict.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/dynamicMeshDict.partitioned new file mode 100644 index 0000000..1c0a6b2 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/dynamicMeshDict.partitioned @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +"solver|motionSolver" velocityLaplacian; + +diffusivity quadratic inverseDistance (membrane-fluid); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/fluidProperties.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/fluidProperties.partitioned new file mode 100644 index 0000000..6d07ed4 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/fluidProperties.partitioned @@ -0,0 +1,26 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fluidProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fluidModel pimpleFluid; + +pimpleFluidCoeffs +{ + // PIMPLE settings given in fvSolution +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/momentumTransport b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/momentumTransport new file mode 100644 index 0000000..523ad0f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/momentumTransport @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object momentumTransport; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// This file is only used by the OpenFOAM Foundation version + +simulationType laminar; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/transportProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/transportProperties new file mode 100644 index 0000000..f6d951f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/transportProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [0 2 -1 0 0 0 0] 0.01; + +rho rho [1 -3 0 0 0 0 0] 1.0; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/turbulenceProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/turbulenceProperties new file mode 100644 index 0000000..7664815 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fluid/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fsiProperties.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fsiProperties.partitioned new file mode 100644 index 0000000..b3495ee --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/fsiProperties.partitioned @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fsiProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//fluidSolidInterface fixedRelaxation; +//fluidSolidInterface Aitken; +fluidSolidInterface IQNILS; + +"fixedRelaxationCoeffs|AitkenCoeffs|IQNILSCoeffs" +{ + // Interface patches + solidPatch membrane-solid; + fluidPatch membrane-fluid; + + // Predictors at the start of a new time step + predictor yes; + predictSolid yes; + + // Under-relaxation factor for passing the solid interface + // displacement/velocity to the fluid interface + // For fixedRelaxation, this value is used for all iterations + // For Aitken, this value is used for the first iteration each time-step, + // then it adaptively changes + // For IQNILS, this value is used for the first two iterations each + // time-step, then the IQNILS procedure is used + relaxationFactor 0.1; + + // Tolerance for the FSI loop within each time-step + outerCorrTolerance 1e-6; + + // Maximum number of outer FSI loop correctors within each time-step + nOuterCorr 100; + + // Enable/disable coupling from the start + coupled yes; + + // Method for transferring information between the interfaces + interfaceTransferMethod directMap; + + // Optional (only for IQNILS): re-use modes from previous time-steps. + // The number of modes to be re-used is specified + // Defaults to 0 modes + couplingReuse 0; + minSignificant 1e-12; + + // Write fsi residuals to file + writeResidualsToFile yes; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/physicsProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/physicsProperties new file mode 100644 index 0000000..979bbd6 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/physicsProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object physicsProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// type fluid; +// type solid; +type fluidSolidInteraction; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/dynamicMeshDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/dynamicMeshDict new file mode 100644 index 0000000..c65b22a --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/dynamicMeshDict @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh staticFvMesh; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/mechanicalProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/mechanicalProperties new file mode 100644 index 0000000..68334f3 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/mechanicalProperties @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object mechanicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +planeStress no; + +mechanical +( + rubber + { + type StVenantKirchhoffElastic; + rho rho [1 -3 0 0 0 0 0] 500; + E E [1 -1 -2 0 0 0 0] 500; + nu nu [0 0 0 0 0 0 0] 0.0; + } +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/solidProperties.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/solidProperties.partitioned new file mode 100644 index 0000000..8b57151 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/constant/solid/solidProperties.partitioned @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object solidProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//solidModel linearGeometryTotalDisplacement; +solidModel nonLinearGeometryTotalLagrangianTotalDisplacement; + +"linearGeometryTotalDisplacementCoeffs|nonLinearGeometryTotalLagrangianTotalDisplacementCoeffs" +{ + // Solution algorithm + solutionAlgorithm PETScSNES; + + // Predictor D at the start of a new time step using U and A + predictor yes; + + // Stabilisation + stabilisation + { + momentum + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + + pressure + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet1.batch b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet1.batch new file mode 100644 index 0000000..9351f4b --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet1.batch @@ -0,0 +1 @@ +cellSet cellsToRefine1 new boxToCell (0.2 0 -1) (2.6 0.375 1); diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet2.batch b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet2.batch new file mode 100644 index 0000000..2e23ef5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/setSet2.batch @@ -0,0 +1 @@ +cellSet cellsToRefine2 new boxToCell (0.3 0 -1) (1.8 0.3 1); diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/controlDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/controlDict new file mode 100644 index 0000000..92078d4 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/controlDict @@ -0,0 +1,86 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs +( + "libmembraneRoofVelocity2dFvPatchVectorField.so" +); + +application solids4Foam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2; + +deltaT 0.005; + +writeControl runTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep no; + +functions +{ + forces + { + type forces; + region fluid; + libs ( "libforces.so" ); + outputControl timeStep; + outputInterval 1; + patches (membrane-fluid); + "pName|p" p; + "UName|U" U; + "rhoName|rho" rhoInf; + log true; + rhoInf 1.0; + CofR (0.6 0.2 0); + } + pointDisp + { + type solidPointDisplacement; + point (0.6 0.2 0); + } + fsiConvData + { + type fsiConvergenceData; + region fluid; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.1 new file mode 100644 index 0000000..795f2a5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.1 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (12 6 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (12 24 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (12 24 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (36 24 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (36 6 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.2 new file mode 100644 index 0000000..df242eb --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.2 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (24 12 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (24 48 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (24 48 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (72 48 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (72 12 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.3 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.3 new file mode 100644 index 0000000..8bf10d3 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/blockMeshDict.3 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (48 24 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (48 96 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (48 96 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (144 96 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (144 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/decomposeParDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/decomposeParDict new file mode 100644 index 0000000..657baae --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/decomposeParDict @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSchemes.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSchemes.partitioned new file mode 100644 index 0000000..7b292c5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSchemes.partitioned @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default leastSquares; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linearUpwind cellLimited leastSquares 1; + div((nuEff*dev2(T(grad(U))))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSolution.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSolution.partitioned new file mode 100644 index 0000000..1ef5af3 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/fvSolution.partitioned @@ -0,0 +1,92 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "p|pFinal" + { + solver GAMG; + tolerance 1e-06; + relTol 0; + minIter 1; + maxIter 1000; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + cellMotionU + { + solver GAMG; + tolerance 1e-06; + relTol 0; + minIter 1; + maxIter 100; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + "U|UFinal" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-06; + relTol 0; + minIter 1; + } +} + +PIMPLE +{ + momentumPredictor on; + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 1; + + residualControl + { + U + { + relTol 1e-5; + tolerance 1e-5; + } + + p + { + relTol 1e-5; + tolerance 1e-5; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.1 new file mode 100644 index 0000000..860047b --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.1 @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object refineMeshDict.1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +set cellsToRefine1; + +coordinateSystem global; + +globalCoeffs +{ + tan1 (1 0 0); + tan2 (0 1 0); +} + +directions +( + tan1 + tan2 +); + +useHexTopology false; + +geometricCut false; + +writeMesh false; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.2 new file mode 100644 index 0000000..5103be8 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/fluid/refineMeshDict.2 @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object refineMeshDict.2; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +set cellsToRefine2; + +coordinateSystem global; + +globalCoeffs +{ + tan1 (1 0 0); + tan2 (0 1 0); +} + +directions +( + tan1 + tan2 +); + +useHexTopology false; + +geometricCut false; + +writeMesh false; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.1 new file mode 100644 index 0000000..5ae431c --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.1 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (48 6 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.2 new file mode 100644 index 0000000..dab94fa --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.2 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (96 12 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.3 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.3 new file mode 100644 index 0000000..edb2469 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/blockMeshDict.3 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (192 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/controlDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/controlDict new file mode 100644 index 0000000..8a2e68e --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application solids4Foam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 3; + +deltaT 1e-3; + +writeControl timeStep; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep no; + +maxCo 0.2; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSchemes.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSchemes.partitioned new file mode 100644 index 0000000..c514da0 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSchemes.partitioned @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +d2dt2Schemes +{ + default backward; +} + +ddtSchemes +{ + default backward; +} + +gradSchemes +{ + default leastSquaresS4f; +} + +divSchemes +{ + default Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +snGradSchemes +{ + default corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(impK) linear; + interpolate(grad(D)) linear; + interpolate(grad(DD)) linear; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSolution.partitioned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSolution.partitioned new file mode 100644 index 0000000..e349669 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/system/solid/fvSolution.partitioned @@ -0,0 +1,77 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + D + { + solver petsc; + + options + { + // Nonlinear solver + snes_type newtonls; + snes_linesearch_type basic; + snes_rtol "1e-6"; + snes_stol "1e-6"; + snes_max_it "1000"; + snes_monitor; + snes_converged_reason; + + snes_mf; + snes_mf_operator; + + // Linear solver + ksp_type lgmres; + ksp_gmres_restart "100"; + ksp_converged_reason; + + // Store the preconditioner + snes_lag_preconditioner_persists true; + snes_lag_preconditioner "-2"; + + // Preconditioner - LU + pc_type bjacobi; + sub_pc_type lu; + + // Preconditioner - ILU + // pc_type asm; + // sub_pc_type ilu; + // sub_pc_factor_levels "1"; + + // Preconditioner - multigrid + // pc_type hypre; + // pc_hypre_type boomeramg; + // pc_hypre_boomeramg_max_iter "1"; + // //pc_hypre_boomeramg_strong_threshold "0.25"; + // pc_hypre_boomeramg_strong_threshold "0.7"; + // pc_hypre_boomeramg_grid_sweeps_up "1"; + // pc_hypre_boomeramg_grid_sweeps_down "1"; + // pc_hypre_boomeramg_agg_nl "1"; + // pc_hypre_boomeramg_agg_num_paths "1"; + // pc_hypre_boomeramg_max_levels "25"; + // pc_hypre_boomeramg_coarsen_type HMIS; + // pc_hypre_boomeramg_interp_type ext+i; + // pc_hypre_boomeramg_P_max "1"; + // pc_hypre_boomeramg_truncfactor "0.3"; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/D.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/D.monolithic new file mode 100644 index 0000000..fdd3d81 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/D.monolithic @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object D; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedDisplacement; + value uniform (0 0 0); + } + + outlet + { + type fixedDisplacement; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedDisplacement; + + // Do not update pointD from D, as the pointD interface field has + // already be set from the solid side + enforcePointPatchField no; + value uniform (0 0 0); + } + + bottom + { + type fixedDisplacement; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type fixedDisplacement; + value uniform (0 0 0); + } + + top + { + type fixedDisplacement; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/U.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/U.monolithic new file mode 100644 index 0000000..a5031b6 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/U.monolithic @@ -0,0 +1,66 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type membraneRoofVelocity2d; + value uniform (0 0 0); + } + + outlet + { + type zeroGradient; + } + + membrane-fluid + { + type fixedValue; + //type newMovingWallVelocity; + value uniform (0 0 0); + } + + bottom + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type slip; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/org/motionU b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/org/motionU new file mode 100644 index 0000000..3fb7bc5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/org/motionU @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class tetPointVectorField; + object motionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type slip; + value uniform (0 0 0); + } + + frontAndBack + { + type slip; + value uniform (0 0 0); + } + + building + { + type slip; + value uniform (0 0 0); + } + + top + { + type slip; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/p b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/p new file mode 100644 index 0000000..561ffc2 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/p @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + membrane-fluid + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } + + building + { + type zeroGradient; + } + + top + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointD.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointD.monolithic new file mode 100644 index 0000000..88bdf36 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointD.monolithic @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointD; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type fixedValue; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointDisplacement.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointDisplacement.monolithic new file mode 100644 index 0000000..9b443fb --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointDisplacement.monolithic @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type fixedValue; + value uniform (0 0 0); + } + + top + { + type fixedValue; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointMotionU b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointMotionU new file mode 100644 index 0000000..def51fc --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/fluid/pointMotionU @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointMotionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + membrane-fluid + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type slip; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } + + building + { + type slip; + value uniform (0 0 0); + } + + top + { + type slip; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/D b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/D new file mode 100644 index 0000000..09d845f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/D @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object D; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + sides + { + type fixedDisplacement; + value uniform (0 0 0); + } + + membrane-solid + { + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 0; + value uniform (0 0 0); + } + + bottom + { + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 0; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/DFutureTime.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/DFutureTime.monolithic new file mode 100644 index 0000000..b8c13f9 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/DFutureTime.monolithic @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object DFutureTime; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + membrane-solid + { + type calculated; + value uniform (0 0 0); + } + + bottom + { + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 0; + value uniform (0 0 0); + } + + sides + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/U.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/U.monolithic new file mode 100644 index 0000000..0ec9f94 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/U.monolithic @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + membrane-solid + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + sides + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/pointD b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/pointD new file mode 100644 index 0000000..607d57f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/0/solid/pointD @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointD; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + membrane-solid + { + type calculated; + value uniform (0 0 0); + } + + bottom + { + type calculated; + value uniform (0 0 0); + } + + sides + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/Allclean b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/Allclean new file mode 100755 index 0000000..c0cce5c --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/Allclean @@ -0,0 +1,28 @@ +#!/bin/bash + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +# Source solids4Foam scripts +source solids4FoamScripts.sh + +[ -f constant/solid/polyMesh/blockMeshDict ] && cp constant/solid/polyMesh/blockMeshDict system/solid/ +[ -f constant/fluid/polyMesh/blockMeshDict ] && cp constant/fluid/polyMesh/blockMeshDict system/fluid +cleanCase +if [[ $WM_PROJECT = "foam" ]]; then + foamClearPolyMesh -region fluid + foamClearPolyMesh -region solid +elif [[ $WM_PROJECT_VERSION == v* ]]; then + foamCleanPolyMesh -region fluid + foamCleanPolyMesh -region solid +fi +[ -f system/solid/blockMeshDict ] && mkdir constant/solid/polyMesh && cp system/solid/blockMeshDict constant/solid/polyMesh/ +[ -f system/fluid/blockMeshDict ] && mkdir constant/fluid/polyMesh && cp system/fluid/blockMeshDict constant/fluid/polyMesh/ + +rm -rf 0 case.foam residuals force.pdf deflection.pdf postProcessing iterations.pdf + +# Remove symlinks created by Allrun for monolithic/partitioned switching +find ./0.orig ./constant ./system -maxdepth 3 -type l -exec rm -f {} \; 2>/dev/null + +# Convert case version to FOAM EXTEND +solids4Foam::convertCaseFormatFoamExtend . diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/dynamicMeshDict.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/dynamicMeshDict.monolithic new file mode 100644 index 0000000..f2cc7f1 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/dynamicMeshDict.monolithic @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +"solver|motionSolver" solids4foamSolidModel; + +regionName fluid; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/fluidProperties.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/fluidProperties.monolithic new file mode 100644 index 0000000..9bcef87 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/fluidProperties.monolithic @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fluidProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fluidModel newtonIcoFluid; + +newtonIcoFluidCoeffs +{ + // Force an implicit flux + forceImplicitFlux true; + + // If the flux is explicit, specific the extrapolation approach + // This is not used if forceImplicitFlux is enabled + fluidFluxExtrapolationAlgorithm1 yes; + + // Additional divU term which is meant to improve convergence + addDivPhiUDamping no; + + // Scaling of pressure equation relative to the momentum + pressureScaleFactor 1.0; + + // Pressure stabilisation approach + stabilisation + { + type RhieChow; + scaleFactor 1.0; + + // type laplacian; + // omega omega [0 -2 1 0 0 0 0] 1.0; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/mechanicalProperties.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/mechanicalProperties.monolithic new file mode 100644 index 0000000..fb577c5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/mechanicalProperties.monolithic @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object mechanicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +planeStress no; + +mechanical +( + rubber + { + type diffusionHyperElastic; + rho rho [1 -3 0 0 0 0 0] 1; + mu mu [1 -1 -2 0 0 0 0] 1; + K K [1 -1 -2 0 0 0 0] 3; + diffusivity quadratic inverseDistance (membrane-fluid); + regionName fluid; + writeStiffScaleFactor no; + } +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/momentumTransport b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/momentumTransport new file mode 100644 index 0000000..523ad0f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/momentumTransport @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object momentumTransport; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// This file is only used by the OpenFOAM Foundation version + +simulationType laminar; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/solidProperties.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/solidProperties.monolithic new file mode 100644 index 0000000..681fcd1 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/solidProperties.monolithic @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object solidProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solidModel nonLinearGeometryTotalLagrangianTotalDisplacement; + +nonLinearGeometryTotalLagrangianTotalDisplacementCoeffs +{ + solutionAlgorithm PETScSNES; +} +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/transportProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/transportProperties new file mode 100644 index 0000000..f6d951f --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/transportProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [0 2 -1 0 0 0 0] 0.01; + +rho rho [1 -3 0 0 0 0 0] 1.0; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/turbulenceProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/turbulenceProperties new file mode 100644 index 0000000..7664815 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fluid/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fsiProperties.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fsiProperties.monolithic new file mode 100644 index 0000000..ac68947 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/fsiProperties.monolithic @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fsiProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fluidSolidInterface NewtonQuasiMonolithic; + +NewtonQuasiMonolithicCoeffs +{ + // Solid and fluid interface patches + solidPatch membrane-solid; + fluidPatch membrane-fluid; + + // Enable coupling from 2.0 s + coupled yes; + //couplingStartTime 2.0; + + // Mapping data across the solid-fluid interface + interfaceTransferMethod directMap; + + // PETSc SNES options for the monolithic UpU system are defined in + // system/fvSolution. + + // Pass viscous forces from fluid-to-solid interface (in addition to pressure + // forces) + passViscousStress yes; + + // Scaling for fluid system to improve the condition number + fluidSystemScaleFactor 1e+08; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/physicsProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/physicsProperties new file mode 100644 index 0000000..979bbd6 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/physicsProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object physicsProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// type fluid; +// type solid; +type fluidSolidInteraction; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/dynamicMeshDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/dynamicMeshDict new file mode 100644 index 0000000..c65b22a --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/dynamicMeshDict @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh staticFvMesh; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/g b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/g new file mode 100644 index 0000000..025d26d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/g @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 0 ); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/mechanicalProperties b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/mechanicalProperties new file mode 100644 index 0000000..68334f3 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/mechanicalProperties @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object mechanicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +planeStress no; + +mechanical +( + rubber + { + type StVenantKirchhoffElastic; + rho rho [1 -3 0 0 0 0 0] 500; + E E [1 -1 -2 0 0 0 0] 500; + nu nu [0 0 0 0 0 0 0] 0.0; + } +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/solidProperties.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/solidProperties.monolithic new file mode 100644 index 0000000..c0d7fd6 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/constant/solid/solidProperties.monolithic @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object solidProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solidModel nonLinearGeometryTotalLagrangianVelocity; + +nonLinearGeometryTotalLagrangianVelocityCoeffs +{ + dampingCoeff [0 0 -1 0 0 0 0] 0; + + stabilisation + { + momentum + { + type diffStencilLaplacian; + scaleFactor 0.5; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet1.batch b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet1.batch new file mode 100644 index 0000000..9351f4b --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet1.batch @@ -0,0 +1 @@ +cellSet cellsToRefine1 new boxToCell (0.2 0 -1) (2.6 0.375 1); diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet2.batch b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet2.batch new file mode 100644 index 0000000..2e23ef5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/setSet2.batch @@ -0,0 +1 @@ +cellSet cellsToRefine2 new boxToCell (0.3 0 -1) (1.8 0.3 1); diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/controlDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/controlDict new file mode 100644 index 0000000..92078d4 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/controlDict @@ -0,0 +1,86 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs +( + "libmembraneRoofVelocity2dFvPatchVectorField.so" +); + +application solids4Foam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2; + +deltaT 0.005; + +writeControl runTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep no; + +functions +{ + forces + { + type forces; + region fluid; + libs ( "libforces.so" ); + outputControl timeStep; + outputInterval 1; + patches (membrane-fluid); + "pName|p" p; + "UName|U" U; + "rhoName|rho" rhoInf; + log true; + rhoInf 1.0; + CofR (0.6 0.2 0); + } + pointDisp + { + type solidPointDisplacement; + point (0.6 0.2 0); + } + fsiConvData + { + type fsiConvergenceData; + region fluid; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/decomposeParDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/decomposeParDict new file mode 100644 index 0000000..cbdaeed --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/decomposeParDict @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Keep this top-level processor count consistent with the region +// decomposeParDicts because the parallel tutorial wrapper uses it to choose +// the MPI size for the monolithic run. + +numberOfSubdomains 4; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.1 new file mode 100644 index 0000000..795f2a5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.1 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (12 6 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (12 24 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (12 24 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (36 24 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (36 6 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.2 new file mode 100644 index 0000000..df242eb --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.2 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (24 12 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (24 48 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (24 48 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (72 48 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (72 12 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.3 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.3 new file mode 100644 index 0000000..8bf10d3 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/blockMeshDict.3 @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (0 0 0.05) // 0 + (0.4 0 0.05) // 1 + (0.4 0.2 0.05) // 2 + (0 0.2 0.05) // 3 + (0 1 0.05) // 4 + (0.4 1 0.05) // 5 + (0.8 0.2 0.05) // 6 + (0.8 0 0.05) // 7 + (2.2 0 0.05) // 8 + (2.2 0.2 0.05) // 9 + (0.8 1 0.05) // 10 + (2.2 1 0.05) // 11 + + (0 0 -0.05) // 12 + (0.4 0 -0.05) // 13 + (0.4 0.2 -0.05) // 14 + (0 0.2 -0.05) // 15 + (0 1 -0.05) // 16 + (0.4 1 -0.05) // 17 + (0.8 0.2 -0.05) // 18 + (0.8 0 -0.05) // 19 + (2.2 0 -0.05) // 20 + (2.2 0.2 -0.05) // 21 + (0.8 1 -0.05) // 22 + (2.2 1 -0.05) // 23 + +); + +blocks +( + hex (12 13 14 15 0 1 2 3) (48 24 1) simpleGrading (1 1 1) + hex (15 14 17 16 3 2 5 4) (48 96 1) simpleGrading (1 1 1) + hex (14 18 22 17 2 6 10 5) (48 96 1) simpleGrading (1 1 1) + hex (18 21 23 22 6 9 11 10) (144 96 1) simpleGrading (1 1 1) + hex (19 20 21 18 7 8 9 6) (144 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 3 15 12) + (3 4 16 15) + ); + } + + outlet + { + type patch; + faces + ( + (21 23 11 9) + (20 21 9 8) + ); + } + + membrane-fluid + { + type patch; + faces + ( + (2 14 18 6) + ); + } + + building + { + type wall; + faces + ( + (1 2 14 13) + (19 18 6 7) + + ); + } + + bottom + { + type wall; + faces + ( + (0 12 13 1) + (7 19 20 8) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 1 2 3) + (3 2 5 4) + (2 6 10 5) + (6 9 11 10) + (7 8 9 6) + (12 15 14 13) + (15 16 17 14) + (17 22 18 14) + (22 23 21 18) + (18 21 20 19) + ); + } + + top + { + type patch; + faces + ( + (4 5 17 16) + (5 10 22 17) + (10 11 23 22) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/decomposeParDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/decomposeParDict new file mode 100644 index 0000000..657baae --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/decomposeParDict @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic new file mode 100644 index 0000000..b26e580 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic @@ -0,0 +1,72 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +d2dt2Schemes +{ + default none; + d2dt2(D) steadyState; +} + +ddtSchemes +{ + default none; + ddt(U) Euler; + ddt(p) Euler; + ddt(D) steadyState; + d2dt2(D) steadyState; +} + +gradSchemes +{ + default leastSquares; + grad(D) leastSquaresS4f; +} + +divSchemes +{ + default none; + jacobian-div(phi,U) Gauss upwind; + div(phi,U) Gauss linearUpwind cellLimited leastSquares 1; + div((nuEff*dev2(T(grad(U))))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; + div(U) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(U) skewCorrected linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic new file mode 100644 index 0000000..1581fc5 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic @@ -0,0 +1,121 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + D // fluid mesh motion + { + solver petsc; + + options + { + snes_type newtonls; + snes_linesearch_type basic; + snes_rtol "1e-3"; + snes_stol "1e-3"; + snes_monitor; + snes_converged_reason; + + snes_mf; + snes_mf_operator; + + ksp_type lgmres; + ksp_gmres_restart "100"; + ksp_converged_reason; + + pc_type hypre; + pc_hypre_type boomeramg; + pc_hypre_boomeramg_max_iter "1"; + pc_hypre_boomeramg_strong_threshold "0.6"; + pc_hypre_boomeramg_grid_sweeps_up "1"; + pc_hypre_boomeramg_grid_sweeps_down "1"; + pc_hypre_boomeramg_agg_nl "1"; + pc_hypre_boomeramg_agg_num_paths "1"; + pc_hypre_boomeramg_max_levels "25"; + pc_hypre_boomeramg_coarsen_type HMIS; + pc_hypre_boomeramg_interp_type ext+i; + pc_hypre_boomeramg_P_max "1"; + pc_hypre_boomeramg_truncfactor "0.3"; + + snes_lag_preconditioner_persists true; + snes_lag_preconditioner "-2"; + } + } + + "p|pFinal|Phi" + { + solver GAMG; + tolerance 1e-06; + relTol 0; + minIter 1; + maxIter 1000; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + cellMotionU + { + solver GAMG; + tolerance 1e-06; + relTol 0; + minIter 1; + maxIter 100; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + "U|UFinal" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-06; + relTol 0; + minIter 1; + } +} + +PIMPLE +{ + momentumPredictor on; + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 1; +} + +potentialFlow +{ + nNonOrthogonalCorrectors 10; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.1 new file mode 100644 index 0000000..860047b --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.1 @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object refineMeshDict.1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +set cellsToRefine1; + +coordinateSystem global; + +globalCoeffs +{ + tan1 (1 0 0); + tan2 (0 1 0); +} + +directions +( + tan1 + tan2 +); + +useHexTopology false; + +geometricCut false; + +writeMesh false; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.2 new file mode 100644 index 0000000..5103be8 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/refineMeshDict.2 @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object refineMeshDict.2; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +set cellsToRefine2; + +coordinateSystem global; + +globalCoeffs +{ + tan1 (1 0 0); + tan2 (0 1 0); +} + +directions +( + tan1 + tan2 +); + +useHexTopology false; + +geometricCut false; + +writeMesh false; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic new file mode 100644 index 0000000..544f11a --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic @@ -0,0 +1,87 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + UpU + { + solver petsc; + + options + { + snes_type newtonls; + snes_linesearch_type basic; + snes_rtol "1e-6"; + snes_stol "1e-6"; + snes_monitor; + snes_converged_reason; + snes_max_linear_solve_fail "100"; + + snes_mf_operator; + + ksp_type lgmres; + ksp_gmres_restart "200"; + ksp_rtol "1e-4"; + ksp_converged_reason; + ksp_max_it "1000"; + + // Top-level: fluid/solid multiplicative split + pc_type fieldsplit; + pc_fieldsplit_type multiplicative; + + // Solid: gather to 1 rank, exact LU (parallel-safe) + fieldsplit_solid_ksp_type preonly; + fieldsplit_solid_pc_type redundant; + fieldsplit_solid_redundant_pc_type lu; + + // Fluid: nested velocity/pressure Schur (2-D: block_size 3) + fieldsplit_fluid_ksp_type preonly; + fieldsplit_fluid_pc_type fieldsplit; + fieldsplit_fluid_pc_fieldsplit_type schur; + fieldsplit_fluid_pc_fieldsplit_schur_fact_type upper; + fieldsplit_fluid_pc_fieldsplit_schur_precondition selfp; + fieldsplit_fluid_pc_fieldsplit_block_size "3"; + fieldsplit_fluid_pc_fieldsplit_0_fields "0,1"; + fieldsplit_fluid_pc_fieldsplit_1_fields "2"; + + // Velocity sub-block: bjacobi + ILU(0) + fieldsplit_fluid_fieldsplit_0_ksp_type preonly; + fieldsplit_fluid_fieldsplit_0_pc_type bjacobi; + fieldsplit_fluid_fieldsplit_0_sub_pc_type ilu; + fieldsplit_fluid_fieldsplit_0_sub_pc_factor_levels "0"; + + // Pressure Schur complement: HYPRE BoomerAMG + fieldsplit_fluid_fieldsplit_1_ksp_type preonly; + fieldsplit_fluid_fieldsplit_1_pc_type hypre; + fieldsplit_fluid_fieldsplit_1_pc_hypre_type boomeramg; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_max_iter "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_strong_threshold "0.6"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_grid_sweeps_up "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_grid_sweeps_down "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_agg_nl "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_agg_num_paths "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_max_levels "25"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_coarsen_type HMIS; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_interp_type ext+i; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_P_max "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_truncfactor "0.3"; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.physicsPC b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.physicsPC new file mode 100644 index 0000000..f71b82b --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.physicsPC @@ -0,0 +1,82 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + UpU + { + solver petsc; + + options + { + snes_type newtonls; + snes_linesearch_type basic; + snes_rtol "1e-6"; + snes_stol "1e-6"; + snes_monitor; + snes_converged_reason; + snes_max_linear_solve_fail "100"; + + snes_mf_operator; + + // fgmres is required because the physics PC is variable + ksp_type fgmres; + ksp_gmres_restart "200"; + ksp_rtol "1e-4"; + ksp_pc_side right; + ksp_converged_reason; + ksp_max_it "1000"; + + pc_type physics; + pc_physics_type model; + } + } + + // One fixed momentum correction per physics PC application + dU + { + solver PBiCG; + preconditioner DILU; + tolerance 0; + relTol 0; + minIter 1; + maxIter 1; + } + + // One fixed pressure correction per physics PC application + dp + { + solver GAMG; + tolerance 0; + relTol 0; + minIter 1; + maxIter 1; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 1; + nFinestSweeps 1; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.schurTuned b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.schurTuned new file mode 100644 index 0000000..9fcbd27 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fvSolution.monolithic.schurTuned @@ -0,0 +1,88 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + UpU + { + solver petsc; + + options + { + snes_type newtonls; + snes_linesearch_type basic; + snes_rtol "1e-6"; + snes_stol "1e-6"; + snes_monitor; + snes_converged_reason; + snes_max_linear_solve_fail "100"; + + snes_mf_operator; + + ksp_type lgmres; + ksp_gmres_restart "200"; + ksp_rtol "1e-4"; + ksp_converged_reason; + ksp_max_it "1000"; + + // Top-level: fluid/solid multiplicative split + pc_type fieldsplit; + pc_fieldsplit_type multiplicative; + + // Solid: gather to 1 rank, exact LU (parallel-safe) + fieldsplit_solid_ksp_type preonly; + fieldsplit_solid_pc_type redundant; + fieldsplit_solid_redundant_pc_type lu; + + // Fluid: nested velocity/pressure Schur (2-D: block_size 3) + // Tuned: full factorisation, a11 Schur precondition, ASM+ILU + fieldsplit_fluid_ksp_type preonly; + fieldsplit_fluid_pc_type fieldsplit; + fieldsplit_fluid_pc_fieldsplit_type schur; + fieldsplit_fluid_pc_fieldsplit_schur_fact_type full; + fieldsplit_fluid_pc_fieldsplit_schur_precondition a11; + fieldsplit_fluid_pc_fieldsplit_block_size "3"; + fieldsplit_fluid_pc_fieldsplit_0_fields "0,1"; + fieldsplit_fluid_pc_fieldsplit_1_fields "2"; + + // Velocity sub-block: ASM + ILU(0) + fieldsplit_fluid_fieldsplit_0_ksp_type preonly; + fieldsplit_fluid_fieldsplit_0_pc_type asm; + fieldsplit_fluid_fieldsplit_0_sub_pc_type ilu; + fieldsplit_fluid_fieldsplit_0_sub_pc_factor_levels "0"; + + // Pressure Schur complement: HYPRE BoomerAMG + fieldsplit_fluid_fieldsplit_1_ksp_type preonly; + fieldsplit_fluid_fieldsplit_1_pc_type hypre; + fieldsplit_fluid_fieldsplit_1_pc_hypre_type boomeramg; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_max_iter "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_strong_threshold "0.6"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_grid_sweeps_up "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_grid_sweeps_down "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_agg_nl "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_agg_num_paths "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_max_levels "25"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_coarsen_type HMIS; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_interp_type ext+i; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_P_max "1"; + fieldsplit_fluid_fieldsplit_1_pc_hypre_boomeramg_truncfactor "0.3"; + } + } +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.1 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.1 new file mode 100644 index 0000000..5ae431c --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.1 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (48 6 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.2 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.2 new file mode 100644 index 0000000..dab94fa --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.2 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (96 12 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.3 b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.3 new file mode 100644 index 0000000..edb2469 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/blockMeshDict.3 @@ -0,0 +1,98 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + // Membrane thickness is 0.002 + // (0.6 0.198 -0.05) //0 + // (1 0.198 -0.05) //1 + // (1 0.2 -0.05) //2 + // (0.6 0.2 -0.05) //3 + // (0.6 0.198 0.05) //4 + // (1 0.198 0.05) //5 + // (1 0.2 0.05) //6 + // (0.6 0.2 0.05) //7 + + // Membrane thickness is 0.005 + (0.4 0.195 -0.05) //0 + (0.8 0.195 -0.05) //1 + (0.8 0.2 -0.05) //2 + (0.4 0.2 -0.05) //3 + (0.4 0.195 0.05) //4 + (0.8 0.195 0.05) //5 + (0.8 0.2 0.05) //6 + (0.4 0.2 0.05) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (192 24 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + membrane-solid + { + type patch; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type patch; + faces + ( + (4 0 1 5) + ); + } + + sides + { + type patch; + faces + ( + (4 7 3 0) + (5 1 2 6) + ); + } + + frontAndBack + { + type empty; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/controlDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/controlDict new file mode 100644 index 0000000..8a2e68e --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application solids4Foam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 3; + +deltaT 1e-3; + +writeControl timeStep; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep no; + +maxCo 0.2; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/decomposeParDict b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/decomposeParDict new file mode 100644 index 0000000..657baae --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/decomposeParDict @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes new file mode 100644 index 0000000..c514da0 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +d2dt2Schemes +{ + default backward; +} + +ddtSchemes +{ + default backward; +} + +gradSchemes +{ + default leastSquaresS4f; +} + +divSchemes +{ + default Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +snGradSchemes +{ + default corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(impK) linear; + interpolate(grad(D)) linear; + interpolate(grad(DD)) linear; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes.monolithic new file mode 100644 index 0000000..234cf49 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSchemes.monolithic @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +d2dt2Schemes +{ + default backward; +} + +ddtSchemes +{ + default backward; +} + +gradSchemes +{ + default leastSquaresS4f; +} + +divSchemes +{ + default Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +snGradSchemes +{ + default corrected; +} + +interpolationSchemes +{ + default linear; +} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSolution.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSolution.monolithic new file mode 100644 index 0000000..56e9bbd --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/solid/fvSolution.monolithic @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| solids4foam: solid mechanics and fluid-solid interaction simulations | +| Version: v2.3 | +| Web: https://solids4foam.github.io | +| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | +| producer and distributor of the OpenFOAM software via | +| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | +| trade marks. | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ +} + +//relaxationFactors +//{ +//} + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/run.slurm b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/run.slurm new file mode 100755 index 0000000..975e1a1 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/run.slurm @@ -0,0 +1,20 @@ +#!/bin/bash +#SBATCH --job-name=membraneRoof2d +#SBATCH --output=log.%x_%j.out +#SBATCH --error=log.%x_%j.err +#SBATCH --partition=main +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=1 +#SBATCH --time=24:00:00 + +cd "$SLURM_SUBMIT_DIR" + +. /usr/lib/openfoam/openfoam2512/etc/bashrc + +export SOLIDS4FOAM_ROOT="${SOLIDS4FOAM_ROOT:-/home/philipc/OpenFOAM/philipc-v2512/solids4foam.monolithic}" + +# Campaign controls can be overridden at submission time, e.g. +# sbatch --export=ALL,STUDY=time,DT_VALUES="0.04 0.02 0.01" run.slurm +: "${STUDY:=mesh}" + +./Allrun "$STUDY" &> "log.Allrun.${STUDY}" diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/Allwmake b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/Allwmake new file mode 100755 index 0000000..bcfedfe --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/Allwmake @@ -0,0 +1,4 @@ +#!/bin/bash +cd "${0%/*}" || exit + +wmake $* libso membraneRoofVelocity2dFvPatchVectorField diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/files b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/files new file mode 100644 index 0000000..094951d --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/files @@ -0,0 +1,3 @@ +membraneRoofVelocity2dFvPatchVectorField.C + +LIB = $(FOAM_USER_LIBBIN)/libmembraneRoofVelocity2dFvPatchVectorField diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/options b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/options new file mode 100644 index 0000000..6d93d58 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/Make/options @@ -0,0 +1,25 @@ +ifeq ($(WM_PROJECT), foam) + VER := $(shell expr `echo $(WM_PROJECT_VERSION)` \>= 4.1) + ifeq ($(VER), 1) + VERSION_SPECIFIC_INC = -DFOAMEXTEND=41 + else + VERSION_SPECIFIC_INC = -DFOAMEXTEND=40 + endif +else + ifneq (,$(findstring -DOPENFOAM=,$(GFLAGS))) + VERSION_SPECIFIC_INC = -DOPENFOAM_COM + else ifneq (,$(findstring v,$(WM_PROJECT_VERSION))) + VERSION_SPECIFIC_INC = -DOPENFOAM_COM + else + VERSION_SPECIFIC_INC = -DOPENFOAM_ORG + endif + VERSION_SPECIFIC_INC += -DOPENFOAM_NOT_EXTEND +endif + +EXE_INC = \ + $(VERSION_SPECIFIC_INC) \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lOpenFOAM \ + -lfiniteVolume diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.C b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.C new file mode 100644 index 0000000..a79f0b4 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.C @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "membraneRoofVelocity2dFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +namespace Foam +{ + +membraneRoofVelocity2dFvPatchVectorField:: +membraneRoofVelocity2dFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF) +{} + + +membraneRoofVelocity2dFvPatchVectorField:: +membraneRoofVelocity2dFvPatchVectorField +( + const membraneRoofVelocity2dFvPatchVectorField& pvf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(pvf, p, iF, mapper) +{} + + +membraneRoofVelocity2dFvPatchVectorField:: +membraneRoofVelocity2dFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF, dict) +{ + Info<< "Creating " << type() << " boundary condition" << endl; +} + + +#ifndef OPENFOAM_ORG +membraneRoofVelocity2dFvPatchVectorField:: +membraneRoofVelocity2dFvPatchVectorField +( + const membraneRoofVelocity2dFvPatchVectorField& pvf +) +: + fixedValueFvPatchVectorField(pvf) +{} +#endif + + +membraneRoofVelocity2dFvPatchVectorField:: +membraneRoofVelocity2dFvPatchVectorField +( + const membraneRoofVelocity2dFvPatchVectorField& pvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(pvf, iF) +{} + + +membraneRoofVelocity2dFvPatchVectorField:: +~membraneRoofVelocity2dFvPatchVectorField() +{} + + +void membraneRoofVelocity2dFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchVectorField::autoMap(m); +} + + +void membraneRoofVelocity2dFvPatchVectorField::rmap +( + const fvPatchField& pvf, + const labelList& addr +) +{ + fixedValueFvPatchVectorField::rmap(pvf, addr); +} + + +void membraneRoofVelocity2dFvPatchVectorField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const scalar uMax = 0.6; + const scalar yTop = 1.0; + const scalar rampEndTime = 2.0; + + const scalarField y(patch().Cf().component(vector::Y)); + scalarField eta(y/yTop); + forAll(eta, faceI) + { + eta[faceI] = max(min(eta[faceI], 1.0), 0.0); + } + const scalarField uy(2.0*eta - sqr(eta)); + + const scalar t = db().time().value(); + scalar ut = 1.0; + if (t < rampEndTime) + { + ut = t/rampEndTime; + } + + operator==(uMax*ut*uy*vector(1, 0, 0)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +makePatchTypeField +( + fvPatchVectorField, + membraneRoofVelocity2dFvPatchVectorField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H new file mode 100644 index 0000000..19c89d8 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + Foam::membraneRoofVelocity2dFvPatchVectorField + +Description + Prescribed inlet velocity profile from: + + Von Scheven, M., and E. Ramm. Strong coupling schemes for interaction of + thin‐walled structures and incompressible flows, International journal + for numerical methods in engineering, 87.1‐5 (2011): 214-231. + +SourceFiles + membraneRoofVelocity2dFvPatchVectorField.C + +Author + Ivan Batistsic, UCD. + Philip Cardiff, UCD. All rights reserved. +\*---------------------------------------------------------------------------*/ + +#ifndef membraneRoofVelocity2dFvPatchVectorField_H +#define membraneRoofVelocity2dFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------* \ + Class membraneRoofVelocity2dFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + + +class membraneRoofVelocity2dFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ +public: + + //- Runtime type information + TypeName("membraneRoofVelocity2d"); + + + // Constructors + + //- Construct from patch and internal field + membraneRoofVelocity2dFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + membraneRoofVelocity2dFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping onto a new patch + membraneRoofVelocity2dFvPatchVectorField + ( + const membraneRoofVelocity2dFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + membraneRoofVelocity2dFvPatchVectorField + ( + const membraneRoofVelocity2dFvPatchVectorField& +#ifdef OPENFOAM_ORG + ) = delete; +#else + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new membraneRoofVelocity2dFvPatchVectorField(*this) + ); + } +#endif + + //- Construct as copy setting internal field reference + membraneRoofVelocity2dFvPatchVectorField + ( + const membraneRoofVelocity2dFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new membraneRoofVelocity2dFvPatchVectorField(*this, iF) + ); + } + + + //- Destructor + virtual ~membraneRoofVelocity2dFvPatchVectorField(); + + + // Member functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField&, + const labelList& + ); + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 9442f4fe1fa3b92d96f62ac032fc6d4f72008f27 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 18 May 2026 14:47:02 +0200 Subject: [PATCH 15/23] Fix for .H file --- .../membraneRoofVelocity2dFvPatchVectorField.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H index 19c89d8..71195b0 100644 --- a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/src/membraneRoofVelocity2dFvPatchVectorField/membraneRoofVelocity2dFvPatchVectorField.H @@ -30,7 +30,7 @@ SourceFiles Author Ivan Batistsic, UCD. - Philip Cardiff, UCD. All rights reserved. + Philip Cardiff, UCD. \*---------------------------------------------------------------------------*/ #ifndef membraneRoofVelocity2dFvPatchVectorField_H From 87d0d2c932a382beb1700540caafd51211fb2472 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 18 May 2026 14:53:53 +0200 Subject: [PATCH 16/23] Added deflection and force gnuplot scripts --- .../base/partitioned/deflection.gnuplot | 11 +++++++++++ .../membraneRoof2d/base/partitioned/force.gnuplot | 15 +++++++++++++++ .../base/partitioned/iterations.gnuplot | 10 ++++++++++ .../base/quasiMonolithic/deflection.gnuplot | 11 +++++++++++ .../base/quasiMonolithic/force.gnuplot | 15 +++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/deflection.gnuplot create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/force.gnuplot create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/iterations.gnuplot create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/deflection.gnuplot create mode 100644 papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/force.gnuplot diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/deflection.gnuplot b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/deflection.gnuplot new file mode 100644 index 0000000..c9c1f43 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/deflection.gnuplot @@ -0,0 +1,11 @@ +set terminal pdfcairo enhanced color solid + +set output "deflection.pdf" +set xlabel "Time, t [s]" +set ylabel "Centre point vertical deflection, u_y [m]" +set grid + +set yrange[-0.1:0] +set xrange[0:2] + +plot "./postProcessing/0/solidPointDisplacement_pointDisp.dat" using 1:3 title "u_y" with lines lw 2 diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/force.gnuplot b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/force.gnuplot new file mode 100644 index 0000000..caaf8c7 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/force.gnuplot @@ -0,0 +1,15 @@ +set terminal pdfcairo enhanced color solid + +set output "force.pdf" +set xlabel "Time, t [s]" +set ylabel "Fx [N]" +set y2label "Fy [N]" +set grid + +set y2tics +set yrange[0:0.002] +set y2range[-0.022:-0.008] + +plot [0:2] \ + "< sed s/[\\(\\)]//g `find . -name 'force.dat'`" using 1:2 axis x1y1 title "Fx" with lines lw 2, \ + "< sed s/[\\(\\)]//g `find . -name 'force.dat'`" using 1:3 axis x1y2 title "Fy" with lines lw 2 \ No newline at end of file diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/iterations.gnuplot b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/iterations.gnuplot new file mode 100644 index 0000000..0edeac1 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/partitioned/iterations.gnuplot @@ -0,0 +1,10 @@ +set terminal pdfcairo enhanced color solid + +set output "iterations.pdf" + +set xlabel "Time (in s)" +set ylabel "Number of FSI iterations" +set grid +set key top right + +plot "postProcessing/fsiResiduals.dat" u 1:2 w l lw 0.5 lt 1 notitle diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/deflection.gnuplot b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/deflection.gnuplot new file mode 100644 index 0000000..c9c1f43 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/deflection.gnuplot @@ -0,0 +1,11 @@ +set terminal pdfcairo enhanced color solid + +set output "deflection.pdf" +set xlabel "Time, t [s]" +set ylabel "Centre point vertical deflection, u_y [m]" +set grid + +set yrange[-0.1:0] +set xrange[0:2] + +plot "./postProcessing/0/solidPointDisplacement_pointDisp.dat" using 1:3 title "u_y" with lines lw 2 diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/force.gnuplot b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/force.gnuplot new file mode 100644 index 0000000..caaf8c7 --- /dev/null +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/force.gnuplot @@ -0,0 +1,15 @@ +set terminal pdfcairo enhanced color solid + +set output "force.pdf" +set xlabel "Time, t [s]" +set ylabel "Fx [N]" +set y2label "Fy [N]" +set grid + +set y2tics +set yrange[0:0.002] +set y2range[-0.022:-0.008] + +plot [0:2] \ + "< sed s/[\\(\\)]//g `find . -name 'force.dat'`" using 1:2 axis x1y1 title "Fx" with lines lw 2, \ + "< sed s/[\\(\\)]//g `find . -name 'force.dat'`" using 1:3 axis x1y2 title "Fy" with lines lw 2 \ No newline at end of file From 0529004d9939ff63e26d75c29d336fe3b0176feb Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 18 May 2026 15:04:16 +0200 Subject: [PATCH 17/23] Fix for physicsPC --- .../system/fluid/fvSchemes.monolithic | 1 + .../system/fluid/fvSolution.monolithic | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic index b26e580..121fceb 100644 --- a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSchemes.monolithic @@ -26,6 +26,7 @@ ddtSchemes { default none; ddt(U) Euler; + ddt(dU) Euler; ddt(p) Euler; ddt(D) steadyState; d2dt2(D) steadyState; diff --git a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic index 1581fc5..73142e0 100644 --- a/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic +++ b/papers/JFNK_quasi_monolithic_FSI/fluidSolidInteraction/membraneRoof2d/base/quasiMonolithic/system/fluid/fvSolution.monolithic @@ -103,6 +103,37 @@ solvers relTol 0; minIter 1; } + + // Physics PC inner solvers (used only with pc_type physics) + + dU + { + solver PBiCG; + preconditioner DILU; + tolerance 0; + relTol 0; + minIter 1; + maxIter 1; + } + + dp + { + solver GAMG; + tolerance 0; + relTol 0; + minIter 1; + maxIter 1; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 1; + nFinestSweeps 1; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } } PIMPLE From 7f752d1c5d9f1c1fbe5f4f0b7ee81024c88cb6e7 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Sun, 2 Aug 2026 23:29:32 +0200 Subject: [PATCH 18/23] Added parallel scaling script --- .../linearElastic/sphericalCavity/Allrun | 6 + .../sphericalCavity/Allrun.jacChoice | 6 + .../sphericalCavity/Allrun.parallelScaling | 287 ++++++++++ .../sphericalCavity/base/snes/Allrun | 9 + .../base/snes/system/controlDict | 2 +- .../plotScripts/parallelScaling.gnuplot | 34 ++ .../sphericalCavity/src/Allwmake | 10 + .../sphericalCavity/src/Make/files | 6 + .../sphericalCavity/src/Make/options | 46 ++ ...phericalCavityTractionFvPatchVectorField.C | 237 +++++++++ ...phericalCavityTractionFvPatchVectorField.H | 180 +++++++ .../sphericalCavityAnalyticalSolution.C | 492 ++++++++++++++++++ .../sphericalCavityAnalyticalSolution.H | 192 +++++++ .../sphericalCavityStressDisplacement.C | 209 ++++++++ .../sphericalCavityStressDisplacement.H | 116 +++++ 15 files changed, 1831 insertions(+), 1 deletion(-) create mode 100755 papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/parallelScaling.gnuplot create mode 100755 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Allwmake create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/files create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/options create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.H create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.C create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.H diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun index a6189d4..8e4d83c 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun @@ -6,6 +6,12 @@ source solids4FoamScripts.sh # Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend +SCRIPT_DIR="$(cd "${0%/*}" && pwd -P)" +export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../solids4foam-ib-2412}" + +# Compile local analytical library +(cd src && ./Allwmake -s) + # Define configurations as space-separated strings configs=( #"BASE=base/snes NAME=tet.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=tet" diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice index c73fd39..898acf6 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.jacChoice @@ -6,6 +6,12 @@ source solids4FoamScripts.sh # Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend +SCRIPT_DIR="$(cd "${0%/*}" && pwd -P)" +export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../solids4foam-ib-2412}" + +# Compile local analytical library +(cd src && ./Allwmake -s) + # Define configurations as space-separated strings configs=( "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling new file mode 100755 index 0000000..6f7a91e --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling @@ -0,0 +1,287 @@ +#!/bin/bash + +# Source required functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions +source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend + +SCRIPT_DIR="$(cd "${0%/*}" && pwd -P)" +export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../solids4foam-ib-2412}" + +# Compile local analytical library +(cd src && ./Allwmake -s) + +# Defaults can be overridden, e.g. +# MESHES="3 4 5" NP_LIST="1 2 4 8" ./Allrun.parallelScaling +MESHES="${MESHES:-4}" +NP_LIST="${NP_LIST:-1 2 3}" +MESH_FAMILIES="${MESH_FAMILIES:-tet}" + +set -- ${NP_LIST} +if [ "$1" -ne 1 ] +then + echo "NP_LIST must start with 1 so speedup and efficiency have a serial baseline" + exit 1 +fi + +configs=() +for meshFamily in ${MESH_FAMILIES} +do + if [[ "${meshFamily}" == "tet" ]] + then + configs+=("BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + configs+=("BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + configs+=("BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + elif [[ "${meshFamily}" == "poly" ]] + then + configs+=("BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + configs+=("BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + configs+=("BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true") + else + echo "Unknown mesh family: ${meshFamily}" + echo "Supported values: tet poly" + exit 1 + fi +done + +runTimed() +{ + local logFile="$1" + shift + + if command -v gtime &> /dev/null + then + gtime \ + -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" \ + "$@" &> "${logFile}" + return $? + elif [ -x /usr/bin/time ] && /usr/bin/time -f "%e" true &> /dev/null + then + /usr/bin/time \ + -f "gtime/time (wall clock) time: %e\nMaximum resident set size (kbytes): %M" \ + "$@" &> "${logFile}" + return $? + else + local startTime endTime status + startTime=$(date +%s) + "$@" &> "${logFile}" + status=$? + endTime=$(date +%s) + echo "gtime/time (wall clock) time: $((endTime - startTime))" >> "${logFile}" + return ${status} + fi +} + +extractOrNaN() +{ + local value="$1" + + if [ -n "${value}" ] + then + echo "${value}" + else + echo "NaN" + fi +} + +calcSpeedup() +{ + local serialTime="$1" + local currentTime="$2" + + awk -v s="${serialTime}" -v t="${currentTime}" \ + 'BEGIN { if (s > 0 && t > 0) printf "%.6g", s/t; else printf "NaN" }' +} + +calcEfficiency() +{ + local speedup="$1" + local nProc="$2" + + awk -v sp="${speedup}" -v np="${nProc}" \ + 'BEGIN { if (sp > 0 && np > 0) printf "%.6g", sp/np; else printf "NaN" }' +} + +# Compile projectPointsToSphere +cd projectPointsToSphere +wclean +wmake +cd .. + +if [[ "$OSTYPE" == "darwin"* ]] +then + CPU_TYPE=$(sysctl -n machdep.cpu.brand_string | sed 's/[^a-zA-Z0-9]/_/g') +elif [[ -f /proc/cpuinfo ]] +then + CPU_TYPE=$(grep -m 1 "model name" /proc/cpuinfo | awk -F': ' '{print $2}' | sed 's/[^a-zA-Z0-9]/_/g') +else + CPU_TYPE="Unknown_CPU" +fi + +DATE=$(date +%Y-%m-%d_%H-%M-%S) +RUN_DIR="run_parallelScaling_${CPU_TYPE}_${DATE}" +echo "Creating ${RUN_DIR}" +mkdir "${RUN_DIR}" + +cd "${RUN_DIR}" + +GLOBAL_SUMMARY="parallelScaling.summary.txt" +echo "# Case Mesh Processors Time Speedup Efficiency Mem Cells D_L2 D_Linf S_L2 S_Linf Status" > "${GLOBAL_SUMMARY}" + +for config in "${configs[@]}" +do + unset GMSH_FILE PETSC_FILE polyOrder extraCells HOJAC HORES + + eval ${config} + echo; echo "***************************************" + echo "Running configuration: ${config}" + echo "Meshes: ${MESHES}" + echo "Processors: ${NP_LIST}" + echo "***************************************" + + SUMMARY="${NAME}.parallelScaling.summary.txt" + echo "# Mesh Processors Time Speedup Efficiency Mem Cells D_L2 D_Linf S_L2 S_Linf Status" > "${SUMMARY}" + + for i in ${MESHES} + do + MESH_CASE="${NAME}.${i}.mesh" + echo; echo "Preparing mesh case: ${MESH_CASE}" + + cp -r "../${BASE}" "${MESH_CASE}" + cd "${MESH_CASE}" + + if command -v gmsh &> /dev/null + then + mv 0 0.tmp + + if [[ "${GMSH_FILE}" == "tet" ]] + then + cp "gmsh/tet-meshSpacing/meshSpacing${i}.geo" "gmsh/tet-meshSpacing/meshSpacing.geo" + solids4Foam::runApplication gmsh -3 -format msh2 gmsh/tet.geo + solids4Foam::runApplication gmshToFoam gmsh/tet.msh + fi + + if [[ "${GMSH_FILE}" == "poly" ]] + then + cp "gmsh/poly-meshSpacing/meshSpacing${i}.geo" "gmsh/poly-meshSpacing/meshSpacing.geo" + solids4Foam::runApplication gmsh -3 -format msh2 gmsh/poly.geo + solids4Foam::runApplication gmshToFoam gmsh/poly.msh + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + fi + + solids4Foam::runApplication changeDictionary + solids4Foam::runApplication checkMesh + mv 0.tmp 0 + else + echo; echo "Gmsh is required to run this case: please install it" + exit 1 + fi + + solids4Foam::runApplication projectPointsToSphere cavity "(0 0 0)" 0.2 + mv 1/polyMesh/points constant/polyMesh/points + rm -rf 1/meshPhi 1/pointMotion 1/polyMesh + + if [ -n "${PETSC_FILE}" ]; then + sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" constant/solidProperties + fi + + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties + fi + + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties + fi + + if [ -n "${HOJAC}" ]; then + sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties + fi + + if [ -n "${HORES}" ]; then + sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties + fi + + CELLS=$(grep "cells:" log.checkMesh | awk '{print $2}') + cd .. + + SERIAL_TIME="NaN" + + for nProc in ${NP_LIST} + do + CASE="${NAME}.${i}.np${nProc}" + echo; echo "Processing case: ${CASE}" + + cp -r "${MESH_CASE}" "${CASE}" + cd "${CASE}" + + STATUS="OK" + if [ "${nProc}" -eq 1 ] + then + echo "Running solids4Foam on ${CASE}" + runTimed log.solids4Foam solids4Foam || STATUS="FAIL" + else + if ! command -v mpirun &> /dev/null + then + echo "mpirun is required for parallel runs" + STATUS="FAIL" + else + sed -i "/^\s*numberOfSubdomains /s|^.*|numberOfSubdomains ${nProc};|" system/decomposeParDict + solids4Foam::runApplication decomposePar -force + echo "Running solids4Foam on ${CASE} with ${nProc} processors" + runTimed log.solids4Foam mpirun -np "${nProc}" solids4Foam -parallel || STATUS="FAIL" + fi + fi + + CLOCK_TIME=$(grep "gtime/time" log.solids4Foam | tail -1 | awk '{print $5}') + CLOCK_TIME=$(extractOrNaN "${CLOCK_TIME}") + + if grep -q "Maximum resident" log.solids4Foam + then + MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | tail -1 | awk '{print int($6 / 1000)}') + else + MAX_MEMORY="NaN" + fi + + DISP_L2_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $2}') + DISP_L2_ERROR=$(extractOrNaN "${DISP_L2_ERROR}") + + DISP_LINF_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + DISP_LINF_ERROR=$(extractOrNaN "${DISP_LINF_ERROR}") + + STRESS_L2_ERROR=$(grep "Component: 5" -A 2 log.solids4Foam | tail -1 | awk '{print $2}') + STRESS_L2_ERROR=$(extractOrNaN "${STRESS_L2_ERROR}") + + STRESS_LINF_ERROR=$(grep "Component: 5" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + STRESS_LINF_ERROR=$(extractOrNaN "${STRESS_LINF_ERROR}") + + if [ "${nProc}" -eq 1 ] + then + SERIAL_TIME="${CLOCK_TIME}" + fi + + SPEEDUP=$(calcSpeedup "${SERIAL_TIME}" "${CLOCK_TIME}") + EFFICIENCY=$(calcEfficiency "${SPEEDUP}" "${nProc}") + + echo "${i} ${nProc} ${CLOCK_TIME} ${SPEEDUP} ${EFFICIENCY} ${MAX_MEMORY} ${CELLS} ${DISP_L2_ERROR} ${DISP_LINF_ERROR} ${STRESS_L2_ERROR} ${STRESS_LINF_ERROR} ${STATUS}" >> ../"${SUMMARY}" + echo "${NAME} ${i} ${nProc} ${CLOCK_TIME} ${SPEEDUP} ${EFFICIENCY} ${MAX_MEMORY} ${CELLS} ${DISP_L2_ERROR} ${DISP_LINF_ERROR} ${STRESS_L2_ERROR} ${STRESS_LINF_ERROR} ${STATUS}" >> ../"${GLOBAL_SUMMARY}" + + cd .. + done + done + + echo; echo "${SUMMARY} file:"; cat "${SUMMARY}"; echo +done + +echo; echo "${GLOBAL_SUMMARY} file:"; cat "${GLOBAL_SUMMARY}"; echo +if command -v gnuplot &> /dev/null +then + cp ../plotScripts/parallelScaling.gnuplot . + gnuplot parallelScaling.gnuplot +fi + +echo; echo; echo "Done!"; echo +echo "View the results in ${RUN_DIR}" +echo; echo $(date) +echo; echo diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun index 4026d58..65c65e3 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/Allrun @@ -9,6 +9,15 @@ source solids4FoamScripts.sh solids4Foam::caseDoesNotRunWithFoamExtend solids4Foam::caseDoesNotRunWithOpenFOAMOrg +SCRIPT_DIR="$(cd "${0%/*}" && pwd -P)" +export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../../../solids4foam-ib-2412}" + +# Compile local analytical library when running from the benchmark base case +if [ -d ../../src ] +then + (cd ../../src && ./Allwmake -s) +fi + # Use poly (1) or tet (0) volumes USE_POLY=0 diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/system/controlDict b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/system/controlDict index 2cb05c3..7035d6a 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/system/controlDict +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/snes/system/controlDict @@ -17,7 +17,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -libs ("libsphericalCavity.so"); +libs ("libsphericalCavityAnalytical.so"); application solids4Foam; diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/parallelScaling.gnuplot b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/parallelScaling.gnuplot new file mode 100644 index 0000000..55e4ac6 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/plotScripts/parallelScaling.gnuplot @@ -0,0 +1,34 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +dataFile = "parallelScaling.summary.txt" + +set grid +set xrange [1:*] +set yrange [0:*] +set xtics 1 +set ytics +set xlabel "Number of processors" +set ylabel "Speedup" +set key left top +set key spacing 1.2 + +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 41 lc rgb "black" lt 2 lw 1 dt 2 + +meshes = system("awk 'NF && $1 !~ /^#/ {print $2}' ".dataFile." | sort -n | uniq") + +do for [i=1:words(meshes)] { + mesh = word(meshes, i) + 0 + + set output sprintf("sphericalCavity_parallelScaling_mesh%d.pdf", mesh) + set title sprintf("Mesh %d", mesh) + + plot \ + x w l ls 41 title "ideal", \ + dataFile u (($2 == mesh && strstrt(strcol(1), ".N1") > 0) ? $3 : 1/0):5 w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + dataFile u (($2 == mesh && strstrt(strcol(1), ".N2") > 0) ? $3 : 1/0):5 w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + dataFile u (($2 == mesh && strstrt(strcol(1), ".N3") > 0) ? $3 : 1/0):5 w lp ls 31 title "{/Times-Italic p}_{ }=3" +} diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Allwmake b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Allwmake new file mode 100755 index 0000000..45b4cad --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Allwmake @@ -0,0 +1,10 @@ +#!/bin/bash +cd "${0%/*}" || exit # Run from this directory + +if [[ -n "${S4F_NO_USE_EIGEN:-}" ]]; then + echo "Eigen is required to compile this local library" + echo "Unset S4F_NO_USE_EIGEN and rebuild solids4foam" + exit 1 +fi + +wmake $* libso diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/files b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/files new file mode 100644 index 0000000..d6e72e6 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/files @@ -0,0 +1,6 @@ +analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C + +sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C +sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.C + +LIB = $(FOAM_MODULE_LIBBIN)/libsphericalCavityAnalytical diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/options b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/options new file mode 100644 index 0000000..fc4fd0a --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/Make/options @@ -0,0 +1,46 @@ +SOLIDS4FOAM_ROOT := $(shell d="$(CURDIR)"; while [ "$$d" != "/" ]; do if [ -f "$$d/etc/wmake-options" ] && [ -d "$$d/src/solids4FoamModels" ]; then echo "$$d"; exit 0; fi; if [ -f "$$d/solids4foam-ib-2412/etc/wmake-options" ] && [ -d "$$d/solids4foam-ib-2412/src/solids4FoamModels" ]; then echo "$$d/solids4foam-ib-2412"; exit 0; fi; d="$$(dirname "$$d")"; done) + +ifeq ($(SOLIDS4FOAM_ROOT),) +SOLIDS4FOAM_ROOT := $(SOLIDS4FOAM_DIR) +endif + +sinclude $(SOLIDS4FOAM_ROOT)/etc/wmake-options +sinclude $(SOLIDS4FOAM_ROOT)/../etc/wmake-options + +EXE_INC = \ + -Wno-old-style-cast -Wno-deprecated-declarations \ + $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_ROOT)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_ROOT)/src/blockCoupledSolids4FoamTools/lnInclude \ + -I$(SOLIDS4FOAM_ROOT)/src/RBFMeshMotionSolver/lnInclude \ + -I$(SOLIDS4FOAM_ROOT)/src/solids4FoamModels/lnInclude \ + -I$(SOLIDS4FOAM_ROOT)/src/solids4FoamModels/numerics/compatibilityFunctions \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ + -I$(LIB_SRC)/lagrangian/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/fvMotionSolver/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude \ + -I$(LIB_SRC)/postProcessing/foamCalcFunctions/lnInclude \ + -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ + -I$(LIB_SRC)/errorEstimation/lnInclude \ + -I$(LIB_SRC)/mesh/cfMesh/lnInclude \ + -I$(LIB_SRC)/tetFiniteElement/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/meshMotion/fvMotionSolver/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/meshMotion/tetMotionSolver/lnInclude \ + -I$(LIB_SRC)/overset/oversetMesh/lnInclude + +LIB_INC = $(EXE_INC) + +LIB_LIBS = \ + -lfiniteVolume \ + -L$(FOAM_MODULE_LIBBIN) \ + -lblockCoupledSolids4FoamTools \ + -lRBFMeshMotionSolver \ + -lsolids4FoamModels diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C new file mode 100644 index 0000000..a93764e --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C @@ -0,0 +1,237 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "analyticalSphericalCavityTractionFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "sphericalCavityStressDisplacement.H" +#include "lookupSolidModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +analyticalSphericalCavityTractionFvPatchVectorField:: +analyticalSphericalCavityTractionFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + solidTractionFvPatchVectorField(p, iF), + T0_(0.0), + cavityR_(0.0), + nu_(0.0) +{} + + +analyticalSphericalCavityTractionFvPatchVectorField:: +analyticalSphericalCavityTractionFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + solidTractionFvPatchVectorField(p, iF), + T0_(readScalar(dict.lookup("farFieldTractionZ"))), + cavityR_(readScalar(dict.lookup("cavityRadius"))), + nu_(readScalar(dict.lookup("nu"))) +{} + + +analyticalSphericalCavityTractionFvPatchVectorField:: +analyticalSphericalCavityTractionFvPatchVectorField +( + const analyticalSphericalCavityTractionFvPatchVectorField& stpvf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + solidTractionFvPatchVectorField(stpvf, p, iF, mapper), + T0_(stpvf.T0_), + cavityR_(stpvf.cavityR_), + nu_(stpvf.nu_) +{} + +#ifndef OPENFOAM_ORG +analyticalSphericalCavityTractionFvPatchVectorField:: +analyticalSphericalCavityTractionFvPatchVectorField +( + const analyticalSphericalCavityTractionFvPatchVectorField& stpvf +) +: + solidTractionFvPatchVectorField(stpvf), + T0_(stpvf.T0_), + cavityR_(stpvf.cavityR_), + nu_(stpvf.nu_) +{} +#endif + +analyticalSphericalCavityTractionFvPatchVectorField:: +analyticalSphericalCavityTractionFvPatchVectorField +( + const analyticalSphericalCavityTractionFvPatchVectorField& stpvf, + const DimensionedField& iF +) +: + solidTractionFvPatchVectorField(stpvf, iF), + T0_(stpvf.T0_), + cavityR_(stpvf.cavityR_), + nu_(stpvf.nu_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void analyticalSphericalCavityTractionFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + solidTractionFvPatchVectorField::autoMap(m); +} + + +// Reverse-map the given fvPatchField onto this fvPatchField +void analyticalSphericalCavityTractionFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + solidTractionFvPatchVectorField::rmap(ptf, addr); +} + + +// Update the coefficients associated with the patch field +void analyticalSphericalCavityTractionFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Patch unit normals + vectorField n(patch().nf()); + + // Patch face centres + const vectorField& Cf = patch().Cf(); + + // Set the patch traction + + vectorField& trac = traction(); + + forAll(traction(), faceI) + { + trac[faceI] = + ( + n[faceI] & sphericalCavityStress(T0_, nu_, cavityR_, Cf[faceI]) + ); + } + + solidTractionFvPatchVectorField::updateCoeffs(); +} + + +#ifndef FOAMEXTEND +autoPtr> +analyticalSphericalCavityTractionFvPatchVectorField::evaluateQuadrature() const +{ + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.displacementMLS().quadrature().faceQuadPoints(); + + labelList nQpPerFace(this->size(), 0); + const label start = this->patch().start(); + forAll(nQpPerFace, faceI) + { + const label globalFaceID = faceI + start; + nQpPerFace[faceI]=faceQuadPoints[globalFaceID].size(); + } + + autoPtr> tQuadPointsValue + ( + new CompactListList(nQpPerFace) + ); + + // Get a reference to the actual data for easier access + CompactListList& quadPointsValue = tQuadPointsValue(); + + // Patch unit normals + vectorField n(patch().nf()); + + forAll(*this, faceI) + { + const label globalFaceID = faceI + start; + + // Get the number of quadrature points for this face + const label nPoints = faceQuadPoints[globalFaceID].size(); + + // Assign the same value to all quadrature points on this face + // We assume constant distribution of traction! + for (label pointI = 0; pointI < nPoints; ++pointI) + { + const point quadPoint = faceQuadPoints[globalFaceID][pointI]; + quadPointsValue[faceI][pointI] = + n[faceI] & sphericalCavityStress(T0_, nu_, cavityR_, quadPoint); + } + } + + return tQuadPointsValue; +} +#endif + + +// Write +void analyticalSphericalCavityTractionFvPatchVectorField::write(Ostream& os) const +{ + solidTractionFvPatchVectorField::write(os); + + os.writeKeyword("farFieldTractionZ") + << T0_ << token::END_STATEMENT << nl; + + os.writeKeyword("cavityRadius") + << cavityR_ << token::END_STATEMENT << nl; + + os.writeKeyword("nu") + << nu_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + analyticalSphericalCavityTractionFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.H new file mode 100644 index 0000000..d5451b2 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.H @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + analyticalSphericalCavityTractionFvPatchVectorField + +Description + Traction boundary condition for a spherical cavity in an infinite elastic + medium subjected to a distant stress test case to enforce analytical + tractions at the boundaries. + +Author + Philip Cardiff, UCD. + +SourceFiles + analyticalSphericalCavityTractionFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef analyticalSphericalCavityTractionFvPatchVectorField_H +#define analyticalSphericalCavityTractionFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "solidTractionFvPatchVectorField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class analyticalSphericalCavityTractionFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class analyticalSphericalCavityTractionFvPatchVectorField +: + public solidTractionFvPatchVectorField +{ +private: + + // Private Data + + //- Far field traction + // It is assumed that it acts in the positive Z direction + const scalar T0_; + + //- Hole radius + const scalar cavityR_; + + //- Poisson's ration + const scalar nu_; + + +public: + + //- Runtime type information + TypeName("analyticalSphericalCavityTraction"); + + + // Constructors + + //- Construct from patch and internal field + analyticalSphericalCavityTractionFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + analyticalSphericalCavityTractionFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // analyticalSphericalCavityTractionFvPatchVectorField onto a new patch + analyticalSphericalCavityTractionFvPatchVectorField + ( + const analyticalSphericalCavityTractionFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + analyticalSphericalCavityTractionFvPatchVectorField + ( + const analyticalSphericalCavityTractionFvPatchVectorField& +#ifdef OPENFOAM_ORG + ) = delete; +#else + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new analyticalSphericalCavityTractionFvPatchVectorField(*this) + ); + } +#endif + + //- Construct as copy setting internal field reference + analyticalSphericalCavityTractionFvPatchVectorField + ( + const analyticalSphericalCavityTractionFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new analyticalSphericalCavityTractionFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + +#ifndef FOAMEXTEND + //- Return face quadrature values, used for high order solvers + virtual autoPtr> + evaluateQuadrature() const; +#endif + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C new file mode 100644 index 0000000..9d8974e --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C @@ -0,0 +1,492 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*----------------------------------------------------------------------------*/ + +#include "sphericalCavityAnalyticalSolution.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "pointFields.H" +#include "sphericalCavityStressDisplacement.H" +#include "OSspecific.H" +#include "compatibilityFunctions.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(sphericalCavityAnalyticalSolution, 0); + + addToRunTimeSelectionTable + ( + functionObject, + sphericalCavityAnalyticalSolution, + dictionary + ); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +bool Foam::sphericalCavityAnalyticalSolution::writeData() +{ + // Lookup the solid mesh + const fvMesh* meshPtr = NULL; + if (time_.foundObject("solid")) + { + meshPtr = &(time_.lookupObject("solid")); + } + else + { + meshPtr = &(time_.lookupObject("region0")); + } + const fvMesh& mesh = *meshPtr; + + // Lookup the point mesh + const pointMesh& pMesh = mesh.lookupObject("pointMesh"); + + // Cell-centres coordinates + const volVectorField& C = mesh.C(); + const vectorField& CI = C; + + // Point coordinates + const pointField& points = mesh.points(); + + if (gMin(mag(points)) < -SMALL) + { + FatalErrorIn + ( + "bool Foam::sphericalCavityAnalyticalSolution::writeData()" + ) << "The cavity should be centred on the origin!" << endl + << "gMin(mag(points)) = " << gMin(mag(points)) + << abort(FatalError); + } + + // Cell analytical fields + if (cellDisplacement_ || cellStress_) + { + // Analytical stress field + volSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalCellStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero), + "calculated" + ); + + // Analytical displacement field + volVectorField analyticalD + ( + IOobject + ( + "analyticalD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimLength, vector::zero), + "calculated" + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, cellI) + { + if (cellStress_) + { + sI[cellI] = + sphericalCavityStress(T0_, nu_, cavityR_, CI[cellI]); + } + + if (cellDisplacement_) + { + aDI[cellI] = + sphericalCavityDisplacement + ( + nu_, T0_, E_, cavityR_, CI[cellI] + ); + } + } + + forAll(analyticalStress.boundaryField(), patchI) + { + if (mesh.boundary()[patchI].type() != "empty") + { + symmTensorField& sP = boundaryFieldRef(analyticalStress)[patchI]; + vectorField& aDP = boundaryFieldRef(analyticalD)[patchI]; + const vectorField& CP = C.boundaryField()[patchI]; + + forAll(sP, faceI) + { + if (cellStress_) + { + sP[faceI] = + sphericalCavityStress + ( + T0_, nu_, cavityR_, CP[faceI] + ); + } + + if (cellDisplacement_) + { + aDP[faceI] = + sphericalCavityDisplacement + ( + nu_, T0_, E_, cavityR_, CP[faceI] + ); + } + } + } + } + + // Write out the cell analytical field + if (cellStress_) + { + Info<< "Writing analyticalCellStress field" + << nl << endl; + analyticalStress.write(); + + // Calculate and write the equivalent (von Mises) stress + Info<< "Writing analyticalCellStressEq field" + << nl << endl; + volScalarField analyticalStressEq + ( + IOobject + ( + "analyticalCellStressEq", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(analyticalStress))) + ); + analyticalStressEq.write(); + } + + if (cellDisplacement_) + { + Info<< "Writing analyticalD field" + << nl << endl; + analyticalD.write(); + } + + + if (cellStress_ && mesh.foundObject("sigma")) + { + const volSymmTensorField& sigma = + mesh.lookupObject("sigma"); + + const volSymmTensorField diff + ( + "cellStressDifference", analyticalStress - sigma + ); + Info<< "Writing cellStressDifference field" << endl; + diff.write(); + + if (Pstream::master()) + { + historyFilePtr_() + << time_.time().value(); + } + + for (int cmpt = 0; cmpt < pTraits::nComponents; cmpt++) + { + const symmTensorField& diffI = diff; + const scalarField diffIcmptI(diffI.component(cmpt)); + const scalar l1 = gAverage(mag(diffIcmptI)); + const scalar l2 = Foam::sqrt(gAverage(magSqr(diffIcmptI))); + const scalar lInf = gMax(mag(diffIcmptI)); + + Info<< " Component: " << cmpt << endl; + Info<< " Norms: mean L1, mean L2, LInf: " << nl + << " " << l1 + << " " << l2 + << " " << lInf + << nl << endl; + + if (Pstream::master()) + { + historyFilePtr_() + << " " << l1 << " " << l2 << " " << lInf; + } + } + + if (Pstream::master()) + { + historyFilePtr_() + << endl; + } + } + + if (cellDisplacement_ && mesh.foundObject("D")) + { + const volVectorField& D = + mesh.lookupObject("D"); + + const volVectorField diff + ( + "DDifference", analyticalD - D + ); + Info<< "Writing DDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff; + Info<< " Norms: mean L1, mean L2, LInf: " << nl + << " " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << nl << endl; + } + } + + // Point analytical fields + if (pointDisplacement_ || pointStress_) + { + pointSymmTensorField analyticalStress + ( + IOobject + ( + "analyticalPointStress", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedSymmTensor("zero", dimPressure, symmTensor::zero) + ); + + pointVectorField analyticalD + ( + IOobject + ( + "analyticalPointD", + time_.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero) + ); + + symmTensorField& sI = analyticalStress; + vectorField& aDI = analyticalD; + + forAll(sI, pointI) + { + if (pointStress_) + { + sI[pointI] = + sphericalCavityStress(T0_, nu_, cavityR_, points[pointI]); + } + + if (pointDisplacement_) + { + aDI[pointI] = + sphericalCavityDisplacement + ( + nu_, T0_, E_, cavityR_, points[pointI] + ); + } + } + + // Write point analytical fields + if (pointStress_) + { + Info<< "Writing analyticalPointStress" + << nl << endl; + analyticalStress.write(); + } + + if (pointDisplacement_) + { + Info<< "Writing analyticalPointDisplacement" + << nl << endl; + analyticalD.write(); + } + + if + ( + pointDisplacement_ + && mesh.foundObject("pointD") + ) + { + const pointVectorField& pointD = + mesh.lookupObject("pointD"); + + const pointVectorField diff + ( + "pointDDifference", analyticalD - pointD + ); + Info<< "Writing pointDDifference field" << endl; + diff.write(); + + const vectorField& diffI = diff; + Info<< " Norms: mean L1, mean L2, LInf: " << nl + << " " << gAverage(mag(diffI)) + << " " << Foam::sqrt(gAverage(magSqr(diffI))) + << " " << gMax(mag(diffI)) + << nl << endl; + } + } + + return true; +} + +//** * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sphericalCavityAnalyticalSolution::sphericalCavityAnalyticalSolution +( + const word& name, + const Time& t, + const dictionary& dict +) +: + functionObject(name), + name_(name), + time_(t), + cellDisplacement_ + ( + dict.lookupOrDefault("cellDisplacement", true) + ), + pointDisplacement_ + ( + dict.lookupOrDefault("pointDisplacement", true) + ), + cellStress_ + ( + dict.lookupOrDefault("cellStress", true) + ), + pointStress_ + ( + dict.lookupOrDefault("pointStress", true) + ), + historyFilePtr_(), + T0_(readScalar(dict.lookup("farFieldTractionZ"))), + cavityR_(readScalar(dict.lookup("cavityRadius"))), + E_(readScalar(dict.lookup("E"))), + nu_(readScalar(dict.lookup("nu"))) +{ + Info<< "Creating " << this->name() << " function object" << endl; + + if (cavityR_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "cavityRadius should be greater than 0!" + << abort(FatalError); + } + + if (E_ < SMALL || nu_ < SMALL) + { + FatalErrorIn(this->name() + " function object constructor") + << "E and nu should be positive!" + << abort(FatalError); + } + + // Create history file if not already created + if (historyFilePtr_.empty()) + { + // File update + if (Pstream::master()) + { + fileName historyDir; + + word startTimeName = + time_.timeName(time_.startTime().value()); + + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + historyDir = time_.path()/".."/"postProcessing"/startTimeName; + } + else + { + historyDir = time_.path()/"postProcessing"/startTimeName; + } + + // Create directory if does not exist. + mkDir(historyDir); + + // Open new file at start up + OStringStream FileName; + FileName() + << "sphericalCavityStressErrors.dat"; + + historyFilePtr_.reset + ( + new OFstream(historyDir/word(FileName.str())) + ); + + // Add headers to output data + if (historyFilePtr_.valid()) + { + historyFilePtr_() + << "# Time" << " " + << "Stress Errors (l1, l2, lInfinity) for each component " + << "(XX XY XZ YY YZ ZZ)" << endl; + } + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::sphericalCavityAnalyticalSolution::start() +{ + return true; +} + + +#if FOAMEXTEND + bool Foam::sphericalCavityAnalyticalSolution::execute(const bool forceWrite) +#else + bool Foam::sphericalCavityAnalyticalSolution::execute() +#endif +{ + return writeData(); +} + + +bool Foam::sphericalCavityAnalyticalSolution::read(const dictionary& dict) +{ + return true; +} + + +#ifdef OPENFOAM_NOT_EXTEND +bool Foam::sphericalCavityAnalyticalSolution::write() +{ + return false; +} +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H new file mode 100644 index 0000000..2bda22d --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H @@ -0,0 +1,192 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + sphericalCavityAnalyticalSolution + +Description + FunctionObject that generates the analytical displacement and stress fields + for the spherical cavity (radius = a) in an infinite linear elastic solid + (Young's modulus of E and Poisson's ration of nu) subjected to a distant + uniaxial stress T0 applied in the positive Z direction. + + The analytical solution requires the following inputs: + - farFieldTractionZ : far-field traction in the positive Z direction + - cavityRadius : radius of the cavity centred on the origin + - E : Young's modulus + - nu : Poisson's ratio + + The analytical solution for stress is taken from: + + R.V. Southwell M.A. F.R.S. & H.J. Gough M.B.E. B.Sc. (1926) VI. On the + concentration of stress in the neighbourhood of a small spherical flaw; + and on the propagation of fatigue fractures in “Statistically Isotropic” + materials , The London, Edinburgh, and Dublin Philosophical Magazine and + Journal of Science: Series 7, 1:1, 71-97, DOI: 10.1080/14786442608633614 + + The analytical solution for displacement is taken from: + + Allan F. Bower (2009) Applied Mechanics of Solids, CRC Press, Taylor and + Francis Group. + + Note: Bower also gives the stress solutions but they seem to have errors + as the axial (zz) stress formula does not provide the correct stress + concentration factor at the edge of the cavity. + +Author + Philip Cardiff, UCD. + +SourceFiles + sphericalCavityAnalyticalSolution.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sphericalCavityAnalyticalSolution_H +#define sphericalCavityAnalyticalSolution_H + +#include "functionObject.H" +#include "dictionary.H" +#include "fvMesh.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class sphericalCavityAnalyticalSolution Declaration +\*---------------------------------------------------------------------------*/ + +class sphericalCavityAnalyticalSolution +: + public functionObject +{ + // Private data + + //- Name + const word name_; + + //- Reference to main object registry + const Time& time_; + + //- Calculate cell displacement fields + const Switch cellDisplacement_; + + //- Calculate point displacement fields + const Switch pointDisplacement_; + + //- Calculate cell stress fields + const Switch cellStress_; + + //- Calculate point stress fields + const Switch pointStress_; + + //- Optional history file for writing the errors + autoPtr historyFilePtr_; + + //- Far field traction + // It is assumed that it acts in the positive Z direction + const scalar T0_; + + //- Cavity radius + const scalar cavityR_; + + //- Young's modulus + const scalar E_; + + //- Poisson's ratio + const scalar nu_; + + + // Private Member Functions + + //- Write data + bool writeData(); + + //- Disallow default bitwise copy construct + sphericalCavityAnalyticalSolution + ( + const sphericalCavityAnalyticalSolution& + ); + + //- Disallow default bitwise assignment + void operator=(const sphericalCavityAnalyticalSolution&); + + +public: + + //- Runtime type information + TypeName("sphericalCavityAnalyticalSolution"); + + + // Constructors + + //- Construct from components + sphericalCavityAnalyticalSolution + ( + const word& name, + const Time&, + const dictionary& + ); + + + // Member Functions + + //- start is called at the start of the time-loop + virtual bool start(); + + //- execute is called at each ++ or += of the time-loop +#if FOAMEXTEND + virtual bool execute(const bool forceWrite); +#else + virtual bool execute(); +#endif + + //- Called when time was set at the end of the Time::operator++ + virtual bool timeSet() + { + return true; + } + + //- Read and set the function object if its data has changed + virtual bool read(const dictionary& dict); + +#ifdef OPENFOAM_NOT_EXTEND + //- Write + virtual bool write(); +#else + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +#endif +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.C new file mode 100644 index 0000000..415b7db --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.C @@ -0,0 +1,209 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*----------------------------------------------------------------------------*/ + +#include "sphericalCavityStressDisplacement.H" +#include "coordinateSystem.H" +#include "transform.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::scalar Foam::KroneckerDelta(const int i, const int j) +{ + return (i == j) ? 1.0 : 0.0; +} + +Foam::scalar Foam::sphericalCavityDisplacementComponent +( + const int i, + const scalar nu, + const scalar sigma_0, + const scalar E, + const scalar a, + const vector& x +) +{ + const scalar R = mag(x); + const scalar x_3 = x[vector::Z]; + + const scalar term1 = + 2 + + (5*(5 - 4*nu)*pow(a, 3))/((7 - 5*nu)*pow(R, 3)) + + (6*pow(a, 5))/((7 - 5*nu)*pow(R, 5)); + const scalar term2 = + (-2*nu)/(1 + nu) + + (5*nu - 6)*pow(a, 3)/((7 - 5*nu)*pow(R, 3)) + + 3*pow(a, 5)/((7 - 5*nu)*pow(R, 5)); + const scalar common_factor = (1 + nu)*sigma_0/(2*E); + + return + common_factor + *( + term1*x_3*KroneckerDelta(i, 2) + + term2*x[i]*(1 - 5*pow(x_3, 2)/pow(R, 2)) + ); +} + + +Foam::vector Foam::sphericalCavityDisplacement +( + const scalar nu, + const scalar T, + const scalar E, + const scalar a, + const vector& x +) +{ + // Bower 2009 approach - not correct + // vector disp = vector::zero; + // for (int i = 0; i < 3; ++i) + // { + // disp[i] = + // sphericalCavityDisplacementComponent(i, nu, T, E, a, x); + // } + + // Goodier 1933 + + // Shear modulus + const scalar mu = E/(2*(1 + nu)); + + // Constants for a spherical cavity + const scalar A = -pow3(a)*(T/(8*mu))*(13 - 10*nu)/(7 - 5*nu); + const scalar B = pow5(a)*(T/(8*mu))*(1/(7 - 5*nu)); + const scalar C = pow3(a)*(T/(8*mu))*((5*(1 - 2*nu))/(7 - 5*nu)); + + // Calculate the spherical polar coordinates + const scalar r = mag(x); + if (r < SMALL) + { + FatalError + << "r is less than SMALL. " + << "Are you sure the cavity is centred on the origin?" + << abort(FatalError); + } + const scalar theta = Foam::acos(x.z()/r); + const scalar phi = Foam::atan2(x.y(), x.x()); + + // Radial displacement + const scalar ur = + - A/sqr(r) - 3*B/pow4(r) + + ( + ((5 - 4*nu)/(1 - 2*nu))*C/sqr(r) - 9*B/pow4(r) + )*cos(2*theta); + + // Theta displacement + const scalar utheta = -(2*C/sqr(r) + 6*B/pow4(r))*sin(2*theta); + + // Spherical polar displacement vector (r, theta, phi) + const vector dispPolar(ur, utheta, 0); + + // Calculate the Cartesian displacement vector + const vector dispCart + ( + ur*sin(theta)*cos(phi) + utheta*cos(theta)*cos(phi), + ur*sin(theta)*sin(phi) + utheta*cos(theta)*sin(phi), + ur*cos(theta) - utheta*sin(theta) + ); + + // Calculate the displacement field called by a uniform uniaxial T when + // there is no cavity + const vector dispUni(-nu*T*x.x()/E, -nu*T*x.y()/E, T*x.z()/E); + + // Return the total Cartesian displacement vector + return dispCart + dispUni; +} + + +Foam::symmTensor Foam::sphericalCavityStress +( + const scalar T, + const scalar nu, + const scalar a, + const vector& x +) +{ + // Stress formulae from Southwell et al, 1926, On the concentration of + // stress in the neighbourhood of a small spherical flaw; and on the + // propagation of fatigue fractures in Statistically Isotropic materials + + // Polar radial coordinate + // Take care: in general, R != r + const scalar R = mag(x); + + // Cylindrical radial coordinate + const scalar r = sqrt(sqr(x.x()) + sqr(x.y())); + + // Cylindrical axial coordinate + const scalar z = x.z(); + + // Initialise stress tensor + // We will place rr in xx, thetaTheta in yy, zz in zz, and zr in xz + // We will late rotate this stress tensor to the Cartesian coordinate system + symmTensor sigmaCylindrical = symmTensor::zero; + + // Radial (rr) component + sigmaCylindrical.xx() = + (T/(14 - 10*nu))*(pow3(a)/pow3(R)) + *( + 9 - 15*nu - 12*(sqr(a)/sqr(R)) + - (sqr(r)/sqr(R))*(72 - 15*nu - 105*(sqr(a)/sqr(R))) + + 15*(pow4(r)/pow4(R))*(5 - 7*(sqr(a)/sqr(R))) + ); + + // Hoop (thetaTheta) component + sigmaCylindrical.yy() = + (T/(14 - 10*nu))*(pow3(a)/pow3(R)) + *( + 9 - 15*nu - 12*(sqr(a)/sqr(R)) + - 15*(sqr(r)/sqr(R))*(1 - 2*nu - (sqr(a)/sqr(R))) + ); + + // Axial (zz) component + sigmaCylindrical.zz() = + T + *( + 1 + - (1/(14 - 10*nu))*(pow3(a)/pow3(R)) + *( + 38 - 10*nu - 24*sqr(a)/sqr(R) + - (sqr(r)/sqr(R))*(117 - 15*nu - 120*sqr(a)/sqr(R)) + + 15*(pow4(r)/pow4(R))*(5 - 7*sqr(a)/sqr(R)) + ) + ); + + // Radial-axial shear (rz) component + sigmaCylindrical.xz() = + (T/(14 - 10*nu))*(pow3(a)*z*r/pow5(R)) + *( + - 3*(19 - 5*nu) + 60*(sqr(a)/sqr(R)) + + 15*(sqr(r)/sqr(R))*(5 - 7*(sqr(a)/sqr(R))) + ); + + // Rotate the cylindrical stress to Cartesian coordinates + const coordinateSystem cs("cylindrical", x, vector(0, 0, 1), x/mag(x)); +#ifdef OPENFOAM_COM + const symmTensor sigmaCartesian = transform(cs.R(), sigmaCylindrical); +#else + const symmTensor sigmaCartesian = transform(cs.R().R(), sigmaCylindrical); +#endif + + return sigmaCartesian; +} + + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.H b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.H new file mode 100644 index 0000000..8139c57 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityStressDisplacement.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Functions + sphericalCavityStressDisplacement + +Description + Functions that generates the analytical displacement and stress fields + for the spherical cavity (radius = a) in an infinite linear elastic solid + (Young's modulus of E and Poisson's ration of nu) subjected to a distant + uniaxial stress T0 applied in the positive Z direction. + + The analytical solution requires the following inputs: + - farFieldTractionZ : far-field traction in the positive Z direction + - cavityRadius : radius of the cavity centred on the origin + - E : Young's modulus + - nu : Poisson's ratio + + The analytical solution for stress is taken from: + + R.V. Southwell M.A. F.R.S. & H.J. Gough M.B.E. B.Sc. (1926) VI. On the + concentration of stress in the neighbourhood of a small spherical flaw; + and on the propagation of fatigue fractures in “Statistically Isotropic” + materials , The London, Edinburgh, and Dublin Philosophical Magazine and + Journal of Science: Series 7, 1:1, 71-97, DOI: 10.1080/14786442608633614 + + The analytical solution for displacement is taken from: + + Allan F. Bower (2009) Applied Mechanics of Solids, CRC Press, Taylor and + Francis Group. + + Note: Bower also gives the stress solutions but they seem to have errors + as the axial (zz) stress formula does not provide the correct stress + concentration factor at the edge of the cavity. + +Author + Philip Cardiff, UCD. + +SourceFiles + sphericalCavityStressDisplacement.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sphericalCavityStressDisplacement_H +#define sphericalCavityStressDisplacement_H + +#include "vector.H" +#include "symmTensor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + //- Kronecker delta function + scalar KroneckerDelta + ( + const int i, const int j + ); + + //- Calculate the displacement component i at a coordinate x + // From Bower (2009) + scalar sphericalCavityDisplacementComponent + ( + const int i, + const scalar nu, + const scalar sigma_0, + const scalar E, + const scalar a, + const vector& x + ); + + //- Calculate the displacement vector at a coordinate x + // From Bower (2009) + vector sphericalCavityDisplacement + ( + const scalar nu, + const scalar sigma_0, + const scalar E, + const scalar a, + const vector& x + ); + + //- Calculate the stress at point x + // From Southwell (1926) + symmTensor sphericalCavityStress + ( + const scalar T, // distant ZZ stress + const scalar nu, // Poisson's ratio + const scalar a, // Sphere radius + const vector& x // Position + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 6b25186bb12ed56cfe41f593bdca6b50ff9667d2 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Sun, 2 Aug 2026 23:35:45 +0200 Subject: [PATCH 19/23] removed sphericalCavity redundand files --- .../sphericalCavity/sphericalCavity/Allwmake | 42 ---- .../sphericalCavity/Make/files | 3 - .../sphericalCavity/Make/options | 12 - ...icalCavityDisplacementFvPatchVectorField.C | 213 ------------------ ...icalCavityDisplacementFvPatchVectorField.H | 176 --------------- 5 files changed, 446 deletions(-) delete mode 100755 papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Allwmake delete mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/files delete mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/options delete mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.C delete mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.H diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Allwmake b/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Allwmake deleted file mode 100755 index 5a57e73..0000000 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Allwmake +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -cd "${0%/*}" || exit # Run from this directory - -# Stop at first error -set -e - -# Check if OpenFOAM/FOAM has been sourced -if [[ -z "${WM_PROJECT}" ]] -then - echo "Please source the OpenFOAM/FOAM bashrc first!" - exit 1 -fi - -# Check if the solids4foam installation directory has been set -if [[ -z "${SOLIDS4FOAM_DIR}" ]] -then - echo "Please set SOLIDS4FOAM_DIR, e.g." - echo " export SOLIDS4FOAM_DIR=/Users/philipc/OpenFOAM/philipc-v2312/solids4foam" - exit 1 -fi - -# Compile library -wmake $* libso 2>&1 | tee log.wmake - -# Check if the build succeeded -echo "Checking if the installation was a success:" -N_ERRORS_1=$(find . -name log.wmake | xargs grep " Error " | wc -l) -N_ERRORS_2=$(find . -name log.wmake | xargs grep " Stop." | wc -l) -if [[ $N_ERRORS_1 -gt 0 ]] || [[ $N_ERRORS_2 -gt 0 ]] -then - echo "** BUILD ERROR **" - echo "There were build errors in the following logs:" - echo $(find . -name log.wmake | xargs grep -l " Error ") - echo $(find . -name log.wmake | xargs grep -l " Stop.") - echo; echo "Please examine these logs for additional details"; echo - exit 1 -else - echo "There were no build errors: enjoy!"; echo -fi -echo - -#------------------------------------------------------------------------------ diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/files b/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/files deleted file mode 100644 index fde6d5d..0000000 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -analyticalSphericalCavityDisplacementFvPatchVectorField.C - -LIB = $(FOAM_USER_LIBBIN)/libsphericalCavity diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/options b/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/options deleted file mode 100644 index c5b1801..0000000 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/Make/options +++ /dev/null @@ -1,12 +0,0 @@ -sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options -sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options - -EXE_INC = \ - $(VERSION_SPECIFIC_INC) \ - -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.C deleted file mode 100644 index b0e38ff..0000000 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.C +++ /dev/null @@ -1,213 +0,0 @@ -/*---------------------------------------------------------------------------*\ -License - This file is part of solids4foam. - - solids4foam is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - solids4foam is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solids4foam. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "analyticalSphericalCavityDisplacementFvPatchVectorField.H" -#include "addToRunTimeSelectionTable.H" -#include "sphericalCavityStressDisplacement.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -analyticalSphericalCavityDisplacementFvPatchVectorField:: -analyticalSphericalCavityDisplacementFvPatchVectorField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedDisplacementFvPatchVectorField(p, iF), - T0_(0.0), - cavityR_(0.0), - nu_(0.0), - E_(0.0), - dict_() -{} - - -analyticalSphericalCavityDisplacementFvPatchVectorField:: -analyticalSphericalCavityDisplacementFvPatchVectorField -( - const analyticalSphericalCavityDisplacementFvPatchVectorField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedDisplacementFvPatchVectorField(ptf, p, iF, mapper), - T0_(ptf.T0_), - cavityR_(ptf.cavityR_), - nu_(ptf.nu_), - E_(ptf.E_), - dict_(ptf.dict_) -{} - - -analyticalSphericalCavityDisplacementFvPatchVectorField:: -analyticalSphericalCavityDisplacementFvPatchVectorField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedDisplacementFvPatchVectorField(p, iF, dict), - T0_(readScalar(dict.lookup("farFieldTractionZ"))), - cavityR_(readScalar(dict.lookup("cavityRadius"))), - nu_(readScalar(dict.lookup("nu"))), - E_(readScalar(dict.lookup("E"))), - dict_(dict) -{} - -#ifndef OPENFOAM_ORG -analyticalSphericalCavityDisplacementFvPatchVectorField:: -analyticalSphericalCavityDisplacementFvPatchVectorField -( - const analyticalSphericalCavityDisplacementFvPatchVectorField& pivpvf -) -: - fixedDisplacementFvPatchVectorField(pivpvf), - T0_(pivpvf.T0_), - cavityR_(pivpvf.cavityR_), - nu_(pivpvf.nu_), - E_(pivpvf.E_), - dict_(pivpvf.dict_) -{} -#endif - -analyticalSphericalCavityDisplacementFvPatchVectorField:: -analyticalSphericalCavityDisplacementFvPatchVectorField -( - const analyticalSphericalCavityDisplacementFvPatchVectorField& pivpvf, - const DimensionedField& iF -) -: - fixedDisplacementFvPatchVectorField(pivpvf, iF), - T0_(pivpvf.T0_), - cavityR_(pivpvf.cavityR_), - nu_(pivpvf.nu_), - E_(pivpvf.E_), - dict_(pivpvf.dict_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -void analyticalSphericalCavityDisplacementFvPatchVectorField::updateCoeffs() -{ - if (this->updated()) - { - return; - } - - // Set the displacement at each patch face - vectorField& disp = totalDisp(); - const vectorField& Cf = patch().Cf(); - forAll(disp, faceI) - { - disp[faceI] = - sphericalCavityDisplacement - ( - nu_, - T0_, - E_, - cavityR_, - Cf[faceI] - ); - } - - fixedDisplacementFvPatchVectorField::updateCoeffs(); -} - - -autoPtr> -analyticalSphericalCavityDisplacementFvPatchVectorField::evaluateQuadrature -( - const CompactListList& faceQuadPoints -) const -{ - // faceQuadPoints is list for whole mesh. - labelList nQpPerFace(this->size(), 0); - const label start = this->patch().start(); - forAll(nQpPerFace, faceI) - { - const label globalFaceID = faceI + start; - nQpPerFace[faceI]=faceQuadPoints[globalFaceID].size(); - } - - autoPtr> tQuadPointsValue - ( - new CompactListList(nQpPerFace) - ); - - // Get a reference to the actual data for easier access - CompactListList& quadPointsValue = tQuadPointsValue(); - - // Loop over faces - forAll(*this, faceI) - { - const label globalFaceID = faceI + start; - - // Get the number of quadrature points for this face - const label nPoints = faceQuadPoints[globalFaceID].size(); - - // Assign the values to face quadrature points - for (label pointI = 0; pointI < nPoints; ++pointI) - { - const point quadPoint = faceQuadPoints[globalFaceID][pointI]; - quadPointsValue[faceI][pointI] = - sphericalCavityDisplacement - ( - nu_, - T0_, - E_, - cavityR_, - quadPoint - ); - } - } - - return tQuadPointsValue; -} - - -void analyticalSphericalCavityDisplacementFvPatchVectorField:: -write(Ostream& os) const -{ - fixedDisplacementFvPatchVectorField::write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchVectorField, - analyticalSphericalCavityDisplacementFvPatchVectorField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.H deleted file mode 100644 index 54c3a0d..0000000 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/sphericalCavity/analyticalSphericalCavityDisplacementFvPatchVectorField.H +++ /dev/null @@ -1,176 +0,0 @@ -/*---------------------------------------------------------------------------*\ -License - This file is part of solids4foam. - - solids4foam is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - solids4foam is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solids4foam. If not, see . - -Class - Foam::analyticalSphericalCavityDisplacementFvPatchVectorField - -Description - Traction boundary condition for a spherical cavity in an infinite elastic - medium subjected to a distant stress test case to enforce analytical - tractions at the boundaries. - -Author - Philip Cardiff, UCD. - Ivan Batistic, UCD. - -SourceFiles - analyticalSphericalCavityDisplacementFvPatchVectorField.C - -Author - Philip Cardiff, UCD. All rights reserved. - -\*---------------------------------------------------------------------------*/ - -#ifndef analyticalSphericalCavityDisplacementFvPatchVectorField_H -#define analyticalSphericalCavityDisplacementFvPatchVectorField_H - -#include "fixedDisplacementFvPatchVectorField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class analyticalSphericalCavityDisplacementFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -class analyticalSphericalCavityDisplacementFvPatchVectorField -: - public fixedDisplacementFvPatchVectorField -{ - // Private Data - - //- Far field traction - // It is assumed that it acts in the positive Z direction - const scalar T0_; - - //- Hole radius - const scalar cavityR_; - - //- Poisson's ration - const scalar nu_; - - //- Young modulus - const scalar E_; - - //- A copy of the constructor dict - const dictionary dict_; - - -public: - - //- Runtime type information - TypeName("analyticalSphericalCavityDisplacement"); - - - // Constructors - - //- Construct from patch and internal field - analyticalSphericalCavityDisplacementFvPatchVectorField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - analyticalSphericalCavityDisplacementFvPatchVectorField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given analyticalSphericalCavityDisplacementFvPatchVectorField - // onto a new patch - analyticalSphericalCavityDisplacementFvPatchVectorField - ( - const analyticalSphericalCavityDisplacementFvPatchVectorField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - analyticalSphericalCavityDisplacementFvPatchVectorField - ( - const analyticalSphericalCavityDisplacementFvPatchVectorField& -#ifdef OPENFOAM_ORG - ) = delete; -#else - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new analyticalSphericalCavityDisplacementFvPatchVectorField(*this) - ); - } -#endif - - //- Construct as copy setting internal field reference - analyticalSphericalCavityDisplacementFvPatchVectorField - ( - const analyticalSphericalCavityDisplacementFvPatchVectorField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new analyticalSphericalCavityDisplacementFvPatchVectorField(*this, iF) - ); - } - - - - // Member functions - - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Return face quadrature values. - // Used for high order solvers, input is position of points - virtual autoPtr> evaluateQuadrature - ( - const CompactListList& faceQuadPoints - ) const; - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From 76efaf56dfb2149590d3eb7a0208d04409c5b375 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Mon, 3 Aug 2026 01:23:06 +0200 Subject: [PATCH 20/23] fix for Allrun paralle --- .../sphericalCavity/Allrun.parallelScaling | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling index 6f7a91e..6b28e38 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.parallelScaling @@ -14,8 +14,8 @@ export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../solids4f # Defaults can be overridden, e.g. # MESHES="3 4 5" NP_LIST="1 2 4 8" ./Allrun.parallelScaling -MESHES="${MESHES:-4}" -NP_LIST="${NP_LIST:-1 2 3}" +MESHES="${MESHES:-4 5 6}" +NP_LIST="${NP_LIST:-1 2 4 6 8 12}" MESH_FAMILIES="${MESH_FAMILIES:-tet}" set -- ${NP_LIST} @@ -103,6 +103,23 @@ calcEfficiency() 'BEGIN { if (sp > 0 && np > 0) printf "%.6g", sp/np; else printf "NaN" }' } +copyCase() +{ + local source="$1" + local target="$2" + local brokenLinks + + cp -aL "${source}" "${target}" + + brokenLinks=$(find "${target}" -xtype l -print) + if [ -n "${brokenLinks}" ] + then + echo "Broken symbolic links remain in ${target}:" + echo "${brokenLinks}" + exit 1 + fi +} + # Compile projectPointsToSphere cd projectPointsToSphere wclean @@ -148,7 +165,7 @@ do MESH_CASE="${NAME}.${i}.mesh" echo; echo "Preparing mesh case: ${MESH_CASE}" - cp -r "../${BASE}" "${MESH_CASE}" + copyCase "../${BASE}" "${MESH_CASE}" cd "${MESH_CASE}" if command -v gmsh &> /dev/null @@ -213,7 +230,7 @@ do CASE="${NAME}.${i}.np${nProc}" echo; echo "Processing case: ${CASE}" - cp -r "${MESH_CASE}" "${CASE}" + copyCase "${MESH_CASE}" "${CASE}" cd "${CASE}" STATUS="OK" From 130eb656212ba528915bceccf7a81e53070d7c65 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Fri, 21 Aug 2026 18:21:14 +0200 Subject: [PATCH 21/23] Updated mixed MMS 2D for kExact framework --- .../manufacturedSolution/mixed/Allrun | 50 ++-- .../manufacturedSolution/mixed/Allrun.kExact | 241 ++++++++++++++++++ .../base/highOrder/constant/solidProperties | 4 +- .../mixed/base/highOrder/petscOptions.ksponly | 97 ------- .../mixed/base/highOrder/petscOptions.lu | 57 ----- .../mixed/base/highOrder/solidProperties | 54 ---- .../mixed/base/snes/system/fvSolution | 25 +- .../dispErrors_movingVskExact.gnuplot | 137 ++++++++++ .../stressErrors_movingVskExact.gnuplot | 137 ++++++++++ .../{manufacturedSolution => src}/Allwmake | 0 .../{manufacturedSolution => src}/Make/files | 0 .../Make/options | 0 .../manufacturedSolution.C | 4 +- .../manufacturedSolution.H | 0 .../manufacturedSolutionFunctionObject.C | 74 +++++- .../manufacturedSolutionFunctionObject.H | 8 + .../manufacturedSolutionFvPatchVectorField.C | 2 +- .../manufacturedSolutionFvPatchVectorField.H | 0 .../manufacturedSolutionSource.C | 0 .../manufacturedSolutionSource.H | 0 .../manufacturedSolution/polynomial/Allrun | 2 +- .../manufacturedSolution.C | 2 +- 22 files changed, 653 insertions(+), 241 deletions(-) create mode 100755 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun.kExact delete mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly delete mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu delete mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/Make/files (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/Make/options (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolution.C (98%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolution.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.C (76%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.H (94%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.C (98%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionSource.C (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/{manufacturedSolution => src}/manufacturedSolutionSource.H (100%) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun index b1ff03f..68e7c06 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun @@ -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 manucafturedSolution library -(cd manufacturedSolution && wclean libso && ./Allwmake -j -s) +(cd src && wclean libso && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -25,21 +25,21 @@ configs=( # "BASE=base/segregated NAME=tet.unstruct_v1.seg GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=tet.unstruct_v2.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0" - "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" - "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true PETSC_FILE=petscOptions.lu" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 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 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 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 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 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 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=movingLeastSquares" ) # SNES segregated approach @@ -82,7 +82,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 polyOrder extraCells HOJAC HORES TYPE # Parse the configuration string eval $config @@ -132,21 +132,21 @@ do 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 in the LRECoeffs + # Update the order if [ -n "${polyOrder}" ]; then sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties fi - # Update number of stencil cells in the LRECoeffs + # Update number of stencil cells in stencil if [ -n "${extraCells}" ]; then sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties fi + # Update least-squares reconstruction 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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun.kExact new file mode 100755 index 0000000..3c49cf8 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/Allrun.kExact @@ -0,0 +1,241 @@ +#!/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 manucafturedSolution library +(cd src && wclean libso && ./Allwmake -j -s) + +# 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/snes NAME=tet.struct.hypre-snes GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=tet.unstruct_v1.hypre-snes GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=tet.unstruct_v2.hypre-snes GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + # "BASE=base/snes NAME=poly.struct.hypre-snes GMSH_FILE=poly-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_v1.seg GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0" + # "BASE=base/segregated NAME=tet.unstruct_v2.seg GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0" + # "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 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 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 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 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 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 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N1 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N2 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v1.ho.N3 GMSH_FILE=tet-unstructured_v1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N1 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N2 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct_v2.ho.N3 GMSH_FILE=tet-unstructured_v2 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=poly-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 HOJAC=false HORES=true TYPE=kExactLeastSquares" +) + +# SNES segregated approach +# "BASE=base/snes NAME=hex.struct.hypre-snes-seg GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.seg.hypre" +# "BASE=base/snes NAME=tet.struct.hypre-snes-seg GMSH_FILE=tet-structured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.seg.hypre" +# "BASE=base/snes NAME=tet.unstruct.hypre-snes-seg GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.seg.hypre" + +# Define start and end mesh indices +# Mesh input files are defined from 1 to 32 +# END_MESH should be greater than START_MESH +START_MESH=1 +END_MESH=32 + + +# 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 polyOrder 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 + if [[ "$GMSH_FILE" == "poly-structured" ]] + then + # Special prcedure for generating polyhedral mesh + 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" + mv 0/ 0.tmp + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + solids4Foam::runApplication extrudeMesh + solids4Foam::runApplication createPatch -overwrite + mv 0.tmp/ 0 + else + # Other types of meshes + 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 + fi + + # Optional mesh distortion + if [ "$USE_PERTURBMESHPOINTS" -eq 1 ] + then + solids4Foam::runApplication perturbMeshPoints + fi + solids4Foam::runApplication checkMesh + + # Update the order + if [ -n "${polyOrder}" ]; then + sed -i "/^\s*polynomialOrder /s|^.*| polynomialOrder ${polyOrder};|" constant/solidProperties + fi + + # Update number of stencil cells in stencil + if [ -n "${extraCells}" ]; then + sed -i "/^\s*faceStencilExtraCells /s|^.*| faceStencilExtraCells ${extraCells};|" constant/solidProperties + fi + + # Update least-squares reconstruction 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 "Maximum 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 "Maximum 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 mpirun -np 1 solids4Foam &> log.solids4Foam + + else + 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 "Maximum resident" log.solids4Foam; then + MAX_MEMORY=$(grep "Maximum resident" log.solids4Foam | awk '{print int($6 / 1000)}') + else + MAX_MEMORY="NaN" + fi + + # Record the time + CLOCK_TIME=$(grep "ClockTime" log.solids4Foam | awk '{print $7}') + + # 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 + + mkdir dispErrorComparisonMatlab/ + mkdir stressErrorComparisonMatlab/ + mv mms_dispErrorsComparison* dispErrorComparisonMatlab/ + mv mms_stressErrorsComparison* stressErrorComparisonMatlab/ +fi + +echo; echo; echo "Done!"; echo +echo "View the PDF files in ${RUN_DIR}" +echo; echo $(date) +echo; echo diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties index 05c3502..6d839ba 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/constant/solidProperties @@ -22,9 +22,7 @@ solidModel linearGeometryTotalDisplacement; linearGeometryTotalDisplacementCoeffs { // Solution algorithm - //solutionAlgorithm implicitCoupled; solutionAlgorithm PETScSNES; - optionsFile petscOptions.ksponly; highOrderCoeffs { @@ -33,6 +31,8 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; + polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly deleted file mode 100644 index 8dcc792..0000000 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.ksponly +++ /dev/null @@ -1,97 +0,0 @@ -# # Nonlinear solver -# # The default line search may sometimes fail; in that case, switch to "basic" -# -snes_type newtonls -# -snes_linesearch_type basic -# -snes_rtol 1e-6 -# -snes_stol 1e-6 -# -snes_max_it 1000 -# -snes_monitor -# -snes_converged_reason - -# # Calculate the Jacobian using matrix-free finite differencing -# -snes_mf -# -snes_mf_operator - -# # Linear solver -# # Increase the restart (directions) if it is struggling to converged -# -ksp_type lgmres -# #-ksp_gmres_restart 100 -# #-ksp_rtol 1e-3 -# -ksp_monitor -# #-ksp_view -# -ksp_converged_reason - -# # Preconditioner - LU -# # Good for small/medium cases but will require large amounts of memory for -# # larger models -# -pc_type bjacobi -# -sub_pc_type lu - -# # Preconditioner - ILU -# # Less expensive than LU but not as good -# # Increasing the levels (fill-in) improves the preconditioning but is more -# # expensive -# #-pc_type asm -# #-sub_pc_type ilu -# #-sub_pc_factor_levels 1 - -# # Preconditioner - multigrid -# # Should perform better than LU for larger cases -# # -pc_type hypre -# # -pc_hypre_type boomeramg -# # -pc_hypre_boomeramg_max_iter 1 -# # #-pc_hypre_boomeramg_strong_threshold 0.25 -# # -pc_hypre_boomeramg_strong_threshold 0.7 -# # -pc_hypre_boomeramg_grid_sweeps_up 1 -# # -pc_hypre_boomeramg_grid_sweeps_down 1 -# # -pc_hypre_boomeramg_agg_nl 1 -# # -pc_hypre_boomeramg_agg_num_paths 1 -# # -pc_hypre_boomeramg_max_levels 25 -# # -pc_hypre_boomeramg_coarsen_type HMIS -# # -pc_hypre_boomeramg_interp_type ext+i -# # -pc_hypre_boomeramg_P_max 1 -# # -pc_hypre_boomeramg_truncfactor 0.3 - -# # Construct the precondioner once and store it since it does not change -# -snes_lag_preconditioner_persists true -# -snes_lag_preconditioner -2 - -# #-snes_test_jacobian -# #-snes_test_jacobian_view - - - --snes_type ksponly --snes_converged_reason - -# Linear solver --ksp_type lgmres --ksp_rtol 1e-8 --ksp_atol 0 --ksp_monitor --ksp_max_it 2000 --ksp_gmres_restart 100 -#-ksp_monitor_true_residual -#-ksp_converged_reason --ksp_error_if_not_converged -# (Avoid restarts at first; add -ksp_gmres_restart 200 only if memory becomes an issue) - -# Preconditioner - multigrid -# Should perform better than LU for larger cases --pc_type hypre --pc_hypre_type boomeramg --pc_hypre_boomeramg_max_iter 1 -#-pc_hypre_boomeramg_strong_threshold 0.25 --pc_hypre_boomeramg_strong_threshold 0.7 --pc_hypre_boomeramg_grid_sweeps_up 1 --pc_hypre_boomeramg_grid_sweeps_down 1 --pc_hypre_boomeramg_agg_nl 1 --pc_hypre_boomeramg_agg_num_paths 1 --pc_hypre_boomeramg_max_levels 25 --pc_hypre_boomeramg_coarsen_type HMIS --pc_hypre_boomeramg_interp_type ext+i --pc_hypre_boomeramg_P_max 1 --pc_hypre_boomeramg_truncfactor 0.3 - -#-pc_type bjacobi -#-sub_pc_type lu \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu deleted file mode 100644 index 34c0949..0000000 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/petscOptions.lu +++ /dev/null @@ -1,57 +0,0 @@ -# Nonlinear solver -# The default line search may sometimes fail; in that case, switch to "basic" --snes_type newtonls --snes_linesearch_type basic --snes_rtol 1e-6 --snes_stol 1e-6 --snes_max_it 1000 --snes_monitor --snes_converged_reason - -# Calculate the Jacobian using matrix-free finite differencing --snes_mf --snes_mf_operator - -# Linear solver -# Increase the restart (directions) if it is struggling to converged --ksp_type lgmres -#-ksp_gmres_restart 100 -#-ksp_rtol 1e-3 -#-ksp_monitor -#-ksp_view -#-ksp_converged_reason - -# Preconditioner - LU -# Good for small/medium cases but will require large amounts of memory for -# larger models --pc_type bjacobi --sub_pc_type lu - -# Preconditioner - ILU -# Less expensive than LU but not as good -# Increasing the levels (fill-in) improves the preconditioning but is more -# expensive -#-pc_type asm -#-sub_pc_type ilu -#-sub_pc_factor_levels 1 - -# Preconditioner - multigrid -# Should perform better than LU for larger cases -# -pc_type hypre -# -pc_hypre_type boomeramg -# -pc_hypre_boomeramg_max_iter 1 -# #-pc_hypre_boomeramg_strong_threshold 0.25 -# -pc_hypre_boomeramg_strong_threshold 0.7 -# -pc_hypre_boomeramg_grid_sweeps_up 1 -# -pc_hypre_boomeramg_grid_sweeps_down 1 -# -pc_hypre_boomeramg_agg_nl 1 -# -pc_hypre_boomeramg_agg_num_paths 1 -# -pc_hypre_boomeramg_max_levels 25 -# -pc_hypre_boomeramg_coarsen_type HMIS -# -pc_hypre_boomeramg_interp_type ext+i -# -pc_hypre_boomeramg_P_max 1 -# -pc_hypre_boomeramg_truncfactor 0.3 - -# Construct the precondioner once and store it since it does not change --snes_lag_preconditioner_persists true --snes_lag_preconditioner -2 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties deleted file mode 100644 index 2f5f021..0000000 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/highOrder/solidProperties +++ /dev/null @@ -1,54 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| solids4foam: solid mechanics and fluid-solid interaction simulations | -| Version: v2.0 | -| Web: https://solids4foam.github.io | -| Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, | -| producer and distributor of the OpenFOAM software via | -| www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® | -| trade marks. | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object solidProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -solidModel linearGeometryTotalDisplacement; - -linearGeometryTotalDisplacementCoeffs -{ - // Solution algorithm - //solutionAlgorithm implicitCoupled; - solutionAlgorithm PETScSNES; - optionsFile petscOptions.ksponly; - - highOrderCoeffs - { - highOrderJacobian false; - highOrderResidual true; - - LRECoeffs - { - N 1; - Nn 45; - weightFunction radiallySymmetricExponential; - k 6; - maxStencilSize 80; - useQRDecomposition true; - useGlobalStencils true; - calcConditionNumber false; - } - } - - stabilisation - { - type alpha; - scaleFactor 0.1; - } -} - -// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution index 6cfa2e8..5f49668 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/base/snes/system/fvSolution @@ -18,6 +18,29 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers -{} +{ + D + { + solver petsc; + + options + { + snes_type newtonls; + snes_monitor; + snes_converged_reason; + snes_mf; + snes_mf_operator; + + ksp_type lgmres; + ksp_gmres_restart "100"; + ksp_converged_reason; + + pc_type bjacobi; + sub_pc_type lu; + snes_lag_preconditioner_persists true; + snes_lag_preconditioner "-2"; + } + } +} // ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..2d5f489 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,137 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +set grid +set xrange [25:500] +set yrange [1e-7:1] +set xtics +set xtics add (5, 25, 50, 500) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in m)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 + +set output "mms_2D_dispErrors_hex_struct_movingVskExact.pdf" +plot \ + (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ + (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ + "hex.struct.ho.N1.summary.txt" u ((1/$4)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((1/$4)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((1/$4)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((1/$4)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((1/$4)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)" , \ + "hex.struct.ho.N3.summary.txt" u ((1/$4)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("hex.struct.ho.N1.summary.txt") u ((1/$4)**0.5*1e3):($5) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N1.summary.txt") u ((1/$4)**0.5*1e3):($6) w lp ls 112 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((1/$4)**0.5*1e3):($5) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((1/$4)**0.5*1e3):($6) w lp ls 122 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((1/$4)**0.5*1e3):($5) w lp ls 131 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((1/$4)**0.5*1e3):($6) w lp ls 132 notitle + +set output "mms_2D_dispErrors_ho-tet_struct_movingVskExact.pdf" +plot \ + (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ + (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ + "tet.struct.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 112 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 122 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 131 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 132 notitle + +set output "mms_2D_dispErrors_ho-tet_unstruct_v1_movingVskExact.pdf" +plot \ + (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ + (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ + "tet.unstruct_v1.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v1.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v1.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v1.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v1.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct_v1.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct_v1.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 111 notitle, \ + movingFile("tet.unstruct_v1.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 112 notitle, \ + movingFile("tet.unstruct_v1.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 121 notitle, \ + movingFile("tet.unstruct_v1.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 122 notitle, \ + movingFile("tet.unstruct_v1.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 131 notitle, \ + movingFile("tet.unstruct_v1.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 132 notitle + +set output "mms_2D_dispErrors_ho-tet_unstruct_v2_movingVskExact.pdf" +plot \ + (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ + (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ + "tet.unstruct_v2.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v2.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v2.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v2.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v2.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct_v2.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct_v2.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 111 notitle, \ + movingFile("tet.unstruct_v2.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 112 notitle, \ + movingFile("tet.unstruct_v2.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 121 notitle, \ + movingFile("tet.unstruct_v2.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 122 notitle, \ + movingFile("tet.unstruct_v2.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($5) w lp ls 131 notitle, \ + movingFile("tet.unstruct_v2.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($6) w lp ls 132 notitle + +set output "mms_2D_dispErrors_ho-poly_struct_movingVskExact.pdf" +plot \ + (3e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (0.15e-08 * x**3) w l ls 2 title "3^{rd} order", \ + (0.8e-12 * x**4) w l ls 3 title "4^{th} order", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("poly.struct.ho.N1.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N1.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 112 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 122 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($5) w lp ls 131 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($6) w lp ls 132 notitle diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..2493cdf --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,137 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c stressErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +set grid +set xrange [25:500] +set yrange [1e-5:5] +set xtics +set xtics add (5, 25, 50, 500) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in Pa)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 + +set output "mms_2D_stressErrors_hex_struct_movingVskExact.pdf" +plot \ + (5e-3 * x) w l ls 1 title "1^{st} order", \ + (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ + (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ + "hex.struct.ho.N1.summary.txt" u ((1/$4)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((1/$4)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((1/$4)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((1/$4)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((1/$4)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((1/$4)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("hex.struct.ho.N1.summary.txt") u ((1/$4)**0.5*1e3):($7) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N1.summary.txt") u ((1/$4)**0.5*1e3):($8) w lp ls 112 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((1/$4)**0.5*1e3):($7) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((1/$4)**0.5*1e3):($8) w lp ls 122 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((1/$4)**0.5*1e3):($7) w lp ls 131 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((1/$4)**0.5*1e3):($8) w lp ls 132 notitle + +set output "mms_2D_stressErrors_ho-tet_struct_movingVskExact.pdf" +plot \ + (5e-3 * x) w l ls 1 title "1^{st} order", \ + (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ + (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.struct.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 112 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 122 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 131 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 132 notitle + +set output "mms_2D_stressErrors_ho-tet_unstruct_v1_movingVskExact.pdf" +plot \ + (5e-3 * x) w l ls 1 title "1^{st} order", \ + (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ + (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.unstruct_v1.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v1.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v1.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v1.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v1.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct_v1.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct_v1.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 111 notitle, \ + movingFile("tet.unstruct_v1.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 112 notitle, \ + movingFile("tet.unstruct_v1.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 121 notitle, \ + movingFile("tet.unstruct_v1.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 122 notitle, \ + movingFile("tet.unstruct_v1.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 131 notitle, \ + movingFile("tet.unstruct_v1.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 132 notitle + +set output "mms_2D_stressErrors_ho-tet_unstruct_v2_movingVskExact.pdf" +plot \ + (5e-3 * x) w l ls 1 title "1^{st} order", \ + (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ + (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.unstruct_v2.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v2.ho.N1.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct_v2.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v2.ho.N2.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct_v2.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct_v2.ho.N3.summary.txt" u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct_v2.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 111 notitle, \ + movingFile("tet.unstruct_v2.ho.N1.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 112 notitle, \ + movingFile("tet.unstruct_v2.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 121 notitle, \ + movingFile("tet.unstruct_v2.ho.N2.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 122 notitle, \ + movingFile("tet.unstruct_v2.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($7) w lp ls 131 notitle, \ + movingFile("tet.unstruct_v2.ho.N3.summary.txt") u ((4*(1/$4)/3**0.5)**0.5*1e3):($8) w lp ls 132 notitle + +set output "mms_2D_stressErrors_ho-poly_struct_movingVskExact.pdf" +plot \ + (5e-3 * x) w l ls 1 title "1^{st} order", \ + (0.35e-5 * x**2) w l ls 2 title "2^{nd} order", \ + (0.2e-8 * x**3) w l ls 3 title "3^{rd} order", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("poly.struct.ho.N1.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N1.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 112 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 122 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($7) w lp ls 131 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((4*(1/$4)/pi)**0.5*1e3):($8) w lp ls 132 notitle diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Allwmake b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Allwmake rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/files b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/files rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Make/options similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/Make/options rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/Make/options diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolution.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolution.C index ab9b679..a004dc2 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolution.C @@ -74,7 +74,7 @@ void Foam::manufacturedSolution::calcBodyForces() const const solidModel& solMod = lookupSolidModel(mesh); const fvMeshQuadrature& quadrature = - solMod.displacementMLS().quadrature(); + solMod.displacementLeastSquares().quadrature(); const CompactListList& cellQuadPoints = quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = @@ -93,6 +93,8 @@ void Foam::manufacturedSolution::calcBodyForces() const bodyForcesI[cellI] += quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } + + bodyForcesI[cellI] /= mesh_.V()[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolution.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolution.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolution.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.C similarity index 76% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.C index 7b311bb..2931024 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "coordinateSystem.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,6 +41,76 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::manufacturedSolutionFunctionObject:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& highOrderDict = + solMod.solidModelDict().subDict("highOrderCoeffs"); + const dictionary& displacementDict = + highOrderDict.subDict("displacement"); + const word reconstructionType + ( + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) + ); + + useCellAverage = reconstructionType == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *mmsPtr_->calculateDisplacement + ( + cellQuadPoints[cellI][pointI] + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + mmsPtr_->calculateDisplacement(cellCentres[cellI]); + } + } +} + bool Foam::manufacturedSolutionFunctionObject::writeData() { // Lookup the solid mesh @@ -99,9 +170,10 @@ bool Foam::manufacturedSolutionFunctionObject::writeData() forAll(sI, cellI) { sI[cellI] = mmsPtr_->calculateStress(CI[cellI]); - aDI[cellI] = mmsPtr_->calculateDisplacement(CI[cellI]); } + calculateAnalyticalCellDisplacement(mesh, aDI); + forAll(analyticalStress.boundaryField(), patchI) { #ifdef OPENFOAM_NOT_EXTEND diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.H similarity index 94% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.H index 3310ce6..789d179 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFunctionObject.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFunctionObject.H @@ -83,6 +83,14 @@ class manufacturedSolutionFunctionObject // Private Member Functions + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFvPatchVectorField.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFvPatchVectorField.C index 241bcc1..1851328 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFvPatchVectorField.C @@ -129,7 +129,7 @@ manufacturedSolutionFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFvPatchVectorField.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionFvPatchVectorField.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionSource.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionSource.C diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionSource.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/manufacturedSolution/manufacturedSolutionSource.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/src/manufacturedSolutionSource.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun index 72c35ed..cd0d1e9 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun @@ -7,7 +7,7 @@ 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 manucafturedSolution library diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C index 3940409..48e4c1f 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C @@ -71,7 +71,7 @@ void Foam::manufacturedSolution::calcBodyForces() const { const solidModel& solMod = lookupSolidModel(mesh); const fvMeshQuadrature& quadrature = - solMod.displacementMLS().quadrature(); + solMod.displacementLeastSquares().quadrature(); const CompactListList& cellQuadPoints = quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = From 589e9f9624f124deb88a74fdbf8dbf793a45996d Mon Sep 17 00:00:00 2001 From: iBatistic Date: Fri, 21 Aug 2026 20:21:06 +0200 Subject: [PATCH 22/23] Added kExact to 3D MMS case --- .../manufacturedSolution/trigonometric/Allrun | 35 +-- .../trigonometric/Allrun.alphaAnalysis | 61 +++-- .../trigonometric/Allrun.kExact | 228 ++++++++++++++++++ .../base/highOrder/constant/solidProperties | 1 + .../dispErrors_movingVskExact.gnuplot | 122 ++++++++++ .../stressErrors_movingVskExact.gnuplot | 122 ++++++++++ .../{manufacturedSolution => src}/Allwmake | 0 .../{manufacturedSolution => src}/Make/files | 0 .../Make/options | 0 .../manufacturedSolution.C | 4 +- .../manufacturedSolution.H | 0 .../manufacturedSolutionFunctionObject.C | 75 +++++- .../manufacturedSolutionFunctionObject.H | 8 + .../manufacturedSolutionFvPatchVectorField.C | 2 +- .../manufacturedSolutionFvPatchVectorField.H | 0 .../manufacturedSolutionSource.C | 0 .../manufacturedSolutionSource.H | 0 17 files changed, 614 insertions(+), 44 deletions(-) create mode 100755 papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.kExact create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/Make/files (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/Make/options (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolution.C (99%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolution.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.C (85%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.H (94%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.C (98%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionSource.C (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/{manufacturedSolution => src}/manufacturedSolutionSource.H (100%) diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun index 0030f44..1014be2 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun @@ -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 manucafturedSolution library -(cd manufacturedSolution && wclean libso && ./Allwmake -j -s) +(cd src && wclean libso && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -22,18 +22,18 @@ configs=( "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0" - "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" ) # Define start and end mesh indices @@ -71,7 +71,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 @@ -129,6 +129,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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis index 25b5df1..6b0a16d 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.alphaAnalysis @@ -6,35 +6,39 @@ 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 manucafturedSolution library -(cd manufacturedSolution && wclean libso && ./Allwmake -j -s) +(cd src && wclean libso && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( - "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001" - "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" - "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" - "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1" + "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.001 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.001 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.001 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N1.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.01 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.0.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3.alpha.1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=1 Nn=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=2 Nn=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.01 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.01 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.0.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=0.1 TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3.alpha.1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 N=3 Nn=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true ALPHA=1 TYPE=movingLeastSquares" ) # Define start and end mesh indices @@ -72,7 +76,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 ALPHA + unset GMSH_FILE PETSC_FILE order extraCells HOJAC HORES ALPHA TYPE # Parse the configuration string eval $config @@ -133,6 +137,11 @@ do sed -i "/^\s*scaleFactor /s|^.*| scaleFactor ${ALPHA};|" 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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.kExact new file mode 100755 index 0000000..e818746 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/Allrun.kExact @@ -0,0 +1,228 @@ +#!/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 manucafturedSolution library +(cd src && wclean libso && ./Allwmake -j -s) + +# Define configurations as space-separated strings +configs=( + "BASE=base/snes NAME=hex.struct.hypre-snes GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.hypre" + "BASE=base/snes NAME=tet.struct.hypre-snes GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.hypre" + "BASE=base/snes NAME=poly.struct.hypre-snes GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.hypre" + "BASE=base/segregated NAME=hex.struct.seg GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + "BASE=base/segregated NAME=poly.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0" + "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" +) + +# Define start and end mesh indices +# Mesh input files are defined from 1 to 19 +# END_MESH should be greater than START_MESH +START_MESH=1 +END_MESH=13 + + +# 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 createPatch -overwrite + if [ "$USE_DUALMESH" -eq 1 ]; then + cp -r 0 0.org + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + rm -rf 0 + mv 0.org 0 + fi + + # Optional mesh distortion + if [ "$USE_PERTURBMESHPOINTS" -eq 1 ] + then + solids4Foam::runApplication perturbMeshPoints + mv 0/polyMesh/* constant/polyMesh/. + 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 + + 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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties index fc91a36..de72682 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..6f99cad --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,122 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +volume = 0.2**3 + +set grid +set xrange [3:60] +set yrange [1e-9:0.2] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in μm)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 + +set output "mms_3D_dispErrors_hex_struct_movingVskExact.pdf" +plot \ + (1e-4 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-07 * x**3) w l ls 2 title "3^{rd} order", \ + (5e-10 * x**4) w l ls 3 title "4^{th} order", \ + "hex.struct.ho.N1.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("hex.struct.ho.N1.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N1.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 112 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 122 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($5*1e6) w lp ls 131 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($6*1e6) w lp ls 132 notitle + +set output "mms_3D_dispErrors_ho-tet_struct_movingVskExact.pdf" +plot \ + (1e-4 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-07 * x**3) w l ls 2 title "3^{rd} order", \ + (5e-10 * x**4) w l ls 3 title "4^{th} order", \ + "tet.struct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.struct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 112 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 122 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 131 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 132 notitle + +set output "mms_3D_dispErrors_ho-tet_unstruct_movingVskExact.pdf" +plot \ + (1e-4 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-07 * x**3) w l ls 2 title "3^{rd} order", \ + (5e-10 * x**4) w l ls 3 title "4^{th} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 111 notitle, \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 112 notitle, \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 121 notitle, \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 122 notitle, \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5*1e6) w lp ls 131 notitle, \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6*1e6) w lp ls 132 notitle + +set output "mms_3D_dispErrors_ho-poly_struct_movingVskExact.pdf" +plot \ + (1e-4 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-07 * x**3) w l ls 2 title "3^{rd} order", \ + (5e-10 * x**4) w l ls 3 title "4^{th} order", \ + "poly.struct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("poly.struct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 112 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 122 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5*1e6) w lp ls 131 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6*1e6) w lp ls 132 notitle + diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..3ac463e --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,122 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c stressErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +volume = 0.2**3 + +set grid +set xrange [3:60] +set yrange [1e-8:10] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in MPa)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 + +set output "mms_3D_stressErrors_hex_struct_movingVskExact.pdf" +plot \ + (2e-2 * x) w l ls 1 title "1^{st} order", \ + (0.15e-3 * x**2) w l ls 2 title "2^{nd} order", \ + (0.4e-6 * x**3) w l ls 3 title "3^{rd} order", \ + "hex.struct.ho.N1.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("hex.struct.ho.N1.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N1.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ((volume/$4)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle + +set output "mms_3D_stressErrors_ho-tet_struct_movingVskExact.pdf" +plot \ + (2e-2 * x) w l ls 1 title "1^{st} order", \ + (0.15e-3 * x**2) w l ls 2 title "2^{nd} order", \ + (0.4e-6 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.struct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.struct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle + +set output "mms_3D_stressErrors_ho-tet_unstruct_movingVskExact.pdf" +plot \ + (2e-2 * x) w l ls 1 title "1^{st} order", \ + (0.15e-3 * x**2) w l ls 2 title "2^{nd} order", \ + (0.4e-6 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle, \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle, \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle, \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle, \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle, \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle + +set output "mms_3D_stressErrors_ho-poly_struct_movingVskExact.pdf" +plot \ + (2e-2 * x) w l ls 1 title "1^{st} order", \ + (0.15e-3 * x**2) w l ls 2 title "2^{nd} order", \ + (0.4e-6 * x**3) w l ls 3 title "3^{rd} order", \ + "poly.struct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.struct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.struct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.struct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + movingFile("poly.struct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle + diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Allwmake b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Allwmake rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/files b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/files rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Make/options similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/Make/options rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/Make/options diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolution.C similarity index 99% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolution.C index 1fd6d5e..1dddca0 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolution.C @@ -70,7 +70,7 @@ void Foam::manufacturedSolution::calcBodyForces() const { const solidModel& solMod = lookupSolidModel(mesh); const fvMeshQuadrature& quadrature = - solMod.displacementMLS().quadrature(); + solMod.displacementLeastSquares().quadrature(); const CompactListList& cellQuadPoints = quadrature.cellQuadPoints(); const CompactListList& cellQuadWeights = @@ -86,6 +86,8 @@ void Foam::manufacturedSolution::calcBodyForces() const bodyForcesI[cellI] += quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } + + bodyForcesI[cellI] /= mesh_.V()[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolution.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolution.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolution.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.C similarity index 85% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.C index 67df7fe..2747a32 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "coordinateSystem.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,6 +41,77 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::manufacturedSolutionFunctionObject:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& highOrderDict = + solMod.solidModelDict().subDict("highOrderCoeffs"); + const dictionary& displacementDict = + highOrderDict.subDict("displacement"); + const word reconstructionType + ( + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) + ); + + useCellAverage = reconstructionType == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *mmsPtr_->calculateDisplacement + ( + cellQuadPoints[cellI][pointI] + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + mmsPtr_->calculateDisplacement(cellCentres[cellI]); + } + } +} + + bool Foam::manufacturedSolutionFunctionObject::writeData() { // Lookup the solid mesh @@ -138,9 +210,10 @@ bool Foam::manufacturedSolutionFunctionObject::writeData() forAll(sI, cellI) { sI[cellI] = mmsPtr_->calculateStress(CI[cellI]); - aDI[cellI] = mmsPtr_->calculateDisplacement(CI[cellI]); } + calculateAnalyticalCellDisplacement(mesh, aDI); + forAll(pEI, pointI) { pEI[pointI] = mmsPtr_->calculateStrain(points[pointI]); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.H similarity index 94% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.H index 64f90c8..babd147 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFunctionObject.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFunctionObject.H @@ -82,6 +82,14 @@ class manufacturedSolutionFunctionObject // Private Member Functions + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFvPatchVectorField.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFvPatchVectorField.C index a486349..7f96487 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFvPatchVectorField.C @@ -129,7 +129,7 @@ manufacturedSolutionFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFvPatchVectorField.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionFvPatchVectorField.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionSource.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionSource.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionSource.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionSource.C diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionSource.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionSource.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/manufacturedSolution/manufacturedSolutionSource.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/src/manufacturedSolutionSource.H From 0adf2f9b91522dbddf8252734f2fa040e6f60019 Mon Sep 17 00:00:00 2001 From: iBatistic Date: Thu, 27 Aug 2026 20:38:40 +0200 Subject: [PATCH 23/23] Updated linearElastic cases scripts for kExact comparison --- .../linearElastic/cantilever/Allrun | 29 +- .../linearElastic/cantilever/Allrun.kExact | 218 +++++++++++++++ .../base/highOrder/constant/solidProperties | 1 + .../dispErrors_movingVskExact.gnuplot | 95 +++++++ .../stressErrors_movingVskExact.gnuplot | 86 ++++++ .../{analyticalCantilever => src}/Allwmake | 0 .../{analyticalCantilever => src}/Make/files | 0 .../Make/options | 0 ...CantileverDisplacementFvPatchVectorField.C | 2 +- ...CantileverDisplacementFvPatchVectorField.H | 0 ...icalCantileverTractionFvPatchVectorField.C | 2 +- ...icalCantileverTractionFvPatchVectorField.H | 0 .../cantileverAnalyticalSolution.C | 83 +++++- .../cantileverAnalyticalSolution.H | 8 + .../cantileverStressDisplacement.C | 0 .../cantileverStressDisplacement.H | 0 .../linearElastic/cooksMembrane/Allrun | 19 +- .../linearElastic/cooksMembrane/Allrun.kExact | 216 +++++++++++++++ .../base/highOrder/constant/solidProperties | 1 + .../dispVsLiterature_movingVskExact.gnuplot | 64 +++++ .../dispErrors_movingVskExact.gnuplot | 12 +- .../stressErrors_movingVskExact.gnuplot | 12 +- .../manufacturedSolution/polynomial/Allrun | 38 ++- .../base/highOrder/constant/solidProperties | 1 + .../{manufacturedSolution => src}/Allwmake | 0 .../{manufacturedSolution => src}/Make/files | 0 .../Make/options | 0 .../manufacturedSolution.C | 4 +- .../manufacturedSolution.H | 0 .../manufacturedSolutionFunctionObject.C | 73 ++++- .../manufacturedSolutionFunctionObject.H | 7 + .../manufacturedSolutionFvPatchVectorField.C | 2 +- .../manufacturedSolutionFvPatchVectorField.H | 1 + .../manufacturedSolutionSource.C | 0 .../manufacturedSolutionSource.H | 0 .../dispErrors_movingVskExact.gnuplot | 12 +- .../efficiency_movingVskExact.gnuplot | 183 +++++++++++++ .../stressErrors_movingVskExact.gnuplot | 12 +- .../linearElastic/plateHole/Allrun | 29 +- .../plateHole/Allrun.conditioning | 8 +- .../linearElastic/plateHole/Allrun.kExact | 231 ++++++++++++++++ .../analyticalPlateHole/Make/options | 12 - .../base/highOrder/constant/solidProperties | 1 + .../dispErrors_movingVskExact.gnuplot | 106 +++++++ .../stressErrors_movingVskExact.gnuplot | 106 +++++++ .../{analyticalPlateHole => src}/Allwmake | 0 .../{analyticalPlateHole => src}/Make/files | 2 + .../linearElastic/plateHole/src/Make/options | 27 ++ .../analyticalPlateHoleFunctionObject.C | 85 +++++- .../analyticalPlateHoleFunctionObject.H | 8 + ...ticalPlateHoleTractionFvPatchVectorField.C | 258 ++++++++++++++++++ ...ticalPlateHoleTractionFvPatchVectorField.H | 185 +++++++++++++ .../plateHole/src/plateHoleAnalyticalFields.C | 142 ++++++++++ .../plateHole/src/plateHoleAnalyticalFields.H | 107 ++++++++ .../linearElastic/pressurisedCylinder/Allrun | 26 +- .../pressurisedCylinder/Allrun.kExact | 211 ++++++++++++++ .../Make/options | 12 - .../base/highOrder/constant/solidProperties | 1 + .../dispErrors_movingVskExact.gnuplot | 87 ++++++ .../stressErrors_movingVskExact.gnuplot | 87 ++++++ .../Allwmake | 0 .../Make/files | 0 .../pressurisedCylinder/src/Make/options | 27 ++ ...lyticalPressurisedCylinderFunctionObject.C | 68 ++++- ...lyticalPressurisedCylinderFunctionObject.H | 8 + .../linearElastic/sphericalCavity/Allrun | 22 +- .../sphericalCavity/Allrun.kExact | 239 ++++++++++++++++ .../base/highOrder/constant/solidProperties | 1 + .../dispErrors_movingVskExact.gnuplot | 88 ++++++ .../stressErrors_movingVskExact.gnuplot | 90 ++++++ ...phericalCavityTractionFvPatchVectorField.C | 2 +- .../sphericalCavityAnalyticalSolution.C | 88 +++++- .../sphericalCavityAnalyticalSolution.H | 8 + 73 files changed, 3418 insertions(+), 135 deletions(-) create mode 100755 papers/JFNK_highOrder/linearElastic/cantilever/Allrun.kExact create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/Make/files (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/Make/options (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/analyticalCantileverDisplacementFvPatchVectorField.C (98%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/analyticalCantileverDisplacementFvPatchVectorField.H (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/analyticalCantileverTractionFvPatchVectorField.C (98%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/analyticalCantileverTractionFvPatchVectorField.H (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/cantileverAnalyticalSolution.C (84%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/cantileverAnalyticalSolution.H (95%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/cantileverStressDisplacement.C (100%) rename papers/JFNK_highOrder/linearElastic/cantilever/{analyticalCantilever => src}/cantileverStressDisplacement.H (100%) create mode 100755 papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun.kExact create mode 100644 papers/JFNK_highOrder/linearElastic/cooksMembrane/comparisonPlotScripts/dispVsLiterature_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/Make/files (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/Make/options (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolution.C (98%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolution.H (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.C (86%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionFunctionObject.H (95%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.C (98%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionFvPatchVectorField.H (99%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionSource.C (100%) rename papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/{manufacturedSolution => src}/manufacturedSolutionSource.H (100%) create mode 100644 papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/efficiency_movingVskExact.gnuplot create mode 100755 papers/JFNK_highOrder/linearElastic/plateHole/Allrun.kExact delete mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/plateHole/{analyticalPlateHole => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/plateHole/{analyticalPlateHole => src}/Make/files (53%) create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/src/Make/options rename papers/JFNK_highOrder/linearElastic/plateHole/{analyticalPlateHole => src}/analyticalPlateHoleFunctionObject.C (85%) rename papers/JFNK_highOrder/linearElastic/plateHole/{analyticalPlateHole => src}/analyticalPlateHoleFunctionObject.H (94%) create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.C create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.H create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.C create mode 100644 papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.H create mode 100755 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun.kExact delete mode 100644 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/options create mode 100644 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot rename papers/JFNK_highOrder/linearElastic/pressurisedCylinder/{analyticalPressurisedCylinder => src}/Allwmake (100%) rename papers/JFNK_highOrder/linearElastic/pressurisedCylinder/{analyticalPressurisedCylinder => src}/Make/files (100%) create mode 100644 papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/options rename papers/JFNK_highOrder/linearElastic/pressurisedCylinder/{analyticalPressurisedCylinder => src}/analyticalPressurisedCylinderFunctionObject.C (84%) rename papers/JFNK_highOrder/linearElastic/pressurisedCylinder/{analyticalPressurisedCylinder => src}/analyticalPressurisedCylinderFunctionObject.H (94%) create mode 100755 papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.kExact create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot create mode 100644 papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun index 0858ade..cc59f1f 100755 --- a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun.kExact new file mode 100755 index 0000000..7012c16 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/Allrun.kExact @@ -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 diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties index 4717048..5f0e64d 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cantilever/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..e265f6f --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,95 @@ +set term pdfcairo dashed enhanced size 3.25,2 + +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +beamArea = 0.2 + +set grid +set xrange [5:55] +set yrange [1e-13:1e-2] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in m)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +# set output "cantilever_dispErrors-hex.pdf" +# plot \ +# (2e-6 * x**2) w l ls 1 title "2^{nd} order", \ +# (4e-8 * x**3) w l ls 2 title "3^{rd} order", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ +# "hex.struct.ho.N3.summary.txt" u ((beamArea/$4)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" + +set output "cantilever_dispErrors_tet-struct_movingVskExact.pdf" +plot \ + (2e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-8 * x**3) w l ls 2 title "3^{rd} order", \ + "tet.struct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 111 notitle , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 112 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 121 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 122 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 131 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 132 notitle + +set output "cantilever_dispErrors_tet-unstruct_movingVskExact.pdf" +plot \ + (2e-6 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-8 * x**3) w l ls 2 title "3^{rd} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($5) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($6) w lp ls 132 notitle \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..acfaac9 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cantilever/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,86 @@ +set term pdfcairo dashed enhanced size 3.25,2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c stressErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +#set size ratio 1 +beamArea= 0.2 + +set grid +set xrange [5:55] +set yrange [0.01:100] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in MPa)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +# set output "cantilever_stressErrors_hex.pdf" +# plot \ +# (0.2 * x**1) w l ls 1 title "1^{st} order", \ +# (2e-5 * x**2) w l ls 2 title "2^{nd} order", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N1.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ +# "hex.struct.ho.N2.summary.txt" u ((beamArea/$4)**0.5*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)" + + +set output "cantilever_stressErrors_tet-struct_movingVskExact.pdf" +plot \ + (0.2 * x**1) w l ls 1 title "1^{st} order", \ + (2e-3 * x**2) w l ls 2 title "2^{nd} order", \ + "tet.struct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)" , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 111 notitle , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 112 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 121 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 122 notitle + +set output "cantilver_stressErrors_tet-unstruct_movingVskExact.pdf" +plot \ + (0.2 * x**1) w l ls 1 title "1^{st} order", \ + (2e-3 * x**2) w l ls 2 title "2^{nd} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($7*1e-6) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(beamArea/$4)/3**0.5)**0.5*1e3):($8*1e-6) w lp ls 122 notitle diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Allwmake b/papers/JFNK_highOrder/linearElastic/cantilever/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Allwmake rename to papers/JFNK_highOrder/linearElastic/cantilever/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files b/papers/JFNK_highOrder/linearElastic/cantilever/src/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/files rename to papers/JFNK_highOrder/linearElastic/cantilever/src/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options b/papers/JFNK_highOrder/linearElastic/cantilever/src/Make/options similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/Make/options rename to papers/JFNK_highOrder/linearElastic/cantilever/src/Make/options diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverDisplacementFvPatchVectorField.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverDisplacementFvPatchVectorField.C index 2d10789..680ac6b 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverDisplacementFvPatchVectorField.C @@ -132,7 +132,7 @@ analyticalCantileverDisplacementFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverDisplacementFvPatchVectorField.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverDisplacementFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverDisplacementFvPatchVectorField.H diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverTractionFvPatchVectorField.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverTractionFvPatchVectorField.C index 3dd3c92..90e8c10 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverTractionFvPatchVectorField.C @@ -157,7 +157,7 @@ analyticalCantileverTractionFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); // faceQuadPoints is list for whole mesh. labelList nQpPerFace(this->size(), 0); diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverTractionFvPatchVectorField.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/analyticalCantileverTractionFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/cantilever/src/analyticalCantileverTractionFvPatchVectorField.H diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.C similarity index 84% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C rename to papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.C index 11707cf..9efe9ae 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.C +++ b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "cantileverStressDisplacement.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,6 +41,78 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::cantileverAnalyticalSolution:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& displacementDict = + solMod.solidModelDict() + .subDict("highOrderCoeffs") + .subDict("displacement"); + useCellAverage = + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *cantileverDisplacement + ( + cellQuadPoints[cellI][pointI], + P_, E_, nu_, L_, D_, I_ + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + cantileverDisplacement + ( + cellCentres[cellI], P_, E_, nu_, L_, D_, I_ + ); + } + } +} + + bool Foam::cantileverAnalyticalSolution::writeData() { // Lookup the solid mesh @@ -110,11 +183,11 @@ bool Foam::cantileverAnalyticalSolution::writeData() cantileverStress(CI[cellI], P_, E_, nu_, L_, D_, I_); } - if (cellDisplacement_) - { - aDI[cellI] = - cantileverDisplacement(CI[cellI], P_, E_, nu_, L_, D_, I_); - } + } + + if (cellDisplacement_) + { + calculateAnalyticalCellDisplacement(mesh, aDI); } forAll(analyticalStress.boundaryField(), patchI) diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.H similarity index 95% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H rename to papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.H index 43a313b..f46793e 100644 --- a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverAnalyticalSolution.H +++ b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverAnalyticalSolution.H @@ -101,6 +101,14 @@ class cantileverAnalyticalSolution // Private Member Functions + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverStressDisplacement.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.C rename to papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverStressDisplacement.C diff --git a/papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H b/papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverStressDisplacement.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/cantilever/analyticalCantilever/cantileverStressDisplacement.H rename to papers/JFNK_highOrder/linearElastic/cantilever/src/cantileverStressDisplacement.H diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun index 79b7089..94d0602 100755 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun @@ -6,13 +6,17 @@ 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" + # Define configurations as space-separated strings configs=( #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" - "BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" - "BASE=base/highOrder NAME=tet.ho.N1 polyOrder=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N2 polyOrder=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.ho.N3 polyOrder=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" + "BASE=base/highOrder NAME=tet.ho.N1 polyOrder=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.ho.N2 polyOrder=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.ho.N3 polyOrder=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" ) # SNES segregated approach # "BASE=base/snes NAME=hex.seg.lu PETSC_FILE=petscOptions.seg.lu" @@ -50,7 +54,7 @@ cd "${RUN_DIR}" for config in "${configs[@]}" do # Reset variables in the case some variable is not used - unset GMSH_FILE PETSC_FILE N Nn + unset GMSH_FILE PETSC_FILE N Nn TYPE # Parse the configuration string eval $config @@ -109,6 +113,11 @@ do sed -i "/^\s*optionsFile /s|^.*| optionsFile ${PETSC_FILE};|" 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 diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun.kExact new file mode 100755 index 0000000..a5e5d30 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/Allrun.kExact @@ -0,0 +1,216 @@ +#!/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" + +# Define configurations as space-separated strings +configs=( + #"BASE=base/snes NAME=hex.lu PETSC_FILE=petscOptions.lu" + #"BASE=base/segregated NAME=tet.seg GMSH_FILE=tet-unstructured" + "BASE=base/highOrder NAME=tet.ho.N1 polyOrder=1 extraCells=7 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.ho.N2 polyOrder=2 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.ho.N3 polyOrder=3 extraCells=10 GMSH_FILE=tet-unstructured PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" +) +# SNES segregated approach +# "BASE=base/snes NAME=hex.seg.lu PETSC_FILE=petscOptions.seg.lu" + +# Define start and end mesh indices +# Mesh input files are defined from 1 to 8 +START_MESH=1 +END_MESH=8 + + +# 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 N Nn 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" > "${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 -r "../${BASE}" "${CASE}" + cd "$CASE" + + # Create the mesh + if [ -n "${GMSH_FILE}" ]; then + if command -v gmsh &> /dev/null + then + # Remporarily rename 0 to avoid issues + mv 0 0.tmp + 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 + # Move 0 back + mv 0.tmp 0 + else + # Fail silently + echo; echo "Gmsh is required for tet meshes: please install it" + exit 0 + fi + else + # Replace the blockMeshDict + if [[ ! -f "system/blockMeshDict.$i" ]] + then + echo "Cannot find ${CASE}/system/blockMeshDict.$i: please add it to ${BASE}/meshes/"; echo + exit 1; + else + echo "Copying ${CASE}/system/blockMeshDict.$i to ${CASE}/system/blockMeshDict" + \cp "system/blockMeshDict.$i" system/blockMeshDict + rm -f constant/polyMesh/blockMeshDict + fi + solids4Foam::runApplication blockMesh + 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 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 + + # 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 + + # 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 reference point vertical displacement + DISP=$(tail -1 postProcessing/0/solidPointDisplacement_pointDisp.dat | awk '{print $3}') + + # Write data to file + echo "$i $CLOCK_TIME $MAX_MEMORY $CELLS $DISP" >> ../"${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/* . + + # Run all scripts + for f in *gnuplot + do + echo "Running gnuplot on $f" + gnuplot "$f" 2>/dev/null + done +fi + +# Exit the run directory +cd .. + +echo; echo; echo "Done!"; echo +echo "View the PDF files in ${RUN_DIR}" +echo; echo $(date +%Y%m%d_%H%M%S) +echo; echo diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties index fc91a36..de72682 100644 --- a/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/cooksMembrane/comparisonPlotScripts/dispVsLiterature_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/cooksMembrane/comparisonPlotScripts/dispVsLiterature_movingVskExact.gnuplot new file mode 100644 index 0000000..5ddd146 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/cooksMembrane/comparisonPlotScripts/dispVsLiterature_movingVskExact.gnuplot @@ -0,0 +1,64 @@ +set term pdfcairo dashed enhanced size 3.25,2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispVsLiterature_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +set grid +set xrange [0.099:20] +set yrange [14:34] +set xtics +#set ytics (0.7, 0.8, 0.9, 1) + +set logscale x +set format x "%g" + +#set logscale y +#set ytics 0.002 +set xlabel "Average cell spacing (in mm)" +set ylabel "Reference point vertical\n displacement (in µm)" +set key left b + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.75 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.75 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.75 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.75 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.75 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.75 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 + +# Average mesh spacing of mesh1 +# First mesh have 9 elements and one element area is then 0.00016. sqrt of that is 0.012649 +dx=12.649 + +#Average mesh spacing of mesh 1 for Zienkiewicz and Taylor results +dxZT = 18.973666 + +file = "hex.lu.summary.txt" +file_ZT = "ZienkiewiczAndTaylor.dat" +file_A = "Abaqus.dat" +area=1440 + +set output "CooksMembrane-tet-hookeanTipDispConvergence_movingVskExact.pdf" +plot \ + file_ZT u (dxZT/(2**($0))):($2) w lp pt 8 ps 1 lw 1.2 lc "gray" t "Zienkiewicz and Taylor (2000) - Q4",\ + file_A u 2:4 w lp pt 4 ps 1 lw 1.2 lc "purple" t "Abaqus (CPE4H)",\ + "tet.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 11 t"{/Times-Italic p}_{ }=1", \ + "tet.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 21 t"{/Times-Italic p}_{ }=2", \ + "tet.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 31 t"{/Times-Italic p}_{ }=3" , \ + movingFile("tet.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 111 notitle , \ + movingFile("tet.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 121 notitle , \ + movingFile("tet.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5*1000*1000) w lp ls 131 notitle diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot index 2d5f489..b6f64b9 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -39,12 +39,12 @@ set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 # Moving-least-squares data use the same colours with 50% transparency -set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 -set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 -set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 -set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 -set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 -set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 set output "mms_2D_dispErrors_hex_struct_movingVskExact.pdf" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot index 2493cdf..9b42953 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/mixed/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -39,12 +39,12 @@ set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 # Moving-least-squares data use the same colours with 50% transparency -set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 -set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 -set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 -set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 -set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 -set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 set output "mms_2D_stressErrors_hex_struct_movingVskExact.pdf" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun index cd0d1e9..c7886e9 100755 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/Allrun @@ -7,11 +7,11 @@ source solids4FoamScripts.sh solids4Foam::caseDoesNotRunWithFoamExtend # solids4Foam location path -export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412 +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412/ echo "SOLIDS4FOAM_DIR = $SOLIDS4FOAM_DIR" # Compile the manucafturedSolution library -(cd manufacturedSolution && wclean libso && ./Allwmake -j -s) +(cd src && wclean libso && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -23,25 +23,25 @@ configs=( # "BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" # "BASE=base/segregated NAME=poly.seg GMSH_FILE=tet-unstructured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0" - # "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=poly.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=25 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=poly.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - # "BASE=base/highOrder NAME=poly.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + # "BASE=base/highOrder NAME=hex.struct.ho.N1 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=hex.struct.ho.N2 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=tet.struct.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=tet.struct.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=tet.struct.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=poly.ho.N1 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=poly.ho.N2 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + # "BASE=base/highOrder NAME=poly.ho.N3 GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" ) # Define start and end mesh indices # Mesh input files are defined from 1 to 12 # END_MESH should be greater than START_MESH START_MESH=1 -END_MESH=4 # 12 +END_MESH=8 # Detect the CPU type: we append this to the case name @@ -71,6 +71,9 @@ cd "${RUN_DIR}" # Iterate through configurations for config in "${configs[@]}" do + # Reset variables in case a variable is not used + unset GMSH_FILE PETSC_FILE polyOrder extraCells HOJAC HORES TYPE + # Parse the configuration string eval $config echo; echo "***************************************" @@ -124,6 +127,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 diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties index 4717048..5f0e64d 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Allwmake b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Allwmake rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/files b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/files rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Make/options similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/Make/options rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/Make/options diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolution.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolution.C index 48e4c1f..2ea532b 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolution.C @@ -19,6 +19,7 @@ License #include "manufacturedSolution.H" #include "mathematicalConstants.H" +#include "lookupSolidModel.H" #include "tetPoints.H" #include "tetQuadrature.H" #include "polyMeshTetDecomposition.H" @@ -88,7 +89,8 @@ void Foam::manufacturedSolution::calcBodyForces() const quadWeights[pointI]*calculateBodyForce(quadPoints[pointI]); } - totalBodyForce += quadVolume*bodyForcesI[cellI]; + bodyForcesI[cellI] /= mesh.V()[cellI]; + totalBodyForce += mesh.V()[cellI]*bodyForcesI[cellI]; } } else diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolution.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolution.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolution.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.C similarity index 86% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.C index 67df7fe..4e0fd3d 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "coordinateSystem.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,6 +41,75 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::manufacturedSolutionFunctionObject:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& displacementDict = + solMod.solidModelDict() + .subDict("highOrderCoeffs") + .subDict("displacement"); + + useCellAverage = + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *mmsPtr_->calculateDisplacement + ( + cellQuadPoints[cellI][pointI] + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + mmsPtr_->calculateDisplacement(cellCentres[cellI]); + } + } +} + + bool Foam::manufacturedSolutionFunctionObject::writeData() { // Lookup the solid mesh @@ -138,9 +208,10 @@ bool Foam::manufacturedSolutionFunctionObject::writeData() forAll(sI, cellI) { sI[cellI] = mmsPtr_->calculateStress(CI[cellI]); - aDI[cellI] = mmsPtr_->calculateDisplacement(CI[cellI]); } + calculateAnalyticalCellDisplacement(mesh, aDI); + forAll(pEI, pointI) { pEI[pointI] = mmsPtr_->calculateStrain(points[pointI]); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.H similarity index 95% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.H index 64f90c8..d2c092e 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFunctionObject.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFunctionObject.H @@ -82,6 +82,13 @@ class manufacturedSolutionFunctionObject // Private Member Functions + //- Calculate point-valued or cell-average analytical displacement + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.C similarity index 98% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.C index 5bc15c7..3c97c89 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.C @@ -129,7 +129,7 @@ manufacturedSolutionFvPatchVectorField::evaluateQuadrature // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.H similarity index 99% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.H index 5b99628..14e2f13 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionFvPatchVectorField.H +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionFvPatchVectorField.H @@ -37,6 +37,7 @@ Author #include "fixedDisplacementFvPatchVectorField.H" #include "manufacturedSolution.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionSource.C b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionSource.C similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionSource.C rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionSource.C diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionSource.H b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionSource.H similarity index 100% rename from papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/manufacturedSolution/manufacturedSolutionSource.H rename to papers/JFNK_highOrder/linearElastic/manufacturedSolution/polynomial/src/manufacturedSolutionSource.H diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot index 6f99cad..360cca3 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -41,12 +41,12 @@ set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 # Moving-least-squares data use the same colours with 50% transparency -set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 -set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 -set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 -set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 -set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 -set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 set output "mms_3D_dispErrors_hex_struct_movingVskExact.pdf" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/efficiency_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/efficiency_movingVskExact.gnuplot new file mode 100644 index 0000000..8d54373 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/efficiency_movingVskExact.gnuplot @@ -0,0 +1,183 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c efficiency_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +volume = 0.2**3 + +set grid +set xrange [0:1000] +#set yrange [1e-9:0.2] +set xtics +#set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Time (in s)" +set ylabel "{/Times-Italic L}_{ 2} error (in μm)" +set key right bottom outside; +set rmargin 15 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 01 lc rgb "black" pt 7 ps 0.5 lw 1 +set style line 02 lc rgb "slategrey" pt 7 ps 0.5 lw 1 +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 30% opacity +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 + +set output "mms_3D_dispEfficiency_hex_struct_movingVskExact.pdf" +plot \ + "hex.struct.seg.summary.txt" u 2:($5*1e6) w lp ls 01 title"S4F_{SEG}", \ + "hex.struct.hypre-snes.summary.txt" u 2:($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ + "hex.struct.ho.N1.summary.txt" u 2:($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "hex.struct.ho.N2.summary.txt" u 2:($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "hex.struct.ho.N3.summary.txt" u 2:($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("hex.struct.ho.N1.summary.txt") u 2:($5*1e6) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u 2:($5*1e6) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u 2:($5*1e6) w lp ls 131 notitle + +set output "mms_3D_dispEfficiency_tet_struct_movingVskExact.pdf" +plot \ + "tet.struct.seg.summary.txt" u 2:($5*1e6) w lp ls 01 title"S4F_{SEG}", \ + "tet.struct.hypre-snes.summary.txt" u 2:($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ + "tet.struct.ho.N1.summary.txt" u 2:($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "tet.struct.ho.N2.summary.txt" u 2:($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "tet.struct.ho.N3.summary.txt" u 2:($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("tet.struct.ho.N1.summary.txt") u 2:($5*1e6) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u 2:($5*1e6) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u 2:($5*1e6) w lp ls 131 notitle + +# set output "mms_3D_dispEfficiency_tet_unstruct_movingVskExact.pdf" +# plot \ +# "tet.unstruct.seg.summary.txt" u 2:($5*1e6) w lp ls 01 title"S4F_{SEG}", \ +# "tet.unstruct.hypre-snes.summary.txt" u 2:($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ +# "tet.unstruct.ho.N1.summary.txt" u 2:($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ +# "tet.unstruct.ho.N2.summary.txt" u 2:($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ +# "tet.unstruct.ho.N3.summary.txt" u 2:($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ +# movingFile("tet.unstruct.ho.N1.summary.txt") u 2:($5*1e6) w lp ls 111 notitle, \ +# movingFile("tet.unstruct.ho.N2.summary.txt") u 2:($5*1e6) w lp ls 121 notitle, \ +# movingFile("tet.unstruct.ho.N3.summary.txt") u 2:($5*1e6) w lp ls 131 notitle + +set output "mms_3D_dispEfficiency_poly_struct_movingVskExact.pdf" +plot \ + "poly.struct.seg.summary.txt" u 2:($5*1e6) w lp ls 01 title"S4F_{SEG}", \ + "poly.struct.hypre-snes.summary.txt" u 2:($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ + "poly.struct.ho.N1.summary.txt" u 2:($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "poly.struct.ho.N2.summary.txt" u 2:($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "poly.struct.ho.N3.summary.txt" u 2:($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("poly.struct.ho.N1.summary.txt") u 2:($5*1e6) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u 2:($5*1e6) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u 2:($5*1e6) w lp ls 131 notitle + +set output "mms_3D_stressEfficiency_hex_struct_movingVskExact.pdf" +plot \ + "hex.struct.seg.summary.txt" u 2:($7*1e-6) w lp ls 01 title"S4F_{SEG}", \ + "hex.struct.hypre-snes.summary.txt" u 2:($7*1e-6) w lp ls 02 title "S4F_{JFNK}", \ + "hex.struct.ho.N1.summary.txt" u 2:($7*1e-6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "hex.struct.ho.N2.summary.txt" u 2:($7*1e-6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "hex.struct.ho.N3.summary.txt" u 2:($7*1e-6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("hex.struct.ho.N1.summary.txt") u 2:($7*1e-6) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u 2:($7*1e-6) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u 2:($7*1e-6) w lp ls 131 notitle + +set output "mms_3D_stressEfficiency_tet_struct_movingVskExact.pdf" +plot \ + "tet.struct.seg.summary.txt" u 2:($7*1e-6) w lp ls 01 title"S4F_{SEG}", \ + "tet.struct.hypre-snes.summary.txt" u 2:($7*1e-6) w lp ls 02 title "S4F_{JFNK}", \ + "tet.struct.ho.N1.summary.txt" u 2:($7*1e-6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "tet.struct.ho.N2.summary.txt" u 2:($7*1e-6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "tet.struct.ho.N3.summary.txt" u 2:($7*1e-6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("tet.struct.ho.N1.summary.txt") u 2:($7*1e-6) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u 2:($7*1e-6) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u 2:($7*1e-6) w lp ls 131 notitle + +# set output "mms_3D_stressEfficiency_tet_unstruct_movingVskExact.pdf" +# plot \ +# "tet.unstruct.seg.summary.txt" u 2:($7*1e-6) w lp ls 01 title"S4F_{SEG}", \ +# "tet.unstruct.hypre-snes.summary.txt" u 2:($7*1e-6) w lp ls 02 title "S4F_{JFNK}", \ +# "tet.unstruct.ho.N1.summary.txt" u 2:($7*1e-6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ +# "tet.unstruct.ho.N2.summary.txt" u 2:($7*1e-6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ +# "tet.unstruct.ho.N3.summary.txt" u 2:($7*1e-6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ +# movingFile("tet.unstruct.ho.N1.summary.txt") u 2:($7*1e-6) w lp ls 111 notitle, \ +# movingFile("tet.unstruct.ho.N2.summary.txt") u 2:($7*1e-6) w lp ls 121 notitle, \ +# movingFile("tet.unstruct.ho.N3.summary.txt") u 2:($7*1e-6) w lp ls 131 notitle + +set output "mms_3D_stressEfficiency_poly_struct_movingVskExact.pdf" +plot \ + "poly.struct.seg.summary.txt" u 2:($7*1e-6) w lp ls 01 title"S4F_{SEG}", \ + "poly.struct.hypre-snes.summary.txt" u 2:($7*1e-6) w lp ls 02 title "S4F_{JFNK}", \ + "poly.struct.ho.N1.summary.txt" u 2:($7*1e-6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "poly.struct.ho.N2.summary.txt" u 2:($7*1e-6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "poly.struct.ho.N3.summary.txt" u 2:($7*1e-6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("poly.struct.ho.N1.summary.txt") u 2:($7*1e-6) w lp ls 111 notitle, \ + movingFile("poly.struct.ho.N2.summary.txt") u 2:($7*1e-6) w lp ls 121 notitle, \ + movingFile("poly.struct.ho.N3.summary.txt") u 2:($7*1e-6) w lp ls 131 notitle + +set output "mms_3D_memoryEfficiency_hex_struct_movingVskExact.pdf" +set xrange [0.05:10] +set xlabel "Memory (in MB)" + +plot \ + "hex.struct.seg.summary.txt" u ($3/1024):($5*1e6) w lp ls 01 title"S4F_{SEG}", \ + "hex.struct.hypre-snes.summary.txt" u ($3/1204):($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ + "hex.struct.ho.N1.summary.txt" u ($3/1024):($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "hex.struct.ho.N2.summary.txt" u ($3/1024):($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "hex.struct.ho.N3.summary.txt" u ($3/1024):($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("hex.struct.ho.N1.summary.txt") u ($3/1024):($5*1e6) w lp ls 111 notitle, \ + movingFile("hex.struct.ho.N2.summary.txt") u ($3/1024):($5*1e6) w lp ls 121 notitle, \ + movingFile("hex.struct.ho.N3.summary.txt") u ($3/1024):($5*1e6) w lp ls 131 notitle + +set output "mms_3D_memoryEfficiency_tet_struct_movingVskExact.pdf" +plot \ + "tet.struct.seg.summary.txt" u ($3/1024):($5*1e6) w lp ls 01 title"S4F_{SEG}", \ + "tet.struct.hypre-snes.summary.txt" u ($3/1024):($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ + "tet.struct.ho.N1.summary.txt" u ($3/1024):($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ + "tet.struct.ho.N2.summary.txt" u ($3/1024):($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ + "tet.struct.ho.N3.summary.txt" u ($3/1024):($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ + movingFile("tet.struct.ho.N1.summary.txt") u ($3/1024):($5*1e6) w lp ls 111 notitle, \ + movingFile("tet.struct.ho.N2.summary.txt") u ($3/1024):($5*1e6) w lp ls 121 notitle, \ + movingFile("tet.struct.ho.N3.summary.txt") u ($3/1024):($5*1e6) w lp ls 131 notitle + +# set output "mms_3D_memoryEfficiency_tet_unstruct_movingVskExact.pdf" +# plot \ +# "tet.unstruct.seg.summary.txt" u ($3/1024):($5*1e6) w lp ls 01 title"S4F_{SEG}", \ +# "tet.unstruct.hypre-snes.summary.txt" u ($3/1024):($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ +# "tet.unstruct.ho.N1.summary.txt" u ($3/1024):($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ +# "tet.unstruct.ho.N2.summary.txt" u ($3/1024):($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ +# "tet.unstruct.ho.N3.summary.txt" u ($3/1024):($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ +# movingFile("tet.unstruct.ho.N1.summary.txt") u ($3/1024):($5*1e6) w lp ls 111 notitle, \ +# movingFile("tet.unstruct.ho.N2.summary.txt") u ($3/1024):($5*1e6) w lp ls 121 notitle, \ +# movingFile("tet.unstruct.ho.N3.summary.txt") u ($3/1024):($5*1e6) w lp ls 131 notitle + +# set output "mms_3D_memoryEfficiency_poly_struct_movingVskExact.pdf" +# plot \ +# "poly.struct.seg.summary.txt" u ($3/1024):($5*1e6) w lp ls 01 title"S4F_{SEG}", \ +# "poly.struct.hypre-snes.summary.txt" u ($3/1024):($5*1e6) w lp ls 02 title "S4F_{JFNK}", \ +# "poly.struct.ho.N1.summary.txt" u ($3/1024):($5*1e6) w lp ls 11 title "{/Times-Italic p}_{ }=1", \ +# "poly.struct.ho.N2.summary.txt" u ($3/1024):($5*1e6) w lp ls 21 title "{/Times-Italic p}_{ }=2", \ +# "poly.struct.ho.N3.summary.txt" u ($3/1024):($5*1e6) w lp ls 31 title "{/Times-Italic p}_{ }=3", \ +# movingFile("poly.struct.ho.N1.summary.txt") u ($3/1024):($5*1e6) w lp ls 111 notitle, \ +# movingFile("poly.struct.ho.N2.summary.txt") u ($3/1024):($5*1e6) w lp ls 121 notitle, \ +# movingFile("poly.struct.ho.N3.summary.txt") u ($3/1024):($5*1e6) w lp ls 131 notitle diff --git a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot index 3ac463e..fc93279 100644 --- a/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot +++ b/papers/JFNK_highOrder/linearElastic/manufacturedSolution/trigonometric/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -41,12 +41,12 @@ set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 # Moving-least-squares data use the same colours with 50% transparency -set style line 111 lc rgb "#80ff0000" pt 7 ps 0.5 lw 1 -set style line 112 lc rgb "#80ff0000" pt 6 ps 0.5 lw 1 -set style line 121 lc rgb "#800000ff" pt 5 ps 0.5 lw 1 -set style line 122 lc rgb "#800000ff" pt 4 ps 0.5 lw 1 -set style line 131 lc rgb "#80ee82ee" pt 9 ps 0.5 lw 1 -set style line 132 lc rgb "#80ee82ee" pt 8 ps 0.5 lw 1 +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 set output "mms_3D_stressErrors_hex_struct_movingVskExact.pdf" plot \ diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun index 9a7cc9e..a81b08b 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun @@ -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 analyticalPlateHole library -(cd analyticalPlateHole && ./Allwmake -j -s) +(cd src && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -22,15 +22,15 @@ configs=( #"BASE=base/segregated NAME=hex.seg USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" #"BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" #"BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" - #"BASE=base/highOrder NAME=hex.ho.N1 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.ho.N2 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.ho.N3 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 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 USE_DUALMESH=0 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 USE_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true" + #"BASE=base/highOrder NAME=hex.ho.N1 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" + #"BASE=base/highOrder NAME=hex.ho.N2 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" + #"BASE=base/highOrder NAME=hex.ho.N3 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 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 USE_DUALMESH=0 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 USE_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=movingLeastSquares" ) # Define start and end mesh indices @@ -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 N Nn + unset GMSH_FILE PETSC_FILE N Nn TYPE # Parse the configuration string eval $config @@ -132,6 +132,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 diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning index 81b59e5..8b862c9 100755 --- a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.conditioning @@ -5,7 +5,9 @@ source solids4FoamScripts.sh # Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend -solids4Foam::caseDoesNotRunWithOpenFOAMOrg + +# Compile the src library +(cd src && ./Allwmake -j -s) # Define configurations as space-separated strings configs=( @@ -116,12 +118,12 @@ do sed -i "/^\s*Nn /s|^.*| Nn ${Nn};|" constant/solidProperties fi - # Update how Jacobian is calculated + # Update how Jacobian is calculated if [ -n "${HOJAC}" ]; then sed -i "/^\s*highOrderJacobian /s|^.*| highOrderJacobian ${HOJAC};|" constant/solidProperties fi - # Update how Residual is calculated + # Update how Residual is calculated if [ -n "${HORES}" ]; then sed -i "/^\s*highOrderResidual /s|^.*| highOrderResidual ${HORES};|" constant/solidProperties fi diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.kExact new file mode 100755 index 0000000..5734979 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/Allrun.kExact @@ -0,0 +1,231 @@ +#!/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 analyticalPlateHole library +(cd src && ./Allwmake -j -s) + +# Define configurations as space-separated strings +configs=( + #"BASE=base/snes NAME=hex.struct.hypre-snes GMSH_FILE=hex-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + #"BASE=base/snes NAME=tet.struct.hypre-snes GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + #"BASE=base/snes NAME=poly.hypre-snes GMSH_FILE=tet-structured USE_DUALMESH=1 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + #"BASE=base/snes NAME=tet.unstruct.hypre-snes GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 PETSC_FILE=petscOptions.lu" + #"BASE=base/segregated NAME=hex.seg USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + #"BASE=base/segregated NAME=tet.struct.seg GMSH_FILE=tet-structured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + #"BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet-unstructured USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0" + #"BASE=base/highOrder NAME=hex.ho.N1 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" + #"BASE=base/highOrder NAME=hex.ho.N2 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" + #"BASE=base/highOrder NAME=hex.ho.N3 USE_TET=0 USE_DUALMESH=0 USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.lu HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_DUALMESH=0 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 USE_DUALMESH=0 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 USE_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 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_DUALMESH=0 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 6 +# END_MESH should be greater than START_MESH +START_MESH=1 +END_MESH=5 + + +# 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 N Nn 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" + + # Create mesh + if [[ "$GMSH_FILE" == "tet-structured" || "$GMSH_FILE" == "tet-unstructured" ]] + then + if command -v gmsh &>/dev/null; then + # 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 + if [ "$USE_DUALMESH" -eq 1 ]; then + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + fi + fi + else + cp "system/blockMeshDict.$i" "system/blockMeshDict" + solids4Foam::runApplication blockMesh + fi + + # Optional mesh distortion + if [ "$USE_PERTURBMESHPOINTS" -eq 1 ] + then + solids4Foam::runApplication perturbMeshPoints + mv 0/polyMesh/* constant/polyMesh/. + 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 $2}') + + # Extract the LInfinity (max) error for displacement + DISP_LINF_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + + # 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 diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options b/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options deleted file mode 100644 index c5b1801..0000000 --- a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/options +++ /dev/null @@ -1,12 +0,0 @@ -sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options -sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options - -EXE_INC = \ - $(VERSION_SPECIFIC_INC) \ - -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties index 4717048..5f0e64d 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/plateHole/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..fc69e3f --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,106 @@ +set term pdfcairo dashed enhanced size 3.25,2 + +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +area = 3.803650459 + +set grid +set xrange [5:200] +set yrange [1e-8:1] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in μm)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +set output "plateHole_dispErrors_hex_movingVskExact.pdf" +#set title "Hexahedral structured mesh" +plot \ + (4e-6 * x**2) w l ls 1 title "2^{nd} order",\ + (2e-8 * x**3) w l ls 2 title "3^{rd} order",\ + (8e-11 * x**4) w l ls 3 title "4^{th} order",\ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 112 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 132 notitle + + +set output "plateHole_dispErrors_tet-struct_movingVskExact.pdf" +plot \ + (4e-6 * x**2) w l ls 1 title "2^{nd} order",\ + (2e-8 * x**3) w l ls 2 title "3^{rd} order",\ + (8e-11 * x**4) w l ls 3 title "4^{th} order",\ + "tet.struct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 112 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 132 notitle + +set output "plateHole_dispErrors_tet-unstruct_movingVskExact.pdf" +plot \ + (4e-6 * x**2) w l ls 1 title "2^{nd} order",\ + (2e-8 * x**3) w l ls 2 title "3^{rd} order",\ + (8e-11 * x**4) w l ls 3 title "4^{th} order",\ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 132 notitle \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..e41d12a --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,106 @@ +set term pdfcairo dashed enhanced size 3.25,2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c stressErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +area= 3.803650459 + +set grid +set xrange [4:130] +set yrange [1e-8:0.1] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in MPa)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + + +set output "plateHole_stressErrors_hex_movingVskExact.pdf" +plot \ + (2e-4 * x**1) w l ls 1 title "1^{st} order", \ + (1e-6 * x**2) w l ls 2 title "2^{nd} order", \ + (5e-9 * x**3) w l ls 3 title "3^{rd} order", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 112 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5*1e3):($6*1e6) w lp ls 132 notitle + + +set output "plateHole_stressErrors_tet-unstruct_movingVskExact.pdf" +plot \ + (2e-4 * x**1) w l ls 1 title "1^{st} order", \ + (0.4e-6 * x**2) w l ls 2 title "2^{nd} order", \ + (0.4e-9 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 132 notitle + + +set output "plateHole_stressErrors_tet-struct_movingVskExact.pdf" +plot \ + (2e-4 * x**1) w l ls 1 title "1^{st} order", \ + (1e-6 * x**2) w l ls 2 title "2^{nd} order", \ + (5e-9 * x**3) w l ls 3 title "3^{rd} order", \ + "tet.struct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.struct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 111 notitle , \ + movingFile("tet.struct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 112 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 121 notitle , \ + movingFile("tet.struct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 122 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($5*1e6) w lp ls 131 notitle , \ + movingFile("tet.struct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5*1e3):($6*1e6) w lp ls 132 notitle diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake b/papers/JFNK_highOrder/linearElastic/plateHole/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Allwmake rename to papers/JFNK_highOrder/linearElastic/plateHole/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files b/papers/JFNK_highOrder/linearElastic/plateHole/src/Make/files similarity index 53% rename from papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files rename to papers/JFNK_highOrder/linearElastic/plateHole/src/Make/files index 02d9700..9538b6c 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/Make/files +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/Make/files @@ -1,3 +1,5 @@ +plateHoleAnalyticalFields.C +analyticalPlateHoleTractionFvPatchVectorField.C analyticalPlateHoleFunctionObject.C LIB = $(FOAM_USER_LIBBIN)/libanalyticalPlateHole diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/src/Make/options b/papers/JFNK_highOrder/linearElastic/plateHole/src/Make/options new file mode 100644 index 0000000..0397381 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/Make/options @@ -0,0 +1,27 @@ +sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options +sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options + +EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ + $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ + -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.C similarity index 85% rename from papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.C index 9bc11ac..1af7366 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.C +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "coordinateSystem.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -121,6 +122,81 @@ Foam::vector Foam::analyticalPlateHole::plateHoleDisplacement ); } + +void Foam::analyticalPlateHole::calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& displacementDict = + solMod.solidModelDict() + .subDict("highOrderCoeffs") + .subDict("displacement"); + useCellAverage = + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + const point& quadPoint = cellQuadPoints[cellI][pointI]; + + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *plateHoleDisplacement + ( + quadPoint, + plateHoleStress(quadPoint) + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + plateHoleDisplacement + ( + cellCentres[cellI], + plateHoleStress(cellCentres[cellI]) + ); + } + } +} + + bool Foam::analyticalPlateHole::writeData() { // Lookup the solid mesh @@ -197,10 +273,11 @@ bool Foam::analyticalPlateHole::writeData() sI[cellI] = plateHoleStress(CI[cellI]); } - if (cellDisplacement_) - { - aDI[cellI] = plateHoleDisplacement(CI[cellI], sI[cellI]); - } + } + + if (cellDisplacement_) + { + calculateAnalyticalCellDisplacement(mesh, aDI); } forAll(analyticalStress.boundaryField(), patchI) diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.H similarity index 94% rename from papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.H index f64d112..e22d26a 100644 --- a/papers/JFNK_highOrder/linearElastic/plateHole/analyticalPlateHole/analyticalPlateHoleFunctionObject.H +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleFunctionObject.H @@ -101,6 +101,14 @@ class analyticalPlateHole //- Analytical displacement solution vector plateHoleDisplacement(const vector& C, const symmTensor& sigma); + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.C new file mode 100644 index 0000000..cca5abc --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.C @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "analyticalPlateHoleTractionFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "mechanicalModel.H" +#include "volFields.H" +#include "fvc.H" +#include "fixedValueFvPatchFields.H" +#include "lookupSolidModel.H" +#include "plateHoleAnalyticalFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * * // + +symmTensor analyticalPlateHoleTractionFvPatchVectorField::plateHoleSolution +( + const vector& C +) const +{ + return plateHoleAnalyticalFields::stress(C, T_, holeR_); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +analyticalPlateHoleTractionFvPatchVectorField:: +analyticalPlateHoleTractionFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + solidTractionFvPatchVectorField(p, iF), + T_(0.0), + holeR_(0.0) +{} + + +analyticalPlateHoleTractionFvPatchVectorField:: +analyticalPlateHoleTractionFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + solidTractionFvPatchVectorField(p, iF), + T_(readScalar(dict.lookup("farFieldTractionX"))), + holeR_(readScalar(dict.lookup("holeRadius"))) +{} + + +analyticalPlateHoleTractionFvPatchVectorField:: +analyticalPlateHoleTractionFvPatchVectorField +( + const analyticalPlateHoleTractionFvPatchVectorField& stpvf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + solidTractionFvPatchVectorField(stpvf, p, iF, mapper), + T_(stpvf.T_), + holeR_(stpvf.holeR_) +{} + +#ifndef OPENFOAM_ORG +analyticalPlateHoleTractionFvPatchVectorField:: +analyticalPlateHoleTractionFvPatchVectorField +( + const analyticalPlateHoleTractionFvPatchVectorField& stpvf +) +: + solidTractionFvPatchVectorField(stpvf), + T_(stpvf.T_), + holeR_(stpvf.holeR_) +{} +#endif + +analyticalPlateHoleTractionFvPatchVectorField:: +analyticalPlateHoleTractionFvPatchVectorField +( + const analyticalPlateHoleTractionFvPatchVectorField& stpvf, + const DimensionedField& iF +) +: + solidTractionFvPatchVectorField(stpvf, iF), + T_(stpvf.T_), + holeR_(stpvf.holeR_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void analyticalPlateHoleTractionFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + solidTractionFvPatchVectorField::autoMap(m); +} + + +// Reverse-map the given fvPatchField onto this fvPatchField +void analyticalPlateHoleTractionFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + solidTractionFvPatchVectorField::rmap(ptf, addr); +} + + +// Update the coefficients associated with the patch field +void analyticalPlateHoleTractionFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Patch unit normals + vectorField n(patch().nf()); + + // Patch face centres + const vectorField& Cf = patch().Cf(); + + // Set the patch traction + + vectorField& trac = traction(); + + forAll(traction(), faceI) + { + vector curC(Cf[faceI].x(), Cf[faceI].y(), 0); + vector curN = n[faceI]; + + if (patch().name() == "hole") + { + curC /= mag(curC); + curC *= holeR_; + + curN = -curC/mag(curC); + } + + trac[faceI] = + plateHoleAnalyticalFields::traction(curC, curN, T_, holeR_); + } + + solidTractionFvPatchVectorField::updateCoeffs(); +} + +#ifndef FOAMEXTEND +autoPtr> +analyticalPlateHoleTractionFvPatchVectorField::evaluateQuadrature() const +{ + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const solidModel& solMod = lookupSolidModel(mesh); + + // faceQuadPoints is list for the whole mesh + const CompactListList& faceQuadPoints = + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); + + labelList nQpPerFace(this->size(), 0); + const label start = this->patch().start(); + forAll(nQpPerFace, faceI) + { + const label globalFaceID = faceI + start; + nQpPerFace[faceI]=faceQuadPoints[globalFaceID].size(); + } + + autoPtr> tQuadPointsValue + ( + new CompactListList(nQpPerFace) + ); + + // Get a reference to the actual data for easier access + CompactListList& quadPointsValue = tQuadPointsValue(); + + // Patch unit normals + vectorField n(patch().nf()); + + forAll(*this, faceI) + { + const label globalFaceID = faceI + start; + + // Get the number of quadrature points for this face + const label nPoints = faceQuadPoints[globalFaceID].size(); + + // Assign the same value to all quadrature points on this face + // We assume constant distribution of traction! + for (label pointI = 0; pointI < nPoints; ++pointI) + { + const point quadPoint = faceQuadPoints[globalFaceID][pointI]; + quadPointsValue[faceI][pointI] = + plateHoleAnalyticalFields::traction + ( + quadPoint, + n[faceI], + T_, + holeR_ + ); + } + } + + return tQuadPointsValue; +} +#endif + + +// Write +void analyticalPlateHoleTractionFvPatchVectorField::write(Ostream& os) const +{ + solidTractionFvPatchVectorField::write(os); + + os.writeKeyword("farFieldTractionX") + << T_ << token::END_STATEMENT << nl; + + os.writeKeyword("holeRadius") + << holeR_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + analyticalPlateHoleTractionFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.H b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.H new file mode 100644 index 0000000..dee1471 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/analyticalPlateHoleTractionFvPatchVectorField.H @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + analyticalPlateHoleTractionFvPatchVectorField + +Description + Traction boundary condition for plateHole test case to enforce + analytical traction at the boundaries + +Author + Philip Cardiff, UCD. + Zeljko Tukovic, Zagreb. + +SourceFiles + analyticalPlateHoleTractionFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef analyticalPlateHoleTractionFvPatchVectorField_H +#define analyticalPlateHoleTractionFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "solidTractionFvPatchVectorField.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class analyticalPlateHoleTractionFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class analyticalPlateHoleTractionFvPatchVectorField +: + public solidTractionFvPatchVectorField +{ +private: + + // Private Data + + //- Far field traction + // It is assumed that it acts in the positive X direction + const scalar T_; + + //- Hole radius + const scalar holeR_; + + + // Private Member Functions + + //- Analytical solution + symmTensor plateHoleSolution(const vector& C) const; + + +public: + + //- Runtime type information + TypeName("analyticalPlateHoleTraction"); + + + // Constructors + + //- Construct from patch and internal field + analyticalPlateHoleTractionFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + analyticalPlateHoleTractionFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // analyticalPlateHoleTractionFvPatchVectorField onto a new patch + analyticalPlateHoleTractionFvPatchVectorField + ( + const analyticalPlateHoleTractionFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + analyticalPlateHoleTractionFvPatchVectorField + ( + const analyticalPlateHoleTractionFvPatchVectorField& +#ifdef OPENFOAM_ORG + ) = delete; +#else + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new analyticalPlateHoleTractionFvPatchVectorField(*this) + ); + } +#endif + + //- Construct as copy setting internal field reference + analyticalPlateHoleTractionFvPatchVectorField + ( + const analyticalPlateHoleTractionFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new analyticalPlateHoleTractionFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + +#ifndef FOAMEXTEND + //- Return face quadrature values + // Used for high order solvers, argument is position of points + virtual autoPtr> + evaluateQuadrature() const; +#endif + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.C b/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.C new file mode 100644 index 0000000..1b93b5e --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "plateHoleAnalyticalFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::symmTensor Foam::plateHoleAnalyticalFields::stress +( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius +) +{ + symmTensor sigma = symmTensor::zero; + + const scalar r = ::sqrt(sqr(C.x()) + sqr(C.y())); + const scalar theta = atan2(C.y(), C.x()); + + sigma.xx() = + farFieldTractionX + *( + 1.0 + - (sqr(holeRadius)/sqr(r))*(3*cos(2*theta)/2 + cos(4*theta)) + + (3*pow(holeRadius, 4)/(2*pow(r, 4)))*cos(4*theta) + ); + + sigma.yy() = + farFieldTractionX + *( + - (sqr(holeRadius)/sqr(r))*(cos(2*theta)/2 - cos(4*theta)) + - (3*pow(holeRadius, 4)/(2*pow(r, 4)))*cos(4*theta) + ); + + sigma.xy() = + farFieldTractionX + *( + - (sqr(holeRadius)/sqr(r))*(sin(2*theta)/2 + sin(4*theta)) + + (3*pow(holeRadius, 4)/(2*pow(r, 4)))*sin(4*theta) + ); + + return sigma; +} + + +Foam::vector Foam::plateHoleAnalyticalFields::displacement +( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar mu, + const scalar kappa +) +{ + const scalar r = ::sqrt(sqr(C.x()) + sqr(C.y())); + const scalar theta = atan2(C.y(), C.x()); + + return vector + ( + (holeRadius*farFieldTractionX/(8*mu)) + *( + (r/holeRadius)*(kappa + 1)*cos(theta) + + (2*holeRadius/r)*((1 + kappa)*cos(theta) + cos(3*theta)) + - (2*pow(holeRadius, 3)/pow(r, 3))*cos(3*theta) + ), + (holeRadius*farFieldTractionX/(8*mu)) + *( + (r/holeRadius)*(kappa - 3)*sin(theta) + + (2*holeRadius/r)*((1 - kappa)*sin(theta) + sin(3*theta)) + - (2*pow(holeRadius, 3)/pow(r, 3))*sin(3*theta) + ), + 0.0 + ); +} + + +Foam::vector Foam::plateHoleAnalyticalFields::displacement +( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar E, + const scalar nu, + const bool planeStress +) +{ + const scalar mu = E/(2*(1 + nu)); + scalar kappa = 3 - 4*nu; + + if (planeStress) + { + kappa = (3.0 - nu)/(1.0 + nu); + } + + return displacement(C, farFieldTractionX, holeRadius, mu, kappa); +} + + +Foam::scalar Foam::plateHoleAnalyticalFields::hydPressure +( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar nu +) +{ + const symmTensor sigma = stress(C, farFieldTractionX, holeRadius); + const scalar sigmaZZ = nu*(sigma.xx() + sigma.yy()); + + return -(sigma.xx() + sigma.yy() + sigmaZZ)/3; +} + + +Foam::vector Foam::plateHoleAnalyticalFields::traction +( + const vector& C, + const vector& n, + const scalar farFieldTractionX, + const scalar holeRadius +) +{ + return n & stress(C, farFieldTractionX, holeRadius); +} + + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.H b/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.H new file mode 100644 index 0000000..3954111 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/plateHole/src/plateHoleAnalyticalFields.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ +License + This file is part of solids4foam. + + solids4foam is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + solids4foam is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with solids4foam. If not, see . + +Class + plateHoleAnalyticalFields + +Description + Shared Kirsch analytical stress, displacement, pressure and traction + helpers for the plate-hole tutorials. + +SourceFiles + plateHoleAnalyticalFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef plateHoleAnalyticalFields_H +#define plateHoleAnalyticalFields_H + +#include "scalar.H" +#include "symmTensor.H" +#include "vector.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class plateHoleAnalyticalFields Declaration +\*---------------------------------------------------------------------------*/ + +class plateHoleAnalyticalFields +{ +public: + + //- Analytical stress field + static symmTensor stress + ( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius + ); + + //- Analytical displacement field + static vector displacement + ( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar mu, + const scalar kappa + ); + + //- Analytical displacement field from E and nu + static vector displacement + ( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar E, + const scalar nu, + const bool planeStress + ); + + //- Hydrostatic pressure from the analytical stress state + static scalar hydPressure + ( + const vector& C, + const scalar farFieldTractionX, + const scalar holeRadius, + const scalar nu + ); + + //- Analytical traction + static vector traction + ( + const vector& C, + const vector& n, + const scalar farFieldTractionX, + const scalar holeRadius + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun index 7623105..ab8c45b 100755 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun @@ -6,20 +6,24 @@ 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 analyticalPressurisedCylinder && ./Allwmake -j -s) +(cd src && ./Allwmake -j -s) # 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.unstruct.seg GMSH_FILE=tet-unstructured 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.snes 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.snes HOJAC=false HORES=true" - #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.snes 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.snes 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.snes HOJAC=false HORES=true TYPE=movingLeastSquares" + #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=movingLeastSquares" ) # Define start and end mesh indices @@ -56,6 +60,9 @@ cd "${RUN_DIR}" # Iterate through configurations for config in "${configs[@]}" do + # Reset variables in case a variable is not used + unset GMSH_FILE PETSC_FILE polyOrder extraCells HOJAC HORES TYPE + # Parse the configuration string eval $config echo; echo "***************************************" @@ -104,6 +111,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 diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun.kExact new file mode 100755 index 0000000..824ef33 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/Allrun.kExact @@ -0,0 +1,211 @@ +#!/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) + +# 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.unstruct.seg GMSH_FILE=tet-unstructured 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.snes 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.snes HOJAC=false HORES=true TYPE=kExactLeastSquares" + #"BASE=base/highOrder NAME=hex.struct.ho.N3 GMSH_FILE=hex-structured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=20 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=1 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=2 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet-unstructured USE_PERTURBMESHPOINTS=0 polyOrder=3 extraCells=10 PETSC_FILE=petscOptions.snes HOJAC=false HORES=true TYPE=kExactLeastSquares" +) + +# Define start and end mesh indices +# Mesh input files are defined from 1 to 6 +# END_MESH should be greater than START_MESH +START_MESH=1 +END_MESH=6 + + +# 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 case a variable is not used + unset GMSH_FILE PETSC_FILE polyOrder 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 $2}') + + # Extract the LInfinity (max) error for displacement + DISP_LINF_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + + # 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 diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/options b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/options deleted file mode 100644 index c5b1801..0000000 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/options +++ /dev/null @@ -1,12 +0,0 @@ -sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options -sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options - -EXE_INC = \ - $(VERSION_SPECIFIC_INC) \ - -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties index 4717048..5f0e64d 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..2a2e21b --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,87 @@ +set term pdfcairo dashed enhanced size 3.25,2 + +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +area = 233.9627498 + +set grid +set xrange [0.05:3] +set yrange [1e-11:1e-3] +set xtics +set xtics add (0.1, 1, 2) +set ytics +set key r bottom +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in m)" +set ylabel "Error (in m)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +set output "pressurisedCylinder-dispErrors_hex_movingVskExact.pdf" +plot \ + (2e-5 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-6 * x**3) w l ls 2 title "3^{rd} order", \ + (6e-7 * x**4) w l ls 3 title "4^{th} order", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5):($5) w lp ls 111 notitle , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5):($6) w lp ls 112 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5):($5) w lp ls 121 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5):($6) w lp ls 122 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5):($5) w lp ls 131 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5):($6) w lp ls 132 notitle + +set output "pressurisedCylinder-dispErrors_tet_movingVskExact.pdf" +plot \ + (2e-5 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-6 * x**3) w l ls 2 title "3^{rd} order", \ + (6e-7 * x**4) w l ls 3 title "4^{th} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 132 notitle \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..a5c8abb --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,87 @@ +set term pdfcairo dashed enhanced size 3.25,2 + +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +area = 233.9627498 + +set grid +set xrange [0.05:3] +set yrange [1e-11:1e-3] +set xtics +set xtics add (0.1, 1, 2) +set ytics +set key r bottom +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in m)" +set ylabel "Error (in m)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +set output "pressurisedCylinder-stressErrors_hex_movingVskExact.pdf" +plot \ + (2e-5 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-6 * x**3) w l ls 2 title "3^{rd} order", \ + (6e-7 * x**4) w l ls 3 title "4^{th} order", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N1.summary.txt" u ((area/$4)**0.5):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N2.summary.txt" u ((area/$4)**0.5):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "hex.struct.ho.N3.summary.txt" u ((area/$4)**0.5):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5):($5) w lp ls 111 notitle , \ + movingFile("hex.struct.ho.N1.summary.txt") u ((area/$4)**0.5):($6) w lp ls 112 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5):($5) w lp ls 121 notitle , \ + movingFile("hex.struct.ho.N2.summary.txt") u ((area/$4)**0.5):($6) w lp ls 122 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5):($5) w lp ls 131 notitle , \ + movingFile("hex.struct.ho.N3.summary.txt") u ((area/$4)**0.5):($6) w lp ls 132 notitle + +set output "pressurisedCylinder-stressErrors_tet_movingVskExact.pdf" +plot \ + (2e-5 * x**2) w l ls 1 title "2^{nd} order", \ + (4e-6 * x**3) w l ls 2 title "3^{rd} order", \ + (6e-7 * x**4) w l ls 3 title "4^{th} order", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($5) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((4*(area/$4)/3**0.5)**0.5):($6) w lp ls 132 notitle \ No newline at end of file diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Allwmake b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Allwmake similarity index 100% rename from papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Allwmake rename to papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Allwmake diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/files b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/files similarity index 100% rename from papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/Make/files rename to papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/files diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/options b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/options new file mode 100644 index 0000000..0397381 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/Make/options @@ -0,0 +1,27 @@ +sinclude $(SOLIDS4FOAM_DIR)/etc/wmake-options +sinclude $(SOLIDS4FOAM_DIR)/../etc/wmake-options + +EXE_INC = \ + -std=c++14 \ + -Wno-old-style-cast -Wno-deprecated-declarations \ + $(VERSION_SPECIFIC_INC) \ + -I$(SOLIDS4FOAM_DIR)/ThirdParty/eigen3 \ + -I$(SOLIDS4FOAM_DIR)/src/blockCoupledSolids4FoamTools/lnInclude \ + -I$(SOLIDS4FOAM_DIR)/src/solids4FoamModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -ldynamicFvMesh \ + -ldynamicMesh \ + -lmeshTools \ + -ltopoChangerFvMesh \ + -L$(FOAM_USER_LIBBIN) \ + -lsolids4FoamModels \ + -lblockCoupledSolids4FoamTools diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.C b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.C similarity index 84% rename from papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.C rename to papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.C index cf048ca..619659d 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.C +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.C @@ -22,6 +22,7 @@ License #include "volFields.H" #include "pointFields.H" #include "coordinateSystem.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -96,6 +97,70 @@ stress(const Foam::vector& pos) const } +void Foam::analyticalPressurisedCylinderFunctionObject:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& displacementDict = + solMod.solidModelDict() + .subDict("highOrderCoeffs") + .subDict("displacement"); + useCellAverage = + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *displacement(cellQuadPoints[cellI][pointI]); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = displacement(cellCentres[cellI]); + } + } +} + + bool Foam::analyticalPressurisedCylinderFunctionObject::writeData() { // Lookup the solid mesh @@ -151,9 +216,10 @@ bool Foam::analyticalPressurisedCylinderFunctionObject::writeData() forAll(sI, cellI) { sI[cellI] = stress(CI[cellI]); - aDI[cellI] = displacement(CI[cellI]); } + calculateAnalyticalCellDisplacement(mesh, aDI); + forAll(analyticalStress.boundaryField(), patchI) { if (mesh.boundary()[patchI].type() != "empty") diff --git a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.H b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.H similarity index 94% rename from papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.H rename to papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.H index 2da37a0..da419db 100644 --- a/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/analyticalPressurisedCylinder/analyticalPressurisedCylinderFunctionObject.H +++ b/papers/JFNK_highOrder/linearElastic/pressurisedCylinder/src/analyticalPressurisedCylinderFunctionObject.H @@ -100,6 +100,14 @@ class analyticalPressurisedCylinderFunctionObject //- Analytical stress for point symmTensor stress(const vector& pos) const; + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData(); diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun index 8e4d83c..940aea6 100755 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun @@ -6,8 +6,7 @@ source solids4FoamScripts.sh # Extend version not supported solids4Foam::caseDoesNotRunWithFoamExtend -SCRIPT_DIR="$(cd "${0%/*}" && pwd -P)" -export SOLIDS4FOAM_DIR="${SOLIDS4FOAM_DIR:-${SCRIPT_DIR}/../../../../../solids4foam-ib-2412}" +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412/ # Compile local analytical library (cd src && ./Allwmake -s) @@ -18,12 +17,12 @@ configs=( "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet" "BASE=base/segregated NAME=poly.unstruct.seg GMSH_FILE=poly" "BASE=base/snes NAME=poly.unstruct.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=poly" - "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" - "BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=movingLeastSquares" ) # Define start and end mesh indices @@ -66,7 +65,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 @@ -140,6 +139,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 diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.kExact b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.kExact new file mode 100755 index 0000000..eee85b2 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/Allrun.kExact @@ -0,0 +1,239 @@ +#!/bin/bash + +# Source required functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions +source solids4FoamScripts.sh +# Extend version not supported +solids4Foam::caseDoesNotRunWithFoamExtend + +export SOLIDS4FOAM_DIR=/Users/ivanbatistic/work/solids4foam-ib/solids4foam-ib-2412/ + +# Compile local analytical library +(cd src && ./Allwmake -s) + +# Define configurations as space-separated strings +configs=( + #"BASE=base/snes NAME=tet.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=tet" + "BASE=base/segregated NAME=tet.unstruct.seg GMSH_FILE=tet" + "BASE=base/segregated NAME=poly.unstruct.seg GMSH_FILE=poly" + "BASE=base/snes NAME=poly.unstruct.hypre PETSC_FILE=petscOptions.hypre GMSH_FILE=poly" + "BASE=base/highOrder NAME=tet.unstruct.ho.N1 GMSH_FILE=tet polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N2 GMSH_FILE=tet polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=tet.unstruct.ho.N3 GMSH_FILE=tet polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N1 GMSH_FILE=poly polyOrder=1 extraCells=45 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N2 GMSH_FILE=poly polyOrder=2 extraCells=55 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" + "BASE=base/highOrder NAME=poly.unstruct.ho.N3 GMSH_FILE=poly polyOrder=3 extraCells=65 PETSC_FILE=petscOptions.hypre HOJAC=false HORES=true TYPE=kExactLeastSquares" +) + +# Define start and end mesh indices +# Mesh input files are defined from 1 to 6 +# END_MESH should be greater than START_MESH +START_MESH=1 +END_MESH=6 + +# Compile projectPoitnToSphere +cd projectPointsToSphere +wclean +wmake +cd .. + +# 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 -r "../${BASE}" "${CASE}" + cd "$CASE" + + # Create the mesh + if command -v gmsh &> /dev/null + then + # Remporarily rename 0 to avoid issues + mv 0 0.tmp + + # Create mesh with gmsh + if [[ "$GMSH_FILE" == "tet" ]] + then + cp "gmsh/tet-meshSpacing/meshSpacing$i.geo" "gmsh/tet-meshSpacing/meshSpacing.geo" + solids4Foam::runApplication gmsh -3 -format msh2 gmsh/tet.geo + solids4Foam::runApplication gmshToFoam gmsh/tet.msh + fi + + if [[ "$GMSH_FILE" == "poly" ]] + then + cp "gmsh/poly-meshSpacing/meshSpacing$i.geo" "gmsh/poly-meshSpacing/meshSpacing.geo" + solids4Foam::runApplication gmsh -3 -format msh2 gmsh/poly.geo + solids4Foam::runApplication gmshToFoam gmsh/poly.msh + solids4Foam::runApplication polyDualMesh 30 -overwrite + solids4Foam::runApplication combinePatchFaces 45 -overwrite + fi + solids4Foam::runApplication changeDictionary + solids4Foam::runApplication checkMesh + + # Move 0 back + mv 0.tmp 0 + else + echo; echo "Gmsh is required to run this case: please install it" + exit 1 + fi + + # Project the cavity patch to a sphere to avoid write precision issue + solids4Foam::runApplication projectPointsToSphere cavity "(0 0 0)" 0.2 + mv 1/polyMesh/points constant/polyMesh/points + rm -rf 1/meshPhi 1/pointMotion 1/polyMesh + + # 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 $2}') + + # Extract the LInfinity (max) error for displacement + DISP_LINF_ERROR=$(grep "Writing DDifference field" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + + # Extract the L2 (average) error for sigma_zz + STRESS_L2_ERROR=$(grep "Component: 5" -A 2 log.solids4Foam | tail -1 | awk '{print $2}') + + # Extract the LInfinity (max) error for sigma_zz + STRESS_LINF_ERROR=$(grep "Component: 5" -A 2 log.solids4Foam | tail -1 | awk '{print $3}') + + # 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 diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties index dfa3965..87b8c18 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/base/highOrder/constant/solidProperties @@ -33,6 +33,7 @@ linearGeometryTotalDisplacementCoeffs displacement { + type movingLeastSquares; polynomialOrder 2; faceStencilExtraCells 10; diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..c3feb56 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/dispErrors_movingVskExact.gnuplot @@ -0,0 +1,88 @@ +set term pdfcairo dashed enhanced size 3.25, 2 + +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c dispErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +volume = 0.104056049 + +set grid +set xrange [20:80] +set yrange [1e-12:1e-07] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in m)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +#set xrange [25:85] +set output "sphericalCavity_dispErrors_tet_movingVskExact.pdf" +plot \ + (5e-12 * x**2) w l ls 1 title "2^{nd} order",\ + (0.8e-14 * x**3) w l ls 2 title "3^{rd} order",\ + (0.8e-16 * x**4) w l ls 3 title "4^{th} order",\ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($5) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($6) w lp ls 132 notitle + +set output "sphericalCavity_dispErrors_poly_movingVskExact.pdf" +set xrange [15:80] +plot \ + (5e-12 * x**2) w l ls 1 title "2^{nd} order",\ + (0.8e-14 * x**3) w l ls 2 title "3^{rd} order",\ + (0.8e-16 * x**4) w l ls 3 title "4^{th} order",\ + "poly.unstruct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.unstruct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.unstruct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.unstruct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.unstruct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.unstruct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("poly.unstruct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 111 notitle , \ + movingFile("poly.unstruct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 112 notitle , \ + movingFile("poly.unstruct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 121 notitle , \ + movingFile("poly.unstruct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 122 notitle , \ + movingFile("poly.unstruct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($5) w lp ls 131 notitle , \ + movingFile("poly.unstruct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($6) w lp ls 132 notitle diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot b/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot new file mode 100644 index 0000000..b083604 --- /dev/null +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/comparisonPlotScripts/stressErrors_movingVskExact.gnuplot @@ -0,0 +1,90 @@ +set term pdfcairo dashed enhanced size 3.25, 2 +set datafile separator " " + +if (ARGC < 1) { + print "Usage: gnuplot -c stressErrors_movingVskExact.gnuplot " + exit +} + +movingResults = ARG1 +movingFile(fileName) = sprintf("%s/%s", movingResults, fileName) + +volume = 0.104056049 + +set grid +set xrange [20:80] +#set yrange [1e-3:100] +set xtics +set xtics add (5, 25, 50) +set ytics +set logscale x +set logscale y +set format y "10^{%L}" +#set ytics 0.002 +set xlabel "Average cell edge (in mm)" +set ylabel "Error (in MPa)" +set key right bottom outside; +set rmargin 16 +set key spacing 1.2 + +# Polynomial guide lines (no title) +set style line 1 lc rgb "red" lt 2 lw 2 dt 2 +set style line 2 lc rgb "blue" lt 2 lw 2 dt 2 +set style line 3 lc rgb "violet" lt 2 lw 2 dt 2 + +# Data lines for each p-order (with titles) +set style line 11 lc rgb "red" pt 7 ps 0.5 lw 1 +set style line 12 lc rgb "red" pt 6 ps 0.5 lw 1 +set style line 21 lc rgb "blue" pt 5 ps 0.5 lw 1 +set style line 22 lc rgb "blue" pt 4 ps 0.5 lw 1 +set style line 31 lc rgb "violet" pt 9 ps 0.5 lw 1 +set style line 32 lc rgb "violet" pt 8 ps 0.5 lw 1 + +# Moving-least-squares data use the same colours with 50% transparency +set style line 111 lc rgb "#B3ff0000" pt 7 ps 0.5 lw 1 +set style line 112 lc rgb "#B3ff0000" pt 6 ps 0.5 lw 1 +set style line 121 lc rgb "#B30000ff" pt 5 ps 0.5 lw 1 +set style line 122 lc rgb "#B30000ff" pt 4 ps 0.5 lw 1 +set style line 131 lc rgb "#B3ee82ee" pt 9 ps 0.5 lw 1 +set style line 132 lc rgb "#B3ee82ee" pt 8 ps 0.5 lw 1 + +set style line 50 lc rgb "orange" pt 11 ps 0.5 lw 1 + +set output "sphericalCavity_stressErrors_tet_movingVskExact.pdf" +plot \ + (5e-4 * x) w l ls 1 title "1^{st} order",\ + (11e-7 * x**2) w l ls 2 title "2^{nd} order",\ + (1e-8 * x**3) w l ls 3 title "3^{rd} order",\ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N1.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N2.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "tet.unstruct.ho.N3.summary.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)", \ + NaN w l lc rgb "white" title " ", \ + "tet.unstruct.ho.N3.summary.zeroTraction.txt" u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 50 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}^{_*}_{ }=3)" , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle , \ + movingFile("tet.unstruct.ho.N1.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle , \ + movingFile("tet.unstruct.ho.N2.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle , \ + movingFile("tet.unstruct.ho.N3.summary.txt") u ((8.48528*(volume/$4))**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle + +set output "sphericalCavity_stressErrors_poly_movingVskExact.pdf" +set xrange [15:80] +plot \ + (5e-4 * x) w l ls 1 title "1^{st} order",\ + (11e-7 * x**2) w l ls 2 title "2^{nd} order",\ + (1e-8 * x**3) w l ls 3 title "3^{rd} order",\ + "poly.unstruct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 11 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=1)", \ + "poly.unstruct.ho.N1.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 12 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=1)", \ + "poly.unstruct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 21 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=2)", \ + "poly.unstruct.ho.N2.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 22 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=2)", \ + "poly.unstruct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 31 title "{/Times-Italic L}_{ 2} ({/Times-Italic p}_{ }=3)", \ + "poly.unstruct.ho.N3.summary.txt" u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 32 title "{/Times-Italic L}_{ ∞} ({/Times-Italic p}_{ }=3)" , \ + movingFile("poly.unstruct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 111 notitle , \ + movingFile("poly.unstruct.ho.N1.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 112 notitle , \ + movingFile("poly.unstruct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 121 notitle , \ + movingFile("poly.unstruct.ho.N2.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 122 notitle , \ + movingFile("poly.unstruct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($7*1e-6) w lp ls 131 notitle , \ + movingFile("poly.unstruct.ho.N3.summary.txt") u ((6*(volume/$4)/pi)**(1.0/3.0)*1e3):($8*1e-6) w lp ls 132 notitle diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C index a93764e..d4680bc 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/analyticalSphericalCavityTraction/analyticalSphericalCavityTractionFvPatchVectorField.C @@ -163,7 +163,7 @@ analyticalSphericalCavityTractionFvPatchVectorField::evaluateQuadrature() const // faceQuadPoints is list for the whole mesh const CompactListList& faceQuadPoints = - solMod.displacementMLS().quadrature().faceQuadPoints(); + solMod.displacementLeastSquares().quadrature().faceQuadPoints(); labelList nQpPerFace(this->size(), 0); const label start = this->patch().start(); diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C index 9d8974e..7ded938 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.C @@ -24,6 +24,7 @@ License #include "sphericalCavityStressDisplacement.H" #include "OSspecific.H" #include "compatibilityFunctions.H" +#include "lookupSolidModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -42,6 +43,80 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::sphericalCavityAnalyticalSolution:: +calculateAnalyticalCellDisplacement +( + const fvMesh& mesh, + vectorField& analyticalD +) +{ + const solidModel& solMod = lookupSolidModel(mesh); + bool useCellAverage = false; + + if (solMod.highOrderResidual()) + { + const dictionary& displacementDict = + solMod.solidModelDict() + .subDict("highOrderCoeffs") + .subDict("displacement"); + useCellAverage = + displacementDict.lookupOrDefault + ( + "type", + "movingLeastSquares" + ) == "kExactLeastSquares"; + } + + if (useCellAverage) + { + const fvMeshQuadrature& quadrature = + solMod.displacementLeastSquares().quadrature(); + const CompactListList& cellQuadPoints = + quadrature.cellQuadPoints(); + const CompactListList& cellQuadWeights = + quadrature.cellQuadWeights(); + const scalarField& cellVolumes = mesh.V(); + + Info<< "Using cell-average analytical displacement" << endl; + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = vector::zero; + + forAll(cellQuadPoints[cellI], pointI) + { + analyticalD[cellI] += + cellQuadWeights[cellI][pointI] + *sphericalCavityDisplacement + ( + nu_, + T0_, + E_, + cavityR_, + cellQuadPoints[cellI][pointI] + ); + } + + analyticalD[cellI] /= cellVolumes[cellI]; + } + } + else + { + Info<< "Using point-valued analytical displacement" << endl; + + const vectorField& cellCentres = mesh.C().internalField(); + + forAll(analyticalD, cellI) + { + analyticalD[cellI] = + sphericalCavityDisplacement + ( + nu_, T0_, E_, cavityR_, cellCentres[cellI] + ); + } + } +} + bool Foam::sphericalCavityAnalyticalSolution::writeData() { @@ -123,14 +198,11 @@ bool Foam::sphericalCavityAnalyticalSolution::writeData() sphericalCavityStress(T0_, nu_, cavityR_, CI[cellI]); } - if (cellDisplacement_) - { - aDI[cellI] = - sphericalCavityDisplacement - ( - nu_, T0_, E_, cavityR_, CI[cellI] - ); - } + } + + if (cellDisplacement_) + { + calculateAnalyticalCellDisplacement(mesh, aDI); } forAll(analyticalStress.boundaryField(), patchI) diff --git a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H index 2bda22d..819daf6 100644 --- a/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H +++ b/papers/JFNK_highOrder/linearElastic/sphericalCavity/src/sphericalCavityAnalyticalSolution/sphericalCavityAnalyticalSolution.H @@ -115,6 +115,14 @@ class sphericalCavityAnalyticalSolution // Private Member Functions + //- Calculate analytical cell displacement using the selected + // reconstruction semantics + void calculateAnalyticalCellDisplacement + ( + const fvMesh& mesh, + vectorField& analyticalD + ); + //- Write data bool writeData();