From 8141282b1de6f35c6cbf6326810ecc27de6c8aea Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Thu, 18 Jul 2013 03:43:15 +0200 Subject: [PATCH] Convert tabs to fours spaces systematically --- CMakeLists.txt | 4 +- COPYING | 14 +- README | 8 +- .../porousInterFoam/createPorousZones.H | 6 +- .../calculateDivDSigmaExp.H | 82 +- .../correctGlobalFaceZoneMesh.H | 211 +++-- .../createFields.H | 26 +- .../createGlobalToLocalFaceZonePointMap.H | 169 ++-- .../createSolidInterface.H | 26 +- .../elasticContactIncrSolidFoam.C | 136 +-- .../moveMeshLeastSquares.H | 51 +- .../printContactResults.H | 60 +- .../readDivDSigmaExpMethod.H | 16 +- .../elasticContactIncrSolidFoam/writeFields.H | 97 +-- .../calculateDivDSigmaExp.H | 82 +- .../calculateDivDSigmaExpLargeStrain.H | 50 +- .../calculateExtrapolationVectors.H | 81 +- .../calculatePointBoundaryWeights.H | 206 ++--- .../correctGlobalFaceZoneMesh.H | 211 +++-- .../createFields.H | 40 +- .../createGlobalToLocalFaceZonePointMap.H | 166 ++-- .../elasticContactNonLinULSolidFoam.C | 181 ++-- .../findBoundaryPoints.H | 32 +- .../moveMesh.H | 24 +- .../moveMeshInverseDistance.H | 59 +- .../moveMeshLeastSquares.H | 51 +- ...erformEdgeCorrectedVolPointInterpolation.H | 138 +-- .../printContactResults.H | 60 +- .../readDivDSigmaExpMethod.H | 16 +- .../writeFields.H | 52 +- .../calculateDivSigmaExp.H | 83 +- .../correctGlobalFaceZoneMesh.H | 211 +++-- .../elasticContactSolidFoam/createFields.H | 20 +- .../createGlobalToLocalFaceZonePointMap.H | 166 ++-- .../elasticContactSolidFoam.C | 192 ++--- .../moveMeshLeastSquares.H | 51 +- .../printContactResults.H | 60 +- .../readDivSigmaExpMethod.H | 4 +- .../elasticContactSolidFoam/writeFields.H | 52 +- .../calculateDivSigmaExp.H | 83 +- .../elasticGravitySolidFoam/createFields.H | 18 +- .../createSolidInterface.H | 24 +- .../elasticGravitySolidFoam.C | 150 ++-- .../readDivSigmaExpMethod.H | 16 +- .../elasticGravitySolidFoam/writeFields.H | 52 +- .../calculateDivDSigmaExp.H | 84 +- .../elasticIncrSolidFoam/createFields.H | 18 +- .../createSolidInterface.H | 24 +- .../elasticIncrSolidFoam.C | 154 ++-- .../readDivDSigmaExpMethod.H | 16 +- .../elasticIncrSolidFoam/writeFields.H | 52 +- .../writeForceDisplacement.H | 33 +- .../correctDirectionMixedTL.H | 56 +- .../elasticNonLinTLSolidFoam/createFields.H | 2 +- .../elasticNonLinTLSolidFoam.C | 137 +-- .../moveMeshLeastSquares.H | 51 +- .../elasticNonLinTLSolidFoam/writeFields.H | 126 +-- .../calculateDivDSigmaExp.H | 84 +- .../calculateDivDSigmaLargeStrainExp.H | 48 +- .../calculateExtrapolationVectors.H | 81 +- .../calculatePointBoundaryWeights.H | 206 ++--- .../elasticNonLinULSolidFoam/createFields.H | 48 +- .../createSolidInterface.H | 34 +- .../elasticNonLinULSolidFoam.C | 206 ++--- .../findBoundaryPoints.H | 14 +- .../elasticNonLinULSolidFoam/moveMesh.H | 26 +- .../moveMeshInverseDistance.H | 55 +- .../moveMeshLeastSquares.H | 51 +- ...erformEdgeCorrectedVolPointInterpolation.H | 138 +-- .../readDivDSigmaExpMethod.H | 19 +- .../elasticNonLinULSolidFoam/writeFields.H | 52 +- .../calculateDivDSigmaExp.H | 84 +- .../calculateDivDSigmaLargeStrainExp.H | 50 +- .../calculateExtrapolationVectors.H | 81 +- .../calculatePointBoundaryWeights.H | 206 ++--- .../createFields.H | 52 +- .../createSolidInterface.H | 34 +- .../elasticPlasticNonLinULSolidFoam.C | 198 ++--- .../findBoundaryPoints.H | 32 +- .../moveMesh.H | 24 +- .../moveMeshInverseDistance.H | 59 +- .../moveMeshLeastSquares.H | 51 +- ...erformEdgeCorrectedVolPointInterpolation.H | 138 +-- .../readDivDSigmaExpMethod.H | 19 +- .../writeFields.H | 80 +- .../calculateDivDSigmaExp.H | 78 +- .../elasticPlasticSolidFoam/createFields.H | 32 +- .../createSolidInterface.H | 24 +- .../elasticPlasticSolidFoam.C | 168 ++-- .../readDivDSigmaExpMethod.H | 16 +- .../elasticPlasticSolidFoam/writeFields.H | 80 +- .../elasticSolidFoam/calculateDivSigmaExp.H | 84 +- .../elasticSolidFoam/createFields.H | 18 +- .../elasticSolidFoam/createSolidInterface.H | 24 +- .../elasticSolidFoam/elasticSolidFoam.C | 142 ++-- .../elasticSolidFoam/readDivSigmaExpMethod.H | 4 +- .../elasticSolidFoam/writeFields.H | 52 +- .../calculateSigmaExp.H | 70 +- .../elasticThermalSolidFoam.C | 154 ++-- .../readSigmaExpMethod.H | 4 +- .../updateLoadingPatch.H | 46 +- .../elasticThermalSolidFoam/writeFields.H | 52 +- .../calculateLiftAndDrag.H | 32 +- .../createStressFields.H | 16 +- .../icoFsiElasticNonLinULSolidFoam.C | 4 +- .../moveSolidMeshLeastSquares.H | 45 +- .../readCouplingProperties.H | 12 +- .../contactModel/contactPatchPair.C | 270 +++--- .../contactModel/contactPatchPair.H | 8 +- .../contactModel/contactPatchPairCorrect.C | 474 ++++++----- .../solidModels/contactModel/contactProblem.C | 202 +++-- .../solidModels/contactModel/contactProblem.H | 4 +- ...ticalPlateHoleTractionFvPatchVectorField.C | 26 +- .../cohesiveZoneFvPatchVectorField.C | 6 +- ...ohesiveZoneIncrementalFvPatchVectorField.C | 24 +- .../fixedDisplacementFvPatchVectorField.C | 6 +- ...dDisplacementZeroShearFvPatchVectorField.C | 70 +- ...dDisplacementZeroShearFvPatchVectorField.H | 10 +- .../fixedRotationFvPatchVectorField.C | 8 +- .../solidTractionFvPatchVectorField.C | 138 +-- .../solidTractionFvPatchVectorField.H | 10 +- .../solidTractionFreeFvPatchVectorField.C | 86 +- .../solidTractionFreeFvPatchVectorField.H | 10 +- ...meVaryingSolidTractionFvPatchVectorField.C | 6 +- ...meVaryingSolidTractionFvPatchVectorField.H | 4 +- .../leastSquaresVolPointInterpolation.C | 480 +++++------ .../leastSquaresVolPointInterpolation.H | 2 +- .../plasticityModel/plasticityModel.C | 200 +++-- .../nonLinearElasticPlastic.C | 2 +- .../solidInterface/solidInterface.C | 8 +- .../slidingBallIncr/constant/timeVsTopDisp | 8 +- .../slidingBallIncr/system/fvSolution | 48 +- .../slidingBallNonLin/0/DU | 12 +- .../slidingBallNonLin/constant/timeVsTopDisp | 8 +- .../slidingBallNonLin/system/fvSolution | 48 +- .../elasticContactSolidFoam/slidingBall/0/U | 2 +- .../slidingBall/constant/timeVsTopDisp | 4 +- .../slidingBall/system/fvSolution | 48 +- .../sphereAndBrick/system/fvSolution | 48 +- .../sphereAndBrick/system/sampleDict | 6 +- .../constant/polyMesh/blockMeshDict | 24 +- .../constant/timeVsTopDisplacement | 4 +- .../gravityBlock/system/fvSolution | 14 +- .../gravityBlock/system/sampleDict | 16 +- .../gravityBlock/system/sampleDict.old | 16 +- .../largeStrainCantileverBeam/0/U | 56 +- .../constant/timeVsTopDisp | 4 +- .../elasticNonLinTLSolidFoam/nonLinBlock/0/U | 42 +- .../nonLinBlock/constant/timeVsTopDisp | 4 +- .../rotateSphereTL/forceDisp.dat | 2 +- .../rotateSphereTL/system/fvSchemes | 16 +- .../system/surfaceSubset/fvSchemes | 12 +- .../rotateSphere/system/fvSchemes | 16 +- .../system/surfaceSubset/fvSchemes | 12 +- .../system/fvSchemes | 20 +- .../system/fvSchemes | 20 +- .../constant/polyMesh/blockMeshDict | 50 +- .../constant/timeVsTopDisplacement | 4 +- .../bimaterialCase/system/fvSolution | 14 +- .../bimaterialCase/system/sampleDict | 16 +- .../bimaterialCase/system/sampleDict.old | 16 +- .../elasticSolidFoam/crackingSENT/0/U | 37 +- .../crackingSENT/constant/timeVsTopDisp | 4 +- .../analyticalPlateHole/analyticalPlateHole.C | 62 +- .../analyticalHotCylinder.C | 573 ++++++------- .../HronTurekFsi/fluid/system/fvSolution | 86 +- .../HronTurekFsi/info.txt | 46 +- .../HronTurekFsi/solid/0/DU | 2 +- .../HronTurekFsi/solid/system/fvSchemes | 4 +- .../HronTurekFsi/solid/system/fvSolution | 12 +- .../system/faSolution | 6 +- .../system/fvSchemes | 4 +- .../system/fvSolution | 18 +- .../foamMeshToAbaqus/foamMeshToAbaqus.C | 788 +++++++++--------- .../patchStressIntegrate.C | 12 +- .../setMatFromCellZones/setMatFromCellZones.C | 36 +- .../calculateSigmaDSigmaCorr.H | 137 ++- .../viscoElasticSolidFoam.C | 121 ++- .../viscoElasticSolidFoam/writeFields.H | 80 +- .../Optional/ccm26ToFoam/ccm26ToFoam.C | 98 +-- .../conversion/gmshToFoam/gmsh/mesh-1.geo | 8 +- .../gmshToFoam/piece-extr-rec.msh.gz | Bin 322526 -> 322500 bytes .../conversion/kivaToFoam/kiva3v-valves.pdf | Bin 112123 -> 112096 bytes .../star4ToFoam/fStar-utils/fStar-cellSets | 192 ++--- .../star4ToFoam/fStar-utils/fStar-cellTable | 62 +- .../star4ToFoam/fStar-utils/fStar-coordinates | 28 +- .../star4ToFoam/star4ToFoam/README.cellTable | 2 +- .../star4ToFoam/star4ToFoam/meshReader.H | 24 +- .../star4ToFoam/star4ToFoam/meshReaderAux.C | 6 +- .../star4ToFoam/star4ToFoam/starMeshReader.H | 8 +- .../conversion/tetgenToFoam/tetgenToFoam.C | 28 +- .../manipulation/flattenMesh/Make/options | 2 +- .../decomposePar/domainDecomposition.C | 2 +- .../foamDataToFluent/fluentUnitNumbers.txt | 18 +- .../ensightOutputFunctions.C | 4 +- .../foamToFieldview9/fv_reader_tags.h | 12 +- .../foamToFieldview9/write_binary_uns.c | 494 +++++------ .../tecio/examples/comtest/comtest.f | 124 +-- .../tecio/examples/comtest/comtest.f90 | 2 +- .../tecio/examples/comtest/comtestc.vcproj | 692 +++++++-------- .../examples/gridsolution/gridsolution.vcproj | 642 +++++++------- .../tecio/examples/simtest/simtest.f | 2 +- .../tecio/examples/simtest/simtestc.vcproj | 692 +++++++-------- .../foamToTecplot360/tecio2009.zip | Bin 1314306 -> 1314197 bytes .../graphics/PV3FoamReader/Allwmake | 10 +- .../PVFoamReader/Make/PVFoamReader.pvsm | 8 +- .../PVFoamReader/PVFoamReader.pvsm.in | 8 +- .../graphics/ensightFoamReader/README | 18 +- .../graphics/ensightFoamReader/README7 | 18 +- .../ensightFoamReader/README_USERD_1.0 | 12 +- .../ensightFoamReader/README_USERD_2.0 | 12 +- .../ensightFoamReader/README_USERD_2.01 | 12 +- .../ensightFoamReader/README_USERD_2.03 | 12 +- .../fieldview9Reader/fieldview9Reader.C | 8 +- .../graphics/newEnsightFoamReader/README | 18 +- .../graphics/newEnsightFoamReader/README7 | 18 +- .../newEnsightFoamReader/README_USERD_1.0 | 12 +- .../newEnsightFoamReader/README_USERD_2.0 | 12 +- .../newEnsightFoamReader/README_USERD_2.01 | 12 +- .../newEnsightFoamReader/README_USERD_2.03 | 12 +- .../stressDifferences/stressDifferences.C | 52 +- .../fluentDataToFoam/fluentUnitNumbers.txt | 18 +- .../preProcessing/mapFields/mapLagrangian.C | 2 +- .../surface/surfaceCoarsen/surfaceCoarsen.C | 8 +- bin/foamGetSystemInfo | 20 +- bin/foamLog | 2 +- bin/foamVersion | 16 +- bin/mpigammarun | 184 ++-- etc/apps/paraview3/bashrc | 32 +- etc/bashrc | 36 +- etc/cshrc | 18 +- etc/settings.csh | 54 +- etc/settings.sh | 48 +- src/ODE/ODESolvers/RK/RK.C | 26 +- src/ODE/sixDOF/sixDOFqODE/sixDOFqODE.H | 2 +- src/OSspecific/POSIX/fileStat.C | 2 +- .../polygon/clipping/SutherlandHodgmanI.H | 2 +- .../GGIInterpolationQuickRejectTests.C | 6 +- .../MixingPlaneInterpolation.H | 10 +- .../RBFInterpolation/RBFInterpolation.H | 10 +- .../BlockLduMatrix/BlockLduMatrix.C | 4 +- .../BlockLduMatrix/BlockLduMatrix.H | 10 +- .../polyPatches/derived/wall/wallPolyPatch.H | 2 +- src/Pstream/gamma/Pstream.C | 6 +- src/Pstream/mpi/Pstream.C | 4 +- src/conversion/meshTables/README | 2 +- .../meshWriter/starcd/STARCDMeshWriter.C | 2 +- .../msqAdditonalSrc/Mesh/PatchData.hpp | 128 +-- .../msqAdditonalSrc/compile.sh | 18 +- .../cellQuality/cellQuality.C | 174 ++-- .../pseudoSolidTetDecompositionMotionSolver.C | 2 +- ...dValvesFacesPointZonesEngineValveSliding.H | 2 +- .../engineValveSliding/engineValveSliding.H | 2 +- ...otionBoundaryConditionEngineValveSliding.H | 2 +- .../layerSmooth/layerSmooth.H | 2 +- .../addValvesFacesPointZonesPistonSliding.H | 2 +- .../pistonSliding/pistonSliding.H | 2 +- .../poppetDeformationPistonSliding.H | 4 +- ...alveMotionBoundaryConditionPistonSliding.H | 2 +- .../setValveMotionBoundaryConditionThobois.H | 2 +- .../addValvesFacesPointZonesThoboisSliding.H | 2 +- .../moveTopOfTheValvesThoboisSliding.H | 4 +- .../moveValvePointsThoboisSliding.H | 4 +- .../poppetDeformationThoboisSliding.H | 4 +- ...lveMotionBoundaryConditionThoboisSliding.H | 2 +- .../thoboisSliding/thoboisSliding.H | 2 +- .../verticalValves/verticalValves.H | 2 +- .../thoboisSlidingValve/thoboisSlidingValve.H | 4 +- src/engine/thoboisValve/thoboisValve.H | 2 +- .../mixingPlane/traceMixingPlaneFlux.H | 15 +- .../definedInjector/definedInjector.C | 10 +- .../molecularDynamics/molecule/Make/options | 2 +- src/multiSolver/Make/options | 4 +- .../mixingPlaneCheckFunctionObject.C | 10 +- .../hsCombustionThermo/hsCombustionThermo.H | 2 +- .../Turbomachinery/CMakeFiles/CMakeLists.txt | 2 +- testHarness/OSIG/Turbomachinery/README.txt | 2 +- .../scripts/prepareCasesForOneTimeStep.sh | 10 +- .../scripts/prepareCasesForTestHarness.sh | 6 +- .../1.6-ext/CMakeFiles/CMakeLists.txt | 4 +- .../scripts/addMissingAllrunFileToTutorial.sh | 4 +- .../scripts/prepareCasesForOneTimeStep.sh | 10 +- .../scripts/prepareCasesForTestHarness.sh | 8 +- .../xFig/2dView.fig | 2 +- .../xFig/grid.fig | 2 +- .../xFig/planes.fig | 2 +- .../laplacianFoam/twoBlocksMixingPlane/Allrun | 28 +- .../twoBlocksMixingPlaneMismatch/Allrun | 28 +- .../dieselFoam/aachenBomb/chemkin/chem.inp | 4 +- .../dieselFoam/aachenBomb/chemkin/chem.inp.1 | 4 +- .../dieselFoam/aachenBomb/chemkin/chem.inp_15 | 10 +- .../rhoCentralFoam/LadenburgJet60psi/0.org/T | 2 +- .../rhoCentralFoam/LadenburgJet60psi/0.org/p | 2 +- .../constant/polyMesh/blockMeshDict | 2 +- .../periodicCubeArgon/system/decomposeParDict | 2 +- .../periodicCubeWater/system/decomposeParDict | 2 +- .../constant/polyMesh/blockMeshDict | 148 ++-- .../constant/polyMesh/blockMeshDict | 2 +- .../constant/polyMesh/blockMeshDict | 2 +- .../RBFMotionFunctionObject.C | 2 +- .../movingBlockRBF/system/controlDict | 12 +- .../movingBlockRBF/system/fvSolution | 4 +- .../incompressible/icoFoam/elbow/elbow.msh | 8 +- .../Allrun | 28 +- .../twoBlocksMixingPlane_dirY_spanZ/Allrun | 28 +- .../twoBlocksMixingPlane_dirZ_spanY/Allrun | 28 +- .../simpleFoam/mixingPlaneAxial/Allrun | 28 +- .../constant/polyMesh/blockMeshDict.m4 | 10 +- .../simplifiedSiwek/chemkin/foam.dat | 36 +- .../channelParticles/customRegexp | 12 +- .../circCylinder3dHex/system/fvSchemes | 14 +- .../nozzle/system/fvSchemes | 10 +- .../bed/constant/interfacialProperties | 2 +- .../constant/interfacialProperties | 6 +- .../bubbleInterTrackFoam/bubble2D_r0.75mm/0/U | 2 +- .../bubbleInterTrackFoam/bubble2D_r0.75mm/0/p | 2 +- .../viscoelasticFluidFoam/DCPP/README | 12 +- .../viscoelasticFluidFoam/FENE-P/README | 12 +- .../viscoelasticFluidFoam/Giesekus/README | 12 +- .../viscoelasticFluidFoam/PTT-Linear/README | 10 +- wmake/rules/linuxPPC64Gcc/mplibSYSTEMOPENMPI | 2 +- 321 files changed, 8612 insertions(+), 8598 deletions(-) mode change 120000 => 100644 wmake/rules/linuxPPC64Gcc/mplibSYSTEMOPENMPI diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4298e5a..a2b1f2914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ IF (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "") # $CDASH_SUBMIT_LOCAL_HOST_ID SET( SITENAME $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} - CACHE STRING "Name of the local site" + CACHE STRING "Name of the local site" ) ELSE (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "") # Grab the hostname FQN; will be used for the sitename @@ -128,7 +128,7 @@ if(GIT_FOUND) if (GIT_BRANCH_NAME STREQUAL "") message("No git-branch. Mercurial?") EXEC_PROGRAM(hg - ARGS branch + ARGS branch OUTPUT_VARIABLE GIT_BRANCH_NAME ) message("Git branch (mercurial): ${GIT_BRANCH_NAME}") diff --git a/COPYING b/COPYING index 18314ff77..ef7ab2332 100644 --- a/COPYING +++ b/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/README b/README index e9773b85c..b196be006 100644 --- a/README +++ b/README @@ -59,7 +59,7 @@ Then update the environment variables by sourcing the $HOME/.bashrc file by typing in the terminal: - + . $HOME/.bashrc + + . $HOME/.bashrc 2) OR, if running tcsh or csh, source the etc/cshrc file by adding the following line to the end of your $HOME/.cshrc file: @@ -69,7 +69,7 @@ Then update the environment variables by sourcing the $HOME/.cshrc file by typing in the terminal: - + source $HOME/.cshrc + + source $HOME/.cshrc *** Installation in alternative locations OpenFOAM may also be installed in alternative locations. However, the @@ -79,13 +79,13 @@ The environment variable 'FOAM_INST_DIR' can be used to find and source the appropriate resource file. Here is a bash/ksh/sh example: - + export FOAM_INST_DIR=/data/app/OpenFOAM + + export FOAM_INST_DIR=/data/app/OpenFOAM + foamDotFile=$FOAM_INST_DIR/OpenFOAM-/etc/bashrc + [ -f $foamDotFile ] && . $foamDotFile and a csh/tcsh example: - + setenv FOAM_INST_DIR /data/app/OpenFOAM + + setenv FOAM_INST_DIR /data/app/OpenFOAM + set foamDotFile=$FOAM_INST_DIR/OpenFOAM-/etc/cshrc + if ( -f $foamDotFile ) source $foamDotFile diff --git a/applications/solvers/multiphase/porousInterFoam/createPorousZones.H b/applications/solvers/multiphase/porousInterFoam/createPorousZones.H index 1593cd563..a386cec4f 100644 --- a/applications/solvers/multiphase/porousInterFoam/createPorousZones.H +++ b/applications/solvers/multiphase/porousInterFoam/createPorousZones.H @@ -3,9 +3,9 @@ // Creates the porosity field for MULES volScalarField porosity ( - IOobject + IOobject ( - "porosity", + "porosity", runTime.timeName(), mesh, IOobject::NO_READ, @@ -26,7 +26,7 @@ forAll( cells, cellI ) { - porosity[cells[cellI]] = zonePorosity; + porosity[cells[cellI]] = zonePorosity; } } diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H index dd9244a67..ecdc73716 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") { divDSigmaExp = fvc::div - ( - mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, - "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradDU = - ((I - n*n)&fvc::interpolate(gradDU)); + ( + mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradDU = ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) - + lambdaf*tr(shearGradDU&(I - n*n))*n - + muf*(shearGradDU&n) - ) - ); - } - else if(divDSigmaExpMethod == "laplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) + + lambdaf*tr(shearGradDU&(I - n*n))*n + + muf*(shearGradDU&n) + ) + ); +} +else if(divDSigmaExpMethod == "laplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)") + fvc::div - ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } + ( + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/correctGlobalFaceZoneMesh.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/correctGlobalFaceZoneMesh.H index 6565fc33d..54cdd60f6 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/correctGlobalFaceZoneMesh.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/correctGlobalFaceZoneMesh.H @@ -23,138 +23,131 @@ philipc //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ //***** FIX INCORRECT POINT ON PATCHES WITH FACEZONE *****// contactPatchPairList& contacts = contact; forAll(contacts, contactI) - { - label masterID = contacts[contactI].masterPatch().index(); - label slaveID = contacts[contactI].slavePatch().index(); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + primitivePatchInterpolation masterInterpolator + ( + mesh.boundaryMesh()[masterID] + ); + primitivePatchInterpolation slaveInterpolator + ( + mesh.boundaryMesh()[slaveID] + ); - //- U must be interpolated to the vertices, this ignores the faceZone - //- points with no U (unlike volPointInterpolation) - vectorField correctMasterPointU = - masterInterpolator.faceToPointInterpolate - ( - U.boundaryField()[masterID] - ); - vectorField correctSlavePointU = - slaveInterpolator.faceToPointInterpolate - ( - U.boundaryField()[slaveID] - ); + //- U must be interpolated to the vertices, this ignores the faceZone + //- points with no U (unlike volPointInterpolation) + vectorField correctMasterPointU = + masterInterpolator.faceToPointInterpolate + ( + U.boundaryField()[masterID] + ); + vectorField correctSlavePointU = + slaveInterpolator.faceToPointInterpolate + ( + U.boundaryField()[slaveID] + ); - vectorField oldMasterPoints = - mesh.boundaryMesh()[masterID].localPoints(); - vectorField oldSlavePoints = - mesh.boundaryMesh()[slaveID].localPoints(); - - labelList masterPointLabels = - mesh.boundaryMesh()[masterID].meshPoints(); - labelList slavePointLabels = - mesh.boundaryMesh()[slaveID].meshPoints(); - - //- correct the patch newPoints - forAll(masterPointLabels, pointI) - { - label pointGlobalLabel = masterPointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldMasterPoints[pointI] - + - correctMasterPointU[pointI]; - } - forAll(slavePointLabels, pointI) - { - label pointGlobalLabel = slavePointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldSlavePoints[pointI] - + - correctSlavePointU[pointI]; - } - } + vectorField oldMasterPoints = + mesh.boundaryMesh()[masterID].localPoints(); + vectorField oldSlavePoints = + mesh.boundaryMesh()[slaveID].localPoints(); + labelList masterPointLabels = + mesh.boundaryMesh()[masterID].meshPoints(); + labelList slavePointLabels = + mesh.boundaryMesh()[slaveID].meshPoints(); + //- correct the patch newPoints + forAll(masterPointLabels, pointI) + { + label pointGlobalLabel = masterPointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldMasterPoints[pointI] + correctMasterPointU[pointI]; + } + forAll(slavePointLabels, pointI) + { + label pointGlobalLabel = slavePointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldSlavePoints[pointI] + correctSlavePointU[pointI]; + } + } //***** NOW FIX AND SYNCHRONISE ALL THE FACEZONE POINTS *****// forAll(mesh.faceZones(), faceZoneI) - { - //- find the patch corresponding to this faceZone - //- assuming that the FZ is called FaceZone - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + { + //- find the patch corresponding to this faceZone + //- assuming that the FZ is called FaceZone + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); + vectorField globalFZpoints = + mesh.faceZones()[faceZoneI]().localPoints(); - //- new points for the face zone - vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); + //- new points for the face zone + vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); - //- inter-proc points are shared by multiple procs - //- pointNumProc is the number of procs which a point lies on - scalarField pointNumProcs(globalFZpoints.size(), 0.0); + //- inter-proc points are shared by multiple procs + //- pointNumProc is the number of procs which a point lies on + scalarField pointNumProcs(globalFZpoints.size(), 0.0); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) - if(pointOnLocalProcPatch[faceZoneI][localPoint]) - { - label procPoint = - mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; - globalFZnewPoints[globalPointI] = - newPoints[procPoint]; - pointNumProcs[globalPointI] = 1; - } - } + //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) + if(pointOnLocalProcPatch[faceZoneI][localPoint]) + { + label procPoint = + mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; + globalFZnewPoints[globalPointI] = newPoints[procPoint]; + pointNumProcs[globalPointI] = 1; + } + } - reduce(globalFZnewPoints, sumOp()); - reduce(pointNumProcs, sumOp()); + reduce(globalFZnewPoints, sumOp()); + reduce(pointNumProcs, sumOp()); - //- now average the newPoints between all procs - if(min(pointNumProcs) < 1) - { - FatalError << "pointNumProc has not been set for all points" << exit(FatalError); - } - globalFZnewPoints /= pointNumProcs; + //- now average the newPoints between all procs + if(min(pointNumProcs) < 1) + { + FatalError << "pointNumProc has not been set for all points" << exit(FatalError); + } + globalFZnewPoints /= pointNumProcs; - //- the globalFZnewPoints now contains the correct FZ new points in - //- a global order, now convert them back into the local proc order + //- the globalFZnewPoints now contains the correct FZ new points in + //- a global order, now convert them back into the local proc order - vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); + vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } + //- now fix the newPoints points on the globalFaceZones + labelList procFZmeshPoints = mesh.faceZones()[faceZoneI]().meshPoints(); - //- now fix the newPoints points on the globalFaceZones - labelList procFZmeshPoints = - mesh.faceZones()[faceZoneI]().meshPoints(); - - forAll(procFZmeshPoints, pointI) - { - label procPoint = procFZmeshPoints[pointI]; - newPoints[procPoint] = - procFZnewPoints[pointI]; - } - } - } + forAll(procFZmeshPoints, pointI) + { + label procPoint = procFZmeshPoints[pointI]; + newPoints[procPoint] = procFZnewPoints[pointI]; + } + } +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createFields.H index 40b361905..72f2f45b7 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createFields.H @@ -25,7 +25,7 @@ IOobject::AUTO_WRITE ), mesh, - dimensionedVector("zero", dimLength, vector::zero) + dimensionedVector("zero", dimLength, vector::zero) ); volSymmTensorField DEpsilon @@ -84,22 +84,22 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divDSigmaExp - ( + volVectorField divDSigmaExp + ( IOobject ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); - // read rheology properties + // read rheology properties rheologyModel rheology(sigma); volScalarField rho = rheology.rho(); @@ -111,5 +111,5 @@ surfaceVectorField n = mesh.Sf()/mesh.magSf(); - //- create contact problem - contactProblem contact(DU); + //- create contact problem + contactProblem contact(DU); diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createGlobalToLocalFaceZonePointMap.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createGlobalToLocalFaceZonePointMap.H index eb84b8420..4f80c19c0 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createGlobalToLocalFaceZonePointMap.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createGlobalToLocalFaceZonePointMap.H @@ -19,117 +19,120 @@ philipc //- these are read if present to allow restarting of contact cases IOList procToGlobalFZmap ( - IOobject - ( - "procToGlobalFZmap", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() - ); + IOobject + ( + "procToGlobalFZmap", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() +); IOList pointOnLocalProcPatch ( - IOobject - ( - "pointOnLocalProcPatch", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() + IOobject + ( + "pointOnLocalProcPatch", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() ); //- if they have been read then don't recalculate it bool globalFaceZoneMappingSet = false; if(gMax(procToGlobalFZmap[0]) > 0 && gMax(pointOnLocalProcPatch[0]) > 0) - { +{ Info << "Reading procToGlobalFZmap and pointOnLocalProcPatch allowing restart of contact cases" - << endl; + << endl; globalFaceZoneMappingSet = true; - } - else - { - Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl - << "this message should only appear starting a new analysis" << endl; - } +} +else +{ + Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl + << "this message should only appear starting a new analysis" << endl; +} //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ if(!globalFaceZoneMappingSet) - { - forAll(mesh.faceZones(), faceZoneI) - { - vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + { + forAll(mesh.faceZones(), faceZoneI) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); + procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); - //- set all slave points to zero because only the master order is used - if(!Pstream::master()) - globalFZpoints *= 0.0; + //- set all slave points to zero because only the master order is used + if(!Pstream::master()) + { + globalFZpoints *= 0.0; + } - //- pass points to all procs - reduce(globalFZpoints, sumOp()); + //- pass points to all procs + reduce(globalFZpoints, sumOp()); - //- now every proc has the master's list of FZ points - //- every proc must now find the mapping from their local FZpoints to - //- the globalFZpoints + //- now every proc has the master's list of FZ points + //- every proc must now find the mapping from their local FZpoints to + //- the globalFZpoints - vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - forAll(globalFZpoints, globalPointI) - { - forAll(procFZpoints, procPointI) - { - if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) - { - procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; - break; - } - } - } - //- procToGlobalFZmap now contains the local FZpoint label for each - //- global FZ point label - for each faceZone + forAll(globalFZpoints, globalPointI) + { + forAll(procFZpoints, procPointI) + { + if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) + { + procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; + break; + } + } + } - //- check what points are on the current proc patch - pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); + //- procToGlobalFZmap now contains the local FZpoint label for each + //- global FZ point label - for each faceZone - //- find corresponding patch - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + //- check what points are on the current proc patch + pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); - forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) - { - forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) - { - if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) - { - pointOnLocalProcPatch[faceZoneI][fzpi] = 1; - break; - } - } - } - } - } //- end if(!globalFaceZoneMappingSet) - } + //- find corresponding patch + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } + + forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) + { + forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) + { + if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) + { + pointOnLocalProcPatch[faceZoneI][fzpi] = 1; + break; + } + } + } + } + } //- end if(!globalFaceZoneMappingSet) +} //- write to disk to allow restart of cases //- because it is not possible to calculate the //- mapping after the meshes have moved if(!globalFaceZoneMappingSet && Pstream::parRun()) - { +{ procToGlobalFZmap.write(); pointOnLocalProcPatch.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createSolidInterface.H index 42705b924..9cb649bc7 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/createSolidInterface.H @@ -4,22 +4,22 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); - gradDU = solidInterfacePtr->grad(DU); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); + gradDU = solidInterfacePtr->grad(DU); - //- solidInterface needs muf and lambdaf to be used for divSigmaExp - if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") - { - FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divDSigmaExp + if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") + { + FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C index f0234a310..add1b76b2 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C @@ -61,21 +61,21 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "createGlobalToLocalFaceZonePointMap.H" +# include "createGlobalToLocalFaceZonePointMap.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -101,91 +101,93 @@ int main(int argc, char *argv[]) //- reset DU to zero at the start of the time-step if //- a predictor is not required if(!predictor) - DU = dimensionedVector("zero", dimLength, vector::zero); + { + DU = dimensionedVector("zero", dimLength, vector::zero); + } do //- start of momentum loop - { - DU.storePrevIter(); + { + DU.storePrevIter(); - //- correct the contact boundaries - if(iCorr % uEqnContactCorrFreq == 0) - { - Info << "\t\tCorrecting contact in the momentum loop " - << "iteration: " << iCorr - << ", residual: " << residual - << endl; - //# include "moveMeshLeastSquares.H" + //- correct the contact boundaries + if(iCorr % uEqnContactCorrFreq == 0) + { + Info << "\t\tCorrecting contact in the momentum loop " + << "iteration: " << iCorr + << ", residual: " << residual + << endl; +//# include "moveMeshLeastSquares.H" # include "moveSolidMesh.H" - contact.correct(); - mesh.movePoints(oldMeshPoints); - } + contact.correct(); + mesh.movePoints(oldMeshPoints); + } # include "calculateDivDSigmaExp.H" - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") - + divDSigmaExp - ); + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") + + divDSigmaExp + ); if(solidInterfaceCorr) - { + { solidInterfacePtr->correct(DUEqn); - } + } - solverPerf = DUEqn.solve(); + solverPerf = DUEqn.solve(); - DU.relax(); + DU.relax(); - solverName = solverPerf.solverName(); + solverName = solverPerf.solverName(); if(solidInterfaceCorr) - { + { gradDU = solidInterfacePtr->grad(DU); - } + } else - { + { gradDU = fvc::grad(DU); - } + } - U = U.oldTime() + DU; + U = U.oldTime() + DU; - residual = solverPerf.initialResidual(); + residual = solverPerf.initialResidual(); - //****************************************************// - // The contact residual is the initial residual for the - // first iteration of the momentum equation - //****************************************************// - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + //****************************************************// + // The contact residual is the initial residual for the + // first iteration of the momentum equation + //****************************************************// + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } # include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } //- end of momentum loop + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; + } //- end of momentum loop while - ( - relativeResidual > convergenceTolerance - //residual > convergenceTolerance - && - ++iCorr < nCorr - ); + ( + relativeResidual > convergenceTolerance + //residual > convergenceTolerance + && + ++iCorr < nCorr + ); // Print out info per contact iteration Info << "\t\tSolving for " << DU.name() - << " using " << solverName - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; + << " using " << solverName + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; lduMatrix::debug = 1; @@ -205,8 +207,8 @@ int main(int argc, char *argv[]) //mesh.movePoints(oldMeshPoints); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } Info<< "End\n" << endl; diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H index 65373c592..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H index 2600c9ea4..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H @@ -1,5 +1,5 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); @@ -12,39 +12,39 @@ if (runTime.outputTime()) //-------------------------------------------------------------// //This is the point distance for each contact vertex pointScalarField cGapPoints - ( - IOobject - ( - "pointContactGap", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedScalar("scalar", dimLength, 0.0), - "calculated" - ); + ( + IOobject + ( + "pointContactGap", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedScalar("scalar", dimLength, 0.0), + "calculated" + ); contact.contactGapPoints(cGapPoints); cGapPoints.write(); - //- This is the point distance for each contact vertex - pointVectorField cPointForce - ( - IOobject - ( - "pointContactForce", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedVector("vector", dimForce, vector::zero), - "calculated" - ); + //- This is the point distance for each contact vertex + pointVectorField cPointForce + ( + IOobject + ( + "pointContactForce", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("vector", dimForce, vector::zero), + "calculated" + ); contact.contactPointForce(cPointForce); cPointForce.write(); @@ -52,4 +52,4 @@ if (runTime.outputTime()) //- SHOULD THIS BE A REF TO A TMP...? volScalarField cPressure = contact.contactPressure(); cPressure.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/readDivDSigmaExpMethod.H index b63cbde5b..275498fb2 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,15 @@ //- how explicit component of sigma is to be calculated word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << divDSigmaExpMethod << " method chosen for calculation of sigmaExp" << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H index 48bf04546..c1d0e7fb0 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H @@ -1,77 +1,78 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; volScalarField pressure - ( - IOobject - ( - "pressure", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE + ( + IOobject + ( + "pressure", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE ), - tr(sigma)/3.0 - ); + tr(sigma)/3.0 + ); + //- boundary surface pressure forAll(pressure.boundaryField(), patchi) - { + { const vectorField& nb = n.boundaryField()[patchi]; pressure.boundaryField()[patchi] = -(nb & ( nb & sigma.boundaryField()[patchi] )); - } + } //- contact slave penetration # include "moveSolidMesh.H" pointMesh pMesh(mesh); pointScalarField cGapPoints - ( - IOobject - ( - "pointContactGap", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), + ( + IOobject + ( + "pointContactGap", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), pMesh, dimensionedScalar("scalar", dimLength, 0.0), "calculated" - ); + ); contact.contactGapPoints(cGapPoints); cGapPoints.write(); mesh.movePoints(oldMeshPoints); runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H index dd9244a67..7415ff9e3 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") - { +{ divDSigmaExp = fvc::div - ( - mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, - "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradDU = - ((I - n*n)&fvc::interpolate(gradDU)); + ( + mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradDU = + ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) - + lambdaf*tr(shearGradDU&(I - n*n))*n - + muf*(shearGradDU&n) - ) - ); - } - else if(divDSigmaExpMethod == "laplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + *( + - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) + + lambdaf*tr(shearGradDU&(I - n*n))*n + + muf*(shearGradDU&n) + ) + ); +} +else if(divDSigmaExpMethod == "laplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)") + fvc::div ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExpLargeStrain.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExpLargeStrain.H index 922801ec6..1c8ed7264 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExpLargeStrain.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExpLargeStrain.H @@ -2,33 +2,33 @@ //- sigma explicit large strain explicit terms //----------------------------------------------------// if(divDSigmaLargeStrainExpMethod == "standard") - { +{ divDSigmaLargeStrainExp = - fvc::div - ( - mu*(gradDU & gradDU.T()) - + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) - + ((sigma + DSigma) & DF.T()), - "div(sigma)" + fvc::div + ( + mu*(gradDU & gradDU.T()) + + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) + + ((sigma + DSigma) & DF.T()), + "div(sigma)" ); - } - else if(divDSigmaLargeStrainExpMethod == "surface") - { - divDSigmaLargeStrainExp = - fvc::div - ( - muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) - + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) - + (mesh.Sf() & fvc::interpolate( sigma & DF.T() )) - + (mesh.Sf() & fvc::interpolate(DSigma & DF.T() )) - ); - } - else - { - FatalError - << "divDSigmaLargeStrainExp not found!" - << exit(FatalError); - } +} +else if(divDSigmaLargeStrainExpMethod == "surface") +{ + divDSigmaLargeStrainExp = + fvc::div + ( + muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) + + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) + + (mesh.Sf() & fvc::interpolate( sigma & DF.T() )) + + (mesh.Sf() & fvc::interpolate(DSigma & DF.T() )) + ); +} +else +{ + FatalError + << "divDSigmaLargeStrainExp not found!" + << exit(FatalError); +} //- relax large strain component divDSigmaLargeStrainExp.relax(); diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateExtrapolationVectors.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateExtrapolationVectors.H index a8008f025..9007c94dd 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateExtrapolationVectors.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateExtrapolationVectors.H @@ -15,59 +15,58 @@ FieldField extraVecs(ptc.size()); { - const labelListList& pfaces = mesh.pointFaces(); + const labelListList& pfaces = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - forAll (ptc, pointI) + forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = pfaces[curPoint]; + const labelList& curFaces = pfaces[curPoint]; - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); - vectorField& curExtraVectors = extraVecs[pointI]; + vectorField& curExtraVectors = extraVecs[pointI]; - label nFacesAroundPoint = 0; + label nFacesAroundPoint = 0; - const vector& pointLoc = mesh.points()[curPoint]; + const vector& pointLoc = mesh.points()[curPoint]; - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(bm[patchID]) - && !bm[patchID].coupled() - ) - { - // Found a face for extrapolation - curExtraVectors[nFacesAroundPoint] = - pointLoc - - centres.boundaryField()[patchID] - [bm[patchID].patch().whichFace(curFaces[faceI])]; + if + ( + !isA(bm[patchID]) + && !bm[patchID].coupled() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; - nFacesAroundPoint++; - } - } - } + nFacesAroundPoint++; + } + } + } - curExtraVectors.setSize(nFacesAroundPoint); + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H index 664110dc4..ade989cac 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H @@ -8,114 +8,116 @@ FieldField w(ptc.size()); { - const labelListList& pf = mesh.pointFaces(); + const labelListList& pf = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - pointScalarField volPointSumWeights + pointScalarField volPointSumWeights ( - IOobject - ( - "volPointSumWeights", - mesh.polyMesh::instance(), - mesh - ), - pMesh, - dimensionedScalar("zero", dimless, 0) - ); - - forAll (ptc, pointI) - { - const label curPoint = ptc[pointI]; - - const labelList& curFaces = pf[curPoint]; - - //w.hook(new scalarField(curFaces.size())); //philipc no hook function - w.set - ( - pointI, - new scalarField(curFaces.size()) - ); - - scalarField& curWeights = w[pointI]; - - label nFacesAroundPoint = 0; - - const vector& pointLoc = mesh.points()[curPoint]; - - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); - - if - ( - !isA(bm[patchID]) - && !( - bm[patchID].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) - ) - { - curWeights[nFacesAroundPoint] = - 1.0/mag - ( - pointLoc - - centres.boundaryField()[patchID] - [ - bm[patchID].patch().whichFace(curFaces[faceI]) - ] - ); - - nFacesAroundPoint++; - } - } - } - - // Reset the sizes of the local weights - curWeights.setSize(nFacesAroundPoint); - - // Collect the sum of weights for parallel correction - volPointSumWeights[curPoint] += sum(curWeights); - } - - // Do parallel correction of weights - - // Update coupled boundaries - // Work-around for cyclic parallels. - /*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) - { - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].initAddField(); - } - } - - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].addField - ( - volPointSumWeights.internalField() + IOobject + ( + "volPointSumWeights", + mesh.polyMesh::instance(), + mesh + ), + pMesh, + dimensionedScalar("zero", dimless, 0) ); - } - } - }*/ - // Re-scale the weights for the current point - forAll (ptc, pointI) + forAll (ptc, pointI) { - w[pointI] /= volPointSumWeights[ptc[pointI]]; + const label curPoint = ptc[pointI]; + + const labelList& curFaces = pf[curPoint]; + + //w.hook(new scalarField(curFaces.size())); //philipc no hook function + w.set + ( + pointI, + new scalarField(curFaces.size()) + ); + + scalarField& curWeights = w[pointI]; + + label nFacesAroundPoint = 0; + + const vector& pointLoc = mesh.points()[curPoint]; + + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); + + if + ( + !isA(bm[patchID]) + && !( + bm[patchID].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) + ) + { + curWeights[nFacesAroundPoint] = + 1.0/mag + ( + pointLoc + - centres.boundaryField()[patchID] + [ + bm[patchID].patch().whichFace(curFaces[faceI]) + ] + ); + + nFacesAroundPoint++; + } + } + } + + // Reset the sizes of the local weights + curWeights.setSize(nFacesAroundPoint); + + // Collect the sum of weights for parallel correction + volPointSumWeights[curPoint] += sum(curWeights); + } + + // Do parallel correction of weights + + // Update coupled boundaries + // Work-around for cyclic parallels. +/* + if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) + { + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].initAddField(); + } + } + + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].addField + ( + volPointSumWeights.internalField() + ); + } + } + } +*/ + + // Re-scale the weights for the current point + forAll (ptc, pointI) + { + w[pointI] /= volPointSumWeights[ptc[pointI]]; } } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/correctGlobalFaceZoneMesh.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/correctGlobalFaceZoneMesh.H index d249bf17f..998973b06 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/correctGlobalFaceZoneMesh.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/correctGlobalFaceZoneMesh.H @@ -23,138 +23,131 @@ philipc //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ //***** FIX INCORRECT POINT ON PATCHES WITH FACEZONE *****// contactPatchPairList& contacts = contact; forAll(contacts, contactI) - { - label masterID = contacts[contactI].masterPatch().index(); - label slaveID = contacts[contactI].slavePatch().index(); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + primitivePatchInterpolation masterInterpolator + ( + mesh.boundaryMesh()[masterID] + ); + primitivePatchInterpolation slaveInterpolator + ( + mesh.boundaryMesh()[slaveID] + ); - //- DU must be interpolated to the vertices, this ignores the faceZone - //- points with no DU (unlike volPointInterpolation) - vectorField correctMasterPointDU = - masterInterpolator.faceToPointInterpolate - ( - DU.boundaryField()[masterID] - ); - vectorField correctSlavePointDU = - slaveInterpolator.faceToPointInterpolate - ( - DU.boundaryField()[slaveID] - ); + //- DU must be interpolated to the vertices, this ignores the faceZone + //- points with no DU (unlike volPointInterpolation) + vectorField correctMasterPointDU = + masterInterpolator.faceToPointInterpolate + ( + DU.boundaryField()[masterID] + ); + vectorField correctSlavePointDU = + slaveInterpolator.faceToPointInterpolate + ( + DU.boundaryField()[slaveID] + ); - vectorField oldMasterPoints = - mesh.boundaryMesh()[masterID].localPoints(); - vectorField oldSlavePoints = - mesh.boundaryMesh()[slaveID].localPoints(); - - labelList masterPointLabels = - mesh.boundaryMesh()[masterID].meshPoints(); - labelList slavePointLabels = - mesh.boundaryMesh()[slaveID].meshPoints(); - - //- correct the patch newPoints - forAll(masterPointLabels, pointI) - { - label pointGlobalLabel = masterPointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldMasterPoints[pointI] - + - correctMasterPointDU[pointI]; - } - forAll(slavePointLabels, pointI) - { - label pointGlobalLabel = slavePointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldSlavePoints[pointI] - + - correctSlavePointDU[pointI]; - } - } + vectorField oldMasterPoints = + mesh.boundaryMesh()[masterID].localPoints(); + vectorField oldSlavePoints = + mesh.boundaryMesh()[slaveID].localPoints(); + labelList masterPointLabels = + mesh.boundaryMesh()[masterID].meshPoints(); + labelList slavePointLabels = + mesh.boundaryMesh()[slaveID].meshPoints(); + //- correct the patch newPoints + forAll(masterPointLabels, pointI) + { + label pointGlobalLabel = masterPointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldMasterPoints[pointI] + correctMasterPointDU[pointI]; + } + forAll(slavePointLabels, pointI) + { + label pointGlobalLabel = slavePointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldSlavePoints[pointI] + correctSlavePointDU[pointI]; + } + } //***** NOW FIX AND SYNCHRONISE ALL THE FACEZONE POINTS *****// forAll(mesh.faceZones(), faceZoneI) - { - //- find the patch corresponding to this faceZone - //- assuming that the FZ is called FaceZone - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + { + //- find the patch corresponding to this faceZone + //- assuming that the FZ is called FaceZone + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); + vectorField globalFZpoints = + mesh.faceZones()[faceZoneI]().localPoints(); - //- new points for the face zone - vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); + //- new points for the face zone + vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); - //- inter-proc points are shared by multiple procs - //- pointNumProc is the number of procs which a point lies on - scalarField pointNumProcs(globalFZpoints.size(), 0.0); + //- inter-proc points are shared by multiple procs + //- pointNumProc is the number of procs which a point lies on + scalarField pointNumProcs(globalFZpoints.size(), 0.0); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) - if(pointOnLocalProcPatch[faceZoneI][localPoint]) - { - label procPoint = - mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; - globalFZnewPoints[globalPointI] = - newPoints[procPoint]; - pointNumProcs[globalPointI] = 1; - } - } + //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) + if(pointOnLocalProcPatch[faceZoneI][localPoint]) + { + label procPoint = + mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; + globalFZnewPoints[globalPointI] = newPoints[procPoint]; + pointNumProcs[globalPointI] = 1; + } + } - reduce(globalFZnewPoints, sumOp()); - reduce(pointNumProcs, sumOp()); + reduce(globalFZnewPoints, sumOp()); + reduce(pointNumProcs, sumOp()); - //- now average the newPoints between all procs - if(min(pointNumProcs) < 1) - { - FatalError << "pointNumProc has not been set for all points" << exit(FatalError); - } - globalFZnewPoints /= pointNumProcs; + //- now average the newPoints between all procs + if(min(pointNumProcs) < 1) + { + FatalError << "pointNumProc has not been set for all points" << exit(FatalError); + } + globalFZnewPoints /= pointNumProcs; - //- the globalFZnewPoints now contains the correct FZ new points in - //- a global order, now convert them back into the local proc order + //- the globalFZnewPoints now contains the correct FZ new points in + //- a global order, now convert them back into the local proc order - vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); + vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } + //- now fix the newPoints points on the globalFaceZones + labelList procFZmeshPoints = mesh.faceZones()[faceZoneI]().meshPoints(); - //- now fix the newPoints points on the globalFaceZones - labelList procFZmeshPoints = - mesh.faceZones()[faceZoneI]().meshPoints(); - - forAll(procFZmeshPoints, pointI) - { - label procPoint = procFZmeshPoints[pointI]; - newPoints[procPoint] = - procFZnewPoints[pointI]; - } - } - } + forAll(procFZmeshPoints, pointI) + { + label procPoint = procFZmeshPoints[pointI]; + newPoints[procPoint] = procFZnewPoints[pointI]; + } + } +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createFields.H index a58d30aab..0b194144d 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createFields.H @@ -25,7 +25,7 @@ IOobject::AUTO_WRITE ), mesh, - dimensionedVector("zero", dimLength, vector::zero) + dimensionedVector("zero", dimLength, vector::zero) ); volSymmTensorField DEpsilon @@ -84,35 +84,35 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divDSigmaExp - ( + volVectorField divDSigmaExp + ( IOobject ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); - volVectorField divDSigmaLargeStrainExp - ( + volVectorField divDSigmaLargeStrainExp + ( IOobject ( - "divDSigmaLargeStrainExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divDSigmaLargeStrainExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); - // read rheology properties + // read rheology properties rheologyModel rheology(sigma); volScalarField rho = rheology.rho(); diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createGlobalToLocalFaceZonePointMap.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createGlobalToLocalFaceZonePointMap.H index 971bc377e..6d0560802 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createGlobalToLocalFaceZonePointMap.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/createGlobalToLocalFaceZonePointMap.H @@ -19,117 +19,117 @@ philipc //- these are read if present to allow restarting of contact cases IOList procToGlobalFZmap ( - IOobject - ( - "procToGlobalFZmap", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() - ); + IOobject + ( + "procToGlobalFZmap", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() +); IOList pointOnLocalProcPatch ( - IOobject - ( - "pointOnLocalProcPatch", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() + IOobject + ( + "pointOnLocalProcPatch", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() ); //- if they have been read then don't recalculate it bool globalFaceZoneMappingSet = false; if(gMax(procToGlobalFZmap[0]) > 0 && gMax(pointOnLocalProcPatch[0]) > 0) - { +{ Info << "Reading procToGlobalFZmap and pointOnLocalProcPatch allowing restart of contact cases" - << endl; + << endl; globalFaceZoneMappingSet = true; - } - else - { - Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl - << "this message should only appear starting a new analysis" << endl; - } +} +else +{ + Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl + << "this message should only appear starting a new analysis" << endl; +} //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ if(!globalFaceZoneMappingSet) - { - forAll(mesh.faceZones(), faceZoneI) - { - vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + { + forAll(mesh.faceZones(), faceZoneI) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); + procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); - //- set all slave points to zero because only the master order is used - if(!Pstream::master()) - globalFZpoints *= 0.0; + //- set all slave points to zero because only the master order is used + if(!Pstream::master()) + { + globalFZpoints *= 0.0; + } - //- pass points to all procs - reduce(globalFZpoints, sumOp()); + //- pass points to all procs + reduce(globalFZpoints, sumOp()); - //- now every proc has the master's list of FZ points - //- every proc must now find the mapping from their local FZpoints to - //- the globalFZpoints + //- now every proc has the master's list of FZ points + //- every proc must now find the mapping from their local FZpoints to + //- the globalFZpoints - vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - forAll(globalFZpoints, globalPointI) - { - forAll(procFZpoints, procPointI) - { - if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) - { - procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; - break; - } - } - } - //- procToGlobalFZmap now contains the local FZpoint label for each - //- global FZ point label - for each faceZone + forAll(globalFZpoints, globalPointI) + { + forAll(procFZpoints, procPointI) + { + if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) + { + procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; + break; + } + } + } - //- check what points are on the current proc patch - pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); + //- check what points are on the current proc patch + pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); - //- find corresponding patch - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + //- find corresponding patch + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } - forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) - { - forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) - { - if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) - { - pointOnLocalProcPatch[faceZoneI][fzpi] = 1; - break; - } - } - } - } - } //- end if(!globalFaceZoneMappingSet) - } + forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) + { + forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) + { + if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) + { + pointOnLocalProcPatch[faceZoneI][fzpi] = 1; + break; + } + } + } + } + } //- end if(!globalFaceZoneMappingSet) +} //- write to disk to allow restart of cases //- because it is not possible to calculate the //- mapping after the meshes have moved if(!globalFaceZoneMappingSet) - { +{ procToGlobalFZmap.write(); pointOnLocalProcPatch.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/elasticContactNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/elasticContactNonLinULSolidFoam.C index 67f296bcc..16062ec70 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/elasticContactNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/elasticContactNonLinULSolidFoam.C @@ -66,137 +66,136 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "readDivDSigmaLargeStrainMethod.H" +# include "readDivDSigmaLargeStrainMethod.H" -# include "readMoveMeshMethod.H" +# include "readMoveMeshMethod.H" -# include "createGlobalToLocalFaceZonePointMap.H" +# include "createGlobalToLocalFaceZonePointMap.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nStarting time loop\n" << endl; + Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << endl; + Info<< "Time: " << runTime.timeName() << endl; -# include "readContactControls.H" +# include "readContactControls.H" -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - //-- for moving the mesh and then back again - vectorField oldMeshPoints = mesh.allPoints(); + //-- for moving the mesh and then back again + vectorField oldMeshPoints = mesh.allPoints(); - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - word solverName; - lduMatrix::debug = 0; - scalar residual = GREAT; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + word solverName; + lduMatrix::debug = 0; + scalar residual = GREAT; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; - do //- start of momentum loop - { - DU.storePrevIter(); + do //- start of momentum loop + { + DU.storePrevIter(); - divDSigmaLargeStrainExp.storePrevIter(); + divDSigmaLargeStrainExp.storePrevIter(); - //- correct the contact boundaries - if(iCorr % uEqnContactCorrFreq == 0) - { - Info << "\t\tCorrecting contact in the momentum loop " - << "iteration: " << iCorr - << ", residual: " << residual - << endl; - //# include "moveMeshLeastSquares.H" -# include "moveSolidMeshForContact.H" - contact.correct(); - mesh.movePoints(oldMeshPoints); - } + //- correct the contact boundaries + if(iCorr % uEqnContactCorrFreq == 0) + { + Info << "\t\tCorrecting contact in the momentum loop " + << "iteration: " << iCorr + << ", residual: " << residual + << endl; +//# include "moveMeshLeastSquares.H" +# include "moveSolidMeshForContact.H" + contact.correct(); + mesh.movePoints(oldMeshPoints); + } -# include "calculateDivDSigmaExp.H" +# include "calculateDivDSigmaExp.H" -# include "calculateDivDSigmaExpLargeStrain.H" +# include "calculateDivDSigmaExpLargeStrain.H" - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") - + divDSigmaExp - + divDSigmaLargeStrainExp + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") + + divDSigmaExp + + divDSigmaLargeStrainExp + ); - ); + solverPerf = DUEqn.solve(); - solverPerf = DUEqn.solve(); + DU.relax(); - DU.relax(); + solverName = solverPerf.solverName(); - solverName = solverPerf.solverName(); + gradDU = fvc::grad(DU); - gradDU = fvc::grad(DU); + DF = gradDU.T(); - DF = gradDU.T(); +# include "calculateDEpsilonDSigma.H" -# include "calculateDEpsilonDSigma.H" + residual = solverPerf.initialResidual(); - residual = solverPerf.initialResidual(); + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } +# include "calculateRelativeResidual.H" -# include "calculateRelativeResidual.H" + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; + } //- end of momentum loop + while + ( + relativeResidual > convergenceTolerance + //residual > convergenceTolerance + && + ++iCorr < nCorr + ); - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } //- end of momentum loop - while - ( - relativeResidual > convergenceTolerance - //residual > convergenceTolerance - && - ++iCorr < nCorr - ); + // Print out info per contact iteration + Info << "\t\tSolving for " << DU.name() + << " using " << solverName + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; - // Print out info per contact iteration - Info << "\t\tSolving for " << DU.name() - << " using " << solverName - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; + lduMatrix::debug = 1; - lduMatrix::debug = 1; +# include "rotateFields.H" -# include "rotateFields.H" +# include "moveMesh.H" -# include "moveMesh.H" +# include "writeFields.H" -# include "writeFields.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H index 0e75c6a56..3d6eaf814 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H @@ -8,26 +8,26 @@ const fvBoundaryMesh& bm = mesh.boundary(); forAll (bm, patchI) { - // If the patch is empty, skip it - // If the patch is coupled, and there are no cyclic parallels, skip it - if + // If the patch is empty, skip it + // If the patch is coupled, and there are no cyclic parallels, skip it + if ( - !isA(bm[patchI]) - && !( - bm[patchI].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) - ) + !isA(bm[patchI]) + && !( + bm[patchI].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) + ) { - const labelList& bp = bm[patchI].patch().boundaryPoints(); + const labelList& bp = bm[patchI].patch().boundaryPoints(); - const labelList& meshPoints = bm[patchI].patch().meshPoints(); + const labelList& meshPoints = bm[patchI].patch().meshPoints(); - forAll (bp, pointI) - { - pointsCorrectionMap.insert(meshPoints[bp[pointI]]); - } + forAll (bp, pointI) + { + pointsCorrectionMap.insert(meshPoints[bp[pointI]]); + } } } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMesh.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMesh.H index 807c713fd..7fd53aaf1 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMesh.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMesh.H @@ -1,15 +1,15 @@ if(moveMeshMethod == "inverseDistance") - { +{ # include "moveMeshInverseDistance.H" - } - else if(moveMeshMethod == "leastSquares") - { +} +else if(moveMeshMethod == "leastSquares") +{ # include "moveMeshLeastSquares.H" - } - else - { - FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl - << "available methods are:" << nl - << "inverseDistance" << nl - << "leastSquares" << exit(FatalError); - } +} +else +{ + FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl + << "available methods are:" << nl + << "inverseDistance" << nl + << "leastSquares" << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H index 7015034a1..b70d0dd6c 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; // Create point mesh @@ -12,24 +12,24 @@ if(min(J.internalField()) > 0) volPointInterpolation pointInterpolation(mesh); wordList types - ( - pMesh.boundary().size(), - //fixedValueFvPatchVectorField::typeName - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + //fixedValueFvPatchVectorField::typeName + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh - ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); // Calculate mesh points displacement pointInterpolation.interpolate(DU, pointDU); @@ -41,26 +41,25 @@ if(min(J.internalField()) > 0) //pointDU.write(); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); // Move mesh vectorField newPoints = mesh.allPoints(); - forAll (pointDUI, pointI) - { - newPoints[pointI] += pointDUI[pointI]; - } + forAll (pointDUI, pointI) + { + newPoints[pointI] += pointDUI[pointI]; + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H index 65373c592..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H index 577713009..767d7e7ae 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H @@ -7,38 +7,40 @@ pointVectorField& pf = pointDU; // Do the correction //GeometricField pfCorr -/*pointVectorField pfCorr +/* +pointVectorField pfCorr ( - IOobject - ( - // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", - "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", - //vf.instance(), - DU, - pMesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - //dimensioned("zero", pf.dimensions(), pTraits::zero), - dimensionedVector("zero", pf.dimensions(), vector::zero), - pf.boundaryField().types() - );*/ + IOobject + ( + // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", + "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", + //vf.instance(), + DU, + pMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + //dimensioned("zero", pf.dimensions(), pTraits::zero), + dimensionedVector("zero", pf.dimensions(), vector::zero), + pf.boundaryField().types() +); +*/ pointVectorField pfCorr ( - IOobject - ( - "pointDUcorr", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - dimensionedVector("vector", dimLength, vector::zero), - "calculated" - ); + IOobject + ( + "pointDUcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + dimensionedVector("vector", dimLength, vector::zero), + "calculated" +); //const labelList& ptc = boundaryPoints(); #include "findBoundaryPoints.H" @@ -57,64 +59,68 @@ const labelListList& PointFaces = mesh.pointFaces(); forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = PointFaces[curPoint]; + const labelList& curFaces = PointFaces[curPoint]; - label fI = 0; + label fI = 0; - // Go through all the faces - forAll (curFaces, faceI) + // Go through all the faces + forAll (curFaces, faceI) { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(mesh.boundary()[patchID]) - && !mesh.boundary()[patchID].coupled() - ) - { - label faceInPatchID = - bm[patchID].patch().whichFace(curFaces[faceI]); + if + ( + !isA(mesh.boundary()[patchID]) + && !mesh.boundary()[patchID].coupled() + ) + { + label faceInPatchID = + bm[patchID].patch().whichFace(curFaces[faceI]); - pfCorr[curPoint] += - w[pointI][fI]* - ( - extraVecs[pointI][fI] - & gradDU.boundaryField()[patchID][faceInPatchID] - ); + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); - fI++; - } - } + fI++; + } + } } } // Update coupled boundaries -/*forAll (pfCorr.boundaryField(), patchI) +/* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].initAddField(); + pfCorr.boundaryField()[patchI].initAddField(); } - }*/ + } +*/ - /*forAll (pfCorr.boundaryField(), patchI) + /* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); + pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); } - }*/ +} +*/ - //Info << "pfCorr: " << pfCorr << endl; - pfCorr.correctBoundaryConditions(); +//Info << "pfCorr: " << pfCorr << endl; +pfCorr.correctBoundaryConditions(); //pfCorr.write(); diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H index 2600c9ea4..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H @@ -1,5 +1,5 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); @@ -12,39 +12,39 @@ if (runTime.outputTime()) //-------------------------------------------------------------// //This is the point distance for each contact vertex pointScalarField cGapPoints - ( - IOobject - ( - "pointContactGap", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedScalar("scalar", dimLength, 0.0), - "calculated" - ); + ( + IOobject + ( + "pointContactGap", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedScalar("scalar", dimLength, 0.0), + "calculated" + ); contact.contactGapPoints(cGapPoints); cGapPoints.write(); - //- This is the point distance for each contact vertex - pointVectorField cPointForce - ( - IOobject - ( - "pointContactForce", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedVector("vector", dimForce, vector::zero), - "calculated" - ); + //- This is the point distance for each contact vertex + pointVectorField cPointForce + ( + IOobject + ( + "pointContactForce", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("vector", dimForce, vector::zero), + "calculated" + ); contact.contactPointForce(cPointForce); cPointForce.write(); @@ -52,4 +52,4 @@ if (runTime.outputTime()) //- SHOULD THIS BE A REF TO A TMP...? volScalarField cPressure = contact.contactPressure(); cPressure.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/readDivDSigmaExpMethod.H index f68edcc8f..b59c62ce4 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,15 @@ //- how explicit component of sigma is to be calculated word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << divDSigmaExpMethod << " method chosen for calculation of DSigmaExp" << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/calculateDivSigmaExp.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/calculateDivSigmaExp.H index dbc16076f..7f62e4995 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/calculateDivSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/calculateDivSigmaExp.H @@ -1,47 +1,46 @@ if(divSigmaExpMethod == "standard") - { +{ divSigmaExp = fvc::div - ( + ( mu*gradU.T() + lambda*(I*tr(gradU)) - (mu + lambda)*gradU, "div(sigma)" - ); - } - else if(divSigmaExpMethod == "surface") - { - divSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) - ); - } - else if(divSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradU)); + ); +} +else if(divSigmaExpMethod == "surface") +{ + divSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) + ); +} +else if(divSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradU = ((I - n*n)&fvc::interpolate(gradU)); - divSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(snGradU&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - ) - ); - } - else if(divSigmaExpMethod == "expLaplacian") - { - divSigmaExp = - - fvc::laplacian(mu + lambda, U, "laplacian(U,U)") - + fvc::div - ( - mu*gradU.T() - + lambda*(I*tr(gradU)), - "div(sigma)" - ); - } - else - { - FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; - } + divSigmaExp = fvc::div + ( + mesh.magSf() + *( + - (muf + lambdaf)*(snGradU&(I - n*n)) + + lambdaf*tr(shearGradU&(I - n*n))*n + + muf*(shearGradU&n) + ) + ); +} +else if(divSigmaExpMethod == "expLaplacian") +{ + divSigmaExp = + - fvc::laplacian(mu + lambda, U, "laplacian(U,U)") + + fvc::div + ( + mu*gradU.T() + + lambda*(I*tr(gradU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H index 6565fc33d..54cdd60f6 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H @@ -23,138 +23,131 @@ philipc //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ //***** FIX INCORRECT POINT ON PATCHES WITH FACEZONE *****// contactPatchPairList& contacts = contact; forAll(contacts, contactI) - { - label masterID = contacts[contactI].masterPatch().index(); - label slaveID = contacts[contactI].slavePatch().index(); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + primitivePatchInterpolation masterInterpolator + ( + mesh.boundaryMesh()[masterID] + ); + primitivePatchInterpolation slaveInterpolator + ( + mesh.boundaryMesh()[slaveID] + ); - //- U must be interpolated to the vertices, this ignores the faceZone - //- points with no U (unlike volPointInterpolation) - vectorField correctMasterPointU = - masterInterpolator.faceToPointInterpolate - ( - U.boundaryField()[masterID] - ); - vectorField correctSlavePointU = - slaveInterpolator.faceToPointInterpolate - ( - U.boundaryField()[slaveID] - ); + //- U must be interpolated to the vertices, this ignores the faceZone + //- points with no U (unlike volPointInterpolation) + vectorField correctMasterPointU = + masterInterpolator.faceToPointInterpolate + ( + U.boundaryField()[masterID] + ); + vectorField correctSlavePointU = + slaveInterpolator.faceToPointInterpolate + ( + U.boundaryField()[slaveID] + ); - vectorField oldMasterPoints = - mesh.boundaryMesh()[masterID].localPoints(); - vectorField oldSlavePoints = - mesh.boundaryMesh()[slaveID].localPoints(); - - labelList masterPointLabels = - mesh.boundaryMesh()[masterID].meshPoints(); - labelList slavePointLabels = - mesh.boundaryMesh()[slaveID].meshPoints(); - - //- correct the patch newPoints - forAll(masterPointLabels, pointI) - { - label pointGlobalLabel = masterPointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldMasterPoints[pointI] - + - correctMasterPointU[pointI]; - } - forAll(slavePointLabels, pointI) - { - label pointGlobalLabel = slavePointLabels[pointI]; - newPoints[pointGlobalLabel] = - oldSlavePoints[pointI] - + - correctSlavePointU[pointI]; - } - } + vectorField oldMasterPoints = + mesh.boundaryMesh()[masterID].localPoints(); + vectorField oldSlavePoints = + mesh.boundaryMesh()[slaveID].localPoints(); + labelList masterPointLabels = + mesh.boundaryMesh()[masterID].meshPoints(); + labelList slavePointLabels = + mesh.boundaryMesh()[slaveID].meshPoints(); + //- correct the patch newPoints + forAll(masterPointLabels, pointI) + { + label pointGlobalLabel = masterPointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldMasterPoints[pointI] + correctMasterPointU[pointI]; + } + forAll(slavePointLabels, pointI) + { + label pointGlobalLabel = slavePointLabels[pointI]; + newPoints[pointGlobalLabel] = + oldSlavePoints[pointI] + correctSlavePointU[pointI]; + } + } //***** NOW FIX AND SYNCHRONISE ALL THE FACEZONE POINTS *****// forAll(mesh.faceZones(), faceZoneI) - { - //- find the patch corresponding to this faceZone - //- assuming that the FZ is called FaceZone - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + { + //- find the patch corresponding to this faceZone + //- assuming that the FZ is called FaceZone + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); + vectorField globalFZpoints = + mesh.faceZones()[faceZoneI]().localPoints(); - //- new points for the face zone - vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); + //- new points for the face zone + vectorField globalFZnewPoints(globalFZpoints.size(), vector::zero); - //- inter-proc points are shared by multiple procs - //- pointNumProc is the number of procs which a point lies on - scalarField pointNumProcs(globalFZpoints.size(), 0.0); + //- inter-proc points are shared by multiple procs + //- pointNumProc is the number of procs which a point lies on + scalarField pointNumProcs(globalFZpoints.size(), 0.0); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) - if(pointOnLocalProcPatch[faceZoneI][localPoint]) - { - label procPoint = - mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; - globalFZnewPoints[globalPointI] = - newPoints[procPoint]; - pointNumProcs[globalPointI] = 1; - } - } + //if(localPoint < mesh.boundaryMesh()[patchID].localPoints().size()) + if(pointOnLocalProcPatch[faceZoneI][localPoint]) + { + label procPoint = + mesh.faceZones()[faceZoneI]().meshPoints()[localPoint]; + globalFZnewPoints[globalPointI] = newPoints[procPoint]; + pointNumProcs[globalPointI] = 1; + } + } - reduce(globalFZnewPoints, sumOp()); - reduce(pointNumProcs, sumOp()); + reduce(globalFZnewPoints, sumOp()); + reduce(pointNumProcs, sumOp()); - //- now average the newPoints between all procs - if(min(pointNumProcs) < 1) - { - FatalError << "pointNumProc has not been set for all points" << exit(FatalError); - } - globalFZnewPoints /= pointNumProcs; + //- now average the newPoints between all procs + if(min(pointNumProcs) < 1) + { + FatalError << "pointNumProc has not been set for all points" << exit(FatalError); + } + globalFZnewPoints /= pointNumProcs; - //- the globalFZnewPoints now contains the correct FZ new points in - //- a global order, now convert them back into the local proc order + //- the globalFZnewPoints now contains the correct FZ new points in + //- a global order, now convert them back into the local proc order - vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); + vectorField procFZnewPoints(globalFZpoints.size(), vector::zero); - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } + //- now fix the newPoints points on the globalFaceZones + labelList procFZmeshPoints = mesh.faceZones()[faceZoneI]().meshPoints(); - //- now fix the newPoints points on the globalFaceZones - labelList procFZmeshPoints = - mesh.faceZones()[faceZoneI]().meshPoints(); - - forAll(procFZmeshPoints, pointI) - { - label procPoint = procFZmeshPoints[pointI]; - newPoints[procPoint] = - procFZnewPoints[pointI]; - } - } - } + forAll(procFZmeshPoints, pointI) + { + label procPoint = procFZmeshPoints[pointI]; + newPoints[procPoint] = procFZnewPoints[pointI]; + } + } +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/createFields.H index f313ddaa4..15b6c1ae2 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/createFields.H @@ -59,22 +59,22 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divSigmaExp - ( + volVectorField divSigmaExp + ( IOobject ( - "divSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); - // read rheology properties + // read rheology properties rheologyModel rheology(sigma); volScalarField rho = rheology.rho(); diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/createGlobalToLocalFaceZonePointMap.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/createGlobalToLocalFaceZonePointMap.H index 971bc377e..6d0560802 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/createGlobalToLocalFaceZonePointMap.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/createGlobalToLocalFaceZonePointMap.H @@ -19,117 +19,117 @@ philipc //- these are read if present to allow restarting of contact cases IOList procToGlobalFZmap ( - IOobject - ( - "procToGlobalFZmap", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() - ); + IOobject + ( + "procToGlobalFZmap", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() +); IOList pointOnLocalProcPatch ( - IOobject - ( - "pointOnLocalProcPatch", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - mesh.faceZones().size() + IOobject + ( + "pointOnLocalProcPatch", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh.faceZones().size() ); //- if they have been read then don't recalculate it bool globalFaceZoneMappingSet = false; if(gMax(procToGlobalFZmap[0]) > 0 && gMax(pointOnLocalProcPatch[0]) > 0) - { +{ Info << "Reading procToGlobalFZmap and pointOnLocalProcPatch allowing restart of contact cases" - << endl; + << endl; globalFaceZoneMappingSet = true; - } - else - { - Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl - << "this message should only appear starting a new analysis" << endl; - } +} +else +{ + Info << "procToGlobalFZmap and pointOnLocalProcPatch will be calculated as it has not been found" << nl + << "this message should only appear starting a new analysis" << endl; +} //- this is only needed in a parallel runs if(Pstream::parRun()) - { +{ if(!globalFaceZoneMappingSet) - { - forAll(mesh.faceZones(), faceZoneI) - { - vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + { + forAll(mesh.faceZones(), faceZoneI) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); + procToGlobalFZmap[faceZoneI].setSize(globalFZpoints.size(), 0); - //- set all slave points to zero because only the master order is used - if(!Pstream::master()) - globalFZpoints *= 0.0; + //- set all slave points to zero because only the master order is used + if(!Pstream::master()) + { + globalFZpoints *= 0.0; + } - //- pass points to all procs - reduce(globalFZpoints, sumOp()); + //- pass points to all procs + reduce(globalFZpoints, sumOp()); - //- now every proc has the master's list of FZ points - //- every proc must now find the mapping from their local FZpoints to - //- the globalFZpoints + //- now every proc has the master's list of FZ points + //- every proc must now find the mapping from their local FZpoints to + //- the globalFZpoints - vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); - forAll(globalFZpoints, globalPointI) - { - forAll(procFZpoints, procPointI) - { - if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) - { - procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; - break; - } - } - } - //- procToGlobalFZmap now contains the local FZpoint label for each - //- global FZ point label - for each faceZone + forAll(globalFZpoints, globalPointI) + { + forAll(procFZpoints, procPointI) + { + if(procFZpoints[procPointI] == globalFZpoints[globalPointI]) + { + procToGlobalFZmap[faceZoneI][globalPointI] = procPointI; + break; + } + } + } - //- check what points are on the current proc patch - pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); + //- check what points are on the current proc patch + pointOnLocalProcPatch[faceZoneI].setSize(globalFZpoints.size(), 0); - //- find corresponding patch - string faceZoneName = mesh.faceZones().names()[faceZoneI]; - //- remove the string FaceZone from the end of the face zone name to get the patch name - string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) - { - FatalError << "Patch " << patchName << " not found corresponding for faceZone" - << faceZoneName << exit(FatalError); - } + //- find corresponding patch + string faceZoneName = mesh.faceZones().names()[faceZoneI]; + //- remove the string FaceZone from the end of the face zone name to get the patch name + string patchName = faceZoneName.substr(0, (faceZoneName.size()-8)); + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) + { + FatalError << "Patch " << patchName << " not found corresponding for faceZone" + << faceZoneName << exit(FatalError); + } - forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) - { - forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) - { - if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) - { - pointOnLocalProcPatch[faceZoneI][fzpi] = 1; - break; - } - } - } - } - } //- end if(!globalFaceZoneMappingSet) - } + forAll(mesh.faceZones()[faceZoneI]().localPoints(), fzpi) + { + forAll(mesh.boundaryMesh()[patchID].localPoints(), pi) + { + if(mesh.faceZones()[faceZoneI]().localPoints()[fzpi] == mesh.boundaryMesh()[patchID].localPoints()[pi]) + { + pointOnLocalProcPatch[faceZoneI][fzpi] = 1; + break; + } + } + } + } + } //- end if(!globalFaceZoneMappingSet) +} //- write to disk to allow restart of cases //- because it is not possible to calculate the //- mapping after the meshes have moved if(!globalFaceZoneMappingSet) - { +{ procToGlobalFZmap.write(); pointOnLocalProcPatch.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/elasticContactSolidFoam.C b/applications/solvers/solidMechanics/elasticContactSolidFoam/elasticContactSolidFoam.C index 3769c9003..8017ae583 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/elasticContactSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/elasticContactSolidFoam.C @@ -66,140 +66,140 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivSigmaExpMethod.H" +# include "readDivSigmaExpMethod.H" -# include "createGlobalToLocalFaceZonePointMap.H" +# include "createGlobalToLocalFaceZonePointMap.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nStarting time loop\n" << endl; + Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << endl; + Info<< "Time: " << runTime.timeName() << endl; -# include "readContactControls.H" +# include "readContactControls.H" -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - //-- for moving the mesh and then back again - vectorField oldMeshPoints = mesh.allPoints(); + //-- for moving the mesh and then back again + vectorField oldMeshPoints = mesh.allPoints(); - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - word solverName; - lduMatrix::debug = 0; - scalar residual = GREAT; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + word solverName; + lduMatrix::debug = 0; + scalar residual = GREAT; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; - //- Predictor step - if (predictor) + //- Predictor step + if (predictor) { - Info << "\nPredicting U, gradU and snGradU based on V, gradV and snGradV\n" << endl; - U += V*runTime.deltaT(); - gradU += gradV*runTime.deltaT(); - snGradU += snGradV*runTime.deltaT(); + Info << "\nPredicting U, gradU and snGradU based on V, gradV and snGradV\n" << endl; + U += V*runTime.deltaT(); + gradU += gradV*runTime.deltaT(); + snGradU += snGradV*runTime.deltaT(); } - do //- start of momentum loop - { - U.storePrevIter(); + do //- start of momentum loop + { + U.storePrevIter(); - //- correct the contact boundaries - if(iCorr % uEqnContactCorrFreq == 0) - { - Info << "\t\tCorrecting contact in the momentum loop " - << "iteration: " << iCorr - << ", residual: " << residual - << endl; - //# include "moveMeshLeastSquares.H" -# include "moveSolidMesh.H" - contact.correct(); - mesh.movePoints(oldMeshPoints); - } + //- correct the contact boundaries + if(iCorr % uEqnContactCorrFreq == 0) + { + Info << "\t\tCorrecting contact in the momentum loop " + << "iteration: " << iCorr + << ", residual: " << residual + << endl; +//# include "moveMeshLeastSquares.H" +# include "moveSolidMesh.H" + contact.correct(); + mesh.movePoints(oldMeshPoints); + } -# include "calculateDivSigmaExp.H" +# include "calculateDivSigmaExp.H" - fvVectorMatrix UEqn - ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") - + divSigmaExp - ); + fvVectorMatrix UEqn + ( + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") + + divSigmaExp + ); - solverPerf = UEqn.solve(); + solverPerf = UEqn.solve(); - U.relax(); + U.relax(); - solverName = solverPerf.solverName(); + solverName = solverPerf.solverName(); - gradU = fvc::grad(U); - snGradU = fvc::snGrad(U); + gradU = fvc::grad(U); + snGradU = fvc::snGrad(U); - residual = solverPerf.initialResidual(); + residual = solverPerf.initialResidual(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } //- end of momentum loop - while - ( - //relativeResidual > convergenceTolerance - residual > convergenceTolerance - && - ++iCorr < nCorr - ); + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << U.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; + } //- end of momentum loop + while + ( + //relativeResidual > convergenceTolerance + residual > convergenceTolerance + && + ++iCorr < nCorr + ); - // Print out info per contact iteration - Info << "\t\tSolving for " << U.name() - << " using " << solverName - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; + // Print out info per contact iteration + Info << "\t\tSolving for " << U.name() + << " using " << solverName + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; - lduMatrix::debug = 1; + lduMatrix::debug = 1; - V = fvc::ddt(U); - gradV = fvc::ddt(gradU); - snGradV = (snGradU - snGradU.oldTime())/runTime.deltaT(); + V = fvc::ddt(U); + gradV = fvc::ddt(gradU); + snGradV = (snGradU - snGradU.oldTime())/runTime.deltaT(); -# include "calculateEpsilonSigma.H" +# include "calculateEpsilonSigma.H" -# include "writeFields.H" +# include "writeFields.H" - //# include "moveMeshLeastSquares.H" - //# include "moveSolidMesh.H" - //# include "printContactResults.H" - //mesh.movePoints(oldMeshPoints); +//# include "moveMeshLeastSquares.H" +//# include "moveSolidMesh.H" +//# include "printContactResults.H" +// mesh.movePoints(oldMeshPoints); - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H index 65373c592..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H index 2600c9ea4..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H @@ -1,5 +1,5 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); @@ -12,39 +12,39 @@ if (runTime.outputTime()) //-------------------------------------------------------------// //This is the point distance for each contact vertex pointScalarField cGapPoints - ( - IOobject - ( - "pointContactGap", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedScalar("scalar", dimLength, 0.0), - "calculated" - ); + ( + IOobject + ( + "pointContactGap", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedScalar("scalar", dimLength, 0.0), + "calculated" + ); contact.contactGapPoints(cGapPoints); cGapPoints.write(); - //- This is the point distance for each contact vertex - pointVectorField cPointForce - ( - IOobject - ( - "pointContactForce", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - pMesh, - dimensionedVector("vector", dimForce, vector::zero), - "calculated" - ); + //- This is the point distance for each contact vertex + pointVectorField cPointForce + ( + IOobject + ( + "pointContactForce", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + dimensionedVector("vector", dimForce, vector::zero), + "calculated" + ); contact.contactPointForce(cPointForce); cPointForce.write(); @@ -52,4 +52,4 @@ if (runTime.outputTime()) //- SHOULD THIS BE A REF TO A TMP...? volScalarField cPressure = contact.contactPressure(); cPressure.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/readDivSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/readDivSigmaExpMethod.H index ae2580772..00ca52a24 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/readDivSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/readDivSigmaExpMethod.H @@ -4,6 +4,6 @@ Info << divSigmaExpMethod << " method chosen for calculation of sigmaExp" << end if(divSigmaExpMethod != "standard" && divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose" && divSigmaExpMethod != "laplacian") { FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); } diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/calculateDivSigmaExp.H b/applications/solvers/solidMechanics/elasticGravitySolidFoam/calculateDivSigmaExp.H index adba22d5d..abd9cc09d 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/calculateDivSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/calculateDivSigmaExp.H @@ -1,47 +1,46 @@ if(divSigmaExpMethod == "standard") - { +{ divSigmaExp = fvc::div - ( + ( mu*gradU.T() + lambda*(I*tr(gradU)) - (mu + lambda)*gradU, "div(sigma)" - ); - } - else if(divSigmaExpMethod == "surface") - { - divSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) - ); - } - else if(divSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradU)); + ); +} +else if(divSigmaExpMethod == "surface") +{ + divSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) + ); +} +else if(divSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradU = ((I - n*n)&fvc::interpolate(gradU)); - divSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - ) - ); - } - else if(divSigmaExpMethod == "expLaplacian") - { - divSigmaExp = - - fvc::laplacian(mu + lambda, U, "laplacian(DU,U)") - + fvc::div - ( - mu*gradU.T() - + lambda*(I*tr(gradU)), - "div(sigma)" - ); - } - else - { - FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; - } + divSigmaExp = fvc::div + ( + mesh.magSf() + *( + - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) + + lambdaf*tr(shearGradU&(I - n*n))*n + + muf*(shearGradU&n) + ) + ); +} +else if(divSigmaExpMethod == "expLaplacian") +{ + divSigmaExp = + - fvc::laplacian(mu + lambda, U, "laplacian(DU,U)") + + fvc::div + ( + mu*gradU.T() + + lambda*(I*tr(gradU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticGravitySolidFoam/createFields.H index e15c1bebb..d604afd81 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/createFields.H @@ -42,19 +42,19 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divSigmaExp - ( + volVectorField divSigmaExp + ( IOobject ( - "divSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); rheologyModel rheology(sigma); diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticGravitySolidFoam/createSolidInterface.H index 665435c98..392bcdaec 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/createSolidInterface.H @@ -4,21 +4,21 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divSigmaExp - if(divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose") - { - FatalError << "divSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divSigmaExp + if(divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose") + { + FatalError << "divSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/elasticGravitySolidFoam.C b/applications/solvers/solidMechanics/elasticGravitySolidFoam/elasticGravitySolidFoam.C index dabb562e8..34cadecd5 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/elasticGravitySolidFoam.C +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/elasticGravitySolidFoam.C @@ -52,116 +52,116 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivSigmaExpMethod.H" +# include "readDivSigmaExpMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" -# include "readGravity.H" +# include "readGravity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - lduMatrix::debug=0; + lduMatrix::debug=0; - do + do { - U.storePrevIter(); + U.storePrevIter(); -# include "calculateDivSigmaExp.H" +# include "calculateDivSigmaExp.H" - //- linear momentum equation - fvVectorMatrix UEqn + //- linear momentum equation + fvVectorMatrix UEqn ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") - + divSigmaExp - + rho*gravity - ); + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") + + divSigmaExp + + rho*gravity + ); - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(UEqn); - } + if(solidInterfaceCorr) + { + solidInterfacePtr->correct(UEqn); + } - solverPerf = UEqn.solve(); + solverPerf = UEqn.solve(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - U.relax(); + U.relax(); - if(solidInterfaceCorr) - { - gradU = solidInterfacePtr->grad(U); - } - else - { - gradU = fvc::grad(U); - } + if(solidInterfaceCorr) + { + gradU = solidInterfacePtr->grad(U); + } + else + { + gradU = fvc::grad(U); + } -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << U.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; } - while - ( - //solverPerf.initialResidual() > convergenceTolerance - relativeResidual > convergenceTolerance - && - ++iCorr < nCorr - ); + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); - Info << nl << "Time " << runTime.value() << ", Solving for " << U.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", Relative residual = " << relativeResidual - << ", No outer iterations " << iCorr - << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info << nl << "Time " << runTime.value() << ", Solving for " << U.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", Relative residual = " << relativeResidual + << ", No outer iterations " << iCorr + << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - lduMatrix::debug=0; + lduMatrix::debug=0; -# include "calculateEpsilonSigma.H" +# include "calculateEpsilonSigma.H" -# include "writeFields.H" +# include "writeFields.H" - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/readDivSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticGravitySolidFoam/readDivSigmaExpMethod.H index 094886708..6907bdc07 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/readDivSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/readDivSigmaExpMethod.H @@ -1,9 +1,15 @@ //- how explicit component of sigma is to be calculated word divSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divSigmaExp")); Info << "Selecting divSigmaExp calculation method " << divSigmaExpMethod << endl; -if(divSigmaExpMethod != "standard" && divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose" && divSigmaExpMethod != "laplacian") - { +if +( + divSigmaExpMethod != "standard" + && divSigmaExpMethod != "surface" + && divSigmaExpMethod != "decompose" + && divSigmaExpMethod != "laplacian" +) +{ FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticGravitySolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticGravitySolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticGravitySolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticGravitySolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateDivDSigmaExp.H index dd9244a67..5f8963e5a 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") - { +{ divDSigmaExp = fvc::div - ( - mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, - "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradDU = - ((I - n*n)&fvc::interpolate(gradDU)); + ( + mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradDU = ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) - + lambdaf*tr(shearGradDU&(I - n*n))*n - + muf*(shearGradDU&n) - ) - ); - } - else if(divDSigmaExpMethod == "laplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) + + lambdaf*tr(shearGradDU&(I - n*n))*n + + muf*(shearGradDU&n) + ) + ); +} +else if(divDSigmaExpMethod == "laplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)") + fvc::div - ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } + ( + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H index 889105a2f..f53811e9a 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H @@ -83,19 +83,19 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divDSigmaExp - ( + volVectorField divDSigmaExp + ( IOobject ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); rheologyModel rheology(sigma); diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createSolidInterface.H index 6fe213be0..e37cfdebb 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createSolidInterface.H @@ -4,21 +4,21 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divDSigmaExp - if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") - { - FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divDSigmaExp + if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") + { + FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C index d116ff7cf..612dd2d09 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C @@ -51,118 +51,118 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::solverPerformance solverPerf; - lduMatrix::debug = 0; + int iCorr = 0; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::solverPerformance solverPerf; + lduMatrix::debug = 0; - do + do { - DU.storePrevIter(); + DU.storePrevIter(); -# include "calculateDivDSigmaExp.H" +# include "calculateDivDSigmaExp.H" - //- linear momentum equation - fvVectorMatrix DUEqn + //- linear momentum equation + fvVectorMatrix DUEqn ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") - + divDSigmaExp - ); + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") + + divDSigmaExp + ); - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } + if(solidInterfaceCorr) + { + solidInterfacePtr->correct(DUEqn); + } - solverPerf = DUEqn.solve(); + solverPerf = DUEqn.solve(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - DU.relax(); + DU.relax(); - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; } - while - ( - //solverPerf.initialResidual() > convergenceTolerance - relativeResidual > convergenceTolerance - && - ++iCorr < nCorr - ); + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); - Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", Relative residual = " << relativeResidual - << ", No outer iterations " << iCorr - << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", Relative residual = " << relativeResidual + << ", No outer iterations " << iCorr + << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - lduMatrix::debug=0; + lduMatrix::debug=0; -# include "calculateDEpsilonDSigma.H" +# include "calculateDEpsilonDSigma.H" - U += DU; - sigma += DSigma; - epsilon += DEpsilon; + U += DU; + sigma += DSigma; + epsilon += DEpsilon; -# include "writeFields.H" +# include "writeFields.H" -# include "calculateNetForces.H" +# include "calculateNetForces.H" - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H index c8109256b..12ef21015 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,15 @@ //- how explicit component of sigma is to be calculated word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << "Selecting divDSigmaExp calculation method " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeForceDisplacement.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeForceDisplacement.H index 92463721e..59aad7261 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeForceDisplacement.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeForceDisplacement.H @@ -2,47 +2,48 @@ label leftPatchID = mesh.boundaryMesh().findPatchID("leftClamp"); if(leftPatchID == -1) - { +{ FatalError << "Cannot find patch left for calculating force" << endl; - } +} //- calculate force in x direction on leftClamp patch -scalar leftForce = gSum( - vector(1, 0, 0) & - (mesh.boundary()[leftPatchID].Sf() & sigma.boundaryField()[leftPatchID]) - ); +scalar leftForce = gSum +( + vector(1, 0, 0) + & (mesh.boundary()[leftPatchID].Sf() & sigma.boundaryField()[leftPatchID]) +); //- patchIntegrate utility integrates it this way but this is worng because the sigma tensor should //- be dotted with the surface normal to give the actual traction/force //- you cannot just take the component of the sigma tensor //scalar leftForcePatchIntegrateMethod = gSum( -// mesh.magSf().boundaryField()[leftPatchID] -// *sigma.boundaryField()[leftPatchID].component(symmTensor::XY) -// ); +// mesh.magSf().boundaryField()[leftPatchID] +// *sigma.boundaryField()[leftPatchID].component(symmTensor::XY) +// ); vector gaugeU1 = vector::zero; vector gaugeU2 = vector::zero; if(gaugeFaceID1 != -1) - { +{ gaugeU1 = U.boundaryField()[gaugeFacePatchID1][gaugeFaceID1]; - } +} if(gaugeFaceID2 != -1) - { +{ gaugeU2 = U.boundaryField()[gaugeFacePatchID2][gaugeFaceID2]; - } +} //- reduce across procs reduce(gaugeU1, sumOp()); reduce(gaugeU2, sumOp()); Pout << "gaugeU1 is " << gaugeU1 << nl - << "gaugeU2 is " << gaugeU2 << endl; + << "gaugeU2 is " << gaugeU2 << endl; scalar gaugeDisp = mag(gaugeU1 - gaugeU2); //- write to file if(Pstream::master()) - { +{ OFstream& forceDispFile = *filePtr; forceDispFile << 1000*gaugeDisp << "\t" << -1*leftForce << endl; - } +} diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/correctDirectionMixedTL.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/correctDirectionMixedTL.H index 5561a4804..b726a1b77 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/correctDirectionMixedTL.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/correctDirectionMixedTL.H @@ -1,33 +1,35 @@ { - forAll(mesh.boundary(), patchID) + forAll(mesh.boundary(), patchID) { - if(U.boundaryField()[patchID].type() - == solidDirectionMixedFvPatchVectorField::typeName - ) - { - solidDirectionMixedFvPatchVectorField& loadingPatch = - refCast - ( - U.boundaryField()[patchID] - ); + if + ( + U.boundaryField()[patchID].type() + == solidDirectionMixedFvPatchVectorField::typeName + ) + { + solidDirectionMixedFvPatchVectorField& loadingPatch = + refCast + ( + U.boundaryField()[patchID] + ); - tensorField Finv = inv(I + gradU); - vectorField newN = Finv & n.boundaryField()[patchID]; - newN /= mag(newN); - loadingPatch.valueFraction() = sqr(newN); + tensorField Finv = inv(I + gradU); + vectorField newN = Finv & n.boundaryField()[patchID]; + newN /= mag(newN); + loadingPatch.valueFraction() = sqr(newN); - //- set gradient - loadingPatch.refGrad() = - ( - //Traction - ( (mu.boundaryField()[patchID] + lambda.boundaryField()[patchID]) * (n.boundaryField()[patchID] & gradU.boundaryField()[patchID]) ) - - ( mu.boundaryField()[patchID] * (n.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) ) - - ( mu.boundaryField()[patchID] * ( n.boundaryField()[patchID] & (gradU.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) ) ) - - ( lambda.boundaryField()[patchID] * tr(gradU.boundaryField()[patchID]) * n.boundaryField()[patchID] ) - - ( 0.5 * lambda.boundaryField()[patchID] * tr(gradU.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) * n.boundaryField()[patchID] ) - ) - / - (2.0*mu.boundaryField()[patchID] + lambda.boundaryField()[patchID]); - } + //- set gradient + loadingPatch.refGrad() = + ( + //Traction + ( (mu.boundaryField()[patchID] + lambda.boundaryField()[patchID]) * (n.boundaryField()[patchID] & gradU.boundaryField()[patchID]) ) + - ( mu.boundaryField()[patchID] * (n.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) ) + - ( mu.boundaryField()[patchID] * ( n.boundaryField()[patchID] & (gradU.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) ) ) + - ( lambda.boundaryField()[patchID] * tr(gradU.boundaryField()[patchID]) * n.boundaryField()[patchID] ) + - ( 0.5 * lambda.boundaryField()[patchID] * tr(gradU.boundaryField()[patchID] & gradU.boundaryField()[patchID].T()) * n.boundaryField()[patchID] ) + ) + / + (2.0*mu.boundaryField()[patchID] + lambda.boundaryField()[patchID]); + } } } diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H index 2c5b51276..af5c5f8ed 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H @@ -25,7 +25,7 @@ IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), - symm(gradU) + 0.5*symm(gradU.T() & gradU) + symm(gradU) + 0.5*symm(gradU.T() & gradU) ); //- second Piloa-Kirchhoff stress tensor diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C index 56f5fe7c8..31ce0d1ed 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C @@ -47,104 +47,105 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - lduMatrix::debug=0; + lduMatrix::debug=0; - do + do { - U.storePrevIter(); + U.storePrevIter(); -# include "correctDirectionMixedTL.H" +# include "correctDirectionMixedTL.H" - fvVectorMatrix UEqn + fvVectorMatrix UEqn ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") - + fvc::div( - -( (mu + lambda) * gradU ) - + ( mu * gradU.T() ) - + ( mu * (gradU & gradU.T()) ) - + ( lambda * tr(gradU) * I ) - + ( 0.5 * lambda * tr(gradU & gradU.T()) * I ) - + ( sigma & gradU ), - "div(sigma)" - ) - ); + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") + + fvc::div + ( + - ( (mu + lambda) * gradU ) + + ( mu * gradU.T() ) + + ( mu * (gradU & gradU.T()) ) + + ( lambda * tr(gradU) * I ) + + ( 0.5 * lambda * tr(gradU & gradU.T()) * I ) + + ( sigma & gradU ), + "div(sigma)" + ) + ); - solverPerf = UEqn.solve(); + solverPerf = UEqn.solve(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - U.relax(); + U.relax(); - gradU = fvc::grad(U); + gradU = fvc::grad(U); -# include "calculateEpsilonSigma.H" +# include "calculateEpsilonSigma.H" -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } - while - ( - solverPerf.initialResidual() > convergenceTolerance - //relativeResidual > convergenceTolerance - && - ++iCorr < nCorr - ); + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << U.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; + } + while + ( + solverPerf.initialResidual() > convergenceTolerance + //relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); - Info << nl << "Time " << runTime.value() << ", Solving for " << U.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", Relative residual = " << relativeResidual - << ", No outer iterations " << iCorr - << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info << nl << "Time " << runTime.value() << ", Solving for " << U.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", Relative residual = " << relativeResidual + << ", No outer iterations " << iCorr + << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - lduMatrix::debug=0; + lduMatrix::debug=0; -# include "writeFields.H" +# include "writeFields.H" - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H index 08933d061..9f75e42f2 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointU - ( - IOobject - ( - "pointU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(U, pointU); - const vectorField& pointUI = - pointU.internalField(); + const vectorField& pointUI = pointU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointUI, pointI) - { + { newPoints[pointI] += pointUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H index 3f3a04905..232e33927 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; //- Calculate Cauchy stress volTensorField F = I + gradU; @@ -40,34 +40,34 @@ if (runTime.outputTime()) rho = rho/J; volSymmTensorField sigmaCauchy - ( - IOobject - ( - "sigmaCauchy", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - (1/J) * symm(F.T() & sigma & F) - ); + ( + IOobject + ( + "sigmaCauchy", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + (1/J) * symm(F.T() & sigma & F) + ); //- Cauchy von Mises stress volScalarField sigmaCauchyEq - ( - IOobject - ( - "sigmaCauchyEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), + ( + IOobject + ( + "sigmaCauchyEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), sqrt((3.0/2.0)*magSqr(dev(sigmaCauchy))) - ); + ); Info<< "Max sigmaCauchyEq = " << max(sigmaCauchyEq).value() - << endl; + << endl; //- write boundary forces //- integrate (sigma2PK & F) over reference area @@ -75,30 +75,30 @@ if (runTime.outputTime()) //- over the deformed area Info << nl; forAll(mesh.boundary(), patchi) - { - Info << "Patch " << mesh.boundary()[patchi].name() << endl; - tensorField F = I + gradU.boundaryField()[patchi]; - vectorField totalForce = mesh.Sf().boundaryField()[patchi] & (sigma.boundaryField()[patchi] & F); + { + Info << "Patch " << mesh.boundary()[patchi].name() << endl; + tensorField F = I + gradU.boundaryField()[patchi]; + vectorField totalForce = mesh.Sf().boundaryField()[patchi] & (sigma.boundaryField()[patchi] & F); - vector force = sum( totalForce ); - Info << "\ttotal force is " << force << " N" << endl; + vector force = sum( totalForce ); + Info << "\ttotal force is " << force << " N" << endl; - tensorField Finv = inv(F); - vectorField nCurrent = Finv & n.boundaryField()[patchi]; - nCurrent /= mag(nCurrent); - scalar normalForce = sum( nCurrent & totalForce ); - Info << "\tnormal force is " << normalForce << " N" << endl; - scalar shearForce = mag(sum( (I - sqr(nCurrent)) & totalForce )); - Info << "\tshear force is " << shearForce << " N" << endl << endl;; - } + tensorField Finv = inv(F); + vectorField nCurrent = Finv & n.boundaryField()[patchi]; + nCurrent /= mag(nCurrent); + scalar normalForce = sum( nCurrent & totalForce ); + Info << "\tnormal force is " << normalForce << " N" << endl; + scalar shearForce = mag(sum( (I - sqr(nCurrent)) & totalForce )); + Info << "\tshear force is " << shearForce << " N" << endl << endl;; + } //- move mesh for visualisation and move it back after writing vectorField oldPoints = mesh.allPoints(); - #include "moveMeshLeastSquares.H" +# include "moveMeshLeastSquares.H" runTime.write(); //- move mesh back mesh.movePoints(oldPoints); - } +} diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaExp.H index dd9244a67..5f8963e5a 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") - { +{ divDSigmaExp = fvc::div - ( - mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, - "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradDU = - ((I - n*n)&fvc::interpolate(gradDU)); + ( + mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradDU = ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) - + lambdaf*tr(shearGradDU&(I - n*n))*n - + muf*(shearGradDU&n) - ) - ); - } - else if(divDSigmaExpMethod == "laplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) + + lambdaf*tr(shearGradDU&(I - n*n))*n + + muf*(shearGradDU&n) + ) + ); +} +else if(divDSigmaExpMethod == "laplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)") + fvc::div - ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } + ( + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H index 10722f94f..ab691c7cd 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H @@ -2,32 +2,32 @@ //- sigma explicit large strain explicit terms //----------------------------------------------------// if(divDSigmaLargeStrainExpMethod == "standard") - { +{ divDSigmaLargeStrainExp = - fvc::div - ( - mu*(gradDU & gradDU.T()) - + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) - + ((sigma + DSigma) & gradDU), - "div(sigma)" - ); - } - else if(divDSigmaLargeStrainExpMethod == "surface") - { - divDSigmaLargeStrainExp = - fvc::div - ( - muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) - + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) - + (mesh.Sf() & fvc::interpolate( (sigma + DSigma) & gradDU )) - ); - } - else - { + fvc::div + ( + mu*(gradDU & gradDU.T()) + + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) + + ((sigma + DSigma) & gradDU), + "div(sigma)" + ); +} +else if(divDSigmaLargeStrainExpMethod == "surface") +{ + divDSigmaLargeStrainExp = + fvc::div + ( + muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) + + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) + + (mesh.Sf() & fvc::interpolate( (sigma + DSigma) & gradDU )) + ); +} +else +{ FatalError - << "divDSigmaLargeStrainMethod not found!" - << exit(FatalError); - } + << "divDSigmaLargeStrainMethod not found!" + << exit(FatalError); +} //- relax divDSigmaLargeStrainExp.relax(); diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateExtrapolationVectors.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateExtrapolationVectors.H index a8008f025..9007c94dd 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateExtrapolationVectors.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculateExtrapolationVectors.H @@ -15,59 +15,58 @@ FieldField extraVecs(ptc.size()); { - const labelListList& pfaces = mesh.pointFaces(); + const labelListList& pfaces = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - forAll (ptc, pointI) + forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = pfaces[curPoint]; + const labelList& curFaces = pfaces[curPoint]; - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); - vectorField& curExtraVectors = extraVecs[pointI]; + vectorField& curExtraVectors = extraVecs[pointI]; - label nFacesAroundPoint = 0; + label nFacesAroundPoint = 0; - const vector& pointLoc = mesh.points()[curPoint]; + const vector& pointLoc = mesh.points()[curPoint]; - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(bm[patchID]) - && !bm[patchID].coupled() - ) - { - // Found a face for extrapolation - curExtraVectors[nFacesAroundPoint] = - pointLoc - - centres.boundaryField()[patchID] - [bm[patchID].patch().whichFace(curFaces[faceI])]; + if + ( + !isA(bm[patchID]) + && !bm[patchID].coupled() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; - nFacesAroundPoint++; - } - } - } + nFacesAroundPoint++; + } + } + } - curExtraVectors.setSize(nFacesAroundPoint); + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H index 664110dc4..ade989cac 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H @@ -8,114 +8,116 @@ FieldField w(ptc.size()); { - const labelListList& pf = mesh.pointFaces(); + const labelListList& pf = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - pointScalarField volPointSumWeights + pointScalarField volPointSumWeights ( - IOobject - ( - "volPointSumWeights", - mesh.polyMesh::instance(), - mesh - ), - pMesh, - dimensionedScalar("zero", dimless, 0) - ); - - forAll (ptc, pointI) - { - const label curPoint = ptc[pointI]; - - const labelList& curFaces = pf[curPoint]; - - //w.hook(new scalarField(curFaces.size())); //philipc no hook function - w.set - ( - pointI, - new scalarField(curFaces.size()) - ); - - scalarField& curWeights = w[pointI]; - - label nFacesAroundPoint = 0; - - const vector& pointLoc = mesh.points()[curPoint]; - - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); - - if - ( - !isA(bm[patchID]) - && !( - bm[patchID].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) - ) - { - curWeights[nFacesAroundPoint] = - 1.0/mag - ( - pointLoc - - centres.boundaryField()[patchID] - [ - bm[patchID].patch().whichFace(curFaces[faceI]) - ] - ); - - nFacesAroundPoint++; - } - } - } - - // Reset the sizes of the local weights - curWeights.setSize(nFacesAroundPoint); - - // Collect the sum of weights for parallel correction - volPointSumWeights[curPoint] += sum(curWeights); - } - - // Do parallel correction of weights - - // Update coupled boundaries - // Work-around for cyclic parallels. - /*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) - { - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].initAddField(); - } - } - - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].addField - ( - volPointSumWeights.internalField() + IOobject + ( + "volPointSumWeights", + mesh.polyMesh::instance(), + mesh + ), + pMesh, + dimensionedScalar("zero", dimless, 0) ); - } - } - }*/ - // Re-scale the weights for the current point - forAll (ptc, pointI) + forAll (ptc, pointI) { - w[pointI] /= volPointSumWeights[ptc[pointI]]; + const label curPoint = ptc[pointI]; + + const labelList& curFaces = pf[curPoint]; + + //w.hook(new scalarField(curFaces.size())); //philipc no hook function + w.set + ( + pointI, + new scalarField(curFaces.size()) + ); + + scalarField& curWeights = w[pointI]; + + label nFacesAroundPoint = 0; + + const vector& pointLoc = mesh.points()[curPoint]; + + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); + + if + ( + !isA(bm[patchID]) + && !( + bm[patchID].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) + ) + { + curWeights[nFacesAroundPoint] = + 1.0/mag + ( + pointLoc + - centres.boundaryField()[patchID] + [ + bm[patchID].patch().whichFace(curFaces[faceI]) + ] + ); + + nFacesAroundPoint++; + } + } + } + + // Reset the sizes of the local weights + curWeights.setSize(nFacesAroundPoint); + + // Collect the sum of weights for parallel correction + volPointSumWeights[curPoint] += sum(curWeights); + } + + // Do parallel correction of weights + + // Update coupled boundaries + // Work-around for cyclic parallels. +/* + if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) + { + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].initAddField(); + } + } + + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].addField + ( + volPointSumWeights.internalField() + ); + } + } + } +*/ + + // Re-scale the weights for the current point + forAll (ptc, pointI) + { + w[pointI] /= volPointSumWeights[ptc[pointI]]; } } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createFields.H index 84a6c6188..8dcce808b 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createFields.H @@ -91,32 +91,32 @@ //- explicit terms in the momentum equation volVectorField divDSigmaExp - ( - IOobject - ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) - ); + ( + IOobject + ( + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) + ); volVectorField divDSigmaLargeStrainExp - ( - IOobject - ( - "divDSigmaLargeStrainExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) - ); + ( + IOobject + ( + "divDSigmaLargeStrainExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) + ); rheologyModel rheology(sigma); volScalarField mu = rheology.mu(); diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createSolidInterface.H index 218325543..70645aa6c 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/createSolidInterface.H @@ -4,26 +4,26 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divDSigmaExp - if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") - { - FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - if(divDSigmaLargeStrainExpMethod == "surface") - { - FatalError << "divDSigmaLargeStrainExp must be surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divDSigmaExp + if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") + { + FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + if(divDSigmaLargeStrainExpMethod == "surface") + { + FatalError << "divDSigmaLargeStrainExp must be surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C index d65925456..075ec6fab 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C @@ -53,131 +53,131 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "readDivDSigmaLargeStrainExpMethod.H" +# include "readDivDSigmaLargeStrainExpMethod.H" -# include "readMoveMeshMethod.H" +# include "readMoveMeshMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info << "\nStarting time loop\n" << endl; + Info << "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time = " << runTime.timeName() << nl << endl; + Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::debug = 0; + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::debug = 0; - do - { - DU.storePrevIter(); - - divDSigmaLargeStrainExp.storePrevIter(); - -# include "calculateDivDSigmaExp.H" - -# include "calculateDivDSigmaLargeStrainExp.H" - - //----------------------------------------------------// - //- updated lagrangian large strain momentum equation - //----------------------------------------------------// - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho,DU) - == - fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") - + divDSigmaExp - + divDSigmaLargeStrainExp - ); - - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } - - solverPerf = DUEqn.solve(); - - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } - - DU.relax(); - - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } - -# include "calculateDEpsilonDSigma.H" - -# include "calculateRelativeResidual.H" - - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", residualDU = " << relativeResidual - << ", inner iterations " << solverPerf.nIterations() << endl; - } - while - ( - //solverPerf.initialResidual() > convergenceTolerance - relativeResidual > convergenceTolerance - && ++iCorr < nCorr - ); - - lduMatrix::debug = 1; - - Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; - -# include "rotateFields.H" - -# include "moveMesh.H" - -# include "writeFields.H" - - //- total force - forAll(mesh.boundary(), patchi) + do { + DU.storePrevIter(); + + divDSigmaLargeStrainExp.storePrevIter(); + +# include "calculateDivDSigmaExp.H" + +# include "calculateDivDSigmaLargeStrainExp.H" + + //----------------------------------------------------// + //- updated lagrangian large strain momentum equation + //----------------------------------------------------// + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho,DU) + == + fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") + + divDSigmaExp + + divDSigmaLargeStrainExp + ); + + if(solidInterfaceCorr) + { + solidInterfacePtr->correct(DUEqn); + } + + solverPerf = DUEqn.solve(); + + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } + + DU.relax(); + + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } + +# include "calculateDEpsilonDSigma.H" + +# include "calculateRelativeResidual.H" + + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", residualDU = " << relativeResidual + << ", inner iterations " << solverPerf.nIterations() << endl; + } + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && ++iCorr < nCorr + ); + + lduMatrix::debug = 1; + + Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; + +# include "rotateFields.H" + +# include "moveMesh.H" + +# include "writeFields.H" + + //- total force + forAll(mesh.boundary(), patchi) + { vector force = sum(mesh.Sf().boundaryField()[patchi] & sigma.boundaryField()[patchi]); Info << "force on " << mesh.boundary()[patchi].name() - << " is " << force << endl; - } + << " is " << force << endl; + } - Info << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H index 0e75c6a56..be49866c3 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H @@ -14,10 +14,10 @@ forAll (bm, patchI) ( !isA(bm[patchI]) && !( - bm[patchI].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) + bm[patchI].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) ) { const labelList& bp = bm[patchI].patch().boundaryPoints(); @@ -25,9 +25,9 @@ forAll (bm, patchI) const labelList& meshPoints = bm[patchI].patch().meshPoints(); forAll (bp, pointI) - { - pointsCorrectionMap.insert(meshPoints[bp[pointI]]); - } + { + pointsCorrectionMap.insert(meshPoints[bp[pointI]]); + } } } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H index 807c713fd..42fa2f3c7 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H @@ -1,15 +1,15 @@ if(moveMeshMethod == "inverseDistance") - { -# include "moveMeshInverseDistance.H" - } - else if(moveMeshMethod == "leastSquares") - { -# include "moveMeshLeastSquares.H" - } - else - { +{ +# include "moveMeshInverseDistance.H" +} +else if(moveMeshMethod == "leastSquares") +{ +# include "moveMeshLeastSquares.H" +} +else +{ FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl - << "available methods are:" << nl - << "inverseDistance" << nl - << "leastSquares" << exit(FatalError); - } + << "available methods are:" << nl + << "inverseDistance" << nl + << "leastSquares" << exit(FatalError); + } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H index 77bc161cd..c4f0a938e 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; // Create point mesh @@ -12,23 +12,23 @@ if(min(J.internalField()) > 0) volPointInterpolation pointInterpolation(mesh); wordList types - ( + ( pMesh.boundary().size(), calculatedFvPatchVectorField::typeName - ); + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh - ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); // Calculate mesh points displacement pointInterpolation.interpolate(DU, pointDU); @@ -36,30 +36,29 @@ if(min(J.internalField()) > 0) //- correct edge interpolation //- this is the stuff from edgeCorrectedVolPointInterpolation but //- that class no longer works - # include "performEdgeCorrectedVolPointInterpolation.H" +# include "performEdgeCorrectedVolPointInterpolation.H" - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- see the effect of correctBCs // Move mesh vectorField newPoints = mesh.allPoints(); - forAll (pointDUI, pointI) - { - newPoints[pointI] += pointDUI[pointI]; - } + forAll (pointDUI, pointI) + { + newPoints[pointI] += pointDUI[pointI]; + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H index 65373c592..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H index 577713009..767d7e7ae 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H @@ -7,38 +7,40 @@ pointVectorField& pf = pointDU; // Do the correction //GeometricField pfCorr -/*pointVectorField pfCorr +/* +pointVectorField pfCorr ( - IOobject - ( - // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", - "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", - //vf.instance(), - DU, - pMesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - //dimensioned("zero", pf.dimensions(), pTraits::zero), - dimensionedVector("zero", pf.dimensions(), vector::zero), - pf.boundaryField().types() - );*/ + IOobject + ( + // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", + "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", + //vf.instance(), + DU, + pMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + //dimensioned("zero", pf.dimensions(), pTraits::zero), + dimensionedVector("zero", pf.dimensions(), vector::zero), + pf.boundaryField().types() +); +*/ pointVectorField pfCorr ( - IOobject - ( - "pointDUcorr", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - dimensionedVector("vector", dimLength, vector::zero), - "calculated" - ); + IOobject + ( + "pointDUcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + dimensionedVector("vector", dimLength, vector::zero), + "calculated" +); //const labelList& ptc = boundaryPoints(); #include "findBoundaryPoints.H" @@ -57,64 +59,68 @@ const labelListList& PointFaces = mesh.pointFaces(); forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = PointFaces[curPoint]; + const labelList& curFaces = PointFaces[curPoint]; - label fI = 0; + label fI = 0; - // Go through all the faces - forAll (curFaces, faceI) + // Go through all the faces + forAll (curFaces, faceI) { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(mesh.boundary()[patchID]) - && !mesh.boundary()[patchID].coupled() - ) - { - label faceInPatchID = - bm[patchID].patch().whichFace(curFaces[faceI]); + if + ( + !isA(mesh.boundary()[patchID]) + && !mesh.boundary()[patchID].coupled() + ) + { + label faceInPatchID = + bm[patchID].patch().whichFace(curFaces[faceI]); - pfCorr[curPoint] += - w[pointI][fI]* - ( - extraVecs[pointI][fI] - & gradDU.boundaryField()[patchID][faceInPatchID] - ); + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); - fI++; - } - } + fI++; + } + } } } // Update coupled boundaries -/*forAll (pfCorr.boundaryField(), patchI) +/* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].initAddField(); + pfCorr.boundaryField()[patchI].initAddField(); } - }*/ + } +*/ - /*forAll (pfCorr.boundaryField(), patchI) + /* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); + pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); } - }*/ +} +*/ - //Info << "pfCorr: " << pfCorr << endl; - pfCorr.correctBoundaryConditions(); +//Info << "pfCorr: " << pfCorr << endl; +pfCorr.correctBoundaryConditions(); //pfCorr.write(); diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/readDivDSigmaExpMethod.H index 1741259cf..32fe4e6a6 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/readDivDSigmaExpMethod.H @@ -1,12 +1,15 @@ //- the method used to calculate the explicit component of sigma word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << "Calculation of divDSigmaExp method: " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" - && divDSigmaExpMethod != "surface" - && divDSigmaExpMethod != "decompose" - && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H index dd9244a67..5f8963e5a 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") - { +{ divDSigmaExp = fvc::div - ( - mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, - "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradDU = - ((I - n*n)&fvc::interpolate(gradDU)); + ( + mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradDU = ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) - + lambdaf*tr(shearGradDU&(I - n*n))*n - + muf*(shearGradDU&n) - ) - ); - } - else if(divDSigmaExpMethod == "laplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(DU)&(I - n*n)) + + lambdaf*tr(shearGradDU&(I - n*n))*n + + muf*(shearGradDU&n) + ) + ); +} +else if(divDSigmaExpMethod == "laplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)") + fvc::div - ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } + ( + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H index fa44d00e1..1b97a11bc 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaLargeStrainExp.H @@ -2,33 +2,33 @@ //- sigma explicit large strain explicit terms //----------------------------------------------------// if(divDSigmaLargeStrainExpMethod == "standard") - { +{ divDSigmaLargeStrainExp = - fvc::div - ( - mu*(gradDU & gradDU.T()) - + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) - + ((sigma + DSigma) & DF.T()), - "div(sigma)" - ); - } - else if(divDSigmaLargeStrainExpMethod == "surface") - { - divDSigmaLargeStrainExp = - fvc::div - ( - muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) - + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) - + (mesh.Sf() & fvc::interpolate( sigma & DF.T() )) - + (mesh.Sf() & fvc::interpolate(DSigma & DF.T() )) - ); - } - else - { + fvc::div + ( + mu*(gradDU & gradDU.T()) + + 0.5*lambda*(gradDU && gradDU)*I //- equivalent to 0.5*lambda*(I*tr(gradDU & gradDU.T())) + + ((sigma + DSigma) & DF.T()), + "div(sigma)" + ); +} +else if(divDSigmaLargeStrainExpMethod == "surface") +{ + divDSigmaLargeStrainExp = + fvc::div + ( + muf * (mesh.Sf() & fvc::interpolate(gradDU & gradDU.T())) + + 0.5*lambdaf * (mesh.Sf() & (fvc::interpolate(gradDU && gradDU)*I)) + + (mesh.Sf() & fvc::interpolate( sigma & DF.T() )) + + (mesh.Sf() & fvc::interpolate(DSigma & DF.T() )) + ); +} +else +{ FatalError - << "divDSigmaLargeStrainMethod not found!" - << exit(FatalError); - } + << "divDSigmaLargeStrainMethod not found!" + << exit(FatalError); +} //- relax divDSigmaLargeStrainExp.relax(); diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateExtrapolationVectors.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateExtrapolationVectors.H index a8008f025..9007c94dd 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateExtrapolationVectors.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateExtrapolationVectors.H @@ -15,59 +15,58 @@ FieldField extraVecs(ptc.size()); { - const labelListList& pfaces = mesh.pointFaces(); + const labelListList& pfaces = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - forAll (ptc, pointI) + forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = pfaces[curPoint]; + const labelList& curFaces = pfaces[curPoint]; - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); - vectorField& curExtraVectors = extraVecs[pointI]; + vectorField& curExtraVectors = extraVecs[pointI]; - label nFacesAroundPoint = 0; + label nFacesAroundPoint = 0; - const vector& pointLoc = mesh.points()[curPoint]; + const vector& pointLoc = mesh.points()[curPoint]; - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(bm[patchID]) - && !bm[patchID].coupled() - ) - { - // Found a face for extrapolation - curExtraVectors[nFacesAroundPoint] = - pointLoc - - centres.boundaryField()[patchID] - [bm[patchID].patch().whichFace(curFaces[faceI])]; + if + ( + !isA(bm[patchID]) + && !bm[patchID].coupled() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; - nFacesAroundPoint++; - } - } - } + nFacesAroundPoint++; + } + } + } - curExtraVectors.setSize(nFacesAroundPoint); + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H index 664110dc4..ade989cac 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H @@ -8,114 +8,116 @@ FieldField w(ptc.size()); { - const labelListList& pf = mesh.pointFaces(); + const labelListList& pf = mesh.pointFaces(); - const volVectorField& centres = mesh.C(); + const volVectorField& centres = mesh.C(); - const fvBoundaryMesh& bm = mesh.boundary(); + const fvBoundaryMesh& bm = mesh.boundary(); - pointScalarField volPointSumWeights + pointScalarField volPointSumWeights ( - IOobject - ( - "volPointSumWeights", - mesh.polyMesh::instance(), - mesh - ), - pMesh, - dimensionedScalar("zero", dimless, 0) - ); - - forAll (ptc, pointI) - { - const label curPoint = ptc[pointI]; - - const labelList& curFaces = pf[curPoint]; - - //w.hook(new scalarField(curFaces.size())); //philipc no hook function - w.set - ( - pointI, - new scalarField(curFaces.size()) - ); - - scalarField& curWeights = w[pointI]; - - label nFacesAroundPoint = 0; - - const vector& pointLoc = mesh.points()[curPoint]; - - // Go through all the faces - forAll (curFaces, faceI) - { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); - - if - ( - !isA(bm[patchID]) - && !( - bm[patchID].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) - ) - { - curWeights[nFacesAroundPoint] = - 1.0/mag - ( - pointLoc - - centres.boundaryField()[patchID] - [ - bm[patchID].patch().whichFace(curFaces[faceI]) - ] - ); - - nFacesAroundPoint++; - } - } - } - - // Reset the sizes of the local weights - curWeights.setSize(nFacesAroundPoint); - - // Collect the sum of weights for parallel correction - volPointSumWeights[curPoint] += sum(curWeights); - } - - // Do parallel correction of weights - - // Update coupled boundaries - // Work-around for cyclic parallels. - /*if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) - { - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].initAddField(); - } - } - - forAll (volPointSumWeights.boundaryField(), patchI) - { - if (volPointSumWeights.boundaryField()[patchI].coupled()) - { - volPointSumWeights.boundaryField()[patchI].addField - ( - volPointSumWeights.internalField() + IOobject + ( + "volPointSumWeights", + mesh.polyMesh::instance(), + mesh + ), + pMesh, + dimensionedScalar("zero", dimless, 0) ); - } - } - }*/ - // Re-scale the weights for the current point - forAll (ptc, pointI) + forAll (ptc, pointI) { - w[pointI] /= volPointSumWeights[ptc[pointI]]; + const label curPoint = ptc[pointI]; + + const labelList& curFaces = pf[curPoint]; + + //w.hook(new scalarField(curFaces.size())); //philipc no hook function + w.set + ( + pointI, + new scalarField(curFaces.size()) + ); + + scalarField& curWeights = w[pointI]; + + label nFacesAroundPoint = 0; + + const vector& pointLoc = mesh.points()[curPoint]; + + // Go through all the faces + forAll (curFaces, faceI) + { + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); + + if + ( + !isA(bm[patchID]) + && !( + bm[patchID].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) + ) + { + curWeights[nFacesAroundPoint] = + 1.0/mag + ( + pointLoc + - centres.boundaryField()[patchID] + [ + bm[patchID].patch().whichFace(curFaces[faceI]) + ] + ); + + nFacesAroundPoint++; + } + } + } + + // Reset the sizes of the local weights + curWeights.setSize(nFacesAroundPoint); + + // Collect the sum of weights for parallel correction + volPointSumWeights[curPoint] += sum(curWeights); + } + + // Do parallel correction of weights + + // Update coupled boundaries + // Work-around for cyclic parallels. +/* + if (Pstream::parRun() && !mesh.parallelData().cyclicParallel()) + { + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].initAddField(); + } + } + + forAll (volPointSumWeights.boundaryField(), patchI) + { + if (volPointSumWeights.boundaryField()[patchI].coupled()) + { + volPointSumWeights.boundaryField()[patchI].addField + ( + volPointSumWeights.internalField() + ); + } + } + } +*/ + + // Re-scale the weights for the current point + forAll (ptc, pointI) + { + w[pointI] /= volPointSumWeights[ptc[pointI]]; } } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createFields.H index 7e6c95630..619c1d91d 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createFields.H @@ -57,33 +57,33 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divDSigmaExp - ( - IOobject - ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) - ); + volVectorField divDSigmaExp + ( + IOobject + ( + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) + ); - volVectorField divDSigmaLargeStrainExp - ( - IOobject - ( - "divDSigmaLargeStrainExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) - ); + volVectorField divDSigmaLargeStrainExp + ( + IOobject + ( + "divDSigmaLargeStrainExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedVector("zero", dimensionSet(1, -2, -2, 0, 0, 0, 0), vector::zero) + ); volSymmTensorField epsilon ( diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createSolidInterface.H index 218325543..70645aa6c 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/createSolidInterface.H @@ -4,26 +4,26 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divDSigmaExp - if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") - { - FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - if(divDSigmaLargeStrainExpMethod == "surface") - { - FatalError << "divDSigmaLargeStrainExp must be surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divDSigmaExp + if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") + { + FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + if(divDSigmaLargeStrainExpMethod == "surface") + { + FatalError << "divDSigmaLargeStrainExp must be surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C index dd85df0ff..e798bb9cf 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C @@ -61,151 +61,151 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "readDivDSigmaLargeStrainExpMethod.H" +# include "readDivDSigmaLargeStrainExpMethod.H" -# include "readMoveMeshMethod.H" +# include "readMoveMeshMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info << "\nStarting time loop\n" << endl; + Info << "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::debug = 0; + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::debug = 0; - const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); + const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); - do - { - DU.storePrevIter(); + do + { + DU.storePrevIter(); - divDSigmaLargeStrainExp.storePrevIter(); + divDSigmaLargeStrainExp.storePrevIter(); -# include "calculateDivDSigmaExp.H" +# include "calculateDivDSigmaExp.H" -# include "calculateDivDSigmaLargeStrainExp.H" +# include "calculateDivDSigmaLargeStrainExp.H" - //----------------------------------------------------// - //- updated lagrangian large strain momentum equation - //----------------------------------------------------// - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") - + divDSigmaExp - + divDSigmaLargeStrainExp - - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) - ); + //----------------------------------------------------// + //- updated lagrangian large strain momentum equation + //----------------------------------------------------// + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") + + divDSigmaExp + + divDSigmaLargeStrainExp + - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) + ); - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } + if(solidInterfaceCorr) + { + solidInterfacePtr->correct(DUEqn); + } - solverPerf = DUEqn.solve(); + solverPerf = DUEqn.solve(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - DU.relax(); + DU.relax(); - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } - DF = gradDU.T(); + DF = gradDU.T(); -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - rheology.correct(); - mu = rheology.newMu(); - lambda = rheology.newLambda(); - muf = fvc::interpolate(rheology.newMu()); - lambdaf = fvc::interpolate(rheology.newLambda()); - if(solidInterfaceCorr) - { - solidInterfacePtr->modifyProperties(muf, lambdaf); - } + rheology.correct(); + mu = rheology.newMu(); + lambda = rheology.newLambda(); + muf = fvc::interpolate(rheology.newMu()); + lambdaf = fvc::interpolate(rheology.newLambda()); + if(solidInterfaceCorr) + { + solidInterfacePtr->modifyProperties(muf, lambdaf); + } -# include "calculateDEpsilonDSigma.H" +# include "calculateDEpsilonDSigma.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } - while - ( - //relativeResidual - solverPerf.initialResidual() > convergenceTolerance - && ++iCorr < nCorr - ); + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; + } + while + ( + //relativeResidual + solverPerf.initialResidual() > convergenceTolerance + && ++iCorr < nCorr + ); - Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; + Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; - lduMatrix::debug = 1; + lduMatrix::debug = 1; - U += DU; + U += DU; - epsilon += DEpsilon; + epsilon += DEpsilon; - epsilonP += DEpsilonP; + epsilonP += DEpsilonP; - volSymmTensorField DEpsilonE = DEpsilon - DEpsilonP; + volSymmTensorField DEpsilonE = DEpsilon - DEpsilonP; - epsilonE += DEpsilonE; + epsilonE += DEpsilonE; - sigma += DSigma; + sigma += DSigma; - rheology.updateYieldStress(); + rheology.updateYieldStress(); -# include "rotateFields.H" +# include "rotateFields.H" -# include "moveMesh.H" +# include "moveMesh.H" -# include "writeFields.H" +# include "writeFields.H" - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H index 0e75c6a56..3d6eaf814 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H @@ -8,26 +8,26 @@ const fvBoundaryMesh& bm = mesh.boundary(); forAll (bm, patchI) { - // If the patch is empty, skip it - // If the patch is coupled, and there are no cyclic parallels, skip it - if + // If the patch is empty, skip it + // If the patch is coupled, and there are no cyclic parallels, skip it + if ( - !isA(bm[patchI]) - && !( - bm[patchI].coupled() - //&& Pstream::parRun() - //&& !mesh.parallelData().cyclicParallel() - ) - ) + !isA(bm[patchI]) + && !( + bm[patchI].coupled() + //&& Pstream::parRun() + //&& !mesh.parallelData().cyclicParallel() + ) + ) { - const labelList& bp = bm[patchI].patch().boundaryPoints(); + const labelList& bp = bm[patchI].patch().boundaryPoints(); - const labelList& meshPoints = bm[patchI].patch().meshPoints(); + const labelList& meshPoints = bm[patchI].patch().meshPoints(); - forAll (bp, pointI) - { - pointsCorrectionMap.insert(meshPoints[bp[pointI]]); - } + forAll (bp, pointI) + { + pointsCorrectionMap.insert(meshPoints[bp[pointI]]); + } } } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMesh.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMesh.H index 807c713fd..7fd53aaf1 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMesh.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMesh.H @@ -1,15 +1,15 @@ if(moveMeshMethod == "inverseDistance") - { +{ # include "moveMeshInverseDistance.H" - } - else if(moveMeshMethod == "leastSquares") - { +} +else if(moveMeshMethod == "leastSquares") +{ # include "moveMeshLeastSquares.H" - } - else - { - FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl - << "available methods are:" << nl - << "inverseDistance" << nl - << "leastSquares" << exit(FatalError); - } +} +else +{ + FatalError << "move mesh method " << moveMeshMethod << " not recognised" << nl + << "available methods are:" << nl + << "inverseDistance" << nl + << "leastSquares" << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H index 7015034a1..b70d0dd6c 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; // Create point mesh @@ -12,24 +12,24 @@ if(min(J.internalField()) > 0) volPointInterpolation pointInterpolation(mesh); wordList types - ( - pMesh.boundary().size(), - //fixedValueFvPatchVectorField::typeName - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + //fixedValueFvPatchVectorField::typeName + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh - ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh + ), + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); // Calculate mesh points displacement pointInterpolation.interpolate(DU, pointDU); @@ -41,26 +41,25 @@ if(min(J.internalField()) > 0) //pointDU.write(); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); // Move mesh vectorField newPoints = mesh.allPoints(); - forAll (pointDUI, pointI) - { - newPoints[pointI] += pointDUI[pointI]; - } + forAll (pointDUI, pointI) + { + newPoints[pointI] += pointDUI[pointI]; + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H index 65373c592..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); @@ -11,46 +11,45 @@ if(min(J.internalField()) > 0) pointMesh pMesh(mesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - mesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + mesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = mesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(mesh); twoDCorrector.correctPoints(newPoints); mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); - } - else - { - FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } +} +else +{ + FatalErrorIn(args.executable()) + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H index 577713009..767d7e7ae 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H @@ -7,38 +7,40 @@ pointVectorField& pf = pointDU; // Do the correction //GeometricField pfCorr -/*pointVectorField pfCorr +/* +pointVectorField pfCorr ( - IOobject - ( - // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", - "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", - //vf.instance(), - DU, - pMesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - //dimensioned("zero", pf.dimensions(), pTraits::zero), - dimensionedVector("zero", pf.dimensions(), vector::zero), - pf.boundaryField().types() - );*/ + IOobject + ( + // "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr", + "edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr", + //vf.instance(), + DU, + pMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + //dimensioned("zero", pf.dimensions(), pTraits::zero), + dimensionedVector("zero", pf.dimensions(), vector::zero), + pf.boundaryField().types() +); +*/ pointVectorField pfCorr ( - IOobject - ( - "pointDUcorr", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - pMesh, - dimensionedVector("vector", dimLength, vector::zero), - "calculated" - ); + IOobject + ( + "pointDUcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pMesh, + dimensionedVector("vector", dimLength, vector::zero), + "calculated" +); //const labelList& ptc = boundaryPoints(); #include "findBoundaryPoints.H" @@ -57,64 +59,68 @@ const labelListList& PointFaces = mesh.pointFaces(); forAll (ptc, pointI) { - const label curPoint = ptc[pointI]; + const label curPoint = ptc[pointI]; - const labelList& curFaces = PointFaces[curPoint]; + const labelList& curFaces = PointFaces[curPoint]; - label fI = 0; + label fI = 0; - // Go through all the faces - forAll (curFaces, faceI) + // Go through all the faces + forAll (curFaces, faceI) { - if (!mesh.isInternalFace(curFaces[faceI])) - { - // This is a boundary face. If not in the empty patch - // or coupled calculate the extrapolation vector - label patchID = - mesh.boundaryMesh().whichPatch(curFaces[faceI]); + if (!mesh.isInternalFace(curFaces[faceI])) + { + // This is a boundary face. If not in the empty patch + // or coupled calculate the extrapolation vector + label patchID = + mesh.boundaryMesh().whichPatch(curFaces[faceI]); - if - ( - !isA(mesh.boundary()[patchID]) - && !mesh.boundary()[patchID].coupled() - ) - { - label faceInPatchID = - bm[patchID].patch().whichFace(curFaces[faceI]); + if + ( + !isA(mesh.boundary()[patchID]) + && !mesh.boundary()[patchID].coupled() + ) + { + label faceInPatchID = + bm[patchID].patch().whichFace(curFaces[faceI]); - pfCorr[curPoint] += - w[pointI][fI]* - ( - extraVecs[pointI][fI] - & gradDU.boundaryField()[patchID][faceInPatchID] - ); + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); - fI++; - } - } + fI++; + } + } } } // Update coupled boundaries -/*forAll (pfCorr.boundaryField(), patchI) +/* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].initAddField(); + pfCorr.boundaryField()[patchI].initAddField(); } - }*/ + } +*/ - /*forAll (pfCorr.boundaryField(), patchI) + /* +forAll (pfCorr.boundaryField(), patchI) { - if (pfCorr.boundaryField()[patchI].coupled()) + if (pfCorr.boundaryField()[patchI].coupled()) { - pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); + pfCorr.boundaryField()[patchI].addField(pfCorr.internalField()); } - }*/ +} +*/ - //Info << "pfCorr: " << pfCorr << endl; - pfCorr.correctBoundaryConditions(); +//Info << "pfCorr: " << pfCorr << endl; +pfCorr.correctBoundaryConditions(); //pfCorr.write(); diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/readDivDSigmaExpMethod.H index 1741259cf..32fe4e6a6 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/readDivDSigmaExpMethod.H @@ -1,12 +1,15 @@ //- the method used to calculate the explicit component of sigma word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << "Calculation of divDSigmaExp method: " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" - && divDSigmaExpMethod != "surface" - && divDSigmaExpMethod != "decompose" - && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H index fff740d9f..d91fba1f1 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H @@ -1,56 +1,56 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; volScalarField sigmaHyd - ( - IOobject - ( - "sigmaHyd", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - ( - sigma.component(symmTensor::XX) - + sigma.component(symmTensor::YY) - + sigma.component(symmTensor::ZZ) - )/3 - ); + ( + IOobject + ( + "sigmaHyd", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + ( + sigma.component(symmTensor::XX) + + sigma.component(symmTensor::YY) + + sigma.component(symmTensor::ZZ) + )/3 + ); Info<< "Max sigmaHyd = " << max(sigmaHyd).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/calculateDivDSigmaExp.H index 14700f71a..309320b87 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/calculateDivDSigmaExp.H @@ -1,47 +1,47 @@ if(divDSigmaExpMethod == "standard") - { +{ divDSigmaExp = fvc::div - ( + ( mu*gradDU.T() + lambda*(I*tr(gradDU)) - (mu + lambda)*gradDU, "div(sigma)" - ); - } - else if(divDSigmaExpMethod == "surface") - { - divDSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) - ); - } - else if(divDSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradDU)); + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradDU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradDU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradDU)) + ); +} +else if(divDSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradU = ((I - n*n)&fvc::interpolate(gradDU)); - divDSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - ) - ); - } - else if(divDSigmaExpMethod == "expLaplacian") - { - divDSigmaExp = + divDSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) + + lambdaf*tr(shearGradU&(I - n*n))*n + + muf*(shearGradU&n) + ) + ); +} +else if(divDSigmaExpMethod == "expLaplacian") +{ + divDSigmaExp = - fvc::laplacian(mu + lambda, U, "laplacian(DU,U)") + fvc::div - ( - mu*gradDU.T() - + lambda*(I*tr(gradDU)), - "div(sigma)" - ); - } - else - { + ( + mu*gradDU.T() + + lambda*(I*tr(gradDU)), + "div(sigma)" + ); +} +else +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } +} diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createFields.H index dac96e317..d624f5d25 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createFields.H @@ -33,15 +33,15 @@ ( IOobject ( - "DEpsilon", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), + "DEpsilon", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), mesh, dimensionedSymmTensor("zero", dimless, symmTensor::zero) - ); + ); volSymmTensorField DSigma ( @@ -100,19 +100,19 @@ ); - volVectorField divDSigmaExp - ( + volVectorField divDSigmaExp + ( IOobject ( - "divDSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divDSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); plasticityModel rheology(gradDU, epsilon, sigma); diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createSolidInterface.H index 6fe213be0..e37cfdebb 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/createSolidInterface.H @@ -4,21 +4,21 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divDSigmaExp - if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") - { - FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divDSigmaExp + if(divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose") + { + FatalError << "divDSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C index 88aac318c..c71457210 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C @@ -50,127 +50,127 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivDSigmaExpMethod.H" +# include "readDivDSigmaExpMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - for (runTime++; !runTime.end(); runTime++) + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::solverPerformance solverPerf; - lduMatrix::debug = 0; + int iCorr = 0; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::solverPerformance solverPerf; + lduMatrix::debug = 0; - const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); + const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); - do - { - DU.storePrevIter(); + do + { + DU.storePrevIter(); -# include "calculateDivDSigmaExp.H" +# include "calculateDivDSigmaExp.H" - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") - + divDSigmaExp - - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) - ); + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") + + divDSigmaExp + - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) + ); - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } - - solverPerf = DUEqn.solve(); - - if(iCorr == 0) + if(solidInterfaceCorr) { - initialResidual = solverPerf.initialResidual(); + solidInterfacePtr->correct(DUEqn); } - DU.relax(); + solverPerf = DUEqn.solve(); - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } -# include "calculateRelativeResidual.H" + DU.relax(); - rheology.correct(); - mu = rheology.newMu(); - lambda = rheology.newLambda(); - muf = fvc::interpolate(rheology.newMu()); - lambdaf = fvc::interpolate(rheology.newLambda()); - if(solidInterfaceCorr) - { - solidInterfacePtr->modifyProperties(muf, lambdaf); - } + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() << endl; - } - while - ( - solverPerf.initialResidual() > convergenceTolerance - && ++iCorr < nCorr - ); +# include "calculateRelativeResidual.H" - Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", No outer iterations " << iCorr << endl; + rheology.correct(); + mu = rheology.newMu(); + lambda = rheology.newLambda(); + muf = fvc::interpolate(rheology.newMu()); + lambdaf = fvc::interpolate(rheology.newLambda()); + if(solidInterfaceCorr) + { + solidInterfacePtr->modifyProperties(muf, lambdaf); + } - lduMatrix::debug = 1; + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() << endl; + } + while + ( + solverPerf.initialResidual() > convergenceTolerance + && ++iCorr < nCorr + ); -# include "calculateDEpsilonDSigma.H" + Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; - U += DU; + lduMatrix::debug = 1; - epsilon += DEpsilon; +# include "calculateDEpsilonDSigma.H" - epsilonP += rheology.DEpsilonP(); + U += DU; - sigma += DSigma; + epsilon += DEpsilon; - rheology.updateYieldStress(); + epsilonP += rheology.DEpsilonP(); -# include "writeFields.H" + sigma += DSigma; - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; + rheology.updateYieldStress(); + +# include "writeFields.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/readDivDSigmaExpMethod.H index c8109256b..12ef21015 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,15 @@ //- how explicit component of sigma is to be calculated word divDSigmaExpMethod(mesh.solutionDict().subDict("stressedFoam").lookup("divDSigmaExp")); Info << "Selecting divDSigmaExp calculation method " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/writeFields.H index fff740d9f..d91fba1f1 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/writeFields.H @@ -1,56 +1,56 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; volScalarField sigmaHyd - ( - IOobject - ( - "sigmaHyd", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - ( - sigma.component(symmTensor::XX) - + sigma.component(symmTensor::YY) - + sigma.component(symmTensor::ZZ) - )/3 - ); + ( + IOobject + ( + "sigmaHyd", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + ( + sigma.component(symmTensor::XX) + + sigma.component(symmTensor::YY) + + sigma.component(symmTensor::ZZ) + )/3 + ); Info<< "Max sigmaHyd = " << max(sigmaHyd).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/calculateDivSigmaExp.H b/applications/solvers/solidMechanics/elasticSolidFoam/calculateDivSigmaExp.H index adba22d5d..041eb7243 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/calculateDivSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/calculateDivSigmaExp.H @@ -1,47 +1,47 @@ if(divSigmaExpMethod == "standard") - { +{ divSigmaExp = fvc::div - ( - mu*gradU.T() + lambda*(I*tr(gradU)) - (mu + lambda)*gradU, - "div(sigma)" - ); - } - else if(divSigmaExpMethod == "surface") - { - divSigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) - ); - } - else if(divSigmaExpMethod == "decompose") - { - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradU)); + ( + mu*gradU.T() + lambda*(I*tr(gradU)) - (mu + lambda)*gradU, + "div(sigma)" + ); +} +else if(divSigmaExpMethod == "surface") +{ + divSigmaExp = fvc::div + ( + muf*(mesh.Sf() & fvc::interpolate(gradU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) + ); +} +else if(divSigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradU = ((I - n*n)&fvc::interpolate(gradU)); - divSigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - ) - ); - } - else if(divSigmaExpMethod == "expLaplacian") - { - divSigmaExp = + divSigmaExp = fvc::div + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) + + lambdaf*tr(shearGradU&(I - n*n))*n + + muf*(shearGradU&n) + ) + ); +} +else if(divSigmaExpMethod == "expLaplacian") +{ + divSigmaExp = - fvc::laplacian(mu + lambda, U, "laplacian(DU,U)") + fvc::div - ( - mu*gradU.T() - + lambda*(I*tr(gradU)), - "div(sigma)" - ); - } - else - { - FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; - } + ( + mu*gradU.T() + + lambda*(I*tr(gradU)), + "div(sigma)" + ); +} +else +{ + FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << endl; +} diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H index e15c1bebb..47bc0ccd3 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H @@ -42,19 +42,19 @@ dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) ); - volVectorField divSigmaExp - ( + volVectorField divSigmaExp + ( IOobject ( - "divSigmaExp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "divSigmaExp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimensionSet(1,-2,-2,0,0,0,0), vector::zero) - ); + ); rheologyModel rheology(sigma); diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/createSolidInterface.H b/applications/solvers/solidMechanics/elasticSolidFoam/createSolidInterface.H index 665435c98..392bcdaec 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/createSolidInterface.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/createSolidInterface.H @@ -4,21 +4,21 @@ solidInterface* solidInterfacePtr(NULL); { const dictionary& stressControl = - mesh.solutionDict().subDict("stressedFoam"); + mesh.solutionDict().subDict("stressedFoam"); solidInterfaceCorr = Switch(stressControl.lookup("solidInterface")); if(solidInterfaceCorr) - { - Info << "Creating solid interface correction" << endl; - solidInterfacePtr = new solidInterface(mesh, rheology); - solidInterfacePtr->modifyProperties(muf, lambdaf); + { + Info << "Creating solid interface correction" << endl; + solidInterfacePtr = new solidInterface(mesh, rheology); + solidInterfacePtr->modifyProperties(muf, lambdaf); - //- solidInterface needs muf and lambdaf to be used for divSigmaExp - if(divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose") - { - FatalError << "divSigmaExp must be decompose or surface when solidInterface is on" - << exit(FatalError); - } - } + //- solidInterface needs muf and lambdaf to be used for divSigmaExp + if(divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose") + { + FatalError << "divSigmaExp must be decompose or surface when solidInterface is on" + << exit(FatalError); + } + } } diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C index 019f7794d..7c86938fc 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C @@ -52,111 +52,111 @@ int main(int argc, char *argv[]) { # include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readDivSigmaExpMethod.H" +# include "readDivSigmaExpMethod.H" -# include "createSolidInterface.H" +# include "createSolidInterface.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - lduMatrix::debug=0; + lduMatrix::debug=0; - do + do { - U.storePrevIter(); + U.storePrevIter(); -# include "calculateDivSigmaExp.H" +# include "calculateDivSigmaExp.H" - //- linear momentum equation - fvVectorMatrix UEqn + //- linear momentum equation + fvVectorMatrix UEqn ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") - + divSigmaExp - ); + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") + + divSigmaExp + ); - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(UEqn); - } + if(solidInterfaceCorr) + { + solidInterfacePtr->correct(UEqn); + } - solverPerf = UEqn.solve(); + solverPerf = UEqn.solve(); - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - U.relax(); + U.relax(); - if(solidInterfaceCorr) - { - gradU = solidInterfacePtr->grad(U); - } - else - { - gradU = fvc::grad(U); - } + if(solidInterfaceCorr) + { + gradU = solidInterfacePtr->grad(U); + } + else + { + gradU = fvc::grad(U); + } -# include "calculateRelativeResidual.H" +# include "calculateRelativeResidual.H" - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << U.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() + << ", relative residual = " << relativeResidual << endl; } - while - ( - //solverPerf.initialResidual() > convergenceTolerance - relativeResidual > convergenceTolerance - && - ++iCorr < nCorr - ); + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); Info << nl << "Time " << runTime.value() << ", Solving for " << U.name() - << ", Initial residual = " << initialResidual - << ", Final residual = " << solverPerf.initialResidual() - << ", Relative residual = " << relativeResidual - << ", No outer iterations " << iCorr - << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", Relative residual = " << relativeResidual + << ", No outer iterations " << iCorr + << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - lduMatrix::debug=0; + lduMatrix::debug=0; -# include "calculateEpsilonSigma.H" +# include "calculateEpsilonSigma.H" -# include "writeFields.H" +# include "writeFields.H" - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/readDivSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticSolidFoam/readDivSigmaExpMethod.H index 094886708..f4fc5d1b2 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/readDivSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/readDivSigmaExpMethod.H @@ -4,6 +4,6 @@ Info << "Selecting divSigmaExp calculation method " << divSigmaExpMethod << end if(divSigmaExpMethod != "standard" && divSigmaExpMethod != "surface" && divSigmaExpMethod != "decompose" && divSigmaExpMethod != "laplacian") { FatalError << "divSigmaExp method " << divSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); } diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/calculateSigmaExp.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/calculateSigmaExp.H index 58cf03951..0387691e0 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/calculateSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/calculateSigmaExp.H @@ -1,47 +1,47 @@ if(sigmaExpMethod == "standard") - { +{ sigmaExp = fvc::div ( mu*gradU.T() + lambda*(I*tr(gradU)) - (mu + lambda)*gradU, "div(sigma)" ); - } - else if(sigmaExpMethod == "surface") - { +} +else if(sigmaExpMethod == "surface") +{ sigmaExp = fvc::div - ( - muf*(mesh.Sf() & fvc::interpolate(gradU.T())) - + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) - - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) - ); - } - else if(sigmaExpMethod == "decompose") - { - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradU)); + ( + muf*(mesh.Sf() & fvc::interpolate(gradU.T())) + + lambdaf*(mesh.Sf() & I*fvc::interpolate(tr(gradU))) + - (muf + lambdaf)*(mesh.Sf() & fvc::interpolate(gradU)) + ); +} +else if(sigmaExpMethod == "decompose") +{ + surfaceTensorField shearGradU = ((I - n*n)&fvc::interpolate(gradU)); sigmaExp = fvc::div - ( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - ) - ); - } - else if(sigmaExpMethod == "expLaplacian") - { - sigmaExp = + ( + mesh.magSf() + * + ( + - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) + + lambdaf*tr(shearGradU&(I - n*n))*n + + muf*(shearGradU&n) + ) + ); +} +else if(sigmaExpMethod == "expLaplacian") +{ + sigmaExp = - fvc::laplacian(mu + lambda, U, "laplacian(DU,U)") + fvc::div - ( - mu*gradU.T() - + lambda*(I*tr(gradU)), - "div(sigma)" - ); - } - else - { + ( + mu*gradU.T() + + lambda*(I*tr(gradU)), + "div(sigma)" + ); +} +else +{ FatalError << "sigmaExp method " << sigmaExpMethod << " not found!" << endl; - } +} diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C index 08f6fc0dc..951f57d91 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C @@ -45,110 +45,110 @@ Description int main(int argc, char *argv[]) { -# include "setRootCase.H" +# include "setRootCase.H" -# include "createTime.H" +# include "createTime.H" -# include "createMesh.H" +# include "createMesh.H" -# include "createFields.H" +# include "createFields.H" -# include "readSigmaExpMethod.H" +# include "readSigmaExpMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nCalculating displacement field\n" << endl; + Info<< "\nCalculating displacement field\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readStressedFoamControls.H" +# include "readStressedFoamControls.H" - int iCorr = 0; - scalar initialResidual = GREAT; - scalar residual = GREAT; - lduMatrix::solverPerformance solverPerfU; - lduMatrix::solverPerformance solverPerfT; + int iCorr = 0; + scalar initialResidual = GREAT; + scalar residual = GREAT; + lduMatrix::solverPerformance solverPerfU; + lduMatrix::solverPerformance solverPerfT; - lduMatrix::debug=0; + lduMatrix::debug=0; - do + do { - U.storePrevIter(); + U.storePrevIter(); -# include "calculateSigmaExp.H" +# include "calculateSigmaExp.H" - //- energy equation - fvScalarMatrix TEqn - ( - fvm::ddt(rhoC, T) == fvm::laplacian(k, T, "laplacian(k,T)") - ); - - solverPerfT = TEqn.solve(); - - T.relax(); - - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr << nl - << "\t\tSolving for " << T.name() - << " using " << solverPerfT.solverName() - << ", residual = " << solverPerfT.initialResidual() << endl; - - //- linear momentum equaiton - fvVectorMatrix UEqn + //- energy equation + fvScalarMatrix TEqn ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") - + sigmaExp - - fvc::grad(threeKalpha*(T-T0),"grad(threeKalphaDeltaT)") - ); + fvm::ddt(rhoC, T) == fvm::laplacian(k, T, "laplacian(k,T)") + ); - solverPerfU = UEqn.solve(); + solverPerfT = TEqn.solve(); - if(iCorr == 0) - { - initialResidual = max - ( - solverPerfU.initialResidual(), - solverPerfT.initialResidual() - ); - } + T.relax(); - residual = max - ( - solverPerfU.initialResidual(), - solverPerfT.initialResidual() - ); + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr << nl + << "\t\tSolving for " << T.name() + << " using " << solverPerfT.solverName() + << ", residual = " << solverPerfT.initialResidual() << endl; - U.relax(); + //- linear momentum equaiton + fvVectorMatrix UEqn + ( + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") + + sigmaExp + - fvc::grad(threeKalpha*(T-T0),"grad(threeKalphaDeltaT)") + ); - gradU = fvc::grad(U); + solverPerfU = UEqn.solve(); - Info << "\t\tSolving for " << U.name() - << " using " << solverPerfU.solverName() - << ", residual = " << solverPerfU.initialResidual() << endl; + if(iCorr == 0) + { + initialResidual = max + ( + solverPerfU.initialResidual(), + solverPerfT.initialResidual() + ); + } + + residual = max + ( + solverPerfU.initialResidual(), + solverPerfT.initialResidual() + ); + + U.relax(); + + gradU = fvc::grad(U); + + Info << "\t\tSolving for " << U.name() + << " using " << solverPerfU.solverName() + << ", residual = " << solverPerfU.initialResidual() << endl; } - while - ( - residual > convergenceTolerance - && - ++iCorr < nCorr - ); + while + ( + residual > convergenceTolerance + && + ++iCorr < nCorr + ); Info << nl << "Time " << runTime.value() - << ", Solving for " << U.name() - << ", Solving for " << T.name() - << ", Initial residual = " << initialResidual - << ", Final U residual = " << solverPerfU.initialResidual() - << ", Final T residual = " << solverPerfT.initialResidual() - << ", No outer iterations " << iCorr - << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + << ", Solving for " << U.name() + << ", Solving for " << T.name() + << ", Initial residual = " << initialResidual + << ", Final U residual = " << solverPerfU.initialResidual() + << ", Final T residual = " << solverPerfT.initialResidual() + << ", No outer iterations " << iCorr + << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - lduMatrix::debug=0; + lduMatrix::debug=0; # include "calculateEpsilonSigma.H" diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/readSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/readSigmaExpMethod.H index 96023adb8..2af52dc7b 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/readSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/readSigmaExpMethod.H @@ -4,6 +4,6 @@ Info << sigmaExpMethod << " method chosen for calculation of sigmaExp" << endl; if(sigmaExpMethod != "standard" && sigmaExpMethod != "surface" && sigmaExpMethod != "decompose") { FatalError << "sigmaExp method " << sigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose" - << exit(FatalError); + << "valid methods are:\nstandard\nsurface\ndecompose" + << exit(FatalError); } diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/updateLoadingPatch.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/updateLoadingPatch.H index b216666d0..efb715b7b 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/updateLoadingPatch.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/updateLoadingPatch.H @@ -4,36 +4,36 @@ || || \* ------------------------------------------------------------------------- */ { - word patchName = "right"; - label patchID = mesh.boundaryMesh().findPatchID(patchName); - if(patchID == -1) + word patchName = "right"; + label patchID = mesh.boundaryMesh().findPatchID(patchName); + if(patchID == -1) { - FatalErrorIn("updateLoadingPatch.H") << "Patch " << patchName << " not found." << endl - << exit(FatalError); + FatalErrorIn("updateLoadingPatch.H") << "Patch " << patchName << " not found." << endl + << exit(FatalError); } - //- update patch - if( - U.boundaryField()[patchID].type() - == fixedValueFvPatchVectorField::typeName - ) + //- update patch + if + ( + U.boundaryField()[patchID].type() + == fixedValueFvPatchVectorField::typeName + ) { - //- 1 mm every 100 seconds - //- experimental ultimate failure occurred at 0.3 mm - vector disp(0.00001*runTime.value(), 0, 0); - U.boundaryField()[patchID] == disp; + //- 1 mm every 100 seconds + //- experimental ultimate failure occurred at 0.3 mm + vector disp(0.00001*runTime.value(), 0, 0); + U.boundaryField()[patchID] == disp; - Info << "Patch " << mesh.boundary()[patchID].name() << " has been updated" - << " to " << disp - << endl; + Info << "Patch " << mesh.boundary()[patchID].name() << " has been updated" + << " to " << disp + << endl; } - - else + else { - SeriousError << "Loading Patch " << patchName << " is type " - << U.boundaryField()[patchID].type() - << " and is not updated!" << endl - << exit(FatalError); + SeriousError << "Loading Patch " << patchName << " is type " + << U.boundaryField()[patchID].type() + << " and is not updated!" << endl + << exit(FatalError); } } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/writeFields.H index aea728db8..890023447 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/writeFields.H @@ -1,36 +1,36 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - IOobject - ( - "epsilonEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((2.0/3.0)*magSqr(dev(epsilon))) - ); + ( + IOobject + ( + "epsilonEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((2.0/3.0)*magSqr(dev(epsilon))) + ); Info<< "Max epsilonEq = " << max(epsilonEq).value() - << endl; + << endl; volScalarField sigmaEq - ( - IOobject - ( - "sigmaEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sqrt((3.0/2.0)*magSqr(dev(sigma))) - ); + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; + << endl; runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calculateLiftAndDrag.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calculateLiftAndDrag.H index 5ae5ea600..0adcc48bc 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calculateLiftAndDrag.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calculateLiftAndDrag.H @@ -4,34 +4,34 @@ label plateID = mesh.boundaryMesh().findPatchID("plate"); label cylinderID = mesh.boundaryMesh().findPatchID("cylinder"); if(plateID == -1 || cylinderID == -1) - { +{ FatalError << "\n Cannot find the plate patch or the cylinder" - << " patch to calculate lift and drag!" - << exit(FatalError); - } + << " patch to calculate lift and drag!" + << exit(FatalError); +} scalar lift = 0; scalar drag = 0; - const vectorField& Sfp = mesh.boundary()[plateID].Sf(); +const vectorField& Sfp = mesh.boundary()[plateID].Sf(); forAll(p.boundaryField()[plateID], facei) { - vector faceForce = p.boundaryField()[plateID][facei] * Sfp[facei]; - lift += vector(0,1,0) & faceForce; - drag += vector(1,0,0) & faceForce; + vector faceForce = p.boundaryField()[plateID][facei] * Sfp[facei]; + lift += vector(0,1,0) & faceForce; + drag += vector(1,0,0) & faceForce; } - const vectorField& Sfc = mesh.boundary()[cylinderID].Sf(); +const vectorField& Sfc = mesh.boundary()[cylinderID].Sf(); forAll(p.boundaryField()[cylinderID], facei) { - vector faceForce = p.boundaryField()[cylinderID][facei] * Sfc[facei]; - lift += vector(0,1,0) & faceForce; - drag += vector(1,0,0) & faceForce; + vector faceForce = p.boundaryField()[cylinderID][facei] * Sfc[facei]; + lift += vector(0,1,0) & faceForce; + drag += vector(1,0,0) & faceForce; } - scalar width = 0.050668; +scalar width = 0.050668; -Info << "Total lift on the cylinder and plate boundaries is " << lift << " N, per unit width is " << (lift/width) << " N\n" - << "Total drag on the cylinder and plate boundaries is " << drag << " N, per unit width is " << (drag/width) << " N\n" - << endl; + Info << "Total lift on the cylinder and plate boundaries is " << lift << " N, per unit width is " << (lift/width) << " N\n" + << "Total drag on the cylinder and plate boundaries is " << drag << " N, per unit width is " << (drag/width) << " N\n" + << endl; } diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H index 5d3bb4f95..10076e66e 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H @@ -19,14 +19,14 @@ ( IOobject ( - "Usolid", - runTime.timeName(), - stressMesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - DU - ); + "Usolid", + runTime.timeName(), + stressMesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + DU + ); Info<< "Reading incremental displacement field DV\n" << endl; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C index dd31175e6..81eb39b86 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C @@ -131,12 +131,12 @@ int main(int argc, char *argv[]) # include "rotateSolidFields.H" - //# include "moveSolidMesh.H" +//# include "moveSolidMesh.H" # include "moveSolidMeshLeastSquares.H" # include "calculateStress.H" - //# include "calculateLiftAndDrag.H" +//# include "calculateLiftAndDrag.H" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H index e90ba107a..05def2f50 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H @@ -2,7 +2,7 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(stressMesh); @@ -11,36 +11,35 @@ if(min(J.internalField()) > 0) pointMesh pMesh(stressMesh); wordList types - ( - pMesh.boundary().size(), - calculatedFvPatchVectorField::typeName - ); + ( + pMesh.boundary().size(), + calculatedFvPatchVectorField::typeName + ); pointVectorField pointDU - ( - IOobject - ( - "pointDU", - runTime.timeName(), - stressMesh + ( + IOobject + ( + "pointDU", + runTime.timeName(), + stressMesh ), - pMesh, - dimensionedVector("zero", dimLength, vector::zero), - types - ); + pMesh, + dimensionedVector("zero", dimLength, vector::zero), + types + ); pointInterpolation.interpolate(DU, pointDU); - const vectorField& pointDUI = - pointDU.internalField(); + const vectorField& pointDUI = pointDU.internalField(); //- Move mesh vectorField newPoints = stressMesh.allPoints(); forAll (pointDUI, pointI) - { + { newPoints[pointI] += pointDUI[pointI]; - } + } twoDPointCorrector twoDCorrector(stressMesh); twoDCorrector.correctPoints(newPoints); @@ -49,8 +48,8 @@ if(min(J.internalField()) > 0) stressMesh.moving(false); } else - { + { FatalErrorIn(args.executable()) - << "Negative Jacobian" - << exit(FatalError); - } + << "Negative Jacobian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H index 8974864fe..26f76ed67 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H @@ -79,12 +79,12 @@ // Check mesh motion solver type bool feMotionSolver = mesh.objectRegistry::foundObject - ( + ( "motionU" - ); + ); bool fvMotionSolver = mesh.objectRegistry::foundObject - ( + ( "pointMotionU" ); @@ -94,7 +94,7 @@ ( DU.boundaryField()[solidPatchID].type() != solidTractionFvPatchVectorField::typeName - //!= tractionDisplacementIncrementFvPatchVectorField::typeName + //!= tractionDisplacementIncrementFvPatchVectorField::typeName ) { FatalErrorIn(args.executable()) @@ -102,8 +102,8 @@ << " is " << DU.boundaryField()[solidPatchID].type() << "for fluid -solid interface patch, instead " - << solidTractionFvPatchVectorField::typeName - //<< tractionDisplacementIncrementFvPatchVectorField::typeName + << solidTractionFvPatchVectorField::typeName + //<< tractionDisplacementIncrementFvPatchVectorField::typeName << abort(FatalError); } diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C index 7e352e6f1..a89d7a764 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C @@ -57,125 +57,131 @@ Foam::contactPatchPair::contactPatchPair masterFaceZoneName_(masterPatch_.name() + "FaceZone"), slavePointZoneName_(slavePatch_.name() + "PointZone"), totalSlavePointForce_( - cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), vector::zero), - // IOobject - // ( - // "totalSlavePointForce", - // cp_.mesh().time().timeName(), - // cp_.mesh(), - // IOobject::READ_IF_PRESENT, - // IOobject::AUTO_WRITE - // ), - // vectorField(cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), vector::zero) - // ), - slavePointPenetration_( - cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), - 0.0 - ), - masterPointPenetration_( - cp_.mesh().boundaryMesh()[masterPatch_.index()].pointNormals().size(), - 0.0 - ), - globalSlavePointPenetration_( - cp_.mesh().pointZones()[cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_)].size(), - 0.0 - ), - globalMasterPointPenetration_( - cp_.mesh().pointZones()[cp_.mesh().faceZones().findZoneID(masterFaceZoneName_)].size(), - 0.0 - ), - oldTotalSlavePointForce_( - cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), - vector::zero - ), + cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), vector::zero), + // IOobject + // ( + // "totalSlavePointForce", + // cp_.mesh().time().timeName(), + // cp_.mesh(), + // IOobject::READ_IF_PRESENT, + // IOobject::AUTO_WRITE + // ), + // vectorField(cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), vector::zero) + // ), + slavePointPenetration_ + ( + cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), + 0.0 + ), + masterPointPenetration_ + ( + cp_.mesh().boundaryMesh()[masterPatch_.index()].pointNormals().size(), + 0.0 + ), + globalSlavePointPenetration_ + ( + cp_.mesh().pointZones()[cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_)].size(), + 0.0 + ), + globalMasterPointPenetration_ + ( + cp_.mesh().pointZones()[cp_.mesh().faceZones().findZoneID(masterFaceZoneName_)].size(), + 0.0 + ), + oldTotalSlavePointForce_ + ( + cp_.mesh().boundaryMesh()[slavePatch_.index()].pointNormals().size(), + vector::zero + ), oldMinSlavePointPenetration_(0.0), penetrationLimit_(readScalar(dict.lookup("penetrationLimit"))), rigidMaster_(dict.lookup("rigidMaster")), interpolationMethod_(dict.lookup("interpolationMethod")), - faceZoneMasterToSlaveInterpolator_( - cp_.mesh().faceZones()[cp_.mesh().faceZones().findZoneID(masterFaceZoneName_)](), // from - cp_.mesh().faceZones()[cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_)](), // to zone - alg_, - dir_ - ), + faceZoneMasterToSlaveInterpolator_ + ( + cp_.mesh().faceZones()[cp_.mesh().faceZones().findZoneID(masterFaceZoneName_)](), // from + cp_.mesh().faceZones()[cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_)](), // to zone + alg_, + dir_ + ), faceZoneSlaveToMasterInterpolatorPtr_(NULL), faceZoneGgiInterpolatorPtr_(NULL), slaveInterpolator_(cp_.mesh().boundaryMesh()[slavePatch_.index()]) { - Info << "\tConstructing contact patch pair" - << "\n\t\tmaster patch:\t" << masterPatch_.name() - << "\n\t\tslave patch:\t" << slavePatch_.name() - << endl; + Info << "\tConstructing contact patch pair" + << "\n\t\tmaster patch:\t" << masterPatch_.name() + << "\n\t\tslave patch:\t" << slavePatch_.name() + << endl; - if(rigidMaster_) + if(rigidMaster_) Info << "\t\tThe master surface is considered rigid and is set as traction-free" << endl; - //- Check interpolation scheme for passing tractions from slave to master - if(interpolationMethod_ == "patchToPatch") + //- Check interpolation scheme for passing tractions from slave to master + if(interpolationMethod_ == "patchToPatch") { - Info << "\t\tMethod for interpolation of traction from slave to master: patchToPatch" << endl; - label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); - label slaveFaceZoneID = cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_); - faceZoneSlaveToMasterInterpolatorPtr_ = - new zoneToZoneInterpolation - ( - cp_.mesh().faceZones()[slaveFaceZoneID](), // from zone - cp_.mesh().faceZones()[masterFaceZoneID](), // to zone - alg_, - dir_ - ); + Info << "\t\tMethod for interpolation of traction from slave to master: patchToPatch" << endl; + label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); + label slaveFaceZoneID = cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_); + faceZoneSlaveToMasterInterpolatorPtr_ = + new zoneToZoneInterpolation + ( + cp_.mesh().faceZones()[slaveFaceZoneID](), // from zone + cp_.mesh().faceZones()[masterFaceZoneID](), // to zone + alg_, + dir_ + ); } - else if(interpolationMethod_ == "ggi") + else if(interpolationMethod_ == "ggi") { - Info << "\t\tMethod for interpolation of traction from slave to master: ggi" << endl; - label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); - label slaveFaceZoneID = cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_); - faceZoneGgiInterpolatorPtr_ = - new ggiZoneInterpolation - ( - cp_.mesh().faceZones()[masterFaceZoneID](), // master zone - cp_.mesh().faceZones()[slaveFaceZoneID](), // slave zone - tensorField(0), - tensorField(0), - vectorField(0), - 0.0, - 0.0, - true, - ggiInterpolation::AABB - ); + Info << "\t\tMethod for interpolation of traction from slave to master: ggi" << endl; + label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); + label slaveFaceZoneID = cp_.mesh().faceZones().findZoneID(slaveFaceZoneName_); + faceZoneGgiInterpolatorPtr_ = + new ggiZoneInterpolation + ( + cp_.mesh().faceZones()[masterFaceZoneID](), // master zone + cp_.mesh().faceZones()[slaveFaceZoneID](), // slave zone + tensorField(0), + tensorField(0), + vectorField(0), + 0.0, + 0.0, + true, + ggiInterpolation::AABB + ); } - else + else { - SeriousError << "\n\nTraction interpolation method '" - << interpolationMethod_ << "' not found!\n" - << "\nValid interpolation methods are:\n" - << "ggi\n" - << "patchToPatch" - << endl - << exit(FatalError); + SeriousError << "\n\nTraction interpolation method '" + << interpolationMethod_ << "' not found!\n" + << "\nValid interpolation methods are:\n" + << "ggi\n" + << "patchToPatch" + << endl + << exit(FatalError); } - //- only the master should create a contactInfo file - if(Pstream::master()) + //- only the master should create a contactInfo file + if(Pstream::master()) { - contactFilePtr_ = new OFstream(name_); - OFstream& contactFile = *contactFilePtr_; - int width = 20; - contactFile << "Time"; - contactFile.width(width); - contactFile << "ContactIter"; - contactFile.width(width); - contactFile << "PenaltyScale"; - contactFile.width(width); - contactFile << "slaveContactVer"; - contactFile.width(width); - contactFile << "penetration"; - contactFile.width(width); - contactFile << "slaveVerReduce"; - contactFile.width(width); - contactFile << "maxSlaveTrac" << endl; + contactFilePtr_ = new OFstream(name_); + OFstream& contactFile = *contactFilePtr_; + int width = 20; + contactFile << "Time"; + contactFile.width(width); + contactFile << "ContactIter"; + contactFile.width(width); + contactFile << "PenaltyScale"; + contactFile.width(width); + contactFile << "slaveContactVer"; + contactFile.width(width); + contactFile << "penetration"; + contactFile.width(width); + contactFile << "slaveVerReduce"; + contactFile.width(width); + contactFile << "maxSlaveTrac" << endl; } - Info << "\tContact patch pair constructed" << endl; + Info << "\tContact patch pair constructed" << endl; } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -267,24 +273,24 @@ Foam::contactPatchPair::slaveTouchFraction() const Foam::tmp Foam::contactPatchPair::masterGapPoints() const { - scalarField globalMasterPointPenetration + scalarField globalMasterPointPenetration ( - cp_.mesh().boundaryMesh()[masterPatch_.index()].meshPoints().size(), - 0.0 - ); + cp_.mesh().boundaryMesh()[masterPatch_.index()].meshPoints().size(), + 0.0 + ); - scalarField vertexMasterGap = masterPointPenetration_; - //globalMasterPointPenetration; + scalarField vertexMasterGap = masterPointPenetration_; + //globalMasterPointPenetration; tmp tcontactGapPoints ( - new scalarField(vertexMasterGap.size(), 0) + new scalarField(vertexMasterGap.size(), 0) ); scalarField& contactGapPoints = tcontactGapPoints(); forAll (vertexMasterGap, pointI) { - contactGapPoints[pointI] = vertexMasterGap[pointI]; + contactGapPoints[pointI] = vertexMasterGap[pointI]; } return tcontactGapPoints; @@ -296,17 +302,17 @@ Foam::contactPatchPair::masterGapPoints() const Foam::tmp Foam::contactPatchPair::slaveGapPoints() const { - const scalarField& slavePointPenetration = slavePointPenetration_; + const scalarField& slavePointPenetration = slavePointPenetration_; - tmp tcontactGapPoints + tmp tcontactGapPoints ( - new scalarField(slavePointPenetration.size(), 0) + new scalarField(slavePointPenetration.size(), 0) ); scalarField& contactGapPoints = tcontactGapPoints(); forAll (slavePointPenetration, pointI) { - contactGapPoints[pointI] = slavePointPenetration[pointI]; + contactGapPoints[pointI] = slavePointPenetration[pointI]; } return tcontactGapPoints; @@ -318,25 +324,25 @@ Foam::contactPatchPair::slaveGapPoints() const Foam::tmp Foam::contactPatchPair::masterPointForce() const { - //- returns zero at the moment - vectorField masterPointForce + //- returns zero at the moment + vectorField masterPointForce ( - cp_.mesh().boundaryMesh()[masterPatch_.index()].meshPoints().size(), - vector::zero - ); + cp_.mesh().boundaryMesh()[masterPatch_.index()].meshPoints().size(), + vector::zero + ); - tmp tcontactPointForce + tmp tcontactPointForce ( - new vectorField(masterPointForce.size(), vector::zero) - ); - vectorField& contactPointForce = tcontactPointForce(); + new vectorField(masterPointForce.size(), vector::zero) + ); + vectorField& contactPointForce = tcontactPointForce(); - forAll (contactPointForce, pointI) + forAll (contactPointForce, pointI) { contactPointForce[pointI] = masterPointForce[pointI]; } - return tcontactPointForce; + return tcontactPointForce; } @@ -345,21 +351,21 @@ Foam::contactPatchPair::masterPointForce() const Foam::tmp Foam::contactPatchPair::slavePointForce() const { - vectorField slavePointForce = totalSlavePointForce_; + vectorField slavePointForce = totalSlavePointForce_; - tmp tcontactPointForce + tmp tcontactPointForce ( - new vectorField(slavePointForce.size(), vector::zero) - ); + new vectorField(slavePointForce.size(), vector::zero) + ); - vectorField& contactPointForce = tcontactPointForce(); + vectorField& contactPointForce = tcontactPointForce(); - forAll (contactPointForce, pointI) + forAll (contactPointForce, pointI) { - contactPointForce[pointI] = slavePointForce[pointI]; + contactPointForce[pointI] = slavePointForce[pointI]; } - return tcontactPointForce; + return tcontactPointForce; } @@ -386,7 +392,7 @@ Foam::contactPatchPair::masterContactPressure() const forAll (masterPressure, faceI) { - contactPressure[faceI] = max(-1*masterPressure[faceI],0); + contactPressure[faceI] = max(-1*masterPressure[faceI],0); } return tcontactPressure; @@ -416,7 +422,7 @@ Foam::contactPatchPair::slaveContactPressure() const forAll (slavePressure, faceI) { - contactPressure[faceI] = max(-1*slavePressure[faceI],0); + contactPressure[faceI] = max(-1*slavePressure[faceI],0); } return tcontactPressure; diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H index b1ccc3a92..db6c207ba 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H @@ -101,7 +101,7 @@ private: //contact iteration number int contactIterNum_; - // file that contains contact information + // file that contains contact information OFstream* contactFilePtr_; // slave face zone name - needed to define zoneToZoneInterp @@ -228,13 +228,13 @@ public: Switch contactActive() { return contactActive_; - }; + }; //- set contactActive_ to on or off void setContactActive(bool trueOrFalse) { - contactActive_ = trueOrFalse; - }; + contactActive_ = trueOrFalse; + }; //- Write dictionary void writeDict(Ostream&) const; diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPairCorrect.C b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPairCorrect.C index bafd71370..496b62b84 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPairCorrect.C +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPairCorrect.C @@ -34,266 +34,262 @@ Description void Foam::contactPatchPair::correct() { + //---------------------PRELIMINARIES---------------------------------// + const fvMesh& mesh = cp_.mesh(); + const label& masterIndex = masterPatch_.index(); + const label& slaveIndex = slavePatch_.index(); + scalar maxMagSlaveTraction = 0.0; + contactIterNum_++; - //---------------------PRELIMINARIES---------------------------------// - const fvMesh& mesh = cp_.mesh(); - const label& masterIndex = masterPatch_.index(); - const label& slaveIndex = slavePatch_.index(); - scalar maxMagSlaveTraction = 0.0; - contactIterNum_++; + //--------CALCULATE MASTER AND SLAVE PENETRATIONS----------------------// + scalarField& globalSlavePointPenetration = globalSlavePointPenetration_; + //scalarField& globalMasterPointPenetration = globalMasterPointPenetration_; + //- tell zoneToZone that mesh has moved, so the intersection will be recalculated + faceZoneMasterToSlaveInterpolator_.movePoints(); + //- calculate intersection distances + //- this is the slowest part of the contact correction especially when the slavePatch + //- has many points. parallelisation of this step should be considered. + globalSlavePointPenetration = + faceZoneMasterToSlaveInterpolator_.pointDistanceToIntersection(); - //--------CALCULATE MASTER AND SLAVE PENETRATIONS----------------------// - scalarField& globalSlavePointPenetration = globalSlavePointPenetration_; - //scalarField& globalMasterPointPenetration = globalMasterPointPenetration_; + //globalMasterPointPenetration = + // faceZoneSlaveToMasterInterpolator.pointDistanceToIntersection(); + scalarField& slavePointPenetration = slavePointPenetration_; + //scalarField& masterPointPenetration = masterPointPenetration_; - //- tell zoneToZone that mesh has moved, so the intersection will be recalculated - faceZoneMasterToSlaveInterpolator_.movePoints(); - //- calculate intersection distances - //- this is the slowest part of the contact correction especially when the slavePatch - //- has many points. parallelisation of this step should be considered. - globalSlavePointPenetration - = faceZoneMasterToSlaveInterpolator_.pointDistanceToIntersection(); - - //globalMasterPointPenetration - //= faceZoneSlaveToMasterInterpolator.pointDistanceToIntersection(); - - - scalarField& slavePointPenetration = slavePointPenetration_; - //scalarField& masterPointPenetration = masterPointPenetration_; - - - forAll(slavePointPenetration, pointI) + forAll(slavePointPenetration, pointI) { - //label pointGlobalLabel = slavePointLabels[pointI]; - slavePointPenetration[pointI] = - globalSlavePointPenetration - [ - pointI //mesh.pointZones()[slavePointZoneID].whichPoint(pointGlobalLabel) - ]; + //label pointGlobalLabel = slavePointLabels[pointI]; + slavePointPenetration[pointI] = + globalSlavePointPenetration + [ + pointI //mesh.pointZones()[slavePointZoneID].whichPoint(pointGlobalLabel) + ]; - //- when the master surface surrounds the slave (like the pelvis and femur head) then - //- the slave penetration can sometimes calculate the distance through the femur head - //- to the pelvis which is wrong so I limit slavePenetration here - //- i should add a limitPenetration switch here if(limitPenetration) - if(slavePointPenetration[pointI] < penetrationLimit_) - { - slavePointPenetration[pointI] = 0.0; - //globalSlavePointPenetration[pointI] = 0.0; - } + //- when the master surface surrounds the slave (like the pelvis and femur head) then + //- the slave penetration can sometimes calculate the distance through the femur head + //- to the pelvis which is wrong so I limit slavePenetration here + //- i should add a limitPenetration switch here if(limitPenetration) + if(slavePointPenetration[pointI] < penetrationLimit_) + { + slavePointPenetration[pointI] = 0.0; + //globalSlavePointPenetration[pointI] = 0.0; + } } - //- This is just for visualisation - // forAll(masterPointPenetration, pointI) - // { - // masterPointPenetration[pointI] = - // globalMasterPointPenetration - // [ - // pointI - // ]; - // } + //- This is just for visualisation + // forAll(masterPointPenetration, pointI) + // { + // masterPointPenetration[pointI] = + // globalMasterPointPenetration + // [ + // pointI + // ]; + // } + //------CALCULATE SLAVE VERTEX FORCES BASED ON PENETRATION-------------// + //- approximation of penaltyFactor + //- this should be automatic, these numbers don't really matter, the scaleFactor + //- scales theses + scalar bulkModulus = 500e6; + scalar faceArea = 9e-6; //0.01; //0.0049; //approx + scalar cellVolume = 2.7e-8; //0.001; //0.00031; //approx + scalar penaltyFactor = penaltyScaleFactor_*bulkModulus*faceArea*faceArea/cellVolume; + scalar returnPenaltyFactor = returnScaleFactor_*penaltyFactor; + //-- slave + const vectorField& slavePointNormals = mesh.boundaryMesh()[slaveIndex].pointNormals(); + vectorField& totalSlavePointForce = totalSlavePointForce_; - //------CALCULATE SLAVE VERTEX FORCES BASED ON PENETRATION-------------// - //- approximation of penaltyFactor - //- this should be automatic, these numbers don't really matter, the scaleFactor - //- scales theses - scalar bulkModulus = 500e6; - scalar faceArea = 9e-6; //0.01; //0.0049; //approx - scalar cellVolume = 2.7e-8; //0.001; //0.00031; //approx - scalar penaltyFactor = penaltyScaleFactor_*bulkModulus*faceArea*faceArea/cellVolume; - scalar returnPenaltyFactor = returnScaleFactor_*penaltyFactor; + label numSlaveContactPoints = 0; + label numSlaveContactPointsReducing = 0; + label numSlavesUpdated = 0; - //-- slave - const vectorField& slavePointNormals = mesh.boundaryMesh()[slaveIndex].pointNormals(); - vectorField& totalSlavePointForce = totalSlavePointForce_; + //- so the procs know the global min + //scalar minSlavePointPenetration = gMin(slavePointPenetration); + scalar minSlavePointPenetration = gMin(globalSlavePointPenetration); - int numSlaveContactPoints = 0; - int numSlaveContactPointsReducing = 0; - int numSlavesUpdated = 0; - - //- so the procs know the global min - //scalar minSlavePointPenetration = gMin(slavePointPenetration); - scalar minSlavePointPenetration = gMin(globalSlavePointPenetration); - - { - //- update old point force - oldTotalSlavePointForce_ = totalSlavePointForce; - - forAll(totalSlavePointForce, pointI) - { - // if a point has penetrated (i.e. if the penetration is negative), - //add a force to it relative to the penetration - if(slavePointPenetration[pointI] < -contactGapTol_) //-I had this before < 0.0) - { - //contactStep = true; - numSlaveContactPoints++; // count points in contact - numSlavesUpdated++; - //- force is linearly dependent on penetration - totalSlavePointForce[pointI] += - ( slavePointNormals[pointI] * penaltyFactor * slavePointPenetration[pointI] ); - } - //- else if point is within contact tolerance then don't add any more force - else if(slavePointPenetration[pointI] < 0.0) - { - numSlaveContactPoints++; // count points in contact - } - // else if penetration is positive and there is a positive - // pressure (negative traction) still - // on the point, then slowly reduce the pressure - else if((totalSlavePointForce[pointI] & slavePointNormals[pointI]) < 0.0) - { - numSlavesUpdated++; - numSlaveContactPointsReducing++; - // point forces must be reduced slowly - - totalSlavePointForce[pointI] += - ( slavePointNormals[pointI] * returnPenaltyFactor * slavePointPenetration[pointI] ); - - // if a tensile force develops - if((totalSlavePointForce[pointI] & slavePointNormals[pointI]) > 0.0) - { - totalSlavePointForce[pointI] = vector::zero; - } - } - } - - //--------INTERPOLATE SLAVE POINT FORCE TO SLAVE FACES AND APPLY----------// - //- tell interpolation that mesh has moved - slaveInterpolator_.movePoints(); - //- local interpolation - vectorField slaveTraction = - slaveInterpolator_.pointToFaceInterpolate - ( - totalSlavePointForce - ); - scalarField slavePressure = mag(slaveTraction); - - //- apply slave traction { - solidTractionFvPatchVectorField& slavePatch = - refCast(cp_.U().boundaryField()[slaveIndex]); - slavePatch.traction() = vector::zero; - slavePatch.pressure() = slavePressure; - maxMagSlaveTraction = gMax(slavePressure); + //- update old point force + oldTotalSlavePointForce_ = totalSlavePointForce; + + forAll(totalSlavePointForce, pointI) + { + // if a point has penetrated (i.e. if the penetration is negative), + //add a force to it relative to the penetration + if(slavePointPenetration[pointI] < -contactGapTol_) //-I had this before < 0.0) + { + //contactStep = true; + numSlaveContactPoints++; // count points in contact + numSlavesUpdated++; + //- force is linearly dependent on penetration + totalSlavePointForce[pointI] += + ( + slavePointNormals[pointI]*penaltyFactor*slavePointPenetration[pointI] + ); + } + //- else if point is within contact tolerance then don't add any more force + else if(slavePointPenetration[pointI] < 0.0) + { + numSlaveContactPoints++; // count points in contact + } + // else if penetration is positive and there is a positive + // pressure (negative traction) still + // on the point, then slowly reduce the pressure + else if((totalSlavePointForce[pointI] & slavePointNormals[pointI]) < 0.0) + { + numSlavesUpdated++; + numSlaveContactPointsReducing++; + // point forces must be reduced slowly + + totalSlavePointForce[pointI] += + ( + slavePointNormals[pointI]*returnPenaltyFactor*slavePointPenetration[pointI] + ); + + // if a tensile force develops + if((totalSlavePointForce[pointI] & slavePointNormals[pointI]) > 0.0) + { + totalSlavePointForce[pointI] = vector::zero; + } + } + } + + //--------INTERPOLATE SLAVE POINT FORCE TO SLAVE FACES AND APPLY----------// + //- tell interpolation that mesh has moved + slaveInterpolator_.movePoints(); + //- local interpolation + vectorField slaveTraction = + slaveInterpolator_.pointToFaceInterpolate + ( + totalSlavePointForce + ); + scalarField slavePressure = mag(slaveTraction); + + //- apply slave traction + { + solidTractionFvPatchVectorField& slavePatch = + refCast(cp_.U().boundaryField()[slaveIndex]); + slavePatch.traction() = vector::zero; + slavePatch.pressure() = slavePressure; + maxMagSlaveTraction = gMax(slavePressure); + } + + //--------INTERPOLATE SLAVE POINT FORCE TO MASTER FACE TRACTIONS----------// + //- for a deformable master + if(!rigidMaster_) + { + const label slaveFaceZoneID = + mesh.faceZones().findZoneID(slaveFaceZoneName_); + const label slavePatchStart = + mesh.boundaryMesh()[slaveIndex].start(); + + scalarField globalSlavePressure + ( + mesh.faceZones()[slaveFaceZoneID].size(), + 0.0 + ); + + forAll(slavePressure, i) + { + globalSlavePressure[mesh.faceZones()[slaveFaceZoneID].whichFace(slavePatchStart + i)] = + slavePressure[i]; + } + //- exchange parallel data + reduce(globalSlavePressure, maxOp()); + + const label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); + scalarField globalMasterPressure(mesh.faceZones()[masterFaceZoneID].size(),0.0); + + if(faceZoneSlaveToMasterInterpolatorPtr_) + { + zoneToZoneInterpolation& faceZoneSlaveToMasterInterpolator = *faceZoneSlaveToMasterInterpolatorPtr_; + faceZoneSlaveToMasterInterpolator.movePoints(); + //- patchToPatch interpolate tractions - inverse distance weighting + globalMasterPressure = + faceZoneSlaveToMasterInterpolator.faceInterpolate + ( + globalSlavePressure + ); + } + else if(faceZoneGgiInterpolatorPtr_) + { + ggiZoneInterpolation& faceZoneGgiInterpolator = *faceZoneGgiInterpolatorPtr_; + faceZoneGgiInterpolator.movePoints(); + + //- GGI interpolate tractions + globalMasterPressure = + faceZoneGgiInterpolator.slaveToMaster + ( + globalSlavePressure + ); + } + + //- exchange parallel data + reduce(globalMasterPressure, maxOp()); + + //Pout << "The max global master trac is " << max(globalMasterPressure) << endl; + + const label masterPatchStart = + mesh.boundaryMesh()[masterIndex].start(); + + scalarField masterPressure(mesh.boundaryMesh()[masterIndex].size(), 0.0); + + forAll(masterPressure, i) + { + masterPressure[i] = + globalMasterPressure + [ + mesh.faceZones()[masterFaceZoneID].whichFace(masterPatchStart + i) + ]; + } + + //- apply master traction + { + solidTractionFvPatchVectorField& masterPatch = + refCast(cp_.U().boundaryField()[masterIndex]); + masterPatch.traction() = vector::zero; + masterPatch.pressure() = masterPressure; + } + } + else //- rigid master + { + solidTractionFvPatchVectorField& masterPatch = + refCast(cp_.U().boundaryField()[masterIndex]); + masterPatch.traction() = vector::zero; + masterPatch.pressure() = 0.0; + } } - //--------INTERPOLATE SLAVE POINT FORCE TO MASTER FACE TRACTIONS----------// - //- for a deformable master - if(!rigidMaster_) - { - const label slaveFaceZoneID - = mesh.faceZones().findZoneID(slaveFaceZoneName_); - const label slavePatchStart - = mesh.boundaryMesh()[slaveIndex].start(); - scalarField globalSlavePressure - ( - mesh.faceZones()[slaveFaceZoneID].size(), - 0.0 - ); + //--------MASTER PROCS WRITES CONTACT INFO FILE----------// + reduce(numSlaveContactPoints, sumOp()); + reduce(numSlaveContactPointsReducing, sumOp()); - forAll(slavePressure, i) - { - globalSlavePressure[mesh.faceZones()[slaveFaceZoneID].whichFace(slavePatchStart + i)] = - slavePressure[i]; - } - //- exchange parallel data - reduce(globalSlavePressure, maxOp()); - - const label masterFaceZoneID = cp_.mesh().faceZones().findZoneID(masterFaceZoneName_); - scalarField globalMasterPressure(mesh.faceZones()[masterFaceZoneID].size(),0.0); - - if(faceZoneSlaveToMasterInterpolatorPtr_) - { - zoneToZoneInterpolation& faceZoneSlaveToMasterInterpolator = *faceZoneSlaveToMasterInterpolatorPtr_; - faceZoneSlaveToMasterInterpolator.movePoints(); - //- patchToPatch interpolate tractions - inverse distance weighting - globalMasterPressure = - faceZoneSlaveToMasterInterpolator.faceInterpolate - ( - globalSlavePressure - ); - } - else if(faceZoneGgiInterpolatorPtr_) - { - ggiZoneInterpolation& faceZoneGgiInterpolator = *faceZoneGgiInterpolatorPtr_; - faceZoneGgiInterpolator.movePoints(); - - //- GGI interpolate tractions - globalMasterPressure = - faceZoneGgiInterpolator.slaveToMaster - ( - globalSlavePressure - ); - } - - - //- exchange parallel data - reduce(globalMasterPressure, maxOp()); - - //Pout << "The max global master trac is " << max(globalMasterPressure) << endl; - - const label masterPatchStart - = mesh.boundaryMesh()[masterIndex].start(); - - scalarField masterPressure(mesh.boundaryMesh()[masterIndex].size(), 0.0); - - forAll(masterPressure, i) - { - masterPressure[i] = - globalMasterPressure - [ - mesh.faceZones()[masterFaceZoneID].whichFace(masterPatchStart + i) - ]; - } - - //- apply master traction - { - solidTractionFvPatchVectorField& masterPatch = - refCast(cp_.U().boundaryField()[masterIndex]); - masterPatch.traction() = vector::zero; - masterPatch.pressure() = masterPressure; - } - } - else //- rigid master - { - solidTractionFvPatchVectorField& masterPatch = - refCast(cp_.U().boundaryField()[masterIndex]); - masterPatch.traction() = vector::zero; - masterPatch.pressure() = 0.0; - } - } - - - //--------MASTER PROCS WRITES CONTACT INFO FILE----------// - reduce(numSlaveContactPoints, sumOp()); - reduce(numSlaveContactPointsReducing, sumOp()); - - if(Pstream::master()) - { - OFstream& contactFile = *contactFilePtr_; + if(Pstream::master()) + { + OFstream& contactFile = *contactFilePtr_; // contactFile << cp_.U().time().value() << "\t\t" << contactStep << "\t\t" << contactIterNum_ -// << "\t\t" << penaltyScaleFactor_ << "\t\t" << penaltyFactor << "\t\t" << numSlaveContactPoints -// << "\t\t\t" << minSlavePointPenetration -// << "\t\t" << numSlaveContactPointsReducing << endl; +// << "\t\t" << penaltyScaleFactor_ << "\t\t" << penaltyFactor << "\t\t" << numSlaveContactPoints +// << "\t\t\t" << minSlavePointPenetration +// << "\t\t" << numSlaveContactPointsReducing << endl; - int width = 20; - contactFile << cp_.U().time().value(); - contactFile.width(width); - contactFile << contactIterNum_; - contactFile.width(width); - contactFile << penaltyScaleFactor_; - contactFile.width(width); - contactFile << numSlaveContactPoints; - contactFile.width(width); - contactFile << minSlavePointPenetration; - contactFile.width(width); - contactFile << numSlaveContactPointsReducing; - contactFile.width(width); - contactFile << maxMagSlaveTraction << endl; + int width = 20; + contactFile << cp_.U().time().value(); + contactFile.width(width); + contactFile << contactIterNum_; + contactFile.width(width); + contactFile << penaltyScaleFactor_; + contactFile.width(width); + contactFile << numSlaveContactPoints; + contactFile.width(width); + contactFile << minSlavePointPenetration; + contactFile.width(width); + contactFile << numSlaveContactPointsReducing; + contactFile.width(width); + contactFile << maxMagSlaveTraction << endl; } } diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C index 70a60450d..9ff16f118 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C @@ -69,46 +69,46 @@ contactProblem::contactProblem contactPatchPairList(), U_(U) { - Info << "\nConstructing contact problem" << endl; - Info << "\t*************************************************************************************\n" - << "\t** MAKE SURE MASTER AND SLAVE FACE AND POINT ZONES HAVE BEEN DEFINED **\n" - << "\t** To define, use the 'setSet' utility: **\n" - << "\t** faceSet FaceZone new patchToFace **\n" - << "\t** faceSet FaceZone new patchToFace **\n" - << "\t** pointSet PointZone new faceToPoint FaceZone all **\n" - << "\t** pointSet PointZone new faceToPoint FaceZone all **\n" - << "\t** Then use the 'setsToZone -noFlipMap' command **\n" - << "\t** For parallel runs, 'globalFaceZones (FaceZone FaceZone)' **\n" - << "\t** must be included in the decomposeParDict **\n" - << "\t** and are replaced with the slave and master patch names **\n" - << "\t*************************************************************************************" - << endl; + Info << "\nConstructing contact problem" << endl; + Info << "\t*************************************************************************************\n" + << "\t** MAKE SURE MASTER AND SLAVE FACE AND POINT ZONES HAVE BEEN DEFINED **\n" + << "\t** To define, use the 'setSet' utility: **\n" + << "\t** faceSet FaceZone new patchToFace **\n" + << "\t** faceSet FaceZone new patchToFace **\n" + << "\t** pointSet PointZone new faceToPoint FaceZone all **\n" + << "\t** pointSet PointZone new faceToPoint FaceZone all **\n" + << "\t** Then use the 'setsToZone -noFlipMap' command **\n" + << "\t** For parallel runs, 'globalFaceZones (FaceZone FaceZone)' **\n" + << "\t** must be included in the decomposeParDict **\n" + << "\t** and are replaced with the slave and master patch names **\n" + << "\t*************************************************************************************" + << endl; - //- Read contactPatchPairList - Istream& is = lookup("contacts"); + //- Read contactPatchPairList + Istream& is = lookup("contacts"); - PtrList contactEntries(is); + PtrList contactEntries(is); - contactPatchPairList& contacts = *this; + contactPatchPairList& contacts = *this; - contacts.setSize(contactEntries.size()); + contacts.setSize(contactEntries.size()); - forAll(contacts, contactI) + forAll(contacts, contactI) { - contacts.set + contacts.set ( - contactI, - new contactPatchPair - ( - contactEntries[contactI].keyword(), - *this, - contactEntries[contactI].dict() - ) - ); - } + contactI, + new contactPatchPair + ( + contactEntries[contactI].keyword(), + *this, + contactEntries[contactI].dict() + ) + ); + } - Info << "Contact problem constructed" - << endl; + Info << "Contact problem constructed" + << endl; } @@ -121,34 +121,32 @@ contactProblem::contactProblem //**********************CORRECT FUNCTION*************************************// void contactProblem::correct() { - contactPatchPairList& contacts = *this; + contactPatchPairList& contacts = *this; - // Collect patches involved in contact - boolList contactPatches(U().boundaryField().size(), false); + // Collect patches involved in contact + boolList contactPatches(U().boundaryField().size(), false); - forAll (contacts, contactI) + forAll (contacts, contactI) { - contactPatches[contacts[contactI].masterPatch().index()] = true; - contactPatches[contacts[contactI].slavePatch().index()] = true; + contactPatches[contacts[contactI].masterPatch().index()] = true; + contactPatches[contacts[contactI].slavePatch().index()] = true; } - // Calculate contact trcations - forAll (contacts, contactI) + // Calculate contact trcations + forAll (contacts, contactI) { - if(contacts[contactI].contactActive()) - { - contacts[contactI].correct(); - } - else - { - Info << "\t\t\tContact " << contacts[contactI].name() << " not active" << endl; - } + if(contacts[contactI].contactActive()) + { + contacts[contactI].correct(); + } + else + { + Info << "\t\t\tContact " << contacts[contactI].name() << " not active" << endl; + } } } - - //**********************CONTACT AREA FUNCTION***********************************// tmp contactProblem::contactArea() const { @@ -189,27 +187,27 @@ tmp contactProblem::contactArea() const label slaveIndex = contacts[contactI].slavePatch().index(); scalarField masterFrac = contacts[contactI].masterTouchFraction(); scalarField slaveFrac = contacts[contactI].slaveTouchFraction(); - scalar contactAreaMaster = - gSum - ( - masterFrac * - mag( - mesh().Sf().boundaryField()[masterIndex] - ) - ); - scalar contactAreaSlave = - gSum - ( + scalar contactAreaMaster = gSum + ( + masterFrac * + mag + ( + mesh().Sf().boundaryField()[masterIndex] + ) + ); + scalar contactAreaSlave = gSum + ( slaveFrac * - mag( - mesh().Sf().boundaryField()[slaveIndex] - ) - ); - Info << "\nContact area of master patch is: " - << contactAreaMaster << " m^2" - << "\nContact area of slave patch is: " - << contactAreaSlave << " m^2" - << endl << endl; + mag + ( + mesh().Sf().boundaryField()[slaveIndex] + ) + ); + Info << "\nContact area of master patch is: " + << contactAreaMaster << " m^2" + << "\nContact area of slave patch is: " + << contactAreaSlave << " m^2" + << endl << endl; //------------------------------------------------------// } @@ -222,26 +220,26 @@ tmp contactProblem::contactArea() const //tmp contactProblem::contactGapPoints() const void contactProblem::contactGapPoints(pointScalarField& cGapPoints) { - const contactPatchPairList& contacts = *this; + const contactPatchPairList& contacts = *this; - scalarField& cGapPointsInternal = cGapPoints.internalField(); + scalarField& cGapPointsInternal = cGapPoints.internalField(); - forAll (contacts, contactI) + forAll (contacts, contactI) { - scalarField masterGapPoints = contacts[contactI].masterGapPoints(); - labelList masterBoundaryLabels = mesh().boundaryMesh()[contacts[contactI].masterPatch().index()].meshPoints(); + scalarField masterGapPoints = contacts[contactI].masterGapPoints(); + labelList masterBoundaryLabels = mesh().boundaryMesh()[contacts[contactI].masterPatch().index()].meshPoints(); - scalarField slaveGapPoints = contacts[contactI].slaveGapPoints(); - labelList slaveBoundaryLabels = mesh().boundaryMesh()[contacts[contactI].slavePatch().index()].meshPoints(); + scalarField slaveGapPoints = contacts[contactI].slaveGapPoints(); + labelList slaveBoundaryLabels = mesh().boundaryMesh()[contacts[contactI].slavePatch().index()].meshPoints(); - forAll(masterBoundaryLabels, pointI) - { - cGapPointsInternal[masterBoundaryLabels[pointI]] = masterGapPoints[pointI]; - } - forAll(slaveBoundaryLabels, pointI) - { - cGapPointsInternal[slaveBoundaryLabels[pointI]] = slaveGapPoints[pointI]; - } + forAll(masterBoundaryLabels, pointI) + { + cGapPointsInternal[masterBoundaryLabels[pointI]] = masterGapPoints[pointI]; + } + forAll(slaveBoundaryLabels, pointI) + { + cGapPointsInternal[slaveBoundaryLabels[pointI]] = slaveGapPoints[pointI]; + } } } @@ -250,33 +248,31 @@ void contactProblem::contactGapPoints(pointScalarField& cGapPoints) void contactProblem::contactPointForce(pointVectorField& cPointForce) { - pointMesh pMesh(mesh()); - const contactPatchPairList& contacts = *this; + pointMesh pMesh(mesh()); + const contactPatchPairList& contacts = *this; - vectorField& cPointForceInternal = cPointForce.internalField(); + vectorField& cPointForceInternal = cPointForce.internalField(); - forAll (contacts, contactI) + forAll (contacts, contactI) { - vectorField masterContactPointForce = contacts[contactI].masterPointForce(); - labelList masterBoundaryLabels = pMesh.boundary()[contacts[contactI].masterPatch().index()].meshPoints(); + vectorField masterContactPointForce = contacts[contactI].masterPointForce(); + labelList masterBoundaryLabels = pMesh.boundary()[contacts[contactI].masterPatch().index()].meshPoints(); - vectorField slaveContactPointForce = contacts[contactI].slavePointForce(); - labelList slaveBoundaryLabels = pMesh.boundary()[contacts[contactI].slavePatch().index()].meshPoints(); + vectorField slaveContactPointForce = contacts[contactI].slavePointForce(); + labelList slaveBoundaryLabels = pMesh.boundary()[contacts[contactI].slavePatch().index()].meshPoints(); - forAll(masterBoundaryLabels, pointI) - { - cPointForceInternal[masterBoundaryLabels[pointI]] = masterContactPointForce[pointI]; - } - forAll(slaveBoundaryLabels, pointI) - { - cPointForceInternal[slaveBoundaryLabels[pointI]] = slaveContactPointForce[pointI]; - } + forAll(masterBoundaryLabels, pointI) + { + cPointForceInternal[masterBoundaryLabels[pointI]] = masterContactPointForce[pointI]; + } + forAll(slaveBoundaryLabels, pointI) + { + cPointForceInternal[slaveBoundaryLabels[pointI]] = slaveContactPointForce[pointI]; + } } } - - tmp contactProblem::contactPressure() const { tmp tcPress diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.H b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.H index 2ee69da36..133efa7c0 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.H +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.H @@ -90,8 +90,8 @@ public: //- Read constructor contactProblem ( - volVectorField& U - ); + volVectorField& U + ); // Destructor diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C index 8e665b3f8..3c38dc9f4 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C @@ -155,25 +155,25 @@ void analyticalPlateHoleTractionFvPatchVectorField::updateCoeffs() const vectorField& Cf = patch().Cf(); forAll(Traction, faceI) - { - vector curC(Cf[faceI].x(), Cf[faceI].y(), 0); - vector curN = n[faceI]; + { + vector curC(Cf[faceI].x(), Cf[faceI].y(), 0); + vector curN = n[faceI]; - if (patch().name() == "hole") - { - curC /= mag(curC); - curC *= 0.5; + if (patch().name() == "hole") + { + curC /= mag(curC); + curC *= 0.5; - curN = -curC/mag(curC); - } + curN = -curC/mag(curC); + } - Traction[faceI] = - (n[faceI] & plateHoleSolution(curC)); - } + Traction[faceI] = + (n[faceI] & plateHoleSolution(curC)); + } //- set patch gradient vectorField newGradient = - Traction + Traction - (n & (mu*gradU.T() - (mu + lambda)*gradU)) - n*lambda*tr(gradU); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C index 0345449e8..3e1c3f5bf 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C @@ -91,9 +91,9 @@ cohesiveZoneFvPatchVectorField::cohesiveZoneFvPatchVectorField if(fieldName_ != "U") { FatalError << "cohesiveZone boundary condition can only be used" - << " with U solvers\n" - << "For small strain DU (incremental) solvers, use cohesiveZoneIncremental" - << exit(FatalError); + << " with U solvers\n" + << "For small strain DU (incremental) solvers, use cohesiveZoneIncremental" + << exit(FatalError); } if (dict.found("refValue")) diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C index fab52d3a7..a566d1fec 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C @@ -267,9 +267,9 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() DEpsilonP = plasticity.DEpsilonP().boundaryField()[patch().index()]; - mu = plasticity.newMu().boundaryField()[patch().index()]; + mu = plasticity.newMu().boundaryField()[patch().index()]; - lambda = plasticity.newLambda().boundaryField()[patch().index()]; + lambda = plasticity.newLambda().boundaryField()[patch().index()]; } // Patch stress increment @@ -323,7 +323,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() if(Un > law().deltaC().value()/2) { // Traction free - cohesiveTractionIncrement = + cohesiveTractionIncrement = vector::zero - n[faceI]*oldSigmaN[faceI]; @@ -332,15 +332,15 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() } else { - // Calculate cohesive traction from cohesive zone model - cohesiveTractionIncrement = - law().traction(2*Un)*n[faceI] + // Calculate cohesive traction from cohesive zone model + cohesiveTractionIncrement = + law().traction(2*Un)*n[faceI] - n[faceI]*oldSigmaN[faceI]; - if (crackIndicator_[faceI] == 1) - { - Pout << "Return to craze, face: " << faceI << endl; - } + if (crackIndicator_[faceI] == 1) + { + Pout << "Return to craze, face: " << faceI << endl; + } crazeIndicator_[faceI] = 1; crackIndicator_[faceI] = 0; @@ -363,8 +363,8 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() // { // // Traction free // cohesiveTractionIncrement = -// vector::zero -// - n[faceI]*oldSigmaN[faceI]; +// vector::zero +// - n[faceI]*oldSigmaN[faceI]; // crazeIndicator_[faceI] = 0; // crackIndicator_[faceI] = 1; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C index 46f318f1f..50949e000 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C @@ -85,9 +85,9 @@ fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField ) != "extendedLeastSquares" ) { - Warning << "The gradScheme for " << fieldName_ - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + Warning << "The gradScheme for " << fieldName_ + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } } diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C index c78d40f3f..18962ab38 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C @@ -90,15 +90,15 @@ fixedDisplacementZeroShearFvPatchVectorField::fixedDisplacementZeroShearFvPatchV { nonLinear_ = nonLinearNames_.read(dict.lookup("nonLinear"));; - if (nonLinear_ == UPDATED_LAGRANGIAN) - { - Info << "\tnonLinear set to updated Lagrangian" - << endl; - } - else if (nonLinear_ == TOTAL_LAGRANGIAN) - { - Info << "\tnonLinear set to total Lagrangian" << endl; - } + if (nonLinear_ == UPDATED_LAGRANGIAN) + { + Info << "\tnonLinear set to updated Lagrangian" + << endl; + } + else if (nonLinear_ == TOTAL_LAGRANGIAN) + { + Info << "\tnonLinear set to total Lagrangian" << endl; + } } //- the leastSquares has zero non-orthogonal correction @@ -115,9 +115,9 @@ fixedDisplacementZeroShearFvPatchVectorField::fixedDisplacementZeroShearFvPatchV ) != "extendedLeastSquares" ) { - Warning << "The gradScheme for " << fieldName_ - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + Warning << "The gradScheme for " << fieldName_ + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } this->refGrad() = vector::zero; @@ -205,8 +205,8 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() const plasticityModel& plasticity = refCast(rheology); - mu = plasticity.newMu().boundaryField()[patch().index()]; - lambda = plasticity.newLambda().boundaryField()[patch().index()]; + mu = plasticity.newMu().boundaryField()[patch().index()]; + lambda = plasticity.newLambda().boundaryField()[patch().index()]; } @@ -230,10 +230,10 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() { tensorField F = I + gradField; tensorField Finv = inv(F); - scalarField J = det(F); + scalarField J = det(F); vectorField nCurrent = Finv & n; nCurrent /= mag(nCurrent); - this->valueFraction() = sqr(nCurrent); + this->valueFraction() = sqr(nCurrent); } //---------------------------// @@ -245,11 +245,11 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() //- incremental solvers if(fieldName_ == "DU") { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); - //- increment of traction - Traction = -(n & sigma); + //- increment of traction + Traction = -(n & sigma); } //---------------------------// @@ -267,35 +267,35 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() refCast(rheology); newGradient += - 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); + 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); } //- if there are thermal effects if(this->db().objectRegistry::foundObject("thermalProperties")) { - const thermalModel& thermo = - this->db().objectRegistry::lookupObject("thermalProperties"); + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); - const fvPatchField& T = - patch().lookupPatchField("T"); + const fvPatchField& T = + patch().lookupPatchField("T"); - const scalarField threeKalpha = - (3*lambda + 2*mu)* - thermo.alpha()().boundaryField()[patch().index()]; + const scalarField threeKalpha = + (3*lambda + 2*mu)* + thermo.alpha()().boundaryField()[patch().index()]; - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - newGradient += (n*threeKalpha*(T - T0)); + newGradient += (n*threeKalpha*(T - T0)); } //- higher order non-linear terms if(nonLinear_ == UPDATED_LAGRANGIAN || nonLinear_ == TOTAL_LAGRANGIAN) { - newGradient -= - (n & (mu*(gradField & gradField.T()))) - + 0.5*n*lambda*(gradField && gradField); - //- tensorial identity - //- tr(gradField & gradField.T())*I == (gradField && gradField)*I + newGradient -= + (n & (mu*(gradField & gradField.T()))) + + 0.5*n*lambda*(gradField && gradField); + //- tensorial identity + //- tr(gradField & gradField.T())*I == (gradField && gradField)*I } newGradient /= (2.0*mu + lambda); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H index 2d4c9bb0a..5297378c5 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H @@ -65,11 +65,11 @@ class fixedDisplacementZeroShearFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; static const NamedEnum nonLinearNames_; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C index eafab70e2..122cdf07e 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C @@ -97,8 +97,8 @@ fixedRotationFvPatchVectorField::fixedRotationFvPatchVectorField ) { Warning << "The gradScheme for " << fieldName_ - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } } @@ -169,8 +169,8 @@ void fixedRotationFvPatchVectorField::updateCoeffs() //- create rotation matrix // tensor rotMat(::cos(theta), -(::sin(theta)), 0, - // ::sin(theta), ::cos(theta), 0, - // 0, 0, 1); + // ::sin(theta), ::cos(theta), 0, + // 0, 0, 1); tensor rotMat = RodriguesRotation(rotationAxis_, rotationAngle_); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C index d9d1ba530..33d9fedba 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C @@ -74,23 +74,23 @@ solidTractionFvPatchVectorField gradient() = vector::zero; Info << "Patch " << patch().name() - << "\tTraction boundary field: " << fieldName_ << endl; + << "\tTraction boundary field: " << fieldName_ << endl; //- check if traction boundary is for non linear solver if (dict.found("nonLinear")) { - nonLinear_ = nonLinearNames_.read(dict.lookup("nonLinear")); + nonLinear_ = nonLinearNames_.read(dict.lookup("nonLinear")); - if (nonLinear_ == UPDATED_LAGRANGIAN) - { - Info << "\tnonLinear set to updated Lagrangian" - << endl; - } - else if (nonLinear_ == TOTAL_LAGRANGIAN) - { - Info << "\tnonLinear set to total Lagrangian" - << endl; - } + if (nonLinear_ == UPDATED_LAGRANGIAN) + { + Info << "\tnonLinear set to updated Lagrangian" + << endl; + } + else if (nonLinear_ == TOTAL_LAGRANGIAN) + { + Info << "\tnonLinear set to total Lagrangian" + << endl; + } } //- the leastSquares has zero non-orthogonal correction @@ -107,9 +107,9 @@ solidTractionFvPatchVectorField ) != "extendedLeastSquares" ) { - Warning << "The gradScheme for " << fieldName_ - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + Warning << "The gradScheme for " << fieldName_ + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } } @@ -213,8 +213,8 @@ void solidTractionFvPatchVectorField::updateCoeffs() const plasticityModel& plasticity = refCast(rheology); - mu = plasticity.newMu().boundaryField()[patch().index()]; - lambda = plasticity.newLambda().boundaryField()[patch().index()]; + mu = plasticity.newMu().boundaryField()[patch().index()]; + lambda = plasticity.newLambda().boundaryField()[patch().index()]; } @@ -235,55 +235,55 @@ void solidTractionFvPatchVectorField::updateCoeffs() //- total Lagrangian small strain if(fieldName_ == "U" && nonLinear_ == OFF) - { - //- total traction - Traction = (traction_ - n*pressure_); - } + { + //- total traction + Traction = (traction_ - n*pressure_); + } //- incremental total Lagrangian small strain else if(fieldName_ == "DU" && nonLinear_ == OFF) //- incremental small strain - { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); + { + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); - //- increment of traction - Traction = (traction_ - n*pressure_) - (n & sigma); - } + //- increment of traction + Traction = (traction_ - n*pressure_) - (n & sigma); + } //- updated Lagrangian or total Lagrangian large strain else if (nonLinear_ == UPDATED_LAGRANGIAN || nonLinear_ == TOTAL_LAGRANGIAN) - { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); + { + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); - tensorField F = I + gradField; - tensorField Finv = inv(F); - scalarField J = det(F); - vectorField nCurrent = Finv & n; - nCurrent /= mag(nCurrent); - vectorField tractionCauchy = traction_ - nCurrent*pressure_; + tensorField F = I + gradField; + tensorField Finv = inv(F); + scalarField J = det(F); + vectorField nCurrent = Finv & n; + nCurrent /= mag(nCurrent); + vectorField tractionCauchy = traction_ - nCurrent*pressure_; - if(nonLinear_ == UPDATED_LAGRANGIAN) - { - //- increment of 2nd Piola-Kirchhoff traction - Traction = (mag(J * Finv & n) * tractionCauchy & Finv) - (n & sigma); - } - else if(nonLinear_ == TOTAL_LAGRANGIAN) - { - //- total 2nd Piola-Kirchhoff traction - Traction = mag(J * Finv & n) * tractionCauchy & Finv; - } - } + if(nonLinear_ == UPDATED_LAGRANGIAN) + { + //- increment of 2nd Piola-Kirchhoff traction + Traction = (mag(J * Finv & n) * tractionCauchy & Finv) - (n & sigma); + } + else if(nonLinear_ == TOTAL_LAGRANGIAN) + { + //- total 2nd Piola-Kirchhoff traction + Traction = mag(J * Finv & n) * tractionCauchy & Finv; + } + } else - { - FatalError << "Field " << fieldName_ << " and " << nonLinear_ << " nonLinear are not compatible!" - << exit(FatalError); - } + { + FatalError << "Field " << fieldName_ << " and " << nonLinear_ << " nonLinear are not compatible!" + << exit(FatalError); + } //---------------------------// //- calculate the normal gradient based on the traction //---------------------------// vectorField newGradient = - Traction + Traction - (n & (mu*gradField.T() - (mu + lambda)*gradField)) - n*lambda*tr(gradField); @@ -294,35 +294,35 @@ void solidTractionFvPatchVectorField::updateCoeffs() refCast(rheology); newGradient += - 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); + 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); } //- if there are thermal effects if(this->db().objectRegistry::foundObject("thermalProperties")) - { - const thermalModel& thermo = - this->db().objectRegistry::lookupObject("thermalProperties"); + { + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); - const fvPatchField& T = - patch().lookupPatchField("T"); + const fvPatchField& T = + patch().lookupPatchField("T"); - const fvPatchField& threeKalpha = - patch().lookupPatchField("((threeK*rho)*alpha)"); + const fvPatchField& threeKalpha = + patch().lookupPatchField("((threeK*rho)*alpha)"); - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - newGradient += (n*threeKalpha*(T - T0)); + newGradient += (n*threeKalpha*(T - T0)); } //- higher order non-linear terms if(nonLinear_ == UPDATED_LAGRANGIAN || nonLinear_ == TOTAL_LAGRANGIAN) - { - newGradient -= - (n & (mu*(gradField & gradField.T()))) - + 0.5*n*lambda*(gradField && gradField); - //- tensorial identity - //- tr(gradField & gradField.T())*I == (gradField && gradField)*I - } + { + newGradient -= + (n & (mu*(gradField & gradField.T()))) + + 0.5*n*lambda*(gradField && gradField); + //- tensorial identity + //- tr(gradField & gradField.T())*I == (gradField && gradField)*I + } newGradient /= (2.0*mu + lambda); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H index 4d121d9e6..f327d4ee0 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H @@ -74,11 +74,11 @@ class solidTractionFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; static const NamedEnum nonLinearNames_; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C index 88e66f5d1..ce79bd83e 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C @@ -70,24 +70,24 @@ solidTractionFreeFvPatchVectorField gradient() = vector::zero; Info << "Patch " << patch().name() - << "\tTraction boundary field: " << fieldName_ << endl; + << "\tTraction boundary field: " << fieldName_ << endl; //- check if traction boundary is for non linear solver if(dict.found("nonLinear")) - { - nonLinear_ = nonLinearNames_.read(dict.lookup("nonLinear"));; + { + nonLinear_ = nonLinearNames_.read(dict.lookup("nonLinear"));; - if(nonLinear_ == UPDATED_LAGRANGIAN) - { - Info << "\tnonLinear set to updated Lagrangian" - << endl; - } - else if(nonLinear_ == TOTAL_LAGRANGIAN) - { - Info << "\tnonLinear set to total Lagrangian" - << endl; - } - } + if(nonLinear_ == UPDATED_LAGRANGIAN) + { + Info << "\tnonLinear set to updated Lagrangian" + << endl; + } + else if(nonLinear_ == TOTAL_LAGRANGIAN) + { + Info << "\tnonLinear set to total Lagrangian" + << endl; + } + } //- the leastSquares has zero non-orthogonal correction //- on the boundary @@ -103,9 +103,9 @@ solidTractionFreeFvPatchVectorField ) != "extendedLeastSquares" ) { - Warning << "The gradScheme for " << fieldName_ - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + Warning << "The gradScheme for " << fieldName_ + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } } @@ -195,8 +195,8 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() const plasticityModel& plasticity = refCast(rheology); - mu = plasticity.newMu().boundaryField()[patch().index()]; - lambda = plasticity.newLambda().boundaryField()[patch().index()]; + mu = plasticity.newMu().boundaryField()[patch().index()]; + lambda = plasticity.newLambda().boundaryField()[patch().index()]; } @@ -217,13 +217,13 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() //- incremental solvers if(fieldName_ == "DU") - { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); + { + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); - //- increment of traction - Traction = - (n & sigma); - } + //- increment of traction + Traction = - (n & sigma); + } //---------------------------// @@ -241,35 +241,35 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() refCast(rheology); newGradient += - 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); + 2*mu*(n & plasticity.DEpsilonP().boundaryField()[patch().index()]); } //- if there are thermal effects if(this->db().objectRegistry::foundObject("thermalProperties")) - { - const thermalModel& thermo = - this->db().objectRegistry::lookupObject("thermalProperties"); + { + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); - const fvPatchField& T = - patch().lookupPatchField("T"); + const fvPatchField& T = + patch().lookupPatchField("T"); const fvPatchField& threeKalpha = - patch().lookupPatchField("((threeK*rho)*alpha)"); + patch().lookupPatchField("((threeK*rho)*alpha)"); - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - newGradient += (n*threeKalpha*(T - T0)); + newGradient += (n*threeKalpha*(T - T0)); } //- higher order non-linear terms if(nonLinear_ == UPDATED_LAGRANGIAN || nonLinear_ == TOTAL_LAGRANGIAN) - { - newGradient -= - (n & (mu*(gradField & gradField.T()))) - + 0.5*n*lambda*(gradField && gradField); - //- tensorial identity - //- tr(gradField & gradField.T())*I == (gradField && gradField)*I - } + { + newGradient -= + (n & (mu*(gradField & gradField.T()))) + + 0.5*n*lambda*(gradField && gradField); + //- tensorial identity + //- tr(gradField & gradField.T())*I == (gradField && gradField)*I + } newGradient /= (2.0*mu + lambda); @@ -317,11 +317,11 @@ void solidTractionFreeFvPatchVectorField::write(Ostream& os) const template<> const char* Foam::NamedEnum::names[] = - { +{ "off", "updatedLagrangian", "totalLagrangian" - }; +}; const Foam::NamedEnum Foam::solidTractionFreeFvPatchVectorField::nonLinearNames_; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H index 2f0ec8983..d65150880 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H @@ -68,11 +68,11 @@ class solidTractionFreeFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; static const NamedEnum nonLinearNames_; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.C index 38046834b..e29209fc8 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.C @@ -79,9 +79,9 @@ timeSeries_(dict) ) != "extendedLeastSquares" ) { - Warning << "The gradScheme for " << fieldName() - << " should be \"extendedLeastSquares 0\" for the boundary " - << "non-orthogonal correction to be right" << endl; + Warning << "The gradScheme for " << fieldName() + << " should be \"extendedLeastSquares 0\" for the boundary " + << "non-orthogonal correction to be right" << endl; } } diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.H index c238afd7d..670368eba 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/timeVaryingSolidTraction/timeVaryingSolidTractionFvPatchVectorField.H @@ -37,8 +37,8 @@ Description inlet { type timeVaryingSolidTraction; - field U; // or DU - nonLinear no; + field U; // or DU + nonLinear no; fileName "$FOAM_CASE/time-series"; outOfBounds clamp; // (error|warn|clamp|repeat) } diff --git a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C index e6b922a2b..936a49141 100644 --- a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C +++ b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C @@ -38,8 +38,8 @@ defineTypeNameAndDebug(leastSquaresVolPointInterpolation, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - void leastSquaresVolPointInterpolation::calcA(List& A) const - { +void leastSquaresVolPointInterpolation::calcA(List& A) const +{ //Info << "leastSquaresVolPointInterpolation calcA" << endl; const fvMesh& mesh = mesh_; @@ -50,141 +50,141 @@ defineTypeNameAndDebug(leastSquaresVolPointInterpolation, 0); //- populate A matrix forAll(points, pointi) - { - const labelList& pointCells = mesh.pointCells()[pointi]; + { + const labelList& pointCells = mesh.pointCells()[pointi]; - //- this component of matrix does not depend on coordinates - A[pointi][3][3] = pointCells.size(); + //- this component of matrix does not depend on coordinates + A[pointi][3][3] = pointCells.size(); - //- fill the A matrices - forAll(pointCells, pointCelli) - { - const label& celli = pointCells[pointCelli]; + //- fill the A matrices + forAll(pointCells, pointCelli) + { + const label& celli = pointCells[pointCelli]; - const scalar& x = mesh.C()[celli].component(vector::X); - const scalar& y = mesh.C()[celli].component(vector::Y); - const scalar& z = mesh.C()[celli].component(vector::Z); + const scalar& x = mesh.C()[celli].component(vector::X); + const scalar& y = mesh.C()[celli].component(vector::Y); + const scalar& z = mesh.C()[celli].component(vector::Z); - A[pointi][0][0] += x*x; - A[pointi][0][1] += x*y; - A[pointi][0][2] += x*z; - A[pointi][0][3] += x; + A[pointi][0][0] += x*x; + A[pointi][0][1] += x*y; + A[pointi][0][2] += x*z; + A[pointi][0][3] += x; - A[pointi][1][0] += x*y; - A[pointi][1][1] += y*y; - A[pointi][1][2] += y*z; - A[pointi][1][3] += y; + A[pointi][1][0] += x*y; + A[pointi][1][1] += y*y; + A[pointi][1][2] += y*z; + A[pointi][1][3] += y; - A[pointi][2][0] += x*z; - A[pointi][2][1] += y*z; - A[pointi][2][2] += z*z; - A[pointi][2][3] += z; + A[pointi][2][0] += x*z; + A[pointi][2][1] += y*z; + A[pointi][2][2] += z*z; + A[pointi][2][3] += z; - A[pointi][3][0] += x; - A[pointi][3][1] += y; - A[pointi][3][2] += z; - //A[pointi][3][3] = pointCells.size(); // set above - } - } + A[pointi][3][0] += x; + A[pointi][3][1] += y; + A[pointi][3][2] += z; + //A[pointi][3][3] = pointCells.size(); // set above + } + } //- for boundary points we will include the surrounding face centres forAll(mesh.boundary(), patchi) - { - const vectorField& faceCentres = mesh.boundaryMesh()[patchi].faceCentres(); - const labelListList& pointFaces = mesh.boundaryMesh()[patchi].pointFaces(); + { + const vectorField& faceCentres = mesh.boundaryMesh()[patchi].faceCentres(); + const labelListList& pointFaces = mesh.boundaryMesh()[patchi].pointFaces(); - if(mesh.boundary()[patchi].coupled()) //- for proc boundaries - { - //- for coupled patches we will use the values at the neighbourField cell centres and we will - //- not use the boundary face values - //- neighbour cell centre are equal to the faceCell centres plus the delta vector - vectorField pDelta = mesh.boundary()[patchi].delta(); - vectorField faceCellC(faceCentres.size(), vector::zero); - forAll(faceCentres, facei) - { - label celli = mesh.boundaryMesh()[patchi].faceCells()[facei]; - faceCellC[facei] = mesh.C()[celli]; - } - vectorField neiCellC = faceCellC + pDelta; + if(mesh.boundary()[patchi].coupled()) //- for proc boundaries + { + //- for coupled patches we will use the values at the neighbourField cell centres and we will + //- not use the boundary face values + //- neighbour cell centre are equal to the faceCell centres plus the delta vector + vectorField pDelta = mesh.boundary()[patchi].delta(); + vectorField faceCellC(faceCentres.size(), vector::zero); + forAll(faceCentres, facei) + { + label celli = mesh.boundaryMesh()[patchi].faceCells()[facei]; + faceCellC[facei] = mesh.C()[celli]; + } + vectorField neiCellC = faceCellC + pDelta; - forAll(pointFaces, pointi) - { - forAll(pointFaces[pointi], pointFacei) - { - label neiCelli = pointFaces[pointi][pointFacei]; - const scalar& x = neiCellC[neiCelli].component(vector::X); - const scalar& y = neiCellC[neiCelli].component(vector::Y); - const scalar& z = neiCellC[neiCelli].component(vector::Z); + forAll(pointFaces, pointi) + { + forAll(pointFaces[pointi], pointFacei) + { + label neiCelli = pointFaces[pointi][pointFacei]; + const scalar& x = neiCellC[neiCelli].component(vector::X); + const scalar& y = neiCellC[neiCelli].component(vector::Y); + const scalar& z = neiCellC[neiCelli].component(vector::Z); - label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; + label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; - A[globalPointi][0][0] += x*x; - A[globalPointi][0][1] += x*y; - A[globalPointi][0][2] += x*z; - A[globalPointi][0][3] += x; + A[globalPointi][0][0] += x*x; + A[globalPointi][0][1] += x*y; + A[globalPointi][0][2] += x*z; + A[globalPointi][0][3] += x; - A[globalPointi][1][0] += x*y; - A[globalPointi][1][1] += y*y; - A[globalPointi][1][2] += y*z; - A[globalPointi][1][3] += y; + A[globalPointi][1][0] += x*y; + A[globalPointi][1][1] += y*y; + A[globalPointi][1][2] += y*z; + A[globalPointi][1][3] += y; - A[globalPointi][2][0] += x*z; - A[globalPointi][2][1] += y*z; - A[globalPointi][2][2] += z*z; - A[globalPointi][2][3] += z; + A[globalPointi][2][0] += x*z; + A[globalPointi][2][1] += y*z; + A[globalPointi][2][2] += z*z; + A[globalPointi][2][3] += z; - A[globalPointi][3][0] += x; - A[globalPointi][3][1] += y; - A[globalPointi][3][2] += z; - A[globalPointi][3][3] += 1; // = pointCells.size(); - } - } - } - else - { - //- each point must use at least 4 neighbouring locations otherwise A is singular - //- and simpleMatrix will cannot invert it - //- therefore empty patches values are included to make sure A is not singular - forAll(pointFaces, pointi) - { - label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; + A[globalPointi][3][0] += x; + A[globalPointi][3][1] += y; + A[globalPointi][3][2] += z; + A[globalPointi][3][3] += 1; // = pointCells.size(); + } + } + } + else + { + //- each point must use at least 4 neighbouring locations otherwise A is singular + //- and simpleMatrix will cannot invert it + //- therefore empty patches values are included to make sure A is not singular + forAll(pointFaces, pointi) + { + label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; - forAll(pointFaces[pointi], pointFacei) - { - //- fix: use pointFace not face philipc - label facei = pointFaces[pointi][pointFacei]; - const scalar& x = faceCentres[facei].component(vector::X); - const scalar& y = faceCentres[facei].component(vector::Y); - const scalar& z = faceCentres[facei].component(vector::Z); + forAll(pointFaces[pointi], pointFacei) + { + //- fix: use pointFace not face philipc + label facei = pointFaces[pointi][pointFacei]; + const scalar& x = faceCentres[facei].component(vector::X); + const scalar& y = faceCentres[facei].component(vector::Y); + const scalar& z = faceCentres[facei].component(vector::Z); - A[globalPointi][0][0] += x*x; - A[globalPointi][0][1] += x*y; - A[globalPointi][0][2] += x*z; - A[globalPointi][0][3] += x; + A[globalPointi][0][0] += x*x; + A[globalPointi][0][1] += x*y; + A[globalPointi][0][2] += x*z; + A[globalPointi][0][3] += x; - A[globalPointi][1][0] += x*y; - A[globalPointi][1][1] += y*y; - A[globalPointi][1][2] += y*z; - A[globalPointi][1][3] += y; + A[globalPointi][1][0] += x*y; + A[globalPointi][1][1] += y*y; + A[globalPointi][1][2] += y*z; + A[globalPointi][1][3] += y; - A[globalPointi][2][0] += x*z; - A[globalPointi][2][1] += y*z; - A[globalPointi][2][2] += z*z; - A[globalPointi][2][3] += z; + A[globalPointi][2][0] += x*z; + A[globalPointi][2][1] += y*z; + A[globalPointi][2][2] += z*z; + A[globalPointi][2][3] += z; - A[globalPointi][3][0] += x; - A[globalPointi][3][1] += y; - A[globalPointi][3][2] += z; - A[globalPointi][3][3] += 1; // = pointCells.size(); - } - } - } //- end of else - } //- end of forAll boundary - } + A[globalPointi][3][0] += x; + A[globalPointi][3][1] += y; + A[globalPointi][3][2] += z; + A[globalPointi][3][3] += 1; // = pointCells.size(); + } + } + } //- end of else + } //- end of forAll boundary +} - void leastSquaresVolPointInterpolation::calcB(List >& B, const GeometricField& vf) const - { +void leastSquaresVolPointInterpolation::calcB(List >& B, const GeometricField& vf) const +{ //Info << "leastSquaresVolPointInterpolation calcB" << endl; const fvMesh& mesh = mesh_; @@ -193,120 +193,120 @@ defineTypeNameAndDebug(leastSquaresVolPointInterpolation, 0); //List >& B = B_; for (direction compi = 0; compi < 3; compi++) - { - forAll(points, pointi) - { - const labelList& pointCells = mesh.pointCells()[pointi]; + { + forAll(points, pointi) + { + const labelList& pointCells = mesh.pointCells()[pointi]; - forAll(pointCells, pointCelli) - { - const label& celli = pointCells[pointCelli]; + forAll(pointCells, pointCelli) + { + const label& celli = pointCells[pointCelli]; - const scalar& x = mesh.C()[celli].component(vector::X); - const scalar& y = mesh.C()[celli].component(vector::Y); - const scalar& z = mesh.C()[celli].component(vector::Z); + const scalar& x = mesh.C()[celli].component(vector::X); + const scalar& y = mesh.C()[celli].component(vector::Y); + const scalar& z = mesh.C()[celli].component(vector::Z); - const scalar& phiCompi = vf.internalField()[celli].component(compi); + const scalar& phiCompi = vf.internalField()[celli].component(compi); - B[pointi][0].component(compi) += phiCompi*x; - B[pointi][1].component(compi) += phiCompi*y; - B[pointi][2].component(compi) += phiCompi*z; - B[pointi][3].component(compi) += phiCompi; - } - } + B[pointi][0].component(compi) += phiCompi*x; + B[pointi][1].component(compi) += phiCompi*y; + B[pointi][2].component(compi) += phiCompi*z; + B[pointi][3].component(compi) += phiCompi; + } + } - //- for boundary points we will include the surrounding face centres - forAll(mesh.boundary(), patchi) - { - const vectorField& faceCentres = mesh.boundaryMesh()[patchi].faceCentres(); - const labelListList& pointFaces = mesh.boundaryMesh()[patchi].pointFaces(); - const labelList& faceCells = mesh.boundaryMesh()[patchi].faceCells(); + //- for boundary points we will include the surrounding face centres + forAll(mesh.boundary(), patchi) + { + const vectorField& faceCentres = mesh.boundaryMesh()[patchi].faceCentres(); + const labelListList& pointFaces = mesh.boundaryMesh()[patchi].pointFaces(); + const labelList& faceCells = mesh.boundaryMesh()[patchi].faceCells(); - //- fix: do not calculate B for empty patches - philipc - if(mesh.boundary()[patchi].coupled()) - { - //- for coupled patches we will use the values at the neighbourField cell centres and we will - //- not use the boundary face values - //- neighbour cell centre are equal to the faceCell centres plus the delta vector - vectorField pDelta = mesh.boundary()[patchi].delta(); - vectorField faceCellC(faceCentres.size(), vector::zero); - forAll(faceCentres, facei) - { - label celli = mesh.boundaryMesh()[patchi].faceCells()[facei]; - faceCellC[facei] = mesh.C()[celli]; - } - vectorField neiCellC = faceCellC + pDelta; + //- fix: do not calculate B for empty patches - philipc + if(mesh.boundary()[patchi].coupled()) + { + //- for coupled patches we will use the values at the neighbourField cell centres and we will + //- not use the boundary face values + //- neighbour cell centre are equal to the faceCell centres plus the delta vector + vectorField pDelta = mesh.boundary()[patchi].delta(); + vectorField faceCellC(faceCentres.size(), vector::zero); + forAll(faceCentres, facei) + { + label celli = mesh.boundaryMesh()[patchi].faceCells()[facei]; + faceCellC[facei] = mesh.C()[celli]; + } + vectorField neiCellC = faceCellC + pDelta; - vectorField phiNeiField = vf.boundaryField()[patchi].patchNeighbourField(); + vectorField phiNeiField = vf.boundaryField()[patchi].patchNeighbourField(); - forAll(pointFaces, pointi) - { - forAll(pointFaces[pointi], pointFacei) - { - label neiCelli = pointFaces[pointi][pointFacei]; - const scalar& x = neiCellC[neiCelli].component(vector::X); - const scalar& y = neiCellC[neiCelli].component(vector::Y); - const scalar& z = neiCellC[neiCelli].component(vector::Z); + forAll(pointFaces, pointi) + { + forAll(pointFaces[pointi], pointFacei) + { + label neiCelli = pointFaces[pointi][pointFacei]; + const scalar& x = neiCellC[neiCelli].component(vector::X); + const scalar& y = neiCellC[neiCelli].component(vector::Y); + const scalar& z = neiCellC[neiCelli].component(vector::Z); - label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; + label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; - //- this is the value of phi at the cell centre in the neighbour (i.e. across the interface) - scalar phiCompi = phiNeiField[neiCelli].component(compi); + //- this is the value of phi at the cell centre in the neighbour (i.e. across the interface) + scalar phiCompi = phiNeiField[neiCelli].component(compi); - B[globalPointi][0].component(compi) += phiCompi*x; - B[globalPointi][1].component(compi) += phiCompi*y; - B[globalPointi][2].component(compi) += phiCompi*z; - B[globalPointi][3].component(compi) += phiCompi; - } - } - } - else - { - //- each point must use at least 4 neighbouring locations otherwise A is singular - //- and simpleMatrix will cannot invert it - //- therefore empty patches values are included to make sure A is not singular - forAll(pointFaces, pointi) - { - forAll(pointFaces[pointi], pointFacei) - { - //- fix: use pointFace not face philipc - label facei = pointFaces[pointi][pointFacei]; - const scalar& x = faceCentres[facei].component(vector::X); - const scalar& y = faceCentres[facei].component(vector::Y); - const scalar& z = faceCentres[facei].component(vector::Z); + B[globalPointi][0].component(compi) += phiCompi*x; + B[globalPointi][1].component(compi) += phiCompi*y; + B[globalPointi][2].component(compi) += phiCompi*z; + B[globalPointi][3].component(compi) += phiCompi; + } + } + } + else + { + //- each point must use at least 4 neighbouring locations otherwise A is singular + //- and simpleMatrix will cannot invert it + //- therefore empty patches values are included to make sure A is not singular + forAll(pointFaces, pointi) + { + forAll(pointFaces[pointi], pointFacei) + { + //- fix: use pointFace not face philipc + label facei = pointFaces[pointi][pointFacei]; + const scalar& x = faceCentres[facei].component(vector::X); + const scalar& y = faceCentres[facei].component(vector::Y); + const scalar& z = faceCentres[facei].component(vector::Z); - label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; + label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; - scalar phiCompi = 0.0; - if(mesh.boundary()[patchi].type() == "empty") - { - //- use faceCell value for empty because empty patches do not store any values - const label& ci = faceCells[facei]; - phiCompi = vf.internalField()[ci].component(compi); - } - else - { - phiCompi = vf.boundaryField()[patchi][facei].component(compi); - } + scalar phiCompi = 0.0; + if(mesh.boundary()[patchi].type() == "empty") + { + //- use faceCell value for empty because empty patches do not store any values + const label& ci = faceCells[facei]; + phiCompi = vf.internalField()[ci].component(compi); + } + else + { + phiCompi = vf.boundaryField()[patchi][facei].component(compi); + } - B[globalPointi][0].component(compi) += phiCompi*x; - B[globalPointi][1].component(compi) += phiCompi*y; - B[globalPointi][2].component(compi) += phiCompi*z; - B[globalPointi][3].component(compi) += phiCompi; - } - } - } - } //- end of forAll boundary - } //- end of for all components - } + B[globalPointi][0].component(compi) += phiCompi*x; + B[globalPointi][1].component(compi) += phiCompi*y; + B[globalPointi][2].component(compi) += phiCompi*z; + B[globalPointi][3].component(compi) += phiCompi; + } + } + } + } //- end of forAll boundary + } //- end of for all components +} - void leastSquaresVolPointInterpolation::interpolate - ( - const GeometricField& vf, - GeometricField& pf //Field& pf - ) const - { +void leastSquaresVolPointInterpolation::interpolate +( + const GeometricField& vf, + GeometricField& pf //Field& pf +) const +{ //Info << "Interpolating cell to point using leastSquaresVolPointInterpolation" << endl; const fvMesh& mesh = mesh_; @@ -314,9 +314,9 @@ defineTypeNameAndDebug(leastSquaresVolPointInterpolation, 0); //- first check that point field is the correct size if(pf.size() != points.size()) - { - FatalError << "pointfield should be equal to the number of points in the fvMesh" << endl; - } + { + FatalError << "pointfield should be equal to the number of points in the fvMesh" << endl; + } //- calculate A and B vector // List >& B = B_; @@ -330,50 +330,50 @@ defineTypeNameAndDebug(leastSquaresVolPointInterpolation, 0); //- solve equations for each component of each point forAll(points, pointi) - { - Field& source = B[pointi]; - simpleMatrix leastSquaresMatrix(A[pointi], source); + { + Field& source = B[pointi]; + simpleMatrix leastSquaresMatrix(A[pointi], source); - //- solve using Gauss elimination or LU decomposition with pivoting - //Field leastSquaresSol = leastSquaresMatrix.solve(); - Field leastSquaresSol = leastSquaresMatrix.LUsolve(); + //- solve using Gauss elimination or LU decomposition with pivoting + //Field leastSquaresSol = leastSquaresMatrix.solve(); + Field leastSquaresSol = leastSquaresMatrix.LUsolve(); - const scalar& x = mesh.points()[pointi].component(vector::X); - const scalar& y = mesh.points()[pointi].component(vector::Y); - const scalar& z = mesh.points()[pointi].component(vector::Z); + const scalar& x = mesh.points()[pointi].component(vector::X); + const scalar& y = mesh.points()[pointi].component(vector::Y); + const scalar& z = mesh.points()[pointi].component(vector::Z); - //- calculate phi at vertex - for (direction compi = 0; compi < 3; compi++) - { - const scalar& a = leastSquaresSol[0].component(compi); - const scalar& b = leastSquaresSol[1].component(compi); - const scalar& c = leastSquaresSol[2].component(compi); - const scalar& d = leastSquaresSol[3].component(compi); + //- calculate phi at vertex + for (direction compi = 0; compi < 3; compi++) + { + const scalar& a = leastSquaresSol[0].component(compi); + const scalar& b = leastSquaresSol[1].component(compi); + const scalar& c = leastSquaresSol[2].component(compi); + const scalar& d = leastSquaresSol[3].component(compi); - pf[pointi].component(compi) = a*x + b*y + c*z + d; - } - } + pf[pointi].component(compi) = a*x + b*y + c*z + d; + } + } //- proc patches are synchronised pf.correctBoundaryConditions(); - } + } // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // - leastSquaresVolPointInterpolation::leastSquaresVolPointInterpolation(const fvMesh& vm) - : +leastSquaresVolPointInterpolation::leastSquaresVolPointInterpolation(const fvMesh& vm) +: mesh_(vm) //, //A_(vm.points().size(), scalarSquareMatrix(4, 0.0)), //B_(vm.points().size(), Field(4, vector::zero)) - { +{ //calcA(); - } +} // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // - leastSquaresVolPointInterpolation::~leastSquaresVolPointInterpolation() - {} +leastSquaresVolPointInterpolation::~leastSquaresVolPointInterpolation() +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.H b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.H index f2dc583c9..cf4d9aa72 100644 --- a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.H +++ b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.H @@ -118,7 +118,7 @@ public: void interpolate ( const GeometricField& vf, - GeometricField& pf + GeometricField& pf ) const; }; diff --git a/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.C b/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.C index 600a3c9df..c28c431d2 100644 --- a/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.C +++ b/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.C @@ -61,7 +61,7 @@ plasticityModel::plasticityModel ), sigma.mesh(), dimensionedScalar("0", dimless, 0) - ), + ), sigmaY_ ( IOobject @@ -237,7 +237,7 @@ void plasticityModel::correct() scalar B = 3.0*(dev(oldSigmaI[cellI]) && dev(DSigmaEI[cellI])); scalar A = sqr(DSigmaEqEI[cellI]); - scalar alpha = (-B + ::sqrt(mag(B*B - 4*A*C)))/(2*A + SMALL); + scalar alpha = (-B + ::sqrt(mag(B*B - 4*A*C)))/(2*A + SMALL); // scalar alpha = (-B + ::sqrt((B*B - 4*A*C)))/(2*A + SMALL); curDEpsEPred = alpha/(2.0*muI[cellI] + SMALL) @@ -250,7 +250,7 @@ void plasticityModel::correct() betaI[cellI] = 1.0 - (devSigmaI[cellI] && curDEpsEPred) - /((devSigmaI[cellI] && DEpsilonI[cellI]) + SMALL); + /((devSigmaI[cellI] && DEpsilonI[cellI]) + SMALL); } } @@ -263,99 +263,98 @@ void plasticityModel::correct() forAll(beta_.boundaryField(), patchI) { if (!beta_.boundaryField()[patchI].coupled()) - { - const scalarField& muPatch = mu_.boundaryField()[patchI]; - const scalarField& lambdaPatch = lambda_.boundaryField()[patchI]; - - const scalarField& sigmaYPatch = sigmaY_.boundaryField()[patchI]; - - const symmTensorField& DEpsilonPatch = - DEpsilon.boundaryField()[patchI]; - - const scalarField DEpsilonEqPatch = - DEpsilonEq.boundaryField()[patchI]; - - const symmTensorField& oldSigmaPatch = - oldSigma.boundaryField()[patchI]; - - const scalarField& oldSigmaEqPatch = - oldSigmaEq.boundaryField()[patchI]; - - const symmTensorField& devSigmaPatch = - devSigma.boundaryField()[patchI]; - - const symmTensorField& DSigmaEPatch = DSigmaE.boundaryField()[patchI]; - - const scalarField& sigmaEqEPatch = sigmaEqE.boundaryField()[patchI]; - - const scalarField& DSigmaEqEPatch = DSigmaEqE.boundaryField()[patchI]; - - const scalarField& oldBetaPatch = - beta_.oldTime().boundaryField()[patchI]; - - scalarField& betaPatch = beta_.boundaryField()[patchI]; - - forAll(betaPatch, faceI) { - tensor curDEpsEPred = tensor::zero; + const scalarField& muPatch = mu_.boundaryField()[patchI]; + const scalarField& lambdaPatch = lambda_.boundaryField()[patchI]; - if - ( - (DEpsilonEqPatch[faceI] >= 0) - && (oldBetaPatch[faceI] > SMALL) - ) + const scalarField& sigmaYPatch = sigmaY_.boundaryField()[patchI]; + + const symmTensorField& DEpsilonPatch = + DEpsilon.boundaryField()[patchI]; + + const scalarField DEpsilonEqPatch = + DEpsilonEq.boundaryField()[patchI]; + + const symmTensorField& oldSigmaPatch = + oldSigma.boundaryField()[patchI]; + + const scalarField& oldSigmaEqPatch = + oldSigmaEq.boundaryField()[patchI]; + + const symmTensorField& devSigmaPatch = + devSigma.boundaryField()[patchI]; + + const symmTensorField& DSigmaEPatch = DSigmaE.boundaryField()[patchI]; + + const scalarField& sigmaEqEPatch = sigmaEqE.boundaryField()[patchI]; + + const scalarField& DSigmaEqEPatch = DSigmaEqE.boundaryField()[patchI]; + + const scalarField& oldBetaPatch = + beta_.oldTime().boundaryField()[patchI]; + + scalarField& betaPatch = beta_.boundaryField()[patchI]; + + forAll(betaPatch, faceI) { - betaPatch[faceI] = 1; - curDEpsEPred = tensor::zero; - } - else - { - betaPatch[faceI] = 0; - curDEpsEPred = DEpsilonPatch[faceI]; + tensor curDEpsEPred = tensor::zero; if ( (DEpsilonEqPatch[faceI] >= 0) - && (sigmaEqEPatch[faceI] >= sigmaYPatch[faceI]) + && (oldBetaPatch[faceI] > SMALL) ) { - scalar C = - sqr(oldSigmaEqPatch[faceI]) - - sqr(sigmaYPatch[faceI]); - scalar B = - 3.0 - *( - dev(oldSigmaPatch[faceI]) - && dev(DSigmaEPatch[faceI]) - ); - scalar A = sqr(DSigmaEqEPatch[faceI]); - - scalar alpha = (-B + ::sqrt(mag(B*B-4*A*C)))/(2*A + SMALL); - - //scalar alpha = (-B + ::sqrt((B*B-4*A*C)))/(2*A + SMALL); - - curDEpsEPred = - alpha/(2.0*muPatch[faceI] + SMALL) - *( - DSigmaEPatch[faceI] - - ( - lambdaPatch[faceI] - /(2*muPatch[faceI] + 3*lambdaPatch[faceI] + SMALL) - ) - *tr(DSigmaEPatch[faceI])*I - ); - - betaPatch[faceI] = - 1.0 - - (devSigmaPatch[faceI] && curDEpsEPred) - /((devSigmaPatch[faceI] && DEpsilonPatch[faceI]) + SMALL); + betaPatch[faceI] = 1; + curDEpsEPred = tensor::zero; } - } + else + { + betaPatch[faceI] = 0; + curDEpsEPred = DEpsilonPatch[faceI]; + if + ( + (DEpsilonEqPatch[faceI] >= 0) + && (sigmaEqEPatch[faceI] >= sigmaYPatch[faceI]) + ) + { + scalar C = + sqr(oldSigmaEqPatch[faceI]) + - sqr(sigmaYPatch[faceI]); + scalar B = + 3.0 + *( + dev(oldSigmaPatch[faceI]) + && dev(DSigmaEPatch[faceI]) + ); + scalar A = sqr(DSigmaEqEPatch[faceI]); - betaPatch[faceI] = max(betaPatch[faceI], 0.0); - betaPatch[faceI] = min(betaPatch[faceI], 1.0); + scalar alpha = (-B + ::sqrt(mag(B*B-4*A*C)))/(2*A + SMALL); + + //scalar alpha = (-B + ::sqrt((B*B-4*A*C)))/(2*A + SMALL); + + curDEpsEPred = + alpha/(2.0*muPatch[faceI] + SMALL) + *( + DSigmaEPatch[faceI] + - ( + lambdaPatch[faceI] + /(2*muPatch[faceI] + 3*lambdaPatch[faceI] + SMALL) + ) + *tr(DSigmaEPatch[faceI])*I + ); + + betaPatch[faceI] = + 1.0 + - (devSigmaPatch[faceI] && curDEpsEPred) + /((devSigmaPatch[faceI] && DEpsilonPatch[faceI]) + SMALL); + } + } + + betaPatch[faceI] = max(betaPatch[faceI], 0.0); + betaPatch[faceI] = min(betaPatch[faceI], 1.0); + } } - } } // Update plastic strain increment @@ -420,27 +419,27 @@ void plasticityModel::updateYieldStress() forAll(sigmaY_.boundaryField(), patchI) { if (!sigmaY_.boundaryField()[patchI].coupled()) - { - const scalarField& EpPatch = Ep_.boundaryField()[patchI]; - const scalarField& sigmaEqPatch = sigmaEq.boundaryField()[patchI]; - scalarField& sigmaYPatch = sigmaY_.boundaryField()[patchI]; - - forAll(sigmaYPatch, faceI) { - if(EpPatch[faceI] != 0) - { - if(sigmaEqPatch[faceI] > sigmaYPatch[faceI]) - { - sigmaYPatch[faceI] = sigmaEqPatch[faceI]; + const scalarField& EpPatch = Ep_.boundaryField()[patchI]; + const scalarField& sigmaEqPatch = sigmaEq.boundaryField()[patchI]; + scalarField& sigmaYPatch = sigmaY_.boundaryField()[patchI]; - Info << "Boundary cell " << patchI << " " << faceI - << " Yield stress updated to Sy= " - << sigmaEqPatch[faceI] * 1.0E-06 << " MPa" - << endl; + forAll(sigmaYPatch, faceI) + { + if(EpPatch[faceI] != 0) + { + if(sigmaEqPatch[faceI] > sigmaYPatch[faceI]) + { + sigmaYPatch[faceI] = sigmaEqPatch[faceI]; + + Info << "Boundary cell " << patchI << " " << faceI + << " Yield stress updated to Sy= " + << sigmaEqPatch[faceI] * 1.0E-06 << " MPa" + << endl; + } } } } - } } Info << "done" << endl; @@ -448,7 +447,6 @@ void plasticityModel::updateYieldStress() bool plasticityModel::read() { - if (regIOobject::read()) { return true; diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C index a79c5416a..79f806251 100755 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C @@ -143,7 +143,7 @@ E(const volScalarField& epsEq) const // Correction of initial modulus to avoid infinity/GREAT // for small strains and for unloading - // strain of 0.1% might be wrong for some materials + // strain of 0.1% might be wrong for some materials if(epsEqI[cellI] < 0.001) { diff --git a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C index ec189fa6f..e51b79900 100644 --- a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C +++ b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C @@ -426,13 +426,13 @@ void solidInterface::makeIndicator() const if (materials[owner[curFace]] < materials[neighbour[curFace]]) { - curPair.first() = int(materials[owner[curFace]]); - curPair.second() = int(materials[neighbour[curFace]]); + curPair.first() = int(materials[owner[curFace]]); + curPair.second() = int(materials[neighbour[curFace]]); } else { - curPair.second() = int(materials[owner[curFace]]); - curPair.first() = int(materials[neighbour[curFace]]); + curPair.second() = int(materials[owner[curFace]]); + curPair.first() = int(materials[neighbour[curFace]]); } } } diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/constant/timeVsTopDisp index cd78b2dbb..c3131dcd1 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/constant/timeVsTopDisp @@ -1,6 +1,6 @@ ( - (0 (2e-4 -1e-4 0)) - (1 (2e-4 -1e-4 0)) - (1.0001 (2e-4 0 0)) - (100 (2e-4 0 0)) + (0 (2e-4 -1e-4 0)) + (1 (2e-4 -1e-4 0)) + (1.0001 (2e-4 0 0)) + (100 (2e-4 0 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/fvSolution index a41c1092a..6e8822c04 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/fvSolution @@ -24,40 +24,40 @@ FoamFile solvers { - DU - { - solver PCG; - preconditioner DIC; - tolerance 1e-10; - relTol 0.1; - minIter 0; + DU + { + solver PCG; + preconditioner DIC; + tolerance 1e-10; + relTol 0.1; + minIter 0; - /* - solver GAMG; - tolerance 1e-09; - relTol 0.99; - smoother GaussSeidel; - cacheAgglomeration true; - nCellsInCoarsestLevel 63; - agglomerator faceAreaPair; - mergeLevels 1; - */ - } + /* + solver GAMG; + tolerance 1e-09; + relTol 0.99; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 63; + agglomerator faceAreaPair; + mergeLevels 1; + */ + } } stressedFoam { - nCorrectors 10000; - DU 1e-8; + nCorrectors 10000; + DU 1e-8; - divDSigmaExp surface; - solidInterface no; - predictor yes; + divDSigmaExp surface; + solidInterface no; + predictor yes; } relaxationFactors { - DU 0.95; + DU 0.95; } diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/0/DU b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/0/DU index 4f6ac0056..c502da89b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/0/DU +++ b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/0/DU @@ -39,7 +39,7 @@ boundaryField bottomBrickUp { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); @@ -48,7 +48,7 @@ boundaryField topBrickDown { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); @@ -57,7 +57,7 @@ boundaryField bottomBrickLeft { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); @@ -66,7 +66,7 @@ boundaryField bottomBrickRight { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); @@ -74,7 +74,7 @@ boundaryField topBrickLeft { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); @@ -82,7 +82,7 @@ boundaryField topBrickRight { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/constant/timeVsTopDisp index cd78b2dbb..c3131dcd1 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/constant/timeVsTopDisp @@ -1,6 +1,6 @@ ( - (0 (2e-4 -1e-4 0)) - (1 (2e-4 -1e-4 0)) - (1.0001 (2e-4 0 0)) - (100 (2e-4 0 0)) + (0 (2e-4 -1e-4 0)) + (1 (2e-4 -1e-4 0)) + (1.0001 (2e-4 0 0)) + (100 (2e-4 0 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/fvSolution index 2f076e6de..e4a8eddbf 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/fvSolution @@ -24,41 +24,41 @@ FoamFile solvers { - DU - { - solver PCG; - preconditioner DIC; - tolerance 1e-07; - relTol 0.1; - minIter 0; + DU + { + solver PCG; + preconditioner DIC; + tolerance 1e-07; + relTol 0.1; + minIter 0; - /* - solver GAMG; - tolerance 1e-09; - relTol 0.99; - smoother GaussSeidel; - cacheAgglomeration true; - nCellsInCoarsestLevel 63; - agglomerator faceAreaPair; - mergeLevels 1; - */ - } + /* + solver GAMG; + tolerance 1e-09; + relTol 0.99; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 63; + agglomerator faceAreaPair; + mergeLevels 1; + */ + } } stressedFoam { - nCorrectors 10000; - DU 1e-6; + nCorrectors 10000; + DU 1e-6; - moveMeshMethod leastSquares; + moveMeshMethod leastSquares; - divDSigmaExp surface; - divDSigmaLargeStrainExp surface; + divDSigmaExp surface; + divDSigmaLargeStrainExp surface; } relaxationFactors { - DU 0.95; + DU 0.95; } diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/U b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/U index ac6c02d4d..427d54944 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/U +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/U @@ -76,7 +76,7 @@ boundaryField topBrickRight { type solidTraction; - traction uniform ( 0 0 0 ); + traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); } diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/timeVsTopDisp index 1f569f41b..05898a035 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/timeVsTopDisp @@ -1,4 +1,4 @@ ( - (0 (0 -1e-4 0)) - (100 (4e-2 -1e-4 0)) + (0 (0 -1e-4 0)) + (100 (4e-2 -1e-4 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/fvSolution index 050462eae..617afabd1 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/fvSolution @@ -24,40 +24,42 @@ FoamFile solvers { - U - { - solver GAMG; - tolerance 1e-09; - relTol 0.99; - smoother GaussSeidel; - cacheAgglomeration true; - nCellsInCoarsestLevel 63; - agglomerator faceAreaPair; - mergeLevels 1; - } + U + { + solver GAMG; + tolerance 1e-09; + relTol 0.99; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 63; + agglomerator faceAreaPair; + mergeLevels 1; + } -/* U - { - solver PCG; - preconditioner DIC; - tolerance 1e-09; - relTol 0.99; - }*/ +/* + U + { + solver PCG; + preconditioner DIC; + tolerance 1e-09; + relTol 0.99; + } +*/ } stressedFoam { - nCorrectors 7000; - U 1e-8; + nCorrectors 7000; + U 1e-8; - divSigmaExp surface; - predictor yes; + divSigmaExp surface; + predictor yes; } relaxationFactors { - U 0.95; + U 0.95; } diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/fvSolution index 2cac87284..aa3bf4997 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/fvSolution @@ -24,41 +24,41 @@ FoamFile solvers { - U - { - tolerance 1e-09; - relTol 0.1; + U + { + tolerance 1e-09; + relTol 0.1; - //solver PCG; - //preconditioner DIC; + //solver PCG; + //preconditioner DIC; - solver GAMG; - smoother GaussSeidel; - nPreSweeps 0; - nPostSweeps 2; - nFinestSweeps 2; - scaleCorrection true; - directSolveCoarsest false; - cacheAgglomeration true; - nCellsInCoarsestLevel 292; - agglomerator faceAreaPair; - mergeLevels 1; - } + solver GAMG; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + scaleCorrection true; + directSolveCoarsest false; + cacheAgglomeration true; + nCellsInCoarsestLevel 292; + agglomerator faceAreaPair; + mergeLevels 1; + } } stressedFoam { - nCorrectors 10000; - U 1e-8; + nCorrectors 10000; + U 1e-8; - divSigmaExp standard; - solidInterface no; - predictor no; + divSigmaExp standard; + solidInterface no; + predictor no; } relaxationFactors { - U 0.95; + U 0.95; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict index eb4606524..6a32c9fe8 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict @@ -24,9 +24,9 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. +// cell : use cell-centre value only; constant over cells +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict index 6bd1b417f..1b030ac4f 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict @@ -26,14 +26,14 @@ convertToMeters 1; vertices ( -(0 0 0) //0 -(1 0 0) //1 -(1 1 0) //2 -(0 1 0) //3 -(0 0 1) //4 -(1 0 1) //5 -(1 1 1) //6 -(0 1 1) //7 +(0 0 0) //0 +(1 0 0) //1 +(1 1 0) //2 +(0 1 0) //3 +(0 0 1) //4 +(1 0 1) //5 +(1 1 1) //6 +(0 1 1) //7 ); blocks @@ -49,7 +49,7 @@ patches ( patch front ( - ( 4 5 6 7) + ( 4 5 6 7) ) patch back @@ -64,17 +64,17 @@ patches patch bottom ( - (0 1 5 4) + (0 1 5 4) ) patch right ( - (1 2 6 5) + (1 2 6 5) ) patch top ( - (2 3 7 6) + (2 3 7 6) ) ); diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/timeVsTopDisplacement b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/timeVsTopDisplacement index 9f26a5af6..ed1d2cb1a 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/timeVsTopDisplacement +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/timeVsTopDisplacement @@ -1,4 +1,4 @@ ( - (0 (0 0 0)) - (10 (0 0.01 0)) + (0 (0 0 0)) + (10 (0 0.01 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/fvSolution index 5842a66af..2d953c4cb 100755 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/fvSolution @@ -24,13 +24,13 @@ FoamFile solvers { - U - { - solver PCG; - preconditioner DIC; - tolerance 1e-08; - relTol 0.1; - } + U + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0.1; + } } stressedFoam diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict index f86e4b1da..a5f7b92f9 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict @@ -24,9 +24,9 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. +// cell : use cell-centre value only; constant over cells +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -114,11 +114,11 @@ surfaces // Fields to sample. fields ( - sigmayy - sigmaxx - sigmaxy - sigmaEq -// Ux + sigmayy + sigmaxx + sigmaxy + sigmaEq +// Ux // Uy // p // mag(U) diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict.old b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict.old index 83fb2ee47..5a465483f 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict.old +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/system/sampleDict.old @@ -24,9 +24,9 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. +// cell : use cell-centre value only; constant over cells +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -109,11 +109,11 @@ sets // Fields to sample. fields ( - sigmayy - sigmaxx - sigmaxy - sigmaEq -// mag(U) + sigmayy + sigmaxx + sigmaxy + sigmaEq +// mag(U) // p // mag(U) // U.component(1) diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/0/U b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/0/U index 5cb753aca..974fc2b14 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/0/U +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/0/U @@ -22,42 +22,42 @@ internalField uniform (0 0 0); boundaryField { left - { - type fixedDisplacement; - value uniform (0 0 0); - } + { + type fixedDisplacement; + value uniform (0 0 0); + } right - { - type solidTraction; - nonLinear totalLagrangian; - traction uniform (0 -1e8 0); - pressure uniform 0; - value uniform (0 0 0); - } + { + type solidTraction; + nonLinear totalLagrangian; + traction uniform (0 -1e8 0); + pressure uniform 0; + value uniform (0 0 0); + } top - { - type solidTraction; - nonLinear totalLagrangian; - traction uniform (0 0 0); - pressure uniform 0; - value uniform (0 0 0); - } + { + type solidTraction; + nonLinear totalLagrangian; + traction uniform (0 0 0); + pressure uniform 0; + value uniform (0 0 0); + } bottom - { - type solidTraction; - nonLinear totalLagrangian; - traction uniform (0 0 0); - pressure uniform 0; - value uniform (0 0 0); - } + { + type solidTraction; + nonLinear totalLagrangian; + traction uniform (0 0 0); + pressure uniform 0; + value uniform (0 0 0); + } frontAndBack - { - type empty; - } + { + type empty; + } } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/timeVsTopDisp index 58f75cf36..f2b2edf0b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/timeVsTopDisp @@ -1,4 +1,4 @@ ( - ( 0 (0 0 0) ) - ( 64 (0 0.4 0)) + ( 0 (0 0 0) ) + ( 64 (0 0.4 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/0/U b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/0/U index aae2a6881..f64496679 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/0/U +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/0/U @@ -22,35 +22,35 @@ internalField uniform (0 0 0); boundaryField { top - { - type fixedDisplacementZeroShear; - nonLinear totalLagrangian; - value uniform ( 0 0.1 0 ); - } + { + type fixedDisplacementZeroShear; + nonLinear totalLagrangian; + value uniform ( 0 0.1 0 ); + } bottom - { - type symmetryPlane; - } + { + type symmetryPlane; + } left - { - type symmetryPlane; - } + { + type symmetryPlane; + } right - { - type solidTraction; - nonLinear totalLagrangian; - traction uniform (0 0 0); - pressure uniform 0; - value uniform (0 0 0); - } + { + type solidTraction; + nonLinear totalLagrangian; + traction uniform (0 0 0); + pressure uniform 0; + value uniform (0 0 0); + } frontAndBack - { - type empty; - } + { + type empty; + } } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsTopDisp index 58f75cf36..f2b2edf0b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsTopDisp @@ -1,4 +1,4 @@ ( - ( 0 (0 0 0) ) - ( 64 (0 0.4 0)) + ( 0 (0 0 0) ) + ( 64 (0 0.4 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/forceDisp.dat b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/forceDisp.dat index fe174bb88..a490c1c42 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/forceDisp.dat +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/forceDisp.dat @@ -1 +1 @@ -#Disp(mm) Force(N) +#Disp(mm) Force(N) diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/fvSchemes index 8618bfdb1..1edb13700 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/fvSchemes @@ -24,35 +24,35 @@ FoamFile d2dt2Schemes { - default steadyState; + default steadyState; } gradSchemes { - default extendedLeastSquares 0; + default extendedLeastSquares 0; } divSchemes { - default none; - div(sigma) Gauss linear; + default none; + div(sigma) Gauss linear; } laplacianSchemes { - default none; - laplacian(DU,U) Gauss linear corrected; + default none; + laplacian(DU,U) Gauss linear corrected; } snGradSchemes { - snGrad(U) corrected; + snGrad(U) corrected; } interpolationSchemes { - default linear; + default linear; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/surfaceSubset/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/surfaceSubset/fvSchemes index 9a51ca6e0..eb28ce42b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/surfaceSubset/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/surfaceSubset/fvSchemes @@ -25,20 +25,20 @@ FoamFile gradSchemes { - default none; + default none; - snGradCorr(DU) leastSquares; - snGradCorr(DUan) leastSquares; - snGradCorr(alpha) leastSquares; + snGradCorr(DU) leastSquares; + snGradCorr(DUan) leastSquares; + snGradCorr(alpha) leastSquares; } divSchemes { - default none; + default none; } laplacianSchemes { - default none; + default none; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/fvSchemes index b56c242d5..af2bd070b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/fvSchemes @@ -24,35 +24,35 @@ FoamFile d2dt2Schemes { - default steadyState; + default steadyState; } gradSchemes { - default extendedLeastSquares 0; + default extendedLeastSquares 0; } divSchemes { - default none; - div(sigma) Gauss linear; + default none; + div(sigma) Gauss linear; } laplacianSchemes { - default none; - laplacian(DDU,DU) Gauss linear corrected; + default none; + laplacian(DDU,DU) Gauss linear corrected; } snGradSchemes { - snGrad(DU) corrected; + snGrad(DU) corrected; } interpolationSchemes { - default linear; + default linear; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/surfaceSubset/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/surfaceSubset/fvSchemes index 9a51ca6e0..eb28ce42b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/surfaceSubset/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/surfaceSubset/fvSchemes @@ -25,20 +25,20 @@ FoamFile gradSchemes { - default none; + default none; - snGradCorr(DU) leastSquares; - snGradCorr(DUan) leastSquares; - snGradCorr(alpha) leastSquares; + snGradCorr(DU) leastSquares; + snGradCorr(DUan) leastSquares; + snGradCorr(alpha) leastSquares; } divSchemes { - default none; + default none; } laplacianSchemes { - default none; + default none; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/system/fvSchemes index 0532a45d7..60f470e85 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/system/fvSchemes @@ -24,38 +24,38 @@ FoamFile d2dt2Schemes { - default steadyState; + default steadyState; } gradSchemes { - default none; + default none; - grad(DU) extendedLeastSquares 0; - snGradCorr(DU) extendedLeastSquares 0; + grad(DU) extendedLeastSquares 0; + snGradCorr(DU) extendedLeastSquares 0; } divSchemes { - default none; - div(sigma) Gauss linear; + default none; + div(sigma) Gauss linear; } laplacianSchemes { - default none; - laplacian(DDU,DU) Gauss linear corrected; + default none; + laplacian(DDU,DU) Gauss linear corrected; } snGradSchemes { - default corrected; + default corrected; } interpolationSchemes { - default linear; + default linear; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/fvSchemes index 0532a45d7..60f470e85 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/fvSchemes @@ -24,38 +24,38 @@ FoamFile d2dt2Schemes { - default steadyState; + default steadyState; } gradSchemes { - default none; + default none; - grad(DU) extendedLeastSquares 0; - snGradCorr(DU) extendedLeastSquares 0; + grad(DU) extendedLeastSquares 0; + snGradCorr(DU) extendedLeastSquares 0; } divSchemes { - default none; - div(sigma) Gauss linear; + default none; + div(sigma) Gauss linear; } laplacianSchemes { - default none; - laplacian(DDU,DU) Gauss linear corrected; + default none; + laplacian(DDU,DU) Gauss linear corrected; } snGradSchemes { - default corrected; + default corrected; } interpolationSchemes { - default linear; + default linear; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict index f83a1215b..e448284c3 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict @@ -26,23 +26,23 @@ convertToMeters 1; vertices ( -(0 0 0) //0 -(1 0 0) //1 -(0 0.5 0) //2 -(1 0.5 0) //3 -(0 0.51 0) //4 -(1 0.51 0) //5 -(0 1 0) //6 -(1 1 0) //7 +(0 0 0) //0 +(1 0 0) //1 +(0 0.5 0) //2 +(1 0.5 0) //3 +(0 0.51 0) //4 +(1 0.51 0) //5 +(0 1 0) //6 +(1 1 0) //7 -(0 0 0.1) //8 -(1 0 0.1) //9 -(0 0.5 0.1) //10 -(1 0.5 0.1) //11 -(0 0.51 0.1) //12 -(1 0.51 0.1) //13 -(0 1 0.1) //14 -(1 1 0.1) //15 +(0 0 0.1) //8 +(1 0 0.1) //9 +(0 0.5 0.1) //10 +(1 0.5 0.1) //11 +(0 0.51 0.1) //12 +(1 0.51 0.1) //13 +(0 1 0.1) //14 +(1 1 0.1) //15 ); @@ -63,38 +63,38 @@ patches ( ( 0 1 3 2) ( 2 3 5 4) - ( 4 5 7 6) + ( 4 5 7 6) ) empty back ( ( 8 9 11 10) (10 11 13 12) - (12 13 15 14) + (12 13 15 14) ) patch left ( ( 0 2 10 8) - ( 2 4 12 10) - ( 4 6 14 12) + ( 2 4 12 10) + ( 4 6 14 12) ) patch bottom ( - ( 0 1 9 8) + ( 0 1 9 8) ) patch right ( - ( 1 3 11 9) - ( 3 5 13 11) - ( 5 7 15 13) + ( 1 3 11 9) + ( 3 5 13 11) + ( 5 7 15 13) ) patch top ( - ( 6 7 15 14) + ( 6 7 15 14) ) ); diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/timeVsTopDisplacement b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/timeVsTopDisplacement index 9f26a5af6..ed1d2cb1a 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/timeVsTopDisplacement +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/timeVsTopDisplacement @@ -1,4 +1,4 @@ ( - (0 (0 0 0)) - (10 (0 0.01 0)) + (0 (0 0 0)) + (10 (0 0.01 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/fvSolution index e820428fd..7ac0746e5 100755 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/fvSolution @@ -24,13 +24,13 @@ FoamFile solvers { - U - { - solver PCG; - preconditioner DIC; - tolerance 1e-08; - relTol 0.1; - } + U + { + solver PCG; + preconditioner DIC; + tolerance 1e-08; + relTol 0.1; + } } stressedFoam diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict index f86e4b1da..a5f7b92f9 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict @@ -24,9 +24,9 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. +// cell : use cell-centre value only; constant over cells +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -114,11 +114,11 @@ surfaces // Fields to sample. fields ( - sigmayy - sigmaxx - sigmaxy - sigmaEq -// Ux + sigmayy + sigmaxx + sigmaxy + sigmaEq +// Ux // Uy // p // mag(U) diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict.old b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict.old index 83fb2ee47..5a465483f 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict.old +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/system/sampleDict.old @@ -24,9 +24,9 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // interpolationScheme : choice of -// cell : use cell-centre value only; constant over cells -// cellPoint : use cell-centre and vertex values -// cellPointFace : use cell-centre, vertex and face values. +// cell : use cell-centre value only; constant over cells +// cellPoint : use cell-centre and vertex values +// cellPointFace : use cell-centre, vertex and face values. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -109,11 +109,11 @@ sets // Fields to sample. fields ( - sigmayy - sigmaxx - sigmaxy - sigmaEq -// mag(U) + sigmayy + sigmaxx + sigmaxy + sigmaEq +// mag(U) // p // mag(U) // U.component(1) diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/0/U b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/0/U index e3dea848c..087f1c84f 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/0/U +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/0/U @@ -21,32 +21,31 @@ internalField uniform (0 0 0); boundaryField { - top + top { - type timeVaryingFixedDisplacement; - fileName "$FOAM_CASE/constant/timeVsTopDisp"; - outOfBounds clamp; - value uniform (0 0 0); + type timeVaryingFixedDisplacement; + fileName "$FOAM_CASE/constant/timeVsTopDisp"; + outOfBounds clamp; + value uniform (0 0 0); } - cohesive + cohesive { - - type cohesiveZone; - cohesiveLaw Dugdale; - relaxationFactor 0.9; - DugdaleCoeffs - { - GIc GIc [ 1 0 -2 0 0 0 0 ] 10; - sigmaMax sigmaMax [ 1 -1 -2 0 0 0 0 ] 1000e+06; - } - value uniform (0 0 0); + type cohesiveZone; + cohesiveLaw Dugdale; + relaxationFactor 0.9; + DugdaleCoeffs + { + GIc GIc [ 1 0 -2 0 0 0 0 ] 10; + sigmaMax sigmaMax [ 1 -1 -2 0 0 0 0 ] 1000e+06; + } + value uniform (0 0 0); } - bottom + bottom { - type fixedDisplacement; - value uniform (0 0 0); + type fixedDisplacement; + value uniform (0 0 0); } tracFree diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/constant/timeVsTopDisp b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/constant/timeVsTopDisp index 9bddf7459..e89271dba 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/constant/timeVsTopDisp +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/crackingSENT/constant/timeVsTopDisp @@ -1,4 +1,4 @@ ( - (0 (0 0 0)) - (1 (0 1e-2 0)) + (0 (0 0 0)) + (1 (0 1e-2 0)) ) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C index 0d8269800..fe8c7343c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C @@ -52,52 +52,52 @@ int main(int argc, char *argv[]) # include "createMesh.H" - runTime++; + runTime++; - Info << "Writing analytical solution for an infinite plate with a circular hole,\nwhere" - << "\n\tradius = 0.5" - << "\n\tdistant traction = (10,000 0 0 )" - << nl << endl; + Info << "Writing analytical solution for an infinite plate with a circular hole,\nwhere" + << "\n\tradius = 0.5" + << "\n\tdistant traction = (10,000 0 0 )" + << nl << endl; - volSymmTensorField sigma + volSymmTensorField sigma ( - IOobject - ( - "analyticalSigma", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) - ); + IOobject + ( + "analyticalSigma", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) + ); - const volVectorField& C = mesh.C(); + const volVectorField& C = mesh.C(); - forAll(sigma.internalField(), celli) + forAll(sigma.internalField(), celli) { - vector curR = vector(C[celli].x(), C[celli].y(), 0); + vector curR = vector(C[celli].x(), C[celli].y(), 0); - sigma.internalField()[celli] = plateHoleSolution(curR); + sigma.internalField()[celli] = plateHoleSolution(curR); } - forAll(sigma.boundaryField(), patchi) + forAll(sigma.boundaryField(), patchi) { - forAll(sigma.boundaryField()[patchi], facei) - { - vector curR = vector(C.boundaryField()[patchi][facei].x(), C.boundaryField()[patchi][facei].y(), 0); + forAll(sigma.boundaryField()[patchi], facei) + { + vector curR = vector(C.boundaryField()[patchi][facei].x(), C.boundaryField()[patchi][facei].y(), 0); - sigma.boundaryField()[patchi][facei] = plateHoleSolution(curR); - } + sigma.boundaryField()[patchi][facei] = plateHoleSolution(curR); + } } - Info << "Writing analytical sigma tensor" << endl; - sigma.write(); + Info << "Writing analytical sigma tensor" << endl; + sigma.write(); - Info << nl << "End" << endl; + Info << nl << "End" << endl; - return 0; + return 0; } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C index 67c6fe689..9565ba472 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C @@ -45,351 +45,352 @@ int main(int argc, char *argv[]) # include "createMesh.H" - runTime++; + runTime++; - Info << "Writing analytical solution for a plain strain cylinder with concentric hole,\nwhere" - << "\n\tinner radius = 0.5" - << "\n\touter radius = 0.7" - << "\n\tinner temperature = 100" - << "\n\touter temperature = 0" - << "\n\tinner pressure = 0" - << "\n\touter pressure = 0" - << "\n\tE = 200e9" - << "\n\tu = 0.3" - << "\n\talpha = 1e-5" - << nl << endl; + Info << "Writing analytical solution for a plain strain cylinder with concentric hole,\nwhere" + << "\n\tinner radius = 0.5" + << "\n\touter radius = 0.7" + << "\n\tinner temperature = 100" + << "\n\touter temperature = 0" + << "\n\tinner pressure = 0" + << "\n\touter pressure = 0" + << "\n\tE = 200e9" + << "\n\tu = 0.3" + << "\n\talpha = 1e-5" + << nl << endl; - //- inner and outer radii and temperatures - scalar a = 0.5; - scalar b = 0.7; - scalar Ti = 100; - scalar To = 0; + //- inner and outer radii and temperatures + scalar a = 0.5; + scalar b = 0.7; + scalar Ti = 100; + scalar To = 0; - //- mechanical and thermal properties - scalar E = 200e9; - scalar nu = 0.3; - scalar alpha = 1e-5; + //- mechanical and thermal properties + scalar E = 200e9; + scalar nu = 0.3; + scalar alpha = 1e-5; - //- create T field - volScalarField T + //- create T field + volScalarField T ( - IOobject - ( - "analyticalT", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimTemperature, 0.0) + IOobject + ( + "analyticalT", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimTemperature, 0.0) + ); + + const volVectorField& C = mesh.C(); + + //- radial coordinate + volScalarField radii = + C.component(vector::X)*C.component(vector::X) + C.component(vector::Y)*C.component(vector::Y); + forAll(radii.internalField(), celli) + { + radii.internalField()[celli] = ::sqrt(radii.internalField()[celli]); + } + forAll(radii.boundaryField(), patchi) + { + forAll(radii.boundaryField()[patchi], facei) + { + radii.boundaryField()[patchi][facei] = ::sqrt(radii.boundaryField()[patchi][facei]); + } + } + + forAll(T.internalField(), celli) + { + const scalar& r = radii[celli]; + + T.internalField()[celli] = + ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); + } + + forAll(T.boundaryField(), patchi) + { + forAll(T.boundaryField()[patchi], facei) + { + const scalar& r = radii.boundaryField()[patchi][facei]; + + T.boundaryField()[patchi][facei] = + ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); + } + } + + //- write temperature file + Info << "Writing analytical termpature field" << endl; + T.write(); + + + //- create sigma field + volScalarField sigmaR + ( + IOobject + ( + "sigmaR", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimForce/dimArea, 0.0) + ); + + forAll(sigmaR.internalField(), celli) + { + const scalar& r = radii.internalField()[celli]; + + sigmaR.internalField()[celli] = + ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + (-Foam::log(b/r) -( a*a/(b*b - a*a))*(1 - (b*b)/(r*r))*Foam::log(b/a)); + } + + forAll(sigmaR.boundaryField(), patchi) + { + forAll(sigmaR.boundaryField()[patchi], facei) + { + const scalar& r = radii.boundaryField()[patchi][facei]; + + sigmaR.boundaryField()[patchi][facei] = + ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + ( -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 - (b*b)/(r*r))*Foam::log(b/a) ); + } + } + + //- write temperature file + Info << "\nWriting analytical sigmaR field" << endl; + sigmaR.write(); + + + volScalarField sigmaTheta + ( + IOobject + ( + "sigmaTheta", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimForce/dimArea, 0.0) ); - const volVectorField& C = mesh.C(); + forAll(sigmaTheta.internalField(), celli) + { + const scalar& r = radii.internalField()[celli]; - //- radial coordinate - volScalarField radii = - C.component(vector::X)*C.component(vector::X) + C.component(vector::Y)*C.component(vector::Y); - forAll(radii.internalField(), celli) - { - radii.internalField()[celli] = ::sqrt(radii.internalField()[celli]); - } - forAll(radii.boundaryField(), patchi) - { - forAll(radii.boundaryField()[patchi], facei) - { - radii.boundaryField()[patchi][facei] = ::sqrt(radii.boundaryField()[patchi][facei]); - } + sigmaTheta.internalField()[celli] = + ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + (1 -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 + (b*b)/(r*r))*Foam::log(b/a) ); } - forAll(T.internalField(), celli) + forAll(sigmaTheta.boundaryField(), patchi) { - const scalar& r = radii[celli]; + forAll(sigmaTheta.boundaryField()[patchi], facei) + { + const scalar& r = radii.boundaryField()[patchi][facei]; - T.internalField()[celli] = - ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); + sigmaTheta.boundaryField()[patchi][facei] = + ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + (1 -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 + (b*b)/(r*r))*Foam::log(b/a) ); + } } - forAll(T.boundaryField(), patchi) - { - forAll(T.boundaryField()[patchi], facei) - { - const scalar& r = radii.boundaryField()[patchi][facei]; - T.boundaryField()[patchi][facei] = - ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); - } - } + //- write temperature file + Info << "\nWriting analytical sigmaTheta field" << endl; + sigmaTheta.write(); - //- write temperature file - Info << "Writing analytical termpature field" << endl; - T.write(); - - - //- create sigma field - volScalarField sigmaR + volScalarField sigmaZ ( - IOobject - ( - "sigmaR", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimForce/dimArea, 0.0) + IOobject + ( + "sigmaZ", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimForce/dimArea, 0.0) ); - forAll(sigmaR.internalField(), celli) + forAll(sigmaZ.internalField(), celli) { - const scalar& r = radii.internalField()[celli]; + //- Timoshenko says this but I am not sure I am not sure the BCs in + //- the z direction + // sigmaZ.internalField()[celli] = + // ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + // (1 - 2*Foam::log(b/r) - ( 2*a*a/(b*b - a*a))*Foam::log(b/a)); - sigmaR.internalField()[celli] = - ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - (-Foam::log(b/r) -( a*a/(b*b - a*a))*(1 - (b*b)/(r*r))*Foam::log(b/a)); + sigmaZ.internalField()[celli] = + 0.3*(sigmaR.internalField()[celli] + sigmaTheta.internalField()[celli]) + - E*alpha*(T.internalField()[celli]); } - forAll(sigmaR.boundaryField(), patchi) + forAll(sigmaZ.boundaryField(), patchi) { - forAll(sigmaR.boundaryField()[patchi], facei) - { - const scalar& r = radii.boundaryField()[patchi][facei]; + forAll(sigmaZ.boundaryField()[patchi], facei) + { + //- Timoshenko says this but I am not sure I am not sure the BCs in + //- the z direction + //sigmaZ.boundaryField()[patchi][facei] = + //( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * + //(1 - 2*Foam::log(b/r) - ( 2*a*a/(b*b - a*a))*Foam::log(b/a)); - sigmaR.boundaryField()[patchi][facei] = - ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - ( -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 - (b*b)/(r*r))*Foam::log(b/a) ); - } + //-for general 2-D plain strain problems, the axial stress is given by this: + sigmaZ.boundaryField()[patchi][facei] = + nu*(sigmaR.boundaryField()[patchi][facei] + sigmaTheta.boundaryField()[patchi][facei]) + - E*alpha*(T.boundaryField()[patchi][facei]); + } } - //- write temperature file - Info << "\nWriting analytical sigmaR field" << endl; - sigmaR.write(); + + //- write temperature file + Info << "\nWriting analytical sigmaZ field" << endl; + sigmaZ.write(); - volScalarField sigmaTheta + //- create analytical sigma tensor + + //- create theta field + volScalarField theta ( - IOobject - ( - "sigmaTheta", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimForce/dimArea, 0.0) - ); + IOobject + ( + "theta", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dimless, 0.0) + ); - forAll(sigmaTheta.internalField(), celli) + forAll(theta.internalField(), celli) { - const scalar& r = radii.internalField()[celli]; + const scalar& x = mesh.C().internalField()[celli][vector::X]; + const scalar& y = mesh.C().internalField()[celli][vector::Y]; - sigmaTheta.internalField()[celli] = - ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - (1 -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 + (b*b)/(r*r))*Foam::log(b/a) ); + theta.internalField()[celli] = Foam::atan(y/x); } - forAll(sigmaTheta.boundaryField(), patchi) + forAll(theta.boundaryField(), patchi) { - forAll(sigmaTheta.boundaryField()[patchi], facei) - { - const scalar& r = radii.boundaryField()[patchi][facei]; + forAll(theta.boundaryField()[patchi], facei) + { + const scalar& x = mesh.C().boundaryField()[patchi][facei][vector::X]; + const scalar& y = mesh.C().boundaryField()[patchi][facei][vector::Y]; - sigmaTheta.boundaryField()[patchi][facei] = - ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - (1 -Foam::log(b/r) - ( a*a/(b*b - a*a))*(1 + (b*b)/(r*r))*Foam::log(b/a) ); - } + theta.boundaryField()[patchi][facei] = Foam::atan(y/x); + } } - - //- write temperature file - Info << "\nWriting analytical sigmaTheta field" << endl; - sigmaTheta.write(); - - volScalarField sigmaZ + //- rotation matrix to convert polar stresses to cartesian + volTensorField rotMat ( - IOobject - ( - "sigmaZ", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimForce/dimArea, 0.0) - ); + IOobject + ( + "rotMat", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedTensor("zero", dimless, tensor::zero) + ); - forAll(sigmaZ.internalField(), celli) + forAll(rotMat.internalField(), celli) { - //- Timoshenko says this but I am not sure I am not sure the BCs in - //- the z direction - // sigmaZ.internalField()[celli] = - // ( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - // (1 - 2*Foam::log(b/r) - ( 2*a*a/(b*b - a*a))*Foam::log(b/a)); + const scalar& t = theta.internalField()[celli]; - sigmaZ.internalField()[celli] = - 0.3*(sigmaR.internalField()[celli] + sigmaTheta.internalField()[celli]) - - E*alpha*(T.internalField()[celli]); + rotMat.internalField()[celli] = tensor + ( + ::cos(t), ::sin(t), 0, + -::sin(t), ::cos(t), 0, + 0, 0, 1 + ); } - forAll(sigmaZ.boundaryField(), patchi) + forAll(rotMat.boundaryField(), patchi) { - forAll(sigmaZ.boundaryField()[patchi], facei) - { - //- Timoshenko says this but I am not sure I am not sure the BCs in - //- the z direction - //sigmaZ.boundaryField()[patchi][facei] = - //( (alpha*E*(Ti-To))/(2*(1-nu)*Foam::log(b/a)) ) * - //(1 - 2*Foam::log(b/r) - ( 2*a*a/(b*b - a*a))*Foam::log(b/a)); + forAll(rotMat.boundaryField()[patchi], facei) + { + const scalar& t = theta.boundaryField()[patchi][facei]; - //-for general 2-D plain strain problems, the axial stress is given by this: - sigmaZ.boundaryField()[patchi][facei] = - nu*(sigmaR.boundaryField()[patchi][facei] + sigmaTheta.boundaryField()[patchi][facei]) - - E*alpha*(T.boundaryField()[patchi][facei]); - } + rotMat.boundaryField()[patchi][facei] = tensor + ( + ::cos(t), ::sin(t), 0, + -::sin(t), ::cos(t), 0, + 0, 0, 1 + ); + } } - - //- write temperature file - Info << "\nWriting analytical sigmaZ field" << endl; - sigmaZ.write(); - - - //- create analytical sigma tensor - - //- create theta field - volScalarField theta + volSymmTensorField sigma ( - IOobject - ( - "theta", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - forAll(theta.internalField(), celli) - { - const scalar& x = mesh.C().internalField()[celli][vector::X]; - const scalar& y = mesh.C().internalField()[celli][vector::Y]; + IOobject + ( + "analyticalSigma", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) + ); - theta.internalField()[celli] = Foam::atan(y/x); + forAll(sigma.internalField(), celli) + { + const scalar& r = sigmaR.internalField()[celli]; + const scalar& t = sigmaTheta.internalField()[celli]; + const scalar& z = sigmaZ.internalField()[celli]; + + const tensor& rot = rotMat.internalField()[celli]; + + symmTensor sigmaCart(r, 0, 0, t, 0, z); + + sigma.internalField()[celli] = + symm(rot.T() & sigmaCart & rot); + + //-for general 2-D plain strain problems, the axial stress is given by this: + //- (which is not equal to the solution by Timoshenko... hmmmnn) + // sigma.internalField()[celli][symmTensor::ZZ] = + // 0.3*(sigma.internalField()[celli][symmTensor::XX] + sigma.internalField()[celli][symmTensor::YY]) + // - E*alpha*(T.internalField()[celli]); } - forAll(theta.boundaryField(), patchi) + forAll(sigma.boundaryField(), patchi) { - forAll(theta.boundaryField()[patchi], facei) - { - const scalar& x = mesh.C().boundaryField()[patchi][facei][vector::X]; - const scalar& y = mesh.C().boundaryField()[patchi][facei][vector::Y]; + forAll(sigma.boundaryField()[patchi], facei) + { + const scalar& r = sigmaR.boundaryField()[patchi][facei]; + const scalar& t = sigmaTheta.boundaryField()[patchi][facei]; + const scalar& z = sigmaZ.boundaryField()[patchi][facei]; - theta.boundaryField()[patchi][facei] = Foam::atan(y/x); - } + const tensor& rot = rotMat.boundaryField()[patchi][facei]; + + symmTensor sigmaCart(r, 0, 0, t, 0, z); + sigma.boundaryField()[patchi][facei] = + symm(rot.T() & sigmaCart & rot); + } } - //- rotation matrix to convert polar stresses to cartesian - volTensorField rotMat - ( - IOobject - ( - "rotMat", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedTensor("zero", dimless, tensor::zero) - ); + Info << "\nWriting analytical sigma tensor" << endl; + sigma.write(); - forAll(rotMat.internalField(), celli) - { - const scalar& t = theta.internalField()[celli]; + Info << nl << "End" << endl; - rotMat.internalField()[celli] = tensor(::cos(t), ::sin(t), 0, - -::sin(t), ::cos(t), 0, - 0, 0, 1); - } - - forAll(rotMat.boundaryField(), patchi) - { - forAll(rotMat.boundaryField()[patchi], facei) - { - const scalar& t = theta.boundaryField()[patchi][facei]; - - rotMat.boundaryField()[patchi][facei] = tensor(::cos(t), ::sin(t), 0, - -::sin(t), ::cos(t), 0, - 0, 0, 1); - } - } - - volSymmTensorField sigma - ( - IOobject - ( - "analyticalSigma", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) - ); - - forAll(sigma.internalField(), celli) - { - const scalar& r = sigmaR.internalField()[celli]; - const scalar& t = sigmaTheta.internalField()[celli]; - const scalar& z = sigmaZ.internalField()[celli]; - - const tensor& rot = rotMat.internalField()[celli]; - - symmTensor sigmaCart(r, 0, 0, - t, 0, - z); - - sigma.internalField()[celli] = - symm(rot.T() & sigmaCart & rot); - - //-for general 2-D plain strain problems, the axial stress is given by this: - //- (which is not equal to the solution by Timoshenko... hmmmnn) -// sigma.internalField()[celli][symmTensor::ZZ] = -// 0.3*(sigma.internalField()[celli][symmTensor::XX] + sigma.internalField()[celli][symmTensor::YY]) -// - E*alpha*(T.internalField()[celli]); - } - - forAll(sigma.boundaryField(), patchi) - { - forAll(sigma.boundaryField()[patchi], facei) - { - const scalar& r = sigmaR.boundaryField()[patchi][facei]; - const scalar& t = sigmaTheta.boundaryField()[patchi][facei]; - const scalar& z = sigmaZ.boundaryField()[patchi][facei]; - - const tensor& rot = rotMat.boundaryField()[patchi][facei]; - - symmTensor sigmaCart(r, 0, 0, - t, 0, - z); - sigma.boundaryField()[patchi][facei] = - symm(rot.T() & sigmaCart & rot); - } - } - - - - Info << "\nWriting analytical sigma tensor" << endl; - sigma.write(); - - Info << nl << "End" << endl; - - return 0; + return 0; } diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/system/fvSolution b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/system/fvSolution index 93ca88349..32a0fba90 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/system/fvSolution @@ -25,55 +25,55 @@ FoamFile solvers { - p - { - 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; - }; + p + { + 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-6; - relTol 1e-3; - minIter 1; - maxIter 1000; + cellMotionU + { + solver GAMG; + tolerance 1e-6; + relTol 1e-3; + minIter 1; + maxIter 1000; - smoother GaussSeidel; - nPreSweeps 0; - nPostSweeps 2; - nFinestSweeps 2; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; - scaleCorrection true; - directSolveCoarsest false; + scaleCorrection true; + directSolveCoarsest false; - cacheAgglomeration true; + cacheAgglomeration true; - nCellsInCoarsestLevel 20; - agglomerator faceAreaPair; - mergeLevels 1; - }; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + }; - U - { - solver PBiCG; - preconditioner DILU; - tolerance 1e-06; - relTol 0; - }; + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-06; + relTol 0; + }; } PISO diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/info.txt b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/info.txt index 490ab8165..66c9aa943 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/info.txt +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/info.txt @@ -1,45 +1,45 @@ Solver - icoFsiElasticNonLinSolidFoam + icoFsiElasticNonLinSolidFoam Description - This solver is for fluid-structure interaction of an incompressible - fluid and a large deformation solid. + This solver is for fluid-structure interaction of an incompressible + fluid and a large deformation solid. OpenFOAM versions - 1.6-ext + 1.6-ext Parallelised - yes + yes Tutorial Case - HronTurekFsi2 + HronTurekFsi2 Case setup notes - setSet -case fluid + setSet -case fluid - faceSet plateZone new patchToFace plate - quit + faceSet plateZone new patchToFace plate + quit - setsToZones -case fluid -noFlipMap + setsToZones -case fluid -noFlipMap - //- for parallel runs - decomposePar -case fluid -cellDist + //- for parallel runs + decomposePar -case fluid -cellDist - setSet -case solid + setSet -case solid - faceSet plateZone new patchToFace plate - quit - setsToZones -case solid -noFlipMap + faceSet plateZone new patchToFace plate + quit + setsToZones -case solid -noFlipMap - //- for parallel runs - decomposePar -case solid -cellDist + //- for parallel runs + decomposePar -case solid -cellDist - //- for serial runs - ./removeSerialLinks fluid solid - ./makeSerialLinks fluid solid + //- for serial runs + ./removeSerialLinks fluid solid + ./makeSerialLinks fluid solid - //- for parallel runs - ./makeLinks fluid solid + //- for parallel runs + ./makeLinks fluid solid diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/0/DU b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/0/DU index b4875c8a6..17cbd8028 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/0/DU +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/0/DU @@ -31,7 +31,7 @@ boundaryField plate { type solidTraction; - nonLinear updatedLagrangian; + nonLinear updatedLagrangian; traction uniform ( 0 0 0 ); pressure uniform 0; value uniform (0 0 0); diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSchemes index 7dcfe95ac..5497cd32f 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSchemes @@ -51,8 +51,8 @@ divSchemes laplacianSchemes { - default none; - laplacian(DDU,DU) Gauss linear corrected; + default none; + laplacian(DDU,DU) Gauss linear corrected; } snGradSchemes diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSolution b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSolution index c511a0b43..2ba628b3e 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/solid/system/fvSolution @@ -26,7 +26,7 @@ solvers { DU { - solver GAMG; + solver GAMG; tolerance 1e-8; relTol 0.01; minIter 1; @@ -37,7 +37,7 @@ solvers nPostSweeps 2; nFinestSweeps 2; - scaleCorrection true; + scaleCorrection true; directSolveCoarsest false; @@ -50,7 +50,7 @@ solvers // DU // { -// solver amgSolver; +// solver amgSolver; // cycle W-cycle; // policy AAMG; // nPreSweeps 0; @@ -73,9 +73,9 @@ solvers stressedFoam { - nCorrectors 1000; - DU 1e-06; - historyPointID 62; + nCorrectors 1000; + DU 1e-06; + historyPointID 62; } relaxationFactors diff --git a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/faSolution b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/faSolution index 594df09e9..5cb9ac53e 100755 --- a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/faSolution +++ b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/faSolution @@ -16,9 +16,9 @@ object faSolution; solvers { - p ICCG 1e-6 0.0; - U BICCG 1e-5 0.0; - Cs BICCG 1e-6 0.0; + p ICCG 1e-6 0.0; + U BICCG 1e-5 0.0; + Cs BICCG 1e-6 0.0; } PISO diff --git a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSchemes b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSchemes index bbf0b4ada..7278b0e44 100755 --- a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSchemes +++ b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSchemes @@ -43,8 +43,8 @@ divSchemes laplacianSchemes { - default none; - laplacian(mu,DU) Gauss linear corrected; + default none; + laplacian(mu,DU) Gauss linear corrected; laplacian(DDU,DU) Gauss linear corrected; } diff --git a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSolution b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSolution index bf902954b..be2e9d83c 100755 --- a/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/viscoElasticSolidFoam/compressionRelaxationTest/system/fvSolution @@ -24,19 +24,19 @@ FoamFile solvers { - DU - { - solver PCG; - preconditioner DIC; - tolerance 1e-09; - relTol 0.001; - } + DU + { + solver PCG; + preconditioner DIC; + tolerance 1e-09; + relTol 0.001; + } } stressedFoam { - nCorrectors 5000; - DU 1e-06; + nCorrectors 5000; + DU 1e-06; } diff --git a/applications/solvers/solidMechanics/utilities/foamMeshToAbaqus/foamMeshToAbaqus.C b/applications/solvers/solidMechanics/utilities/foamMeshToAbaqus/foamMeshToAbaqus.C index 86e539a38..3aaa467ef 100644 --- a/applications/solvers/solidMechanics/utilities/foamMeshToAbaqus/foamMeshToAbaqus.C +++ b/applications/solvers/solidMechanics/utilities/foamMeshToAbaqus/foamMeshToAbaqus.C @@ -50,471 +50,463 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" - //----------------------------------------------------------------------// - //- open abaqus input file - //----------------------------------------------------------------------// - Info << "Opening Abaqus input file" << endl << endl; - OFstream abaqusInp("abaqusMesh.inp"); + //----------------------------------------------------------------------// + //- open abaqus input file + //----------------------------------------------------------------------// + Info << "Opening Abaqus input file" << endl << endl; + OFstream abaqusInp("abaqusMesh.inp"); - //- input header - Info << "Writing input file header" << endl << endl; - abaqusInp << "*Heading\n" - << "** Job name: OpenFoamMesh Model name: OpenFoamMesh\n" - << "** Generated by: Abaqus/CAE 6.9-2\n" - << "*Preprint, echo=NO, model=NO, history=NO, contact=NO\n" - << "**\n" - << "** PARTS\n" - << "**\n" - << "*Part, name=OpenFoamMeshPart" - << endl; + //- input header + Info << "Writing input file header" << endl << endl; + abaqusInp << "*Heading\n" + << "** Job name: OpenFoamMesh Model name: OpenFoamMesh\n" + << "** Generated by: Abaqus/CAE 6.9-2\n" + << "*Preprint, echo=NO, model=NO, history=NO, contact=NO\n" + << "**\n" + << "** PARTS\n" + << "**\n" + << "*Part, name=OpenFoamMeshPart" + << endl; - //----------------------------------------------------------------------// - //- write nodes - //----------------------------------------------------------------------// - Info << "Writing Nodes" << endl << endl; - abaqusInp << "*Node" << endl; - const pointField& points = mesh.points(); - forAll(points, pointi) + //----------------------------------------------------------------------// + //- write nodes + //----------------------------------------------------------------------// + Info << "Writing Nodes" << endl << endl; + abaqusInp << "*Node" << endl; + const pointField& points = mesh.points(); + forAll(points, pointi) { - abaqusInp << "\t" << (pointi+1) - << ",\t" << (points[pointi]).x() - << ",\t" << (points[pointi]).y() - << ",\t" << (points[pointi]).z() - << endl; + abaqusInp << "\t" << (pointi+1) + << ",\t" << (points[pointi]).x() + << ",\t" << (points[pointi]).y() + << ",\t" << (points[pointi]).z() + << endl; } - //----------------------------------------------------------------------// - //- determine abaqusCellPoints - //----------------------------------------------------------------------// - //- for hex 1st order elements, abaqus orders the points - //- where nodes 1 2 3 4 are clockwise from the outside of the cell - //- and then 5 6 7 8 are apposite 1 2 3 4 respectively - Info << "Determining Abaqus element node ordering" << endl << endl; + //----------------------------------------------------------------------// + //- determine abaqusCellPoints + //----------------------------------------------------------------------// + //- for hex 1st order elements, abaqus orders the points + //- where nodes 1 2 3 4 are clockwise from the outside of the cell + //- and then 5 6 7 8 are apposite 1 2 3 4 respectively + Info << "Determining Abaqus element node ordering" << endl << endl; - const cellList& cells = mesh.cells(); - const faceList& faces = mesh.faces(); - const labelListList pointPoints = mesh.pointPoints(); - const labelListList cellPoints = mesh.cellPoints(); - const labelList faceOwner = mesh.faceOwner(); - const vectorField faceNormals = mesh.Sf()/mesh.magSf(); + const cellList& cells = mesh.cells(); + const faceList& faces = mesh.faces(); + const labelListList pointPoints = mesh.pointPoints(); + const labelListList cellPoints = mesh.cellPoints(); + const labelList faceOwner = mesh.faceOwner(); + const vectorField faceNormals = mesh.Sf()/mesh.magSf(); - labelListList abaqusCellPoints(cellPoints.size(), List