diff --git a/CMakeLists.txt b/CMakeLists.txt index aac37fb6d..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 @@ -81,16 +81,16 @@ SET( ) # Find out the version of the compiler being used. -# Add this information to the buildname +# Add this information to the buildname # This is for gcc or icc because they both support the -dumpversion option EXEC_PROGRAM($ENV{WM_CC} ARGS -dumpversion OUTPUT_VARIABLE COMPILER_VERSION ) -SET(BUILDNAME "${BUILDNAME}-$ENV{WM_CC}${COMPILER_VERSION}") +SET(BUILDNAME "${BUILDNAME}-$ENV{WM_CC}${COMPILER_VERSION}") # # We will support more compilers eventually. -# +# # Timeout for running every single test: 4 hours: 4 x 3600 seconds #SET( @@ -128,12 +128,12 @@ 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}") endif() - SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}") + SET(BUILDNAME "${BUILDNAME}-git-branch=${GIT_BRANCH_NAME}") endif() # Some last minute cleanup @@ -158,7 +158,7 @@ set_property( # Compile the OpenFOAM unit tests located under applications/test # This part will not be compiled and run by default. # This would be a good candidate for a sub-project -add_custom_target (OpenFOAM-$ENV{WM_PROJECT_VERSION}_unitTests +add_custom_target (OpenFOAM-$ENV{WM_PROJECT_VERSION}_unitTests wmake all ${OF_ROOT}/applications/test ) @@ -184,7 +184,7 @@ IF(BUILD_TESTING) # Modify this variable if you want the full length test case simulations # Beware, this might take a long time to execute. - # Otherwise, the default behaviour is to run each tutorial for 1 "timestep" + # Otherwise, the default behaviour is to run each tutorial for 1 "timestep" #SET(RUN_FROM_ONE_TIMESTEP 0) SET(RUN_FROM_ONE_TIMESTEP 1) 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/ContributionsForNextRelease.txt b/ContributionsForNextRelease.txt index aff262727..6ec94b8b7 100644 --- a/ContributionsForNextRelease.txt +++ b/ContributionsForNextRelease.txt @@ -14,7 +14,7 @@ Contributions: - TU Braunschweig: real gas thermo - Kornev, Rostock: inlet turbulence generator; locDynV2F hybrid turbulence model - Christoph Goniva: and multi-mixer dynamic mesh class -- +- - segregated pressure-based turbomachinery (Wikki) diff --git a/ExtendProjectPreamble b/ExtendProjectPreamble index 80314d499..62e0e6ffc 100644 --- a/ExtendProjectPreamble +++ b/ExtendProjectPreamble @@ -1,118 +1,118 @@ -The OpenFOAM-Extend Project - -Web site: http://www.extend-project.de/ - -The goal of the OpenFOAM -Extend Project is to open the OpenFOAM CFD toolbox -to community contributed extensions in the spirit of the Open Source -development model. - -Software under the name OpenFOAM has been developed by a large group of -volunteers starting in 1991 and has spread through scientific and engineering -community in the late 1990s and early 2000s. Its main strength was the spirit -of open collaboration in the community: the aim of the OpenFOAM-Extend Project -is to formalize this spirit. - - * Trademark notice - Currently, the word "OpenFOAM" is held as a trademark by a commercial - company, not associated with the Open Source development effort of this - software. While the author acknowledges the existence of Trademark, - association of trademarked phrase with the the code developed by third - parties and including the author is misleading in terms of authorship, - ownership of intellectual property of the source code. - - In the absence of a legal resolution, we shall refer to the project as the - -Extend project and software as "OpenFOAM", as per agreement between - Prof. Hrvoje Jasak and Mr. Henry G. Weller of 30 September 2004. - - The excerpts below are from the correspondences of Dr.Jasak and are to - his knowledge all the relevant writings about this topic. Although - this topic has been discussed before in public forums there exists no - 'official' answer by OpenCFD on this issue. In the interest of - fairness a reference (link) to such an answer will be added to this - document as soon as we come aware of it. - - 09/30/2004 01:45 PM - - Dear Dr. Jasak, - - I propose that we make FOAM open-source and shutdown Nabla, that way we - are free to pursue whatever future we wish independently. - - Henry G. Weller - Managing Director - Nabla Ltd - - The first release of the OpenFOAM source code of 10 December 2004 - and subsequent clarification of 16 February 2005. - - Hi Henry, - - ... - - Regarding the new setup, I would like to thank you for your effort i - n making FOAM public domain, with crucial comments regarding some - important details. - - - in the header files for the open version of foam there exists a line - which claims copyright for OpenCFD Ltd: - - Copyright (C) 1991-2004 OpenCFD Ltd. - - I am not sure whether it is possible to claim copyright over a GPL piece - of software, but this is at least misleading. In order for this - statement to be true, OpenCFD Ltd. would need to purchase the copyright - from Nabla Ltd. and from you and me personally (due to unresolved - ownership and the remaining payments Nabla Ltd. needs to make to us - regarding the original transfer of copyright). I can offer a number - of solutions acceptable to me as follows: - - 1) no Copyright statement apart from the required GPL statement - 2) Copyright OpenFOAM.org - 3) Copyright Henry Weller, Hrvoje Jasak et al - 4) Copyright OpenCFD and Hrvoje Jasak - 5) List of authors instead of the copyright statement - - I am also prepared to consider any other reasonable ideas along the same - lines (including the sale of copyright, which would be a bit pointless - at this stage) - please advise. - - - 02/17/2005 11:09 PM - - Under the GPL there has to be an organization in place to enforce the GPL - if there are violation, these are part of the rules. OpenCFD undertakes - that responsibility hence the copyright. - - Henry G. Weller - Managing Director - - - 12 November 2010 - - From the above it is clear that OpenCFD does not own the rights or - authorship of the source code, which is currently concealed in public. - For further details, I have been attempting to get a formal response by - this company for 6 years now, without success. It is time to move on. - - The current Copyright notice does not fairly describe the authorship of - the software. In the spirit of the open source development model, the - -Extend project wishes to formally acknowledge all contributors and - developers of OpenFOAM from its inception to today. - - As this issue still remains unresolved, and the list of contributors - has been removed from the OpenFOAM source code by Mr. Weller in 2006, - we shall re-base OpenFOAM as an Open Source community-based project - and associate the authorship and Copyright in each case with the - original author. - - Hrvoje Jasak - - -This offering is not affiliated with OpenCFD Limited, owner of the OpenFOAM -trade mark. - - -Please find the official website of OpenCFD Limited at http://www.openfoam.org -In particular, OpenCFD Limited hosts the following legal statements: -- licensing and intellectual property: http://www.openfoam.com/legal/index.php -- trademark policy: http://www.openfoam.com/legal/trademark-policy.php +The OpenFOAM-Extend Project + +Web site: http://www.extend-project.de/ + +The goal of the OpenFOAM -Extend Project is to open the OpenFOAM CFD toolbox +to community contributed extensions in the spirit of the Open Source +development model. + +Software under the name OpenFOAM has been developed by a large group of +volunteers starting in 1991 and has spread through scientific and engineering +community in the late 1990s and early 2000s. Its main strength was the spirit +of open collaboration in the community: the aim of the OpenFOAM-Extend Project +is to formalize this spirit. + + * Trademark notice + Currently, the word "OpenFOAM" is held as a trademark by a commercial + company, not associated with the Open Source development effort of this + software. While the author acknowledges the existence of Trademark, + association of trademarked phrase with the the code developed by third + parties and including the author is misleading in terms of authorship, + ownership of intellectual property of the source code. + + In the absence of a legal resolution, we shall refer to the project as the + -Extend project and software as "OpenFOAM", as per agreement between + Prof. Hrvoje Jasak and Mr. Henry G. Weller of 30 September 2004. + + The excerpts below are from the correspondences of Dr.Jasak and are to + his knowledge all the relevant writings about this topic. Although + this topic has been discussed before in public forums there exists no + 'official' answer by OpenCFD on this issue. In the interest of + fairness a reference (link) to such an answer will be added to this + document as soon as we come aware of it. + + 09/30/2004 01:45 PM + + Dear Dr. Jasak, + + I propose that we make FOAM open-source and shutdown Nabla, that way we + are free to pursue whatever future we wish independently. + + Henry G. Weller + Managing Director + Nabla Ltd + + The first release of the OpenFOAM source code of 10 December 2004 + and subsequent clarification of 16 February 2005. + + Hi Henry, + + ... + + Regarding the new setup, I would like to thank you for your effort i + n making FOAM public domain, with crucial comments regarding some + important details. + + - in the header files for the open version of foam there exists a line + which claims copyright for OpenCFD Ltd: + + Copyright (C) 1991-2004 OpenCFD Ltd. + + I am not sure whether it is possible to claim copyright over a GPL piece + of software, but this is at least misleading. In order for this + statement to be true, OpenCFD Ltd. would need to purchase the copyright + from Nabla Ltd. and from you and me personally (due to unresolved + ownership and the remaining payments Nabla Ltd. needs to make to us + regarding the original transfer of copyright). I can offer a number + of solutions acceptable to me as follows: + + 1) no Copyright statement apart from the required GPL statement + 2) Copyright OpenFOAM.org + 3) Copyright Henry Weller, Hrvoje Jasak et al + 4) Copyright OpenCFD and Hrvoje Jasak + 5) List of authors instead of the copyright statement + + I am also prepared to consider any other reasonable ideas along the same + lines (including the sale of copyright, which would be a bit pointless + at this stage) - please advise. + + + 02/17/2005 11:09 PM + + Under the GPL there has to be an organization in place to enforce the GPL + if there are violation, these are part of the rules. OpenCFD undertakes + that responsibility hence the copyright. + + Henry G. Weller + Managing Director + + + 12 November 2010 + + From the above it is clear that OpenCFD does not own the rights or + authorship of the source code, which is currently concealed in public. + For further details, I have been attempting to get a formal response by + this company for 6 years now, without success. It is time to move on. + + The current Copyright notice does not fairly describe the authorship of + the software. In the spirit of the open source development model, the + -Extend project wishes to formally acknowledge all contributors and + developers of OpenFOAM from its inception to today. + + As this issue still remains unresolved, and the list of contributors + has been removed from the OpenFOAM source code by Mr. Weller in 2006, + we shall re-base OpenFOAM as an Open Source community-based project + and associate the authorship and Copyright in each case with the + original author. + + Hrvoje Jasak + + +This offering is not affiliated with OpenCFD Limited, owner of the OpenFOAM +trade mark. + + +Please find the official website of OpenCFD Limited at http://www.openfoam.org +In particular, OpenCFD Limited hosts the following legal statements: +- licensing and intellectual property: http://www.openfoam.com/legal/index.php +- trademark policy: http://www.openfoam.com/legal/trademark-policy.php diff --git a/HowToContribute b/HowToContribute index 674db4a5f..9c2f9f4b2 100644 --- a/HowToContribute +++ b/HowToContribute @@ -10,7 +10,7 @@ git Repository: Henrik Rusche (h.rusche@wikki.co.uk) Martin Beaudoin (beaudoin.martin@ireq.ca) 1. SourceForge Access - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ To make contributions to the -extend project, you should first obtain an account at SourceForge.net. (SourceForge will suggest a username @@ -46,7 +46,7 @@ git Repository: Henrik Rusche (h.rusche@wikki.co.uk) The article listed above should be considered mandatory reading material for those planning to make contributions to the repository. Some links about - the general usage of GIT can be found in Section 8. + the general usage of GIT can be found in Section 8. Please do not hesitate to ask one of the "git Repository" contacts at the top of this document if you are not sure about specific operation relative to the git @@ -81,14 +81,14 @@ git Repository: Henrik Rusche (h.rusche@wikki.co.uk) + git checkout -b my-feature-branch Feature branches should be named after the fix or feature that they contain, - *not* named after the author. There may be more than one author, after all, and + *not* named after the author. There may be more than one author, after all, and this information is recorded in the commit anyway. As an example, a bug fix to the mesquite package should be committed to a branch named "hotfix/mesquite". Carefully organized commits and branches, clear commit messages, and well-chosen branch names will make it easier for the release committee to review and merge - each contribution. - + each contribution. + When you have a feature branch that is ready to be merged, push it to the server using a command such as this: @@ -125,7 +125,7 @@ git Repository: Henrik Rusche (h.rusche@wikki.co.uk) The feature branches provided by users will be merged by the release committee into an integration branch called "nextRelease", and then both the local - and remote copy of the feature branch will be deleted. The merge will be performed + and remote copy of the feature branch will be deleted. The merge will be performed using a "git merge --no-ff" command, which forces the creation of a merge commit even in the case where the merge could be accomplished by fast-forward. Note that the automated test loop will be run off of this integration branch. @@ -136,7 +136,7 @@ git Repository: Henrik Rusche (h.rusche@wikki.co.uk) and hotfixes. Note that hotfixes should be branched off of the master branch and should be merged - twice - once into the integration branch and once into the master branch - in order to + twice - once into the integration branch and once into the master branch - in order to guarantee that a merge of the integration branch into the master branch can be accomplished by a fast-forward. diff --git a/README b/README index f540fcd00..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 @@ -93,7 +93,7 @@ of the OpenFOAM installation. * Building the ThirdParty packages from Sources - A new way of compiling and installing the ThirdParty suite of packages is proposed with OpenFOAM-1.6-ext. + A new way of compiling and installing the ThirdParty suite of packages is proposed with OpenFOAM-1.6-ext. Please consult the file ThirdParty/README.ThirdParty a for more information. * Building from Sources (Optional) @@ -154,7 +154,7 @@ * Reporting Bugs in OpenFOAM Please report all bugs and feature requests using our bug tracking system: - http://sourceforge.net/apps/mantisbt/openfoam-extend/main_page.php or + http://sourceforge.net/apps/mantisbt/openfoam-extend/main_page.php or http://www.extend-project.de/project-final/openfoam-extend-bug-tracker Please also report bugs at the CFD-Online User Forum. @@ -188,7 +188,7 @@ David Hill Niklas Wikstrom Dubravko Matijasevic - Darrin Stephens + Darrin Stephens Christian Beck Oliver Borm James Criner diff --git a/ReleaseNotes-1.6-ext b/ReleaseNotes-1.6-ext index ab014f87c..ed1fb84b4 100644 --- a/ReleaseNotes-1.6-ext +++ b/ReleaseNotes-1.6-ext @@ -1,84 +1,84 @@ -# -*- mode: org; -*- -# -#+TITLE: *OpenFOAM release notes for version 1.6-ext* -#+AUTHOR: Hrvoje Jasak. -#+DATE: 12 November 2010 -#+LINK: http://www.extend-project.de -#+OPTIONS: author:nil - -* Overview - OpenFOAM-1.6-ext is a formal release of the community developments in the - OpenFOAM software library, following the establishment of the -Extend Project - and web portal. - - This release includes many improvements, including an automatic test harness - which provides basic quality control by running OpenFOAM over a growing - suite of tutorials and test cases. - -* Compatibility - OpenFOAM-1.6-ext is compatible with the OpenFOAM-1.6.x and 1.7.1 versions - of the code and incorporate most developments and changes from above versions - and ensure top-level compatibility. In some cases, the differences are - caused by bug fixes and algorithmic improvements, considered more important - than inter-operability. - - The list of developments is a result of the work of numerous contributors. - The Extend Project Admins would formally like to thank all contributors; - the list will be updated with further code development - -* Fundamental developments - Improvements in accuracy and stability on tetrahedral and tet-dominant meshes - Implicit coupled multi-domain solver - Block-implicit multi-equation matrix support - Proper Orthogonal Decomposition (POD) data analysis tools - Rewrite of Ordinary Differential Equation (ODE) and ODE solver classes - Dynamic remeshing classes, based on tetrahedral edge swapping - Radial Basis Function interpolation and mesh motion classes - Turbomachinery features: GGI interface, cyclic GGI, partial overlap GGI - Parallelisation of topological change engine - Support for parallelisation and topological changes in the Finite Area Method - Library preparation for Python/Swig interface for OpenFOAM: VulaSHAKA project - (http://sourceforge.net/projects/vulashaka/) - Basic implementation of OpenMP wrapping for multi-core support - -* Ongoing developments - This section lists the applications that existed in versions of OpenFOAM - but were abandoned by OpenCFD due to lack of expertise. In some cases, code - may still be present but it is buggy or unusable. The -Extend project line - maintains, validates and develops the features in contact with original - authors and contributes new features and bug fixes. - - Working parallel point mesh and field tools, shared between interpolation - and FEM discretisation solvers - FEM-based automatic mesh motion solver, with working parallelisation - Dynamic mesh features and topological mesh changes - The Finite Area Method: parallelisation, volume-to-surface mapping - New generation of linear equation solvers, including accelerated AMG - -* Developments to solvers (applications) - Basic 6-degree-of-freedom (6-DOF) solver - POD solver tools: prototype - Demonstration solver for fully implicit block-matrix coupling - -* Developments to utilities - New parallel decomposition and reconstruction formulation, with support - for topologically changing meshes - Level-set support tools - -* Model development - Transport models and top-level solver for visco-elasto-plastic flows - Updates to internal combustion engine simulation tools - Updated version of free surface tracking tools for free surface flows - Updated fluid-structure interaction solver with parallelisation support - Updated stress analysis tools, new large deformation solver formulation - -* Quality Control - Integrated automatic and publicly available test harness with ~150 cases - http://openfoam-extend.sourceforge.net/CDash/index.php - Community-driven test-case base to enhance code quality and integrity. - Contributions under - http://www.extend-project.de/project-final/openfoam-extend-test-harness - -* Other - The number of cumulative bug fixes compared to OpenFOAM-1.6.x is over - 5000; we will stop counting. +# -*- mode: org; -*- +# +#+TITLE: *OpenFOAM release notes for version 1.6-ext* +#+AUTHOR: Hrvoje Jasak. +#+DATE: 12 November 2010 +#+LINK: http://www.extend-project.de +#+OPTIONS: author:nil + +* Overview + OpenFOAM-1.6-ext is a formal release of the community developments in the + OpenFOAM software library, following the establishment of the -Extend Project + and web portal. + + This release includes many improvements, including an automatic test harness + which provides basic quality control by running OpenFOAM over a growing + suite of tutorials and test cases. + +* Compatibility + OpenFOAM-1.6-ext is compatible with the OpenFOAM-1.6.x and 1.7.1 versions + of the code and incorporate most developments and changes from above versions + and ensure top-level compatibility. In some cases, the differences are + caused by bug fixes and algorithmic improvements, considered more important + than inter-operability. + + The list of developments is a result of the work of numerous contributors. + The Extend Project Admins would formally like to thank all contributors; + the list will be updated with further code development + +* Fundamental developments + Improvements in accuracy and stability on tetrahedral and tet-dominant meshes + Implicit coupled multi-domain solver + Block-implicit multi-equation matrix support + Proper Orthogonal Decomposition (POD) data analysis tools + Rewrite of Ordinary Differential Equation (ODE) and ODE solver classes + Dynamic remeshing classes, based on tetrahedral edge swapping + Radial Basis Function interpolation and mesh motion classes + Turbomachinery features: GGI interface, cyclic GGI, partial overlap GGI + Parallelisation of topological change engine + Support for parallelisation and topological changes in the Finite Area Method + Library preparation for Python/Swig interface for OpenFOAM: VulaSHAKA project + (http://sourceforge.net/projects/vulashaka/) + Basic implementation of OpenMP wrapping for multi-core support + +* Ongoing developments + This section lists the applications that existed in versions of OpenFOAM + but were abandoned by OpenCFD due to lack of expertise. In some cases, code + may still be present but it is buggy or unusable. The -Extend project line + maintains, validates and develops the features in contact with original + authors and contributes new features and bug fixes. + + Working parallel point mesh and field tools, shared between interpolation + and FEM discretisation solvers + FEM-based automatic mesh motion solver, with working parallelisation + Dynamic mesh features and topological mesh changes + The Finite Area Method: parallelisation, volume-to-surface mapping + New generation of linear equation solvers, including accelerated AMG + +* Developments to solvers (applications) + Basic 6-degree-of-freedom (6-DOF) solver + POD solver tools: prototype + Demonstration solver for fully implicit block-matrix coupling + +* Developments to utilities + New parallel decomposition and reconstruction formulation, with support + for topologically changing meshes + Level-set support tools + +* Model development + Transport models and top-level solver for visco-elasto-plastic flows + Updates to internal combustion engine simulation tools + Updated version of free surface tracking tools for free surface flows + Updated fluid-structure interaction solver with parallelisation support + Updated stress analysis tools, new large deformation solver formulation + +* Quality Control + Integrated automatic and publicly available test harness with ~150 cases + http://openfoam-extend.sourceforge.net/CDash/index.php + Community-driven test-case base to enhance code quality and integrity. + Contributions under + http://www.extend-project.de/project-final/openfoam-extend-test-harness + +* Other + The number of cumulative bug fixes compared to OpenFOAM-1.6.x is over + 5000; we will stop counting. diff --git a/applications/solvers/basic/sixDOFSolver/sixDOFSolver.C b/applications/solvers/basic/sixDOFSolver/sixDOFSolver.C index b6be6d139..ea3636ff0 100644 --- a/applications/solvers/basic/sixDOFSolver/sixDOFSolver.C +++ b/applications/solvers/basic/sixDOFSolver/sixDOFSolver.C @@ -62,12 +62,12 @@ int main(int argc, char *argv[]) forAll (structure.names(), bodyI) { - Info<< nl << "Average velocity of " << structure.names()[bodyI] + Info<< nl << "Average velocity of " << structure.names()[bodyI] << " in time step = " << structure()[bodyI].Uaverage().value() << nl << "Current velocity in time instant = " << structure()[bodyI].U().value() << nl - << "Average omega of " << structure.names()[bodyI] + << "Average omega of " << structure.names()[bodyI] << " in time step = " << structure()[bodyI].omegaAverage().value() << nl << "Current omega in time instant = " diff --git a/applications/solvers/combustion/PDRFoam/XiEqns b/applications/solvers/combustion/PDRFoam/XiEqns index bd5ca3066..8de3bffe4 100644 --- a/applications/solvers/combustion/PDRFoam/XiEqns +++ b/applications/solvers/combustion/PDRFoam/XiEqns @@ -22,7 +22,7 @@ volScalarField GEta = GEtaCoef/tauEta; volScalarField XiEqEta = 1.0 + XiCoef*sqrt(up/(Su + SuMin))*Reta; - volScalarField R = + volScalarField R = GEta*XiEqEta/(XiEqEta - 0.999) + GIn*XiIn/(XiIn - 0.999); volScalarField XiEqStar = R/(R - GEta - GIn); @@ -42,7 +42,7 @@ volScalarField GEta = GEtaCoef/tauEta; volScalarField XiEqEta = 1.0 + XiCoef*sqrt(up/(Su + SuMin))*Reta; - volScalarField R = + volScalarField R = GEta*XiEqEta/(XiEqEta - 0.999) + GIn*XiIn/(XiIn - 0.999); volScalarField XiEqStar = R/(R - GEta - GIn); diff --git a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C index cfa992f77..b705c5efb 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C @@ -91,7 +91,7 @@ bool Foam::XiModels::algebraic::read(const dictionary& XiProperties) XiModel::read(XiProperties); XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef; - + return true; } diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index cb67681f0..adfb9ceff 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C @@ -117,7 +117,7 @@ inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::polyPhi { scalar x = phi - 1.0; - return + return a[0] *( scalar(1) diff --git a/applications/solvers/combustion/PDRFoam/setDeltaT.H b/applications/solvers/combustion/PDRFoam/setDeltaT.H index 707ccceef..c906d9a39 100644 --- a/applications/solvers/combustion/PDRFoam/setDeltaT.H +++ b/applications/solvers/combustion/PDRFoam/setDeltaT.H @@ -45,7 +45,7 @@ if (adjustTimeStep) maxDeltaT ) ); - + Info<< "deltaT = " << runTime.deltaT().value() << endl; } diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/applications/solvers/compressible/rhoCentralFoam/Allwmake index 698558da0..5f01d96a7 100755 --- a/applications/solvers/compressible/rhoCentralFoam/Allwmake +++ b/applications/solvers/compressible/rhoCentralFoam/Allwmake @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso BCs +wmake libso BCs wmake # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C b/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C index 4f025b504..8ff886333 100644 --- a/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C +++ b/applications/solvers/compressible/rhoSonicFoam/rhoSonicFoam.C @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) ( fvm::ddt(rhoU) + fvm::div(phiv, rhoU) - == + == - fvc::grad(p) ); diff --git a/applications/solvers/compressible/rhopSonicFoam/Allwmake b/applications/solvers/compressible/rhopSonicFoam/Allwmake index 698558da0..5f01d96a7 100755 --- a/applications/solvers/compressible/rhopSonicFoam/Allwmake +++ b/applications/solvers/compressible/rhopSonicFoam/Allwmake @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso BCs +wmake libso BCs wmake # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhopSonicFoam/BCs/p/inviscidWallPFvPatchScalarField.C b/applications/solvers/compressible/rhopSonicFoam/BCs/p/inviscidWallPFvPatchScalarField.C index aea2e1df5..1f06a0fa5 100644 --- a/applications/solvers/compressible/rhopSonicFoam/BCs/p/inviscidWallPFvPatchScalarField.C +++ b/applications/solvers/compressible/rhopSonicFoam/BCs/p/inviscidWallPFvPatchScalarField.C @@ -131,7 +131,7 @@ void inviscidWallPFvPatchScalarField::updateCoeffs() const fvPatchField& rhoUp = lookupPatchField("rhoU"); - const fvsPatchField& phip = + const fvsPatchField& phip = lookupPatchField("phi"); const fvsPatchField& rAp = @@ -147,7 +147,7 @@ void inviscidWallPFvPatchScalarField::updateCoeffs() void inviscidWallPFvPatchScalarField::write(Ostream& os) const { fixedGradientFvPatchScalarField::write(os); - os.writeKeyword("fluxFraction") + os.writeKeyword("fluxFraction") << fluxFraction_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/applications/solvers/compressible/rhopSonicFoam/BCs/rhoE/mixedRhoEFvPatchScalarField.C b/applications/solvers/compressible/rhopSonicFoam/BCs/rhoE/mixedRhoEFvPatchScalarField.C index 06f94d262..e992d722a 100644 --- a/applications/solvers/compressible/rhopSonicFoam/BCs/rhoE/mixedRhoEFvPatchScalarField.C +++ b/applications/solvers/compressible/rhopSonicFoam/BCs/rhoE/mixedRhoEFvPatchScalarField.C @@ -145,7 +145,7 @@ void mixedRhoEFvPatchScalarField::updateCoeffs() const volScalarField& T = db().lookupObject("T"); const label patchi = patch().index(); - fvPatchScalarField& Tp = + fvPatchScalarField& Tp = const_cast(T.boundaryField()[patchi]); Tp.evaluate(); @@ -164,7 +164,7 @@ void mixedRhoEFvPatchScalarField::updateCoeffs() refGrad() = rhop*Cv.value()*Tp.snGrad() + ( - refValue() + refValue() - (0.5*rhop.patchInternalField()* magSqr(rhoUp.patchInternalField()/rhop.patchInternalField())) )*patch().deltaCoeffs(); diff --git a/applications/solvers/compressible/rhopSonicFoam/BCs/rhoU/fixedRhoUFvPatchVectorField.H b/applications/solvers/compressible/rhopSonicFoam/BCs/rhoU/fixedRhoUFvPatchVectorField.H index 0eb667cab..57030daf2 100644 --- a/applications/solvers/compressible/rhopSonicFoam/BCs/rhoU/fixedRhoUFvPatchVectorField.H +++ b/applications/solvers/compressible/rhopSonicFoam/BCs/rhoU/fixedRhoUFvPatchVectorField.H @@ -66,7 +66,7 @@ public: const dictionary& ); - //- Construct by mapping given fixedRhoUFvPatchVectorField + //- Construct by mapping given fixedRhoUFvPatchVectorField // onto a new patch fixedRhoUFvPatchVectorField ( diff --git a/applications/solvers/coupled/conjugateHeatFoam/Make/files b/applications/solvers/coupled/conjugateHeatFoam/Make/files index 4a3cb8acf..18d6456ca 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/Make/files +++ b/applications/solvers/coupled/conjugateHeatFoam/Make/files @@ -1,3 +1,3 @@ -conjugateHeatFoam.C +conjugateHeatFoam.C EXE = $(FOAM_APPBIN)/conjugateHeatFoam diff --git a/applications/solvers/electromagnetics/electrostaticFoam/Make/files b/applications/solvers/electromagnetics/electrostaticFoam/Make/files index 073ad4cd7..d5cb4f139 100644 --- a/applications/solvers/electromagnetics/electrostaticFoam/Make/files +++ b/applications/solvers/electromagnetics/electrostaticFoam/Make/files @@ -1,3 +1,3 @@ -electrostaticFoam.C +electrostaticFoam.C EXE = $(FOAM_APPBIN)/electrostaticFoam diff --git a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C index 5dfd54f0d..ea4f934be 100644 --- a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C +++ b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) U = rUA*UEqn.H(); - phi = (fvc::interpolate(U) & mesh.Sf()) + phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) diff --git a/applications/solvers/engine/icoDyMEngineFoam/createFields.H b/applications/solvers/engine/icoDyMEngineFoam/createFields.H index e885cdf93..52faaaaa0 100644 --- a/applications/solvers/engine/icoDyMEngineFoam/createFields.H +++ b/applications/solvers/engine/icoDyMEngineFoam/createFields.H @@ -83,6 +83,6 @@ momentumPredictor = false; # include "UEqn.H" momentumPredictor = momentumPredictorSave; - + rUA = 1.0/UEqn.A(); } diff --git a/applications/solvers/engine/icoDyMEngineFoam/meshCourantNo.H b/applications/solvers/engine/icoDyMEngineFoam/meshCourantNo.H index eec8feee1..21f3de5b5 100644 --- a/applications/solvers/engine/icoDyMEngineFoam/meshCourantNo.H +++ b/applications/solvers/engine/icoDyMEngineFoam/meshCourantNo.H @@ -35,7 +35,7 @@ scalar meanMeshCoNum = 0.0; if (mesh.nInternalFaces()) { - surfaceScalarField SfUfbyDelta = + surfaceScalarField SfUfbyDelta = mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi()); meshCoNum = max(SfUfbyDelta/mesh.magSf()) diff --git a/applications/solvers/engine/sonicTurbDyMEngineFoam/compressibleCorrectPhi.H b/applications/solvers/engine/sonicTurbDyMEngineFoam/compressibleCorrectPhi.H index e28a92438..f71258e73 100644 --- a/applications/solvers/engine/sonicTurbDyMEngineFoam/compressibleCorrectPhi.H +++ b/applications/solvers/engine/sonicTurbDyMEngineFoam/compressibleCorrectPhi.H @@ -28,7 +28,7 @@ pcorr.oldTime() == p.oldTime(); phi = fvc::interpolate(rho) - *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); + *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { @@ -43,7 +43,7 @@ if (nonOrth == nNonOrthCorr) { - phi += pcorrEqn.flux(); + phi += pcorrEqn.flux(); } } } diff --git a/applications/solvers/engine/turbDyMEngineFoam/meshCourantNo.H b/applications/solvers/engine/turbDyMEngineFoam/meshCourantNo.H index eec8feee1..21f3de5b5 100644 --- a/applications/solvers/engine/turbDyMEngineFoam/meshCourantNo.H +++ b/applications/solvers/engine/turbDyMEngineFoam/meshCourantNo.H @@ -35,7 +35,7 @@ scalar meanMeshCoNum = 0.0; if (mesh.nInternalFaces()) { - surfaceScalarField SfUfbyDelta = + surfaceScalarField SfUfbyDelta = mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi()); meshCoNum = max(SfUfbyDelta/mesh.magSf()) diff --git a/applications/solvers/equationReader/equationReaderDemo/equationReaderDemo.C b/applications/solvers/equationReader/equationReaderDemo/equationReaderDemo.C index 263201aed..decb8e75e 100644 --- a/applications/solvers/equationReader/equationReaderDemo/equationReaderDemo.C +++ b/applications/solvers/equationReader/equationReaderDemo/equationReaderDemo.C @@ -28,7 +28,7 @@ Application Description Sample application testing the equationReader extension, and demonstrating its use. - + Author David L. F. Gaden @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) Info << "Reading equation b from testDict, linking an output variable" << endl; eqns.readEquation(testDict, "b", activeOutB); - + Info << "Output variable before update() = " << activeOutB << endl; Info << "Begining .update() - this evaluates all equations with active " << "output..." << endl; @@ -161,11 +161,11 @@ int main(int argc, char *argv[]) Info << "done. Evaluating equation f ... "; passiveOutF = eqns.evaluate("f"); Info << "done." << token::NL << "The result is: " << passiveOutF << endl; - + Info << token::NL << "Creating output..." << endl; OFstream os(path/"outputDict"); os << eqns; eqns.dataSourceStatus(os); - + return(0); } diff --git a/applications/solvers/equationReader/equationReaderTester/equationReaderTester.C b/applications/solvers/equationReader/equationReaderTester/equationReaderTester.C index becb0cc04..db912f62e 100644 --- a/applications/solvers/equationReader/equationReaderTester/equationReaderTester.C +++ b/applications/solvers/equationReader/equationReaderTester/equationReaderTester.C @@ -28,7 +28,7 @@ Application Description Sample application testing the equationReader in a finite volume solver environment. - + Author David L. F. Gaden @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) eqns.addDataSource(Sj, "Sj"); eqns.addDataSource(Sk, "Sk"); eqns.addDataSource(Sl, "Sl"); - + label listIndex(0); eqns.addDataSource(p); eqns.addDataSource(dummy); @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) scalar saD(readScalar(testDict1.lookup("saD"))); scalar saE(readScalar(testDict1.lookup("saE"))); scalar saF(readScalar(testDict1.lookup("saF"))); - + dimensionedScalar dsaA(testDict1.lookup("dsaA")); dimensionedScalar dsaB(testDict1.lookup("dsaB")); dimensionedScalar dsaC(testDict1.lookup("dsaC")); @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; DStime.value() = runTime.value(); - + Info << "Moving p index to "; listIndex++; if (listIndex == p.size()) @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); - phi = (fvc::interpolate(U) & mesh.Sf()) + phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi); adjustPhi(phi, U, p); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H index 3bded31e1..a088b9d34 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H @@ -71,7 +71,7 @@ class solidWallMixedTemperatureCoupledFvPatchScalarField //- Name of field on the neighbour region const word neighbourFieldName_; - + //- Name of thermal conductivity field const word KName_; diff --git a/applications/solvers/incompressible/icoDyMFoam/createFields.H b/applications/solvers/incompressible/icoDyMFoam/createFields.H index 561cd7bf4..9c918b565 100644 --- a/applications/solvers/incompressible/icoDyMFoam/createFields.H +++ b/applications/solvers/incompressible/icoDyMFoam/createFields.H @@ -85,6 +85,6 @@ momentumPredictor = false; # include "UEqn.H" momentumPredictor = momentumPredictorSave; - + rAU = 1.0/UEqn.A(); } diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H index 561cd7bf4..9c918b565 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H @@ -85,6 +85,6 @@ momentumPredictor = false; # include "UEqn.H" momentumPredictor = momentumPredictorSave; - + rAU = 1.0/UEqn.A(); } diff --git a/applications/solvers/incompressible/icoFoam/Make/files b/applications/solvers/incompressible/icoFoam/Make/files index 964e46e15..f1564ba48 100644 --- a/applications/solvers/incompressible/icoFoam/Make/files +++ b/applications/solvers/incompressible/icoFoam/Make/files @@ -1,3 +1,3 @@ -icoFoam.C +icoFoam.C EXE = $(FOAM_APPBIN)/icoFoam diff --git a/applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files b/applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files index ad5215ffd..8b68719cc 100644 --- a/applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files +++ b/applications/solvers/incompressible/nonNewtonianIcoFoam/Make/files @@ -1,3 +1,3 @@ -nonNewtonianIcoFoam.C +nonNewtonianIcoFoam.C EXE = $(FOAM_APPBIN)/nonNewtonianIcoFoam diff --git a/applications/solvers/incompressible/simpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/Make/files index 22ef53883..693d26fd8 100644 --- a/applications/solvers/incompressible/simpleFoam/Make/files +++ b/applications/solvers/incompressible/simpleFoam/Make/files @@ -1,3 +1,3 @@ -simpleFoam.C +simpleFoam.C EXE = $(FOAM_APPBIN)/simpleFoam diff --git a/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C b/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C index c12a074ab..83a48db6e 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C +++ b/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) # include "solverScalarTransportFoam.H" multiRun++; - + // * * * * * * * * * * * * * * * * icoFoam2 * * * * * * * * * * * * * * * * // Info << "*** Switching to icoFoam2 ***\n" << endl; diff --git a/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H b/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H index f62ba240e..1fedb60d0 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H +++ b/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H @@ -31,7 +31,7 @@ volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); - phi = (fvc::interpolate(U) & mesh.Sf()) + phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi); adjustPhi(phi, U, p); diff --git a/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H b/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H index 6f1622510..c5e93c7ef 100644 --- a/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H +++ b/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H @@ -3,12 +3,12 @@ dimensionedScalar totalMass = fvc::domainIntegrate(rho); - scalar sumLocalContErr = + scalar sumLocalContErr = ( fvc::domainIntegrate(mag(rho - thermoRho))/totalMass ).value(); - scalar globalContErr = + scalar globalContErr = ( fvc::domainIntegrate(rho - thermoRho)/totalMass ).value(); diff --git a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H index 9233804c4..95e0c4fa1 100644 --- a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H +++ b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H @@ -47,7 +47,7 @@ if (adjustTimeStep) maxDeltaT ) ); - + Info<< "deltaT = " << runTime.deltaT().value() << endl; } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/alphaContactAngle/alphaContactAngleFvPatchScalarField.C index bd209f4b5..91967aeb5 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/alphaContactAngle/alphaContactAngleFvPatchScalarField.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/alphaContactAngle/alphaContactAngleFvPatchScalarField.C @@ -63,7 +63,7 @@ Ostream& operator<< ) { os << tp.theta0_ << token::SPACE - << tp.uTheta_ << token::SPACE + << tp.uTheta_ << token::SPACE << tp.thetaA_ << token::SPACE << tp.thetaR_; diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 62f40a821..01154f4a2 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -166,13 +166,13 @@ Foam::tmp Foam::multiphaseMixture::muf() const { PtrDictionary::const_iterator iter = phases_.begin(); - tmp tmuf = + tmp tmuf = fvc::interpolate(iter().limitedAlpha())*iter().rho()* fvc::interpolate(iter().nu()); for(++iter; iter != phases_.end(); ++iter) { - tmuf() += + tmuf() += fvc::interpolate(iter().limitedAlpha())*iter().rho()* fvc::interpolate(iter().nu()); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C index a726a75d8..4af2f36e9 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C @@ -28,7 +28,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::phase::phase +Foam::phase::phase ( const word& name, const dictionary& phaseDict, diff --git a/applications/solvers/multiphase/porousInterFoam/createPorousZones.H b/applications/solvers/multiphase/porousInterFoam/createPorousZones.H index 37e26b34e..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, @@ -19,14 +19,14 @@ forAll( pZones, zoneI ) { const label & zoneId( pZones[zoneI].zoneId() ); - + const labelList & cells(mesh.cellZones()[zoneId]); const scalar & zonePorosity( pZones[zoneI].porosity() ); forAll( cells, cellI ) { - porosity[cells[cellI]] = zonePorosity; + porosity[cells[cellI]] = zonePorosity; } } diff --git a/applications/solvers/multiphase/settlingFoam/correctViscosity.H b/applications/solvers/multiphase/settlingFoam/correctViscosity.H index 0c22a12ea..ddc539dcd 100644 --- a/applications/solvers/multiphase/settlingFoam/correctViscosity.H +++ b/applications/solvers/multiphase/settlingFoam/correctViscosity.H @@ -1,5 +1,5 @@ { - mul = muc + + mul = muc + plasticViscosity ( plasticViscosityCoeff, diff --git a/applications/solvers/multiphase/settlingFoam/kEpsilon.H b/applications/solvers/multiphase/settlingFoam/kEpsilon.H index 0c0930dd1..67dbfc7b5 100644 --- a/applications/solvers/multiphase/settlingFoam/kEpsilon.H +++ b/applications/solvers/multiphase/settlingFoam/kEpsilon.H @@ -26,7 +26,7 @@ if(turbulence) + fvm::div(phi, epsilon) - fvm::laplacian ( - alphaEps*mut + mul, epsilon, + alphaEps*mut + mul, epsilon, "laplacian(DepsilonEff,epsilon)" ) == diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options index 78af0f414..8ddc2ab0b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options @@ -6,7 +6,7 @@ EXE_INC = \ -IinterfacialModels/lnInclude \ -IphaseModel/lnInclude \ -Iaveraging - + EXE_LIBS = \ -lEulerianInterfacialModels \ -lfiniteVolume \ diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H index 93593196a..9f0417045 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/UEqns.H @@ -56,7 +56,7 @@ fvVectorMatrix UbEqn(Ub, Ub.dimensions()*dimVol/dimTime); -fvc::interpolate(nuEffb)*mesh.magSf()*fvc::snGrad(beta) /fvc::interpolate(beta + scalar(0.001)); - UbEqn = + UbEqn = ( (scalar(1) + Cvm*rhob*alpha/rhob)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C index a8de3ea2b..d52f7ec6e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C @@ -83,7 +83,7 @@ Foam::tmp Foam::GidaspowErgunWenYu::K Cds[celli] = 0.44; } } - + // Wen and Yu (1966) tmp tKWenYu = 0.75*Cds*phaseb_.rho()*Ur*bp/phasea_.d(); volScalarField& KWenYu = tKWenYu(); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C index a575614be..54f03d530 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/dragModels/dragModel/newDragModel.C @@ -41,7 +41,7 @@ Foam::autoPtr Foam::dragModel::New interfaceDict.lookup("dragModel" + phasea.name()) ); - Info << "Selecting dragModel for phase " + Info << "Selecting dragModel for phase " << phasea.name() << ": " << dragModelType << endl; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C index e357ad713..75b17320d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C @@ -75,7 +75,7 @@ Foam::tmp Foam::GidaspowConductivity::kappa ( 2.0*sqr(alpha)*g0*(1.0 + e)/sqrtPi + (9.0/8.0)*sqrtPi*g0*0.5*(1.0 + e)*sqr(alpha) - + (15.0/16.0)*sqrtPi*alpha + + (15.0/16.0)*sqrtPi*alpha + (25.0/64.0)*sqrtPi/((1.0 + e)*g0) ); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index deea98f09..fc4fd6914 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C @@ -76,7 +76,7 @@ Foam::tmp Foam::HrenyaSinclairConductivity::kappa { const scalar sqrtPi = sqrt(mathematicalConstant::pi); - volScalarField lamda = + volScalarField lamda = scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_; return rhoa*da*sqrt(Theta)* diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C index a138e2bd4..d0f25d9c9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/conductivityModel/newConductivityModel.C @@ -35,9 +35,9 @@ Foam::autoPtr Foam::conductivityModel::New { word conductivityModelType(dict.lookup("conductivityModel")); - Info<< "Selecting conductivityModel " + Info<< "Selecting conductivityModel " << conductivityModelType << endl; - + dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(conductivityModelType); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index f7ff84669..821ce51be 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -73,7 +73,7 @@ frictionalPressure ) const { - return + return Fr*pow(max(alpha - alphaMinFriction, scalar(0)), eta) /pow(max(alphaMax - alpha, scalar(5.0e-2)), p); } @@ -104,9 +104,9 @@ Foam::tmp Foam::JohnsonJacksonFrictionalStress::muf const dimensionedScalar& alphaMax, const volScalarField& pf, const volTensorField& D, - const dimensionedScalar& phi + const dimensionedScalar& phi ) const -{ +{ return dimensionedScalar("0.5", dimTime, 0.5)*pf*sin(phi); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C index 648e4a935..007226bbc 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C @@ -35,9 +35,9 @@ Foam::autoPtr Foam::frictionalStressModel::New { word frictionalStressModelType(dict.lookup("frictionalStressModel")); - Info<< "Selecting frictionalStressModel " + Info<< "Selecting frictionalStressModel " << frictionalStressModelType << endl; - + dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(frictionalStressModelType); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C index c4175d429..a69867eab 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/granularPressureModel/granularPressureModel/newGranularPressureModel.C @@ -35,9 +35,9 @@ Foam::autoPtr Foam::granularPressureModel::New { word granularPressureModelType(dict.lookup("granularPressureModel")); - Info<< "Selecting granularPressureModel " + Info<< "Selecting granularPressureModel " << granularPressureModelType << endl; - + dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(granularPressureModelType); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C index 4d663a2c5..12d8810f6 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C @@ -65,7 +65,7 @@ Foam::tmp Foam::CarnahanStarlingRadial::g0 ) const { - return + return 1.0/(1.0 - alpha) + 3.0*alpha/(2.0*sqr(1.0 - alpha)) + sqr(alpha)/(2.0*pow(1.0 - alpha, 3)); @@ -78,8 +78,8 @@ Foam::tmp Foam::CarnahanStarlingRadial::g0prime const dimensionedScalar& alphaMax ) const { - return - - alpha/sqr(1.0 - alpha) + return + - alpha/sqr(1.0 - alpha) + (3.0*(1.0 - alpha) + 6.0*sqr(alpha))/(2.0*(1.0 - alpha)) + (2.0*alpha*(1.0 - alpha) + 3.0*pow(alpha, 3)) /(2.0*pow(1.0 - alpha, 4)); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/Gidaspow/GidaspowRadial.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/Gidaspow/GidaspowRadial.C index 07dc32ee0..8aad9f39f 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/Gidaspow/GidaspowRadial.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/Gidaspow/GidaspowRadial.C @@ -74,7 +74,7 @@ Foam::tmp Foam::GidaspowRadial::g0prime const dimensionedScalar& alphaMax ) const { - return + return (-1.0/5.0)*pow(alpha/alphaMax, -2.0/3.0) /(alphaMax*sqr(1.0 - pow(alpha/alphaMax, 1.0/3.0))); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C index c9c870b02..652971a2b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C @@ -74,7 +74,7 @@ Foam::tmp Foam::SinclairJacksonRadial::g0prime const dimensionedScalar& alphaMax ) const { - return + return (-1.0/3.0)*pow(alpha/alphaMax, -2.0/3.0) /(alphaMax*sqr(1.0 - pow(alpha/alphaMax, 1.0/3.0))); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C index 2722fece0..832898495 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/radialModel/radialModel/newRadialModel.C @@ -35,9 +35,9 @@ Foam::autoPtr Foam::radialModel::New { word radialModelType(dict.lookup("radialModel")); - Info<< "Selecting radialModel " + Info<< "Selecting radialModel " << radialModelType << endl; - + dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(radialModelType); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H index ad4874551..ade4ce0b3 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H @@ -42,7 +42,7 @@ phib = (fvc::interpolate(Ub) & mesh.Sf()) + fvc::ddtPhiCorr(rUbA, Ub, phib) + phiDragb; - + phi = alphaf*phia + betaf*phib; surfaceScalarField Dp("(rho*(1|A(U)))", alphaf*rUaAf/rhoa + betaf*rUbAf/rhob); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/packingLimiter.H b/applications/solvers/multiphase/twoPhaseEulerFoam/packingLimiter.H index 457e476b2..ba6dcf7ce 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/packingLimiter.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/packingLimiter.H @@ -14,12 +14,12 @@ // Initializing neighbouring cells contribution scalar neighboursEx = 0.0; - + forAll (neighbourCell, cellj) { labelList neighboursNeighbour = neighbour[neighbourCell[cellj]]; scalar neighboursNeighbourCellVolumes = 0.0; - + forAll (neighboursNeighbour, cellk) { neighboursNeighbourCellVolumes += diff --git a/applications/solvers/newStressAnalysis/materialModels/Make/files b/applications/solvers/newStressAnalysis/materialModels/Make/files index 5b798f25b..63dde3fe5 100644 --- a/applications/solvers/newStressAnalysis/materialModels/Make/files +++ b/applications/solvers/newStressAnalysis/materialModels/Make/files @@ -16,7 +16,7 @@ $(rheologyLaws)/PronyViscoelastic/PronyViscoelastic.C thermalModel/thermalModel.C thermalLaws = thermalModel/thermalLaws -$(thermalLaws)/thermalLaw/thermalLaw.C +$(thermalLaws)/thermalLaw/thermalLaw.C $(thermalLaws)/thermalLaw/newThermalLaw.C $(thermalLaws)/constantThermal/constantThermal.C $(thermalLaws)/multiMaterialThermal/multiMaterialThermal.C diff --git a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H index 2e30e7e74..18d79b207 100644 --- a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H +++ b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H @@ -71,7 +71,7 @@ public: DugdaleCohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy diff --git a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C index 2ea3e3a7d..634663d82 100644 --- a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C +++ b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C @@ -74,7 +74,7 @@ Foam::autoPtr Foam::cohesiveLaw::New Foam::cohesiveLaw::cohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ) : cohesiveLawCoeffs_(dict.subDict(cohesiveLawName + "Coeffs")), diff --git a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H index 6a98e59ce..6ad767f52 100644 --- a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H +++ b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H @@ -97,7 +97,7 @@ public: static autoPtr New ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); @@ -107,7 +107,7 @@ public: cohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy @@ -124,7 +124,7 @@ public: // Member Functions - + //- Return cohesive law coefficients const dictionary& cohesiveLawCoeffs() const { diff --git a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/linear/linearCohesiveLaw.H b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/linear/linearCohesiveLaw.H index 53d4ee100..d77823b27 100644 --- a/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/linear/linearCohesiveLaw.H +++ b/applications/solvers/newStressAnalysis/materialModels/cohesiveLaws/linear/linearCohesiveLaw.H @@ -71,7 +71,7 @@ public: linearCohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy diff --git a/applications/solvers/newStressAnalysis/materialModels/componentReference/componentReference.H b/applications/solvers/newStressAnalysis/materialModels/componentReference/componentReference.H index f4d4b2e83..37b6d97ae 100644 --- a/applications/solvers/newStressAnalysis/materialModels/componentReference/componentReference.H +++ b/applications/solvers/newStressAnalysis/materialModels/componentReference/componentReference.H @@ -171,7 +171,7 @@ public: { checkPatchFace(mesh); } - + //- Construct from dictionary componentReference diff --git a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C index f1a3119dc..5a263ab76 100644 --- a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C +++ b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C @@ -245,7 +245,7 @@ void cohesiveLawFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); traction_.writeEntry("traction", os); - os.writeKeyword("cohesiveLaw") << law().type() + os.writeKeyword("cohesiveLaw") << law().type() << token::END_STATEMENT << nl; os.writeKeyword("relaxationFactor") << relaxationFactor_ << token::END_STATEMENT << nl; diff --git a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C index d3af686e7..8d69cde47 100644 --- a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C +++ b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C @@ -99,7 +99,7 @@ cohesiveZoneFvPatchVectorField::cohesiveZoneFvPatchVectorField { this->refValue() = vector::zero; } - + if (dict.found("refGradient")) { this->refGrad() = vectorField("refGradient", dict, p.size()); @@ -111,7 +111,7 @@ cohesiveZoneFvPatchVectorField::cohesiveZoneFvPatchVectorField if (dict.found("valueFraction")) { - this->valueFraction() = + this->valueFraction() = symmTensorField("valueFraction", dict, p.size()); } else @@ -206,7 +206,7 @@ void cohesiveZoneFvPatchVectorField::updateCoeffs() const rheologyModel& rheology = this->db().objectRegistry::lookupObject(rheologyName_); - const scalarField mu = + const scalarField mu = rheology.mu()().boundaryField()[patch().index()]; const scalarField lambda = @@ -276,17 +276,17 @@ void cohesiveZoneFvPatchVectorField::updateCoeffs() if(magSqr(valueFraction()[faceI]) < SMALL) { - cohesiveTraction = - relaxationFactor_*cohesiveTraction + cohesiveTraction = + relaxationFactor_*cohesiveTraction + (1.0 - relaxationFactor_)*sigmaN[faceI]*n[faceI]; refGrad()[faceI] = ( cohesiveTraction - ( - n[faceI] + n[faceI] & ( - mu[faceI]*gradU[faceI].T() + mu[faceI]*gradU[faceI].T() - (mu[faceI] + lambda[faceI])*gradU[faceI] ) ) @@ -306,7 +306,7 @@ void cohesiveZoneFvPatchVectorField::write(Ostream& os) const directionMixedFvPatchVectorField::write(os); os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; os.writeKeyword("rheology") << rheologyName_ << token::END_STATEMENT << nl; - os.writeKeyword("cohesiveLaw") << law().type() + os.writeKeyword("cohesiveLaw") << law().type() << token::END_STATEMENT << nl; os.writeKeyword("relaxationFactor") << relaxationFactor_ << token::END_STATEMENT << nl; diff --git a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H index 2ae87d9d3..c322b1eaa 100644 --- a/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H +++ b/applications/solvers/newStressAnalysis/materialModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H @@ -174,7 +174,7 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); - + //- Write virtual void write(Ostream&) const; diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C index 01070f220..12ec4a171 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C @@ -107,7 +107,7 @@ Foam::tmp Foam::BurgersViscoelastic::E(scalar t) const + eta2_.value()/k2_.value(); scalar p2 = eta1_.value()*eta2_.value()/(k1_.value()*k2_.value()); - + scalar q1 = eta1_.value(); scalar q2 = eta1_.value()*eta2_.value()/k2_.value(); @@ -120,7 +120,7 @@ Foam::tmp Foam::BurgersViscoelastic::E(scalar t) const E = (q1 - q2*r1)*exp(-r1*t)/A - (q1 - q2*r2)*exp(-r2*t)/A; } - + tmp tresult ( @@ -178,7 +178,7 @@ Foam::tmp Foam::BurgersViscoelastic::J(scalar t) const if(t >= 0) { - J = 1.0/k1_.value() + J = 1.0/k1_.value() + (1 - exp(-k2_.value()*t/eta2_.value()))/k2_.value() + t/eta1_.value(); } diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C index 6f5eee04f..e902243fb 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C @@ -102,14 +102,14 @@ Foam::tmp Foam::KelvinSLSViscoelastic::E(scalar t) const if(t>=0) { scalar p1 = eta2_.value()/(k1_.value() + k2_.value()); - + scalar q0 = k1_.value()*k2_.value()/(k1_.value() + k2_.value()); scalar q1 = k1_.value()*eta2_.value()/(k1_.value() + k2_.value()); E = q0 + (q1/p1 - q0)*exp(-t/p1); } - + tmp tresult ( @@ -168,7 +168,7 @@ Foam::tmp Foam::KelvinSLSViscoelastic::J(scalar t) const if(t >= 0) { scalar p1 = eta2_.value()/(k1_.value() + k2_.value()); - + scalar q0 = k1_.value()*k2_.value()/(k1_.value() + k2_.value()); scalar q1 = k1_.value()*eta2_.value()/(k1_.value() + k2_.value()); diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C index 2ff2ff7f3..19137ea1e 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C @@ -183,8 +183,8 @@ Foam::MaxwellElasticViscoelastic::J(scalar t) const mesh(), dimensionedScalar ( - "J", - dimless/k_.dimensions(), + "J", + dimless/k_.dimensions(), 1.0/k_.value() + t/eta_.value() ), zeroGradientFvPatchScalarField::typeName diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C index 7db135033..25edfff3b 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C @@ -101,7 +101,7 @@ Foam::tmp Foam::MaxwellSLSViscoelastic::E(scalar t) const { E = k2_.value() + k1_.value()*exp(-k1_.value()*t/eta1_.value()); } - + tmp tresult ( diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C index ead261907..c2ea155b7 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C @@ -169,8 +169,8 @@ Foam::tmp Foam::MaxwellViscoelastic::J(scalar t) const mesh(), dimensionedScalar ( - "J", - dimless/k_.dimensions(), + "J", + dimless/k_.dimensions(), 1.0/k_.value() + t/eta_.value() ), zeroGradientFvPatchScalarField::typeName diff --git a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C index 297988a02..c0b319c72 100644 --- a/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C +++ b/applications/solvers/newStressAnalysis/materialModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C @@ -105,7 +105,7 @@ Foam::tmp Foam::PronyViscoelastic::E(scalar t) const { E += k_[i]*exp(-t/tau_[i]); } - + if(t < 0) { E = 0; @@ -162,7 +162,7 @@ Foam::tmp Foam::PronyViscoelastic::nu(scalar t) const Foam::tmp Foam::PronyViscoelastic::J(scalar t) const { notImplemented(type() + "::J(scalar t)"); - + return 1.0/E(t); } diff --git a/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.C b/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.C index 86416ce20..ce69f8c32 100644 --- a/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.C +++ b/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.C @@ -104,7 +104,7 @@ Foam::contactPatchPair::contactPatchPair cp.mesh().boundaryMesh()[slavePatch_.index()], // to patch intersection::algorithmNames_.read(dict.lookup("projectionAlgo")), intersection::directionNames_.read(dict.lookup("projectionDir")) - + ), slaveToMasterInterpolate_ ( @@ -112,7 +112,7 @@ Foam::contactPatchPair::contactPatchPair cp.mesh().boundaryMesh()[masterPatch_.index()], // to patch intersection::algorithmNames_.read(dict.lookup("projectionAlgo")), intersection::directionNames_.read(dict.lookup("projectionDir")) - + ) {} diff --git a/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.H b/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.H index cb2d65ae0..2fa8ffe32 100644 --- a/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.H +++ b/applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.H @@ -27,7 +27,7 @@ Class Description A pair of surfaces in contact. - + SourceFiles contactPatchPair.C diff --git a/applications/solvers/newStressAnalysis/newContactStressFoam/contactProblem.C b/applications/solvers/newStressAnalysis/newContactStressFoam/contactProblem.C index 63010d8fe..8a9a0ee9e 100644 --- a/applications/solvers/newStressAnalysis/newContactStressFoam/contactProblem.C +++ b/applications/solvers/newStressAnalysis/newContactStressFoam/contactProblem.C @@ -241,7 +241,7 @@ void contactProblem::correct() ( lambdaPatches[patchI]*tr(gradUpatches[patchI]) ) - + )/(2.0*muPatches[patchI] + lambdaPatches[patchI]); // Set the value fractions diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/calculateDivDSigmaExp.H index b44a5cd85..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)); - - 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 = + ( + 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 = - 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 55b3d0b3c..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(); - - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - //- 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]; - } - } + 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] + ); + + 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); - } - - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); - - //- 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); - - 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; - } - } - - 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; - - //- 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); - - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } - - //- 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]; - } - } - } + { + //- 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(); + + //- 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); + + 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; + } + } + + 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; + + //- 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); + + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } + + //- 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]; + } + } +} 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 ef00ba1e1..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(); - - 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; - - //- 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 - - 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 - - //- 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); - } - - 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) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + + 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; + } + + //- 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 + + 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 + + //- 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); + } + + 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 +//- 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 6698c5831..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); - - //- 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); - } - } + { + 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 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 a3fd09ca8..add1b76b2 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/elasticContactIncrSolidFoam.C @@ -61,35 +61,35 @@ 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; - + for (runTime++; !runTime.end(); runTime++) { Info<< "Time: " << runTime.timeName() << endl; - + # include "readContactControls.H" # include "readStressedFoamControls.H" - + //-- for moving the mesh and then back again vectorField oldMeshPoints = mesh.allPoints(); - + int iCorr = 0; lduMatrix::solverPerformance solverPerf; word solverName; @@ -101,116 +101,118 @@ 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(); - - //- correct the contact boundaries - if(iCorr % uEqnContactCorrFreq == 0) - { - Info << "\t\tCorrecting contact in the momentum loop " - << "iteration: " << iCorr - << ", residual: " << residual - << endl; - //# include "moveMeshLeastSquares.H" + { + 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" # 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(); + + DU.relax(); + + solverName = solverPerf.solverName(); - solverPerf = DUEqn.solve(); - - DU.relax(); - - solverName = solverPerf.solverName(); - if(solidInterfaceCorr) - { + { gradDU = solidInterfacePtr->grad(DU); - } + } else - { + { gradDU = fvc::grad(DU); - } - - U = U.oldTime() + DU; + } - residual = 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" + U = U.oldTime() + DU; - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; - } //- end of momentum loop + residual = 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 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; - + # include "calculateDEpsilonDSigma.H" - + epsilon += DEpsilon; - + sigma += DSigma; # include "writeFields.H" - + //# include "writeBoundaryNetForces.H" - + //# include "moveMeshLeastSquares.H" //# include "moveSolidMesh.H" //# include "printContactResults.H" //mesh.movePoints(oldMeshPoints); - + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } - + Info<< "End\n" << endl; - + return(0); } diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H index 6f7ffb2ff..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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/moveSolidMesh.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveSolidMesh.H index 95753e149..4b5bb274a 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveSolidMesh.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/moveSolidMesh.H @@ -1,4 +1,4 @@ -{ +{ //- move mesh for the contact correction // Create point interpolation @@ -8,20 +8,20 @@ pointVectorField pointU = pointInterpolation.interpolate(U); const vectorField& pointUI = pointU.internalField(); - + // Move mesh vectorField newPoints = mesh.allPoints(); - + forAll (pointUI, pointI) { newPoints[pointI] += pointUI[pointI]; } # include "correctGlobalFaceZoneMesh.H" - + twoDPointCorrector twoDCorrector(mesh); - twoDCorrector.correctPoints(newPoints); - + twoDCorrector.correctPoints(newPoints); + mesh.movePoints(newPoints); mesh.V00(); mesh.moving(false); diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H index e87af322a..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/printContactResults.H @@ -1,55 +1,55 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); //ca.write(); - + //-------------------------------------------------------------// // I couldn't get tmp to return the pointScalarField correctly // // so I had to make the pointScalarField here and pass it to // // contactGapPoints and pointContactForce to populate // //-------------------------------------------------------------// //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" - ); + pointScalarField cGapPoints + ( + 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(); - + //- this is the actual (sigma&n)&n) on the contact patches //- 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/writeBoundaryNetForces.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeBoundaryNetForces.H index 429f86d75..ae84eb2d6 100644 --- a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeBoundaryNetForces.H +++ b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeBoundaryNetForces.H @@ -6,9 +6,9 @@ Info << nl; forAll(netForces, patchI) { netForces[patchI] = gSum(mesh.Sf().boundaryField()[patchI] & sigma.boundaryField()[patchI]); - + Info << "patch\t" << mesh.boundary()[patchI].name() << "\t\tnet force is\t" << netForces[patchI] << " N" << endl; -} +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactIncrSolidFoam/writeFields.H index dd5b144aa..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); + mesh.movePoints(oldMeshPoints); runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculateDivDSigmaExp.H index b44a5cd85..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)); - - 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 = + ( + 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 = - 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 2562c5a56..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 53ef67047..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 labelList& curFaces = pfaces[curPoint]; - - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + const label curPoint = ptc[pointI]; - vectorField& curExtraVectors = extraVecs[pointI]; - - label nFacesAroundPoint = 0; + const labelList& curFaces = pfaces[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]); - - 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++; - } - } - } - - curExtraVectors.setSize(nFacesAroundPoint); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); + + vectorField& curExtraVectors = extraVecs[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() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; + + nFacesAroundPoint++; + } + } + } + + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/calculatePointBoundaryWeights.H index 276c25f03..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(); - - pointScalarField volPointSumWeights + const fvBoundaryMesh& bm = mesh.boundary(); + + 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 c2429e99b..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(); - - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - //- 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]; - } - } + 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] + ); + + 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); - } - - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); - - //- 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); - - 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; - } - } - - 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; - - //- 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); - - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } - - //- 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]; - } - } - } + { + //- 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(); + + //- 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); + + 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; + } + } + + 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; + + //- 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); + + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } + + //- 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]; + } + } +} 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 e6297b5c3..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(); - - 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; - - //- 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 - - 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 - - //- 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); - } - - 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) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + + 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; + } + + //- 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 + + vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + + 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); + + //- 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 +//- 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 d60ebf99a..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; - - for (runTime++; !runTime.end(); runTime++) +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << endl; - -# include "readContactControls.H" + Info<< "Time: " << runTime.timeName() << endl; -# include "readStressedFoamControls.H" - - //-- 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; - - do //- start of momentum loop - { - DU.storePrevIter(); - - divDSigmaLargeStrainExp.storePrevIter(); +# include "readContactControls.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 "moveSolidMeshForContact.H" - contact.correct(); - mesh.movePoints(oldMeshPoints); - } - -# include "calculateDivDSigmaExp.H" - -# include "calculateDivDSigmaExpLargeStrain.H" +# include "readStressedFoamControls.H" - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") - + divDSigmaExp - + divDSigmaLargeStrainExp + //-- for moving the mesh and then back again + vectorField oldMeshPoints = mesh.allPoints(); - ); - - solverPerf = DUEqn.solve(); - - DU.relax(); - - solverName = solverPerf.solverName(); - - gradDU = fvc::grad(DU); - - DF = gradDU.T(); + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + word solverName; + lduMatrix::debug = 0; + scalar residual = GREAT; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; -# include "calculateDEpsilonDSigma.H" + do //- start of momentum loop + { + DU.storePrevIter(); - residual = solverPerf.initialResidual(); - - 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 - 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; - - lduMatrix::debug = 1; - -# include "rotateFields.H" + divDSigmaLargeStrainExp.storePrevIter(); -# include "moveMesh.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 "moveSolidMeshForContact.H" + contact.correct(); + mesh.movePoints(oldMeshPoints); + } -# include "writeFields.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; +# include "calculateDivDSigmaExp.H" + +# include "calculateDivDSigmaExpLargeStrain.H" + + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)") + + divDSigmaExp + + divDSigmaLargeStrainExp + ); + + solverPerf = DUEqn.solve(); + + DU.relax(); + + solverName = solverPerf.solverName(); + + gradDU = fvc::grad(DU); + + DF = gradDU.T(); + +# include "calculateDEpsilonDSigma.H" + + residual = solverPerf.initialResidual(); + + 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 + 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; + + lduMatrix::debug = 1; + +# include "rotateFields.H" + +# include "moveMesh.H" + +# include "writeFields.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + return(0); } diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/findBoundaryPoints.H index 07ee1f644..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& meshPoints = bm[patchI].patch().meshPoints(); + const labelList& bp = bm[patchI].patch().boundaryPoints(); - forAll (bp, pointI) - { - pointsCorrectionMap.insert(meshPoints[bp[pointI]]); - } + const labelList& meshPoints = bm[patchI].patch().meshPoints(); + + 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 389847569..b70d0dd6c 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,34 +2,34 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; - + // Create point mesh pointMesh pMesh(mesh); // Create point interpolation 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 6f7ffb2ff..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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/moveSolidMeshForContact.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveSolidMeshForContact.H index 41184fd34..e592c90fe 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveSolidMeshForContact.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/moveSolidMeshForContact.H @@ -1,4 +1,4 @@ -{ +{ // Create point interpolation volPointInterpolation pointInterpolation(mesh); @@ -6,20 +6,20 @@ pointVectorField pointDU = pointInterpolation.interpolate(DU); vectorField pointDUI = pointDU.internalField(); - + // Move mesh vectorField newPoints = mesh.allPoints(); - + forAll (pointDUI, pointI) { newPoints[pointI] += pointDUI[pointI]; } # include "correctGlobalFaceZoneMesh.H" - + twoDPointCorrector twoDCorrector(mesh); - twoDCorrector.correctPoints(newPoints); - + twoDCorrector.correctPoints(newPoints); + mesh.movePoints(newPoints); // pMesh.movePoints(newPoints); mesh.V00(); diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H index f352e9442..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 +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 labelList& curFaces = PointFaces[curPoint]; - - label fI = 0; - - // Go through all the faces - forAll (curFaces, faceI) + const label curPoint = ptc[pointI]; + + const labelList& curFaces = PointFaces[curPoint]; + + label fI = 0; + + // 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(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] - ); - - fI++; - } - } + 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]); + + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); + + 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 e87af322a..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/printContactResults.H @@ -1,55 +1,55 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); //ca.write(); - + //-------------------------------------------------------------// // I couldn't get tmp to return the pointScalarField correctly // // so I had to make the pointScalarField here and pass it to // // contactGapPoints and pointContactForce to populate // //-------------------------------------------------------------// //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" - ); + pointScalarField cGapPoints + ( + 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(); - + //- this is the actual (sigma&n)&n) on the contact patches //- 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/rotateFields.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/rotateFields.H index 486ed6cf7..edc549fcf 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/rotateFields.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/rotateFields.H @@ -5,9 +5,9 @@ Info << "Rotating fields" << endl; F = I + DF; - + U += DU; - + epsilon += DEpsilon; sigma += DSigma; @@ -15,9 +15,9 @@ volTensorField Finv = inv(F); J = det(F); - + rho = rho/J; - + epsilon = symm(Finv.T() & epsilon & Finv); sigma = 1/J * symm(F & sigma & F.T()); diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeBoundaryNetForces.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeBoundaryNetForces.H index e0f7bdb31..7c8108614 100644 --- a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeBoundaryNetForces.H +++ b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeBoundaryNetForces.H @@ -6,9 +6,9 @@ Info << nl; forAll(netForces, patchI) { netForces[patchI] = gSum(mesh.Sf().boundaryField()[patchI] & sigma.boundaryField()[patchI]); - + Info << "patch " << mesh.boundary()[patchI].name() << " net force is " << netForces[patchI] << " N" << endl; -} +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactNonLinULSolidFoam/writeFields.H index 574bd09a9..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 7ccf03e23..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)); - - 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; - } + ); +} +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; +} diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/correctGlobalFaceZoneMesh.H index 55b3d0b3c..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(); - - primitivePatchInterpolation masterInterpolator - (mesh.boundaryMesh()[masterID]); - primitivePatchInterpolation slaveInterpolator - (mesh.boundaryMesh()[slaveID]); + { + label masterID = contacts[contactI].masterPatch().index(); + label slaveID = contacts[contactI].slavePatch().index(); - //- 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]; - } - } + 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] + ); + + 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); - } - - vectorField globalFZpoints = - mesh.faceZones()[faceZoneI]().localPoints(); - - //- 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); - - 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; - } - } - - 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; - - //- 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); - - forAll(globalFZnewPoints, globalPointI) - { - label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; - - procFZnewPoints[localPoint] = - globalFZnewPoints[globalPointI]; - } - - //- 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]; - } - } - } + { + //- 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(); + + //- 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); + + 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; + } + } + + 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; + + //- 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); + + forAll(globalFZnewPoints, globalPointI) + { + label localPoint = procToGlobalFZmap[faceZoneI][globalPointI]; + procFZnewPoints[localPoint] = globalFZnewPoints[globalPointI]; + } + + //- 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]; + } + } +} 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 e6297b5c3..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(); - - 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; - - //- 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 - - 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 - - //- 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); - } - - 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) + { + vectorField globalFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + + 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; + } + + //- 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 + + vectorField procFZpoints = mesh.faceZones()[faceZoneI]().localPoints(); + + 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); + + //- 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 +//- 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 377312e3a..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; - - for (runTime++; !runTime.end(); runTime++) +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << endl; - -# include "readContactControls.H" + Info<< "Time: " << runTime.timeName() << endl; -# include "readStressedFoamControls.H" - - //-- 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; +# include "readContactControls.H" - //- Predictor step - if (predictor) +# include "readStressedFoamControls.H" + + //-- 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; + + //- 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(); - - //- 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" + do //- start of momentum loop + { + U.storePrevIter(); - fvVectorMatrix UEqn - ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") - + divSigmaExp - ); - - solverPerf = UEqn.solve(); - - U.relax(); - - solverName = solverPerf.solverName(); - - gradU = fvc::grad(U); - snGradU = fvc::snGrad(U); + //- 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); + } - residual = solverPerf.initialResidual(); - - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } - -# include "calculateRelativeResidual.H" +# include "calculateDivSigmaExp.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 - ); - - // 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; - - V = fvc::ddt(U); - gradV = fvc::ddt(gradU); - snGradV = (snGradU - snGradU.oldTime())/runTime.deltaT(); + fvVectorMatrix UEqn + ( + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*mu + lambda, U, "laplacian(DU,U)") + + divSigmaExp + ); -# include "calculateEpsilonSigma.H" - -# include "writeFields.H" - - //# include "moveMeshLeastSquares.H" - //# include "moveSolidMesh.H" - //# include "printContactResults.H" - //mesh.movePoints(oldMeshPoints); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << endl << endl; + solverPerf = UEqn.solve(); + + U.relax(); + + solverName = solverPerf.solverName(); + + gradU = fvc::grad(U); + snGradU = fvc::snGrad(U); + + residual = solverPerf.initialResidual(); + + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } + +# 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 + ); + + // 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; + + V = fvc::ddt(U); + gradV = fvc::ddt(gradU); + snGradV = (snGradU - snGradU.oldTime())/runTime.deltaT(); + +# include "calculateEpsilonSigma.H" + +# include "writeFields.H" + +//# include "moveMeshLeastSquares.H" +//# include "moveSolidMesh.H" +//# include "printContactResults.H" +// mesh.movePoints(oldMeshPoints); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << endl << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + return(0); } diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H index 6f7ffb2ff..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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/moveSolidMesh.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveSolidMesh.H index 37128a5be..b0f696503 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/moveSolidMesh.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/moveSolidMesh.H @@ -1,4 +1,4 @@ -{ +{ // Create point interpolation volPointInterpolation pointInterpolation(mesh); @@ -8,21 +8,21 @@ // const vectorField& pointUI = pointU.internalField(); vectorField pointUI = pointU.internalField(); - + // Move mesh vectorField newPoints = mesh.allPoints(); - + forAll (pointUI, pointI) { newPoints[pointI] += pointUI[pointI]; } # include "correctGlobalFaceZoneMesh.H" - + twoDPointCorrector twoDCorrector(mesh); - twoDCorrector.correctPoints(newPoints); - + twoDCorrector.correctPoints(newPoints); + mesh.movePoints(newPoints); // pMesh.movePoints(newPoints); mesh.V00(); diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H index e87af322a..8782d1845 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/printContactResults.H @@ -1,55 +1,55 @@ if (runTime.outputTime()) - { +{ // FAILS IN PARALLEL - FIX // Info << "Print contact area" << endl; //volScalarField ca = contact.contactArea(); //ca.write(); - + //-------------------------------------------------------------// // I couldn't get tmp to return the pointScalarField correctly // // so I had to make the pointScalarField here and pass it to // // contactGapPoints and pointContactForce to populate // //-------------------------------------------------------------// //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" - ); + pointScalarField cGapPoints + ( + 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(); - + //- this is the actual (sigma&n)&n) on the contact patches //- 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/writeBoundaryNetForces.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/writeBoundaryNetForces.H index 429f86d75..ae84eb2d6 100644 --- a/applications/solvers/solidMechanics/elasticContactSolidFoam/writeBoundaryNetForces.H +++ b/applications/solvers/solidMechanics/elasticContactSolidFoam/writeBoundaryNetForces.H @@ -6,9 +6,9 @@ Info << nl; forAll(netForces, patchI) { netForces[patchI] = gSum(mesh.Sf().boundaryField()[patchI] & sigma.boundaryField()[patchI]); - + Info << "patch\t" << mesh.boundary()[patchI].name() << "\t\tnet force is\t" << netForces[patchI] << " N" << endl; -} +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticContactSolidFoam/writeFields.H index 574bd09a9..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 5759d3fd6..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)); - - 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; - } + ); +} +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; +} 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 75996ea24..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; - -# include "readStressedFoamControls.H" + Info<< "Time: " << runTime.timeName() << nl << endl; - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; +# include "readStressedFoamControls.H" - lduMatrix::debug=0; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - do + lduMatrix::debug=0; + + do { - U.storePrevIter(); - -# include "calculateDivSigmaExp.H" + U.storePrevIter(); - //- linear momentum equation - fvVectorMatrix UEqn +# include "calculateDivSigmaExp.H" + + //- 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(); - } - - U.relax(); + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - if(solidInterfaceCorr) - { - gradU = solidInterfacePtr->grad(U); - } - else - { - gradU = fvc::grad(U); - } + U.relax(); -# include "calculateRelativeResidual.H" - - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + if(solidInterfaceCorr) + { + gradU = solidInterfacePtr->grad(U); + } + else + { + gradU = fvc::grad(U); + } + +# 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 << 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; + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); -# include "calculateEpsilonSigma.H" + 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; -# include "writeFields.H" + lduMatrix::debug=0; - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; +# include "calculateEpsilonSigma.H" + +# include "writeFields.H" + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + 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 574bd09a9..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 b44a5cd85..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)); - - 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 = + ( + 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 = - 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/calculateNetForces.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateNetForces.H index a0c5cedaa..9e48bfd6a 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateNetForces.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateNetForces.H @@ -6,7 +6,7 @@ Info << nl; forAll(netForces, patchI) { netForces[patchI] = gSum(mesh.Sf().boundaryField()[patchI] & sigma.boundaryField()[patchI]); - + Info << "patch\t" << mesh.boundary()[patchI].name() << "\t\tnet force is\t" << netForces[patchI] << " N" << endl; -} +} diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H index 48f9c12b1..f53811e9a 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H @@ -24,7 +24,7 @@ IOobject::AUTO_WRITE ), mesh, - dimensionedVector("zero", dimLength, vector::zero) + dimensionedVector("zero", dimLength, vector::zero) ); volSymmTensorField DEpsilon @@ -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 12e09a824..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; - -# include "readStressedFoamControls.H" + Info<< "Time: " << runTime.timeName() << nl << endl; - int iCorr = 0; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::solverPerformance solverPerf; - lduMatrix::debug = 0; +# include "readStressedFoamControls.H" - do + int iCorr = 0; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::solverPerformance solverPerf; + lduMatrix::debug = 0; + + 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(); - } - - DU.relax(); + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } + DU.relax(); -# include "calculateRelativeResidual.H" - - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } + +# include "calculateRelativeResidual.H" + + 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 - ); - - 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; + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); -# include "calculateDEpsilonDSigma.H" + 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; - U += DU; - sigma += DSigma; - epsilon += DEpsilon; + lduMatrix::debug=0; -# include "writeFields.H" +# include "calculateDEpsilonDSigma.H" -# include "calculateNetForces.H" + U += DU; + sigma += DSigma; + epsilon += DEpsilon; - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; +# include "writeFields.H" + +# include "calculateNetForces.H" + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + 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 574bd09a9..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 b6aba6a41..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] - ); - - tensorField Finv = inv(I + gradU); - vectorField newN = Finv & n.boundaryField()[patchID]; - newN /= mag(newN); - loadingPatch.valueFraction() = sqr(newN); + if + ( + U.boundaryField()[patchID].type() + == solidDirectionMixedFvPatchVectorField::typeName + ) + { + solidDirectionMixedFvPatchVectorField& loadingPatch = + refCast + ( + U.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]); - } + 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]); + } } } 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 47ab58eab..31ce0d1ed 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C @@ -28,13 +28,13 @@ Application Description Finite volume structural solver employing a total strain total Lagrangian approach. - + Valid for finite strains, finite displacements and finite rotations. Author Micheal Leonard Philip Cardiff - + \*---------------------------------------------------------------------------*/ #include "fvCFD.H" @@ -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; - -# include "readStressedFoamControls.H" + Info<< "Time: " << runTime.timeName() << nl << endl; - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; +# include "readStressedFoamControls.H" - lduMatrix::debug=0; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - do + lduMatrix::debug=0; + + do { - U.storePrevIter(); + U.storePrevIter(); -# include "correctDirectionMixedTL.H" - - fvVectorMatrix UEqn +# include "correctDirectionMixedTL.H" + + 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(); - } - - U.relax(); + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - gradU = fvc::grad(U); + U.relax(); -# include "calculateEpsilonSigma.H" + gradU = fvc::grad(U); -# 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 << 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; +# include "calculateEpsilonSigma.H" -# include "writeFields.H" +# include "calculateRelativeResidual.H" - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << 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 + ); + + 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; + +# include "writeFields.H" + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + return(0); } diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H index 007e9d423..9f75e42f2 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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 ef9004345..232e33927 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/writeFields.H @@ -1,37 +1,37 @@ 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; volScalarField J = det(F); @@ -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; - - 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;; - } + 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;; + } //- 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 b44a5cd85..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)); - - 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 = + ( + 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 = - 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 ddcdfbd34..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 53ef67047..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 labelList& curFaces = pfaces[curPoint]; - - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + const label curPoint = ptc[pointI]; - vectorField& curExtraVectors = extraVecs[pointI]; - - label nFacesAroundPoint = 0; + const labelList& curFaces = pfaces[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]); - - 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++; - } - } - } - - curExtraVectors.setSize(nFacesAroundPoint); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); + + vectorField& curExtraVectors = extraVecs[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() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; + + nFacesAroundPoint++; + } + } + } + + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/calculatePointBoundaryWeights.H index 276c25f03..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(); - - pointScalarField volPointSumWeights + const fvBoundaryMesh& bm = mesh.boundary(); + + 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 cbdf9931f..075ec6fab 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C @@ -28,9 +28,9 @@ Application Description Finite volume structural solver employing a incremental strain updated Lagrangian approach. - + Valid for small strains, finite displacements and finite rotations. - + Author Philip Cardiff @@ -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; - - for (runTime++; !runTime.end(); runTime++) + Info << "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time = " << runTime.timeName() << nl << endl; - -# include "readStressedFoamControls.H" + Info<< "Time = " << runTime.timeName() << nl << endl; - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::debug = 0; - - do - { - DU.storePrevIter(); +# include "readStressedFoamControls.H" - divDSigmaLargeStrainExp.storePrevIter(); + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::debug = 0; -# 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; - - return(0); + + Info<< "End\n" << endl; + + return(0); } // ************************************************************************* // diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H index 07ee1f644..be49866c3 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/findBoundaryPoints.H @@ -14,20 +14,20 @@ 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(); - + 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 7e0b88462..c4f0a938e 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,33 +2,33 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; - + // Create point mesh pointMesh pMesh(mesh); // Create point interpolation 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 6f7ffb2ff..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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 f352e9442..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 +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 labelList& curFaces = PointFaces[curPoint]; - - label fI = 0; - - // Go through all the faces - forAll (curFaces, faceI) + const label curPoint = ptc[pointI]; + + const labelList& curFaces = PointFaces[curPoint]; + + label fI = 0; + + // 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(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] - ); - - fI++; - } - } + 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]); + + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); + + 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/rotateFields.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/rotateFields.H index 550ed49cc..386bf7ccd 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/rotateFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/rotateFields.H @@ -5,9 +5,9 @@ Info << "Rotating fields" << endl; F = I + gradDU; - + U += DU; - + epsilon += DEpsilon; sigma += DSigma; @@ -15,7 +15,7 @@ volTensorField Finv = inv(F); J = det(F); - + rho = rho/J; epsilon = symm(Finv & epsilon & Finv.T()); diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/writeFields.H index 574bd09a9..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/calculateDEpsilonDSigma.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDEpsilonDSigma.H index bfbfa7e47..17df85aec 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDEpsilonDSigma.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDEpsilonDSigma.H @@ -1,4 +1,4 @@ DEpsilon = symm(gradDU) + 0.5*symm(gradDU & gradDU.T()); - + DSigma = 2*rheology.newMu()*(DEpsilon - DEpsilonP) + rheology.newLambda()*(I*tr(DEpsilon)); diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculateDivDSigmaExp.H index b44a5cd85..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)); - - 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 = + ( + 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 = - 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 11ea74c0e..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 53ef67047..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 labelList& curFaces = pfaces[curPoint]; - - // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function - extraVecs.set - ( - pointI, - new vectorField(curFaces.size()) - ); + const label curPoint = ptc[pointI]; - vectorField& curExtraVectors = extraVecs[pointI]; - - label nFacesAroundPoint = 0; + const labelList& curFaces = pfaces[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]); - - 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++; - } - } - } - - curExtraVectors.setSize(nFacesAroundPoint); + // extraVecs.hook(new vectorField(curFaces.size())); //- no hook function + extraVecs.set + ( + pointI, + new vectorField(curFaces.size()) + ); + + vectorField& curExtraVectors = extraVecs[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() + ) + { + // Found a face for extrapolation + curExtraVectors[nFacesAroundPoint] = + pointLoc + - centres.boundaryField()[patchID] + [bm[patchID].patch().whichFace(curFaces[faceI])]; + + nFacesAroundPoint++; + } + } + } + + curExtraVectors.setSize(nFacesAroundPoint); } - } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/calculatePointBoundaryWeights.H index 276c25f03..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(); - - pointScalarField volPointSumWeights + const fvBoundaryMesh& bm = mesh.boundary(); + + 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 1603b38f8..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; - - for (runTime++; !runTime.end(); runTime++) + Info << "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << nl << endl; - -# include "readStressedFoamControls.H" + Info<< "Time: " << runTime.timeName() << nl << endl; - int iCorr = 0; - lduMatrix::solverPerformance solverPerf; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::debug = 0; - - const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); - - do - { - DU.storePrevIter(); +# include "readStressedFoamControls.H" - divDSigmaLargeStrainExp.storePrevIter(); + int iCorr = 0; + lduMatrix::solverPerformance solverPerf; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::debug = 0; -# 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 - - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) - ); - - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } + const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); - solverPerf = DUEqn.solve(); - - if(iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } - - DU.relax(); - - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } - - DF = gradDU.T(); - -# 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); - } - -# include "calculateDEpsilonDSigma.H" + do + { + DU.storePrevIter(); - 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; - - lduMatrix::debug = 1; - - U += DU; - - epsilon += DEpsilon; - - epsilonP += DEpsilonP; - - volSymmTensorField DEpsilonE = DEpsilon - DEpsilonP; - - epsilonE += DEpsilonE; - - sigma += DSigma; - - rheology.updateYieldStress(); - -# include "rotateFields.H" - -# include "moveMesh.H" - -# include "writeFields.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; + 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 + - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))) + ); + + 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); + } + + DF = gradDU.T(); + +# 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); + } + +# 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 << nl << "Time " << runTime.value() << ", Solving for " << DU.name() + << ", Initial residual = " << initialResidual + << ", Final residual = " << solverPerf.initialResidual() + << ", No outer iterations " << iCorr << endl; + + lduMatrix::debug = 1; + + U += DU; + + epsilon += DEpsilon; + + epsilonP += DEpsilonP; + + volSymmTensorField DEpsilonE = DEpsilon - DEpsilonP; + + epsilonE += DEpsilonE; + + sigma += DSigma; + + rheology.updateYieldStress(); + +# include "rotateFields.H" + +# include "moveMesh.H" + +# include "writeFields.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + return(0); } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/findBoundaryPoints.H index 07ee1f644..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& meshPoints = bm[patchI].patch().meshPoints(); + const labelList& bp = bm[patchI].patch().boundaryPoints(); - forAll (bp, pointI) - { - pointsCorrectionMap.insert(meshPoints[bp[pointI]]); - } + const labelList& meshPoints = bm[patchI].patch().meshPoints(); + + 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 389847569..b70d0dd6c 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshInverseDistance.H @@ -2,34 +2,34 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Move solid mesh using inverse distance interpolation" << endl; - + // Create point mesh pointMesh pMesh(mesh); // Create point interpolation 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 6f7ffb2ff..64048ca0d 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/moveMeshLeastSquares.H @@ -2,55 +2,54 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(mesh); - + // Create point mesh 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 f352e9442..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 +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 labelList& curFaces = PointFaces[curPoint]; - - label fI = 0; - - // Go through all the faces - forAll (curFaces, faceI) + const label curPoint = ptc[pointI]; + + const labelList& curFaces = PointFaces[curPoint]; + + label fI = 0; + + // 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(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] - ); - - fI++; - } - } + 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]); + + pfCorr[curPoint] += + w[pointI][fI]* + ( + extraVecs[pointI][fI] + & gradDU.boundaryField()[patchID][faceInPatchID] + ); + + 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/rotateFields.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/rotateFields.H index 6a15dbd2d..6730d1c14 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/rotateFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/rotateFields.H @@ -8,7 +8,7 @@ F = I + DF; volTensorField Finv = inv(F); J = det(F); - + rho = rho/J; sigma = 1/J * symm(F & sigma & F.T()); epsilon = symm(Finv.T() & epsilon & Finv); diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/writeFields.H index f519b4cce..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 6d9e9ce46..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)); - - 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 = + ); +} +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 = - 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 4bab52b5c..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; - - for (runTime++; !runTime.end(); runTime++) + + Info<< "\nCalculating displacement field\n" << endl; + + for (runTime++; !runTime.end(); runTime++) { - Info<< "Time: " << runTime.timeName() << nl << endl; - -# include "readStressedFoamControls.H" - - int iCorr = 0; - scalar initialResidual = 0; - scalar relativeResidual = GREAT; - lduMatrix::solverPerformance solverPerf; - lduMatrix::debug = 0; - - const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); - - do - { - DU.storePrevIter(); + Info<< "Time: " << runTime.timeName() << nl << endl; -# 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))) - ); +# include "readStressedFoamControls.H" - if(solidInterfaceCorr) - { - solidInterfacePtr->correct(DUEqn); - } - - solverPerf = DUEqn.solve(); - - if(iCorr == 0) + int iCorr = 0; + scalar initialResidual = 0; + scalar relativeResidual = GREAT; + lduMatrix::solverPerformance solverPerf; + lduMatrix::debug = 0; + + const volSymmTensorField& DEpsilonP = rheology.DEpsilonP(); + + do + { + DU.storePrevIter(); + +# 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))) + ); + + if(solidInterfaceCorr) { - initialResidual = solverPerf.initialResidual(); + solidInterfacePtr->correct(DUEqn); } - - DU.relax(); - - if(solidInterfaceCorr) - { - gradDU = solidInterfacePtr->grad(DU); - } - else - { - gradDU = fvc::grad(DU); - } -# 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); - } + solverPerf = DUEqn.solve(); - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() << endl; - } - while - ( - 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; - - lduMatrix::debug = 1; - -# include "calculateDEpsilonDSigma.H" + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - U += DU; - - epsilon += DEpsilon; - - epsilonP += rheology.DEpsilonP(); - - sigma += DSigma; - - rheology.updateYieldStress(); - -# include "writeFields.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; + DU.relax(); + + if(solidInterfaceCorr) + { + gradDU = solidInterfacePtr->grad(DU); + } + else + { + gradDU = fvc::grad(DU); + } + +# 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); + } + + Info << "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", residual = " << solverPerf.initialResidual() << endl; + } + while + ( + 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; + + lduMatrix::debug = 1; + +# include "calculateDEpsilonDSigma.H" + + U += DU; + + epsilon += DEpsilon; + + epsilonP += rheology.DEpsilonP(); + + sigma += DSigma; + + rheology.updateYieldStress(); + +# include "writeFields.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + 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 f519b4cce..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 5759d3fd6..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)); - - 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 = + ( + 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 = - 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 2c4d99c15..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; - -# include "readStressedFoamControls.H" + Info<< "Time: " << runTime.timeName() << nl << endl; - int iCorr = 0; - scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; - scalar relativeResidual = GREAT; +# include "readStressedFoamControls.H" - lduMatrix::debug=0; + int iCorr = 0; + scalar initialResidual = 0; + lduMatrix::solverPerformance solverPerf; + scalar relativeResidual = GREAT; - do + lduMatrix::debug=0; + + do { - U.storePrevIter(); - -# include "calculateDivSigmaExp.H" + U.storePrevIter(); - //- linear momentum equation - fvVectorMatrix UEqn +# include "calculateDivSigmaExp.H" + + //- 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(); - } - - U.relax(); + if(iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - if(solidInterfaceCorr) - { - gradU = solidInterfacePtr->grad(U); - } - else - { - gradU = fvc::grad(U); - } + U.relax(); -# include "calculateRelativeResidual.H" - - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", residual = " << solverPerf.initialResidual() - << ", relative residual = " << relativeResidual << endl; + if(solidInterfaceCorr) + { + gradU = solidInterfacePtr->grad(U); + } + else + { + gradU = fvc::grad(U); + } + +# 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 << 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; + while + ( + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && + ++iCorr < nCorr + ); -# include "calculateEpsilonSigma.H" + 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; -# include "writeFields.H" + lduMatrix::debug=0; - Info<< "ExecutionTime = " - << runTime.elapsedCpuTime() - << " s\n\n" << endl; +# include "calculateEpsilonSigma.H" + +# include "writeFields.H" + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; } - - Info<< "End\n" << endl; - - return(0); + + Info<< "End\n" << endl; + + 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 574bd09a9..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 c137d6075..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 dccac1558..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; - -# include "readStressedFoamControls.H" - - int iCorr = 0; - scalar initialResidual = GREAT; - scalar residual = GREAT; - lduMatrix::solverPerformance solverPerfU; - lduMatrix::solverPerformance solverPerfT; - - lduMatrix::debug=0; + Info<< "Time: " << runTime.timeName() << nl << endl; - do +# include "readStressedFoamControls.H" + + int iCorr = 0; + scalar initialResidual = GREAT; + scalar residual = GREAT; + lduMatrix::solverPerformance solverPerfU; + lduMatrix::solverPerformance solverPerfT; + + lduMatrix::debug=0; + + do { - U.storePrevIter(); - -# include "calculateSigmaExp.H" + U.storePrevIter(); - //- energy equation - fvScalarMatrix TEqn - ( - fvm::ddt(rhoC, T) == fvm::laplacian(k, T, "laplacian(k,T)") - ); +# include "calculateSigmaExp.H" - 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(); - - gradU = fvc::grad(U); - - Info << "\t\tSolving for " << U.name() - << " using " << solverPerfU.solverName() - << ", residual = " << solverPerfU.initialResidual() << endl; + //- 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)") + ); + + solverPerfU = UEqn.solve(); + + 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; - - lduMatrix::debug=0; + << ", 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; # 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 574bd09a9..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/calcFsiResidual.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calcFsiResidual.H index f0b6436e1..f85627e60 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calcFsiResidual.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/calcFsiResidual.H @@ -1,14 +1,14 @@ { - const vectorField& solidPatchDisplacement = + const vectorField& solidPatchDisplacement = DU.boundaryField()[solidPatchID]; vectorField solidZoneDisplacement ( - stressMesh.faceZones()[solidZoneID]().size(), + stressMesh.faceZones()[solidZoneID]().size(), vector::zero ); - const label solidPatchStart = + const label solidPatchStart = stressMesh.boundaryMesh()[solidPatchID].start(); forAll(solidPatchDisplacement, i) @@ -17,7 +17,7 @@ [ stressMesh.faceZones()[solidZoneID] .whichFace(solidPatchStart + i) - ] = + ] = solidPatchDisplacement[i]; } @@ -36,7 +36,7 @@ vector::zero ); - const label fluidPatchStart = + const label fluidPatchStart = mesh.boundaryMesh()[fluidPatchID].start(); forAll(fluidPatchDisplacement, i) @@ -63,7 +63,7 @@ fsiResidual = solidPatchPointsDispl - fluidPatchPointsDispl; -// maxFsiResidual = +// maxFsiResidual = // gMax // ( // mag(fsiResidual) 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/createInterfaceFields.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createInterfaceFields.H index cd6f621e4..4ffea09ad 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createInterfaceFields.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createInterfaceFields.H @@ -30,13 +30,13 @@ vectorField fsiResidualOld vectorField solidPatchTraction ( - stressMesh.boundary()[solidPatchID].size(), + stressMesh.boundary()[solidPatchID].size(), vector::zero ); scalarField solidPatchPressure ( - stressMesh.boundary()[solidPatchID].size(), + stressMesh.boundary()[solidPatchID].size(), 0.0 ); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressFields.H index 5d3bb4f95..1a0fb3400 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; @@ -103,7 +103,7 @@ word solidDdtScheme ( - stressMesh.ddtScheme("ddt(" + DU.name() +')') + stressMesh.schemesDict().ddtScheme("ddt(" + DU.name() +')') ); // if diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressPointMesh.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressPointMesh.H index e51f7fdf5..46d7df051 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressPointMesh.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createStressPointMesh.H @@ -9,7 +9,7 @@ pointPatchInterpolation patchPointInterpolator(stressMesh); wordList types ( - pStressMesh.boundary().size(), + pStressMesh.boundary().size(), calculatedFvPatchVectorField::typeName ); @@ -17,9 +17,9 @@ wordList types forAll(DU.boundaryField().types(), patchI) { - if + if ( - DU.boundaryField().types()[patchI] + DU.boundaryField().types()[patchI] == fixedValueFvPatchVectorField::typeName ) { diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createZoneToZoneInterpolators.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createZoneToZoneInterpolators.H index 24eef3e18..fa666a5b9 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createZoneToZoneInterpolators.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createZoneToZoneInterpolators.H @@ -27,17 +27,17 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) Info << "Check fluid-to-solid and solid-to-fluid interpolators" << endl; { - vectorField fluidPatchFaceCentres = + vectorField fluidPatchFaceCentres = vectorField(mesh.boundaryMesh()[fluidPatchID].faceCentres()); vectorField fluidZoneFaceCentres ( - mesh.faceZones()[fluidZoneID].size(), + mesh.faceZones()[fluidZoneID].size(), vector::zero ); - - const label fluidPatchStart = + + const label fluidPatchStart = mesh.boundaryMesh()[fluidPatchID].start(); forAll (fluidPatchFaceCentres, i) @@ -45,7 +45,7 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) fluidZoneFaceCentres [ mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i) - ] = + ] = fluidPatchFaceCentres[i]; } @@ -60,11 +60,11 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) vectorField solidPatchFaceCentres ( - stressMesh.boundaryMesh()[solidPatchID].size(), + stressMesh.boundaryMesh()[solidPatchID].size(), vector::zero ); - const label solidPatchStart = + const label solidPatchStart = stressMesh.boundaryMesh()[solidPatchID].start(); forAll(solidPatchFaceCentres, i) @@ -86,23 +86,23 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) ) ); - Info << "Fluid-to-solid face interpolation error: " << maxDist + Info << "Fluid-to-solid face interpolation error: " << maxDist << endl; } { - vectorField solidPatchFaceCentres = + vectorField solidPatchFaceCentres = vectorField(stressMesh.boundaryMesh()[solidPatchID].faceCentres()); vectorField solidZoneFaceCentres ( - stressMesh.faceZones()[solidZoneID].size(), + stressMesh.faceZones()[solidZoneID].size(), vector::zero ); - const label solidPatchStart = + const label solidPatchStart = stressMesh.boundaryMesh()[solidPatchID].start(); forAll (solidPatchFaceCentres, i) @@ -111,7 +111,7 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) [ stressMesh.faceZones()[solidZoneID] .whichFace(solidPatchStart + i) - ] = + ] = solidPatchFaceCentres[i]; } @@ -126,11 +126,11 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) vectorField fluidPatchFaceCentres ( - mesh.boundaryMesh()[fluidPatchID].size(), + mesh.boundaryMesh()[fluidPatchID].size(), vector::zero ); - const label fluidPatchStart = + const label fluidPatchStart = mesh.boundaryMesh()[fluidPatchID].start(); forAll(fluidPatchFaceCentres, i) @@ -157,9 +157,9 @@ if(!interpolatorFluidSolidPtr || !interpolatorSolidFluidPtr) } } -zoneToZoneInterpolation& interpolatorFluidSolid = +zoneToZoneInterpolation& interpolatorFluidSolid = *interpolatorFluidSolidPtr; -zoneToZoneInterpolation& interpolatorSolidFluid = +zoneToZoneInterpolation& interpolatorSolidFluid = *interpolatorSolidFluidPtr; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C index a88fcd7cf..81eb39b86 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/icoFsiElasticNonLinULSolidFoam.C @@ -29,7 +29,7 @@ Description Transient solver for fluid-solid interaction for an incompressible fluid and a large strain solid solid mesh is moved using U interpolated using least squares method - + Author Zeljko Tukovic FSB Zagreb adapted by Philip Cardiff @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) } while ( - (fsiResidualNorm > outerCorrTolerance) + (fsiResidualNorm > outerCorrTolerance) && (outerCorr < nOuterCorr) ); @@ -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/moveFluidMesh.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveFluidMesh.H index 7b4d92dab..c4a8339cd 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveFluidMesh.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveFluidMesh.H @@ -1,6 +1,6 @@ { // Move fluid mesh - const vectorField& n = + const vectorField& n = mesh.boundaryMesh()[fluidPatchID].pointNormals(); primitivePatchInterpolation patchInterpolator @@ -14,7 +14,7 @@ mesh.boundary()[fluidPatchID].deltaCoeffs() ); - scalar delta = + scalar delta = gMax ( mag @@ -29,7 +29,7 @@ *pointDeltaCoeffs ); - Info << "Maximal accumulated displacement of interface points: " + Info << "Maximal accumulated displacement of interface points: " << delta << endl; if(delta < interfaceDeformationLimit) @@ -37,12 +37,12 @@ // Move only interface points pointField newPoints = mesh.allPoints(); - const labelList& meshPoints = + const labelList& meshPoints = mesh.boundaryMesh()[fluidPatchID].meshPoints(); forAll (fluidPatchPointsDispl, pointI) { - newPoints[meshPoints[pointI]] += + newPoints[meshPoints[pointI]] += fluidPatchPointsDispl[pointI] - fluidPatchPointsDisplOld[pointI]; } @@ -54,7 +54,7 @@ mesh.movePoints(newPoints); // Accumulate interface points displacement - accumulatedFluidInterfaceDisplacement += + accumulatedFluidInterfaceDisplacement += fluidPatchPointsDispl - fluidPatchPointsDisplOld; } @@ -63,13 +63,13 @@ // Move whole fluid mesh pointField newPoints = mesh.allPoints(); - const labelList& meshPoints = + const labelList& meshPoints = mesh.boundaryMesh()[fluidPatchID].meshPoints(); forAll (accumulatedFluidInterfaceDisplacement, pointI) { - newPoints[meshPoints[pointI]] -= - accumulatedFluidInterfaceDisplacement[pointI]; + newPoints[meshPoints[pointI]] -= + accumulatedFluidInterfaceDisplacement[pointI]; } twoDPointCorrector twoDCorrector(mesh); @@ -78,7 +78,7 @@ mesh.movePoints(newPoints); - accumulatedFluidInterfaceDisplacement += + accumulatedFluidInterfaceDisplacement += fluidPatchPointsDispl - fluidPatchPointsDisplOld; @@ -94,7 +94,7 @@ "motionU" ) ); - + fixedValueTetPolyPatchVectorField& motionUFluidPatch = refCast ( @@ -106,7 +106,7 @@ refCast(motionUFluidPatch.patch()) ); - motionUFluidPatch == + motionUFluidPatch == tppi.pointToPointInterpolate ( accumulatedFluidInterfaceDisplacement @@ -124,14 +124,14 @@ "pointMotionU" ) ); - + fixedValuePointPatchVectorField& motionUFluidPatch = refCast ( motionU.boundaryField()[fluidPatchID] ); - motionUFluidPatch == + motionUFluidPatch == accumulatedFluidInterfaceDisplacement /runTime.deltaT().value(); } diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMesh.H_old b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMesh.H_old index 4fce86e25..f8994482f 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMesh.H_old +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMesh.H_old @@ -24,7 +24,7 @@ stressMesh.moving(false); // Rotate stress field (old Cauchy becomes new 2nd Piola) - //sigma = 1/J * symm(F & sigma & F.T()); + //sigma = 1/J * symm(F & sigma & F.T()); //rho = rho/J; } diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H index a31defca8..05def2f50 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H @@ -2,45 +2,44 @@ //- move mesh //--------------------------------------------------// if(min(J.internalField()) > 0) - { +{ Info << "Moving mesh using least squares interpolation" << endl; leastSquaresVolPointInterpolation pointInterpolation(stressMesh); - + // Create point mesh 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 9dbd86998..26f76ed67 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H @@ -39,7 +39,7 @@ << abort(FatalError); } -// const label solidPatchStart = +// const label solidPatchStart = // stressMesh.boundaryMesh()[solidPatchID].start(); // const faceZone& solidZone = stressMesh.faceZones()[solidZoneID]; @@ -70,21 +70,21 @@ << abort(FatalError); } -// const label fluidPatchStart = +// const label fluidPatchStart = // mesh.boundaryMesh()[fluidPatchID].start(); // const faceZone& fluidZone = mesh.faceZones()[fluidZoneID]; - // Check mesh motion solver type - bool feMotionSolver = + // Check mesh motion solver type + bool feMotionSolver = mesh.objectRegistry::foundObject - ( + ( "motionU" - ); + ); bool fvMotionSolver = mesh.objectRegistry::foundObject - ( + ( "pointMotionU" ); @@ -94,16 +94,16 @@ ( DU.boundaryField()[solidPatchID].type() != solidTractionFvPatchVectorField::typeName - //!= tractionDisplacementIncrementFvPatchVectorField::typeName + //!= tractionDisplacementIncrementFvPatchVectorField::typeName ) { FatalErrorIn(args.executable()) - << "Bounary condition on " << DU.name() - << " is " - << DU.boundaryField()[solidPatchID].type() - << "for fluid -solid interface patch, instead " - << solidTractionFvPatchVectorField::typeName - //<< tractionDisplacementIncrementFvPatchVectorField::typeName + << "Bounary condition on " << DU.name() + << " is " + << DU.boundaryField()[solidPatchID].type() + << "for fluid -solid interface patch, instead " + << solidTractionFvPatchVectorField::typeName + //<< tractionDisplacementIncrementFvPatchVectorField::typeName << abort(FatalError); } @@ -159,12 +159,12 @@ ), vectorField ( - mesh.boundaryMesh()[fluidPatchID].nPoints(), + mesh.boundaryMesh()[fluidPatchID].nPoints(), vector::zero ) ); } - vectorField& accumulatedFluidInterfaceDisplacement + vectorField& accumulatedFluidInterfaceDisplacement = *accumulatedFluidInterfaceDisplacementPtr; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readFsiControls.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readFsiControls.H index e899e8476..df139c64b 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readFsiControls.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readFsiControls.H @@ -4,9 +4,9 @@ if (couplingProperties.found("couplingScheme")) { couplingScheme = word(couplingProperties.lookup("couplingScheme")); - if + if ( - (couplingScheme == "IQN-ILS") + (couplingScheme == "IQN-ILS") || (couplingScheme == "Aitken") || (couplingScheme == "FixedRelaxation") ) @@ -31,7 +31,7 @@ if (couplingProperties.found("couplingScheme")) // ( // couplingProperties.lookup("couplingReuse") // ) -// ); +// ); scalar interfaceDeformationLimit ( @@ -66,6 +66,6 @@ fsiRelaxationFactor = fsiRelaxationFactorMin; scalar outerCorrTolerance ( readScalar(couplingProperties.lookup("outerCorrTolerance")) -); +); Switch fsi(couplingProperties.lookup("fsi")); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/rotateSolidFields.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/rotateSolidFields.H index e3ed1aab2..2dc37a2c2 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/rotateSolidFields.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/rotateSolidFields.H @@ -5,10 +5,10 @@ Info << "Rotating fields" << endl; F = I + DF; - + //U += DU; Usolid += DU; - + //epsilon += DEpsilon; sigma += DSigma; @@ -16,9 +16,9 @@ //volTensorField Finv = inv(F); J = det(F); - + rho = rho/J; - + //epsilon = symm(Finv.T() & epsilon & Finv); sigma = 1/J * symm(F & sigma & F.T()); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceDisplacement.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceDisplacement.H index a22bc581c..50fb929b9 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceDisplacement.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceDisplacement.H @@ -1,9 +1,9 @@ -Info << "\nTime = " << runTime.timeName() +Info << "\nTime = " << runTime.timeName() << ", iteration: " << outerCorr << endl; if (outerCorr < 3 || couplingScheme == "FixedRelaxation") { - Info << "Current fsi under-relaxation factor: " + Info << "Current fsi under-relaxation factor: " << fsiRelaxationFactor << endl; fluidPatchPointsDisplOld = fluidPatchPointsDispl; @@ -14,7 +14,7 @@ else { if (couplingScheme == "Aitken") { - fsiRelaxationFactor = + fsiRelaxationFactor = -fsiRelaxationFactor *( gSum @@ -33,12 +33,12 @@ else fsiRelaxationFactor = mag(fsiRelaxationFactor); - Info << "Current fsi under-relaxation factor (Aitken): " - << fsiRelaxationFactor << endl; + Info << "Current fsi under-relaxation factor (Aitken): " + << fsiRelaxationFactor << endl; fluidPatchPointsDisplOld = fluidPatchPointsDispl; - fluidPatchPointsDispl += + fluidPatchPointsDispl += fsiRelaxationFactor*fsiResidual; } // else if (couplingScheme == "IQN-ILS") diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceForce.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceForce.H index 2769d4cf8..0e0941464 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceForce.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/setInterfaceForce.H @@ -16,11 +16,11 @@ vectorField fluidZoneTraction ( - mesh.faceZones()[fluidZoneID].size(), + mesh.faceZones()[fluidZoneID].size(), vector::zero ); - const label fluidPatchStart = + const label fluidPatchStart = mesh.boundaryMesh()[fluidPatchID].start(); forAll(fluidPatchTraction, i) @@ -28,7 +28,7 @@ fluidZoneTraction [ mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i) - ] = + ] = fluidPatchTraction[i]; } @@ -38,7 +38,7 @@ scalarField fluidZonePressure ( - mesh.faceZones()[fluidZoneID].size(), + mesh.faceZones()[fluidZoneID].size(), 0.0 ); @@ -47,7 +47,7 @@ fluidZonePressure [ mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i) - ] = + ] = fluidPatchPressure[i]; } @@ -66,7 +66,7 @@ fluidZonePressure ); - const label solidPatchStart = + const label solidPatchStart = stressMesh.boundaryMesh()[solidPatchID].start(); forAll(solidPatchTraction, i) diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H index 4c737efac..66e0155af 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H @@ -47,15 +47,15 @@ DF = gradDU.T(); # include "calculateDSigma.H" - } + } while ( - solverPerf.initialResidual() > convergenceTolerance + solverPerf.initialResidual() > convergenceTolerance && ++iCorr < nCorr ); - Info << "Solving for " << DU.name() - << ", Initial residual = " << initialResidual + Info << "Solving for " << DU.name() + << ", Initial residual = " << initialResidual << ", Final residual = " << solverPerf.initialResidual() << ", No outer iterations " << iCorr << endl; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H index 9b9aa32bb..2ab5b0c25 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H @@ -46,15 +46,15 @@ DF = gradDU.T(); # include "calculateDSigma.H" - } + } while ( - solverPerf.initialResidual() > convergenceTolerance + solverPerf.initialResidual() > convergenceTolerance && ++iCorr < nCorr ); - Info << "Solving for " << DU.name() - << ", Initial residual = " << initialResidual + Info << "Solving for " << DU.name() + << ", Initial residual = " << initialResidual << ", Final residual = " << solverPerf.initialResidual() << ", No outer iterations " << iCorr << endl; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.C b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.C index 14eda463c..4b82db4ba 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.C @@ -140,7 +140,7 @@ void transitionalParabolicVelocityFvPatchVectorField::updateCoeffs() // // Get range and orientation // boundBox bb(patch().patch().localPoints(), true); - + // boundBox bb(vector(0, 0, -0.025334), vector(0, 0.41, 0.025334)); vector ctr = 0.5*(boundBoxMax_ + boundBoxMin_); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.H index 3a6d5b179..e5a640cf7 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/transitionalParabolicVelocity/transitionalParabolicVelocityFvPatchVectorField.H @@ -100,7 +100,7 @@ public: const dictionary& ); - //- Construct by mapping given + //- Construct by mapping given // transitionalParabolicVelocityFvPatchVectorField // onto a new patch transitionalParabolicVelocityFvPatchVectorField diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H index 2e30e7e74..18d79b207 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/Dugdale/DugdaleCohesiveLaw.H @@ -71,7 +71,7 @@ public: DugdaleCohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.C b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.C index 87a91e66d..6ecb71c30 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.C +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.C @@ -89,7 +89,7 @@ Foam::scalar Foam::bilinearCohesiveLaw::traction(scalar delta) const else if (delta > delta1().value()) { - return sigma1().value()*(1.0 - (delta-delta1().value())/(deltaC().value()-delta1().value())); + return sigma1().value()*(1.0 - (delta-delta1().value())/(deltaC().value()-delta1().value())); } return sigmaMax().value() + (sigma1().value()-sigmaMax().value())*delta/delta1().value(); diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.H b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.H index e963487bb..5aed3cd72 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.H +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/bilinear/bilinearCohesiveLaw.H @@ -77,7 +77,7 @@ public: bilinearCohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C index ee9329c0f..9b2b62738 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.C @@ -74,7 +74,7 @@ Foam::autoPtr Foam::cohesiveLaw::New Foam::cohesiveLaw::cohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ) : cohesiveLawCoeffs_(dict.subDict(cohesiveLawName + "Coeffs")), @@ -107,8 +107,8 @@ void Foam::cohesiveLaw::writeDict(Ostream& os) const //- philipc word keyword(type() + "Coeffs"); - // os.writeKeyword(type() + "Coeffs") - os.writeKeyword(keyword) + // os.writeKeyword(type() + "Coeffs") + os.writeKeyword(keyword) << cohesiveLawCoeffs(); } diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H index 6a98e59ce..6ad767f52 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/cohesiveLaw/cohesiveLaw.H @@ -97,7 +97,7 @@ public: static autoPtr New ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); @@ -107,7 +107,7 @@ public: cohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy @@ -124,7 +124,7 @@ public: // Member Functions - + //- Return cohesive law coefficients const dictionary& cohesiveLawCoeffs() const { diff --git a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/linear/linearCohesiveLaw.H b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/linear/linearCohesiveLaw.H index 53d4ee100..d77823b27 100644 --- a/applications/solvers/solidMechanics/solidModels/cohesiveLaws/linear/linearCohesiveLaw.H +++ b/applications/solvers/solidMechanics/solidModels/cohesiveLaws/linear/linearCohesiveLaw.H @@ -71,7 +71,7 @@ public: linearCohesiveLaw ( const word& cohesiveLawName, - const dictionary& dict + const dictionary& dict ); //- Construct as copy diff --git a/applications/solvers/solidMechanics/solidModels/componentReference/componentReference.H b/applications/solvers/solidMechanics/solidModels/componentReference/componentReference.H index f4d4b2e83..37b6d97ae 100644 --- a/applications/solvers/solidMechanics/solidModels/componentReference/componentReference.H +++ b/applications/solvers/solidMechanics/solidModels/componentReference/componentReference.H @@ -171,7 +171,7 @@ public: { checkPatchFace(mesh); } - + //- Construct from dictionary componentReference diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.C index 999652d78..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; - - if(rigidMaster_) + Info << "\tConstructing contact patch pair" + << "\n\t\tmaster patch:\t" << masterPatch_.name() + << "\n\t\tslave patch:\t" << slavePatch_.name() + << endl; + + 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 * * * * * * * * * * * * * * * // @@ -193,9 +199,9 @@ Foam::contactPatchPair::masterTouchFraction() const scalarField pDistToInter(cp_.mesh().boundaryMesh()[masterPatch_.index()].size(), 0.0); // = slaveToMasterInterpolateDeformed.pointDistanceToIntersection(); - + scalarField vertexMasterGap = pDistToInter; - + // Calculate area in contact const faceList& masterPatchLocalFaces = mesh.boundaryMesh()[masterPatch_.index()].localFaces(); @@ -234,7 +240,7 @@ Foam::contactPatchPair::slaveTouchFraction() const scalarField vertexSlaveGap = slavePointPenetration_; // (cp_.mesh().boundaryMesh()[slavePatch_.index()].size(), 0.0); - + // Calculate area in contact const faceList& slavePatchLocalFaces = mesh.boundaryMesh()[slavePatch_.index()].localFaces(); @@ -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 - ); - - tmp tcontactPointForce + cp_.mesh().boundaryMesh()[masterPatch_.index()].meshPoints().size(), + vector::zero + ); + + tmp tcontactPointForce ( - new vectorField(masterPointForce.size(), vector::zero) - ); - vectorField& contactPointForce = tcontactPointForce(); - - forAll (contactPointForce, pointI) + new vectorField(masterPointForce.size(), vector::zero) + ); + vectorField& contactPointForce = tcontactPointForce(); + + forAll (contactPointForce, pointI) { contactPointForce[pointI] = masterPointForce[pointI]; } - - return tcontactPointForce; + + return tcontactPointForce; } @@ -344,22 +350,22 @@ Foam::contactPatchPair::masterPointForce() const Foam::tmp Foam::contactPatchPair::slavePointForce() const -{ - vectorField slavePointForce = totalSlavePointForce_; - - tmp tcontactPointForce - ( - new vectorField(slavePointForce.size(), vector::zero) - ); - - vectorField& contactPointForce = tcontactPointForce(); +{ + vectorField slavePointForce = totalSlavePointForce_; - forAll (contactPointForce, pointI) + tmp tcontactPointForce + ( + new vectorField(slavePointForce.size(), vector::zero) + ); + + vectorField& contactPointForce = tcontactPointForce(); + + 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 fd8697bad..db6c207ba 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactPatchPair.H @@ -27,7 +27,7 @@ Class Description A pair of surfaces in contact. - + SourceFiles contactPatchPair.C @@ -76,7 +76,7 @@ private: //- Reference to contact problem contactProblem& cp_; - + //- patch to patch algorithm const intersection::algorithm alg_; @@ -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 @@ -143,12 +143,12 @@ private: //- interpolation method for passing traction from slave to master word interpolationMethod_; - + //- zoneToZoneInterpolation for the calculation of pointDistanceToIntersection zoneToZoneInterpolation faceZoneMasterToSlaveInterpolator_; //- zoneToZone or ggiZone for interpolation of traction from slave to master - zoneToZoneInterpolation* faceZoneSlaveToMasterInterpolatorPtr_; + zoneToZoneInterpolation* faceZoneSlaveToMasterInterpolatorPtr_; ggiZoneInterpolation* faceZoneGgiInterpolatorPtr_; //- interpolation from slave vertices to slave face centres @@ -223,18 +223,18 @@ public: //- Correct contact data void correct(); - + //- if contact correction on or off 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 4418f9410..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_; + //--------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(); + //- 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(); + //globalMasterPointPenetration = + // faceZoneSlaveToMasterInterpolator.pointDistanceToIntersection(); - - scalarField& slavePointPenetration = slavePointPenetration_; - //scalarField& masterPointPenetration = masterPointPenetration_; + 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) - ]; - - //- 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; - } + //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; + } } - //- 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_; - - 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); + //------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_; + + label numSlaveContactPoints = 0; + label numSlaveContactPointsReducing = 0; + label numSlavesUpdated = 0; + + //- so the procs know the global min + //scalar minSlavePointPenetration = gMin(slavePointPenetration); + scalar minSlavePointPenetration = gMin(globalSlavePointPenetration); - //- 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 - ); - - 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_; + //--------MASTER PROCS WRITES CONTACT INFO FILE----------// + reduce(numSlaveContactPoints, sumOp()); + reduce(numSlaveContactPointsReducing, sumOp()); + + 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; - - 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; +// << "\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; } } diff --git a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C index dfb760925..9ff16f118 100644 --- a/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C +++ b/applications/solvers/solidMechanics/solidModels/contactModel/contactProblem.C @@ -69,48 +69,48 @@ 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); - - contactPatchPairList& contacts = *this; - - contacts.setSize(contactEntries.size()); - - forAll(contacts, contactI) + PtrList contactEntries(is); + + contactPatchPairList& contacts = *this; + + contacts.setSize(contactEntries.size()); + + 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; } - + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -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; - - scalarField& cGapPointsInternal = cGapPoints.internalField(); - - forAll (contacts, contactI) - { - 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(); + const contactPatchPairList& contacts = *this; - forAll(masterBoundaryLabels, pointI) - { - cGapPointsInternal[masterBoundaryLabels[pointI]] = masterGapPoints[pointI]; - } - forAll(slaveBoundaryLabels, pointI) - { - cGapPointsInternal[slaveBoundaryLabels[pointI]] = slaveGapPoints[pointI]; - } + scalarField& cGapPointsInternal = cGapPoints.internalField(); + + forAll (contacts, contactI) + { + 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(); + + 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; - - vectorField& cPointForceInternal = cPointForce.internalField(); - - forAll (contacts, contactI) + pointMesh pMesh(mesh()); + const contactPatchPairList& contacts = *this; + + vectorField& cPointForceInternal = cPointForce.internalField(); + + forAll (contacts, contactI) { - 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(); - - forAll(masterBoundaryLabels, pointI) - { - cPointForceInternal[masterBoundaryLabels[pointI]] = masterContactPointForce[pointI]; - } - forAll(slaveBoundaryLabels, pointI) - { - cPointForceInternal[slaveBoundaryLabels[pointI]] = slaveContactPointForce[pointI]; - } + 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(); + + 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 9a915aaa9..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 @@ -135,7 +135,7 @@ public: //- Return contact pressure field tmp contactPressure() const; - + //- Return a list of contact patch pair names wordList names() const; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C index dfca8536d..3c38dc9f4 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/analyticalPlateHoleTraction/analyticalPlateHoleTractionFvPatchVectorField.C @@ -142,7 +142,7 @@ void analyticalPlateHoleTractionFvPatchVectorField::updateCoeffs() const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - scalarField mu = + scalarField mu = rheology.mu()().boundaryField()[patch().index()]; scalarField lambda = rheology.lambda()().boundaryField()[patch().index()]; @@ -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]; - - if (patch().name() == "hole") - { - curC /= mag(curC); - curC *= 0.5; - - curN = -curC/mag(curC); - } - - Traction[faceI] = - (n[faceI] & plateHoleSolution(curC)); - } + { + vector curC(Cf[faceI].x(), Cf[faceI].y(), 0); + vector curN = n[faceI]; + + if (patch().name() == "hole") + { + curC /= mag(curC); + curC *= 0.5; + + curN = -curC/mag(curC); + } + + Traction[faceI] = + (n[faceI] & plateHoleSolution(curC)); + } //- set patch gradient - vectorField newGradient = - Traction + vectorField newGradient = + Traction - (n & (mu*gradU.T() - (mu + lambda)*gradU)) - n*lambda*tr(gradU); @@ -233,7 +233,7 @@ symmTensor analyticalPlateHoleTractionFvPatchVectorField::plateHoleSolution(cons coordinateSystem cs("polarCS", C, vector(0, 0, 1), C/mag(C)); sigma.xx() = - T*(1 - sqr(a)/sqr(r))/2 + T*(1 - sqr(a)/sqr(r))/2 + T*(1 + 3*pow(a,4)/pow(r,4) - 4*sqr(a)/sqr(r))*::cos(2*theta)/2; sigma.xy() = @@ -242,7 +242,7 @@ symmTensor analyticalPlateHoleTractionFvPatchVectorField::plateHoleSolution(cons sigma.yx() = sigma.xy(); sigma.yy() = - T*(1 + sqr(a)/sqr(r))/2 + T*(1 + sqr(a)/sqr(r))/2 - T*(1 + 3*pow(a,4)/pow(r,4))*::cos(2*theta)/2; @@ -254,7 +254,7 @@ symmTensor analyticalPlateHoleTractionFvPatchVectorField::plateHoleSolution(cons S.xx() = sigma.xx(); S.xy() = sigma.xy(); S.yy() = sigma.yy(); - + return S; } diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C index b76999797..281fcba44 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveLaw/cohesiveLawFvPatchVectorField.C @@ -245,7 +245,7 @@ void cohesiveLawFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); traction_.writeEntry("traction", os); - os.writeKeyword("cohesiveLaw") << law().type() + os.writeKeyword("cohesiveLaw") << law().type() << token::END_STATEMENT << nl; os.writeKeyword("relaxationFactor") << relaxationFactor_ << token::END_STATEMENT << nl; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.C index 22fd6460a..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")) @@ -104,7 +104,7 @@ cohesiveZoneFvPatchVectorField::cohesiveZoneFvPatchVectorField { this->refValue() = vector::zero; } - + if (dict.found("refGradient")) { this->refGrad() = vectorField("refGradient", dict, p.size()); @@ -116,7 +116,7 @@ cohesiveZoneFvPatchVectorField::cohesiveZoneFvPatchVectorField if (dict.found("valueFraction")) { - this->valueFraction() = + this->valueFraction() = symmTensorField("valueFraction", dict, p.size()); } else @@ -210,7 +210,7 @@ void cohesiveZoneFvPatchVectorField::updateCoeffs() const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - const scalarField mu = + const scalarField mu = rheology.mu()().boundaryField()[patch().index()]; const scalarField lambda = @@ -280,17 +280,17 @@ void cohesiveZoneFvPatchVectorField::updateCoeffs() if(magSqr(valueFraction()[faceI]) < SMALL) { - cohesiveTraction = - relaxationFactor_*cohesiveTraction + cohesiveTraction = + relaxationFactor_*cohesiveTraction + (1.0 - relaxationFactor_)*sigmaN[faceI]*n[faceI]; refGrad()[faceI] = ( cohesiveTraction - ( - n[faceI] + n[faceI] & ( - mu[faceI]*gradField[faceI].T() + mu[faceI]*gradField[faceI].T() - (mu[faceI] + lambda[faceI])*gradField[faceI] ) ) @@ -308,7 +308,7 @@ void cohesiveZoneFvPatchVectorField::updateCoeffs() void cohesiveZoneFvPatchVectorField::write(Ostream& os) const { directionMixedFvPatchVectorField::write(os); - os.writeKeyword("cohesiveLaw") << law().type() + os.writeKeyword("cohesiveLaw") << law().type() << token::END_STATEMENT << nl; os.writeKeyword("relaxationFactor") << relaxationFactor_ << token::END_STATEMENT << nl; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H index aed54e215..fa2434a30 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZone/cohesiveZoneFvPatchVectorField.H @@ -175,7 +175,7 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); - + //- Write virtual void write(Ostream&) const; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C index 109c6e618..a566d1fec 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.C @@ -94,8 +94,8 @@ cohesiveZoneIncrementalFvPatchVectorField::cohesiveZoneIncrementalFvPatchVectorF ( cohesiveLaw::New(dict.lookup("cohesiveLaw"), dict).ptr() ), - crackIndicator_(p.size(), 0.0), - crazeIndicator_(p.size(), 0.0), + crackIndicator_(p.size(), 0.0), + crazeIndicator_(p.size(), 0.0), relaxationFactor_(readScalar(dict.lookup("relaxationFactor"))) { if (dict.found("refValue")) @@ -106,7 +106,7 @@ cohesiveZoneIncrementalFvPatchVectorField::cohesiveZoneIncrementalFvPatchVectorF { this->refValue() = vector::zero; } - + if (dict.found("refGradient")) { this->refGrad() = vectorField("refGradient", dict, p.size()); @@ -118,7 +118,7 @@ cohesiveZoneIncrementalFvPatchVectorField::cohesiveZoneIncrementalFvPatchVectorF if (dict.found("valueFraction")) { - this->valueFraction() = + this->valueFraction() = symmTensorField("valueFraction", dict, p.size()); } else @@ -229,7 +229,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - scalarField mu = + scalarField mu = rheology.mu()().boundaryField()[patch().index()]; scalarField lambda = @@ -261,19 +261,19 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() symmTensorField DEpsilonP(size(), symmTensor::zero); if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + const plasticityModel& plasticity = refCast(rheology); - DEpsilonP = + 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 - symmTensorField DSigma = + symmTensorField DSigma = 2*mu*(DEpsilon - DEpsilonP) + I*(lambda*tr(DEpsilon)); @@ -307,11 +307,11 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() valueFraction()[faceI] = symmTensor::zero; crazeIndicator_[faceI] = 1; crackIndicator_[faceI] = 0; - + Pout << "Crack started at face: " << faceI << endl; // Cohesive traction - cohesiveTractionIncrement = + cohesiveTractionIncrement = n[faceI]*law().sigmaMax().value() - n[faceI]*oldSigmaN[faceI]; } @@ -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; @@ -372,7 +372,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() // else // { // // Calculate cohesive traction from cohesive zone model -// cohesiveTractionIncrement = +// cohesiveTractionIncrement = // law().traction(2*Un)*n[faceI] // - n[faceI]*oldSigmaN[faceI]; @@ -383,17 +383,17 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() if(magSqr(valueFraction()[faceI]) < SMALL) { - cohesiveTractionIncrement = - relaxationFactor_*cohesiveTractionIncrement + cohesiveTractionIncrement = + relaxationFactor_*cohesiveTractionIncrement + (1.0 - relaxationFactor_)*DSigmaN[faceI]*n[faceI]; refGrad()[faceI] = ( cohesiveTractionIncrement - ( - n[faceI] + n[faceI] & ( - mu[faceI]*gradDU[faceI].T() + mu[faceI]*gradDU[faceI].T() - (mu[faceI] + lambda[faceI])*gradDU[faceI] ) ) @@ -427,7 +427,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::updateCoeffs() // vectorField nGradUp = (n&gradU.patchInternalField()); // Field gradValue = -// this->patchInternalField() +// this->patchInternalField() // + 0.5*nGradUp/this->patch().deltaCoeffs() // + 0.5*refGrad()/this->patch().deltaCoeffs(); @@ -446,7 +446,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::write(Ostream& os) const directionMixedFvPatchVectorField::write(os); // os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl; // os.writeKeyword("fieldIncrName") << fieldIncrName_ << token::END_STATEMENT << nl; - os.writeKeyword("cohesiveLaw") << law().type() + os.writeKeyword("cohesiveLaw") << law().type() << token::END_STATEMENT << nl; crazeIndicator_.writeEntry("crazeIndicator", os); crackIndicator_.writeEntry("crackIndicator", os); @@ -460,7 +460,7 @@ void cohesiveZoneIncrementalFvPatchVectorField::write(Ostream& os) const makePatchTypeField ( - fvPatchVectorField, + fvPatchVectorField, cohesiveZoneIncrementalFvPatchVectorField ); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.H index b0996fe1e..0f556f9db 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/cohesiveZoneIncremental/cohesiveZoneIncrementalFvPatchVectorField.H @@ -106,7 +106,7 @@ public: const dictionary& ); - //- Construct by mapping given + //- Construct by mapping given // cohesiveZoneIncrementalFvPatchVectorField onto // a new patch cohesiveZoneIncrementalFvPatchVectorField @@ -196,7 +196,7 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); - + // //- Evaluate the patch field // virtual void evaluate(); diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C index 90ca9ee0f..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; } } @@ -120,7 +120,7 @@ snGrad() const { //- fixedValue snGrad with no correction // return (*this - patchInternalField())*this->patch().deltaCoeffs(); - + const fvPatchField& gradField = patch().lookupPatchField ( @@ -133,9 +133,9 @@ snGrad() const //- correction vector vectorField k = delta - n*(n&delta); - return + return ( - *this + *this - (patchInternalField() + (k&gradField.patchInternalField())) )*this->patch().deltaCoeffs(); } diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C index 01ca316e9..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; @@ -195,18 +195,18 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() //---------------------------// const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - scalarField mu = + scalarField mu = rheology.mu()().boundaryField()[patch().index()]; scalarField lambda = rheology.lambda()().boundaryField()[patch().index()]; if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + 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,17 +245,17 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() //- incremental solvers if(fieldName_ == "DU") { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); - - //- increment of traction - Traction = -(n & sigma); + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); + + //- increment of traction + Traction = -(n & sigma); } //---------------------------// //- calculate the normal gradient based on the traction //---------------------------// - vectorField newGradient = + vectorField newGradient = Traction - (n & (mu*gradField.T() - (mu + lambda)*gradField)) - n*lambda*tr(gradField); @@ -263,39 +263,39 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() //- if there is plasticity if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + const plasticityModel& plasticity = 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 fvPatchField& T = - patch().lookupPatchField("T"); - - const scalarField threeKalpha = - (3*lambda + 2*mu)* - thermo.alpha()().boundaryField()[patch().index()]; - - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - - newGradient += (n*threeKalpha*(T - T0)); + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); + + const fvPatchField& T = + patch().lookupPatchField("T"); + + const scalarField threeKalpha = + (3*lambda + 2*mu)* + thermo.alpha()().boundaryField()[patch().index()]; + + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + + 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 501b88bff..5297378c5 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.H @@ -65,12 +65,12 @@ class fixedDisplacementZeroShearFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; - + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; + static const NamedEnum nonLinearNames_; //- if it is a non linear solver diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.C index 0f56006b6..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; } } @@ -137,7 +137,7 @@ snGrad() const { //- fixedValue snGrad with no correction // return (*this - patchInternalField())*this->patch().deltaCoeffs(); - + const fvPatchField& gradField = patch().lookupPatchField ( @@ -150,9 +150,9 @@ snGrad() const //- correction vector vectorField k = delta - n*(n&delta); - return + return ( - *this + *this - (patchInternalField() + (k&gradField.patchInternalField())) )*this->patch().deltaCoeffs(); } @@ -169,15 +169,15 @@ 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_); const vectorField& oldFaceCentres = dimensionedInternalField().mesh().C().boundaryField()[patch().index()]; - + vectorField newFaceCentres = (rotMat & (oldFaceCentres - rotationOrigin_)) + rotationOrigin_; - + fvPatchField::operator== ( newFaceCentres - oldFaceCentres diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.H b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.H index bf7b0984c..e740e95a0 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedRotation/fixedRotationFvPatchVectorField.H @@ -152,7 +152,7 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); - + //- Return the matrix source coefficients corresponding to the // evaluation of the gradient of this patchField virtual tmp > gradientBoundaryCoeffs() const; diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidDirectionMixed/solidDirectionMixedFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidDirectionMixed/solidDirectionMixedFvPatchVectorField.C index a6641ea79..845aed0b6 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidDirectionMixed/solidDirectionMixedFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidDirectionMixed/solidDirectionMixedFvPatchVectorField.C @@ -80,7 +80,7 @@ solidDirectionMixedFvPatchVectorField::solidDirectionMixedFvPatchVectorField Field gradValue = this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); - + //- non-ortho corrected gradValue //- gradField will not have been created so I must do this during updateCoeffs /*const fvPatchField& gradField = @@ -95,7 +95,7 @@ solidDirectionMixedFvPatchVectorField::solidDirectionMixedFvPatchVectorField Field transformGradValue = transform(I - valueFraction(), gradValue); - + Field::operator=(normalValue + transformGradValue); } @@ -144,13 +144,13 @@ void solidDirectionMixedFvPatchVectorField::evaluate(const Pstream::commsTypes) { this->updateCoeffs(); } - + Field normalValue = transform(valueFraction(), refValue()); //- no correction //Field gradValue = //this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); - + //- non-ortho corrected gradValue const fvPatchField& gradField = patch().lookupPatchField("grad(" +fieldName_ + ")"); @@ -160,7 +160,7 @@ void solidDirectionMixedFvPatchVectorField::evaluate(const Pstream::commsTypes) Field gradValue = this->patchInternalField() + (k&gradField.patchInternalField()) + refGrad()/this->patch().deltaCoeffs(); - + Field transformGradValue = transform(I - valueFraction(), gradValue); @@ -188,13 +188,13 @@ Foam::tmp > solidDirectionMixedFvPatchVectorField::snGrad() (this->refGrad()/this->patch().deltaCoeffs()) + (pif) + (k&gradField.patchInternalField()); - + Field transformGradValue = transform(I - (this->valueFraction()), gradValue); Field patchValue = normalValue + transformGradValue; - return + return ( patchValue - ((this->patchInternalField()) + (k&gradField.patchInternalField())) diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C index 666b6367a..33d9fedba 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C @@ -72,31 +72,31 @@ solidTractionFvPatchVectorField { fvPatchVectorField::operator=(patchInternalField()); 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 //- so the gradient scheme should be extendedLeastSquares - if + if ( Foam::word ( @@ -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; } } @@ -203,18 +203,18 @@ void solidTractionFvPatchVectorField::updateCoeffs() //---------------------------// const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - scalarField mu = + scalarField mu = rheology.mu()().boundaryField()[patch().index()]; scalarField lambda = rheology.lambda()().boundaryField()[patch().index()]; if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + 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,94 +235,94 @@ 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"); - - //- increment of traction - Traction = (traction_ - n*pressure_) - (n & sigma); - } + { + const fvPatchField& sigma = + patch().lookupPatchField("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"); - - tensorField F = I + gradField; - tensorField Finv = inv(F); - scalarField J = det(F); - vectorField nCurrent = Finv & n; - nCurrent /= mag(nCurrent); - vectorField tractionCauchy = traction_ - nCurrent*pressure_; + { + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); - 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; - } - } + 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; + } + } 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 + vectorField newGradient = + Traction - (n & (mu*gradField.T() - (mu + lambda)*gradField)) - n*lambda*tr(gradField); //- if there is plasticity if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + const plasticityModel& plasticity = 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 fvPatchField& T = - patch().lookupPatchField("T"); + { + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); - const fvPatchField& threeKalpha = - patch().lookupPatchField("((threeK*rho)*alpha)"); - - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - - newGradient += (n*threeKalpha*(T - T0)); + const fvPatchField& T = + patch().lookupPatchField("T"); + + const fvPatchField& threeKalpha = + patch().lookupPatchField("((threeK*rho)*alpha)"); + + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + + 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 c4f1b6083..f327d4ee0 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H @@ -74,12 +74,12 @@ class solidTractionFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; - + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; + static const NamedEnum nonLinearNames_; //- if it is a non linear solver diff --git a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C index 79c90c974..ce79bd83e 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C @@ -70,29 +70,29 @@ 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 //- so the gradient scheme should be extendedLeastSquares - if + if ( Foam::word ( @@ -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; } } @@ -185,18 +185,18 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() //---------------------------// const rheologyModel& rheology = this->db().objectRegistry::lookupObject("rheologyProperties"); - scalarField mu = + scalarField mu = rheology.mu()().boundaryField()[patch().index()]; scalarField lambda = rheology.lambda()().boundaryField()[patch().index()]; if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + 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,19 +217,19 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() //- incremental solvers if(fieldName_ == "DU") - { - const fvPatchField& sigma = - patch().lookupPatchField("sigma"); - - //- increment of traction - Traction = - (n & sigma); - } + { + const fvPatchField& sigma = + patch().lookupPatchField("sigma"); + + //- increment of traction + Traction = - (n & sigma); + } //---------------------------// //- calculate the normal gradient based on the traction //---------------------------// - vectorField newGradient = + vectorField newGradient = Traction - (n & (mu*gradField.T() - (mu + lambda)*gradField)) - n*lambda*tr(gradField); @@ -237,39 +237,39 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() //- if there is plasticity if(rheology.type() == plasticityModel::typeName) { - const plasticityModel& plasticity = + const plasticityModel& plasticity = 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 fvPatchField& T = - patch().lookupPatchField("T"); - + { + const thermalModel& thermo = + this->db().objectRegistry::lookupObject("thermalProperties"); + + const fvPatchField& T = + patch().lookupPatchField("T"); + const fvPatchField& threeKalpha = - patch().lookupPatchField("((threeK*rho)*alpha)"); - - const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; - - newGradient += (n*threeKalpha*(T - T0)); + patch().lookupPatchField("((threeK*rho)*alpha)"); + + const scalarField T0 = thermo.T0()().boundaryField()[patch().index()]; + + 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 d162ffad5..d65150880 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H @@ -68,12 +68,12 @@ class solidTractionFreeFvPatchVectorField //- non-linear solver options enum nonLinearType - { - OFF, - UPDATED_LAGRANGIAN, - TOTAL_LAGRANGIAN - }; - + { + OFF, + UPDATED_LAGRANGIAN, + TOTAL_LAGRANGIAN + }; + static const NamedEnum nonLinearNames_; //- if it is a non linear solver 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/fvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/solidMechanics/solidModels/fvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 764d08ea9..8d42f6ff6 100644 --- a/applications/solvers/solidMechanics/solidModels/fvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/solidMechanics/solidModels/fvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -171,7 +171,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() const fvPatchField& gradU = patch().lookupPatchField("grad(" +UName_ + ")"); - + gradient() = ( (traction_ - (pressure_)*n) diff --git a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C index e2bed35e7..936a49141 100644 --- a/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C +++ b/applications/solvers/solidMechanics/solidModels/interpolation/leastSquaresVolPointInterpolation/leastSquaresVolPointInterpolation.C @@ -38,275 +38,275 @@ 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_; const pointField& points = mesh.points(); - + //- construct 4x4 A matrix for each point //List& A = A_; - + //- 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]; + + 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][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][3][0] += x; + A[pointi][3][1] += y; + A[pointi][3][2] += z; + //A[pointi][3][3] = pointCells.size(); // set above + } + } - //- 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); - - 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][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 - } - } - //- 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); - - label globalPointi = mesh.boundaryMesh()[patchi].meshPoints()[pointi]; + 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); - 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][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]; + 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); - - 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][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][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][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]; + + 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][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][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_; const pointField& points = mesh.points(); - + //List >& B = B_; for (direction compi = 0; compi < 3; compi++) - { - forAll(points, pointi) - { - const labelList& pointCells = mesh.pointCells()[pointi]; - - 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& 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; - } - } - - //- 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; - - vectorField phiNeiField = vf.boundaryField()[patchi].patchNeighbourField(); + { + forAll(points, pointi) + { + const labelList& pointCells = mesh.pointCells()[pointi]; - 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]; - - //- this is the value of phi at the cell centre in the neighbour (i.e. across the interface) - scalar phiCompi = phiNeiField[neiCelli].component(compi); + forAll(pointCells, pointCelli) + { + const label& celli = pointCells[pointCelli]; - 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]; + 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); - 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); - } + const scalar& phiCompi = vf.internalField()[celli].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[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; + } + } - void leastSquaresVolPointInterpolation::interpolate - ( - const GeometricField& vf, - GeometricField& pf //Field& pf - ) const - { + //- 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; + + 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); + + 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); + + 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]; + + 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 +} + + +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(); - - 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); - - pf[pointi].component(compi) = a*x + b*y + c*z + d; - } - } + //- 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); + + //- 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; + } + } //- 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 8c21cff3e..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 @@ -125,7 +125,7 @@ void plasticityModel::correct() // rheologyModel::correct(); Info << "\tCorrecting plasticity model ... " << flush; - const volSymmTensorField DEpsilon = + const volSymmTensorField DEpsilon = symm(gradDU_) + dimensioned ( @@ -135,7 +135,7 @@ void plasticityModel::correct() ); const volScalarField epsilonEq = - sqrt((2.0/3.0)*magSqr(dev(epsilon_ + DEpsilon))) + sqrt((2.0/3.0)*magSqr(dev(epsilon_ + DEpsilon))) + dimensionedScalar("SMALL", dimless, SMALL); scalarField& sigmaYI = sigmaY_.internalField(); @@ -164,7 +164,7 @@ void plasticityModel::correct() - sqrt((2.0/3.0)*magSqr(dev(epsilon_))) + dimensionedScalar("SMALL", dimless, SMALL); - const volSymmTensorField DSigma = + const volSymmTensorField DSigma = 2*mu_*(DEpsilon - DEpsilonP_) + I*(lambda_*tr(DEpsilon)); const volSymmTensorField& oldSigma = sigma(); @@ -173,7 +173,7 @@ void plasticityModel::correct() const volSymmTensorField sigma_ = sigma() + DSigma; - const volScalarField sigmaEq = + const volScalarField sigmaEq = sqrt(1.5*magSqr(dev(sigma_))) + dimensionedScalar("SMALL", dimPressure, SMALL); @@ -226,9 +226,9 @@ void plasticityModel::correct() { betaI[cellI] = 0.0; curDEpsEPred = DEpsilonI[cellI]; - + if - ( + ( (DEpsilonEqI[cellI] >= 0) && (sigmaEqEI[cellI] >= sigmaYI[cellI]) ) @@ -236,133 +236,132 @@ void plasticityModel::correct() scalar C = sqr(oldSigmaEqI[cellI]) - sqr(sigmaYI[cellI]); 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((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) *( - DSigmaEI[cellI] + DSigmaEI[cellI] - (lambdaI[cellI]/(2*muI[cellI] + 3*lambdaI[cellI] + SMALL)) *tr(DSigmaEI[cellI])*I ); - + betaI[cellI] = 1.0 - (devSigmaI[cellI] && curDEpsEPred) - /((devSigmaI[cellI] && DEpsilonI[cellI]) + SMALL); + /((devSigmaI[cellI] && DEpsilonI[cellI]) + SMALL); } } - + betaI[cellI] = max(betaI[cellI], 0.0); betaI[cellI] = min(betaI[cellI], 1.0); } - + // Update beta at boundary 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]); + + 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); } - - betaPatch[faceI] = max(betaPatch[faceI], 0.0); - betaPatch[faceI] = min(betaPatch[faceI], 1.0); } - } } - + // Update plastic strain increment - scalar rf = + scalar rf = readScalar(plasticityModelCoeffs_.lookup("relaxationFactor")); - volSymmTensorField newDEpsilonP = + volSymmTensorField newDEpsilonP = 4.5*beta_*mu_*(devSigma && DEpsilon)*devSigma /( (Ep_ + 3*mu_)*sqr(sigmaEq) @@ -409,9 +408,9 @@ void plasticityModel::updateYieldStress() { sigmaYI[cellI] = sigmaEqI[cellI]; - Info << " Internal cell " << cellI + Info << " Internal cell " << cellI << " Yield stress updated to Sy= " - << sigmaEqI[cellI] * 1.0E-06 << " MPa" + << sigmaEqI[cellI] * 1.0E-06 << " MPa" << endl; } } @@ -420,35 +419,34 @@ 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; } bool plasticityModel::read() { - if (regIOobject::read()) { return true; diff --git a/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.H b/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.H index 266727264..f8deccbf5 100644 --- a/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.H +++ b/applications/solvers/solidMechanics/solidModels/plasticityModel/plasticityModel.H @@ -111,17 +111,17 @@ public: { return DEpsilonP_; } - + const volScalarField& newMu() const { return mu_; } - + const volScalarField& newLambda() const { return lambda_; } - + //- Correct plastic strain increment virtual void correct(); diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C index ce08a4439..e7c08e118 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/BurgersViscoelastic/BurgersViscoelastic.C @@ -107,7 +107,7 @@ Foam::tmp Foam::BurgersViscoelastic::E(scalar t) const + eta2_.value()/k2_.value(); scalar p2 = eta1_.value()*eta2_.value()/(k1_.value()*k2_.value()); - + scalar q1 = eta1_.value(); scalar q2 = eta1_.value()*eta2_.value()/k2_.value(); @@ -120,7 +120,7 @@ Foam::tmp Foam::BurgersViscoelastic::E(scalar t) const E = (q1 - q2*r1)*exp(-r1*t)/A - (q1 - q2*r2)*exp(-r2*t)/A; } - + tmp tresult ( @@ -178,7 +178,7 @@ Foam::tmp Foam::BurgersViscoelastic::J(scalar t) const if(t >= 0) { - J = 1.0/k1_.value() + J = 1.0/k1_.value() + (1 - exp(-k2_.value()*t/eta2_.value()))/k2_.value() + t/eta1_.value(); } diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C index ea312d8b3..d6d2a4526 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/KelvinSLSViscoelastic/KelvinSLSViscoelastic.C @@ -102,14 +102,14 @@ Foam::tmp Foam::KelvinSLSViscoelastic::E(scalar t) const if(t>=0) { scalar p1 = eta2_.value()/(k1_.value() + k2_.value()); - + scalar q0 = k1_.value()*k2_.value()/(k1_.value() + k2_.value()); scalar q1 = k1_.value()*eta2_.value()/(k1_.value() + k2_.value()); E = q0 + (q1/p1 - q0)*exp(-t/p1); } - + tmp tresult ( @@ -168,7 +168,7 @@ Foam::tmp Foam::KelvinSLSViscoelastic::J(scalar t) const if(t >= 0) { scalar p1 = eta2_.value()/(k1_.value() + k2_.value()); - + scalar q0 = k1_.value()*k2_.value()/(k1_.value() + k2_.value()); scalar q1 = k1_.value()*eta2_.value()/(k1_.value() + k2_.value()); diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C index b604380ca..883c9f3b2 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellElasticViscoelastic/MaxwellElasticViscoelastic.C @@ -183,8 +183,8 @@ Foam::MaxwellElasticViscoelastic::J(scalar t) const mesh(), dimensionedScalar ( - "J", - dimless/k_.dimensions(), + "J", + dimless/k_.dimensions(), 1.0/k_.value() + t/eta_.value() ), zeroGradientFvPatchScalarField::typeName diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C index a660196ae..cc3b7d900 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellSLSViscoelastic/MaxwellSLSViscoelastic.C @@ -101,7 +101,7 @@ Foam::tmp Foam::MaxwellSLSViscoelastic::E(scalar t) const { E = k2_.value() + k1_.value()*exp(-k1_.value()*t/eta1_.value()); } - + tmp tresult ( diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C index 51973f000..228adcda8 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/MaxwellViscoelastic/MaxwellViscoelastic.C @@ -169,8 +169,8 @@ Foam::tmp Foam::MaxwellViscoelastic::J(scalar t) const mesh(), dimensionedScalar ( - "J", - dimless/k_.dimensions(), + "J", + dimless/k_.dimensions(), 1.0/k_.value() + t/eta_.value() ), zeroGradientFvPatchScalarField::typeName diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C index 8bc490cdc..08d264129 100644 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/PronyViscoelastic/PronyViscoelastic.C @@ -105,7 +105,7 @@ Foam::tmp Foam::PronyViscoelastic::E(scalar t) const { E += k_[i]*exp(-t/tau_[i]); } - + if(t < 0) { E = 0; @@ -162,7 +162,7 @@ Foam::tmp Foam::PronyViscoelastic::nu(scalar t) const Foam::tmp Foam::PronyViscoelastic::J(scalar t) const { notImplemented(type() + "::J(scalar t)"); - + return 1.0/E(t); } diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/elasticNLPlastic/elasticNLPlastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/elasticNLPlastic/elasticNLPlastic.C index 66670d81c..81c3717a3 100755 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/elasticNLPlastic/elasticNLPlastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/elasticNLPlastic/elasticNLPlastic.C @@ -89,11 +89,11 @@ Foam::tmp Foam::elasticNLPlastic::rho() const Foam::tmp Foam::elasticNLPlastic::E() const { - // Correction of modulus of elasticity to account for + // Correction of modulus of elasticity to account for // stress-strain curve continuity! - // Done according to yield stress value - E = sigmaY/epsY! + // Done according to yield stress value - E = sigmaY/epsY! - dimensionedScalar Ecorr = + dimensionedScalar Ecorr = sigmaY_ /::exp ( @@ -103,7 +103,7 @@ Foam::tmp Foam::elasticNLPlastic::E() const /bCf_.value() ) /nCf_.value() - ); + ); return tmp ( @@ -217,7 +217,7 @@ Ep(const volScalarField& sigmaEq) const scalar epsY = exp ( log ( log(matStrength_/(matStrength_ - sigmaY_)).value() /bCf_.value() ) /nCf_.value() ); - dimensionedScalar Ecorr = sigmaY_ /epsY; + dimensionedScalar Ecorr = sigmaY_ /epsY; forAll(sigmaEqI, cellI) { @@ -227,7 +227,7 @@ Ep(const volScalarField& sigmaEq) const dimensionedScalar Ep = matStrength_*bCf_*nCf_ *pow(epsCurrI, nCf_ - 1.0) *exp(-bCf_*pow(epsCurrI, nCf_)); - tresult().internalField()[cellI] = + tresult().internalField()[cellI] = Ep.value()/(1.0 - Ep.value()/Ecorr.value()); } diff --git a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C index 97cd68768..79f806251 100755 --- a/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C +++ b/applications/solvers/solidMechanics/solidModels/rheologyModel/rheologyLaws/nonLinearElasticPlastic/nonLinearElasticPlastic.C @@ -129,7 +129,7 @@ E(const volScalarField& epsEq) const zeroGradientFvPatchScalarField::typeName ) ); - + scalar epsY = exp ( log ( log(matStrength_/(matStrength_ - sigmaY_)).value() /bCf_.value() ) /nCf_.value() ); @@ -141,9 +141,9 @@ E(const volScalarField& epsEq) const dimensionedScalar E = matStrength_*bCf_*nCf_ *pow(epsEqI[cellI], nCf_ - 1.0) *exp(-bCf_*pow(epsEqI[cellI], nCf_)); - // Correction of initial modulus to avoid infinity/GREAT + // 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) { @@ -152,7 +152,7 @@ E(const volScalarField& epsEq) const } if(epsEqI[cellI] > epsY) - { + { E = matStrength_*bCf_*nCf_*pow(epsY, nCf_ - 1.0) *exp(-bCf_*pow(epsY, nCf_)); } @@ -269,7 +269,7 @@ Ep(const volScalarField& sigmaEq) const dimensionedScalar Ep = matStrength_*bCf_*nCf_ *pow(epsCurrI, nCf_ - 1.0) *exp(-bCf_*pow(epsCurrI, nCf_)); - tresult().internalField()[cellI] = + tresult().internalField()[cellI] = Ep.value()/(1.0 - Ep.value()/E.value()); } diff --git a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C index cc00dfd15..e51b79900 100644 --- a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C +++ b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.C @@ -66,8 +66,8 @@ void solidInterface::makeSubMesh() const << "sub-mesh already exist" << abort(FatalError); } - - const volScalarField& materials = + + const volScalarField& materials = mesh_.lookupObject("materials"); const scalarField& materialsI = materials.internalField(); @@ -79,9 +79,9 @@ void solidInterface::makeSubMesh() const forAll(neighbour, faceI) { - if + if ( - mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) + mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) > SMALL ) { @@ -141,10 +141,10 @@ void solidInterface::makeGlobalInterFaces() const << "global inter-faces addressing already exist" << abort(FatalError); } - + if (mesh_.foundObject("materials")) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); const scalarField& materialsI = materials.internalField(); @@ -153,19 +153,19 @@ void solidInterface::makeGlobalInterFaces() const const unallocLabelList& neighbour = mesh_.neighbour(); labelHashSet interFacesSet; - + forAll(neighbour, faceI) { - if + if ( - mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) + mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) > SMALL ) { interFacesSet.insert(faceI); } } - + globalInterFacesPtr_ = new labelList(interFacesSet.toc()); faceSet faMeshSet(mesh_, "faMeshSet", interFacesSet); @@ -195,8 +195,8 @@ void solidInterface::makeLocalInterFaces() const << "local inter-faces addressing already exist" << abort(FatalError); } - - const volScalarField& materials = + + const volScalarField& materials = mesh_.lookupObject("materials"); volScalarField subMaterials = subMesh().interpolate(materials); @@ -212,9 +212,9 @@ void solidInterface::makeLocalInterFaces() const forAll(neighbour, faceI) { - if + if ( - mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) + mag(materialsI[neighbour[faceI]] - materialsI[owner[faceI]]) > SMALL ) { @@ -243,7 +243,7 @@ void solidInterface::makeInterfaceDisplacement() const << "interface displacement field already exist" << abort(FatalError); } - + interfaceUPtr_ = new vectorField(globalInterFaces().size(), vector::zero); } @@ -268,7 +268,7 @@ void solidInterface::makeProcessorPatches() const if (mesh_.foundObject("materials")) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); labelHashSet processorPatches; @@ -277,7 +277,7 @@ void solidInterface::makeProcessorPatches() const { if (mesh_.boundary()[patchI].type() == processorFvPatch::typeName) { - scalarField ownMat = + scalarField ownMat = materials.boundaryField()[patchI].patchInternalField(); scalarField ngbMat = @@ -328,17 +328,17 @@ void solidInterface::makeProcessorPatchFaces() const forAll(procPatches, patchI) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); label curProcPatch = procPatches[patchI]; - scalarField ownMat = + scalarField ownMat = materials.boundaryField()[curProcPatch].patchInternalField(); scalarField ngbMat = materials.boundaryField()[curProcPatch].patchNeighbourField(); - + labelHashSet curProcPatchFaces; forAll(ownMat, faceI) @@ -346,7 +346,7 @@ void solidInterface::makeProcessorPatchFaces() const if (mag(ownMat[faceI] - ngbMat[faceI]) > SMALL) { curProcPatchFaces.insert(faceI); - } + } } processorPatchFaces[patchI] = labelList(curProcPatchFaces.toc()); @@ -372,7 +372,7 @@ void solidInterface::makeProcessorInterfaceDisplacement() const << abort(FatalError); } - processorInterfaceUPtr_ = + processorInterfaceUPtr_ = new FieldField(processorPatches().size()); FieldField& processorInterfaceU = *processorInterfaceUPtr_; @@ -380,7 +380,7 @@ void solidInterface::makeProcessorInterfaceDisplacement() const { processorInterfaceU.set ( - patchI, + patchI, new vectorField(processorPatchFaces()[patchI].size(), vector::zero) ); } @@ -405,17 +405,17 @@ void solidInterface::makeIndicator() const << abort(FatalError); } - indicatorPtr_ = + indicatorPtr_ = new List(globalInterFaces().size(), labelPair(0, 0)); - List& indicator = *indicatorPtr_; + List& indicator = *indicatorPtr_; const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& neighbour = mesh_.neighbour(); if (mesh_.foundObject("materials")) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); forAll(globalInterFaces(), faceI) @@ -423,16 +423,16 @@ void solidInterface::makeIndicator() const label curFace = globalInterFaces()[faceI]; labelPair& curPair = indicator[faceI]; - + 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]]); } } } @@ -601,7 +601,7 @@ void solidInterface::correct(fvVectorMatrix& UEqn) const volVectorField& U = UEqn.psi(); const vectorField& UI = U.internalField(); - const volTensorField& gradU = + const volTensorField& gradU = mesh_.lookupObject("grad(" + U.name() + ')'); const tensorField& gradUI = gradU.internalField(); @@ -717,7 +717,7 @@ void solidInterface::correct(fvVectorMatrix& UEqn) // Interface displacement - vector curInterUt = + vector curInterUt = ( ownMu*ownUt*ngbDn + ngbMu*ngbUt*ownDn + ownDn*ngbDn*(ngbMu*ngbSGradUn - ownMu*ownSGradUn) @@ -759,12 +759,12 @@ void solidInterface::correct(fvVectorMatrix& UEqn) source[curOwner] += ( - ownK*ngbDn*ngbLambda*ngbTrSGradUt + ownK*ngbDn*ngbLambda*ngbTrSGradUt + ngbK*ownDn*ownLambda*ownTrSGradUt )*ownN*magS /(ownK*ngbDn + ngbK*ownDn) + ( - ownMu*ngbMu*ngbDn*ngbSGradUn + ownMu*ngbMu*ngbDn*ngbSGradUn + ownMu*ngbMu*ownDn*ownSGradUn )*magS /(ownMu*ngbDn + ngbMu*ownDn); @@ -778,12 +778,12 @@ void solidInterface::correct(fvVectorMatrix& UEqn) source[curNeighbour] -= ( - ownK*ngbDn*ngbLambda*ngbTrSGradUt + ownK*ngbDn*ngbLambda*ngbTrSGradUt + ngbK*ownDn*ownLambda*ownTrSGradUt )*ownN*magS /(ownK*ngbDn + ngbK*ownDn) + ( - ownMu*ngbMu*ngbDn*ngbSGradUn + ownMu*ngbMu*ngbDn*ngbSGradUn + ownMu*ngbMu*ownDn*ownSGradUn )*magS /(ownMu*ngbDn + ngbMu*ownDn); @@ -792,12 +792,12 @@ void solidInterface::correct(fvVectorMatrix& UEqn) // Processor faces - + forAll(processorPatchFaces(), patchI) { label curPatch = processorPatches()[patchI]; - vectorField& curProcInterU = + vectorField& curProcInterU = processorInterfaceDisplacement()[patchI]; const vectorField curProcOwnU = @@ -828,7 +828,7 @@ void solidInterface::correct(fvVectorMatrix& UEqn) lambda.boundaryField()[curPatch].patchInternalField(); const scalarField curProcNgbLambda = lambda.boundaryField()[curPatch].patchNeighbourField(); - + const unallocLabelList& curProcFaceCells = mesh_.boundary()[curPatch].faceCells(); @@ -868,7 +868,7 @@ void solidInterface::correct(fvVectorMatrix& UEqn) // Interface displacement - vector curInterUt = + vector curInterUt = ( ownMu*ownUt/ownDn + ngbMu*ngbUt/ngbDn - (ngbMu*ngbSGradUn + ownMu*ownSGradUn) @@ -889,13 +889,13 @@ void solidInterface::correct(fvVectorMatrix& UEqn) // Implicit coupling scalar wRevLin = 1.0 - curProcW[curFace]; - + scalar ownK = (2*ownMu + ownLambda); scalar ngbK = (2*ngbMu + ngbLambda); - + scalar Kf = 1.0/(wRevLin/ownK + (1.0-wRevLin)/ngbK); scalar muf = 1.0/(wRevLin/ownMu + (1.0-wRevLin)/ngbMu); - + scalar Dnf = 1.0/curProcDeltaCoeffs[curFace]; // Owner @@ -922,14 +922,14 @@ void solidInterface::correct(fvVectorMatrix& UEqn) void solidInterface::modifyProperties ( - surfaceScalarField& muf, + surfaceScalarField& muf, surfaceScalarField& lambdaf ) const { forAll(globalInterFaces(), faceI) { label curGlobalFace = globalInterFaces()[faceI]; - + muf.internalField()[curGlobalFace] = 0; lambdaf.internalField()[curGlobalFace] = 0; } @@ -964,7 +964,7 @@ tmp solidInterface::grad(volVectorField& U) const IOobject::NO_WRITE ), mesh_, - dimensionedTensor("zero", dimless, tensor::zero) + dimensionedTensor("zero", dimless, tensor::zero) ) ); volTensorField& gradU = tGradU(); @@ -978,10 +978,10 @@ tmp solidInterface::grad(volVectorField& U) const { const skewCorrectionVectors& scv = skewCorrectionVectors::New(mesh_); - const volTensorField& gradU = + const volTensorField& gradU = mesh_.lookupObject("grad(" + U.name() + ')'); - Uf += + Uf += ( scv() & linear(mesh_).interpolate @@ -990,7 +990,7 @@ tmp solidInterface::grad(volVectorField& U) const ) ); -// Uf += +// Uf += // ( // scv() // & linear(mesh_).interpolate @@ -1043,11 +1043,11 @@ tmp solidInterface::sigmaA() const const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& neighbour = mesh_.neighbour(); - const volVectorField& U = + const volVectorField& U = mesh_.lookupObject("U"); const vectorField& UI = U.internalField(); - const volTensorField& gradU = + const volTensorField& gradU = mesh_.lookupObject("grad(" + U.name() + ')'); const tensorField& gradUI = gradU.internalField(); @@ -1069,7 +1069,7 @@ tmp solidInterface::sigmaA() const if (mesh_.foundObject("materials")) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); tensorField gradUA(sigmaA.size(), tensor::zero); @@ -1108,7 +1108,7 @@ tmp solidInterface::sigmaA() const // { // label curFace = globalInterFaces()[faceI]; // label index = findIndex(faceLabels, curFace); - + // Us.internalField()[index] = interU[faceI]; // } // Us.correctBoundaryConditions(); @@ -1118,7 +1118,7 @@ tmp solidInterface::sigmaA() const // { // label curFace = globalInterFaces()[faceI]; // label index = findIndex(faceLabels, curFace); - + // interSGradU[faceI] = sGradU[index]; // } // } @@ -1162,11 +1162,11 @@ tmp solidInterface::sigmaB() const const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& neighbour = mesh_.neighbour(); - const volVectorField& U = + const volVectorField& U = mesh_.lookupObject("U"); const vectorField& UI = U.internalField(); - const volTensorField& gradU = + const volTensorField& gradU = mesh_.lookupObject("grad(" + U.name() + ')'); const tensorField& gradUI = gradU.internalField(); @@ -1188,13 +1188,13 @@ tmp solidInterface::sigmaB() const if (mesh_.foundObject("materials")) { - const volScalarField& materials = + const volScalarField& materials = mesh_.lookupObject("materials"); tensorField gradUB(sigmaB.size(), tensor::zero); scalarField muB(sigmaB.size(), 0); scalarField lambdaB(sigmaB.size(), 0); - + // // Calc surface gradient using FAM // tensorField interSGradU(interU.size(), tensor::zero); // { @@ -1227,7 +1227,7 @@ tmp solidInterface::sigmaB() const // { // label curFace = globalInterFaces()[faceI]; // label index = findIndex(faceLabels, curFace); - + // Us.internalField()[index] = interU[faceI]; // } // Us.correctBoundaryConditions(); @@ -1237,7 +1237,7 @@ tmp solidInterface::sigmaB() const // { // label curFace = globalInterFaces()[faceI]; // label index = findIndex(faceLabels, curFace); - + // interSGradU[faceI] = sGradU[index]; // } // } @@ -1289,7 +1289,7 @@ const List& solidInterface::indicator() const void solidInterface::correctGrad ( - const volVectorField& U, + const volVectorField& U, volTensorField& gradU ) const { @@ -1311,11 +1311,11 @@ void solidInterface::correctGrad Us.internalField()[curFace] = interU[faceI]; } - volTensorField gaussGradU = + volTensorField gaussGradU = fv::gaussGrad(sMesh).grad(Us); fv::gaussGrad(sMesh).correctBoundaryConditions ( - subU, + subU, gaussGradU ); @@ -1324,7 +1324,7 @@ void solidInterface::correctGrad label curFace = localInterFaces()[faceI]; gradU.internalField() - [subMesh().cellMap()[owner[curFace]]] = + [subMesh().cellMap()[owner[curFace]]] = gaussGradU.internalField()[owner[curFace]]; gradU.internalField() diff --git a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.H b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.H index 116b32072..ad08b821c 100644 --- a/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.H +++ b/applications/solvers/solidMechanics/solidModels/solidInterface/solidInterface.H @@ -62,7 +62,7 @@ namespace Foam class solidInterface { // Private data - + const fvMesh& mesh_; const rheologyModel& rheology_; @@ -102,7 +102,7 @@ class solidInterface // Private Member Functions // Make demand-driven data - + //- Make sub-mesh void makeSubMesh() const; @@ -149,11 +149,11 @@ public: ); // Destructor - ~solidInterface(); + ~solidInterface(); // Member Functions - const fvMeshSubset& subMesh() const; + const fvMeshSubset& subMesh() const; const labelList& globalInterFaces() const; @@ -175,7 +175,7 @@ public: void modifyProperties ( - surfaceScalarField& muf, + surfaceScalarField& muf, surfaceScalarField& lambdaf ) const; 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/decomposeParDict index fe6e21aa0..13533424b 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactIncrSolidFoam/slidingBallIncr/system/decomposeParDict @@ -28,7 +28,7 @@ simpleCoeffs distributed no; -roots +roots ( ); 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/decomposeParDict index 01c8b9f2f..530d12090 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactNonLinULSolidFoam/slidingBallNonLin/system/decomposeParDict @@ -77,7 +77,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" 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/0/cellDist b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/cellDist index 07cf79429..cf38cc063 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/cellDist +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/0/cellDist @@ -17,7 +17,7 @@ FoamFile dimensions [0 0 0 0 0 0 0]; -internalField nonuniform List +internalField nonuniform List 800 ( 0 diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/contactProperties b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/contactProperties index 252182aae..8edf044ec 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/contactProperties +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/constant/contactProperties @@ -27,19 +27,19 @@ contacts masterPatch bottomBrickUp; slavePatch topBrickDown; contactGapTol 5e-8; - + rigidMaster no; interpolationMethod patchToPatch; //interpolationMethod ggi;; - + penaltyScaleFactor 4e5; returnScaleFactor 1.5; - + projectionDir contactSphere; projectionAlgo visible; penetrationLimit -0.03; nContactSettleIterations 0; - + smoothContactPatches no; shearCorrection no; shearFactor 1e9; 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/decomposeParDict index dd2adf560..53e1e3c09 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/slidingBall/system/decomposeParDict @@ -28,7 +28,7 @@ simpleCoeffs distributed no; -roots +roots ( ); 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/decomposeParDict index e30c7c462..e33406cb5 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/decomposeParDict @@ -29,7 +29,7 @@ simpleCoeffs distributed no; -roots +roots ( ); 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/mapFieldsDict b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/mapFieldsDict index 3f2815f98..978065550 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/mapFieldsDict +++ b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/mapFieldsDict @@ -23,7 +23,7 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // List of pairs of source/target patches for mapping -patchMap +patchMap ( bottomBrickDown bottomBrickDown @@ -45,7 +45,7 @@ patchMap // List of target patches cutting the source domain (these need to be // handled specially e.g. interpolated from internal values) -cuttingPatches +cuttingPatches ( ); diff --git a/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict b/applications/solvers/solidMechanics/tutorials/elasticContactSolidFoam/sphereAndBrick/system/sampleDict index 043224651..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.) @@ -61,7 +61,7 @@ writeFormat raw; // cloud specified points, uses findCell // // -// axis: how to write point coordinate. Choice of +// axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only // - xyz: three columns // (probably does not make sense for anything but raw) diff --git a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict index c73e5aa31..1b030ac4f 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict +++ b/applications/solvers/solidMechanics/tutorials/elasticGravitySolidFoam/gravityBlock/constant/polyMesh/blockMeshDict @@ -24,57 +24,57 @@ FoamFile convertToMeters 1; -vertices +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 +blocks ( hex ( 0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1) ); -edges +edges ( ); -patches +patches ( - patch front + patch front ( - ( 4 5 6 7) + ( 4 5 6 7) ) - - patch back + + patch back ( ( 0 3 2 1) ) - - patch left + + patch left ( (0 4 7 3) ) - + 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 afac29e71..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.) @@ -62,7 +62,7 @@ surfaceFormat vtk; // cloud specified points, uses findCell // // -// axis: how to write point coordinate. Choice of +// axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only // - xyz: three columns // (probably does not make sense for anything but raw) @@ -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 c94903b2b..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.) @@ -61,7 +61,7 @@ writeFormat raw; // cloud specified points, uses findCell // // -// axis: how to write point coordinate. Choice of +// axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only // - xyz: three columns // (probably does not make sense for anything but raw) @@ -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/elasticIncrSolidFoam/incrPlateHole/constant/timeVsRightTraction b/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/constant/timeVsRightTraction index 607889de9..fe06c78de 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/constant/timeVsRightTraction +++ b/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/constant/timeVsRightTraction @@ -2,5 +2,5 @@ (0 (0 0 0)) (1 (1e4 0 0)) (3 (2e4 0 0)) - (5 (1e3 0 0)) + (5 (1e3 0 0)) ) diff --git a/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticIncrSolidFoam/incrPlateHole/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/Allrun b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/Allrun index 4c1a4ab48..00348b2fb 100755 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/Allrun +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/Allrun @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh currDir=`pwd` application=`basename $currDir` 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/largeStrainCantileverBeam/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/decomposeParDict index 9f40aa547..8a8e8c385 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/fvSolution index 93776a53f..dd22ac990 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/system/fvSolution @@ -23,11 +23,11 @@ solvers relTol 0.1; //minIter 0; //maxIter 1000; - + solver PCG; preconditioner DIC; - - /* + + /* solver GAMG; smoother GaussSeidel; nPreSweeps 0; @@ -39,7 +39,7 @@ solvers nCellsInCoarsestLevel 120; agglomerator faceAreaPair; mergeLevels 1; - */ + */ /* solver amgSolver; cycle W-cycle; 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/nonLinBlock/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/decomposeParDict index 9f40aa547..8a8e8c385 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/fvSolution index b49ad16d6..3a0e40180 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/nonLinBlock/system/fvSolution @@ -23,11 +23,11 @@ solvers relTol 0.1; //minIter 0; //maxIter 1000; - + solver PCG; preconditioner DIC; - - /* + + /* solver GAMG; smoother GaussSeidel; nPreSweeps 0; @@ -39,7 +39,7 @@ solvers nCellsInCoarsestLevel 120; agglomerator faceAreaPair; mergeLevels 1; - */ + */ /* solver amgSolver; cycle W-cycle; 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/decomposeParDict index 02e9221ee..bbbcf37f7 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinTLSolidFoam/rotateSphereTL/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" 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/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/decomposeParDict index 02e9221ee..bbbcf37f7 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/rotateSphere/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" 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/constant/polyMesh/blockMeshDict b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/polyMesh/blockMeshDict index ced7832be..00967e3bf 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/polyMesh/blockMeshDict +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/polyMesh/blockMeshDict @@ -2,13 +2,13 @@ /* ------------------------------------------------------------------------------- ========= | dictionary - \\ / | + \\ / | \\ / | Name: blockMeshDict \\ / | Family: FoamX configuration file - \\/ | + \\/ | F ield | FOAM version: 2.2 O peration | Product of Nabla Ltd. - A and | + A and | M anipulation | Email: Enquiries@Nabla.co.uk ------------------------------------------------------------------------------- */ @@ -32,7 +32,7 @@ FoamFile convertToMeters 1; -vertices +vertices ( (0.5 0 0) (1 0 0) @@ -58,7 +58,7 @@ vertices (0 0.5 0.5) ); -blocks +blocks ( hex (5 4 9 10 16 15 20 21) (10 10 1) simpleGrading (1 1 1) hex (0 1 4 5 11 12 15 16) (10 10 1) simpleGrading (1 1 1) @@ -67,7 +67,7 @@ blocks hex (9 4 7 8 20 15 18 19) (10 20 1) simpleGrading (1 1 1) ); -edges +edges ( arc 0 5 (0.469846 0.17101 0) arc 5 10 (0.17101 0.469846 0) @@ -79,34 +79,34 @@ edges arc 15 20 (0.34202 0.939693 0.5) ); -patches +patches ( - symmetryPlane left + symmetryPlane left ( (8 9 20 19) (9 10 21 20) ) - patch right + patch right ( (2 3 14 13) (3 6 17 14) ) - symmetryPlane down + symmetryPlane down ( (0 1 12 11) (1 2 13 12) ) - patch up + patch up ( (7 8 19 18) (6 7 18 17) ) - patch hole + patch hole ( (10 5 16 21) (5 0 11 16) ) - empty frontAndBack + empty frontAndBack ( (10 9 4 5) (5 4 1 0) diff --git a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/timeVsRightTraction b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/timeVsRightTraction index 607889de9..fe06c78de 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/timeVsRightTraction +++ b/applications/solvers/solidMechanics/tutorials/elasticNonLinULSolidFoam/timeVaryingNonLinPlateHole/constant/timeVsRightTraction @@ -2,5 +2,5 @@ (0 (0 0 0)) (1 (1e4 0 0)) (3 (2e4 0 0)) - (5 (1e3 0 0)) + (5 (1e3 0 0)) ) 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/constant/timeVsRightTraction b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/constant/timeVsRightTraction index 607889de9..fe06c78de 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/constant/timeVsRightTraction +++ b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/constant/timeVsRightTraction @@ -2,5 +2,5 @@ (0 (0 0 0)) (1 (1e4 0 0)) (3 (2e4 0 0)) - (5 (1e3 0 0)) + (5 (1e3 0 0)) ) diff --git a/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticPlasticNonLinULSolidFoam/timeVaryingPlasticNonLinPlateHole/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" 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/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/constant/timeVsRightTraction b/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/constant/timeVsRightTraction index 607889de9..fe06c78de 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/constant/timeVsRightTraction +++ b/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/constant/timeVsRightTraction @@ -2,5 +2,5 @@ (0 (0 0 0)) (1 (1e4 0 0)) (3 (2e4 0 0)) - (5 (1e3 0 0)) + (5 (1e3 0 0)) ) diff --git a/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticPlasticSolidFoam/timeVaryingPlasticPlateHole/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/0/materials b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/0/materials index c6685739b..4838a3ca6 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/0/materials +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/0/materials @@ -17,7 +17,7 @@ FoamFile dimensions [0 0 0 0 0 0 0]; -internalField nonuniform List +internalField nonuniform List 10000 ( 1 diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict index 5502e0a33..e448284c3 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/bimaterialCase/constant/polyMesh/blockMeshDict @@ -24,77 +24,77 @@ FoamFile convertToMeters 1; -vertices +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 ); -blocks +blocks ( hex ( 0 1 3 2 8 9 11 10) (100 50 1) simpleGrading (1 1 1) hex ( 2 3 5 4 10 11 13 12) (100 1 1) simpleGrading (1 1 1) hex ( 4 5 7 6 12 13 15 14) (100 49 1) simpleGrading (1 1 1) ); -edges +edges ( ); -patches +patches ( - empty front + empty front ( ( 0 1 3 2) ( 2 3 5 4) - ( 4 5 7 6) + ( 4 5 7 6) ) - - empty back + + empty back ( ( 8 9 11 10) (10 11 13 12) - (12 13 15 14) + (12 13 15 14) ) - - patch left + + 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 afac29e71..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.) @@ -62,7 +62,7 @@ surfaceFormat vtk; // cloud specified points, uses findCell // // -// axis: how to write point coordinate. Choice of +// axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only // - xyz: three columns // (probably does not make sense for anything but raw) @@ -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 c94903b2b..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.) @@ -61,7 +61,7 @@ writeFormat raw; // cloud specified points, uses findCell // // -// axis: how to write point coordinate. Choice of +// axis: how to write point coordinate. Choice of // - x/y/z: x/y/z coordinate only // - xyz: three columns // (probably does not make sense for anything but raw) @@ -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 5df43c235..fe8c7343c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/analyticalPlateHole/analyticalPlateHole.C @@ -26,7 +26,7 @@ Description Generate analytical solution for a infinite plaste with a circular hole. Stress field sigma is generated. - Based on solution outlined in Timoshenko, Theory of Elasticity. + Based on solution outlined in Timoshenko, Theory of Elasticity. Author plateHoleSolution function by Z. Tukovic @@ -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; - - volSymmTensorField sigma + 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 ( - 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; - - return 0; + Info << nl << "End" << endl; + + return 0; } // ************************************************************************* // @@ -116,7 +116,7 @@ symmTensor plateHoleSolution(const vector& C) coordinateSystem cs("polarCS", C, vector(0, 0, 1), C/mag(C)); sigma.xx() = - T*(1 - sqr(a)/sqr(r))/2 + T*(1 - sqr(a)/sqr(r))/2 + T*(1 + 3*pow(a,4)/pow(r,4) - 4*sqr(a)/sqr(r))*::cos(2*theta)/2; sigma.xy() = @@ -125,7 +125,7 @@ symmTensor plateHoleSolution(const vector& C) sigma.yx() = sigma.xy(); sigma.yy() = - T*(1 + sqr(a)/sqr(r))/2 + T*(1 + sqr(a)/sqr(r))/2 - T*(1 + 3*pow(a,4)/pow(r,4))*::cos(2*theta)/2; @@ -137,6 +137,6 @@ symmTensor plateHoleSolution(const vector& C) S.xx() = sigma.xx(); S.xy() = sigma.xy(); S.yy() = sigma.yy(); - + return S; } diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/plateHole/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/constant/timeVsRightTraction b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/constant/timeVsRightTraction index 607889de9..fe06c78de 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/constant/timeVsRightTraction +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/constant/timeVsRightTraction @@ -2,5 +2,5 @@ (0 (0 0 0)) (1 (1e4 0 0)) (3 (2e4 0 0)) - (5 (1e3 0 0)) + (5 (1e3 0 0)) ) diff --git a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticSolidFoam/timeVaryingPlateHole/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/T b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/T index 3c041edaf..01fc42374 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/T +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/T @@ -29,7 +29,7 @@ boundaryField { type symmetryPlane; } - + inside { type fixedValue; diff --git a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/U b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/U index c60404912..dec9e5cac 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/U +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/0/U @@ -29,7 +29,7 @@ boundaryField { type symmetryPlane; } - + inside { type solidTraction; diff --git a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C index a71efdfd1..9565ba472 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/analyticalHotCylinder/analyticalHotCylinder.C @@ -26,7 +26,7 @@ Description Generate analytical solution for a thick-walled cylinder with a temperature gradient. Temperature field T and stress field sigma and generated. - Based on solution outlined in Timoshenko, Theory of Elasticity. + Based on solution outlined in Timoshenko, Theory of Elasticity. Author philip.cardiff@ucd.ie @@ -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; - - //- inner and outer radii and temperatures - scalar a = 0.5; - scalar b = 0.7; - scalar Ti = 100; - scalar To = 0; + 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; - //- mechanical and thermal properties - scalar E = 200e9; - scalar nu = 0.3; - scalar alpha = 1e-5; + //- inner and outer radii and temperatures + scalar a = 0.5; + scalar b = 0.7; + scalar Ti = 100; + scalar To = 0; - //- create T field - volScalarField T + //- mechanical and thermal properties + scalar E = 200e9; + scalar nu = 0.3; + scalar alpha = 1e-5; + + //- create T field + volScalarField T ( - IOobject - ( - "analyticalT", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimTemperature, 0.0) - ); - - const volVectorField& C = mesh.C(); + IOobject + ( + "analyticalT", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimTemperature, 0.0) + ); - //- radial coordinate - volScalarField radii = - C.component(vector::X)*C.component(vector::X) + C.component(vector::Y)*C.component(vector::Y); - forAll(radii.internalField(), celli) + 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]); + radii.internalField()[celli] = ::sqrt(radii.internalField()[celli]); } - forAll(radii.boundaryField(), patchi) + forAll(radii.boundaryField(), patchi) { - forAll(radii.boundaryField()[patchi], facei) - { - radii.boundaryField()[patchi][facei] = ::sqrt(radii.boundaryField()[patchi][facei]); - } + forAll(radii.boundaryField()[patchi], facei) + { + radii.boundaryField()[patchi][facei] = ::sqrt(radii.boundaryField()[patchi][facei]); + } } - forAll(T.internalField(), celli) + forAll(T.internalField(), celli) { - const scalar& r = radii[celli]; + const scalar& r = radii[celli]; - T.internalField()[celli] = - ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); + T.internalField()[celli] = + ( (Ti-To)/Foam::log(b/a) ) * Foam::log(b/r); } - forAll(T.boundaryField(), patchi) + forAll(T.boundaryField(), patchi) { - forAll(T.boundaryField()[patchi], facei) - { - const scalar& r = radii.boundaryField()[patchi][facei]; + 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); - } + 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(); + //- write temperature file + Info << "Writing analytical termpature field" << endl; + T.write(); - //- create sigma field - volScalarField sigmaR + //- create sigma field + volScalarField sigmaR ( - IOobject - ( - "sigmaR", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimForce/dimArea, 0.0) + 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) ); - forAll(sigmaR.internalField(), celli) + forAll(sigmaTheta.internalField(), celli) { - const scalar& r = radii.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)); + 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(sigmaR.boundaryField(), patchi) + forAll(sigmaTheta.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) ); - } + forAll(sigmaTheta.boundaryField()[patchi], facei) + { + const scalar& r = radii.boundaryField()[patchi][facei]; + + 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) ); + } } - //- write temperature file - Info << "\nWriting analytical sigmaR field" << endl; - sigmaR.write(); + //- write temperature file + Info << "\nWriting analytical sigmaTheta field" << endl; + sigmaTheta.write(); - volScalarField sigmaTheta + volScalarField sigmaZ ( - IOobject - ( - "sigmaTheta", - 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(sigmaTheta.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)); - 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) ); + sigmaZ.internalField()[celli] = + 0.3*(sigmaR.internalField()[celli] + sigmaTheta.internalField()[celli]) + - E*alpha*(T.internalField()[celli]); } - forAll(sigmaTheta.boundaryField(), patchi) + forAll(sigmaZ.boundaryField(), patchi) { - forAll(sigmaTheta.boundaryField()[patchi], facei) - { - const scalar& r = radii.boundaryField()[patchi][facei]; - - 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(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)); + + //-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 sigmaTheta field" << endl; - sigmaTheta.write(); + //- write temperature file + Info << "\nWriting analytical sigmaZ field" << endl; + sigmaZ.write(); - volScalarField sigmaZ + + //- create analytical sigma tensor + + //- create theta field + volScalarField theta ( - IOobject - ( - "sigmaZ", - 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(sigmaZ.internalField(), celli) + forAll(theta.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& x = mesh.C().internalField()[celli][vector::X]; + const scalar& y = mesh.C().internalField()[celli][vector::Y]; - sigmaZ.internalField()[celli] = - 0.3*(sigmaR.internalField()[celli] + sigmaTheta.internalField()[celli]) - - E*alpha*(T.internalField()[celli]); + theta.internalField()[celli] = Foam::atan(y/x); } - forAll(sigmaZ.boundaryField(), patchi) + forAll(theta.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(theta.boundaryField()[patchi], facei) + { + const scalar& x = mesh.C().boundaryField()[patchi][facei][vector::X]; + const scalar& y = mesh.C().boundaryField()[patchi][facei][vector::Y]; - //-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]); - } + theta.boundaryField()[patchi][facei] = Foam::atan(y/x); + } } - - //- write temperature file - Info << "\nWriting analytical sigmaZ field" << endl; - sigmaZ.write(); - - - //- create analytical sigma tensor - - //- create theta field - volScalarField theta + //- rotation matrix to convert polar stresses to cartesian + volTensorField rotMat ( - 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 + ( + "rotMat", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedTensor("zero", dimless, tensor::zero) + ); - theta.internalField()[celli] = Foam::atan(y/x); + forAll(rotMat.internalField(), celli) + { + const scalar& t = theta.internalField()[celli]; + + rotMat.internalField()[celli] = tensor + ( + ::cos(t), ::sin(t), 0, + -::sin(t), ::cos(t), 0, + 0, 0, 1 + ); } - forAll(theta.boundaryField(), patchi) + forAll(rotMat.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]; - - theta.boundaryField()[patchi][facei] = Foam::atan(y/x); - } + 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 + ); + } } - //- rotation matrix to convert polar stresses to cartesian - volTensorField rotMat + volSymmTensorField sigma ( - IOobject - ( - "rotMat", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedTensor("zero", dimless, tensor::zero) - ); + IOobject + ( + "analyticalSigma", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) + ); - forAll(rotMat.internalField(), celli) + forAll(sigma.internalField(), celli) { - const scalar& t = theta.internalField()[celli]; + const scalar& r = sigmaR.internalField()[celli]; + const scalar& t = sigmaTheta.internalField()[celli]; + const scalar& z = sigmaZ.internalField()[celli]; - rotMat.internalField()[celli] = tensor(::cos(t), ::sin(t), 0, - -::sin(t), ::cos(t), 0, - 0, 0, 1); + 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(rotMat.boundaryField(), patchi) + forAll(sigma.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); - } + 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); + } } - volSymmTensorField sigma - ( - IOobject - ( - "analyticalSigma", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero) - ); + Info << "\nWriting analytical sigma tensor" << endl; + sigma.write(); - forAll(sigma.internalField(), celli) - { - const scalar& r = sigmaR.internalField()[celli]; - const scalar& t = sigmaTheta.internalField()[celli]; - const scalar& z = sigmaZ.internalField()[celli]; + Info << nl << "End" << endl; - 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/elasticThermalSolidFoam/hotCylinder/system/decomposeParDict b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/decomposeParDict index b7ed8d986..b009f144c 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/decomposeParDict +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/decomposeParDict @@ -84,7 +84,7 @@ manualCoeffs //// Is the case distributed //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. -//roots +//roots //( // "/tmp" // "/tmp" diff --git a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/fvSolution b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/fvSolution index 13a105dc9..67159ecc2 100644 --- a/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/fvSolution +++ b/applications/solvers/solidMechanics/tutorials/elasticThermalSolidFoam/hotCylinder/system/fvSolution @@ -38,10 +38,10 @@ solvers relTol 0.1; minIter 0; maxIter 1000; - + //solver PCG; //preconditioner DIC; - + solver GAMG; smoother GaussSeidel; nPreSweeps 0; @@ -53,7 +53,7 @@ solvers nCellsInCoarsestLevel 20; agglomerator faceAreaPair; mergeLevels 1; - + /* solver amgSolver; cycle W-cycle; diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/dynamicMeshDict b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/dynamicMeshDict index f4b57e24e..725e46727 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/dynamicMeshDict +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/dynamicMeshDict @@ -34,7 +34,7 @@ diffusivity quadratic inverseDistance 1(plate); frozenDiffusion yes; -distancePatches +distancePatches ( plate ); diff --git a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/polyMesh/faceZones b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/polyMesh/faceZones index 789b10a45..8d9c3a480 100644 --- a/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/polyMesh/faceZones +++ b/applications/solvers/solidMechanics/tutorials/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/constant/polyMesh/faceZones @@ -20,7 +20,7 @@ FoamFile plateZone { type faceZone; - faceLabels List