From fc663e07c9951d219fe6bab6b83998e2af82ab12 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 5 Aug 2026 16:45:05 +0200 Subject: [PATCH] Trying to tune te perpendicular-flap/solid-solids4foam case: PETScSNES --- .../mechanicalProperties.withDefaultValues | 24 +++++++++ .../constant/solidProperties | 12 +---- .../solidProperties.withDefaultValues | 50 +++++++++++++++++++ .../solid-solids4foam/system/fvSchemes | 4 +- .../solid-solids4foam/system/fvSolution | 49 ++++++++++-------- 5 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 perpendicular-flap/solid-solids4foam/constant/mechanicalProperties.withDefaultValues create mode 100644 perpendicular-flap/solid-solids4foam/constant/solidProperties.withDefaultValues diff --git a/perpendicular-flap/solid-solids4foam/constant/mechanicalProperties.withDefaultValues b/perpendicular-flap/solid-solids4foam/constant/mechanicalProperties.withDefaultValues new file mode 100644 index 000000000..d8e337906 --- /dev/null +++ b/perpendicular-flap/solid-solids4foam/constant/mechanicalProperties.withDefaultValues @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2512 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + arch "LSB;label=32;scalar=64"; + class dictionary; + location "constant"; + object mechanicalProperties.withDefaultValues; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +planeStress no; + +mechanical 1 ( rubber { type linearElastic ; rho rho [ 1 -3 0 0 0 0 0 ] 3000 ; E E [ 1 -1 -2 0 0 0 0 ] 4e+06 ; nu nu [ 0 0 0 0 0 0 0 ] 0.3 ; solvePressureEqn false ; pressureSmoothingScaleFactor 100 ; } ; ); + + +// ************************************************************************* // diff --git a/perpendicular-flap/solid-solids4foam/constant/solidProperties b/perpendicular-flap/solid-solids4foam/constant/solidProperties index 183eead5c..497fd981c 100644 --- a/perpendicular-flap/solid-solids4foam/constant/solidProperties +++ b/perpendicular-flap/solid-solids4foam/constant/solidProperties @@ -10,16 +10,6 @@ solidModel linearGeometryTotalDisplacement; linearGeometryTotalDisplacementCoeffs { - // Maximum number of momentum correctors - nCorrectors 1000; - - // Solution tolerance for displacement - solutionTolerance 1e-08; - - // Alternative solution tolerance for displacement - alternativeTolerance 1e-08; - - // Write frequency for the residuals - infoFrequency 100; + solutionAlgorithm PETScSNES; } diff --git a/perpendicular-flap/solid-solids4foam/constant/solidProperties.withDefaultValues b/perpendicular-flap/solid-solids4foam/constant/solidProperties.withDefaultValues new file mode 100644 index 000000000..fa7d5e127 --- /dev/null +++ b/perpendicular-flap/solid-solids4foam/constant/solidProperties.withDefaultValues @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2512 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + arch "LSB;label=32;scalar=64"; + class dictionary; + location "constant"; + object solidProperties.withDefaultValues; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solidModel linearGeometryTotalDisplacement; + +linearGeometryTotalDisplacementCoeffs +{ + solutionAlgorithm PETScSNES; + dampingCoeff dampingCoeff [ 0 0 -1 0 0 0 0 ] 0; + solutionTolerance 1e-06; + alternativeTolerance 1e-07; + materialTolerance 1e-05; + infoFrequency 100; + nCorrectors 10000; + writeResidualField false; + relaxationMethod fixed; + restart false; + residualFile false; + stabilisation + { + momentum + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + pressure + { + type diffStencilLaplacian; + scaleFactor 0.1; + } + } +} + + +// ************************************************************************* // diff --git a/perpendicular-flap/solid-solids4foam/system/fvSchemes b/perpendicular-flap/solid-solids4foam/system/fvSchemes index 842fba231..6f42f025a 100644 --- a/perpendicular-flap/solid-solids4foam/system/fvSchemes +++ b/perpendicular-flap/solid-solids4foam/system/fvSchemes @@ -18,7 +18,7 @@ ddtSchemes gradSchemes { - default leastSquaresS4f 0; + default leastSquaresS4f; } divSchemes @@ -28,7 +28,7 @@ divSchemes laplacianSchemes { - default none; + default Gauss linear corrected; laplacian(DD,D) Gauss linear corrected; laplacian(DDD,DD) Gauss linear corrected; } diff --git a/perpendicular-flap/solid-solids4foam/system/fvSolution b/perpendicular-flap/solid-solids4foam/system/fvSolution index 69fc05a9c..d26fb80f9 100644 --- a/perpendicular-flap/solid-solids4foam/system/fvSolution +++ b/perpendicular-flap/solid-solids4foam/system/fvSolution @@ -1,3 +1,12 @@ +/*--------------------------------*- 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; @@ -6,33 +15,31 @@ FoamFile location "system"; object fvSolution; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { - "D|DD" + D { - solver PCG; - preconditioner FDIC; - tolerance 1e-09; - relTol 0.1; - } -} + solver petsc; -relaxationFactors -{ - // Under-relaxating the D equation by 0.99-0.9999 can improve convergence in - // some cases, in particular when there are solidContact boundaries - equations - { - //D 0.999; - } + options + { + snes_type newtonls; + snes_monitor; + snes_converged_reason; + snes_mf; + snes_mf_operator; - // Under-relaxating the D field by 0.1-0.9 can improve convergence in some - // cases - fields - { - //D 0.9; + ksp_type lgmres; + ksp_gmres_restart "100"; + ksp_converged_reason; + + pc_type lu; + snes_lag_preconditioner_persists true; + snes_lag_preconditioner "-2"; + } } } - +// ************************************************************************* //