From 9588cbdc0c5f764f81f048b3802b49f541cbd986 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 18 Dec 2013 17:34:08 +0000 Subject: [PATCH 001/197] Release docs --- HowToContribute | 202 ++++----------------- ReleaseNotes-foam-extend-3.0 | 336 +++++++++++++++++++++++++++++++++++ 2 files changed, 367 insertions(+), 171 deletions(-) create mode 100644 ReleaseNotes-foam-extend-3.0 diff --git a/HowToContribute b/HowToContribute index 9c2f9f4b2..0f17f5b6c 100644 --- a/HowToContribute +++ b/HowToContribute @@ -1,185 +1,45 @@ -How to Contribute -~~~~~~~~~~~~~~~~~ +Guide to contribute code to OpenFOAM-extend project -Contacts: - -Release Committee: Hrvoje Jasak (h.jasak@wikki.co.uk) -SourceForge Accounts: Bernhard Gschaider (Bernhard.Gschaider@ice-sf.at) - Martin Beaudoin (beaudoin.martin@ireq.ca) -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 - of firstnamelastname, but a username of firstname_lastname may - be a better choice.) After you obtain your account at SourceForge, you will - still need to be granted specific access to the -extend project. Make a request - to the "SourceForge Accounts" contact at the top of this document for access to - the project. +You have developed a new top-level solver or utility. You have implemented a further turbulence model, interface to a material properties library or created a really useful boundary condition? This guide shows the ways to share this code with the OpenFOAM® communinity. -2. Access to the git Repository - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Why should I share my code? - For a read-only copy of the repository, use the following command: - + git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext +Depending on your background, motivations for contributing code to OpenFOAM® via the FOAM-extend project will differ. - To obtain a copy of the repository with write access, use the following command: - + git clone ssh://username@openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext +With an industrial background you may find it a cost-advantage compared to keeping everything in-house. Code contributed to the source-core will be maintained along with the complete project source code. This saves you the cost of porting your code to each new release. Furthermore, your code will be reviewed by experts with relevant OpenFOAM® experience, who will be able to spot design improvements that lead to increased speed of execution, better convergence, improved robustness, stability or all of the above. If you plan to deploy your code to clients, the extend-bazaar gives you a unified platform that is simple to use, easy to access and gives you maximum freedom in presenting your code. - Also see: - http://openfoam-extend.git.sourceforge.net/git/gitweb.cgi?p=openfoam-extend +In academia, many OpenFOAM® developments are carried out within publicly funded projects, often as part of PhD studies. Unfortunately, much of this work is not re-used and developed further. A time-saving option to share this work is the extend-bazaar, where working code and example cases can be simply uploaded with a brief description. This can be expanded and may even form the base for a journal publication; a good example for this is the waves2Foam package by Niels Jacobsen LINK. Contributing gives the code visibility in the OpenFOAM® community and harvests public recognition long after the project has been completed. + +In both cases, the credit for your work, its authorship, and Copyright remains with you. We do not require contributors to give up the rights to their work. + +What is the difference between contibuting to source-core and to extend-bazaar? + +The \BOLD{source-core} of FOAM-extend meets the high quality standards of a software package that is deployed for production use. A contribution will be therefore reviewed by an experiened OpenFOAM®-extend maintainer. The code must adhere to OpenFOAM® coding style guideline LINK. The contribution procedure is: +* Check your code, especially regarding coding style and trailing whitespace +* Contact the maintainers of FOAM-extend repository to get write access , ???@???.org. +* Use git to make a local feature branch, move your contribution into this branch and push the branch to the repository. See details of the FOAM-extend branching model LINK and git usage LINK. +* Contact the maintainers and ask for review and merge of your code. Experience shows this involves a few iterative steps. +* Your code is merged and becomes part of FOAM-extend. You are added to the list of contributors FOAM-extend. +* Maintainance of your case is now part of the general development + +The \BOLD{extend-bazaar} has been created to minimize the effort for sharing your code. It is ideal for solvers and utilities that can live in the user-directory. The required steps are: + +* Create a user account on the OpenFOAM® Wiki. +* Go to the extend-bazaar page and find a category for your contribution. +* Create a new sub-page in the category and write a brief description/documentation for your contribution. Templates LINK exist that you can re-use. +* Upload your code. Options are: + * For small packages that will not change much in the future, you can upload a .tgz archive to your wiki page directly. + * For larger packages that contain for example big meshes, use a file-hoster and add a link to your wiki page. + * If your contribution is under active development, create a repository for example on sourceforge LINK or github LINK. Add a link to the repository on the wiki page. +* Implementing bug fixes, new features or ports to a new FOAM-extend release is at your discretion -3. git Commit Policies and Workflow (Introduction) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - A formal procedure for contributions has been established for the project with - regard to branching and commits in the git repository. The workflow proposed - by Hrv Jasak and Henrik Rusche for contributing to the git repository is described - in the following document: - - http://nvie.com/posts/a-successful-git-branching-model/ - - 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. - - 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 - repository. -4. git Commit Policies and Workflow (User Perspective) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - The document listed in Section 3 above from nvie.com provides an excellent conceptual - description of the policies that will be used for the -extend repository. More - detailed instructions for users who wish to make contributions are spelled out in - this section. - - Before making any commits to the git repository, be sure to configure git with your - username and e-mail address, which helps to ensure that you receive proper credit - in the git repository for work you contribute. - - The author's name and e-mail address can be provided to git using commands such - as these: - - + git config --global user.name "John Doe" - + git config --global user.email john.doe@xxx.com - - Afterwards, the provided information will be contained in a file named .gitconfig - in the user's home directory. - - All contributions to the project repository will be contained in a new feature branch - created by the contributor. The recommended way of creating branches is to create one - branch for each new specific fix or feature using a command such as this: - - + 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 - 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. - - When you have a feature branch that is ready to be merged, push it to the server - using a command such as this: - - + git push origin my-feature-branch - - Next, notify the "Release Committee" point-of-contact listed at the top of this - document that the feature branch has been pushed to the server and is ready to be - merged. A release committee member will review your contribution, merge your - branch, and then delete the branch from the server, as it is no longer needed once - it has been merged. - - If you need to delete the branch from the server or are requested to do so, the proper - command is - - + git push origin :my-feature-branch - - To delete the same branch from your local repository requires the command - - + git branch -d my-feature-branch - - Finally, to clean your local repository of tracking branches that have been deleted - from the server requires the command - - + git remote prune origin - -5. git Commit Policies and Workflow (Committee Perspective) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - The -extend project "release committee" (initially comprised of Hrv Jasak) will be - solely responsible for merging user contributions into the master and nextRelease branches. - - User contributions will be contained in feature branches, with a new feature branch for - each new fix or feature, as described in Section 4 above. - - 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 - 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. - - When the next release is ready, the release committee will merge the - integration branch into the master branch, again using a "git merge --no-ff" command. - Consistent with the proposed workflow, the master branch will only contain releases - 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 - guarantee that a merge of the integration branch into the master branch can be - accomplished by a fast-forward. -6. Specific Usage Instructions - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - In case you find out that something that should be a hotfix ended up in - your local feature branch, follow the steps below to ensure that the hotfix is - properly committed to the integration and master branches: - - a. Single out the SHA-1 of the commit that contains the hotfix (e.g. 13e5d2f) - - c. Create a new hotfix branch; e.g. - - + git checkout master - + git checkout -b hotfix/my-hotfix-topic - - b. Single out the commit and base it on the master branch; e.g. - - # The fix is in a single commit, but localBranch has advanced - + git cherry-pick commitID - - OR - - # The fix is small, but the commit contains other changes - + git checkout localBranch file - + git commit - - d. Contact the "Release Committee" point-of-contact at the top of this document - and request that the hotfix be merged into the integration and master branches. - - -7. Acknowledgements & Copyright - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Your authorship is tracked by the version control system (git). You may also document - your authorship in the header of the files. Furthermore, the release committee will - update the list of contributors in the README file with every release. - - -8. Background Reading on git - ~~~~~~~~~~~~~~~~~~~~~~~~~ - - http://openfoamwiki.net/index.php/Starting_points_for_using_GIT + +http://www.openfoam.org/contrib/code-style.php diff --git a/ReleaseNotes-foam-extend-3.0 b/ReleaseNotes-foam-extend-3.0 new file mode 100644 index 000000000..d0ee9c512 --- /dev/null +++ b/ReleaseNotes-foam-extend-3.0 @@ -0,0 +1,336 @@ +# -*- mode: org; -*- +# +#+TITLE: *Release notes for foam-extend-3.0* +#+AUTHOR: Hrvoje Jasak. +#+DATE: 18 December 2013 +#+LINK: http://foam-extend.org +#+OPTIONS: author:nil + +################################################################################ + +Contents: +* Overview +* Installation +* Compatibility +* New features in foam-extend-3.0 +* Reporting bugs +* How to contribute +* List of Contributors + +################################################################################ + +* Overview + The foam-extend project is a fork of the OpenFOAM® open source library for + Computational Fluid Dynamics (CFD). It is an open project welcoming and + integrating contributions from all users and developers. Previously known as + OpenFOAM®-dev and OpenFOAM®-extend, it contains bug fixes and performance + improvements, as well as extensions and additional features provided + by community contributors (see list below), such as dynamic mesh and + topological change support, turbomachinery extensions including general grid + interpolation (GGI), cyclic GGI and mixing place, block-coupled matrix + support, finite area method, comprehensive mesh motion capability and GPU + support. For a full list, see below. + + Version 3.0, nicknamed "Jeju", is the current version of foam-extend. The + release now continues the tradition and spirit of the original FOAM code + developed by prof. Jasak and Mr. Weller during their time at + Imperial College and released as the general purpose CFD/CCM package by + Nabla Ltd. in 2000. In this spirit, we shall revert to original numbering + scheme (foam-2.3.2, 13 December 2004) as release number 3.0. + Visit http://foam-extend.org for more information. + + OPENFOAM® is a registered trademark of ESI Group. OpenFOAM-extend and + foam-extend are a community effort not endorsed by ESI Group. + +* Installation + foam-extend-3.0 can be compiled and runs on any linux system and + Apple Mac OS X. + + ** From source + Please refer to doc/buildInstructions/ for details. If you have + improvements or build instructions for a new system, please share them + with the community (see section "How to contribute", below). + + ** Binary packages + Binary packages are available for download at + http://sourceforge.net/projects/openfoam-extend/ + for the following systems: Ubuntu 12.04, Ubuntu 13.10 and Fedora 19 . + +* Compatibility + Upstream features from the OpenFOAM® code base are merged into foam-extend + on regular basis. The interface format of foam-extend-3.0 is largely + compatible to OpenFOAM-1.6-ext and OpenFOAM-1.7.x. In some cases, + the differences are caused by bug fixes and algorithmic improvements, + considered more important than inter-operability. + +* Main diferentiators + A large number of features has been lost within the release cycle of OpenFOAM + code; since version 1.3, the code base has shrunk by more than 40%. While + we understand the lack of technical ability of supporting advanced + CFD features, we feel that existing features and specifically large-scale + contributions should remain active and developed further. Below is a list + of main features of foam-extend-3.0 which are lost, deactivated or unusable + in ESI releases: + + ** Turbomachinery features, including General Grid Interface (GGI), + partial overlap GGI, cyclic GGI, with improvements in parallel scaling. + First full and validated release of a mixing plane stage interface + + ** Dynamic mesh with topological changes + sliding interfaces, mesh layering, attach-detach boundaries etc. + in foam-extend-3.0 full parallel support for topological changes + is released for the first time + + ** Finite Element Method with support for polyhedral meshes + This is mainly used in mesh deformation and over the last 15 years + it has proven vastly superior to all other dynamic mesh methods. + + ** Advanced mesh deformation technology + including tet FEM mesh deformation, Radial Basis Function (RBF) mesh + deformation, tetrahedral remeshing dynamic mesh support and solid body + motion functions. All of the above include parallelisation support + + ** Library of dynamic meshes with topological changes with full + second order FVM discretisation support on moving meshes with + topological changes + + ** Internal combustion engine-specific dynamic mesh classes such as + two-stroke engine and various forms of 4-stroke and multi-valve + dynamic mesh classes + + ** Finite Area Method providing support for FVM-like discretisation on + a curved surface in 3-D, with examples of liquid film modelling + + ** Block-coupled matrix support, allowing fully implicit multi-equation + solution of NxN equation sets, with full parallelisation support. + First release of a block-AMG linear equation solver + + ** Fully implicit conjugate-coupled solution framework, allowing implicit + solution fo multiple equations over multiple meshes, with parallelism + + ** Proper Orthogonal Decomposition data analysis tools, with applications + to FOAM field classes + + ** Equation reader classes and tutorials + + ** Multi-solver solution framework, allowing mutiple field models to be + solved in a coupled manner + + ** A major contribution is solid mechanics modelling, including linear + and non-linear materials, contact, self-contact and friction, with + updated Lagrangian or absolute Lagrangian formulation. Solution o + damage models and crack propagation in complex materials via + topological changes + + ** CUDA solver release, provided in full source and as an example of + coupling external linear equation solvers with FOAM + + ** Library-level support for Immersed Boundary Method and Overset Mesh + + ** Major improvements in accuracy and stability of FVM discretisation + with options on convection and diffusion discretisation, deferred + correction or explicit schemes + + ** Algebraic multigrid solver framerowk + + ** 190 tutorials with automated run scripts + + ** Automatic test harness + +* New features in foam-extend-3.0 + The list of features is a result of the work of numerous contributors. The + maintainers of foam-extend would formally like to thank them all. Features + listed below have are new with regard to OpenFOAM-1.6-ext. For a list of + extension features in OpenFOAM-1.6-ext, please refer to file + "ReleaseNotes-1.6-ext". + + ** Core library + + cudaSolvers + dynamicMesh + dynamicTopoFvMesh: + dynamicTopoFvMeshCoupled + convexSetAlgorithm + fieldMapping + meshOpsTemplates + msqAdditionalSrc + tetDecompositionMotionSolver + tetMotionSolver + multiTopoBodyFvMesh + engine + accordionValve + accordionEngineMesh + attachDetachFunctions + deformingEngineMesh + regionSide + twoStrokeEngine + equationReader + finiteArea: + faMeshMapper + faMeshUpdate.C + interpolation: + mapping + finitVolume: + mixingPlane + regionCouple + adjConvectionSchemes + backwardD2dt2Scheme + skewCorrectedSnGrad + singleCellFvMesh + harmonic + harmonicTemplates + magLongDelta.[HC] + multiSolver + OpenFOAM: + PriorityList + + IOReferencer + postfixedSubRegistry + + symmTensor4thOrder + VectorN + diagTensor + oscillatingFixedValue + + profiling + + MixingPlaneInterpolation + splineInterpolateXY + + BlockAmg solver + blockVectorN solver + BlockLduInterface + + mixingPlane (also with GAMG) + regionCouple (also with GAMG) + + BlockCoeffNorm + + postProcessing: + foamCalcFunctions: + scalarMult + componentsTurbo + domainIntegrate + functionObjects: + mixingPlaneCheck + maxFieldCell + solidModels + tetDecompositionFiniteElement + thermophysicalModels: + radiation: + viewFactor + turbulenceModels: + RWallFunctions + VectorN + + ** Solver applications + + conjugateHeatSimpleFoam + equationReaderDemo + MRFSimpleFoam + simpleSRFFoam + MRFInterFoam + multiSolver + solidMechanics: + elasticAcpSolidFoam + elasticIncrAcpSolidFoam + elasticIncrSolidFoam + elasticNonLinIncrTLSolidFoam + elasticNonLinTLSolidFoam + elasticNonLinULSolidFoam + elasticOrthoAcpSolidFoam + elasticOrthoNonLinULSolidFoam + elasticOrthoSolidFoam + elasticPlasticSolidFoam + elasticPlasticNonLinTLSolidFoam + elasticPlasticNonLinULSolidFoam + elasticSolidFoam + elasticThermalSolidFoam + icoFsiElasticNonLinULSolidFoam + viscoElasticSolidFoam + + ** Utilities + + foamMeshToAbaqus + multiSolver (postProcessing) + solidMechanics: + calculateCourantNumber + forceDisp + patchStressIntegrate + smoothMesh + surfaceTractions + + ** ThirdParty software + gcc compatibility up to 4.8.1 + Updated to: + Paraview 4.1 + openmpi 1.6.5 + cmake 2.8.12 + metis 5.1.0 + parmetis 4.0.3 + scotch 6.0.0 + zoltan 3.6 + +* Reporting bugs + To report bugs, please use the MantisBT bugtracker at + http://sourceforge.net/apps/mantisbt/openfoam-extend/my_view_page.php . + +* How to contribute + All your contributions are highly welcome: New solvers, utilities and + models; bug fixes; documentation. The many ways of contributing and the + contribution process are described in detail in the file "HowToContribute". + +* List of Contributors + (If your name is missing in the list, please contact the maintainers at + and it will be added asap.) + Henry Weller + Hrvoje Jasak + Mattijs Janssens + Zeljko Tukovic + Bernhard Gschaider + Tommaso Lucchini + Martin Beaudoin + Sandeep Menon + Niklas Nordin + Eugene De Villiers + Henrik Rusche + Ivor Clifford + Philiposse Rajan + Gavin Tabor + Jovani Favero + Frank Bos + David Hill + Niklas Wikstrom + Dubravko Matijasevic + Darrin Stephens + Christian Beck + Oliver Borm + James Criner + Hua Shan + David Boner + Pierre-Olivier Dallaire + Norman Del Puppo + Dennis Kingsley + Frank Albina + Flavio Galeazzo + Hannes Kroger + Olivier Petit + David Schmidt + Andreas Feymark + Luca Mangani + Daniel Schmode + Christoph Goniva + Takuya Oshima + Juho Peltola + Eric Paterson + Fabian Peng Karrholm + Aleksandar Karac + Maria Garcia Camprubi + Chris Greenshields + Mark Olesen + Hilary Spencer + Andy Heather + Dominik Christ + Peter Janas + Niels Linnemann + Nikola Kornev From edd149e316cb70ceb8e880c134dae13f5792b946 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 18 Dec 2013 17:34:44 +0000 Subject: [PATCH 002/197] Old release notes removed --- ContributionsForNextRelease.txt | 23 ----- ReleaseNotes-1.6-ext | 84 ---------------- buildInstructions.txt | 169 -------------------------------- 3 files changed, 276 deletions(-) delete mode 100644 ContributionsForNextRelease.txt delete mode 100644 ReleaseNotes-1.6-ext delete mode 100644 buildInstructions.txt diff --git a/ContributionsForNextRelease.txt b/ContributionsForNextRelease.txt deleted file mode 100644 index 6ec94b8b7..000000000 --- a/ContributionsForNextRelease.txt +++ /dev/null @@ -1,23 +0,0 @@ -Standard response: - -Your name and authorship will be preserved by the git system, but please put the author name for the classes you have written, or a note saying that yo have changed the code. - -Bug fixes: - -- Peter Janas: accordionEngineMesh and bug fixes - - -Contributions: - -- Niels Linnemann: Actuator disk -- Bernhard Gscheider: surfactantFoam clean-up; swakToFoam -- 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) -- improvements to GGI -- mixing plane interface -- ??? Swig interface diff --git a/ReleaseNotes-1.6-ext b/ReleaseNotes-1.6-ext deleted file mode 100644 index ed1fb84b4..000000000 --- a/ReleaseNotes-1.6-ext +++ /dev/null @@ -1,84 +0,0 @@ -# -*- 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/buildInstructions.txt b/buildInstructions.txt deleted file mode 100644 index b615324fc..000000000 --- a/buildInstructions.txt +++ /dev/null @@ -1,169 +0,0 @@ -1) Download files - -Get all files from the sources directory on the web site and put them into the linuxSrc directory - -2) Unpack OpenFOAM and set up the dot-files - -cd ~/OpenFOAM -tar xzf linuxSrc/OpenFOAM-1.4.1-dev_22_11_05.tgz -cp -r OpenFOAM-1.4.1-dev/.OpenFOAM-1.4.1-dev ~ - -set up dot files: - -put: - -source ~/.OpenFOAM-1.4.1-dev/cshrc - -into your .cshrc file. If you are using bash, add - -. ~/.OpenFOAM-1.4.1-dev/bashrc - -into ~/.bashrc - -Do: - -source ~/.cshrc - -For bash users, do - -. ~/.bashrc - -instead. - - -3) Build utilities - -3.1) gcc -tar xzf gcc-4.2.2.tgz -mkdir gcc-4.2.2-obj -cd gcc-4.2.2-obj - -../gcc-4.2.2/configure --prefix=/usr/tmp/gcc-4.2.2 --exec-prefix=/usr/tmp/gcc-4.2.2 --enable-languages=c,c++ --enable-shared - -gmake bootstrap -gmake -gmake install - -cd /usr/tmp/ -tar cvzf ~/OpenFOAM/linux/gcc-4.2.2.bin.tgz gcc-4.2.2 -cd ~/OpenFOAM/linux -tar xzf gcc-4.2.2.bin.tgz - -3.2) gdb - -cd ~/OpenFOAM/linuxSrc -tar xzf gdb-6.4.tar.gz -cd gdb-6.4 -./configure --prefix=~/OpenFOAM/linux/gdb-6.4 -gmake -gmake install - -3.3 cmake - -cd ~/OpenFOAM/linuxSrc -tar xzf cmake-2.4.7.tar.gz -cd cmake-2.4.7 -./configure --prefix=~/OpenFOAM/linux/cmake-2.4.7 -gmake -gmake install - -3.4 dx -cd ~/OpenFOAM/linuxSrc -tar xzf dx-4.4.4.tgz -cd dx-4.4.4 -./configure --prefix=~/OpenFOAM/linux/dx-4.4.4 --enable-shared -gmake -gmake install - -3.5 paraview -cd ~/OpenFOAM/linuxSrc -tar xvzf paraview-2.4.4.tgz -mkdir paraview-2.4.4-obj -cmake -i ../paraview-2.4.4 - -Change options: - -enable shared library: YES -prefix: ~/OpenFOAM/linux/paraview-2.4.4 - -gmake -gmake install - - -cd ~/OpenFOAM/linuxSrc - -mkdir ~/OpenFOAM/linux/paraview-2.4.4/include -cp ./paraview-2.4.4/VTK/Common/vtk* ~/OpenFOAM/linux/paraview-2.4.4/include/ -cp ./paraview-2.4.4/VTK/Filtering/vtk* ~/OpenFOAM/linux/paraview-2.4.4/include/ -cp ./paraview-2.4.4-obj/VTK/vtk* ~/OpenFOAM/linux/paraview-2.4.4/include/ -cp ./paraview-2.4.4-obj/ParaViewConfig.cmake ~/OpenFOAM/linux/paraview-2.4.4/lib/paraview-2.4/ - -linux64 copy commands - -mkdir ~/OpenFOAM/linux64/paraview-2.4.4/include -cp ./paraview-2.4.4/VTK/Common/vtk* ~/OpenFOAM/linux64/paraview-2.4.4/include/ -cp ./paraview-2.4.4/VTK/Filtering/vtk* ~/OpenFOAM/linux64/paraview-2.4.4/include/ -cp ./paraview-2.4.4-obj/VTK/vtk* ~/OpenFOAM/linux64/paraview-2.4.4/include/ -cp ./paraview-2.4.4-obj/ParaViewConfig.cmake ~/OpenFOAM/linux64/paraview-2.4.4/lib/paraview-2.4/ - - -4) build OpenFOAM - -foam -(this should take you to the ~/OpenFOAM/OpenFOAM-1.4.1-dev directory) - -./Allwmake - -This will build foam. - -5) check build - -source ~/.cshrc -icoFoam - -(this should run and report something like) - -wooster*101-> icoFoam -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 1.4.1-dev | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ - -Exec : icoFoam -Date : Mar 06 2008 -Time : 17:25:53 -Host : wooster -PID : 8238 - -Usage: icoFoam [-parallel] - - ---> FOAM FATAL ERROR : Wrong number of arguments, expected 2 found 0 - - -FOAM exiting - - -SVN check-out command - -svn co https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.4.1-dev - - -SVK setup - -svk depotmap --init -svk mirror https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.4.1-dev //OpenFOAM-1.4.1-dev -svk sync //OpenFOAM-1.4.1-dev - -Ready to check-out - -Additional source packages: - - -http://www.lam-mpi.org/7.1/download.php -http://www.open-mpi.org/ -http://www.mico.org/ -http://www.zlib.net/ \ No newline at end of file From 6820387ef93bdbfd4adfdc23206495e718e04d0b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 2 Jan 2014 15:37:43 +0000 Subject: [PATCH 003/197] BUGFIX: Enabled sorted toc for swak compatibility --- src/foam/Make/files | 4 +- .../HashTables/HashPtrTable/HashPtrTable.C | 42 +- .../HashTables/HashPtrTable/HashPtrTable.H | 37 +- .../HashTables/HashPtrTable/HashPtrTableIO.C | 91 ++- .../containers/HashTables/HashSet/HashSet.C | 22 +- .../containers/HashTables/HashSet/HashSet.H | 18 +- .../HashTables/HashTable/HashTable.C | 240 ++++---- .../HashTables/HashTable/HashTable.H | 318 +++++++---- .../{HashTableName.C => HashTableCore.C} | 41 +- .../HashTables/HashTable/HashTableI.H | 537 +++++++++--------- .../HashTables/HashTable/HashTableIO.C | 17 +- .../StaticHashTable/StaticHashTable.C | 59 +- .../StaticHashTable/StaticHashTable.H | 40 +- ...cHashTableName.C => StaticHashTableCore.C} | 6 +- .../StaticHashTable/StaticHashTableI.H | 13 +- .../StaticHashTable/StaticHashTableIO.C | 6 +- 16 files changed, 824 insertions(+), 667 deletions(-) rename src/foam/containers/HashTables/HashTable/{HashTableName.C => HashTableCore.C} (65%) rename src/foam/containers/HashTables/StaticHashTable/{StaticHashTableName.C => StaticHashTableCore.C} (95%) diff --git a/src/foam/Make/files b/src/foam/Make/files index aa6d266f2..17a9e6590 100644 --- a/src/foam/Make/files +++ b/src/foam/Make/files @@ -81,8 +81,8 @@ coordinateSystems/coordinateRotation/axisCoordinateRotation.C primitives/random/Random.C -containers/HashTables/HashTable/HashTableName.C -containers/HashTables/StaticHashTable/StaticHashTableName.C +containers/HashTables/HashTable/HashTableCore.C +containers/HashTables/StaticHashTable/StaticHashTableCore.C containers/Lists/SortableList/ParSortableListName.C containers/Lists/PackedList/PackedListName.C containers/Lists/ListOps/ListOps.C diff --git a/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.C b/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.C index d51e828f8..eab7560b1 100644 --- a/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.C +++ b/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.C @@ -24,19 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "error.H" - #include "HashPtrTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct given initial table size template -HashPtrTable::HashPtrTable(label size) +Foam::HashPtrTable::HashPtrTable(const label size) : HashTable(size) {} @@ -44,14 +38,16 @@ HashPtrTable::HashPtrTable(label size) // Construct as copy template -HashPtrTable::HashPtrTable(const HashPtrTable& ht) +Foam::HashPtrTable::HashPtrTable +( + const HashPtrTable& ht +) : HashTable() { for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter) { - // Bug fix, Microsoft port. HJ, 21/Mar/2011 - this->insert(iter.key(), iter()->clone().ptr()); + this->insert(iter.key(), new T(**iter)); } } @@ -59,7 +55,7 @@ HashPtrTable::HashPtrTable(const HashPtrTable& ht) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -HashPtrTable::~HashPtrTable() +Foam::HashPtrTable::~HashPtrTable() { clear(); } @@ -68,7 +64,7 @@ HashPtrTable::~HashPtrTable() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -T* HashPtrTable::remove(iterator& it) +T* Foam::HashPtrTable::remove(iterator& it) { T* elemPtr = *it; HashTable::erase(it); @@ -77,7 +73,7 @@ T* HashPtrTable::remove(iterator& it) template -bool HashPtrTable::erase(iterator& it) +bool Foam::HashPtrTable::erase(iterator& it) { T* elemPtr = *it; @@ -98,7 +94,7 @@ bool HashPtrTable::erase(iterator& it) template -void HashPtrTable::clear() +void Foam::HashPtrTable::clear() { for ( @@ -117,13 +113,13 @@ void HashPtrTable::clear() // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -void HashPtrTable::operator= +void Foam::HashPtrTable::operator= ( - const HashPtrTable& ht + const HashPtrTable& rhs ) { // Check for assignment to self - if (this == &ht) + if (this == &rhs) { FatalErrorIn ( @@ -133,20 +129,14 @@ void HashPtrTable::operator= << abort(FatalError); } - clear(); + this->clear(); - for(const_iterator iter = ht.begin(); iter != ht.end(); ++iter) + for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter) { - // Bug fix, Microsoft port. HJ, 21/Mar/2011 - insert(iter.key(), iter()->clone().ptr()); + this->insert(iter.key(), new T(**iter)); } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // #include "HashPtrTableIO.C" diff --git a/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.H b/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.H index fa710ef0f..53375a05a 100644 --- a/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.H +++ b/src/foam/containers/HashTables/HashPtrTable/HashPtrTable.H @@ -50,34 +50,33 @@ class Ostream; template class HashPtrTable; -template Istream& operator>> -( - Istream&, - HashPtrTable& -); +template +Istream& operator>>(Istream&, HashPtrTable&); -template Ostream& operator<< -( - Ostream&, - const HashPtrTable& -); +template +Ostream& operator<<(Ostream&, const HashPtrTable&); /*---------------------------------------------------------------------------*\ Class HashPtrTable Declaration \*---------------------------------------------------------------------------*/ -template +template class HashPtrTable : public HashTable { - // Private member functions + // Private Member Functions //- Read from Istream using given Istream constructor class template void read(Istream&, const INew& inewt); + //- Read from dictionary using given dictionary constructor class + template + void read(const dictionary& dict, const INew& inewt); + + public: @@ -97,13 +96,16 @@ public: //- Construct from Istream using default Istream constructor class HashPtrTable(Istream&); + //- Construct from dictionary using default dictionary constructor + // class + HashPtrTable(const dictionary&); + //- Construct as copy HashPtrTable(const HashPtrTable&); - // Destructor - - ~HashPtrTable(); + //- Destructor + ~HashPtrTable(); // Member Functions @@ -119,6 +121,9 @@ public: //- Clear all entries from table void clear(); + //- Write + void write(Ostream& os) const; + // Member Operators @@ -127,7 +132,6 @@ public: // IOstream Operators -#ifndef SWIG friend Istream& operator>> ( Istream&, @@ -139,7 +143,6 @@ public: Ostream&, const HashPtrTable& ); -#endif }; diff --git a/src/foam/containers/HashTables/HashPtrTable/HashPtrTableIO.C b/src/foam/containers/HashTables/HashPtrTable/HashPtrTableIO.C index 819705e0f..f76464571 100644 --- a/src/foam/containers/HashTables/HashPtrTable/HashPtrTableIO.C +++ b/src/foam/containers/HashTables/HashPtrTable/HashPtrTableIO.C @@ -27,17 +27,13 @@ License #include "Istream.H" #include "Ostream.H" #include "INew.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "dictionary.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template template -void HashPtrTable::read(Istream& is, const INew& inewt) +void Foam::HashPtrTable::read(Istream& is, const INew& inewt) { is.fatalCheck("HashPtrTable::read(Istream&, const INew&)"); @@ -54,7 +50,7 @@ void HashPtrTable::read(Istream& is, const INew& inewt) label s = firstToken.labelToken(); // Read beginning of contents - char listDelimiter = is.readBeginList("HashPtrTable"); + char delimiter = is.readBeginList("HashPtrTable"); if (s) { @@ -63,7 +59,7 @@ void HashPtrTable::read(Istream& is, const INew& inewt) this->resize(2*s); } - if (listDelimiter == token::BEGIN_LIST) + if (delimiter == token::BEGIN_LIST) { for (label i=0; i::read(Istream& is, const INew& inewt) } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - template template -HashPtrTable::HashPtrTable(Istream& is, const INew& inewt) +void Foam::HashPtrTable::read +( + const dictionary& dict, + const INew& inewt +) { - read(is, inewt); + forAllConstIter(dictionary, dict, iter) + { + this->insert + ( + iter().keyword(), + inewt(dict.subDict(iter().keyword())).ptr() + ); + } } template -HashPtrTable::HashPtrTable(Istream& is) +void Foam::HashPtrTable::write(Ostream& os) const { - read(is, INew()); + + for + ( + typename HashPtrTable::const_iterator + iter = this->begin(); + iter != this->end(); + ++iter + ) + { + const T* ptr = iter(); + ptr->write(os); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +template +Foam::HashPtrTable::HashPtrTable(Istream& is, const INew& inewt) +{ + this->read(is, inewt); +} + + +template +Foam::HashPtrTable::HashPtrTable(Istream& is) +{ + this->read(is, INew()); +} + + +template +Foam::HashPtrTable::HashPtrTable(const dictionary& dict) +{ + this->read(dict, INew()); } // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template -Istream& operator>>(Istream& is, HashPtrTable& L) +Foam::Istream& Foam::operator>>(Istream& is, HashPtrTable& L) { L.clear(); L.read(is, INew()); @@ -172,15 +212,16 @@ Istream& operator>>(Istream& is, HashPtrTable& L) template -Ostream& operator<<(Ostream& os, const HashPtrTable& L) +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const HashPtrTable& L +) { - // Write size of HashPtrTable - os << nl << L.size(); + // Write size and start delimiter + os << nl << L.size() << nl << token::BEGIN_LIST << nl; - // Write beginning of contents - os << nl << token::BEGIN_LIST << nl; - - // Write HashPtrTable contents + // Write contents for ( typename HashPtrTable::const_iterator iter = L.begin(); @@ -191,7 +232,7 @@ Ostream& operator<<(Ostream& os, const HashPtrTable& L) os << iter.key() << token::SPACE << *iter() << nl; } - // Write end of contents + // Write end delimiter os << token::END_LIST; // Check state of IOstream @@ -201,8 +242,4 @@ Ostream& operator<<(Ostream& os, const HashPtrTable& L) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/foam/containers/HashTables/HashSet/HashSet.C b/src/foam/containers/HashTables/HashSet/HashSet.C index 6d327d68e..d701dd7ea 100644 --- a/src/foam/containers/HashTables/HashSet/HashSet.C +++ b/src/foam/containers/HashTables/HashSet/HashSet.C @@ -52,6 +52,24 @@ Foam::HashSet::HashSet } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::label Foam::HashSet::insert(const UList& lst) +{ + label count = 0; + forAll(lst, elemI) + { + if (this->insert(lst[elemI])) + { + ++count; + } + } + + return count; +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template @@ -89,7 +107,7 @@ bool Foam::HashSet::operator==(const HashSet& rhs) const template bool Foam::HashSet::operator!=(const HashSet& rhs) const { - return !(this->operator==(rhs)); + return !(operator==(rhs)); } @@ -124,7 +142,7 @@ void Foam::HashSet::operator^=(const HashSet& rhs) // Add missed rhs elements, remove duplicate elements for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter) { - if (found(iter.key())) + if (this->found(iter.key())) { this->erase(iter.key()); } diff --git a/src/foam/containers/HashTables/HashSet/HashSet.H b/src/foam/containers/HashTables/HashSet/HashSet.H index bd9e5797e..fae9dbc91 100644 --- a/src/foam/containers/HashTables/HashSet/HashSet.H +++ b/src/foam/containers/HashTables/HashSet/HashSet.H @@ -128,10 +128,26 @@ public: return HashTable::insert(key, nil()); } + //- Insert keys from a UList of Key + // Return the number of new elements inserted + label insert(const UList&); + //- Same as insert (cannot overwrite nil content) bool set(const Key& key) { - return HashTable::insert(key, nil()); + return insert(key); + } + + //- Same as insert (cannot overwrite nil content) + label set(const UList& lst) + { + return insert(lst); + } + + //- Unset the specified key - same as erase + bool unset(const Key& key) + { + return HashTable::erase(key); } diff --git a/src/foam/containers/HashTables/HashTable/HashTable.C b/src/foam/containers/HashTables/HashTable/HashTable.C index 107aa5406..fd86ee0da 100644 --- a/src/foam/containers/HashTables/HashTable/HashTable.C +++ b/src/foam/containers/HashTables/HashTable/HashTable.C @@ -29,44 +29,15 @@ License #include "HashTable.H" #include "List.H" -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -template -Foam::label Foam::HashTable::canonicalSize(const label size) -{ - if (size < 1) - { - return 0; - } - - // enforce power of two - unsigned int goodSize = size; - - if (goodSize & (goodSize - 1)) - { - // brute-force is fast enough - goodSize = 1; - while (goodSize < unsigned(size)) - { - goodSize <<= 1; - } - } - - return goodSize; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::HashTable::HashTable(const label size) : - HashTableName(), + HashTableCore(), nElmts_(0), - tableSize_(canonicalSize(size)), - table_(NULL), - endIter_(*this, NULL, 0), - endConstIter_(*this, NULL, 0) + tableSize_(HashTableCore::canonicalSize(size)), + table_(NULL) { if (tableSize_) { @@ -83,12 +54,10 @@ Foam::HashTable::HashTable(const label size) template Foam::HashTable::HashTable(const HashTable& ht) : - HashTableName(), + HashTableCore(), nElmts_(0), tableSize_(ht.tableSize_), - table_(NULL), - endIter_(*this, NULL, 0), - endConstIter_(*this, NULL, 0) + table_(NULL) { if (tableSize_) { @@ -112,12 +81,10 @@ Foam::HashTable::HashTable const Xfer >& ht ) : - HashTableName(), + HashTableCore(), nElmts_(0), tableSize_(0), - table_(NULL), - endIter_(*this, NULL, 0), - endConstIter_(*this, NULL, 0) + table_(NULL) { transfer(ht()); } @@ -181,7 +148,7 @@ Foam::HashTable::find { if (key == ep->key_) { - return iterator(*this, ep, hashIdx); + return iterator(this, ep, hashIdx); } } } @@ -194,7 +161,7 @@ Foam::HashTable::find } # endif - return end(); + return iterator(); } @@ -213,7 +180,7 @@ Foam::HashTable::find { if (key == ep->key_) { - return const_iterator(*this, ep, hashIdx); + return const_iterator(this, ep, hashIdx); } } } @@ -226,23 +193,32 @@ Foam::HashTable::find } # endif - return cend(); + return const_iterator(); } -// Return the table of contents template Foam::List Foam::HashTable::toc() const { - List tofc(nElmts_); - label i = 0; + List keys(nElmts_); + label keyI = 0; for (const_iterator iter = cbegin(); iter != cend(); ++iter) { - tofc[i++] = iter.key(); + keys[keyI++] = iter.key(); } - return tofc; + return keys; +} + + +template +Foam::List Foam::HashTable::sortedToc() const +{ + List sortedLst = this->toc(); + sort(sortedLst); + + return sortedLst; } @@ -280,7 +256,7 @@ bool Foam::HashTable::set table_[hashIdx] = new hashedEntry(key, table_[hashIdx], newEntry); nElmts_++; - if (double(nElmts_)/tableSize_ > 0.8) + if (double(nElmts_)/tableSize_ > 0.8 && tableSize_ < maxTableSize) { # ifdef FULLDEBUG if (debug) @@ -332,18 +308,22 @@ bool Foam::HashTable::set template -bool Foam::HashTable::erase(const iterator& cit) +bool Foam::HashTable::iteratorBase::erase() { - if (cit.elmtPtr_) // note: endIter_ also has 0 elmtPtr_ + // note: entryPtr_ is NULL for end(), so this catches that too + if (entryPtr_) { - iterator& it = const_cast(cit); - - // Search element before elmtPtr_ + // Search element before entryPtr_ hashedEntry* prev = 0; - for (hashedEntry* ep = table_[it.hashIndex_]; ep; ep = ep->next_) + for + ( + hashedEntry* ep = hashTable_->table_[hashIndex_]; + ep; + ep = ep->next_ + ) { - if (ep == it.elmtPtr_) + if (ep == entryPtr_) { break; } @@ -352,98 +332,76 @@ bool Foam::HashTable::erase(const iterator& cit) if (prev) { - // Have element before elmtPtr - prev->next_ = it.elmtPtr_->next_; - delete it.elmtPtr_; - it.elmtPtr_ = prev; + // has an element before entryPtr - reposition to there + prev->next_ = entryPtr_->next_; + delete entryPtr_; + entryPtr_ = prev; } else { - // elmtPtr is first element on SLList - table_[it.hashIndex_] = it.elmtPtr_->next_; - delete it.elmtPtr_; + // entryPtr was first element on SLList + hashTable_->table_[hashIndex_] = entryPtr_->next_; + delete entryPtr_; - // Search back for previous non-zero table entry - while (--it.hashIndex_ >= 0 && !table_[it.hashIndex_]) - {} + // assign any non-NULL pointer value so it doesn't look + // like end()/cend() + entryPtr_ = reinterpret_cast(this); - if (it.hashIndex_ >= 0) - { - // In table entry search for last element - it.elmtPtr_ = table_[it.hashIndex_]; - - while (it.elmtPtr_ && it.elmtPtr_->next_) - { - it.elmtPtr_ = it.elmtPtr_->next_; - } - } - else - { - // No previous found. Mark with special value which is - // - not end()/cend() - // - handled by operator++ - it.elmtPtr_ = reinterpret_cast(this); - it.hashIndex_ = -1; - } + // Mark with special hashIndex value to signal it has been rewound. + // The next increment will bring it back to the present location. + // + // From the current position 'curPos', we wish to continue at + // prevPos='curPos-1', which we mark as markPos='-curPos-1'. + // The negative lets us notice it is special, the extra '-1' + // is needed to avoid ambiguity for position '0'. + // To retrieve prevPos, we would later use '-(markPos+1) - 1' + hashIndex_ = -hashIndex_ - 1; } - nElmts_--; - -# ifdef FULLDEBUG - if (debug) - { - Info<< "HashTable::erase(iterator&) : " - << "hashedEntry " << it.elmtPtr_->key_ << " removed.\n"; - } -# endif + hashTable_->nElmts_--; return true; } else { -# ifdef FULLDEBUG - if (debug) - { - Info<< "HashTable::erase(iterator&) : " - << "cannot remove hashedEntry from hash table\n"; - } -# endif - return false; } } + +// NOTE: +// We use (const iterator&) here, but manipulate its contents anyhow. +// The parameter should be (iterator&), but then the compiler doesn't find +// it correctly and tries to call as (iterator) instead. +// +template +bool Foam::HashTable::erase(const iterator& iter) +{ + // adjust iterator after erase + return const_cast(iter).erase(); +} + + template bool Foam::HashTable::erase(const Key& key) { - iterator fnd = find(key); - - if (fnd != end()) - { - return erase(fnd); - } - else - { - return false; - } + return erase(find(key)); } template Foam::label Foam::HashTable::erase(const UList& keys) { + const label nTotal = nElmts_; label count = 0; - // Remove listed keys from this table - if (this->size()) + // Remove listed keys from this table - terminates early if possible + for (label keyI = 0; count < nTotal && keyI < keys.size(); ++keyI) { - forAll(keys, keyI) + if (erase(keys[keyI])) { - if (erase(keys[keyI])) - { - count++; - } + count++; } } @@ -477,7 +435,7 @@ Foam::label Foam::HashTable::erase template void Foam::HashTable::resize(const label sz) { - label newSize = canonicalSize(sz); + label newSize = HashTableCore::canonicalSize(sz); if (newSize == tableSize_) { @@ -492,22 +450,22 @@ void Foam::HashTable::resize(const label sz) return; } - HashTable* newTable = new HashTable(newSize); + HashTable* tmpTable = new HashTable(newSize); for (const_iterator iter = cbegin(); iter != cend(); ++iter) { - newTable->insert(iter.key(), *iter); + tmpTable->insert(iter.key(), *iter); } - label oldTableSize = tableSize_; - tableSize_ = newTable->tableSize_; - newTable->tableSize_ = oldTableSize; + label oldSize = tableSize_; + tableSize_ = tmpTable->tableSize_; + tmpTable->tableSize_ = oldSize; hashedEntry** oldTable = table_; - table_ = newTable->table_; - newTable->table_ = oldTable; + table_ = tmpTable->table_; + tmpTable->table_ = oldTable; - delete newTable; + delete tmpTable; } @@ -543,6 +501,19 @@ void Foam::HashTable::clearStorage() } +template +void Foam::HashTable::shrink() +{ + const label newSize = HashTableCore::canonicalSize(nElmts_); + + if (newSize < tableSize_) + { + // avoid having the table disappear on us + resize(newSize ? newSize : 2); + } +} + + template void Foam::HashTable::transfer(HashTable& ht) { @@ -606,18 +577,12 @@ bool Foam::HashTable::operator== const HashTable& rhs ) const { - // Are all my elements in rhs? - for (const_iterator iter = cbegin(); iter != cend(); ++iter) + // sizes (number of keys) must match + if (size() != rhs.size()) { - const_iterator fnd = rhs.find(iter.key()); - - if (fnd == rhs.cend() || fnd() != iter()) - { - return false; - } + return false; } - // Are all rhs elements in me? for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter) { const_iterator fnd = find(iter.key()); @@ -627,6 +592,7 @@ bool Foam::HashTable::operator== return false; } } + return true; } diff --git a/src/foam/containers/HashTables/HashTable/HashTable.H b/src/foam/containers/HashTables/HashTable/HashTable.H index a62c35ab3..f90c2b03e 100644 --- a/src/foam/containers/HashTables/HashTable/HashTable.H +++ b/src/foam/containers/HashTables/HashTable/HashTable.H @@ -70,23 +70,59 @@ Ostream& operator<<(Ostream&, const HashTable&); /*---------------------------------------------------------------------------*\ - Class HashTableName Declaration + Class HashTableCore Declaration \*---------------------------------------------------------------------------*/ -TemplateName(HashTable); +//- Template-invariant bits for HashTable +struct HashTableCore +{ + //- Return a canonical (power-of-two) size + static label canonicalSize(const label); + + //- Maximum allowable table size + static const label maxTableSize; + + //- Construct null + HashTableCore() + {} + + //- Define template name and debug + ClassName("HashTable"); + + //- A zero-sized end iterator + struct iteratorEnd + { + //- Construct null + iteratorEnd() + {} + }; + + //- iteratorEnd set to beyond the end of any HashTable + inline static iteratorEnd cend() + { + return iteratorEnd(); + } + + //- iteratorEnd set to beyond the end of any HashTable + inline static iteratorEnd end() + { + return iteratorEnd(); + } +}; /*---------------------------------------------------------------------------*\ - Class HashTable Declaration + Class HashTable Declaration \*---------------------------------------------------------------------------*/ template class HashTable : - public HashTableName + public HashTableCore { // Private data type for table entries + //- Structure to hold a hashed entry with SLList for collisions struct hashedEntry { //- The lookup key @@ -98,18 +134,17 @@ class HashTable //- The data object T obj_; - //- Constructors + //- Construct from key, next pointer and object + inline hashedEntry(const Key&, hashedEntry* next, const T&); - //- Construct given key, next pointer and object - inline hashedEntry - ( - const Key&, - hashedEntry* next, - const T& newEntry - ); - //- Dissallow construction as copy - hashedEntry(const hashedEntry&); + private: + + //- Disallow default bitwise copy construct + hashedEntry(const hashedEntry&); + + //- Disallow default bitwise assignment + void operator=(const hashedEntry&); }; @@ -118,7 +153,7 @@ class HashTable //- The current number of elements in table label nElmts_; - //- Number of primary entries allocated in table (not necessarily used) + //- Number of primary entries allocated in table label tableSize_; //- The table of primary entries @@ -137,27 +172,32 @@ class HashTable //- Assign a new hashedEntry to a possibly already existing key bool set(const Key&, const T& newElmt, bool protect); - public: + // Forward declaration of iterators + + class iteratorBase; + class iterator; + class const_iterator; + //- Declare friendship with the HashPtrTable class template friend class HashPtrTable; + //- Declare friendship with the iteratorBase + friend class iteratorBase; - // Forward declaration of STL iterators - - class iterator; + //- Declare friendship with the iterator friend class iterator; - class const_iterator; + //- Declare friendship with the const_iterator friend class const_iterator; // Constructors //- Construct given initial table size - HashTable(const label size = 128); + explicit HashTable(const label size = 128); //- Construct from Istream HashTable(Istream&, const label size = 128); @@ -169,16 +209,18 @@ public: HashTable(const Xfer >&); - // Destructor - - ~HashTable(); + //- Destructor + ~HashTable(); // Member Functions // Access - //- Return number of elements in table. + //- The size of the underlying table + inline label capacity() const; + + //- Return number of elements in table inline label size() const; //- Return true if the hash table is empty @@ -198,9 +240,13 @@ public: //- Return the table of contents List toc() const; + //- Return the table of contents as a sorted list + List sortedToc() const; + //- Print information Ostream& printInfo(Ostream&) const; + // Edit //- Insert a new hashedEntry @@ -209,10 +255,11 @@ public: //- Assign a new hashedEntry, overwriting existing entries inline bool set(const Key&, const T& newElmt); - //- Erase an hashedEntry specified by given iterator + //- Erase a hashedEntry specified by given iterator + // This invalidates the iterator until the next operator++ bool erase(const iterator&); - //- Erase an hashedEntry specified by given key if in table + //- Erase a hashedEntry specified by the given key bool erase(const Key&); //- Remove entries given by the listed keys from this HashTable @@ -236,8 +283,11 @@ public: // Equivalent to clear() followed by resize(0) void clearStorage(); + //- Shrink the allocated table to approx. twice number of elements + void shrink(); + //- Transfer the contents of the argument table into this table - // and annull the argument table. + // and annul the argument table. void transfer(HashTable&); //- Transfer contents to the Xfer container @@ -246,27 +296,27 @@ public: // Member Operators - //- Find and return an hashedEntry + //- Find and return a hashedEntry inline T& operator[](const Key&); - //- Find and return an hashedEntry + //- Find and return a hashedEntry inline const T& operator[](const Key&) const; - //- Find and return an hashedEntry, create it null if not present. + //- Find and return a hashedEntry, create it null if not present inline T& operator()(const Key&); //- Assignment void operator=(const HashTable&); - //- Equality. Two hash tables are equal if all contents of first are - // also in second and vice versa. So does not depend on table size or - // order! + //- Equality. Hash tables are equal if the keys and values are equal. + // Independent of table storage size and table order. bool operator==(const HashTable&) const; //- The opposite of the equality operation. Takes linear time. bool operator!=(const HashTable&) const; + // STL type definitions //- Type of values the HashTable contains. @@ -285,138 +335,198 @@ public: typedef label size_type; - // STL iterator + // Iterators and helpers - //- An STL-conforming iterator - class iterator + //- The iterator base for HashTable + // Note: data and functions are protected, to allow reuse by iterator + // and prevent most external usage. + // iterator and const_iterator have the same size, allowing + // us to reinterpret_cast between them (if desired) + class iteratorBase { - friend class HashTable; - friend class const_iterator; + // Private Data - // Private data - - //- Reference to the HashTable this is an iterator for - HashTable& hashTable_; + //- Pointer to the HashTable for which this is an iterator + // This also lets us use the default bitwise copy/assignment + HashTable* hashTable_; //- Current element - hashedEntry* elmtPtr_; + hashedEntry* entryPtr_; //- Current hash index label hashIndex_; + + protected: + + // Constructors + + //- Construct null - equivalent to an 'end' position + inline iteratorBase(); + + //- Construct from hash table, moving to its 'begin' position + inline explicit iteratorBase + ( + const HashTable* curHashTable + ); + + //- Construct from hash table, element and hash index + inline explicit iteratorBase + ( + const HashTable* curHashTable, + const hashedEntry* elmt, + const label hashIndex + ); + + + // Protected Member Functions + + //- Increment to the next position + inline void increment(); + + //- Erase the HashTable element at the current position + bool erase(); + + //- Return non-const access to referenced object + inline T& object(); + + //- Return const access to referenced object + inline const T& cobject() const; + + + public: + + // Member operators + + // Access + + //- Return the Key corresponding to the iterator + inline const Key& key() const; + + //- Compare hashedEntry element pointers + inline bool operator==(const iteratorBase&) const; + inline bool operator!=(const iteratorBase&) const; + + //- Compare hashedEntry to iteratorEnd pointers + inline bool operator==(const iteratorEnd& unused) const; + inline bool operator!=(const iteratorEnd& unused) const; + }; + + + //- An STL-conforming iterator + class iterator + : + public iteratorBase + { + friend class HashTable; + + // Private Member Functions + + //- Construct from hash table, moving to its 'begin' position + inline explicit iterator + ( + HashTable* curHashTable + ); + + //- Construct from hash table, element and hash index + inline explicit iterator + ( + HashTable* curHashTable, + hashedEntry* elmt, + const label hashIndex + ); + + public: // Constructors - //- Construct from hash table, element and hash index - inline iterator - ( - HashTable& curHashTable, - hashedEntry* elmt, - label hashIndex - ); + //- Construct null (end iterator) + inline iterator(); + + //- Construct end iterator + inline iterator(const iteratorEnd& unused); + // Member operators - inline void operator=(const iterator&); - - inline bool operator==(const iterator&) const; - inline bool operator!=(const iterator&) const; - - inline bool operator==(const const_iterator&) const; - inline bool operator!=(const const_iterator&) const; - + //- Return referenced hash value inline T& operator*(); inline T& operator()(); + //- Return referenced hash value inline const T& operator*() const; inline const T& operator()() const; inline iterator& operator++(); inline iterator operator++(int); - - inline const Key& key() const; }; - - //- iterator set to the begining of the HashTable + //- iterator set to the beginning of the HashTable inline iterator begin(); - //- iterator set to beyond the end of the HashTable - inline const iterator& end(); - // STL const_iterator //- An STL-conforming const_iterator class const_iterator + : + public iteratorBase { - friend class iterator; + friend class HashTable; - // Private data + // Private Member Functions - //- Reference to the HashTable this is an iterator for - const HashTable& hashTable_; + //- Construct from hash table, moving to its 'begin' position + inline explicit const_iterator + ( + const HashTable* curHashTable + ); - //- Current element - const hashedEntry* elmtPtr_; - - //- Current hash index - label hashIndex_; + //- Construct from hash table, element and hash index + inline explicit const_iterator + ( + const HashTable* curHashTable, + const hashedEntry* elmt, + const label hashIndex + ); public: // Constructors - //- Construct from hash table, element and hash index - inline const_iterator - ( - const HashTable& curHashTable, - const hashedEntry* elmt, - label hashIndex - ); + //- Construct null (end iterator) + inline const_iterator(); - //- Construct from the non-const iterator + //- Construct from iterator inline const_iterator(const iterator&); + //- Construct end iterator + inline const_iterator(const iteratorEnd& unused); + // Member operators - inline void operator=(const const_iterator&); - - inline bool operator==(const const_iterator&) const; - inline bool operator!=(const const_iterator&) const; - - inline bool operator==(const iterator&) const; - inline bool operator!=(const iterator&) const; - + //- Return referenced hash value inline const T& operator*() const; inline const T& operator()() const; inline const_iterator& operator++(); inline const_iterator operator++(int); - inline const Key& key() const; }; //- const_iterator set to the beginning of the HashTable inline const_iterator cbegin() const; - //- const_iterator set to beyond the end of the HashTable - inline const const_iterator& cend() const; - //- const_iterator set to the beginning of the HashTable inline const_iterator begin() const; - //- const_iterator set to beyond the end of the HashTable - inline const const_iterator& end() const; - // IOstream Operator -#ifndef SWIG friend Istream& operator>> ( Istream&, @@ -428,16 +538,6 @@ public: Ostream&, const HashTable& ); -#endif - - -private: - - //- iterator returned by end() - iterator endIter_; - - //- const_iterator returned by end() - const_iterator endConstIter_; }; diff --git a/src/foam/containers/HashTables/HashTable/HashTableName.C b/src/foam/containers/HashTables/HashTable/HashTableCore.C similarity index 65% rename from src/foam/containers/HashTables/HashTable/HashTableName.C rename to src/foam/containers/HashTables/HashTable/HashTableCore.C index 03e95b0c3..c31bb5ba6 100644 --- a/src/foam/containers/HashTables/HashTable/HashTableName.C +++ b/src/foam/containers/HashTables/HashTable/HashTableCore.C @@ -24,9 +24,48 @@ License \*---------------------------------------------------------------------------*/ #include "HashTable.H" +#include "uLabel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::HashTableName, 0); +namespace Foam +{ +defineTypeNameAndDebug(HashTableCore, 0); +} + +const Foam::label Foam::HashTableCore::maxTableSize +( + Foam::HashTableCore::canonicalSize + ( + Foam::labelMax/2 + ) +); + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::label Foam::HashTableCore::canonicalSize(const label size) +{ + if (size < 1) + { + return 0; + } + + // enforce power of two + uLabel goodSize = size; + + if (goodSize & (goodSize - 1)) + { + // brute-force is fast enough + goodSize = 1; + while (goodSize < unsigned(size)) + { + goodSize <<= 1; + } + } + + return goodSize; +} + // ************************************************************************* // diff --git a/src/foam/containers/HashTables/HashTable/HashTableI.H b/src/foam/containers/HashTables/HashTable/HashTableI.H index 8aeaa5b8f..19bff973f 100644 --- a/src/foam/containers/HashTables/HashTable/HashTableI.H +++ b/src/foam/containers/HashTables/HashTable/HashTableI.H @@ -32,12 +32,12 @@ inline Foam::HashTable::hashedEntry::hashedEntry ( const Key& key, hashedEntry* next, - const T& newEntry + const T& obj ) : key_(key), next_(next), - obj_(newEntry) + obj_(obj) {} @@ -54,6 +54,13 @@ Foam::HashTable::hashKeyIndex(const Key& key) const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +inline Foam::label Foam::HashTable::capacity() const +{ + return tableSize_; +} + + template inline Foam::label Foam::HashTable::size() const { @@ -75,7 +82,7 @@ inline bool Foam::HashTable::insert const T& newEntry ) { - return set(key, newEntry, true); + return this->set(key, newEntry, true); } @@ -86,7 +93,7 @@ inline bool Foam::HashTable::set const T& newEntry ) { - return set(key, newEntry, false); + return this->set(key, newEntry, false); } @@ -103,9 +110,9 @@ Foam::HashTable::xfer() template inline T& Foam::HashTable::operator[](const Key& key) { - iterator iter = find(key); + iterator iter = this->find(key); - if (iter == end()) + if (iter == this->end()) { FatalErrorIn("HashTable::operator[](const Key&)") << key << " not found in table. Valid entries: " @@ -120,9 +127,9 @@ inline T& Foam::HashTable::operator[](const Key& key) template inline const T& Foam::HashTable::operator[](const Key& key) const { - const_iterator iter = find(key); + const_iterator iter = this->find(key); - if (iter == cend()) + if (iter == this->cend()) { FatalErrorIn("HashTable::operator[](const Key&) const") << key << " not found in table. Valid entries: " @@ -137,11 +144,11 @@ inline const T& Foam::HashTable::operator[](const Key& key) const template inline T& Foam::HashTable::operator()(const Key& key) { - iterator iter = find(key); + iterator iter = this->find(key); - if (iter == end()) + if (iter == this->end()) { - insert(key, T()); + this->insert(key, T()); return *find(key); } else @@ -151,78 +158,215 @@ inline T& Foam::HashTable::operator()(const Key& key) } -// * * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * iterator base * * * * * * * * * * * * * * * // template -inline Foam::HashTable::iterator::iterator +inline Foam::HashTable::iteratorBase::iteratorBase() +: + hashTable_(0), + entryPtr_(0), + hashIndex_(0) +{} + + +template +inline Foam::HashTable::iteratorBase::iteratorBase ( - HashTable& hashTbl, - hashedEntry* elmt, - label hashIndex + const HashTable* hashTbl ) : - hashTable_(hashTbl), - elmtPtr_(elmt), + hashTable_(const_cast*>(hashTbl)), + entryPtr_(0), + hashIndex_(0) +{ + if (hashTable_->nElmts_) + { + // find first non-NULL table entry + while + ( + !(entryPtr_ = hashTable_->table_[hashIndex_]) + && ++hashIndex_ < hashTable_->tableSize_ + ) + {} + + if (hashIndex_ >= hashTable_->tableSize_) + { + // make into an end iterator + entryPtr_ = 0; + hashIndex_ = 0; + } + } +} + + +template +inline Foam::HashTable::iteratorBase::iteratorBase +( + const HashTable* hashTbl, + const hashedEntry* elmt, + const label hashIndex +) +: + hashTable_(const_cast*>(hashTbl)), + entryPtr_(const_cast(elmt)), hashIndex_(hashIndex) {} template -inline void Foam::HashTable::iterator::operator= +inline void +Foam::HashTable::iteratorBase::increment() +{ + // A negative index is a special value from erase + if (hashIndex_ < 0) + { + // the markPos='-curPos-1', but we wish to continue at 'curPos-1' + // thus use '-(markPos+1) -1' + hashIndex_ = -(hashIndex_+1) - 1; + } + else if (entryPtr_) + { + if (entryPtr_->next_) + { + // Move to next element on the SLList + entryPtr_ = entryPtr_->next_; + return; + } + } + // else + // { + // // if we reach here (entryPtr_ is NULL) it is already at the end() + // // we should probably stop + // } + + + // Step to the next table entry + while + ( + ++hashIndex_ < hashTable_->tableSize_ + && !(entryPtr_ = hashTable_->table_[hashIndex_]) + ) + {} + + if (hashIndex_ >= hashTable_->tableSize_) + { + // make into an end iterator + entryPtr_ = 0; + hashIndex_ = 0; + } +} + + +template +inline +const Key& Foam::HashTable::iteratorBase::key() const +{ + return entryPtr_->key_; +} + + +template +inline T& +Foam::HashTable::iteratorBase::object() +{ + return entryPtr_->obj_; +} + + +template +inline const T& +Foam::HashTable::iteratorBase::cobject() const +{ + return entryPtr_->obj_; +} + + +template +inline bool Foam::HashTable::iteratorBase::operator== ( - const iterator& iter + const iteratorBase& iter +) const +{ + return entryPtr_ == iter.entryPtr_; +} + + +template +inline bool Foam::HashTable::iteratorBase::operator!= +( + const iteratorBase& iter +) const +{ + return entryPtr_ != iter.entryPtr_; +} + + +template +inline bool Foam::HashTable::iteratorBase::operator== +( + const iteratorEnd& +) const +{ + return !entryPtr_; +} + + +template +inline bool Foam::HashTable::iteratorBase::operator!= +( + const iteratorEnd& +) const +{ + return entryPtr_; +} + + +// * * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * // + +template +inline Foam::HashTable::iterator::iterator() +: + iteratorBase() +{} + + +template +inline Foam::HashTable::iterator::iterator +( + const iteratorEnd& ) -{ - elmtPtr_ = iter.elmtPtr_; - hashIndex_ = iter.hashIndex_; -} +: + iteratorBase() +{} template -inline bool Foam::HashTable::iterator::operator== +inline Foam::HashTable::iterator::iterator ( - const iterator& iter -) const -{ - return elmtPtr_ == iter.elmtPtr_; -} + HashTable* hashTbl +) +: + iteratorBase(hashTbl) +{} template -inline bool Foam::HashTable::iterator::operator!= +inline Foam::HashTable::iterator::iterator ( - const iterator& iter -) const -{ - return elmtPtr_ != iter.elmtPtr_; -} - - -template -inline bool Foam::HashTable::iterator::operator== -( - const const_iterator& iter -) const -{ - return elmtPtr_ == iter.elmtPtr_; -} - - -template -inline bool Foam::HashTable::iterator::operator!= -( - const const_iterator& iter -) const -{ - return elmtPtr_ != iter.elmtPtr_; -} + HashTable* hashTbl, + hashedEntry* elmt, + const label hashIndex +) +: + iteratorBase(hashTbl, elmt, hashIndex) +{} template inline T& Foam::HashTable::iterator::operator*() { - return elmtPtr_->obj_; + return this->object(); } @@ -230,7 +374,7 @@ template inline T& Foam::HashTable::iterator::operator()() { - return elmtPtr_->obj_; + return this->object(); } @@ -238,7 +382,7 @@ template inline const T& Foam::HashTable::iterator::operator*() const { - return elmtPtr_->obj_; + return this->cobject(); } @@ -246,7 +390,7 @@ template inline const T& Foam::HashTable::iterator::operator()() const { - return elmtPtr_->obj_; + return this->cobject(); } @@ -255,53 +399,18 @@ inline typename Foam::HashTable::iterator& Foam::HashTable::iterator::operator++() { - // Check for special value from erase. (sets hashIndex to -1) - if (hashIndex_ >= 0) - { - // Do we have additional elements on the SLList? - if (elmtPtr_ && elmtPtr_->next_) - { - elmtPtr_ = elmtPtr_->next_; - return *this; - } - } - - // Step to the next table entry - while - ( - ++hashIndex_ < hashTable_.tableSize_ - && !(elmtPtr_ = hashTable_.table_[hashIndex_]) - ) - {} - - if (hashIndex_ == hashTable_.tableSize_) - { - // make end iterator - elmtPtr_ = 0; - hashIndex_ = 0; - } + this->increment(); return *this; } template inline typename Foam::HashTable::iterator -Foam::HashTable::iterator::operator++ -( - int -) +Foam::HashTable::iterator::operator++(int) { - iterator tmp = *this; - ++*this; - return tmp; -} - - -template -inline -const Key& Foam::HashTable::iterator::key() const -{ - return elmtPtr_->key_; + iterator old = *this; + this->increment(); + return old; } @@ -309,135 +418,74 @@ template inline typename Foam::HashTable::iterator Foam::HashTable::begin() { - label i = 0; - - if (nElmts_) - { - while (table_ && !table_[i] && ++i < tableSize_) - {} - } - else - { - i = tableSize_; - } - - if (i == tableSize_) - { -# ifdef FULLDEBUG - if (debug) - { - Info<< "HashTable is empty\n"; - } -# endif - - return HashTable::endIter_; - } - else - { - return iterator(*this, table_[i], i); - } -} - - -template -inline const typename Foam::HashTable::iterator& -Foam::HashTable::end() -{ - return HashTable::endIter_; + return iterator(this); } // * * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * // +template +inline Foam::HashTable::const_iterator::const_iterator() +: + iteratorBase() +{} + + template inline Foam::HashTable::const_iterator::const_iterator ( - const HashTable& hashTbl, + const HashTable::iterator& iter +) +: + iteratorBase(iter) +{} + + +template +inline Foam::HashTable::const_iterator::const_iterator +( + const iteratorEnd& +) +: + iteratorBase() +{} + + +template +inline Foam::HashTable::const_iterator::const_iterator +( + const HashTable* hashTbl +) +: + iteratorBase(hashTbl) +{} + + +template +inline Foam::HashTable::const_iterator::const_iterator +( + const HashTable* hashTbl, const hashedEntry* elmt, - label hashIndex + const label hashIndex ) : - hashTable_(hashTbl), - elmtPtr_(elmt), - hashIndex_(hashIndex) + iteratorBase(hashTbl, elmt, hashIndex) {} -template -inline Foam::HashTable::const_iterator::const_iterator -( - const iterator& iter -) -: - hashTable_(iter.hashTable_), - elmtPtr_(iter.elmtPtr_), - hashIndex_(iter.hashIndex_) -{} - - -template -inline void Foam::HashTable::const_iterator::operator= -( - const const_iterator& iter -) -{ - elmtPtr_ = iter.elmtPtr_; - hashIndex_ = iter.hashIndex_; -} - - -template -inline bool Foam::HashTable::const_iterator::operator== -( - const const_iterator& iter -) const -{ - return elmtPtr_ == iter.elmtPtr_; -} - - -template -inline bool Foam::HashTable::const_iterator::operator!= -( - const const_iterator& iter -) const -{ - return elmtPtr_ != iter.elmtPtr_; -} - - -template -inline bool Foam::HashTable::const_iterator::operator== -( - const iterator& iter -) const -{ - return elmtPtr_ == iter.elmtPtr_; -} - - -template -inline bool Foam::HashTable::const_iterator::operator!= -( - const iterator& iter -) const -{ - return elmtPtr_ != iter.elmtPtr_; -} - - template inline const T& Foam::HashTable::const_iterator::operator*() const { - return elmtPtr_->obj_; + return this->cobject(); } + template inline const T& Foam::HashTable::const_iterator::operator()() const { - return elmtPtr_->obj_; + return this->cobject(); } @@ -446,43 +494,18 @@ inline typename Foam::HashTable::const_iterator& Foam::HashTable::const_iterator::operator++() { - if - ( - !(elmtPtr_ = elmtPtr_->next_) - && ++hashIndex_ < hashTable_.tableSize_ - && !(elmtPtr_ = hashTable_.table_[hashIndex_]) - ) - { - while - ( - ++hashIndex_ < hashTable_.tableSize_ - && !(elmtPtr_ = hashTable_.table_[hashIndex_]) - ) - {} - } - + this->increment(); return *this; } template inline typename Foam::HashTable::const_iterator -Foam::HashTable::const_iterator::operator++ -( - int -) +Foam::HashTable::const_iterator::operator++(int) { - const_iterator tmp = *this; - ++*this; - return tmp; -} - - -template -inline -const Key& Foam::HashTable::const_iterator::key() const -{ - return elmtPtr_->key_; + const_iterator old = *this; + this->increment(); + return old; } @@ -490,41 +513,7 @@ template inline typename Foam::HashTable::const_iterator Foam::HashTable::cbegin() const { - label i = 0; - - if (nElmts_) - { - while (table_ && !table_[i] && ++i < tableSize_) - {} - } - else - { - i = tableSize_; - } - - if (i == tableSize_) - { -# ifdef FULLDEBUG - if (debug) - { - Info<< "HashTable is empty\n"; - } -# endif - - return HashTable::endConstIter_; - } - else - { - return const_iterator(*this, table_[i], i); - } -} - - -template -inline const typename Foam::HashTable::const_iterator& -Foam::HashTable::cend() const -{ - return HashTable::endConstIter_; + return const_iterator(this); } @@ -536,12 +525,4 @@ Foam::HashTable::begin() const } -template -inline const typename Foam::HashTable::const_iterator& -Foam::HashTable::end() const -{ - return HashTable::endConstIter_; -} - - // ************************************************************************* // diff --git a/src/foam/containers/HashTables/HashTable/HashTableIO.C b/src/foam/containers/HashTables/HashTable/HashTableIO.C index 04367c4ff..9c3bfee4a 100644 --- a/src/foam/containers/HashTables/HashTable/HashTableIO.C +++ b/src/foam/containers/HashTables/HashTable/HashTableIO.C @@ -32,16 +32,19 @@ License template Foam::HashTable::HashTable(Istream& is, const label size) : - HashTableName(), + HashTableCore(), nElmts_(0), - tableSize_(canonicalSize(size)), - table_(new hashedEntry*[tableSize_]), - endIter_(*this, NULL, 0), - endConstIter_(*this, NULL, 0) + tableSize_(HashTableCore::canonicalSize(size)), + table_(NULL) { - for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++) + if (tableSize_) { - table_[hashIdx] = 0; + table_ = new hashedEntry*[tableSize_]; + + for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++) + { + table_[hashIdx] = 0; + } } operator>>(is, *this); diff --git a/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.C index 0dafd4dee..401f373bc 100644 --- a/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.C +++ b/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.C @@ -32,8 +32,7 @@ License // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -template -Foam::label Foam::StaticHashTable::canonicalSize(const label size) +Foam::label Foam::StaticHashTableCore::canonicalSize(const label size) { if (size < 1) { @@ -63,8 +62,8 @@ Foam::label Foam::StaticHashTable::canonicalSize(const label size) template Foam::StaticHashTable::StaticHashTable(const label size) : - StaticHashTableName(), - keys_(canonicalSize(size)), + StaticHashTableCore(), + keys_(StaticHashTableCore::canonicalSize(size)), objects_(keys_.size()), nElmts_(0), endIter_(*this, keys_.size(), 0), @@ -88,7 +87,7 @@ Foam::StaticHashTable::StaticHashTable const StaticHashTable& ht ) : - StaticHashTableName(), + StaticHashTableCore(), keys_(ht.keys_), objects_(ht.objects_), nElmts_(ht.nElmts_), @@ -97,14 +96,13 @@ Foam::StaticHashTable::StaticHashTable {} - template Foam::StaticHashTable::StaticHashTable ( - const Xfer< StaticHashTable >& ht + const Xfer >& ht ) : - StaticHashTableName(), + StaticHashTableCore(), keys_(0), objects_(0), nElmts_(0), @@ -223,15 +221,15 @@ Foam::StaticHashTable::find template Foam::List Foam::StaticHashTable::toc() const { - List tofc(nElmts_); - label i = 0; + List keys(nElmts_); + label keyI = 0; for (const_iterator iter = cbegin(); iter != cend(); ++iter) { - tofc[i++] = iter.key(); + keys[keyI++] = iter.key(); } - return tofc; + return keys; } @@ -318,24 +316,9 @@ bool Foam::StaticHashTable::erase(const iterator& cit) if (it.elemIndex_ < 0) { // No previous element in the local list - - // Search back for previous non-zero table entry - while (--it.hashIndex_ >= 0 && !objects_[it.hashIndex_].size()) - {} - - if (it.hashIndex_ >= 0) - { - // The last element in the local list - it.elemIndex_ = objects_[it.hashIndex_].size() - 1; - } - else - { - // No previous found. Mark with special value which is - // - not end() - // - handled by operator++ - it.hashIndex_ = -1; - it.elemIndex_ = 0; - } + // Mark with as special value (see notes in HashTable) + it.hashIndex_ = -it.hashIndex_ - 1; + it.elemIndex_ = 0; } nElmts_--; @@ -406,7 +389,7 @@ Foam::label Foam::StaticHashTable::erase template void Foam::StaticHashTable::resize(const label sz) { - label newSize = canonicalSize(sz); + label newSize = StaticHashTableCore::canonicalSize(sz); if (newSize == keys_.size()) { @@ -467,7 +450,6 @@ void Foam::StaticHashTable::clearStorage() } - template void Foam::StaticHashTable::transfer ( @@ -542,18 +524,8 @@ bool Foam::StaticHashTable::operator== const StaticHashTable& rhs ) const { - // Are all my elements in rhs? - for (const_iterator iter = cbegin(); iter != cend(); ++iter) - { - const_iterator fnd = rhs.find(iter.key()); + // sizes (number of keys) must match - if (fnd == rhs.cend() || fnd() != iter()) - { - return false; - } - } - - // Are all rhs elements in me? for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter) { const_iterator fnd = find(iter.key()); @@ -563,6 +535,7 @@ bool Foam::StaticHashTable::operator== return false; } } + return true; } diff --git a/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.H index 0a2826ce9..77e2603d0 100644 --- a/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.H +++ b/src/foam/containers/HashTables/StaticHashTable/StaticHashTable.H @@ -72,10 +72,31 @@ template Ostream& operator<< /*---------------------------------------------------------------------------*\ - Class StaticHashTableName Declaration + Class StaticHashTableCore Declaration \*---------------------------------------------------------------------------*/ -TemplateName(StaticHashTable); +//- Template-invariant bits for StaticHashTable +struct StaticHashTableCore +{ + //- Return a canonical (power-of-two) size + static label canonicalSize(const label); + + //- Construct null + StaticHashTableCore() + {} + + //- Define template name and debug + ClassName("StaticHashTable"); + + //- A zero-sized end iterator + struct iteratorEnd + { + //- Construct null + iteratorEnd() + {} + }; +}; + /*---------------------------------------------------------------------------*\ @@ -85,7 +106,7 @@ TemplateName(StaticHashTable); template class StaticHashTable : - public StaticHashTableName + public StaticHashTableCore { // Private data type for table entries @@ -108,6 +129,7 @@ class StaticHashTable //- Assign a new hashed entry to a possibly already existing key bool set(const Key&, const T& newElmt, bool protect); + public: @@ -156,11 +178,11 @@ public: StaticHashTable(const StaticHashTable&); //- Construct by transferring the parameter contents - StaticHashTable(const Xfer< StaticHashTable >&); + StaticHashTable(const Xfer >&); - // Destructor - ~StaticHashTable(); + //- Destructor + ~StaticHashTable(); // Member Functions @@ -220,11 +242,11 @@ public: void clearStorage(); //- Transfer the contents of the argument table into this table - // and annull the argument table. + // and annul the argument table. void transfer(StaticHashTable&); //- Transfer contents to the Xfer container - inline Xfer< StaticHashTable > xfer(); + inline Xfer > xfer(); // Member Operators @@ -248,6 +270,7 @@ public: //- The opposite of the equality operation. bool operator!=(const StaticHashTable&) const; + // STL type definitions //- Type of values the StaticHashTable contains. @@ -290,6 +313,7 @@ public: //- Index of current element at hashIndex label elemIndex_; + public: // Constructors diff --git a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableName.C b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableCore.C similarity index 95% rename from src/foam/containers/HashTables/StaticHashTable/StaticHashTableName.C rename to src/foam/containers/HashTables/StaticHashTable/StaticHashTableCore.C index 9ec16b7ca..9fabfe8e0 100644 --- a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableName.C +++ b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableCore.C @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::StaticHashTableName, 0); +namespace Foam +{ +defineTypeNameAndDebug(StaticHashTableCore, 0); +} + // ************************************************************************* // diff --git a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableI.H b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableI.H index c7bbb38da..2c59db4ad 100644 --- a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableI.H +++ b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableI.H @@ -78,7 +78,7 @@ inline bool Foam::StaticHashTable::set template -inline Foam::Xfer< Foam::StaticHashTable > +inline Foam::Xfer > Foam::StaticHashTable::xfer() { return xferMove(*this); @@ -266,8 +266,13 @@ Foam::StaticHashTable::Iterator TableRef >::operator++() { - // Check for special value from erase. (sets hashIndex to -1) - if (hashIndex_ >= 0) + // A negative index is a special value from erase + // (see notes in HashTable) + if (hashIndex_ < 0) + { + hashIndex_ = -(hashIndex_+1) - 1; + } + else { // Try the next element on the local list elemIndex_++; @@ -411,6 +416,4 @@ Foam::StaticHashTable::end() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableIO.C b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableIO.C index e71184f84..6307d55e8 100644 --- a/src/foam/containers/HashTables/StaticHashTable/StaticHashTableIO.C +++ b/src/foam/containers/HashTables/StaticHashTable/StaticHashTableIO.C @@ -36,9 +36,9 @@ Foam::StaticHashTable::StaticHashTable const label size ) : - StaticHashTableName(), - keys_(size), - objects_(size), + StaticHashTableCore(), + keys_(StaticHashTableCore::canonicalSize(size)), + objects_(StaticHashTableCore::canonicalSize(size)), nElmts_(0), endIter_(*this, keys_.size(), 0), endConstIter_(*this, keys_.size(), 0) From 6619d0b46242dcf090dc007aa0166026de3a3a63 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 13 Jan 2014 11:59:08 +0000 Subject: [PATCH 004/197] Updated list of contributors --- ListOfContributors | 77 ++++++++++++++++++++++++++++++++++++ README | 50 +---------------------- ReleaseNotes-foam-extend-3.0 | 55 +------------------------- 3 files changed, 80 insertions(+), 102 deletions(-) create mode 100644 ListOfContributors diff --git a/ListOfContributors b/ListOfContributors new file mode 100644 index 000000000..e033eaa81 --- /dev/null +++ b/ListOfContributors @@ -0,0 +1,77 @@ +# -*- mode: org; -*- +# +#+TITLE: *Cumulative List of Contributors for foam-extend-3.0* +#+AUTHOR: Hrvoje Jasak. +#+DATE: 10 January 2014 +#+LINK: http://foam-extend.org +#+OPTIONS: author:nil + +################################################################################ + +Contents: +* List of Contributors + +################################################################################ + + +* List of Contributors + + (If your name is missing in the list, please contact the maintainers at + and it will be added asap.) + + Henry Weller + Hrvoje Jasak + Mattijs Janssens + Zeljko Tukovic + Bernhard Gschaider + Tommaso Lucchini + Martin Beaudoin + Sandeep Menon + Niklas Nordin + Eugene De Villiers + Henrik Rusche + Ivor Clifford + Philiposse Rajan + Gavin Tabor + Jovani Favero + Frank Bos + David Hill + Niklas Wikstrom + Dubravko Matijasevic + Darrin Stephens + Christian Beck + Oliver Borm + James Criner + Hua Shan + David Boner + Pierre-Olivier Dallaire + Norman Del Puppo + Dennis Kingsley + Frank Albina + Flavio Galeazzo + Hannes Kroger + Olivier Petit + David Schmidt + Andreas Feymark + Luca Mangani + Daniel Schmode + Christoph Goniva + Takuya Oshima + Juho Peltola + Eric Paterson + Fabian Peng Karrholm + Aleksandar Karac + Maria Garcia Camprubi + Chris Greenshields + Mark Olesen + Hilary Spencer + Andy Heather + Dominik Christ + Peter Janas + Niels Linnemann + Nikola Kornev + Philip Cardiff + Declan Carolan + Michael Leonard + David McAuliffe + Tian Tang diff --git a/README b/README index b196be006..ef2b82318 100644 --- a/README +++ b/README @@ -168,54 +168,8 @@ * Instructions on how to contribute http://www.extend-project.de/project-final/how-to-contribute -* List of Contributors - Henry Weller - Hrvoje Jasak - Mattijs Janssens - Zeljko Tukovic - Bernhard Gschaider - Tommaso Lucchini - Martin Beaudoin - Sandeep Menon - Niklas Nordin - Eugene De Villiers - Henrik Rusche - Ivor Clifford - Philiposse Rajan - Gavin Tabor - Jovani Favero - Frank Bos - David Hill - Niklas Wikstrom - Dubravko Matijasevic - Darrin Stephens - Christian Beck - Oliver Borm - James Criner - Hua Shan - David Boner - Pierre-Olivier Dallaire - Norman Del Puppo - Dennis Kingsley - Frank Albina - Flavio Galeazzo - Hannes Kroger - Olivier Petit - David Schmidt - Andreas Feymark - Luca Mangani - Daniel Schmode - Christoph Goniva - Takuya Oshima - Juho Peltola - Eric Paterson - Fabian Peng Karrholm - Aleksandar Karac - Maria Garcia Camprubi - Chris Greenshields - Mark Olesen - Hilary Spencer - Andy Heather +* List of Contributors: See file ListOfContributors + # -*- mode: org; -*- # #+TITLE: *OpenFOAM README for version 1.6-ext* diff --git a/ReleaseNotes-foam-extend-3.0 b/ReleaseNotes-foam-extend-3.0 index d0ee9c512..8cb09cc28 100644 --- a/ReleaseNotes-foam-extend-3.0 +++ b/ReleaseNotes-foam-extend-3.0 @@ -280,57 +280,4 @@ Contents: models; bug fixes; documentation. The many ways of contributing and the contribution process are described in detail in the file "HowToContribute". -* List of Contributors - (If your name is missing in the list, please contact the maintainers at - and it will be added asap.) - Henry Weller - Hrvoje Jasak - Mattijs Janssens - Zeljko Tukovic - Bernhard Gschaider - Tommaso Lucchini - Martin Beaudoin - Sandeep Menon - Niklas Nordin - Eugene De Villiers - Henrik Rusche - Ivor Clifford - Philiposse Rajan - Gavin Tabor - Jovani Favero - Frank Bos - David Hill - Niklas Wikstrom - Dubravko Matijasevic - Darrin Stephens - Christian Beck - Oliver Borm - James Criner - Hua Shan - David Boner - Pierre-Olivier Dallaire - Norman Del Puppo - Dennis Kingsley - Frank Albina - Flavio Galeazzo - Hannes Kroger - Olivier Petit - David Schmidt - Andreas Feymark - Luca Mangani - Daniel Schmode - Christoph Goniva - Takuya Oshima - Juho Peltola - Eric Paterson - Fabian Peng Karrholm - Aleksandar Karac - Maria Garcia Camprubi - Chris Greenshields - Mark Olesen - Hilary Spencer - Andy Heather - Dominik Christ - Peter Janas - Niels Linnemann - Nikola Kornev +* List of Contributors: See file ListOfContributors From 8b468e2cbadd0f62422f13f8b71d06533d827e33 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 13 Jan 2014 11:59:18 +0000 Subject: [PATCH 005/197] Double call to write --- applications/solvers/combustion/reactingFoam/reactingFoam.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index f64d49fb5..a5229bae9 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -88,8 +88,6 @@ int main(int argc, char *argv[]) chemistry.dQ()().write(); } - runTime.write(); - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; From a2a43bb41ef545ef51b75695a0dc47cf5b39337c Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 16 Jan 2014 15:33:28 +0000 Subject: [PATCH 006/197] Formatting --- .../interfaceCompression.H | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/transportModels/interfaceProperties/interfaceCompression/interfaceCompression.H b/src/transportModels/interfaceProperties/interfaceCompression/interfaceCompression.H index 2c464c4a9..fae7bdaf0 100644 --- a/src/transportModels/interfaceProperties/interfaceCompression/interfaceCompression.H +++ b/src/transportModels/interfaceProperties/interfaceCompression/interfaceCompression.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interfaceCompressionWeight Declaration + Class interfaceCompressionLimiter Declaration \*---------------------------------------------------------------------------*/ class interfaceCompressionLimiter @@ -66,13 +66,23 @@ public: ) const { // Quadratic compression scheme - //return min(max(4*min(phiP*(1 - phiP), phiN*(1 - phiN)), 0), 1); + // return min(max(4*min(phiP*(1 - phiP), phiN*(1 - phiN)), 0), 1); // Quartic compression scheme return - min(max( - 1 - max(sqr(1 - 4*phiP*(1 - phiP)), sqr(1 - 4*phiN*(1 - phiN))), - 0), 1); + min + ( + max + ( + 1 - max + ( + sqr(1 - 4*phiP*(1 - phiP)), + sqr(1 - 4*phiN*(1 - phiN)) + ), + 0 + ), + 1 + ); } }; From 19f0ef5bf0444499699f9950f0e580f0d46db8e6 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 20 Jan 2014 11:47:35 +0000 Subject: [PATCH 007/197] Clean-up --- .../tractionBoundaryGradient.H | 2 +- ...dDisplacementZeroShearFvPatchVectorField.C | 58 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H index 11896df87..d638e8bd1 100644 --- a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H +++ b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H @@ -54,7 +54,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class tractionBoundaryGradient Declaration + Class tractionBoundaryGradient Declaration \*---------------------------------------------------------------------------*/ class tractionBoundaryGradient diff --git a/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C b/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C index f254d9418..a02015dfb 100644 --- a/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C @@ -133,32 +133,32 @@ timeVaryingFixedDisplacementZeroShearFvPatchVectorField << "non-orthogonal correction to be right" << endl; } - this->refGrad() = vector::zero; + this->refGrad() = vector::zero; - vectorField n = patch().nf(); - this->valueFraction() = sqr(n); + vectorField n = patch().nf(); + this->valueFraction() = sqr(n); - if (dict.found("value")) + if (dict.found("value")) { - Field::operator=(vectorField("value", dict, p.size())); + Field::operator=(vectorField("value", dict, p.size())); } - else + else { FatalError << "value entry not found for patch " << patch().name() << endl; } - //this->refValue() = *this; - this->refValue() = timeSeries_(this->db().time().timeOutputValue()); - Field normalValue = transform(valueFraction(), refValue()); + this->refValue() = timeSeries_(this->db().time().timeOutputValue()); - Field gradValue = - this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); + Field normalValue = transform(valueFraction(), refValue()); - Field transformGradValue = - transform(I - valueFraction(), gradValue); + Field gradValue = + this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); - Field::operator=(normalValue + transformGradValue); + Field transformGradValue = + transform(I - valueFraction(), gradValue); + + Field::operator=(normalValue + transformGradValue); } @@ -209,16 +209,17 @@ void timeVaryingFixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() // set refValue vectorField disp - ( - patch().size(), - timeSeries_(this->db().time().timeOutputValue()) - ); + ( + patch().size(), + timeSeries_(this->db().time().timeOutputValue()) + ); + if (fieldName_ == "DU") - { + { const fvPatchField& U = patch().lookupPatchField("U"); disp -= U; - } + } else if (fieldName_ != "U") { FatalError @@ -227,21 +228,20 @@ void timeVaryingFixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() } this->refValue() = disp; - // set value fraction to fix reference patch normal // only done at initialisation above //vectorField n = patch().nf(); //this->valueFraction() = sqr(n); refGrad() = tractionBoundaryGradient() - ( - vectorField(patch().size(), vector::zero), - scalarField(patch().size(), 0.0), - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + ( + vectorField(patch().size(), vector::zero), + scalarField(patch().size(), 0), + word(fieldName_), + patch(), + orthotropic_, + nonLinearGeometry::nonLinearNames_[nonLinear_] + ); directionMixedFvPatchVectorField::updateCoeffs(); } From 20c6d00c78b0d9f7881688940ef7eeffc2c6c651 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 20 Jan 2014 11:52:31 +0000 Subject: [PATCH 008/197] Tutorial update --- .../largeStrainCantileverBeam/Allclean | 1 + .../largeStrainCantileverBeam/Allrun | 1 + .../constant/polyMesh/boundary | 2 +- .../elasticNonLinTLSolidFoam/nonLinBlock/0/U | 47 +++++++++--------- .../nonLinBlock/Allclean | 1 + .../nonLinBlock/constant/polyMesh/boundary | 2 +- .../nonLinBlock/constant/timeVsDisp | 2 +- .../nonLinBlock/system/controlDict | 2 +- .../rotateSphereTL/Allclean | 3 +- .../rotateSphereTL/constant/polyMesh/boundary | 2 +- .../constant/polyMesh/zoneToPatchName.gz | Bin 337 -> 0 bytes 11 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/zoneToPatchName.gz diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allclean b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allclean index 5fb11ded5..a357dd88a 100755 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allclean +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allclean @@ -5,5 +5,6 @@ cleanTimeDirectories cleanCase +\rm -rf 0/polyMesh \rm -rf constant/polyMesh/sets constant/polyMesh/*Zones* \rm -rf VTK case.foam history \ No newline at end of file diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allrun b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allrun index 8051b956f..9f41551f4 100755 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allrun +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/Allrun @@ -7,3 +7,4 @@ application="elasticNonLinTLSolidFoam" runApplication blockMesh runApplication $application +runApplication deformedGeom 1 diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/polyMesh/boundary index 497a2fdaa..f25edb21b 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/largeStrainCantileverBeam/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/0/U b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/0/U index 95718284b..213db9b44 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/0/U +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/0/U @@ -22,37 +22,38 @@ internalField uniform (0 0 0); boundaryField { top - { - type timeVaryingFixedDisplacementZeroShear; - nonLinear totalLagrangian; - fileName "$FOAM_CASE/constant/timeVsDisp"; - outOfBounds clamp; - value uniform ( 0 0.1 0 ); - } + { + type timeVaryingFixedDisplacementZeroShear; + nonLinear totalLagrangian; + fileName "$FOAM_CASE/constant/timeVsDisp"; + outOfBounds clamp; + value uniform ( 0 0 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/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/Allclean b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/Allclean index 5fb11ded5..a357dd88a 100755 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/Allclean +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/Allclean @@ -5,5 +5,6 @@ cleanTimeDirectories cleanCase +\rm -rf 0/polyMesh \rm -rf constant/polyMesh/sets constant/polyMesh/*Zones* \rm -rf VTK case.foam history \ No newline at end of file diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/polyMesh/boundary index f96026d04..7c1acaf3c 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsDisp b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsDisp index 58f75cf36..71063d730 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsDisp +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/constant/timeVsDisp @@ -1,4 +1,4 @@ ( - ( 0 (0 0 0) ) + ( 0 (0 0 0) ) ( 64 (0 0.4 0)) ) \ No newline at end of file diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/system/controlDict b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/system/controlDict index 8b423cde7..84449dfca 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/system/controlDict +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/nonLinBlock/system/controlDict @@ -23,7 +23,7 @@ startTime 0; stopAt endTime; -endTime 50; +endTime 40; deltaT 1; diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/Allclean b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/Allclean index 5fb11ded5..effd9db7c 100755 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/Allclean +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/Allclean @@ -5,5 +5,6 @@ cleanTimeDirectories cleanCase -\rm -rf constant/polyMesh/sets constant/polyMesh/*Zones* +\rm -rf 0/polyMesh +\rm -rf constant/polyMesh/sets constant/polyMesh/*Zones* constant/polyMesh/zone* \rm -rf VTK case.foam history \ No newline at end of file diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/boundary index 627df0b92..7b4f792ac 100644 --- a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/zoneToPatchName.gz b/tutorials/solidMechanics/elasticNonLinTLSolidFoam/rotateSphereTL/constant/polyMesh/zoneToPatchName.gz deleted file mode 100644 index a5dc088ed3f3025c92c3fb2fae014c89384e200b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 337 zcmV-X0j~ZZiwFoVgQ!vf1A1?6WmIoaVRU0?PGN0j0IiWtPs1<_hVS_m)=to=%>)wG3BxgEhklD1B0#|z3|r)ZZ0Uqth!SN{1MX}qHw;pFmKtZ>Xe80QciY;n%m j89QR7e$rIwKkv3Q3n7smv)0$4)cE=YI%uNMt^)u70HC6D From fc219a24c2545b5faf7d16d8b7f2f53c6d3bb50a Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 21 Jan 2014 11:12:29 +0000 Subject: [PATCH 009/197] Protection on rho and phi not found --- .../pressureInletVelocityFvPatchVectorField.C | 46 +++++++++++++------ .../pressureInletVelocityFvPatchVectorField.H | 3 ++ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C index 1d7b6a2a3..55a3c9e54 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C @@ -28,14 +28,10 @@ License #include "volFields.H" #include "surfaceFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField +Foam::pressureInletVelocityFvPatchVectorField:: +pressureInletVelocityFvPatchVectorField ( const fvPatch& p, const DimensionedField& iF @@ -47,7 +43,8 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField {} -pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField +Foam::pressureInletVelocityFvPatchVectorField:: +pressureInletVelocityFvPatchVectorField ( const pressureInletVelocityFvPatchVectorField& ptf, const fvPatch& p, @@ -61,7 +58,8 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField {} -pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField +Foam::pressureInletVelocityFvPatchVectorField:: +pressureInletVelocityFvPatchVectorField ( const fvPatch& p, const DimensionedField& iF, @@ -76,7 +74,8 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField } -pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField +Foam::pressureInletVelocityFvPatchVectorField:: +pressureInletVelocityFvPatchVectorField ( const pressureInletVelocityFvPatchVectorField& pivpvf ) @@ -87,7 +86,7 @@ pressureInletVelocityFvPatchVectorField::pressureInletVelocityFvPatchVectorField {} -pressureInletVelocityFvPatchVectorField:: +Foam::pressureInletVelocityFvPatchVectorField:: pressureInletVelocityFvPatchVectorField ( const pressureInletVelocityFvPatchVectorField& pivpvf, @@ -102,13 +101,21 @@ pressureInletVelocityFvPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void pressureInletVelocityFvPatchVectorField::updateCoeffs() +void Foam::pressureInletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } + if (!this->db().objectRegistry::found(phiName_)) + { + // Flux not available, do not update + fixedValueFvPatchVectorField::updateCoeffs(); + + return; + } + const surfaceScalarField& phi = db().lookupObject(phiName_); @@ -124,6 +131,14 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { + if (!this->db().objectRegistry::found(rhoName_)) + { + // Rho not available, do not update + fixedValueFvPatchVectorField::updateCoeffs(); + + return; + } + const fvPatchField& rhop = lookupPatchField(rhoName_); @@ -143,7 +158,7 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs() } -void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const +void Foam::pressureInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); if (phiName_ != "phi") @@ -160,7 +175,7 @@ void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void pressureInletVelocityFvPatchVectorField::operator= +void Foam::pressureInletVelocityFvPatchVectorField::operator= ( const fvPatchField& pvf ) @@ -171,14 +186,15 @@ void pressureInletVelocityFvPatchVectorField::operator= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePatchTypeField ( fvPatchVectorField, pressureInletVelocityFvPatchVectorField ); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H index 07a3a311c..4e2212c7f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H @@ -56,7 +56,10 @@ class pressureInletVelocityFvPatchVectorField { // Private data + //- Name of the flux field word phiName_; + + //- Name of the density field word rhoName_; From 9aad8cbbbe8774ef4e90dea21cdcb33602c63514 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 21 Jan 2014 12:07:58 +0000 Subject: [PATCH 010/197] Formatting --- .../meshes/primitiveMesh/primitiveMeshEdges.C | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/foam/meshes/primitiveMesh/primitiveMeshEdges.C b/src/foam/meshes/primitiveMesh/primitiveMeshEdges.C index cc5e484e9..1ce5d6fd9 100644 --- a/src/foam/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/foam/meshes/primitiveMesh/primitiveMeshEdges.C @@ -66,6 +66,7 @@ Foam::label Foam::primitiveMesh::getEdge { es.append(edge(nextPointI, pointI)); } + return edgeI; } @@ -97,12 +98,12 @@ void Foam::primitiveMesh::calcEdges() const // HJ, 27/Aug/2010 // ALGORITHM: - // Go through the pointFace list. Go through the list of faces for that - // point and ask for edges. If the edge has got the point in question - // AND the second point in the edge is larger than the first, add the - // edge to the list. At the same time, add the edge label to the list - // of edges for the current face (faceEdges) and log the other face as - // the neighbour of this face. + // Go through the pointFace list. Go through the list of faces for + // that point and ask for edges. If the edge has got the point + // in question AND the second point in the edge is larger than + // the first, add the edge to the list. At the same time, + // add the edge label to the listof edges for the current face + // (faceEdges) and log the other face as the neighbour of this face. const faceList& f = faces(); @@ -217,7 +218,7 @@ void Foam::primitiveMesh::calcEdges() const } // All edges for the current point found. Before adding them to the - // list, it is necessary to sort them in the increasing order of the + // list, it is necessary to sort them in the increasing order of // neighbouring point. // Make real list out of SLList to simplify the manipulation. @@ -265,7 +266,10 @@ void Foam::primitiveMesh::calcEdges() const forAll (faceGivingNeighbour, i) { - fgn[reshuffleList[i]].transfer(faceGivingNeighbour[i].shrink()); + fgn[reshuffleList[i]].transfer + ( + faceGivingNeighbour[i].shrink() + ); } labelListList eofgn(edgeOfFaceGivingNeighbour.size()); @@ -300,7 +304,7 @@ void Foam::primitiveMesh::calcEdges() const } // Removed ordered edges: reverting to correct parallelisation -// of edge data. HJ, 17/Au/2010 +// of edge data. HJ, 17/Aug/2010 // void primitiveMesh::calcOrderedEdges() const From 09160d2f6acde8501d1eb966c73aafa8ee2d1b11 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 31 Jan 2014 21:32:21 +0000 Subject: [PATCH 011/197] Settings update --- .../icoDyMFoam/mixerGgi/constant/dynamicMeshDict | 3 ++- .../icoDyMFoam/mixerGgi/system/controlDict | 4 ++-- .../icoDyMFoam/mixerGgi/system/fvSolution | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tutorials/incompressible/icoDyMFoam/mixerGgi/constant/dynamicMeshDict b/tutorials/incompressible/icoDyMFoam/mixerGgi/constant/dynamicMeshDict index 8a3db17a0..bcd84d938 100644 --- a/tutorials/incompressible/icoDyMFoam/mixerGgi/constant/dynamicMeshDict +++ b/tutorials/incompressible/icoDyMFoam/mixerGgi/constant/dynamicMeshDict @@ -27,7 +27,8 @@ mixerGgiFvMeshCoeffs direction (1 0 0); } - rpm 60; + // Rotational speed in revolutions per minute + rpm 60; slider { diff --git a/tutorials/incompressible/icoDyMFoam/mixerGgi/system/controlDict b/tutorials/incompressible/icoDyMFoam/mixerGgi/system/controlDict index 0339bd7e6..527ebc5dc 100644 --- a/tutorials/incompressible/icoDyMFoam/mixerGgi/system/controlDict +++ b/tutorials/incompressible/icoDyMFoam/mixerGgi/system/controlDict @@ -22,7 +22,7 @@ startTime 0; stopAt endTime; -endTime 0.25; +endTime 1; deltaT 0.005; @@ -44,7 +44,7 @@ timePrecision 6; runTimeModifiable yes; -adjustTimeStep yes; +adjustTimeStep no; maxCo 0.5; diff --git a/tutorials/incompressible/icoDyMFoam/mixerGgi/system/fvSolution b/tutorials/incompressible/icoDyMFoam/mixerGgi/system/fvSolution index 77a6b4697..834920986 100644 --- a/tutorials/incompressible/icoDyMFoam/mixerGgi/system/fvSolution +++ b/tutorials/incompressible/icoDyMFoam/mixerGgi/system/fvSolution @@ -25,7 +25,7 @@ solvers maxIter 1000; tolerance 1e-02; relTol 0; - }; + } p { @@ -36,7 +36,7 @@ solvers maxIter 1000; tolerance 1e-07; relTol 0.0; - }; + } pFinal { @@ -47,7 +47,7 @@ solvers maxIter 1000; tolerance 1e-07; relTol 0; - }; + } U { @@ -58,13 +58,13 @@ solvers maxIter 1000; tolerance 1e-07; relTol 0; - }; + } } PISO { nCorrectors 4; - nNonOrthogonalCorrectors 1; + nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; } From 5572d00013afe4bcd78995680807539f4d513dbb Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 14:22:01 +0100 Subject: [PATCH 012/197] Fixes to scripts: - hg updates to the parent revision (for cases that use bookmarks instead of branches - recommended when interacting with git) - ccache now points to the "external" cache --- vagrantSandbox/initGeneralScript.sh | 8 +++++--- vagrantSandbox/skel/.bashrc | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 vagrantSandbox/skel/.bashrc diff --git a/vagrantSandbox/initGeneralScript.sh b/vagrantSandbox/initGeneralScript.sh index 646896d3e..93e2034ae 100755 --- a/vagrantSandbox/initGeneralScript.sh +++ b/vagrantSandbox/initGeneralScript.sh @@ -44,10 +44,12 @@ then echo echo "Parent is mercurial. Hello Bernhard" echo - branchName=`hg branch -R $OFParent` +# branchName=`hg branch -R $OFParent` + idName=`hg id -i -R $OFParent | sed -e "s/\+//"` + # sed removes + in case of a 'tainted' parent - echo "Parent is on branch $branchName" - su vagrant - -c "hg clone -u $branchName $OFParent $OFClone" + echo "Parent is on id $idName" + su vagrant - -c "hg clone -u $idName $OFParent $OFClone" echo else echo diff --git a/vagrantSandbox/skel/.bashrc b/vagrantSandbox/skel/.bashrc new file mode 100644 index 000000000..fd2c4a1bf --- /dev/null +++ b/vagrantSandbox/skel/.bashrc @@ -0,0 +1,10 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific aliases and functions + +export CCACHE_DIR=/vagrant/ccache4vm From 338173c01e34df08bd4d12a7969a4e44113897f5 Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 14:34:45 +0100 Subject: [PATCH 013/197] Add a CentOS 6 Box. Installs but compilation is untested --HG-- rename : vagrantSandbox/initUbunutuScript.sh => vagrantSandbox/initCentOSRHELScript.sh --- vagrantSandbox/Vagrantfile | 9 ++++++++ vagrantSandbox/initCentOSRHELScript.sh | 32 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 vagrantSandbox/initCentOSRHELScript.sh diff --git a/vagrantSandbox/Vagrantfile b/vagrantSandbox/Vagrantfile index e3be2edb7..b1ea907f5 100644 --- a/vagrantSandbox/Vagrantfile +++ b/vagrantSandbox/Vagrantfile @@ -39,4 +39,13 @@ Vagrant.configure("2") do |config| end end + config.vm.define :centos65 do |centos65| + centos65.vm.box = "centos65" + centos65.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" + centos65.vm.provision :shell do |s| + s.args = "centos65" + s.path = "initCentOSRHELScript.sh" + end + end + end diff --git a/vagrantSandbox/initCentOSRHELScript.sh b/vagrantSandbox/initCentOSRHELScript.sh new file mode 100755 index 000000000..08ccf9fc3 --- /dev/null +++ b/vagrantSandbox/initCentOSRHELScript.sh @@ -0,0 +1,32 @@ +#! /bin/bash + +boxName=$1 + +echo +echo "Init script for $boxName" +echo + +# some of these packages are already installed. But lets be sure + +neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build) +bonusPackages=(emacs csh tcsh zsh) + +for p in ${neededPackages[@]}; do + yum install -y $p +done + +for p in ${bonusPackages[@]}; do + yum install -y $p +done + +echo "Update mercurial to a more recent version" +rpm -Uhv http://pkgs.repoforge.org/mercurial/mercurial-2.2.2-1.el6.rfx.x86_64.rpm + +echo +echo "RHEL/CentOS-specific ended. Now doing general stuff" +echo + +/vagrant/initGeneralScript.sh + +echo +echo "Ended" From ad198e0854399014792ea1901f1ade5634c0518b Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 15:12:04 +0100 Subject: [PATCH 014/197] Fixes and a script to compile Foam in one go --HG-- extra : amend_source : 367e251b7df6b13cda03ddf956dbbfa9bec4b51d --- .gitignore | 3 +++ .hgignore | 3 +++ vagrantSandbox/README | 11 +++++++++-- vagrantSandbox/initCentOSRHELScript.sh | 2 +- vagrantSandbox/skel/.bashrc | 1 + vagrantSandbox/skel/bootstrapFoam.sh | 22 ++++++++++++++++++++++ 6 files changed, 39 insertions(+), 3 deletions(-) create mode 100755 vagrantSandbox/skel/bootstrapFoam.sh diff --git a/.gitignore b/.gitignore index 8f9f44c1c..2c91d7832 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,7 @@ src/lduSolvers/amg/amgPolicy/samgPolicy.H src/lduSolvers/amg/amgPolicy/aamgPolicy.C src/lduSolvers/amg/amgPolicy/aamgPolicy.H +# vagrant stuff +vagrantSandbox/.vagrant/ + # end-of-file diff --git a/.hgignore b/.hgignore index 922d0258d..8a5db6955 100644 --- a/.hgignore +++ b/.hgignore @@ -108,4 +108,7 @@ src/lduSolvers/amg/amgPolicy/samgPolicy.H src/lduSolvers/amg/amgPolicy/aamgPolicy.C src/lduSolvers/amg/amgPolicy/aamgPolicy.H +# vagrant stuff +vagrantSandbox/.vagrant/ + # end-of-file diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 37057362a..9393d8ffa 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -16,11 +16,11 @@ One can then connect to the virtual machine with : vagrant ssh and will be in the =$HOME= directory of the user =vagrant= where in - the directory =~/OpenFOAM/OpenFOAM-1.6-ext= the sources are + the directory =~/foam/foam-extend-3.0= the sources are available. Modifications can be pushed "outside" the virtual machine with : hg push - There is also a symbolic link =~/OpenFOAM/OpenFOAM-1.6-ext-parent= + There is also a symbolic link =~/foam/foam-extend-3.0-parent= to the sources if you want to edit there directly. Use with care and don't compile in that directory unless you know what you're doing @@ -32,3 +32,10 @@ =postfix=-package) - maverick :: Tries to fix the problems with the =lucid=-machine. Not yet working + - centos65 :: A CentOS 6.5 machine with preinstalled development + tools +* Scripts + In the home directory these scripts are found + - bootstrapFoam.sh :: A script whose aim it is to compile Foam and + the ThirdParty-packages in one go (no paraview and QT). If this + works the box is considered operational diff --git a/vagrantSandbox/initCentOSRHELScript.sh b/vagrantSandbox/initCentOSRHELScript.sh index 08ccf9fc3..11cf62072 100755 --- a/vagrantSandbox/initCentOSRHELScript.sh +++ b/vagrantSandbox/initCentOSRHELScript.sh @@ -8,7 +8,7 @@ echo # some of these packages are already installed. But lets be sure -neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build) +neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build wget zlib-devel) bonusPackages=(emacs csh tcsh zsh) for p in ${neededPackages[@]}; do diff --git a/vagrantSandbox/skel/.bashrc b/vagrantSandbox/skel/.bashrc index fd2c4a1bf..6aa500ab5 100644 --- a/vagrantSandbox/skel/.bashrc +++ b/vagrantSandbox/skel/.bashrc @@ -7,4 +7,5 @@ fi # User specific aliases and functions +export WM_SCHEDULER=ccache export CCACHE_DIR=/vagrant/ccache4vm diff --git a/vagrantSandbox/skel/bootstrapFoam.sh b/vagrantSandbox/skel/bootstrapFoam.sh new file mode 100755 index 000000000..c589bb4cc --- /dev/null +++ b/vagrantSandbox/skel/bootstrapFoam.sh @@ -0,0 +1,22 @@ +#! /bin/bash + +# Just to be sure +export WM_SCHEDULER=ccache +export CCACHE_DIR=/vagrant/ccache4vm + +cd foam/foam-extend-3.0 +source etc/bashrc + +( cd wmake/src && make ) +cd $WM_THIRD_PARTY_DIR + +./AllMake.stage0 +./AllMake.stage1 +./AllMake.stage2 +./AllMake.stage3 + +cd $WM_PROJECT_DIR +# pick up installed packages +source etc/bashrc + +./Allwmake From b96880ab6e7281aa28cbade604b2788a7dea3061 Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 16:34:06 +0100 Subject: [PATCH 015/197] FreeBSD and OpenSUSE-machines. Currently not working --HG-- rename : vagrantSandbox/initCentOSRHELScript.sh => vagrantSandbox/initFreeBSDScript.sh rename : vagrantSandbox/initCentOSRHELScript.sh => vagrantSandbox/initOpenSUSEScript.sh --- vagrantSandbox/README | 4 ++++ vagrantSandbox/Vagrantfile | 29 ++++++++++++++++++++++++++++ vagrantSandbox/initFreeBSDScript.sh | 16 +++++++++++++++ vagrantSandbox/initOpenSUSEScript.sh | 16 +++++++++++++++ 4 files changed, 65 insertions(+) create mode 100755 vagrantSandbox/initFreeBSDScript.sh create mode 100755 vagrantSandbox/initOpenSUSEScript.sh diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 9393d8ffa..ca36ba2ab 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -34,6 +34,10 @@ =lucid=-machine. Not yet working - centos65 :: A CentOS 6.5 machine with preinstalled development tools + - freebsd92 :: FreeBSD 9.2 32-bit machine. Untested + - freebsd10 :: FreeBSD 10.0 32-big machine. Currently does not boot + properly + - opensuse12 :: OpenSUSE 12.3 machine. Boots but is not provisioned * Scripts In the home directory these scripts are found - bootstrapFoam.sh :: A script whose aim it is to compile Foam and diff --git a/vagrantSandbox/Vagrantfile b/vagrantSandbox/Vagrantfile index b1ea907f5..e07baee3b 100644 --- a/vagrantSandbox/Vagrantfile +++ b/vagrantSandbox/Vagrantfile @@ -48,4 +48,33 @@ Vagrant.configure("2") do |config| end end + config.vm.define :freebsd92 do |freebsd92| + freebsd92.vm.box = "freebsd92" +# freebsd92.vm.box_url = "https://wunki.org/files/freebsd-9.2-amd64-wunki.box" + freebsd92.vm.box_url = "http://iris.hosting.lv/freebsd-9.2-i386.box" + freebsd92.vm.provision :shell do |s| + s.args = "freebsd92" + s.path = "initFreeBSDScript.sh" + end + end + + config.vm.define :freebsd10 do |freebsd10| + freebsd10.vm.box = "freebsd10" +# freebsd10.vm.box_url = "https://wunki.org/files/freebsd-10.0-amd64-wunki.box" + freebsd10.vm.box_url = "http://iris.hosting.lv/freebsd-10.0-i386.box" + freebsd10.vm.provision :shell do |s| + s.args = "freebsd10" + s.path = "initFreeBSDScript.sh" + end + end + + config.vm.define :opensuse12 do |opensuse12| + opensuse12.vm.box = "opensuse12" + opensuse12.vm.box_url = "http://sourceforge.net/projects/opensusevagrant/files/12.3/opensuse-12.3-64.box/download" + opensuse12.vm.provision :shell do |s| + s.args = "opensuse12" + s.path = "initOpenSUSEScript.sh" + end + end + end diff --git a/vagrantSandbox/initFreeBSDScript.sh b/vagrantSandbox/initFreeBSDScript.sh new file mode 100755 index 000000000..0dd703394 --- /dev/null +++ b/vagrantSandbox/initFreeBSDScript.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +boxName=$1 + +echo +echo "Init script for $boxName" +echo + +echo +echo "FreeBSD-specific ended. Now doing general stuff" +echo + +/vagrant/initGeneralScript.sh + +echo +echo "Ended" diff --git a/vagrantSandbox/initOpenSUSEScript.sh b/vagrantSandbox/initOpenSUSEScript.sh new file mode 100755 index 000000000..0dd703394 --- /dev/null +++ b/vagrantSandbox/initOpenSUSEScript.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +boxName=$1 + +echo +echo "Init script for $boxName" +echo + +echo +echo "FreeBSD-specific ended. Now doing general stuff" +echo + +/vagrant/initGeneralScript.sh + +echo +echo "Ended" From 79e0294181b9decb08adc59a44786bbdbdbe436e Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 10 Feb 2014 16:50:53 +0000 Subject: [PATCH 016/197] Clean run script --- tutorials/incompressible/icoDyMFoam/movingConeTopo/Allrun | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/incompressible/icoDyMFoam/movingConeTopo/Allrun b/tutorials/incompressible/icoDyMFoam/movingConeTopo/Allrun index b4df69472..72ef7bcb1 100755 --- a/tutorials/incompressible/icoDyMFoam/movingConeTopo/Allrun +++ b/tutorials/incompressible/icoDyMFoam/movingConeTopo/Allrun @@ -10,8 +10,8 @@ runApplication blockMesh runApplication setSet -batch setBatch cd constant/polyMesh/sets/ -\rm leftCentre leftCentre_old leftWallSet leftWallSet_old leftZone_old rightCentre rightCentre_old rightWallSet rightWallSet_old rightZone_old wallSet -\rm leftCentre.gz leftCentre_old.gz leftWallSet.gz leftWallSet_old.gz leftZone_old.gz rightCentre.gz rightCentre_old.gz rightWallSet.gz rightWallSet_old.gz rightZone_old.gz wallSet.gz +\rm -f leftCentre leftCentre_old leftWallSet leftWallSet_old leftZone_old rightCentre rightCentre_old rightWallSet rightWallSet_old rightZone_old wallSet +\rm -f leftCentre.gz leftCentre_old.gz leftWallSet.gz leftWallSet_old.gz leftZone_old.gz rightCentre.gz rightCentre_old.gz rightWallSet.gz rightWallSet_old.gz rightZone_old.gz wallSet.gz cd ../../.. runApplication setsToZones From 74c5ebe030aaae49328dd9a8dab3c795d6eca8db Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 18:03:40 +0100 Subject: [PATCH 017/197] Now OpenSUSE is provisioned. FreeBSD not working because it doesn't support shared folders in the virtual box --- vagrantSandbox/README | 7 +++++++ vagrantSandbox/initFreeBSDScript.sh | 13 +++++++++++++ vagrantSandbox/initGeneralScript.sh | 3 +++ vagrantSandbox/initOpenSUSEScript.sh | 18 +++++++++++++++++- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/vagrantSandbox/README b/vagrantSandbox/README index ca36ba2ab..4517f92b2 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -4,6 +4,11 @@ These virtual machines require - VirtualBox :: for running from [[https://www.virtualbox.org]] - Vagrant :: to automatically set them up from [[http://www.vagrantup.com]] + To make sure that for the boxes the have the newest + VirtualBox-additions do +: vagrant plugin install vagrant-vbguest + This installs a plugin that tries to update the guest addition if + they are for an older version of VirtualBox * Starting A virtual machine is set up with : vagrant up @@ -38,6 +43,8 @@ - freebsd10 :: FreeBSD 10.0 32-big machine. Currently does not boot properly - opensuse12 :: OpenSUSE 12.3 machine. Boots but is not provisioned + Some machines (read: the BSD-boxes) need the =VirtualBox Extension + Pack= installed (because they have USB 2.0) * Scripts In the home directory these scripts are found - bootstrapFoam.sh :: A script whose aim it is to compile Foam and diff --git a/vagrantSandbox/initFreeBSDScript.sh b/vagrantSandbox/initFreeBSDScript.sh index 0dd703394..48f738557 100755 --- a/vagrantSandbox/initFreeBSDScript.sh +++ b/vagrantSandbox/initFreeBSDScript.sh @@ -6,6 +6,19 @@ echo echo "Init script for $boxName" echo +pkg install -fy virtualbox-ose-additions + +neededPackages=(mercurial git flex bison ccache rpm wget) +bonusPackages=(emacs24 zsh) + +for p in ${neededPackages[@]}; do + pkg install -y $p +done + +for p in ${bonusPackages[@]}; do + pkg install -y $p +done + echo echo "FreeBSD-specific ended. Now doing general stuff" echo diff --git a/vagrantSandbox/initGeneralScript.sh b/vagrantSandbox/initGeneralScript.sh index 93e2034ae..672f49af0 100755 --- a/vagrantSandbox/initGeneralScript.sh +++ b/vagrantSandbox/initGeneralScript.sh @@ -20,6 +20,9 @@ OFDIR=/home/vagrant/foam/ mkdir -vp $OFDIR chown -R vagrant:vagrant $OFDIR +# for distros that don't have group vagrant +chown -R vagrant $OFDIR + OFClone=$OFDIR/foam-extend-3.0 OFReference=$OFClone-parent diff --git a/vagrantSandbox/initOpenSUSEScript.sh b/vagrantSandbox/initOpenSUSEScript.sh index 0dd703394..d4be5b834 100755 --- a/vagrantSandbox/initOpenSUSEScript.sh +++ b/vagrantSandbox/initOpenSUSEScript.sh @@ -6,8 +6,24 @@ echo echo "Init script for $boxName" echo +# Otherwise python/mercurial won't install +zypper -n remove patterns-openSUSE-minimal_base-conflicts + +# patterns-openSUSE-devel_python + +neededPackages=(gcc-c++ mercurial git flex bison make ccache zlib-devel rpm-build) +bonusPackages=(emacs csh tcsh zsh) + +for p in ${neededPackages[@]}; do + zypper -n install $p +done + +for p in ${bonusPackages[@]}; do + zypper -n install $p +done + echo -echo "FreeBSD-specific ended. Now doing general stuff" +echo "OpenSUSE-specific ended. Now doing general stuff" echo /vagrant/initGeneralScript.sh From 56e392ae55cebc97c21abf6b9e3f74a12f6072d6 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 10 Feb 2014 17:29:57 +0000 Subject: [PATCH 018/197] Efficiency on static meshes --- .../movingWallVelocityFvPatchVectorField.C | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index c5f6c128f..55d926c1c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -99,34 +99,42 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs() return; } - const fvPatch& p = patch(); - const polyPatch& pp = p.patch(); const fvMesh& mesh = dimensionedInternalField().mesh(); - const pointField& oldPoints = mesh.oldPoints(); - vectorField oldFc(pp.size()); - - forAll(oldFc, i) + if (mesh.changing()) { - oldFc[i] = pp[i].centre(oldPoints); + const fvPatch& p = patch(); + const polyPatch& pp = p.patch(); + const pointField& oldPoints = mesh.oldPoints(); + + vectorField oldFc(pp.size()); + + forAll(oldFc, i) + { + oldFc[i] = pp[i].centre(oldPoints); + } + + // Get wall-parallel mesh motion velocity from geometry + vectorField Up = + (pp.faceCentres() - oldFc)/mesh.time().deltaT().value(); + + const volVectorField& U = + mesh.lookupObject + ( + dimensionedInternalField().name() + ); + + scalarField phip = + p.patchField(fvc::meshPhi(U)); + + vectorField n = p.nf(); + const scalarField& magSf = p.magSf(); + scalarField Un = phip/(magSf + VSMALL); + + // Adjust for surface-normal mesh motion flux + vectorField::operator=(Up + n*(Un - (n & Up))); } - // Get wall-parallel mesh motion velocity from geometry - vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value(); - - const volVectorField& U = - mesh.lookupObject(dimensionedInternalField().name()); - - scalarField phip = - p.patchField(fvc::meshPhi(U)); - - vectorField n = p.nf(); - const scalarField& magSf = p.magSf(); - scalarField Un = phip/(magSf + VSMALL); - - // Adjust for surface-normal mesh motion flux - vectorField::operator=(Up + n*(Un - (n & Up))); - fixedValueFvPatchVectorField::updateCoeffs(); } From d3c8528c07c2657f047f9f1b1413ca036d566c7b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 10 Feb 2014 17:30:25 +0000 Subject: [PATCH 019/197] Disable layers around corners --- .../layerAdditionRemoval/setLayerPairing.C | 59 +++---------------- 1 file changed, 9 insertions(+), 50 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/setLayerPairing.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/setLayerPairing.C index 92e72ee04..09d9c896c 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/setLayerPairing.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/setLayerPairing.C @@ -144,58 +144,17 @@ bool Foam::layerAdditionRemoval::setLayerPairing() const else { // Point mapped from some other face. Check the label + // Layers wrapped around cells are not allowed. HJ, 10/Feb/2014 if (ptc[clp] != lidFace[pointI]) { - // We may be dealing with a layer that is wrapped around - // a cell. Check second point neighbours for common point. - // This is most probably not a general solution for - // arbitray polyhedra! - // HR, 1/May/2011 - - const label curPoint = faces[mf[faceI]][pointI]; - - const labelListList& ppAddr = mesh.pointPoints(); - - const labelList& p1List = ppAddr[lidFace[pointI]]; - const labelList& p2List = ppAddr[ptc[clp]]; - - bool found = false; - forAll (p1List, p1I) - { - const label p1 = p1List[p1I]; - - if (p1 != curPoint) - { - forAll (p2List, p2I) - { - label p2 = p2List[p2I]; - - if (p1 == p2) - { - ptc[clp] = p1; - found = true; - break; - } - } - } - - if (found) - { - break; - } - } - - if (!found) - { - nPointErrors++; -// Pout<< "Topological error in cell layer pairing. " -// << "This mesh is either topologically incorrect " -// << "or the master afce layer is not defined " -// << "consistently. Please check the " -// << "face zone flip map." << nl -// << "First index: " << ptc[clp] -// << " new index: " << lidFace[pointI] << endl; - } + nPointErrors++; +// Pout<< "Topological error in cell layer pairing. " +// << "This mesh is either topologically incorrect " +// << "or the master afce layer is not defined " +// << "consistently. Please check the " +// << "face zone flip map." << nl +// << "First index: " << ptc[clp] +// << " new index: " << lidFace[pointI] << endl; } } } From 8868132a9eb4f9517530dc75bc913afda3becadf Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Mon, 10 Feb 2014 18:51:15 +0100 Subject: [PATCH 020/197] Try to make FreeBSD work --- vagrantSandbox/README | 7 ++++--- vagrantSandbox/Vagrantfile | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 4517f92b2..de590c01e 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -39,9 +39,10 @@ =lucid=-machine. Not yet working - centos65 :: A CentOS 6.5 machine with preinstalled development tools - - freebsd92 :: FreeBSD 9.2 32-bit machine. Untested - - freebsd10 :: FreeBSD 10.0 32-big machine. Currently does not boot - properly + - freebsd92 :: FreeBSD 9.2 32-bit machine. Does not work because + FreeBSD does not support shared folders + - freebsd10 :: FreeBSD 10.0 32-big machine. Tries to set up shared + folders via NFS. Currently not working - opensuse12 :: OpenSUSE 12.3 machine. Boots but is not provisioned Some machines (read: the BSD-boxes) need the =VirtualBox Extension Pack= installed (because they have USB 2.0) diff --git a/vagrantSandbox/Vagrantfile b/vagrantSandbox/Vagrantfile index e07baee3b..081f8ab5b 100644 --- a/vagrantSandbox/Vagrantfile +++ b/vagrantSandbox/Vagrantfile @@ -66,6 +66,16 @@ Vagrant.configure("2") do |config| s.args = "freebsd10" s.path = "initFreeBSDScript.sh" end + freebsd10.vm.network :private_network, ip: "10.0.0.2" + + # configure the NICs + freebsd10.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--nictype1", "virtio"] + vb.customize ["modifyvm", :id, "--nictype2", "virtio"] + end + + # use NFS for the synced folder + freebsd10.vm.synced_folder "..", "/FOAM-sources", :nfs => true end config.vm.define :opensuse12 do |opensuse12| From 93062c01be569093de35b7fa8ebf71e7d883cb59 Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Tue, 11 Feb 2014 11:29:18 +0100 Subject: [PATCH 021/197] Forgot one library (without liberty nothing links) --- vagrantSandbox/README | 3 ++- vagrantSandbox/initCentOSRHELScript.sh | 2 +- vagrantSandbox/initOpenSUSEScript.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vagrantSandbox/README b/vagrantSandbox/README index de590c01e..29045362f 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -43,7 +43,8 @@ FreeBSD does not support shared folders - freebsd10 :: FreeBSD 10.0 32-big machine. Tries to set up shared folders via NFS. Currently not working - - opensuse12 :: OpenSUSE 12.3 machine. Boots but is not provisioned + - opensuse12 :: OpenSUSE 12.3 machine. Currently not completely + compiling Foam Some machines (read: the BSD-boxes) need the =VirtualBox Extension Pack= installed (because they have USB 2.0) * Scripts diff --git a/vagrantSandbox/initCentOSRHELScript.sh b/vagrantSandbox/initCentOSRHELScript.sh index 11cf62072..b96b1f71e 100755 --- a/vagrantSandbox/initCentOSRHELScript.sh +++ b/vagrantSandbox/initCentOSRHELScript.sh @@ -8,7 +8,7 @@ echo # some of these packages are already installed. But lets be sure -neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build wget zlib-devel) +neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build wget zlib-devel binutils-devel) bonusPackages=(emacs csh tcsh zsh) for p in ${neededPackages[@]}; do diff --git a/vagrantSandbox/initOpenSUSEScript.sh b/vagrantSandbox/initOpenSUSEScript.sh index d4be5b834..89d5fb7b8 100755 --- a/vagrantSandbox/initOpenSUSEScript.sh +++ b/vagrantSandbox/initOpenSUSEScript.sh @@ -11,7 +11,7 @@ zypper -n remove patterns-openSUSE-minimal_base-conflicts # patterns-openSUSE-devel_python -neededPackages=(gcc-c++ mercurial git flex bison make ccache zlib-devel rpm-build) +neededPackages=(gcc-c++ mercurial git flex bison make ccache zlib-devel rpm-build binutils-devel) bonusPackages=(emacs csh tcsh zsh) for p in ${neededPackages[@]}; do From a7d9a55024a09b04518e31f4b2e917df728a51cd Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Tue, 11 Feb 2014 14:01:59 +0100 Subject: [PATCH 022/197] Refactor the Ubuntu-script --- vagrantSandbox/README | 8 ++++++- vagrantSandbox/initUbunutuScript.sh | 33 +++++++++++------------------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 29045362f..41d8b0f16 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -47,8 +47,14 @@ compiling Foam Some machines (read: the BSD-boxes) need the =VirtualBox Extension Pack= installed (because they have USB 2.0) -* Scripts +* Scripts in the machine In the home directory these scripts are found - bootstrapFoam.sh :: A script whose aim it is to compile Foam and the ThirdParty-packages in one go (no paraview and QT). If this works the box is considered operational +* Provisioning scripts + Every "family" of machines has a specific script that makes sure + that the software packages necessary to compile =Foam= are installed + into the machine. In the end these scripts should call + =initGeneralScript.sh= which gets the sources into the machine. It + needs =git=, =mercurial= and =ccache= for that. diff --git a/vagrantSandbox/initUbunutuScript.sh b/vagrantSandbox/initUbunutuScript.sh index ea3de7bf2..d883e1df5 100755 --- a/vagrantSandbox/initUbunutuScript.sh +++ b/vagrantSandbox/initUbunutuScript.sh @@ -24,22 +24,16 @@ echo echo "Installing additional packages" echo -apt-get -y install mercurial -apt-get -y install bison -apt-get -y install flex -apt-get -y install g++ -apt-get -y install make -#apt-get -y install python-dev -apt-get -y install ccache -apt-get -y install cmake +neededPackages=(g++ bison flex mercurial git make ccache cmake rpm) +bonusPackages=(emacs csh tcsh zsh) -# test scripts with different shells -apt-get -y install csh -apt-get -y install tcsh -apt-get -y install zsh +for p in ${neededPackages[@]}; do + apt-get -y install $p +done -# to make the ThirdParty-Stuff work -apt-get -y install rpm +for p in ${bonusPackages[@]}; do + apt-get -y install $p +done # this is needed for the packaging stuff echo @@ -59,13 +53,10 @@ echo echo "Tools for packaging" echo -# Needed for packaging -apt-get -y install default-mta -apt-get -y install dpkg-dev -apt-get -y install debhelper devscripts cdbs - -# Not needed. Just to keep Bernhard happy -apt-get -y install emacs +packagingPackages=(default-mta dpkg-dev debhelper devscripts cdbs binutils-dev) +for p in ${packagingPackages[@]}; do + apt-get -y install $p +done echo echo "Ubuntu-specific ended. Now doing general stuff" From 6d5faa9dacb60fa4dc2635b9032f785de0cadbf3 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 12 Feb 2014 16:43:07 +0000 Subject: [PATCH 023/197] More template depth in instantiation --- wmake/rules/linux64Gcc45/c++ | 2 +- wmake/rules/linux64Gcc46/c++ | 2 +- wmake/rules/linuxGcc45/c++ | 2 +- wmake/rules/linuxGcc46/c++ | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wmake/rules/linux64Gcc45/c++ b/wmake/rules/linux64Gcc45/c++ index 72ba3bf12..605fc9253 100644 --- a/wmake/rules/linux64Gcc45/c++ +++ b/wmake/rules/linux64Gcc45/c++ @@ -6,7 +6,7 @@ CC = g++ -m64 include $(RULES)/c++$(WM_COMPILE_OPTION) -ptFLAGS = -DNoRepository -ftemplate-depth-40 +ptFLAGS = -DNoRepository -ftemplate-depth-200 c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC diff --git a/wmake/rules/linux64Gcc46/c++ b/wmake/rules/linux64Gcc46/c++ index 72ba3bf12..605fc9253 100644 --- a/wmake/rules/linux64Gcc46/c++ +++ b/wmake/rules/linux64Gcc46/c++ @@ -6,7 +6,7 @@ CC = g++ -m64 include $(RULES)/c++$(WM_COMPILE_OPTION) -ptFLAGS = -DNoRepository -ftemplate-depth-40 +ptFLAGS = -DNoRepository -ftemplate-depth-200 c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC diff --git a/wmake/rules/linuxGcc45/c++ b/wmake/rules/linuxGcc45/c++ index 2f19f3a34..fe5929adb 100644 --- a/wmake/rules/linuxGcc45/c++ +++ b/wmake/rules/linuxGcc45/c++ @@ -6,7 +6,7 @@ CC = g++ -m32 include $(RULES)/c++$(WM_COMPILE_OPTION) -ptFLAGS = -DNoRepository -ftemplate-depth-40 +ptFLAGS = -DNoRepository -ftemplate-depth-200 c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC diff --git a/wmake/rules/linuxGcc46/c++ b/wmake/rules/linuxGcc46/c++ index 2f19f3a34..fe5929adb 100644 --- a/wmake/rules/linuxGcc46/c++ +++ b/wmake/rules/linuxGcc46/c++ @@ -6,7 +6,7 @@ CC = g++ -m32 include $(RULES)/c++$(WM_COMPILE_OPTION) -ptFLAGS = -DNoRepository -ftemplate-depth-40 +ptFLAGS = -DNoRepository -ftemplate-depth-200 c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC From 350751972865707b6314b5d742a99b793522b9ca Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 12 Feb 2014 16:45:24 +0000 Subject: [PATCH 024/197] Added named ddt and d2dt2 --- src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C | 68 +++++++++++----- src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H | 26 +++++- src/finiteVolume/finiteVolume/fvm/fvmDdt.C | 83 +++++++++++++++----- src/finiteVolume/finiteVolume/fvm/fvmDdt.H | 31 ++++++++ 4 files changed, 170 insertions(+), 38 deletions(-) diff --git a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C index a4f8b5d97..e3399f468 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.C @@ -44,17 +44,63 @@ template tmp > d2dt2 ( - GeometricField& vf + GeometricField& vf, + const word& name ) { return fv::d2dt2Scheme::New ( vf.mesh(), - vf.mesh().schemesDict().d2dt2Scheme("d2dt2(" + vf.name() + ')') + vf.mesh().schemesDict().d2dt2Scheme(name) )().fvmD2dt2(vf); } +template +tmp > +d2dt2 +( + const dimensionedScalar& rho, + GeometricField& vf, + const word& name +) +{ + return fv::d2dt2Scheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().d2dt2Scheme(name) + )().fvmD2dt2(rho, vf); +} + + +template +tmp > +d2dt2 +( + const volScalarField& rho, + GeometricField& vf, + const word& name +) +{ + return fv::d2dt2Scheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().d2dt2Scheme(name) + )().fvmD2dt2(rho, vf); +} + + +template +tmp > +d2dt2 +( + GeometricField& vf +) +{ + return fvm::d2dt2(vf, "d2dt2(" + vf.name() + ')'); +} + + template tmp > d2dt2 @@ -63,14 +109,7 @@ d2dt2 GeometricField& vf ) { - return fv::d2dt2Scheme::New - ( - vf.mesh(), - vf.mesh().schemesDict().d2dt2Scheme - ( - "d2dt2(" + rho.name() + ',' + vf.name() + ')' - ) - )().fvmD2dt2(rho, vf); + return fvm::d2dt2(rho, vf, "d2dt2(" + rho.name() + ',' + vf.name() + ')'); } @@ -82,14 +121,7 @@ d2dt2 GeometricField& vf ) { - return fv::d2dt2Scheme::New - ( - vf.mesh(), - vf.mesh().schemesDict().d2dt2Scheme - ( - "d2dt2(" + rho.name() + ',' + vf.name() + ')' - ) - )().fvmD2dt2(rho, vf); + return fvm::d2dt2(rho, vf, "d2dt2(" + rho.name() + ',' + vf.name() + ')'); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H index 8424b741a..eb878c961 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmD2dt2.H @@ -53,7 +53,31 @@ namespace fvm tmp > d2dt2 ( const dimensionedScalar&, - GeometricField& + GeometricField&, + const word& name + ); + + template + tmp > d2dt2 + ( + GeometricField&, + const word& name + ); + + template + tmp > d2dt2 + ( + const volScalarField&, + GeometricField&, + const word& name + ); + + template + tmp > d2dt2 + ( + const dimensionedScalar&, + GeometricField&, + const word& name ); template diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C index 851e4b255..cb31fe64e 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C @@ -44,17 +44,76 @@ template tmp > ddt ( - GeometricField& vf + GeometricField& vf, + const word& name ) { return fv::ddtScheme::New ( vf.mesh(), - vf.mesh().schemesDict().ddtScheme("ddt(" + vf.name() + ')') + vf.mesh().schemesDict().ddtScheme(name) )().fvmDdt(vf); } +template +tmp > +ddt +( + const geometricOneField&, + GeometricField& vf, + const word& name +) +{ + return fvm::ddt(vf, name); +} + + +template +tmp > +ddt +( + const dimensionedScalar& rho, + GeometricField& vf, + const word& name +) +{ + return fv::ddtScheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().ddtScheme(name) + )().fvmDdt(rho, vf); +} + + +template +tmp > +ddt +( + const volScalarField& rho, + GeometricField& vf, + const word& name +) +{ + return fv::ddtScheme::New + ( + vf.mesh(), + vf.mesh().schemesDict().ddtScheme(name) + )().fvmDdt(rho, vf); +} + + +template +tmp > +ddt +( + GeometricField& vf +) +{ + return fvm::ddt(vf, "ddt(" + vf.name() + ')'); +} + + template tmp > ddt @@ -63,7 +122,7 @@ ddt GeometricField& vf ) { - return ddt(vf); + return fvm::ddt(vf); } @@ -75,14 +134,7 @@ ddt GeometricField& vf ) { - return fv::ddtScheme::New - ( - vf.mesh(), - vf.mesh().schemesDict().ddtScheme - ( - "ddt(" + rho.name() + ',' + vf.name() + ')' - ) - )().fvmDdt(rho, vf); + return fvm::ddt(rho, vf, "ddt(" + rho.name() + ',' + vf.name() + ')'); } @@ -94,14 +146,7 @@ ddt GeometricField& vf ) { - return fv::ddtScheme::New - ( - vf.mesh(), - vf.mesh().schemesDict().ddtScheme - ( - "ddt(" + rho.name() + ',' + vf.name() + ')' - ) - )().fvmDdt(rho, vf); + return fvm::ddt(rho, vf, "ddt(" + rho.name() + ',' + vf.name() + ')'); } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H index b31c9f743..5024d8d68 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H @@ -50,6 +50,37 @@ namespace Foam namespace fvm { + template + tmp > ddt + ( + GeometricField&, + const word& name + ); + + template + tmp > ddt + ( + const geometricOneField&, + GeometricField&, + const word& name + ); + + template + tmp > ddt + ( + const dimensionedScalar&, + GeometricField&, + const word& name + ); + + template + tmp > ddt + ( + const volScalarField&, + GeometricField&, + const word& name + ); + template tmp > ddt ( From 56c2232abb4f1535df69392b63c98464ae7f1a6d Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 13 Feb 2014 11:36:25 +0000 Subject: [PATCH 025/197] Removed low-Re k-omega SST: not needed --- .../compressible/RAS/Make/files | 1 - .../checkkOmega_LowRePatchFieldTypes.H | 19 - .../RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C | 489 ------------------ .../RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H | 294 ----------- .../RAS/kOmegaSST_LowRe/kOmega_LowReI.H | 115 ---- .../RAS/kOmegaSST_LowRe/wallOmega_LowReI.H | 50 -- .../incompressible/RAS/Make/files | 1 - .../checkkOmega_LowRePatchFieldTypes.H | 19 - .../RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C | 431 --------------- .../RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H | 295 ----------- .../RAS/kOmegaSST_LowRe/kOmega_LowReI.H | 113 ---- .../RAS/kOmegaSST_LowRe/wallOmega_LowReI.H | 50 -- 12 files changed, 1877 deletions(-) delete mode 100644 src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H delete mode 100644 src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C delete mode 100644 src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H delete mode 100644 src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H delete mode 100644 src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H delete mode 100644 src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H delete mode 100644 src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C delete mode 100644 src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H delete mode 100644 src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H delete mode 100644 src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H diff --git a/src/turbulenceModels/compressible/RAS/Make/files b/src/turbulenceModels/compressible/RAS/Make/files index 499d38041..4e034aed4 100644 --- a/src/turbulenceModels/compressible/RAS/Make/files +++ b/src/turbulenceModels/compressible/RAS/Make/files @@ -9,7 +9,6 @@ LaunderGibsonRSTM/LaunderGibsonRSTM.C realizableKE/realizableKE.C SpalartAllmaras/SpalartAllmaras.C kOmegaSST/kOmegaSST.C -kOmegaSST_LowRe/kOmegaSST_LowRe.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H b/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H deleted file mode 100644 index 74e5035f3..000000000 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H +++ /dev/null @@ -1,19 +0,0 @@ -if (!isType(k_.boundaryField()[patchi])) -{ - FatalErrorIn("wall-function evaluation") - << k_.boundaryField()[patchi].type() - << " is the wrong k patchField type on patch " - << curPatch.name() << nl - << " should be zeroGradient" - << exit(FatalError); -} - -if (!isType(omega_.boundaryField()[patchi])) -{ - FatalErrorIn("wall-function evaluation") - << omega_.boundaryField()[patchi].type() - << " is the wrong omega patchField type on patch " - << curPatch.name() << nl - << " should be zeroGradient" - << exit(FatalError); -} diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C b/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C deleted file mode 100644 index 721be4d3b..000000000 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C +++ /dev/null @@ -1,489 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "kOmegaSST_LowRe.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -#include "backwardsCompatibilityWallFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(kOmegaSST_LowRe, 0); -addToRunTimeSelectionTable(RASModel, kOmegaSST_LowRe, dictionary); - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -tmp kOmegaSST_LowRe::F1(const volScalarField& CDkOmega) const -{ - volScalarField CDkOmegaPlus = max - ( - CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) - ); - - volScalarField arg1 = min - ( - min - ( - max - ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*(mu()/rho_)/(sqr(y_)*omega_) - ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) - ), - scalar(10) - ); - - return tanh(pow4(arg1)); -} - -tmp kOmegaSST_LowRe::F2() const -{ - volScalarField arg2 = min - ( - max - ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*(mu()/rho_)/(sqr(y_)*omega_) - ), - scalar(100) - ); - - return tanh(sqr(arg2)); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -kOmegaSST_LowRe::kOmegaSST_LowRe -( - const volScalarField& rho, - const volVectorField& U, - const surfaceScalarField& phi, - const basicThermo& thermophysicalModel -) -: - RASModel(typeName, rho, U, phi, thermophysicalModel), - - alphaK1_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaK1", - coeffDict_, - 0.85034 - ) - ), - alphaK2_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaK2", - coeffDict_, - 1.0 - ) - ), - alphaOmega1_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaOmega1", - coeffDict_, - 0.5 - ) - ), - alphaOmega2_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaOmega2", - coeffDict_, - 0.85616 - ) - ), - Prt_ - ( - dimensioned::lookupOrAddToDict - ( - "Prt", - coeffDict_, - 1.0 - ) - ), - gamma1_ - ( - dimensioned::lookupOrAddToDict - ( - "gamma1", - coeffDict_, - 0.5532 - ) - ), - gamma2_ - ( - dimensioned::lookupOrAddToDict - ( - "gamma2", - coeffDict_, - 0.4403 - ) - ), - beta1_ - ( - dimensioned::lookupOrAddToDict - ( - "beta1", - coeffDict_, - 0.075 - ) - ), - beta2_ - ( - dimensioned::lookupOrAddToDict - ( - "beta2", - coeffDict_, - 0.0828 - ) - ), - betaStar_ - ( - dimensioned::lookupOrAddToDict - ( - "betaStar", - coeffDict_, - 0.09 - ) - ), - a1_ - ( - dimensioned::lookupOrAddToDict - ( - "a1", - coeffDict_, - 0.31 - ) - ), - c1_ - ( - dimensioned::lookupOrAddToDict - ( - "c1", - coeffDict_, - 10.0 - ) - ), - Cmu_ - ( - dimensioned::lookupOrAddToDict - ( - "Cmu", - coeffDict_, - 0.09 - ) - ), - kappa_ - ( - dimensioned::lookupOrAddToDict - ( - "kappa", - coeffDict_, - 0.41 - ) - ), - - y_(mesh_), - - k_ - ( - IOobject - ( - "k", - runTime_.timeName(), - U_.db(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ), - - omega_ - ( - IOobject - ( - "omega", - runTime_.timeName(), - U_.db(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ), - - mut_ - ( - IOobject - ( - "mut", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_))))) - ), - alphat_ - ( - IOobject - ( - "alphat", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateAlphat("alphat", mesh_) - ) -{ - bound(omega_, omega0_); - - mut_ = - ( - a1_*rho_*k_/ - max - ( - a1_*omega_, - F2()*sqrt(2*magSqr(symm(fvc::grad(U_)))) - ) - ); - mut_.correctBoundaryConditions(); - - alphat_ = mut_/Prt_; - alphat_.correctBoundaryConditions(); - - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp kOmegaSST_LowRe::R() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "R", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - ((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))), - k_.boundaryField().types() - ) - ); -} - - -tmp kOmegaSST_LowRe::devRhoReff() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "devRhoReff", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -muEff()*dev(twoSymm(fvc::grad(U_))) - ) - ); -} - - -tmp kOmegaSST_LowRe::divDevRhoReff(volVectorField& U) const -{ - return - ( - - fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T())) - ); -} - - -bool kOmegaSST_LowRe::read() -{ - if (RASModel::read()) - { - alphaK1_.readIfPresent(coeffDict()); - alphaK2_.readIfPresent(coeffDict()); - alphaOmega1_.readIfPresent(coeffDict()); - alphaOmega2_.readIfPresent(coeffDict()); - Prt_.readIfPresent(coeffDict()); - gamma1_.readIfPresent(coeffDict()); - gamma2_.readIfPresent(coeffDict()); - beta1_.readIfPresent(coeffDict()); - beta2_.readIfPresent(coeffDict()); - betaStar_.readIfPresent(coeffDict()); - a1_.readIfPresent(coeffDict()); - c1_.readIfPresent(coeffDict()); - - return true; - } - else - { - return false; - } -} - - -void kOmegaSST_LowRe::correct() -{ - // Bound in case of topological change - // HJ, 22/Aug/2007 - if (mesh_.changing()) - { - bound(k_, k0_); - bound(omega_, omega0_); - } - - if (!turbulence_) - { - // Re-calculate viscosity - mut_ = - a1_*rho_*k_ - /max(a1_*omega_, F2()*sqrt(2*magSqr(symm(fvc::grad(U_))))); - mut_.correctBoundaryConditions(); - - // Re-calculate thermal diffusivity - alphat_ = mut_/Prt_; - alphat_.correctBoundaryConditions(); - - return; - } - - RASModel::correct(); - - volScalarField divU = fvc::div(phi_/fvc::interpolate(rho_)); - - if (mesh_.changing()) - { - y_.correct(); - } - - if (mesh_.moving()) - { - divU += fvc::div(mesh_.phi()); - } - - tmp tgradU = fvc::grad(U_); - volScalarField S2 = magSqr(symm(tgradU())); - volScalarField GbyMu = (tgradU() && dev(twoSymm(tgradU()))); - volScalarField G("RASModel::G", mut_*GbyMu); - tgradU.clear(); - -# include "kOmega_LowReI.H" - - volScalarField CDkOmega = - (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_; - - volScalarField F1 = this->F1(CDkOmega); - volScalarField rhoGammaF1 = rho_*gamma(F1); - - // Turbulent frequency equation - tmp omegaEqn - ( - fvm::ddt(rho_, omega_) - + fvm::div(phi_, omega_) - - fvm::laplacian(DomegaEff(F1), omega_) - == - rhoGammaF1*GbyMu - - fvm::SuSp((2.0/3.0)*rhoGammaF1*divU, omega_) - - fvm::Sp(rho_*beta(F1)*omega_, omega_) - - fvm::SuSp - ( - rho_*(F1 - scalar(1))*CDkOmega/omega_, - omega_ - ) - ); - - omegaEqn().relax(); - -# include "wallOmega_LowReI.H" - - solve(omegaEqn); - bound(omega_, omega0_); - - // Turbulent kinetic energy equation - tmp kEqn - ( - fvm::ddt(rho_, k_) - + fvm::div(phi_, k_) - - fvm::laplacian(DkEff(F1), k_) - == - min(G, (c1_*betaStar_)*rho_*k_*omega_) - - fvm::SuSp(2.0/3.0*rho_*divU, k_) - - fvm::Sp(rho_*betaStar_*omega_, k_) - ); - - kEqn().relax(); - solve(kEqn); - bound(k_, k0_); - - - // Re-calculate viscosity - mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(2*S2)); - mut_.correctBoundaryConditions(); - - // Re-calculate thermal diffusivity - alphat_ = mut_/Prt_; - alphat_.correctBoundaryConditions(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H b/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H deleted file mode 100644 index c8d99ee20..000000000 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H +++ /dev/null @@ -1,294 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Class - Foam::compressible::RASModels::kOmegaSST_LowRe - -Description - Implementation of the k-omega-SST turbulence model for compressible flows - with low-Re near-wall treatment. - - Turbulence model described in: - @verbatim - AlAA 93-2906 - Zonal Two Equation k-cl, Turbulence Models for Aerodynamic Flows. - Florian R. Menter - @endverbatim - - Note that this implementation is written in terms of alpha diffusion - coefficients rather than the more traditional sigma (alpha = 1/sigma) so - that the blending can be applied to all coefficuients in a consistent - manner. The paper suggests that sigma is blended but this would not be - consistent with the blending of the k-epsilon and k-omega models. - - Also note that the error in the last term of equation (2) relating to - sigma has been corrected. - - Wall-functions are applied in this implementation by using equations (14) - to specify the near-wall omega as appropriate. - - The blending functions (15) and (16) are not currently used because of the - uncertainty in their origin, range of applicability and that is y+ becomes - sufficiently small blending u_tau in this manner clearly becomes nonsense. - - The default model coefficients correspond to the following: - @verbatim - kOmegaSST_LowRe - { - alphaK1 0.85034; - alphaK2 1.0; - alphaOmega1 0.5; - alphaOmega2 0.85616; - Prt 1.0; // only for compressible - beta1 0.075; - beta2 0.0828; - betaStar 0.09; - gamma1 0.5532; - gamma2 0.4403; - a1 0.31; - c1 10.0; - } - @endverbatim - -SourceFiles - kOmegaSST_LowRe.C - kOmegaWallFunctionsI.H - kOmegaWallViscosityI.H - wallOmegaI.H - -\*---------------------------------------------------------------------------*/ - -#ifndef compressiblekOmegaSST_LowRe_H -#define compressiblekOmegaSST_LowRe_H - -#include "RASModel.H" -#include "wallDist.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class kOmegaSST_LowRe Declaration -\*---------------------------------------------------------------------------*/ - -class kOmegaSST_LowRe -: - public RASModel -{ - // Private data - - // Model coefficients - - dimensionedScalar alphaK1_; - dimensionedScalar alphaK2_; - - dimensionedScalar alphaOmega1_; - dimensionedScalar alphaOmega2_; - - dimensionedScalar Prt_; - - dimensionedScalar gamma1_; - dimensionedScalar gamma2_; - - dimensionedScalar beta1_; - dimensionedScalar beta2_; - - dimensionedScalar betaStar_; - - dimensionedScalar a1_; - dimensionedScalar c1_; - - dimensionedScalar Cmu_; - dimensionedScalar kappa_; - - - //- Wall distance - // Note: different to wall distance in parent RASModel - wallDist y_; - - // Fields - - volScalarField k_; - volScalarField omega_; - volScalarField mut_; - volScalarField alphat_; - - - // Private member functions - - tmp F1(const volScalarField& CDkOmega) const; - tmp F2() const; - - tmp blend - ( - const volScalarField& F1, - const dimensionedScalar& psi1, - const dimensionedScalar& psi2 - ) const - { - return F1*(psi1 - psi2) + psi2; - } - - tmp alphaK(const volScalarField& F1) const - { - return blend(F1, alphaK1_, alphaK2_); - } - - tmp alphaOmega(const volScalarField& F1) const - { - return blend(F1, alphaOmega1_, alphaOmega2_); - } - - tmp beta(const volScalarField& F1) const - { - return blend(F1, beta1_, beta2_); - } - - tmp gamma(const volScalarField& F1) const - { - return blend(F1, gamma1_, gamma2_); - } - - -public: - - //- Runtime type information - TypeName("kOmegaSST_LowRe"); - - - // Constructors - - //- Construct from components - kOmegaSST_LowRe - ( - const volScalarField& rho, - const volVectorField& U, - const surfaceScalarField& phi, - const basicThermo& thermophysicalModel - ); - - - //- Destructor - - virtual ~kOmegaSST_LowRe() - {} - - - // Member Functions - - //- Return the effective diffusivity for k - tmp DkEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DkEff", alphaK(F1)*mut_ + mu()) - ); - } - - //- Return the effective diffusivity for omega - tmp DomegaEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DomegaEff", alphaOmega(F1)*mut_ + mu()) - ); - } - - virtual tmp mut() const - { - return mut_; - } - - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); - } - - //- Return the turbulence kinetic energy - virtual tmp k() const - { - return k_; - } - - virtual tmp omega() const - { - return omega_; - } - - //- Return the turbulence kinetic energy dissipation rate - virtual tmp epsilon() const - { - return tmp - ( - new volScalarField - ( - IOobject - ( - "epsilon", - mesh_.time().timeName(), - mesh_ - ), - betaStar_*k_*omega_, - omega_.boundaryField().types() - ) - ); - } - - //- Return the Reynolds stress tensor - virtual tmp R() const; - - //- Return the effective stress tensor including the laminar stress - virtual tmp devRhoReff() const; - - //- Return the source term for the momentum equation - virtual tmp divDevRhoReff(volVectorField& U) const; - - //- Solve the turbulence equations and correct the turbulence viscosity - virtual void correct(); - - //- Read RASProperties dictionary - virtual bool read(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H b/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H deleted file mode 100644 index bd3687629..000000000 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Global - kOmegaWallFunctions - -Description - Calculate wall generation and frequency omega from wall-functions. - -\*---------------------------------------------------------------------------*/ - -{ - labelList cellBoundaryFaceCount(omega_.size(), 0); - - scalar Cmu25 = pow(Cmu_.value(), 0.25); - - const fvPatchList& patches = mesh_.boundary(); - - //- Initialise the near-wall omega and G fields to zero - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - omega_[faceCelli] = 0.0; - G[faceCelli] = 0.0; - } - } - } - - //- Accumulate the wall face contributions to omega and G - // Increment cellBoundaryFaceCount for each face for averaging - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { -# include "checkkOmega_LowRePatchFieldTypes.H" - -// const scalarField& rhow = rho_.boundaryField()[patchi]; - - const scalarField& muw = mu().boundaryField()[patchi]; - const scalarField& mutw = mut_.boundaryField()[patchi]; - - scalarField magFaceGradU = - mag(U_.boundaryField()[patchi].snGrad()); - - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - // For corner cells (with two boundary or more faces), - // omega and G in the near-wall cell are calculated - // as an average - - cellBoundaryFaceCount[faceCelli]++; - - omega_[faceCelli] += scalar(6)*muw[facei]/ - (beta1_.value()*sqr(y_[faceCelli])); - - G[faceCelli] += - (mutw[facei] + muw[facei])*magFaceGradU[facei] - *Cmu25*sqrt(k_[faceCelli])/(kappa_.value()*y_[faceCelli]); - } - } - } - - - // Perform the averaging - - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - omega_[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - } - } - } -} - - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H b/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H deleted file mode 100644 index 265c0e480..000000000 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Global - wallOmega - -Description - Set wall dissipation in the omega matrix - -\*---------------------------------------------------------------------------*/ - -{ - const fvPatchList& patches = mesh_.boundary(); - - forAll(patches, patchi) - { - const fvPatch& p = patches[patchi]; - - if (p.isWall()) - { - omegaEqn().setValues - ( - p.faceCells(), - omega_.boundaryField()[patchi].patchInternalField() - ); - } - } -} - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index 230ca1f68..51a3bbfa1 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -17,7 +17,6 @@ LienCubicKELowRe/LienCubicKELowRe.C NonlinearKEShih/NonlinearKEShih.C LienLeschzinerLowRe/LienLeschzinerLowRe.C LamBremhorstKE/LamBremhorstKE.C -kOmegaSST_LowRe/kOmegaSST_LowRe.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H b/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H deleted file mode 100644 index 025c06bb9..000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/checkkOmega_LowRePatchFieldTypes.H +++ /dev/null @@ -1,19 +0,0 @@ -if (!isType(k_.boundaryField()[patchi])) -{ - FatalErrorIn("wall-function evaluation") - << k_.boundaryField()[patchi].type() - << " is the wrong k patchField type for wall-functions on patch " - << curPatch.name() << nl - << " should be zeroGradient" - << exit(FatalError); -} - -if (!isType(omega_.boundaryField()[patchi])) -{ - FatalErrorIn("wall-function evaluation") - << omega_.boundaryField()[patchi].type() - << " is the wrong omega patchField type for wall-functions on patch " - << curPatch.name() << nl - << " should be zeroGradient" - << exit(FatalError); -} diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C b/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C deleted file mode 100644 index b014b2479..000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.C +++ /dev/null @@ -1,431 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "kOmegaSST_LowRe.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -#include "backwardsCompatibilityWallFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(kOmegaSST_LowRe, 0); -addToRunTimeSelectionTable(RASModel, kOmegaSST_LowRe, dictionary); - - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -tmp kOmegaSST_LowRe::F1(const volScalarField& CDkOmega) const -{ - volScalarField CDkOmegaPlus = max - ( - CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) - ); - - volScalarField arg1 = min - ( - min - ( - max - ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) - ), - scalar(10) - ); - - return tanh(pow4(arg1)); -} - - -tmp kOmegaSST_LowRe::F2() const -{ - volScalarField arg2 = min - ( - max - ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - scalar(100) - ); - - return tanh(sqr(arg2)); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -kOmegaSST_LowRe::kOmegaSST_LowRe -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& lamTransportModel -) -: - RASModel(typeName, U, phi, lamTransportModel), - - alphaK1_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaK1", - coeffDict_, - 0.85034 - ) - ), - alphaK2_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaK2", - coeffDict_, - 1.0 - ) - ), - alphaOmega1_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaOmega1", - coeffDict_, - 0.5 - ) - ), - alphaOmega2_ - ( - dimensioned::lookupOrAddToDict - ( - "alphaOmega2", - coeffDict_, - 0.85616 - ) - ), - gamma1_ - ( - dimensioned::lookupOrAddToDict - ( - "gamma1", - coeffDict_, - 0.5532 - ) - ), - gamma2_ - ( - dimensioned::lookupOrAddToDict - ( - "gamma2", - coeffDict_, - 0.4403 - ) - ), - beta1_ - ( - dimensioned::lookupOrAddToDict - ( - "beta1", - coeffDict_, - 0.075 - ) - ), - beta2_ - ( - dimensioned::lookupOrAddToDict - ( - "beta2", - coeffDict_, - 0.0828 - ) - ), - betaStar_ - ( - dimensioned::lookupOrAddToDict - ( - "betaStar", - coeffDict_, - 0.09 - ) - ), - a1_ - ( - dimensioned::lookupOrAddToDict - ( - "a1", - coeffDict_, - 0.31 - ) - ), - c1_ - ( - dimensioned::lookupOrAddToDict - ( - "c1", - coeffDict_, - 10.0 - ) - ), - Cmu_ - ( - dimensioned::lookupOrAddToDict - ( - "Cmu", - coeffDict_, - 0.09 - ) - ), - kappa_ - ( - dimensioned::lookupOrAddToDict - ( - "kappa", - coeffDict_, - 0.41 - ) - ), - - y_(mesh_), - - k_ - ( - IOobject - ( - "k", - runTime_.timeName(), - U_.db(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ), - - omega_ - ( - IOobject - ( - "omega", - runTime_.timeName(), - U_.db(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ), - nut_ - ( - IOobject - ( - "nut", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - a1_*k_/max(a1_*(omega_ + omegaSmall_), F2()*mag(symm(fvc::grad(U_)))) - ) -{ - bound(omega_, omega0_); - - nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(2.0)*mag(symm(fvc::grad(U_)))); - nut_.correctBoundaryConditions(); - - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp kOmegaSST_LowRe::R() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "R", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), - k_.boundaryField().types() - ) - ); -} - - -tmp kOmegaSST_LowRe::devReff() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "devRhoReff", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -nuEff()*dev(twoSymm(fvc::grad(U_))) - ) - ); -} - - -tmp kOmegaSST_LowRe::divDevReff(volVectorField& U) const -{ - return - ( - - fvm::laplacian(nuEff(), U) - - fvc::div(nuEff()*dev(fvc::grad(U)().T())) - ); -} - - -bool kOmegaSST_LowRe::read() -{ - if (RASModel::read()) - { - alphaK1_.readIfPresent(coeffDict()); - alphaK2_.readIfPresent(coeffDict()); - alphaOmega1_.readIfPresent(coeffDict()); - alphaOmega2_.readIfPresent(coeffDict()); - gamma1_.readIfPresent(coeffDict()); - gamma2_.readIfPresent(coeffDict()); - beta1_.readIfPresent(coeffDict()); - beta2_.readIfPresent(coeffDict()); - betaStar_.readIfPresent(coeffDict()); - a1_.readIfPresent(coeffDict()); - c1_.readIfPresent(coeffDict()); - - return true; - } - else - { - return false; - } -} - - -void kOmegaSST_LowRe::correct() -{ - // Bound in case of topological change - // HJ, 22/Aug/2007 - if (mesh_.changing()) - { - bound(k_, k0_); - bound(omega_, omega0_); - } - - RASModel::correct(); - - if (!turbulence_) - { - return; - } - - if (mesh_.changing()) - { - y_.correct(); - } - - volScalarField S2 = magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel::G", nut_*2*S2); - -# include "kOmega_LowReI.H" - - volScalarField CDkOmega = - (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_; - - volScalarField F1 = this->F1(CDkOmega); - - // Turbulent frequency equation - tmp omegaEqn - ( - fvm::ddt(omega_) - + fvm::div(phi_, omega_) - + fvm::SuSp(-fvc::div(phi_), omega_) - - fvm::laplacian(DomegaEff(F1), omega_) - == - gamma(F1)*2*S2 - - fvm::Sp(beta(F1)*omega_, omega_) - - fvm::SuSp - ( - (F1 - scalar(1))*CDkOmega/omega_, - omega_ - ) - ); - - omegaEqn().relax(); - -# include "wallOmega_LowReI.H" - - solve(omegaEqn); - bound(omega_, omega0_); - - // Turbulent kinetic energy equation - tmp kEqn - ( - fvm::ddt(k_) - + fvm::div(phi_, k_) - + fvm::SuSp(-fvc::div(phi_), k_) - - fvm::laplacian(DkEff(F1), k_) - == - min(G, c1_*betaStar_*k_*omega_) - - fvm::Sp(betaStar_*omega_, k_) - ); - - kEqn().relax(); - solve(kEqn); - bound(k_, k0_); - - - // Re-calculate viscosity - nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(2*S2)); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H b/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H deleted file mode 100644 index 0f382e0ee..000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmegaSST_LowRe.H +++ /dev/null @@ -1,295 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Class - Foam::incompressible::RASModels::kOmegaSST_LowRe - -Description - Implementation of the k-omega-SST turbulence model for incompressible - flows. - - Turbulence model described in: - @verbatim - Menter, F., Esch, T. - "Elements of Industrial Heat Transfer Prediction" - 16th Brazilian Congress of Mechanical Engineering (COBEM), - Nov. 2001 - @endverbatim - - Note that this implementation is written in terms of alpha diffusion - coefficients rather than the more traditional sigma (alpha = 1/sigma) so - that the blending can be applied to all coefficuients in a consistent - manner. The paper suggests that sigma is blended but this would not be - consistent with the blending of the k-epsilon and k-omega models. - - Also note that the error in the last term of equation (2) relating to - sigma has been corrected. - - Wall-functions are applied in this implementation by using equations (14) - to specify the near-wall omega as appropriate. - - The blending functions (15) and (16) are not currently used because of the - uncertainty in their origin, range of applicability and that is y+ becomes - sufficiently small blending u_tau in this manner clearly becomes nonsense. - - The default model coefficients correspond to the following: - @verbatim - kOmegaSST_LowRe - { - alphaK1 0.85034; - alphaK2 1.0; - alphaOmega1 0.5; - alphaOmega2 0.85616; - beta1 0.075; - beta2 0.0828; - betaStar 0.09; - gamma1 0.5532; - gamma2 0.4403; - a1 0.31; - c1 10.0; - } - @endverbatim - -SourceFiles - kOmegaSST_LowRe.C - kOmegaWallFunctionsI.H - kOmegaWallViscosityI.H - wallOmegaI.H - -\*---------------------------------------------------------------------------*/ - -#ifndef kOmegaSST_LowRe_H -#define kOmegaSST_LowRe_H - -#include "RASModel.H" -#include "wallDist.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class kOmega Declaration -\*---------------------------------------------------------------------------*/ - -class kOmegaSST_LowRe -: - public RASModel -{ - // Private data - - // Model coefficients - - dimensionedScalar alphaK1_; - dimensionedScalar alphaK2_; - - dimensionedScalar alphaOmega1_; - dimensionedScalar alphaOmega2_; - - dimensionedScalar gamma1_; - dimensionedScalar gamma2_; - - dimensionedScalar beta1_; - dimensionedScalar beta2_; - - dimensionedScalar betaStar_; - - dimensionedScalar a1_; - dimensionedScalar c1_; - - dimensionedScalar Cmu_; - dimensionedScalar kappa_; - - - //- Wall distance field - // Note: different to wall distance in parent RASModel - wallDist y_; - - // Fields - - volScalarField k_; - volScalarField omega_; - volScalarField nut_; - - - // Private member functions - - tmp F1(const volScalarField& CDkOmega) const; - tmp F2() const; - - tmp blend - ( - const volScalarField& F1, - const dimensionedScalar& psi1, - const dimensionedScalar& psi2 - ) const - { - return F1*(psi1 - psi2) + psi2; - } - - tmp alphaK - ( - const volScalarField& F1 - ) const - { - return blend(F1, alphaK1_, alphaK2_); - } - - tmp alphaOmega - ( - const volScalarField& F1 - ) const - { - return blend(F1, alphaOmega1_, alphaOmega2_); - } - - tmp beta - ( - const volScalarField& F1 - ) const - { - return blend(F1, beta1_, beta2_); - } - - tmp gamma - ( - const volScalarField& F1 - ) const - { - return blend(F1, gamma1_, gamma2_); - } - - -public: - - //- Runtime type information - TypeName("kOmegaSST_LowRe"); - - - // Constructors - - //- Construct from components - kOmegaSST_LowRe - ( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport - ); - - - //- Destructor - - virtual ~kOmegaSST_LowRe() - {} - - - // Member Functions - - //- Return the turbulence viscosity - virtual tmp nut() const - { - return nut_; - } - - //- Return the effective diffusivity for k - tmp DkEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DkEff", alphaK(F1)*nut_ + nu()) - ); - } - - //- Return the effective diffusivity for omega - tmp DomegaEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DomegaEff", alphaOmega(F1)*nut_ + nu()) - ); - } - - //- Return the turbulence kinetic energy - virtual tmp k() const - { - return k_; - } - - //- Return the turbulence specific dissipation rate - virtual tmp omega() const - { - return omega_; - } - - //- Return the turbulence kinetic energy dissipation rate - virtual tmp epsilon() const - { - return tmp - ( - new volScalarField - ( - IOobject - ( - "epsilon", - mesh_.time().timeName(), - mesh_ - ), - betaStar_*k_*omega_, - omega_.boundaryField().types() - ) - ); - } - - //- Return the Reynolds stress tensor - virtual tmp R() const; - - //- Return the effective stress tensor including the laminar stress - virtual tmp devReff() const; - - //- Return the source term for the momentum equation - virtual tmp divDevReff(volVectorField& U) const; - - //- Solve the turbulence equations and correct the turbulence viscosity - virtual void correct(); - - //- Read RASProperties dictionary - virtual bool read(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H b/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H deleted file mode 100644 index 7c4d157fa..000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/kOmega_LowReI.H +++ /dev/null @@ -1,113 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Global - kOmegaWallFunctions - -Description - Calculate wall generation and frequency omega from wall-functions. - -\*---------------------------------------------------------------------------*/ - -{ - labelList cellBoundaryFaceCount(omega_.size(), 0); - - scalar Cmu25 = pow(Cmu_.value(), 0.25); - - const fvPatchList& patches = mesh_.boundary(); - - //- Initialise the near-wall omega and G fields to zero - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - omega_[faceCelli] = 0.0; - G[faceCelli] = 0.0; - } - } - } - - //- Accumulate the wall face contributions to omega and G - // Increment cellBoundaryFaceCount for each face for averaging - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { -# include "checkkOmega_LowRePatchFieldTypes.H" - - const scalarField& nuw = nu().boundaryField()[patchi]; - const scalarField& nutw = nut_.boundaryField()[patchi]; - - scalarField magFaceGradU = - mag(U_.boundaryField()[patchi].snGrad()); - - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - // For corner cells (with two boundary or more faces), - // omega and G in the near-wall cell are calculated - // as an average - - cellBoundaryFaceCount[faceCelli]++; - - omega_[faceCelli] += scalar(6)*nuw[facei] - /(beta1_.value()*sqr(y_[faceCelli])); - - G[faceCelli] += - (nutw[facei] + nuw[facei])*magFaceGradU[facei] - *Cmu25*sqrt(k_[faceCelli])/(kappa_.value()*y_[faceCelli]); - } - } - } - - - // Perform the averaging - - forAll(patches, patchi) - { - const fvPatch& curPatch = patches[patchi]; - - if (isType(curPatch)) - { - forAll(curPatch, facei) - { - label faceCelli = curPatch.faceCells()[facei]; - - omega_[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; - } - } - } -} - - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H b/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H deleted file mode 100644 index 265c0e480..000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST_LowRe/wallOmega_LowReI.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | - \\ / A nd | For copyright notice see file Copyright - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with foam-extend. If not, see . - -Global - wallOmega - -Description - Set wall dissipation in the omega matrix - -\*---------------------------------------------------------------------------*/ - -{ - const fvPatchList& patches = mesh_.boundary(); - - forAll(patches, patchi) - { - const fvPatch& p = patches[patchi]; - - if (p.isWall()) - { - omegaEqn().setValues - ( - p.faceCells(), - omega_.boundaryField()[patchi].patchInternalField() - ); - } - } -} - -// ************************************************************************* // From e299d0feabf2f070d88e7d9eb4daf5998976dffc Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Thu, 20 Feb 2014 19:23:16 +0100 Subject: [PATCH 026/197] Adapt for the new location of the MPI-implementations in MacPort --HG-- rename : wmake/rules/darwinIntel64Gcc/ARCHITECTURE_TESTED => wmake/rules/darwinIntel64Dragonegg/ARCHITECTURE_TESTED rename : wmake/rules/darwinIntel64Gcc/X => wmake/rules/darwinIntel64Dragonegg/X rename : wmake/rules/darwinIntel64Gcc/c => wmake/rules/darwinIntel64Dragonegg/c rename : wmake/rules/darwinIntel64Gcc/c++ => wmake/rules/darwinIntel64Dragonegg/c++ rename : wmake/rules/darwinIntel64Gcc/c++Debug => wmake/rules/darwinIntel64Dragonegg/c++Debug rename : wmake/rules/darwinIntel64Gcc/c++Opt => wmake/rules/darwinIntel64Dragonegg/c++Opt rename : wmake/rules/darwinIntel64Gcc/c++Prof => wmake/rules/darwinIntel64Dragonegg/c++Prof rename : wmake/rules/darwinIntel64Gcc/cDebug => wmake/rules/darwinIntel64Dragonegg/cDebug rename : wmake/rules/darwinIntel64Gcc/cOpt => wmake/rules/darwinIntel64Dragonegg/cOpt rename : wmake/rules/darwinIntel64Gcc/cProf => wmake/rules/darwinIntel64Dragonegg/cProf rename : wmake/rules/darwinIntel64Gcc/general => wmake/rules/darwinIntel64Dragonegg/general rename : wmake/rules/darwinIntel64Gcc/mplib => wmake/rules/darwinIntel64Dragonegg/mplib rename : wmake/rules/darwinIntel64Gcc/mplibMACPORTOPENMPI => wmake/rules/darwinIntel64Dragonegg/mplibMACPORTOPENMPI rename : wmake/rules/darwinIntel64Gcc/mplibOPENMPI => wmake/rules/darwinIntel64Dragonegg/mplibOPENMPI rename : wmake/rules/darwinIntel64Gcc/mplibSYSTEMOPENMPI => wmake/rules/darwinIntel64Dragonegg/mplibSYSTEMOPENMPI --- etc/bashrc | 203 +++++++++--------- etc/settings.sh | 28 ++- .../darwinIntel64Clang/mplibMACPORTMPICH | 3 + .../darwinIntel64Clang/mplibMACPORTOPENMPI | 4 +- .../ARCHITECTURE_TESTED | 1 + wmake/rules/darwinIntel64Dragonegg/X | 3 + wmake/rules/darwinIntel64Dragonegg/c | 16 ++ wmake/rules/darwinIntel64Dragonegg/c++ | 22 ++ wmake/rules/darwinIntel64Dragonegg/c++Debug | 2 + wmake/rules/darwinIntel64Dragonegg/c++Opt | 4 + wmake/rules/darwinIntel64Dragonegg/c++Prof | 2 + wmake/rules/darwinIntel64Dragonegg/cDebug | 2 + wmake/rules/darwinIntel64Dragonegg/cOpt | 2 + wmake/rules/darwinIntel64Dragonegg/cProf | 2 + wmake/rules/darwinIntel64Dragonegg/general | 10 + wmake/rules/darwinIntel64Dragonegg/mplib | 3 + .../darwinIntel64Dragonegg/mplibMACPORTMPICH | 3 + .../mplibMACPORTOPENMPI | 5 + .../rules/darwinIntel64Dragonegg/mplibOPENMPI | 3 + .../darwinIntel64Dragonegg/mplibSYSTEMOPENMPI | 1 + .../rules/darwinIntel64Gcc/mplibMACPORTMPICH | 3 + .../darwinIntel64Gcc/mplibMACPORTOPENMPI | 6 +- 22 files changed, 217 insertions(+), 111 deletions(-) create mode 100644 wmake/rules/darwinIntel64Clang/mplibMACPORTMPICH create mode 100644 wmake/rules/darwinIntel64Dragonegg/ARCHITECTURE_TESTED create mode 100644 wmake/rules/darwinIntel64Dragonegg/X create mode 100644 wmake/rules/darwinIntel64Dragonegg/c create mode 100644 wmake/rules/darwinIntel64Dragonegg/c++ create mode 100644 wmake/rules/darwinIntel64Dragonegg/c++Debug create mode 100644 wmake/rules/darwinIntel64Dragonegg/c++Opt create mode 100644 wmake/rules/darwinIntel64Dragonegg/c++Prof create mode 100644 wmake/rules/darwinIntel64Dragonegg/cDebug create mode 100644 wmake/rules/darwinIntel64Dragonegg/cOpt create mode 100644 wmake/rules/darwinIntel64Dragonegg/cProf create mode 100644 wmake/rules/darwinIntel64Dragonegg/general create mode 100644 wmake/rules/darwinIntel64Dragonegg/mplib create mode 100644 wmake/rules/darwinIntel64Dragonegg/mplibMACPORTMPICH create mode 100644 wmake/rules/darwinIntel64Dragonegg/mplibMACPORTOPENMPI create mode 100644 wmake/rules/darwinIntel64Dragonegg/mplibOPENMPI create mode 100644 wmake/rules/darwinIntel64Dragonegg/mplibSYSTEMOPENMPI create mode 100644 wmake/rules/darwinIntel64Gcc/mplibMACPORTMPICH diff --git a/etc/bashrc b/etc/bashrc index 6aad1f6ce..ce6c621cb 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -224,9 +224,6 @@ Darwin) # this makes certain things easier export WM_ARCH_BASE=darwin - # Remove limit of open files - ulimit -n 1000 - case `uname -p` in powerpc) export WM_ARCH=darwinPpc @@ -257,109 +254,113 @@ Darwin) ;; esac - # Make sure that binaries use the best features of the used OS-Version - # We need to get rid of the revision number from this string. eg turn "10.7.5" into "10.7" - export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion | sed -e "s/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2/g"` - which -s port >/dev/null if [ $? -eq "0" -a -d '/opt/local/etc/macports' ] then - if [ "$FOAM_VERBOSE" -a "$PS1" ] - then - echo "Using Macports binaries" - fi + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "Using Macports binaries" + fi - export WM_USE_MACPORT=1 + export WM_USE_MACPORT=1 + export WM_BASE_COMPILER=`echo $WM_COMPILER | tr -d "[:digit:]"` + export WM_MACPORT_MPI_VERSION=`echo $WM_COMPILER | tr "[:upper:]" "[:lower:]"` + export WM_MACPORT_VERSION=`echo $WM_MACPORT_MPI_VERSION | tr -d "[:alpha:]" | sed -e "s/\(.\)\(.\)/\1\.\2/"` - if [ -e '/opt/local/bin/openmpicc' ] - then - export WM_MPLIB=MACPORTOPENMPI - else - if [ -z "$WM_CHOSEN_MAC_MPI" ] - then - echo "WM_CHOSEN_MAC_MPI unset. Using OPENMPI" - export WM_MPLIB=OPENMPI - else - export WM_MPLIB=$WM_CHOSEN_MAC_MPI - fi - fi + if [ -z "$WM_CHOSEN_MAC_MPI" ] + then + if [ -e '/opt/local/bin/mpicc' ] + then + readlink /opt/local/bin/mpicc | grep openmpi >/dev/null + if [ $? -eq "0" ] + then + export WM_MPLIB=MACPORTOPENMPI + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "Using OpenMPI from MacPorts" + fi + else + readlink /opt/local/bin/mpicc | grep mpich >/dev/null + if [ $? -eq "0" ] + then + export WM_MPLIB=MACPORTMPICH + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "Using MPICH from MacPorts" + fi + else + echo "/opt/local/bin/mpicc neither OpenMPI nor MPICH. Confused. Defaulting to OPENMPI" + export WM_MPLIB=OPENMPI + fi + fi + fi + else + export WM_MPLIB=$WM_CHOSEN_MAC_MPI + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "User chose WM_CHOSEN_MAC_MPI=$WM_CHOSEN_MAC_MPI" + fi + fi - if [ "$compilerInstall" == "System" ] - then - # Use Mac-Ports-Compiler instead of Apple-gcc-4.2 - case $WM_COMPILER in - Gcc42) - export WM_MACPORT_VERSION=4.2 - export WM_BASE_COMPILER=Gcc - ;; - Gcc43) - export WM_MACPORT_VERSION=4.3 - export WM_BASE_COMPILER=Gcc - ;; - Gcc44) - export WM_MACPORT_VERSION=4.4 - export WM_BASE_COMPILER=Gcc - ;; - Gcc45) - export WM_MACPORT_VERSION=4.5 - export WM_BASE_COMPILER=Gcc - ;; - Gcc46) - export WM_MACPORT_VERSION=4.6 - export WM_BASE_COMPILER=Gcc - ;; - Gcc47) - export WM_MACPORT_VERSION=4.7 - export WM_BASE_COMPILER=Gcc - ;; - Gcc48) - export WM_MACPORT_VERSION=4.8 - export WM_BASE_COMPILER=Gcc - ;; - Clang32) - export WM_BASE_COMPILER=Clang - export WM_MACPORT_VERSION=3.2 - ;; - Clang33) - export WM_BASE_COMPILER=Clang - export WM_MACPORT_VERSION=3.3 - ;; - Clang34) - export WM_BASE_COMPILER=Clang - export WM_MACPORT_VERSION=3.4 - ;; - Gcc) - ;; - *) - echo "Unsupported MacPorts-Compiler $WM_COMPILER" - ;; - esac - if [ "$WM_MACPORT_VERSION" != "" ] - then - if [ "$WM_BASE_COMPILER" == "Gcc" ] - then - export WM_CC="gcc-mp-$WM_MACPORT_VERSION" - export WM_CXX="g++-mp-$WM_MACPORT_VERSION" - export WM_FC="gfortran-mp-$WM_MACPORT_VERSION" - else - export WM_CC="clang-mp-$WM_MACPORT_VERSION" - export WM_CXX="clang++-mp-$WM_MACPORT_VERSION" + if [ "$WM_MPLIB" == "MACPORTOPENMPI" ] + then + if [ ! -e "/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION" ] + then + export WM_MACPORT_MPI_VERSION=mp + if [ ! -e "/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION" ] + then + echo "Proper OpenMPI not installed. Either do 'port install openmpi-$WM_MACPORT_MPI_VERSION' or 'port install openmpi-default'" + fi + fi + else + if [ "$WM_MPLIB" == "MACPORTMPICH" ] + then + if [ ! -e "/opt/local/lib/mpich-$WM_MACPORT_MPI_VERSION" ] + then + echo "MPICH wants the same version as the used compiler. Do 'port install mpich-$WM_MACPORT_MPI_VERSION'" + fi + fi + fi - # hardcoded. Needed for ThirdParty - export WM_FC="gfortran-mp-4.5" - fi + if [ "$WM_COMPILER" != "Gcc" ] + then + if [ "$WM_BASE_COMPILER" == "Gcc" ] + then + export WM_CC="gcc-mp-$WM_MACPORT_VERSION" + export WM_CXX="g++-mp-$WM_MACPORT_VERSION" + elif [ "$WM_BASE_COMPILER" == "Clang" ] + then + export WM_CC="clang-mp-$WM_MACPORT_VERSION" + export WM_CXX="clang++-mp-$WM_MACPORT_VERSION" + elif [ "$WM_BASE_COMPILER" == "Dragonegg" ] + then + export WM_CC="dragonegg-$WM_MACPORT_VERSION-gcc" + export WM_CXX="dragonegg-$WM_MACPORT_VERSION-g++" + else + echo "Unknown base compiler $WM_BASE_COMPILER" + fi - ruleDirBase=$WM_PROJECT_DIR/wmake/rules/$WM_ARCH$WM_BASE_COMPILER - ruleDir=$WM_PROJECT_DIR/wmake/rules/$WM_ARCH$WM_COMPILER - if [ ! -e $ruleDir ] - then - echo "Rule directory $ruleDir not existing. Linking to $ruleDirBase" - ln -s $ruleDirBase $ruleDir - fi - unset ruleDir ruleDirBase - fi - fi + ruleDirBase=$WM_PROJECT_DIR/wmake/rules/$WM_ARCH + ruleDirTarget=$ruleDirBase$WM_BASE_COMPILER + ruleDir=$ruleDirBase$WM_COMPILER + if [ ! -e $ruleDir ] + then + echo "Rule directory $ruleDir not existing. Linking to $ruleDirTarget" + ln -s $ruleDirTarget $ruleDir + fi + unset ruleDir ruleDirBase + fi + else + echo "Seems you're not using MacPorts. This is currently not supported/tested. Find this line in 'etc/config/settings.sh', modify it accordingly and send patches to Bernhard" + export WM_COMPILER= + export WM_MPLIB=OPENMPI fi + + # Make sure that binaries use the best features of the used OS-Version + # We need to get rid of the revision number from this string. eg turn "10.7.5" into "10.7" + # v=(`sw_vers -productVersion | sed 's/\./ /g'`) + # export MACOSX_DEPLOYMENT_TARGET="${v[1]}.${v[2]}" + export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion | sed -e "s/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2/g"` ;; SunOS) @@ -437,6 +438,14 @@ then export LD_PRELOAD fi +if [[ `uname -s` == "Darwin" ]] +then + if [[ `ulimit -n` == "unlimited" || `ulimit -n` < 8192 ]] + then + # higher limit needed for wmkdeps + ulimit -n 8192 + fi +fi # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/settings.sh b/etc/settings.sh index e85bf95e8..43026c121 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -236,20 +236,28 @@ OPENMPI) ;; MACPORTOPENMPI) - unset OPAL_PREFIX + unset OPAL_PREFIX - export FOAM_MPI=openmpi-macport - libDir=`openmpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` + export FOAM_MPI=openmpi-macport-$WM_MACPORT_MPI_VERSION - # Bit of a hack: strip off 'lib' and hope this is the path to openmpi - # include files and libraries. - export MPI_ARCH_PATH="${libDir%/*}" + # Currently not correctly working on MacPorts + # libDir=`mpicc-openmpi-$WM_MACPORT_MPI_VERSION --showme:libdirs` + libDir=/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION - export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version + _foamAddLib $libDir + unset libDir + ;; - _foamAddLib $libDir - unset libDir - ;; +MACPORTMPICH) + export FOAM_MPI=mpich-macports-$WM_MACPORT_MPI_VERSION + export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI + + libDir=/opt/local/lib/mpich-$WM_MACPORT_MPI_VERSION + + _foamAddLib $libDir + unset libDir + + ;; SYSTEMOPENMPI) mpi_version=openmpi-system diff --git a/wmake/rules/darwinIntel64Clang/mplibMACPORTMPICH b/wmake/rules/darwinIntel64Clang/mplibMACPORTMPICH new file mode 100644 index 000000000..c01671a14 --- /dev/null +++ b/wmake/rules/darwinIntel64Clang/mplibMACPORTMPICH @@ -0,0 +1,3 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +PINC = -I/opt/local/include/mpich-$(WM_MACPORT_MPI_VERSION) +PLIBS = -L/opt/local/lib/mpich-$(WM_MACPORT_MPI_VERSION) -lmpich -lpmpich diff --git a/wmake/rules/darwinIntel64Clang/mplibMACPORTOPENMPI b/wmake/rules/darwinIntel64Clang/mplibMACPORTOPENMPI index aaa50f9f5..17117c9e5 100644 --- a/wmake/rules/darwinIntel64Clang/mplibMACPORTOPENMPI +++ b/wmake/rules/darwinIntel64Clang/mplibMACPORTOPENMPI @@ -1,3 +1,3 @@ PFLAGS = -DOMPI_SKIP_MPICXX -PINC = -I$(MPI_ARCH_PATH)/include/openmpi -PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi +PINC = $(shell mpicc-openmpi-mp --showme:compile) +PLIBS = $(shell mpicc-openmpi-mp --showme:link) diff --git a/wmake/rules/darwinIntel64Dragonegg/ARCHITECTURE_TESTED b/wmake/rules/darwinIntel64Dragonegg/ARCHITECTURE_TESTED new file mode 100644 index 000000000..e7c190c0c --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/ARCHITECTURE_TESTED @@ -0,0 +1 @@ +by bgschaid. 2010-10-05 diff --git a/wmake/rules/darwinIntel64Dragonegg/X b/wmake/rules/darwinIntel64Dragonegg/X new file mode 100644 index 000000000..bed8bfedd --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/X @@ -0,0 +1,3 @@ +XFLAGS = +XINC = $(XFLAGS) -I/usr/X11R6/include +XLIBS = -L/usr/X11R6/lib -lXext -lX11 diff --git a/wmake/rules/darwinIntel64Dragonegg/c b/wmake/rules/darwinIntel64Dragonegg/c new file mode 100644 index 000000000..b91a7d24d --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = $(WM_CC) $(WM_CXXFLAGS) -ftrapping-math + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC -Ddarwin + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -dynamiclib -flat_namespace -undefined suppress +LINKEXE = $(cc) -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/darwinIntel64Dragonegg/c++ b/wmake/rules/darwinIntel64Dragonegg/c++ new file mode 100644 index 000000000..92fab6bc4 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/c++ @@ -0,0 +1,22 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wno-overloaded-virtual -Wno-unsequenced -Wno-c++11-extensions -Wno-unused-comparison + +CC = $(WM_CXX) $(WM_CXXFLAGS) -ftrapping-math + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-200 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC -Ddarwin + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) -lpthread + +LINKLIBSO = $(CC) $(c++FLAGS) -lpthread -dynamiclib -undefined dynamic_lookup +# LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN) -lfoam -L$(FOAM_MPI_LIBBIN) -lPstream +LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_MPI_LIBBIN) -lPstream diff --git a/wmake/rules/darwinIntel64Dragonegg/c++Debug b/wmake/rules/darwinIntel64Dragonegg/c++Debug new file mode 100644 index 000000000..684957e11 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb2 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/darwinIntel64Dragonegg/c++Opt b/wmake/rules/darwinIntel64Dragonegg/c++Opt new file mode 100644 index 000000000..3446f7f58 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/c++Opt @@ -0,0 +1,4 @@ +c++DBUG = +c++OPT = -O3 +#c++OPT = -march=nocona -O3 +# -ftree-vectorize -ftree-vectorizer-verbose=3 diff --git a/wmake/rules/darwinIntel64Dragonegg/c++Prof b/wmake/rules/darwinIntel64Dragonegg/c++Prof new file mode 100644 index 000000000..3bda4dad5 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/darwinIntel64Dragonegg/cDebug b/wmake/rules/darwinIntel64Dragonegg/cDebug new file mode 100644 index 000000000..72b638f45 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/darwinIntel64Dragonegg/cOpt b/wmake/rules/darwinIntel64Dragonegg/cOpt new file mode 100644 index 000000000..17318709f --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/darwinIntel64Dragonegg/cProf b/wmake/rules/darwinIntel64Dragonegg/cProf new file mode 100644 index 000000000..ca3ac9bf5 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/darwinIntel64Dragonegg/general b/wmake/rules/darwinIntel64Dragonegg/general new file mode 100644 index 000000000..a69a25f37 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/general @@ -0,0 +1,10 @@ +CPP = cpp $(GFLAGS) +LD = ld + +PROJECT_LIBS = -l$(WM_PROJECT) + +include $(GENERAL_RULES)/standard + +include $(RULES)/X +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/darwinIntel64Dragonegg/mplib b/wmake/rules/darwinIntel64Dragonegg/mplib new file mode 100644 index 000000000..294bd8615 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/mplib @@ -0,0 +1,3 @@ +PFLAGS = +PINC = +PLIBS = diff --git a/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTMPICH b/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTMPICH new file mode 100644 index 000000000..c01671a14 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTMPICH @@ -0,0 +1,3 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +PINC = -I/opt/local/include/mpich-$(WM_MACPORT_MPI_VERSION) +PLIBS = -L/opt/local/lib/mpich-$(WM_MACPORT_MPI_VERSION) -lmpich -lpmpich diff --git a/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTOPENMPI b/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTOPENMPI new file mode 100644 index 000000000..6f5187e0b --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/mplibMACPORTOPENMPI @@ -0,0 +1,5 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +# PINC = $(shell mpicc-openmpi-$(WM_MACPORT_MPI_VERSION) --showme:compile) +# PLIBS = $(shell mpicc-openmpi-$(WM_MACPORT_MPI_VERSION) --showme:link) +PINC = -I/opt/local/include/openmpi-$(WM_MACPORT_MPI_VERSION) +PLIBS = -L/opt/local/lib/openmpi-$(WM_MACPORT_MPI_VERSION) -lmpi diff --git a/wmake/rules/darwinIntel64Dragonegg/mplibOPENMPI b/wmake/rules/darwinIntel64Dragonegg/mplibOPENMPI new file mode 100644 index 000000000..834d2d3e2 --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/mplibOPENMPI @@ -0,0 +1,3 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +PINC = -I$(MPI_ARCH_PATH)/include +PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi diff --git a/wmake/rules/darwinIntel64Dragonegg/mplibSYSTEMOPENMPI b/wmake/rules/darwinIntel64Dragonegg/mplibSYSTEMOPENMPI new file mode 100644 index 000000000..98fa814ce --- /dev/null +++ b/wmake/rules/darwinIntel64Dragonegg/mplibSYSTEMOPENMPI @@ -0,0 +1 @@ +PFLAGS = -DOMPI_SKIP_MPICXX diff --git a/wmake/rules/darwinIntel64Gcc/mplibMACPORTMPICH b/wmake/rules/darwinIntel64Gcc/mplibMACPORTMPICH new file mode 100644 index 000000000..c01671a14 --- /dev/null +++ b/wmake/rules/darwinIntel64Gcc/mplibMACPORTMPICH @@ -0,0 +1,3 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +PINC = -I/opt/local/include/mpich-$(WM_MACPORT_MPI_VERSION) +PLIBS = -L/opt/local/lib/mpich-$(WM_MACPORT_MPI_VERSION) -lmpich -lpmpich diff --git a/wmake/rules/darwinIntel64Gcc/mplibMACPORTOPENMPI b/wmake/rules/darwinIntel64Gcc/mplibMACPORTOPENMPI index aaa50f9f5..6f5187e0b 100644 --- a/wmake/rules/darwinIntel64Gcc/mplibMACPORTOPENMPI +++ b/wmake/rules/darwinIntel64Gcc/mplibMACPORTOPENMPI @@ -1,3 +1,5 @@ PFLAGS = -DOMPI_SKIP_MPICXX -PINC = -I$(MPI_ARCH_PATH)/include/openmpi -PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi +# PINC = $(shell mpicc-openmpi-$(WM_MACPORT_MPI_VERSION) --showme:compile) +# PLIBS = $(shell mpicc-openmpi-$(WM_MACPORT_MPI_VERSION) --showme:link) +PINC = -I/opt/local/include/openmpi-$(WM_MACPORT_MPI_VERSION) +PLIBS = -L/opt/local/lib/openmpi-$(WM_MACPORT_MPI_VERSION) -lmpi From 198c0969058251abb1f50fe649a2b780f7d11f20 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Fri, 21 Feb 2014 21:19:07 +0100 Subject: [PATCH 027/197] Fixing the scripts to correctly compile with MPI --- etc/settings.sh | 2 ++ wmake/rules/darwinIntel64Clang/c++ | 2 +- wmake/rules/darwinIntel64Dragonegg/c++ | 2 +- wmake/rules/darwinIntel64Gcc/c++ | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/settings.sh b/etc/settings.sh index 43026c121..13d68d33b 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -244,6 +244,7 @@ MACPORTOPENMPI) # libDir=`mpicc-openmpi-$WM_MACPORT_MPI_VERSION --showme:libdirs` libDir=/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION + export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$FOAM_MPI _foamAddLib $libDir unset libDir ;; @@ -252,6 +253,7 @@ MACPORTMPICH) export FOAM_MPI=mpich-macports-$WM_MACPORT_MPI_VERSION export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI + export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$FOAM_MPI libDir=/opt/local/lib/mpich-$WM_MACPORT_MPI_VERSION _foamAddLib $libDir diff --git a/wmake/rules/darwinIntel64Clang/c++ b/wmake/rules/darwinIntel64Clang/c++ index c278cdc5f..8a8884c20 100644 --- a/wmake/rules/darwinIntel64Clang/c++ +++ b/wmake/rules/darwinIntel64Clang/c++ @@ -20,4 +20,4 @@ LINK_LIBS = $(c++DBUG) -lpthread LINKLIBSO = $(CC) $(c++FLAGS) -lpthread -dynamiclib -undefined dynamic_lookup # LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN) -lfoam -L$(FOAM_MPI_LIBBIN) -lPstream -LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_MPI_LIBBIN) -lPstream +LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN)/$(FOAM_MPI) -lPstream diff --git a/wmake/rules/darwinIntel64Dragonegg/c++ b/wmake/rules/darwinIntel64Dragonegg/c++ index 92fab6bc4..18e39113c 100644 --- a/wmake/rules/darwinIntel64Dragonegg/c++ +++ b/wmake/rules/darwinIntel64Dragonegg/c++ @@ -19,4 +19,4 @@ LINK_LIBS = $(c++DBUG) -lpthread LINKLIBSO = $(CC) $(c++FLAGS) -lpthread -dynamiclib -undefined dynamic_lookup # LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN) -lfoam -L$(FOAM_MPI_LIBBIN) -lPstream -LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_MPI_LIBBIN) -lPstream +LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN)/$(FOAM_MPI) -lPstream diff --git a/wmake/rules/darwinIntel64Gcc/c++ b/wmake/rules/darwinIntel64Gcc/c++ index 92fab6bc4..18e39113c 100644 --- a/wmake/rules/darwinIntel64Gcc/c++ +++ b/wmake/rules/darwinIntel64Gcc/c++ @@ -19,4 +19,4 @@ LINK_LIBS = $(c++DBUG) -lpthread LINKLIBSO = $(CC) $(c++FLAGS) -lpthread -dynamiclib -undefined dynamic_lookup # LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN) -lfoam -L$(FOAM_MPI_LIBBIN) -lPstream -LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_MPI_LIBBIN) -lPstream +LINKEXE = $(CC) $(c++FLAGS) -lpthread -L$(FOAM_LIBBIN)/$(FOAM_MPI) -lPstream From 74bc4eacdfdbe602a263d951d8f3cf0753cb3a64 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Fri, 21 Feb 2014 21:21:16 +0100 Subject: [PATCH 028/197] Weird problem where gcc4.7 does not work if the label.H-Header is included before vector.H --- .../directTopoChange/meshCut/refineCell/refineCell.H | 3 +-- src/foam/meshes/meshTools/meshTools.H | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/directTopoChange/meshCut/refineCell/refineCell.H b/src/dynamicMesh/dynamicMesh/directTopoChange/meshCut/refineCell/refineCell.H index 004917262..3f6153333 100644 --- a/src/dynamicMesh/dynamicMesh/directTopoChange/meshCut/refineCell/refineCell.H +++ b/src/dynamicMesh/dynamicMesh/directTopoChange/meshCut/refineCell/refineCell.H @@ -35,8 +35,8 @@ SourceFiles #ifndef refineCell_H #define refineCell_H -#include "label.H" #include "vector.H" +#include "label.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -123,4 +123,3 @@ public: #endif // ************************************************************************* // - diff --git a/src/foam/meshes/meshTools/meshTools.H b/src/foam/meshes/meshTools/meshTools.H index 7241f1392..453013240 100644 --- a/src/foam/meshes/meshTools/meshTools.H +++ b/src/foam/meshes/meshTools/meshTools.H @@ -35,8 +35,8 @@ SourceFiles #ifndef meshTools_H #define meshTools_H -#include "label.H" #include "vector.H" +#include "label.H" #include "labelList.H" #include "pointField.H" #include "faceList.H" From bb2113dfc55b0c69beefb9ec022b940e1664cc34 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Fri, 21 Feb 2014 21:22:46 +0100 Subject: [PATCH 029/197] Adapting the stack-trace on Mac OS X. Got rid of a couple of nasty hacks --- bin/addr2line4Mac.py | 49 +++++--- src/OSspecific/POSIX/printStack.C | 184 +++++++++++------------------- 2 files changed, 103 insertions(+), 130 deletions(-) diff --git a/bin/addr2line4Mac.py b/bin/addr2line4Mac.py index 7a97c1505..54a40f1a8 100755 --- a/bin/addr2line4Mac.py +++ b/bin/addr2line4Mac.py @@ -4,27 +4,46 @@ import sys filename=sys.argv[1] address=sys.argv[2] import re +from os import environ,path -import subprocess +fullFile=None +if path.exists(filename): + fullFile=filename -p = subprocess.Popen("gdb -batch -x /dev/stdin", - shell=True, - bufsize=0, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - close_fds=True) +for v in ["PATH","LD_LIBRARY_PATH"]: + if not fullFile: + for d in environ[v].split(':'): + if path.exists(path.join(d,filename)): + fullFile=path.join(d,filename) + break -(child_stdin, child_stdout) = (p.stdin, p.stdout) -child_stdin.write("set sharedlibrary preload-libraries no\n") -child_stdin.write("file "+filename+"\n") -child_stdin.write("info line *"+address+"\n") -result=child_stdout.readline() +if not fullFile: + fullFile=filename answer="??:0" -match=re.compile('Line (.+) of "(.+)" starts at').match(result) -if match: - answer=match.group(2)+":"+match.group(1) +if path.exists(fullFile): + import subprocess + + result=subprocess.Popen(["xcrun", "atos", + "-o",fullFile, + address], + stdout=subprocess.PIPE + ).communicate()[0] + match=re.compile('.+ \((.+)\) \((.+)\)').match(result) + if match: + answer=match.group(2)+" "+match.group(1) + else: + import os + result=subprocess.Popen(["xcrun", "atos", + "-p",str(os.getppid()), + address], + stdout=subprocess.PIPE + ).communicate()[0] + match=re.compile('.+ \((.+)\) \((.+)\)').match(result) + if match: + answer=match.group(2)+" "+match.group(1) + print answer, sys.exit(255) diff --git a/src/OSspecific/POSIX/printStack.C b/src/OSspecific/POSIX/printStack.C index c88ae6863..7b28ef9f2 100644 --- a/src/OSspecific/POSIX/printStack.C +++ b/src/OSspecific/POSIX/printStack.C @@ -31,10 +31,13 @@ License #include "readHexLabel.H" #include -#ifndef darwin #include -#endif #include +#include + +#ifdef darwin +#include +#endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -126,14 +129,17 @@ void printSourceFileAndLine myAddress = nStream.str(); } +#ifndef darwin if (filename[0] == '/') +#else + if (1) +#endif { string line = pOpen ( #ifndef darwin "addr2line -f --demangle=auto --exe " #else - // "gaddr2line -f --inline --demangle=auto --exe " "addr2line4Mac.py " #endif + filename @@ -144,119 +150,22 @@ void printSourceFileAndLine if (line == "") { - os << " addr2line failed"; + os << " addr2line failed"; } else if (line == "??:0") { - os << " in " << filename; + os << " in " << filename; } else { string cwdLine(line.replaceAll(cwd() + '/', "")); - string homeLine(cwdLine.replaceAll(home(), '~')); - os << " at " << homeLine.c_str(); + os << " at " << homeLine.c_str(); } } } -#ifdef darwin - -// Trying to emulate the original backtrace and backtrace_symbol from the glibc -// After an idea published by Rush Manbert at http://lists.apple.com/archives/xcode-users/2006/Apr/msg00528.html - -template -void *getStackAddress() -{ - const unsigned int stackLevel=level; - return ( - __builtin_frame_address(level) - ? __builtin_return_address(stackLevel) - : (void *)0 - ); -}; - -#define GET_STACK_ADDRESS(lvl) \ - case lvl: {return getStackAddress(); break; } - -// please don't laugh. For some reason this is necessary (the compiler won't accept it otherwise) -void *getStackAddress(int level) -{ - switch(level) { - GET_STACK_ADDRESS(0); - GET_STACK_ADDRESS(1); - GET_STACK_ADDRESS(2); - GET_STACK_ADDRESS(3); - GET_STACK_ADDRESS(4); - GET_STACK_ADDRESS(5); - GET_STACK_ADDRESS(6); - GET_STACK_ADDRESS(7); - GET_STACK_ADDRESS(8); - GET_STACK_ADDRESS(9); - GET_STACK_ADDRESS(10); - GET_STACK_ADDRESS(11); - GET_STACK_ADDRESS(12); - GET_STACK_ADDRESS(13); - GET_STACK_ADDRESS(14); - GET_STACK_ADDRESS(15); - GET_STACK_ADDRESS(16); - GET_STACK_ADDRESS(17); - GET_STACK_ADDRESS(18); - GET_STACK_ADDRESS(19); - GET_STACK_ADDRESS(20); - GET_STACK_ADDRESS(21); - default: - return (void *)0; - break; - } -} - -unsigned backtrace(void **bt, unsigned maxAddrs) -{ - unsigned valid=0; - bool ok=true; - - for(int level=0;level Date: Sun, 23 Feb 2014 10:53:50 +0000 Subject: [PATCH 030/197] Solid models update - boundary traction --- .../solidCohesiveFvPatchVectorField.C | 986 +++++++++--------- .../constitutiveModel/constitutiveModel.H | 25 +- .../tractionBoundaryGradient.C | 885 +++++++++------- .../tractionBoundaryGradient.H | 45 +- .../dirichletNeumannFriction.C | 30 +- .../dirichletNeumann/dirichletNeumann.C | 336 +++--- ...acementOrSolidTractionFvPatchVectorField.C | 27 +- ...dDisplacementZeroShearFvPatchVectorField.C | 53 +- ...roShearOrSolidTractionFvPatchVectorField.C | 63 +- .../solidContactFvPatchVectorField.C | 205 ++-- .../solidTractionFvPatchVectorField.C | 26 +- .../solidTractionFvPatchVectorField.H | 2 +- .../solidTractionFreeFvPatchVectorField.C | 20 +- .../solidTractionFreeFvPatchVectorField.H | 2 +- ...dDisplacementZeroShearFvPatchVectorField.C | 10 +- .../nonLinearGeometry/nonLinearGeometry.H | 2 +- .../elasticIncrSolidFoam/incrPlateHole/0/DU | 8 +- .../incrPlateHole/constant/polyMesh/boundary | 2 +- .../elasticSolidFoam/plateHole/0/U | 11 +- .../plateHole/constant/polyMesh/boundary | 2 +- 20 files changed, 1491 insertions(+), 1249 deletions(-) diff --git a/src/solidModels/arbitraryCrack/solidCohesive/solidCohesiveFvPatchVectorField.C b/src/solidModels/arbitraryCrack/solidCohesive/solidCohesiveFvPatchVectorField.C index 7a0accb32..a7a78cb44 100644 --- a/src/solidModels/arbitraryCrack/solidCohesive/solidCohesiveFvPatchVectorField.C +++ b/src/solidModels/arbitraryCrack/solidCohesive/solidCohesiveFvPatchVectorField.C @@ -116,10 +116,10 @@ solidCohesiveFvPatchVectorField::solidCohesiveFvPatchVectorField nonLinear_(nonLinearGeometry::OFF), orthotropic_(false) { - Info << "Creating solidCohesive patch" << nl - << "\tOnly Dugdale law currently available!" << endl; + Info<< "Creating solidCohesive patch" << nl + << "\tOnly Dugdale law currently available!" << endl; - //- check if traction boundary is for non linear solver + // Check if traction boundary is for non linear solver if (dict.found("nonLinear")) { nonLinear_ = nonLinearGeometry::nonLinearNames_.read @@ -127,23 +127,23 @@ solidCohesiveFvPatchVectorField::solidCohesiveFvPatchVectorField dict.lookup("nonLinear") ); - if (nonLinear_ == nonLinearGeometry::UPDATED_LAGRANGIAN) - { - Info << "\tnonLinear set to updated Lagrangian" - << endl; - } - else if (nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN) - { - Info << "\tnonLinear set to total Lagrangian" - << endl; - } - } + if (nonLinear_ == nonLinearGeometry::UPDATED_LAGRANGIAN) + { + Info << "\tnonLinear set to updated Lagrangian" + << endl; + } + else if (nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN) + { + Info << "\tnonLinear set to total Lagrangian" + << endl; + } + } if (dict.found("orthotropic")) - { - orthotropic_ = Switch(dict.lookup("orthotropic")); - Info << "\t\torthotropic set to " << orthotropic_ << endl; - } + { + orthotropic_ = Switch(dict.lookup("orthotropic")); + Info << "\t\torthotropic set to " << orthotropic_ << endl; + } // if (minUnloadingSeparationDistance_ < 0.001) // { @@ -216,73 +216,73 @@ solidCohesiveFvPatchVectorField::solidCohesiveFvPatchVectorField // } if (dict.found("cracked")) - { + { // cracked_ = Field("cracked", dict, p.size()); - cracked_ = Field("cracked", dict, p.size()); - } + cracked_ = Field("cracked", dict, p.size()); + } if (dict.found("curTractionN")) - { - curTractionN_ = scalarField("curTractionN", dict, p.size()); - } + { + curTractionN_ = scalarField("curTractionN", dict, p.size()); + } if (dict.found("curTractionS")) - { - curTractionS_ = scalarField("curTractionS", dict, p.size()); - } + { + curTractionS_ = scalarField("curTractionS", dict, p.size()); + } if (dict.found("oldTractionN")) - { - oldTractionN_ = scalarField("oldTractionN", dict, p.size()); - } + { + oldTractionN_ = scalarField("oldTractionN", dict, p.size()); + } if (dict.found("oldTractionS")) - { - oldTractionS_ = scalarField("oldTractionS", dict, p.size()); - } + { + oldTractionS_ = scalarField("oldTractionS", dict, p.size()); + } if (dict.found("deltaN")) - { - deltaN_ = scalarField("deltaN", dict, p.size()); - } + { + deltaN_ = scalarField("deltaN", dict, p.size()); + } if (dict.found("deltaS")) - { - deltaS_ = scalarField("deltaS", dict, p.size()); - } + { + deltaS_ = scalarField("deltaS", dict, p.size()); + } if (dict.found("oldDeltaN")) - { - oldDeltaN_ = scalarField("oldDeltaN", dict, p.size()); - } + { + oldDeltaN_ = scalarField("oldDeltaN", dict, p.size()); + } if (dict.found("oldDeltaS")) - { - oldDeltaS_ = scalarField("oldDeltaS", dict, p.size()); - } + { + oldDeltaS_ = scalarField("oldDeltaS", dict, p.size()); + } if (dict.found("curDeltaN")) - { - curDeltaN_ = scalarField("curDeltaN", dict, p.size()); - } + { + curDeltaN_ = scalarField("curDeltaN", dict, p.size()); + } if (dict.found("curDeltaS")) - { - curDeltaS_ = scalarField("curDeltaS", dict, p.size()); - } + { + curDeltaS_ = scalarField("curDeltaS", dict, p.size()); + } if (dict.found("unloadingDeltaEff")) - { - unloadingDeltaEff_ = scalarField("unloadingDeltaEff", dict, p.size()); - } + { + unloadingDeltaEff_ = scalarField("unloadingDeltaEff", dict, p.size()); + } if (dict.found("currentGI")) - { - currentGI_ = scalarField("currentGI", dict, p.size()); - } + { + currentGI_ = scalarField("currentGI", dict, p.size()); + } if (dict.found("currentGII")) - { - currentGII_ = scalarField("currentGII", dict, p.size()); - } + { + currentGII_ = scalarField("currentGII", dict, p.size()); + } if (dict.found("oldGI")) - { - oldGI_ = scalarField("oldGI", dict, p.size()); - } + { + oldGI_ = scalarField("oldGI", dict, p.size()); + } if (dict.found("oldGII")) - { - oldGII_ = scalarField("oldGII", dict, p.size()); - } + { + oldGII_ = scalarField("oldGII", dict, p.size()); + } } @@ -415,14 +415,15 @@ tmp solidCohesiveFvPatchVectorField::crackingAndDamage() const ( new scalarField(size(), 1.0) ); + scalarField& cad = tcrackingAndDamage(); - forAll(tcrackingAndDamage(), facei) - { - if (cracked_[facei]) - { - tcrackingAndDamage()[facei] = 2.0; - } - } + forAll(cad, facei) + { + if (cracked_[facei]) + { + cad[facei] = 2.0; + } + } return tcrackingAndDamage; } @@ -434,11 +435,12 @@ tmp solidCohesiveFvPatchVectorField::GI() const ( new scalarField(size(), 0.0) ); + scalarField& GI = tGI(); - forAll(tGI(), facei) - { - tGI()[facei] = currentGI_[facei]; - } + forAll(GI, facei) + { + GI[facei] = currentGI_[facei]; + } return tGI; } @@ -450,41 +452,44 @@ tmp solidCohesiveFvPatchVectorField::GII() const ( new scalarField(size(), 0.0) ); + scalarField& GII = tGII(); - forAll(tGII(), facei) - { - tGII()[facei] = currentGII_[facei]; - } + forAll(GII, facei) + { + GII[facei] = currentGII_[facei]; + } return tGII; } + bool solidCohesiveFvPatchVectorField::cracking() { - const fvMesh& mesh = patch().boundaryMesh().mesh(); - const crackerFvMesh& crackerMesh = refCast(mesh); + const fvMesh& mesh = patch().boundaryMesh().mesh(); + const crackerFvMesh& crackerMesh = refCast(mesh); - // global fields - Field globalCracked = - crackerMesh.globalCrackField(cracked_); + // global fields + Field globalCracked = + crackerMesh.globalCrackField(cracked_); - label sumDamaged = 0; - label sumCracked = 0; - forAll(globalCracked, facei) - { - if (globalCracked[facei] > 0.0) - { - sumCracked++; - } - else - { - sumDamaged++; - } - } - Info << "\t\tThere are " << sumDamaged << " damaged faces" << endl; - Info << "\t\tThere are " << sumCracked << " cracked faces" << endl; + label sumDamaged = 0; + label sumCracked = 0; - return false; + forAll(globalCracked, facei) + { + if (globalCracked[facei] > 0.0) + { + sumCracked++; + } + else + { + sumDamaged++; + } + } + Info<< "\t\tThere are " << sumDamaged << " damaged faces" << nl + << "\t\tThere are " << sumCracked << " cracked faces" << endl; + + return false; } @@ -534,84 +539,13 @@ void solidCohesiveFvPatchVectorField::autoMap // the traction_ field after mapping and call updateCoeffs. // For here, we will just set traction to zero. - if ( (patch().size()==1) && (nNewFaces == 1) ) + if ( (patch().size() == 1) && (nNewFaces == 1) ) { label i=0; this->valueFraction()[i] = symmTensor::zero; - traction_[i] = vector::zero; - cracked_[i] = false; - curTractionN_[i] = 0.0; - oldTractionN_[i] = 0.0; - curTractionS_[i] = 0.0; - oldTractionS_[i] = 0.0; - deltaN_[i] = 0.0; - oldDeltaN_[i] = 0.0; - deltaS_[i] = 0.0; - oldDeltaS_[i] = 0.0; - curDeltaN_[i] = 0.0; - curDeltaS_[i] = 0.0; - unloadingDeltaEff_[i] = 0.0; - currentGI_[i] = 0.0; - oldGI_[i] = 0.0; - currentGII_[i] = 0.0; - oldGII_[i] = 0.0; - } - else if ( (patch().size()==2) && (nNewFaces == 1) ) - { - label i=1; - this->valueFraction()[i] = symmTensor::zero; + traction_[i] = vector::zero; cracked_[i] = false; - curTractionN_[i] = 0.0; - oldTractionN_[i] = 0.0; - curTractionS_[i] = 0.0; - oldTractionS_[i] = 0.0; - deltaN_[i] = 0.0; - oldDeltaN_[i] = 0.0; - deltaS_[i] = 0.0; - oldDeltaS_[i] = 0.0; - curDeltaN_[i] = 0.0; - curDeltaS_[i] = 0.0; - unloadingDeltaEff_[i] = 0.0; - currentGI_[i] = 0.0; - oldGI_[i] = 0.0; - currentGII_[i] = 0.0; - oldGII_[i] = 0.0; - } - else if ( (patch().size()==2) && (nNewFaces == 2) ) - { - label i=0; - this->valueFraction()[i] = symmTensor::zero; - traction_[i] = vector::zero; - i=1; - this->valueFraction()[i] = symmTensor::zero; - traction_[i] = vector::zero; - cracked_[i] = false; - curTractionN_[i] = 0.0; - oldTractionN_[i] = 0.0; - curTractionS_[i] = 0.0; - oldTractionS_[i] = 0.0; - deltaN_[i] = 0.0; - oldDeltaN_[i] = 0.0; - deltaS_[i] = 0.0; - oldDeltaS_[i] = 0.0; - curDeltaN_[i] = 0.0; - curDeltaS_[i] = 0.0; - unloadingDeltaEff_[i] = 0.0; - currentGI_[i] = 0.0; - oldGI_[i] = 0.0; - currentGII_[i] = 0.0; - oldGII_[i] = 0.0; - } - else - { - for (label i = 1; i < patch().size(); i++) - { - if (addressing[i] == 0) - { - this->valueFraction()[i] = symmTensor::zero; - traction_[i] = vector::zero; - cracked_[i] = false; curTractionN_[i] = 0.0; oldTractionN_[i] = 0.0; curTractionS_[i] = 0.0; @@ -627,6 +561,81 @@ void solidCohesiveFvPatchVectorField::autoMap oldGI_[i] = 0.0; currentGII_[i] = 0.0; oldGII_[i] = 0.0; + } + else if ( (patch().size() == 2) && (nNewFaces == 1) ) + { + label i=1; + this->valueFraction()[i] = symmTensor::zero; + traction_[i] = vector::zero; + cracked_[i] = false; + + curTractionN_[i] = 0.0; + oldTractionN_[i] = 0.0; + curTractionS_[i] = 0.0; + oldTractionS_[i] = 0.0; + deltaN_[i] = 0.0; + oldDeltaN_[i] = 0.0; + deltaS_[i] = 0.0; + oldDeltaS_[i] = 0.0; + curDeltaN_[i] = 0.0; + curDeltaS_[i] = 0.0; + unloadingDeltaEff_[i] = 0.0; + currentGI_[i] = 0.0; + oldGI_[i] = 0.0; + currentGII_[i] = 0.0; + oldGII_[i] = 0.0; + } + else if ( (patch().size()==2) && (nNewFaces == 2) ) + { + label i=0; + this->valueFraction()[i] = symmTensor::zero; + traction_[i] = vector::zero; + i=1; + this->valueFraction()[i] = symmTensor::zero; + traction_[i] = vector::zero; + + cracked_[i] = false; + curTractionN_[i] = 0.0; + oldTractionN_[i] = 0.0; + curTractionS_[i] = 0.0; + oldTractionS_[i] = 0.0; + deltaN_[i] = 0.0; + oldDeltaN_[i] = 0.0; + deltaS_[i] = 0.0; + oldDeltaS_[i] = 0.0; + curDeltaN_[i] = 0.0; + curDeltaS_[i] = 0.0; + unloadingDeltaEff_[i] = 0.0; + currentGI_[i] = 0.0; + oldGI_[i] = 0.0; + currentGII_[i] = 0.0; + oldGII_[i] = 0.0; + } + else + { + for (label i = 1; i < patch().size(); i++) + { + if (addressing[i] == 0) + { + this->valueFraction()[i] = symmTensor::zero; + traction_[i] = vector::zero; + + cracked_[i] = false; + curTractionN_[i] = 0.0; + oldTractionN_[i] = 0.0; + curTractionS_[i] = 0.0; + oldTractionS_[i] = 0.0; + deltaN_[i] = 0.0; + oldDeltaN_[i] = 0.0; + deltaS_[i] = 0.0; + oldDeltaS_[i] = 0.0; + curDeltaN_[i] = 0.0; + curDeltaS_[i] = 0.0; + unloadingDeltaEff_[i] = 0.0; + currentGI_[i] = 0.0; + oldGI_[i] = 0.0; + currentGII_[i] = 0.0; + oldGII_[i] = 0.0; } } } @@ -640,10 +649,10 @@ void solidCohesiveFvPatchVectorField::rmap const labelList& addr ) { - directionMixedFvPatchVectorField::rmap(ptf, addr); + directionMixedFvPatchVectorField::rmap(ptf, addr); - const solidCohesiveFvPatchVectorField& dmptf = - refCast(ptf); + const solidCohesiveFvPatchVectorField& dmptf = + refCast(ptf); relaxationFactor_ = dmptf.relaxationFactor_; traction_.rmap(dmptf.traction_, addr); @@ -681,7 +690,8 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() this->db().objectRegistry::lookupObject ( "rheologyProperties" - ); + ); + label patchID = patch().index(); const scalarField sigmaMax = rheology.cohLaw().sigmaMax()().boundaryField()[patchID]; @@ -695,32 +705,35 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() // update old values if (curTimeIndex_ != this->db().time().timeIndex()) { - // we force the penalty factor to be calculated here for the first time - // as all processors must call this at the same time - if (contact_ && patch().size() > 0) - { - // force calculation of penalty factor here - penaltyFactor(); - } + // we force the penalty factor to be calculated here for the first time + // as all processors must call this at the same time + if (contact_ && patch().size() > 0) + { + // force calculation of penalty factor here + penaltyFactor(); + } - oldDeltaN_ = deltaN_; - oldDeltaS_ = deltaS_; - // curDelta is always latest delta - // whereas delta is only latest when explicitDist is false - //oldDeltaN_ = curDeltaN_; - //oldDeltaS_ = curDeltaS_; - oldTractionN_ = curTractionN_; - oldTractionS_ = curTractionS_; - oldGI_ = currentGI_; - oldGII_ = currentGII_; - unloadingDeltaEff_ = - max - ( - unloadingDeltaEff_, - Foam::sqrt(max(deltaN_, 0.0)*max(deltaN_, 0.0) + deltaS_*deltaS_) - ); + oldDeltaN_ = deltaN_; + oldDeltaS_ = deltaS_; + // curDelta is always latest delta + // whereas delta is only latest when explicitDist is false + //oldDeltaN_ = curDeltaN_; + //oldDeltaS_ = curDeltaS_; + oldTractionN_ = curTractionN_; + oldTractionS_ = curTractionS_; + oldGI_ = currentGI_; + oldGII_ = currentGII_; + unloadingDeltaEff_ = + max + ( + unloadingDeltaEff_, + Foam::sqrt + ( + max(deltaN_, 0.0)*max(deltaN_, 0.0) + deltaS_*deltaS_ + ) + ); - curTimeIndex_ = this->db().time().timeIndex(); + curTimeIndex_ = this->db().time().timeIndex(); } @@ -741,40 +754,40 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() // global patch material field is needed for multimaterial cohesive laws if (updateGlobalPatchMaterials_) - { - updateGlobalPatchMaterials_ = false; + { + updateGlobalPatchMaterials_ = false; - if (mesh.objectRegistry::foundObject("materials")) - { - scalarField localPatchMaterials = - patch().lookupPatchField - ("materials").patchInternalField(); - scalarField newGlobalPatchMaterials = - crackerMesh.globalCrackField(localPatchMaterials); + if (mesh.objectRegistry::foundObject("materials")) + { + scalarField localPatchMaterials = + patch().lookupPatchField + ("materials").patchInternalField(); + scalarField newGlobalPatchMaterials = + crackerMesh.globalCrackField(localPatchMaterials); - globalPatchMaterials_.setSize(newGlobalPatchMaterials.size()); - globalPatchMaterials_ = newGlobalPatchMaterials; - } - } + globalPatchMaterials_.setSize(newGlobalPatchMaterials.size()); + globalPatchMaterials_ = newGlobalPatchMaterials; + } + } const regionSplit& regions = crackerMesh.regions(); labelField faceCellRegion(size(), -1); + forAll(faceCellRegion, faceI) { faceCellRegion[faceI] = regions[faceCells[faceI]]; } + labelField globalFaceCellRegion = crackerMesh.globalCrackField(faceCellRegion); - // Patch displacement vectorField UPatch = *this; if (fieldName_ == "DU") - { - UPatch += - patch().lookupPatchField("U"); - } + { + UPatch += patch().lookupPatchField("U"); + } // Global displacement vectorField globalUPatch = crackerMesh.globalCrackField(UPatch); @@ -796,285 +809,304 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() //globalIndex = crackerMesh.localCrackStart(); for (label i = 0; i < patch().size(); i++) - { - // update deltas - curDeltaN_[i] = n[i] & delta[i]; - curDeltaS_[i] = mag( (I - sqr(n[i])) & delta[i]); // shearing - if (explicitSeparationDistance_) - { - deltaN_[i] = oldDeltaN_[i]; - deltaS_[i] = oldDeltaS_[i]; - - if (mag(deltaN_[i]) < SMALL) - { - deltaN_[i] = 2*SMALL; - } - FatalError - << "explicitSeparationDistance_ is true!" << abort(FatalError); - } - else - { - // relax - deltaN_[i] = - relaxationFactor_*curDeltaN_[i] - + (1.0 - relaxationFactor_)*deltaN_[i]; - deltaS_[i] = - relaxationFactor_*curDeltaS_[i] - + (1.0 - relaxationFactor_)*deltaS_[i]; - } - - // update tractions - curTractionN_[i] = n[i] & traction_[i]; - curTractionS_[i] = mag( (I-sqr(n[i])) & traction_[i] ); - - // effective delta - only positive deltaN is considered - const scalar deltaEff = - ::sqrt(max(deltaN_[i], 0.0)*max(deltaN_[i], 0.0) - + deltaS_[i]*deltaS_[i]); - - // update energies - // stop calculating after cracking for convergence - // because crack might jump in and out of damaged/failed - // only update energies if there is loading - if ( !cracked_[i] && (deltaEff > (unloadingDeltaEff_[i]-SMALL)) ) { - // if the average normal stress is tensile - if ((curTractionN_[i]+oldTractionN_[i]) > 0.0) + // update deltas + curDeltaN_[i] = n[i] & delta[i]; + curDeltaS_[i] = mag( (I - sqr(n[i])) & delta[i]); // shearing + if (explicitSeparationDistance_) { - // trapezoidal rule - currentGI_[i] = - oldGI_[i] - + ((0.5*(curTractionN_[i]+oldTractionN_[i])) - *(deltaN_[i]-oldDeltaN_[i])); + deltaN_[i] = oldDeltaN_[i]; + deltaS_[i] = oldDeltaS_[i]; + + if (mag(deltaN_[i]) < SMALL) + { + deltaN_[i] = 2*SMALL; + } + FatalError + << "explicitSeparationDistance_ is true!" << abort(FatalError); } else { - // no modeI energy lost if in compression - currentGI_[i] = oldGI_[i]; + // relax + deltaN_[i] = + relaxationFactor_*curDeltaN_[i] + + (1.0 - relaxationFactor_)*deltaN_[i]; + + deltaS_[i] = + relaxationFactor_*curDeltaS_[i] + + (1.0 - relaxationFactor_)*deltaS_[i]; } - // mode II - trapezoidal rule - currentGII_[i] = - oldGII_[i] - + ((0.5*(curTractionS_[i]+oldTractionS_[i])) - *(deltaS_[i]-oldDeltaS_[i])); - } - //scalar currentG = currentGI_[i] + currentGII_[i]; - // if - // ( - // ( globalFaceCellRegion[globalIndex] - // == globalFaceCellRegion[gcfa[globalIndex]] ) - // || - // !cracked_[i] - // ) + // update tractions + curTractionN_[i] = n[i] & traction_[i]; + curTractionS_[i] = mag( (I-sqr(n[i])) & traction_[i] ); - // new tractions to be calculated - scalar curNormalTraction = 0; - vector curTangentialTraction = vector::zero; + // effective delta - only positive deltaN is considered + const scalar deltaEff = + Foam::sqrt(max(deltaN_[i], 0.0)*max(deltaN_[i], 0.0) + + deltaS_[i]*deltaS_[i]); - // loading - // if the effective delta is greater than unloadingDeltaEff then - // there is loading - // unloadingDeltaEff is the maximum previsouly reached deltaEff - if (deltaEff > (unloadingDeltaEff_[i]-SMALL) ) - { - // at the moment loading and unloading are the same - // if total energy is dissipated, then fully crack face - //if ( currentG > GIc[i] || cracked_[i] ) //Gc ) - // propagation - if ( ((currentGI_[i]/GIc[i]) + (currentGII_[i]/GIIc[i])) >= 1 ) - { - //Pout << "GIc[i] is " << GIc[i] << ", curG is " << currentG << endl; - if (!cracked_[i]) Pout << "Face " << i << " is fully cracked" << endl; + // update energies + // stop calculating after cracking for convergence + // because crack might jump in and out of damaged/failed + // only update energies if there is loading + if ( !cracked_[i] && (deltaEff > (unloadingDeltaEff_[i]-SMALL)) ) + { + // if the average normal stress is tensile + if ((curTractionN_[i]+oldTractionN_[i]) > 0.0) + { + // trapezoidal rule + currentGI_[i] = + oldGI_[i] + + ((0.5*(curTractionN_[i]+oldTractionN_[i]))* + (deltaN_[i]-oldDeltaN_[i])); + } + else + { + // no modeI energy lost if in compression + currentGI_[i] = oldGI_[i]; + } - cracked_[i] = true; + // mode II - trapezoidal rule + currentGII_[i] = oldGII_[i] + + ((0.5*(curTractionS_[i]+oldTractionS_[i]))* + (deltaS_[i]-oldDeltaS_[i])); + } + //scalar currentG = currentGI_[i] + currentGII_[i]; + + // if + // ( + // ( globalFaceCellRegion[globalIndex] + // == globalFaceCellRegion[gcfa[globalIndex]] ) + // || + // !cracked_[i] + // ) + + // new tractions to be calculated + scalar curNormalTraction = 0; + vector curTangentialTraction = vector::zero; + + // loading + // if the effective delta is greater than unloadingDeltaEff then + // there is loading + // unloadingDeltaEff is the maximum previsouly reached deltaEff + if (deltaEff > (unloadingDeltaEff_[i]-SMALL) ) + { + // at the moment loading and unloading are the same + // if total energy is dissipated, then fully crack face + //if ( currentG > GIc[i] || cracked_[i] ) //Gc ) + // propagation + if ( ((currentGI_[i]/GIc[i]) + (currentGII_[i]/GIIc[i])) >= 1 ) + { + //Pout << "GIc[i] is " << GIc[i] << ", curG is " << currentG << endl; + if (!cracked_[i]) + { + Pout << "Face " << i << " is fully cracked" << endl; + } + + cracked_[i] = true; - // failed faces might come in to contact so we need to deal with them - // here we could use the face delta values but that assumes that the - // opposing crack faces are aligned direclty opposite one another, which - // in general they are not. So we actually need to calculate the actual - // face penetration distances and then a standard penalty approach - // contact is probably fine. We will use simple assumption for now which - // is fine is the relative displacement - // of the opposing faces is not too large - // To-do: we must calculate actual distances - curNormalTraction = 0.0; - curTangentialTraction = vector::zero; - if ( contact_ && deltaN_[i] <= 0.0 ) - { - curNormalTraction = deltaN_[i]*penaltyFactor(); - //Info << "penaltyFactor() is " << penaltyFactor() << endl; + // failed faces might come in to contact so we need to deal with them + // here we could use the face delta values but that assumes that the + // opposing crack faces are aligned direclty opposite one another, which + // in general they are not. So we actually need to calculate the actual + // face penetration distances and then a standard penalty approach + // contact is probably fine. We will use simple assumption for now which + // is fine is the relative displacement + // of the opposing faces is not too large + // To-do: we must calculate actual distances + curNormalTraction = 0.0; + curTangentialTraction = vector::zero; + if ( contact_ && deltaN_[i] <= 0.0 ) + { + curNormalTraction = deltaN_[i]*penaltyFactor(); + //Info << "penaltyFactor() is " << penaltyFactor() << endl; - // friction - vector sDir = (I - sqr(n[i]))&delta[i]; - sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); - scalar slip = mag(deltaS_[gcfa[i]] - deltaS_[i]); - scalar fricMag = - min + // friction + vector sDir = (I - sqr(n[i]))&delta[i]; + sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); + scalar slip = mag(deltaS_[gcfa[i]] - deltaS_[i]); + scalar fricMag = + min + ( + slip*penaltyFactor(), + frictionCoeff_*curNormalTraction // stick/slip + ); + curTangentialTraction = fricMag*sDir; + } + + // relax tractions + curNormalTraction = + relaxationFactor_*curNormalTraction + + (1-relaxationFactor_)*(n[i] & traction_[i]); + + curTangentialTraction = + relaxationFactor_*curTangentialTraction + + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); + + traction_[i] = curNormalTraction*n[i] + curTangentialTraction; + } + // damging face with positive normal delta + else if ( deltaN_[i] > 0.0 ) + { + if (cracked_[i]) + { + Pout << "Face " << i << " is un-cracked" << endl; + } + + cracked_[i] = false; + + // set traction in a fixed point iteration manner to force + // (tN/sigmaMax)^2 + (tS/tauMax)^2 = 1 + // while also allowing varying mode mix by assuming colinear traction + // and delta + // Dugdale version + // scalar tN = + // sigmaMax[i] * deltaN_[i] / + // (SMALL + ::sqrt( (deltaN_[i]*deltaN_[i]) + // + (deltaS_[i]*deltaS_[i])*(sigmaMax[i]*sigmaMax[i] + // /(tauMax[i]*tauMax[i])) )); + // scalar tS = + // tauMax[i] * deltaS_[i] / + // (SMALL + ::sqrt( (deltaS_[i]*deltaS_[i]) + // + (deltaN_[i]*deltaN_[i])*(tauMax[i]*tauMax[i] + // /(sigmaMax[i]*sigmaMax[i])) )); + + // Given current deltaN and deltaS, the cohesive law + // (Dugdale, linear, etc)gives back current traction: + scalar tN = n[i] & traction_[i]; + scalar tS = mag( (I - sqr(n[i])) & traction_[i] ); + // Update tN and tS + rheology.cohLaw().damageTractions ( - slip*penaltyFactor(), - frictionCoeff_*curNormalTraction // stick/slip - ); - curTangentialTraction = fricMag*sDir; - } - - // relax tractions - curNormalTraction = - relaxationFactor_*curNormalTraction - + (1-relaxationFactor_)*(n[i] & traction_[i]); - curTangentialTraction = - relaxationFactor_*curTangentialTraction - + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); - traction_[i] = curNormalTraction*n[i] + curTangentialTraction; - } - - // damging face with positive normal delta - else if ( deltaN_[i] > 0.0 ) - { - if (cracked_[i]) Pout << "Face " << i << " is un-cracked" << endl; - - cracked_[i] = false; - - // set traction in a fixed point iteration manner to force - // (tN/sigmaMax)^2 + (tS/tauMax)^2 = 1 - // while also allowing varying mode mix by assuming colinear traction - // and delta - // Dugdale version - // scalar tN = - // sigmaMax[i] * deltaN_[i] / - // (SMALL + ::sqrt( (deltaN_[i]*deltaN_[i]) - // + (deltaS_[i]*deltaS_[i])*(sigmaMax[i]*sigmaMax[i] - // /(tauMax[i]*tauMax[i])) )); - // scalar tS = - // tauMax[i] * deltaS_[i] / - // (SMALL + ::sqrt( (deltaS_[i]*deltaS_[i]) - // + (deltaN_[i]*deltaN_[i])*(tauMax[i]*tauMax[i] - // /(sigmaMax[i]*sigmaMax[i])) )); - - // Given current deltaN and deltaS, the cohesive law - // (Dugdale, linear, etc)gives back current traction: - scalar tN = n[i] & traction_[i]; - scalar tS = mag( (I - sqr(n[i])) & traction_[i] ); - // Update tN and tS - rheology.cohLaw().damageTractions - ( - tN, - tS, - deltaN_[i], - deltaS_[i], - currentGI_[i], - currentGII_[i], - i, - globalPatchMaterials_ + tN, + tS, + deltaN_[i], + deltaS_[i], + currentGI_[i], + currentGII_[i], + i, + globalPatchMaterials_ ); - // shear delta direction - vector sDir = (I - sqr(n[i]))&delta[i]; - sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); + // shear delta direction + vector sDir = (I - sqr(n[i]))&delta[i]; + sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); - // relax tractions - curNormalTraction = - relaxationFactor_*tN - + (1-relaxationFactor_)*(n[i] & traction_[i]); - curTangentialTraction = - relaxationFactor_*(tS*sDir) - + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); - traction_[i] = curNormalTraction*n[i] + curTangentialTraction; - } + // relax tractions + curNormalTraction = + relaxationFactor_*tN + + (1-relaxationFactor_)*(n[i] & traction_[i]); - // damaging faces with negative normal delta + curTangentialTraction = + relaxationFactor_*(tS*sDir) + + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); + + traction_[i] = curNormalTraction*n[i] + curTangentialTraction; + } + // damaging faces with negative normal delta + else + { + if (cracked_[i]) + { + Pout << "Face " << i << " is un-cracked" << endl; + } + + cracked_[i] = false; + //Pout << "Contact and shearing face " << i << endl; + + //Pout << "Face " << i << " is damaging but in contact" << endl; + // set shear traction from cohesive law + // set normal traction to contact condition + scalar tS = tauMax[i]; + + vector sDir = (I - sqr(n[i])) & delta[i]; + sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); + + // Simple penalty condition + scalar penaltyFac = 0.0; + if (contact_) + { + penaltyFac = penaltyFactor(); + } + scalar contactTN = deltaN_[i]*penaltyFac; + + // relax tractions + curNormalTraction = + relaxationFactor_*contactTN + + (1-relaxationFactor_)*(n[i] & traction_[i]); + + curTangentialTraction = + relaxationFactor_*(tS*sDir) + + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); + + traction_[i] = curNormalTraction*n[i] + curTangentialTraction; + } + } else - { - if (cracked_[i]) Pout << "Face " << i << " is un-cracked" << endl; + { + // unloading + // as the current effective delta is less than the old time + // effective delta - cracked_[i] = false; - //Pout << "Contact and shearing face " << i << endl; + // We have two choice for unloading: + // (a) ductile approach + // unload with initial stiffness (which is infinite) + // similar to ductilve metal stress-strain curve + // as we use infinite intial stiffness, this means to elastic + // energy is recovered + // and we immediately start loading in opposite direction + // (b) brittle approach + // unload straight back to the origin + // this means we recover elastic energy + // + // approach (b) is numerically "nicer"; however, for Dugdale cohesive + // zone this implys that only half the energy is dissipated just before + // failure and then the other half is dissipated at failure. This may + // not be an issue in practive but it does not really make sense. + // Obviously it is fine for a linear cohesive zone as the energy + // is smoothly dissipated up to failure. For now, we will implement + // approach (b), but this requires more thinking... - //Pout << "Face " << i << " is damaging but in contact" << endl; - // set shear traction from cohesive law - // set normal traction to contact condition - scalar tS = tauMax[i]; + // reduce traction linearly with the reduction in delta + scalar scaleFactor = deltaEff/(unloadingDeltaEff_[i]); + traction_[i] = + relaxationFactor_*scaleFactor*traction_[i] + + (1 - relaxationFactor_)*traction_[i]; + } + } - vector sDir = (I - sqr(n[i])) & delta[i]; - sDir /= mag(sDir+vector(SMALL,SMALL,SMALL)); + bool incremental(fieldName_ == "DU"); - // Simple penalty condition - scalar penaltyFac = 0.0; - if (contact_) - { - penaltyFac = penaltyFactor(); - } - scalar contactTN = deltaN_[i]*penaltyFac; - - // relax tractions - curNormalTraction = - relaxationFactor_*contactTN - + (1-relaxationFactor_)*(n[i] & traction_[i]); - curTangentialTraction = - relaxationFactor_*(tS*sDir) - + (1-relaxationFactor_)*( (I -sqr(n[i])) & traction_[i]); - traction_[i] = curNormalTraction*n[i] + curTangentialTraction; - } - } - - else - { - // unloading - // as the current effective delta is less than the old time - // effective delta - - // We have two choice for unloading: - // (a) ductile approach - // unload with initial stiffness (which is infinite) - // similar to ductilve metal stress-strain curve - // as we use infinite intial stiffness, this means to elastic - // energy is recovered - // and we immediately start loading in opposite direction - // (b) brittle approach - // unload straight back to the origin - // this means we recover elastic energy - // - // approach (b) is numerically "nicer"; however, for Dugdale cohesive - // zone this implys that only half the energy is dissipated just before - // failure and then the other half is dissipated at failure. This may - // not be an issue in practive but it does not really make sense. - // Obviously it is fine for a linear cohesive zone as the energy - // is smoothly dissipated up to failure. For now, we will implement - // approach (b), but this requires more thinking... - - // reduce traction linearly with the reduction in delta - scalar scaleFactor = deltaEff/(unloadingDeltaEff_[i]); - traction_[i] = - relaxationFactor_*scaleFactor*traction_[i] - + (1-relaxationFactor_)*traction_[i]; - } - } - - - this->refGrad() = - tractionBoundaryGradient() - ( - traction_, - scalarField(traction_.size(), 0.0), - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + this->refGrad() = tractionBoundaryGradient::snGrad + ( + traction_, + scalarField(traction_.size(), 0.0), + fieldName_, + "U", + patch(), + orthotropic_, + nonLinear_, + incremental + ); directionMixedFvPatchVectorField::updateCoeffs(); } - void solidCohesiveFvPatchVectorField::calcPenaltyFactor() - { + +void solidCohesiveFvPatchVectorField::calcPenaltyFactor() +{ // calculate penalty factor similar to standardPenalty contact model // approx penaltyFactor from mechanical properties // this can then be scaled using the penaltyScale // to-do: write equivalent for orthotropic if (orthotropic_) { - FatalError << "solidCohesiveFvPatchVectorField::calcPenaltyFactor()" + FatalErrorIn + ( + "void solidCohesiveFvPatchVectorField::calcPenaltyFactor()" + ) << "solidCohesiveFvPatchVectorField::calcPenaltyFactor()" << " has yet to be written for orthotropic" << exit(FatalError); } @@ -1083,10 +1115,11 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() const fvMesh& mesh = patch().boundaryMesh().mesh(); const scalarField& mu = - mesh.objectRegistry::lookupObject + mesh.objectRegistry::lookupObject ("mu").boundaryField()[patchID]; + const scalarField& lambda = - mesh.objectRegistry::lookupObject + mesh.objectRegistry::lookupObject ("lambda").boundaryField()[patchID]; // avarage contact patch bulk modulus @@ -1097,13 +1130,16 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() // average contact patch cell volume scalar cellVolume = 0.0; + const volScalarField::DimensionedInternalField & V = mesh.V(); { - const unallocLabelList& faceCells = mesh.boundary()[patchID].faceCells(); - forAll(mesh.boundary()[patchID], facei) - { - cellVolume += V[faceCells[facei]]; - } + const unallocLabelList& faceCells = + mesh.boundary()[patchID].faceCells(); + + forAll(mesh.boundary()[patchID], facei) + { + cellVolume += V[faceCells[facei]]; + } } cellVolume /= patch().size(); @@ -1111,7 +1147,7 @@ void solidCohesiveFvPatchVectorField::updateCoeffs() // we approximate penalty factor for traction instead of force penaltyFactorPtr_ = new scalar(penaltyScale_*bulkModulus*faceArea/cellVolume); - } +} // Write diff --git a/src/solidModels/constitutiveModel/constitutiveModel.H b/src/solidModels/constitutiveModel/constitutiveModel.H index f04969abb..731297324 100644 --- a/src/solidModels/constitutiveModel/constitutiveModel.H +++ b/src/solidModels/constitutiveModel/constitutiveModel.H @@ -81,8 +81,8 @@ class constitutiveModel //- Plane stress Switch planeStress_; - //- Run-time selectable solidInterface method for correct discretisation - // on bi-material interfaces + //- Run-time selectable solidInterface method for correct + // discretisation on bi-material interfaces autoPtr solidInterfacePtr_; // we use IOReferencer to allow lookup of solidInterface object in @@ -137,17 +137,18 @@ public: //- If plasticity is active bool plasticityActive() const { - if (plasticityStressReturnPtr_.valid()) - { - return plasticityStressReturnPtr_->plasticityActive(); - } - return false; + if (plasticityStressReturnPtr_.valid()) + { + return plasticityStressReturnPtr_->plasticityActive(); + } + + return false; } //- If visco effects are active bool viscoActive() const { - return rheologyLawPtr_->viscoActive(); + return rheologyLawPtr_->viscoActive(); } //- Return reference to stress field @@ -241,14 +242,14 @@ public: //- Return reference to solidInterface virtual solidInterface& solInterface() { - return solidInterfacePtr_(); - } + return solidInterfacePtr_(); + } //- Return true if solidInterface is active virtual bool solidInterfaceActive() { - return solidInterfaceActive_; - } + return solidInterfaceActive_; + } //- Update yield stress void updateYieldStress(); diff --git a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.C b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.C index d76fdaac8..59a4bf6d7 100644 --- a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.C +++ b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.C @@ -36,438 +36,587 @@ Author #include "constitutiveModel.H" #include "thermalModel.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ +// * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(tractionBoundaryGradient, 0); - - -// * * * * * * * * * * * * * * Member functions * * * * * * * * * * * * * * // - -tmp tractionBoundaryGradient::traction +Foam::tmp Foam::tractionBoundaryGradient::traction ( const tensorField& gradField, - const word fieldName, + const word& workingFieldName, + const word& integralFieldName, const fvPatch& patch, - Switch orthotropic, - word nonLinear -) const + const bool orthotropic, + const nonLinearGeometry::nonLinearType& nonLinear, + const bool incremental +) { - // create tmp + // Create result tmp ttraction ( new vectorField(gradField.size(), vector::zero) ); vectorField& traction = ttraction(); + // Orthotropic material if (orthotropic) { - // for now, turn off orthotropic - FatalError - << "tractionBoundaryGradient::traction is not written for" - << " orthotropic yet" << nl + // For now, turn off orthotropic + FatalErrorIn + ( + "tmp tractionBoundaryGradient::traction\n" + "(\n" + " const tensorField& gradField,\n" + " const word& workingFieldName,\n" + " const word& integralFieldName,\n" + " const fvPatch& patch,\n" + " const bool orthotropic,\n" + " const nonLinearGeometry::nonLinearType& nonLinear\n" + ") const" + ) << "tractionBoundaryGradient::traction is not written for" + << " orthotropic materials yet" << nl << "you are probably trying to use solidContact boundaries " - << "with orthotropic solver" << nl - << "it should be straight-forward but I have not done it yet!" + << "with the orthotropic solver" << nl << exit(FatalError); } else - { - // lookup material properties from the solver - const fvPatchField& mu = - patch.lookupPatchField("mu"); - const fvPatchField& lambda = - patch.lookupPatchField("lambda"); + { + // Lookup material properties from the solver + const fvPatchScalarField& mu = + patch.lookupPatchField("mu"); - // only for nonlinear elastic properties - // if (rheology.type() == plasticityModel::typeName) - // { - // const plasticityModel& plasticity = - // refCast(rheology); + const fvPatchScalarField& lambda = + patch.lookupPatchField("lambda"); - // mu = plasticity.newMu().boundaryField()[patch.index()]; - // lambda = plasticity.newLambda().boundaryField()[patch.index()]; - // } + // only for nonlinear elastic properties + // if (rheology.type() == plasticityModel::typeName) + // { + // const plasticityModel& plasticity = + // refCast(rheology); - // required fields - vectorField n = patch.nf(); + // mu = plasticity.newMu().boundaryField()[patch.index()]; + // lambda = plasticity.newLambda().boundaryField()[patch.index()]; + // } + + // Get patch normal + vectorField n = patch.nf(); + + // Calculate traction + traction = 2*mu*(n & symm(gradField)) + lambda*tr(gradField)*n; + + // Plasticity effects + const constitutiveModel& rheology = + patch.boundaryMesh().mesh().objectRegistry:: + lookupObject("rheologyProperties"); + + if (rheology.plasticityActive()) + { + traction -= + 2*mu*(n & rheology.DEpsilonP().boundaryField()[patch.index()]); + } + + // Thermal effects + if + ( + patch.boundaryMesh().mesh().objectRegistry:: + foundObject("thermalProperties") + ) + { + const thermalModel& thermo = + patch.boundaryMesh().mesh().objectRegistry:: + lookupObject("thermalProperties"); + + const fvPatchScalarField& threeKalpha = + patch.lookupPatchField + ("((threeK*rho)*alpha)"); + + // Incremental thermal contribution + if (incremental) + { + const fvPatchScalarField& DT = + patch.lookupPatchField("DT"); + + traction -= (n*threeKalpha*DT); + } + else + { + const fvPatchScalarField& T = + patch.lookupPatchField("T"); + + const scalarField T0 = + thermo.T0()().boundaryField()[patch.index()]; + + traction -= (n*threeKalpha*(T - T0)); + } + } + + // Non-linear terms + if + ( + nonLinear == nonLinearGeometry::UPDATED_LAGRANGIAN + || nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + traction += + (n & (mu*(gradField & gradField.T()))) + + 0.5*n*lambda*(gradField && gradField); + + if + ( + incremental + && nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + // Incremental total Lagrangian + + const fvPatchTensorField& gradU = + patch.lookupPatchField + ( + "grad(" + integralFieldName + ")" + ); + + traction += + ( + n + & ( + mu* + ( + (gradU & gradField.T()) + + (gradField & gradU.T()) + ) + ) + ) + + 0.5*n*lambda*tr + ( + (gradU & gradField.T()) + + (gradField & gradU.T()) + ); + } + } - // calculate traction - traction = 2*mu*(n&symm(gradField)) + lambda*tr(gradField)*n; + // Add old stress for incremental approaches + if (incremental) + { + // add on old traction + const fvPatchSymmTensorField& sigma = + patch.lookupPatchField + ( + "sigma" + ); + traction += (n & sigma); + } - //- if there is plasticity - const constitutiveModel& rheology = - patch.boundaryMesh().mesh().objectRegistry:: - lookupObject("rheologyProperties"); - if (rheology.plasticityActive()) - { - traction -= - 2*mu*(n & rheology.DEpsilonP().boundaryField()[patch.index()]); - } + // Visco-elastic effects + if (rheology.viscoActive()) + { + const fvPatchSymmTensorField& DSigmaCorr = + patch.lookupPatchField + ( + "DSigmaCorr" + ); - //- if there are thermal effects - if (patch.boundaryMesh().mesh().objectRegistry:: - foundObject("thermalProperties")) - { - const thermalModel& thermo = - patch.boundaryMesh().mesh().objectRegistry:: - lookupObject("thermalProperties"); + traction += (n & DSigmaCorr); + } - const fvPatchField& threeKalpha = - patch.lookupPatchField - ("((threeK*rho)*alpha)"); + // Updated Lagrangian or total Lagrangian large strain + if + ( + nonLinear == nonLinearGeometry::UPDATED_LAGRANGIAN + || nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + tensorField F = I + gradField; - if (fieldName == "DU") - { - const fvPatchField& DT = - patch.lookupPatchField("DT"); + if + ( + incremental + && nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + // Incremental total Lagrangian - traction -= (n*threeKalpha*DT); - } - else - { - const fvPatchField& T = - patch.lookupPatchField("T"); + const fvPatchTensorField& gradU = + patch.lookupPatchField + ( + "grad(" + integralFieldName + ")" + ); - const scalarField T0 = thermo.T0()().boundaryField()[patch.index()]; + F += gradU; + } - traction -= (n*threeKalpha*(T - T0)); - } - } + tensorField Finv = inv(F); + scalarField J = det(F); - // non linear terms - if (nonLinear == "updatedLagrangian" || nonLinear == "totalLagrangian") - { - traction += - (n & (mu*(gradField & gradField.T()))) - + 0.5*n*lambda*(gradField && gradField); - - if (fieldName == "DU" && nonLinear == "totalLagrangian") - { - // incremental total Lagrangian - const fvPatchField& gradU = - patch.lookupPatchField("grad(U)"); - - traction += - (n & (mu*( (gradU & gradField.T()) + (gradField & gradU.T())))) - + 0.5*n*lambda*tr((gradU & gradField.T()) + (gradField & gradU.T())); - } - } - - - //- add old stress for incremental approaches - if (fieldName == "DU") - { - // add on old traction - const fvPatchField& sigma = - patch.lookupPatchField("sigma"); - traction += (n & sigma); - } - - //- visco-elastic - if (rheology.viscoActive()) - { - const fvPatchField& DSigmaCorr = - patch.lookupPatchField("DSigmaCorr"); - - traction += (n & DSigmaCorr); - } - - //- updated Lagrangian or total Lagrangian large strain - if (nonLinear == "updatedLagrangian" || nonLinear == "totalLagrangian") - { - tensorField F = I + gradField; - if (fieldName == "DU" && nonLinear == "totalLagrangian") - { - const fvPatchField& gradU = - patch.lookupPatchField("grad(U)"); - F += gradU; - } - tensorField Finv = inv(F); - scalarField J = det(F); - - //- rotate second Piola Kirchhoff traction to be Cauchy traction - traction = (traction & F)/(mag(J * Finv & n)); - } - } + // Rotate second Piola Kirchhoff traction to be Cauchy traction + traction = (traction & F)/(mag(J * Finv & n)); + } + } return ttraction; - } +} // * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * // - tmp tractionBoundaryGradient::operator() - ( - const vectorField& traction, - const scalarField& pressure, - const word fieldName, - const fvPatch& patch, - Switch orthotropic, - word nonLinear - ) const - { - // create tmp + +Foam::tmp Foam::tractionBoundaryGradient::snGrad +( + const vectorField& traction, + const scalarField& pressure, + const word& workingFieldName, + const word& integralFieldName, + const fvPatch& patch, + const bool orthotropic, + const nonLinearGeometry::nonLinearType& nonLinear, + const bool incremental +) +{ + // Create result tmp tgradient(new vectorField(traction.size(), vector::zero)); vectorField& gradient = tgradient(); - // lookup switches - - // orthotropic solvers + // Orthotropic material if (orthotropic) - { - // mechanical properties - const constitutiveModel& rheology = - patch.boundaryMesh().mesh().objectRegistry:: - lookupObject("rheologyProperties"); - const diagTensorField K = rheology.K()().boundaryField()[patch.index()]; - const symmTensor4thOrderField C = - rheology.C()().boundaryField()[patch.index()]; + { + // Get mechanical properties + const constitutiveModel& rheology = + patch.boundaryMesh().mesh().objectRegistry:: + lookupObject("rheologyProperties"); - // required fields - vectorField n = patch.nf(); - const diagTensorField Kinv = inv(K); - const fvPatchField& gradField = - patch.lookupPatchField("grad(" + fieldName + ")"); + const diagTensorField K = + rheology.K()().boundaryField()[patch.index()]; + const symmTensor4thOrderField C = + rheology.C()().boundaryField()[patch.index()]; - // calculate the traction to apply - vectorField Traction(n.size(), vector::zero); - tensorField sigmaExp(n.size(), tensor::zero); + // Required fields + vectorField n = patch.nf(); + const diagTensorField Kinv = inv(K); + const fvPatchTensorField& gradField = + patch.lookupPatchField + ( + "grad(" + workingFieldName + ")" + ); - //- total Lagrangian small strain - if (fieldName == "U" && nonLinear == "off") - { - //- total traction - Traction = (traction - n*pressure); + // Calculate the traction to apply + vectorField Traction(n.size(), vector::zero); + tensorField sigmaExp(n.size(), tensor::zero); - sigmaExp = (n*(n&(C && symm(gradField)))) - (K & gradField); - } - //- incremental total Lagrangian small strain - else if (fieldName == "DU" && nonLinear == "off") - { - const fvPatchField& sigma = - patch.lookupPatchField("sigma"); + // Total Lagrangian, small strain + if + ( + !incremental + && nonLinear == nonLinearGeometry::OFF + ) + { + // Use total traction + Traction = (traction - n*pressure); - //- increment of traction - Traction = (traction - n*pressure) - (n & sigma); + sigmaExp = (n*(n&(C && symm(gradField)))) - (K & gradField); + } + // Incremental total Lagrangian small strain + else if + ( + incremental + && nonLinear == nonLinearGeometry::OFF + ) + { + const fvPatchSymmTensorField& sigma = + patch.lookupPatchField + ( + "sigma" + ); - sigmaExp = (n*(n&(C && symm(gradField)))) - (K & gradField); - } - //- updated Lagrangian large strain - else if (nonLinear == "updatedLagrangian") - { - const fvPatchField& sigma = - patch.lookupPatchField("sigma"); + // Increment of traction + Traction = (traction - n*pressure) - (n & 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; + sigmaExp = (n*(n&(C && symm(gradField)))) - (K & gradField); + } + // Updated Lagrangian large strain + else if + ( + nonLinear == nonLinearGeometry::UPDATED_LAGRANGIAN + ) + { + const fvPatchSymmTensorField& sigma = + patch.lookupPatchField + ( + "sigma" + ); - //- increment of 2nd Piola-Kirchhoff traction - Traction = (mag(J * Finv & n) * tractionCauchy & Finv) - (n & sigma); + tensorField F = I + gradField; + tensorField Finv = inv(F); + scalarField J = det(F); + vectorField nCurrent = Finv & n; + nCurrent /= mag(nCurrent) + SMALL; + vectorField tractionCauchy = traction - nCurrent*pressure; - sigmaExp = (n*(n&(C && symm(gradField)))) - (K & gradField); - } - else - { - FatalError - << "solidTractionOrtho boundary condition not suitable for " - << " field " << fieldName << " and " << nonLinear - << abort(FatalError); - } + // Increment of 2nd Piola-Kirchhoff traction + Traction = mag(J*(Finv & n))*(tractionCauchy & Finv) - (n & sigma); - gradient = - n & - ( - Kinv & ( n*(Traction) - sigmaExp ) - ); - } - - // standard isotropic solvers - else - { - // lookup material properties from the solver - const fvPatchField& mu = - patch.lookupPatchField("mu"); - const fvPatchField& lambda = - patch.lookupPatchField("lambda"); - - // only for nonlinear elastic properties - // if (rheology.type() == plasticityModel::typeName) - // { - // const plasticityModel& plasticity = - // refCast(rheology); - - // mu = plasticity.newMu().boundaryField()[patch.index()]; - // lambda = plasticity.newLambda().boundaryField()[patch.index()]; - // } - - - // required fields - vectorField n = patch.nf(); - - // gradient of the field - const fvPatchField& gradField = - patch.lookupPatchField("grad(" + fieldName + ")"); - - - //---------------------------// - //- calculate the actual traction to apply - //---------------------------// - vectorField Traction(n.size(),vector::zero); - - //- total Lagrangian small strain - if (fieldName == "U" && nonLinear == "off") - { - //- total traction - Traction = (traction - n*pressure); - } - //- incremental total Lagrangian small strain - else if (fieldName == "DU" && nonLinear == "off") - { - 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 == "updatedLagrangian" || nonLinear == "totalLagrangian") - { - const fvPatchField& sigma = - patch.lookupPatchField("sigma"); - - tensorField F = I + gradField; - if (fieldName == "DU" && nonLinear == "totalLagrangian") // for incr TL - { - const fvPatchField& gradU = - patch.lookupPatchField("grad(U)"); - F += gradU; - } - tensorField Finv = hinv(F); - scalarField J = det(F); - vectorField nCurrent = Finv & n; - nCurrent /= mag(nCurrent); - vectorField tractionCauchy = traction - nCurrent*pressure; - - Traction = (mag(J * Finv & n) * tractionCauchy & Finv); - - if (fieldName == "DU") - { - //- increment of 2nd Piola-Kirchhoff traction - Traction -= (n & sigma); - } - } - else - { - FatalError - << "Field " << fieldName << " and " << nonLinear - << " nonLinear are not compatible!" - << exit(FatalError); - } - - //- visco-elastic - const constitutiveModel& rheology = - patch.boundaryMesh().mesh().objectRegistry:: - lookupObject("rheologyProperties"); - if (rheology.viscoActive()) - { - //Info << "visco active" << endl; - const fvPatchField& DSigmaCorr = - patch.lookupPatchField("DSigmaCorr"); - - Traction -= (n & DSigmaCorr); - } - - //---------------------------// - //- calculate the normal gradient based on the traction - //---------------------------// - gradient = - Traction - - (n & (mu*gradField.T() - (mu + lambda)*gradField)) - - n*lambda*tr(gradField); - - //- if there is plasticity - if (rheology.plasticityActive()) - { - //Info << "plasticity is active" << endl; - gradient += - 2*mu*(n & rheology.DEpsilonP().boundaryField()[patch.index()]); - } - - //- if there are thermal effects - if (patch.boundaryMesh().mesh().objectRegistry:: - foundObject("thermalProperties")) - { - const thermalModel& thermo = - patch.boundaryMesh().mesh().objectRegistry:: - lookupObject("thermalProperties"); - - const fvPatchField& threeKalpha = - patch.lookupPatchField - ("((threeK*rho)*alpha)"); - - if (fieldName == "DU") - { - const fvPatchField& DT = - patch.lookupPatchField("DT"); - - gradient += (n*threeKalpha*DT); - } + sigmaExp = n*(n &(C && symm(gradField))) - (K & gradField); + } else - { - const fvPatchField& T = - patch.lookupPatchField("T"); + { + FatalErrorIn + ( + "tmp tractionBoundaryGradient::snGrad\n" + "(\n" + " const vectorField& traction,\n" + " const scalarField& pressure,\n" + " const word& workingFieldName,\n" + " const word& integralFieldName,\n" + " const fvPatch& patch,\n" + " const bool orthotropic,\n" + " const nonLinearGeometry::nonLinearType& nonLinear,\n" + " const bool incremental\n" + ") const" + ) << "solidTractionOrtho boundary condition not suitable for " + << " field " << workingFieldName << " and " + << nonLinearGeometry::nonLinearNames_[nonLinear] + << abort(FatalError); + } - const scalarField T0 = thermo.T0()().boundaryField()[patch.index()]; + gradient = n & (Kinv & ( n*(Traction) - sigmaExp )); + } + else + { + // Standard isotropic solvers - gradient += (n*threeKalpha*(T - T0)); - } + // Lookup material properties from the solver + const fvPatchScalarField& mu = + patch.lookupPatchField("mu"); + + const fvPatchScalarField& lambda = + patch.lookupPatchField("lambda"); + + // only for nonlinear elastic properties + // if (rheology.type() == plasticityModel::typeName) + // { + // const plasticityModel& plasticity = + // refCast(rheology); + + // mu = plasticity.newMu().boundaryField()[patch.index()]; + // lambda = plasticity.newLambda().boundaryField()[patch.index()]; + // } + + vectorField n = patch.nf(); + + // gradient of the field + const fvPatchTensorField& gradField = + patch.lookupPatchField + ( + "grad(" + workingFieldName + ")" + ); + + + vectorField Traction(n.size(), vector::zero); + + // Total Lagrangian, small strain + if + ( + !incremental + && nonLinear == nonLinearGeometry::OFF + ) + { + // Use total traction + Traction = (traction - n*pressure); + } + // Incremental total Lagrangian small strain + else if + ( + incremental + && nonLinear == nonLinearGeometry::OFF + ) + { + const fvPatchSymmTensorField& sigma = + patch.lookupPatchField + ( + "sigma" + ); + + // Increment of traction + Traction = (traction - n*pressure) - (n & sigma); + } + else if + ( + nonLinear == nonLinearGeometry::UPDATED_LAGRANGIAN + || nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + const fvPatchSymmTensorField& sigma = + patch.lookupPatchField + ( + "sigma" + ); + + tensorField F = I + gradField; + + if + ( + incremental + && nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + // Incremental total Lagrangian + + const fvPatchTensorField& gradU = + patch.lookupPatchField + ( + "grad(" + integralFieldName + ")" + ); + + F += gradU; + } + + tensorField Finv = hinv(F); + scalarField J = det(F); + vectorField nCurrent = Finv & n; + nCurrent /= mag(nCurrent) + SMALL; + vectorField tractionCauchy = traction - nCurrent*pressure; + + Traction = mag(J*(Finv & n))*(tractionCauchy & Finv); + + if (incremental) + { + // Increment of 2nd Piola-Kirchhoff traction + Traction -= (n & sigma); + } + } + else + { + FatalErrorIn + ( + "tmp tractionBoundaryGradient::snGrad\n" + "(\n" + " const vectorField& traction,\n" + " const scalarField& pressure,\n" + " const word& workingFieldName,\n" + " const word& integralFieldName,\n" + " const fvPatch& patch,\n" + " const bool orthotropic,\n" + " const nonLinearGeometry::nonLinearType& nonLinear,\n" + " const bool incremental\n" + ") const" + ) << " field " << workingFieldName << " and " + << nonLinearGeometry::nonLinearNames_[nonLinear] + << " nonLinear are not compatible!" + << abort(FatalError); } - //- higher order non-linear terms - if (nonLinear == "updatedLagrangian" || nonLinear == "totalLagrangian") - { - // no extra relaxation - gradient -= - (n & (mu*(gradField & gradField.T()))) - // + 0.5*n*lambda*(gradField && gradField); + //- visco-elastic + const constitutiveModel& rheology = + patch.boundaryMesh().mesh().objectRegistry:: + lookupObject("rheologyProperties"); + + if (rheology.viscoActive()) + { + const fvPatchSymmTensorField& DSigmaCorr = + patch.lookupPatchField + ( + "DSigmaCorr" + ); + + Traction -= (n & DSigmaCorr); + } + + // Calculate the normal gradient based on the traction + + gradient = + Traction + - (n & (mu*gradField.T() - (mu + lambda)*gradField)) + - n*lambda*tr(gradField); + + //- Plasticity contribution + if (rheology.plasticityActive()) + { + gradient += + 2*mu*(n & rheology.DEpsilonP().boundaryField()[patch.index()]); + } + + // Thermal effects + if + ( + patch.boundaryMesh().mesh().objectRegistry:: + foundObject("thermalProperties") + ) + { + const thermalModel& thermo = + patch.boundaryMesh().mesh().objectRegistry:: + lookupObject("thermalProperties"); + + const fvPatchScalarField& threeKalpha = + patch.lookupPatchField + ( + "((threeK*rho)*alpha)" + ); + + if (!incremental) + { + const fvPatchScalarField& DT = + patch.lookupPatchField("DT"); + + gradient += n*threeKalpha*DT; + } + else + { + const fvPatchScalarField& T = + patch.lookupPatchField("T"); + + const scalarField T0 = + thermo.T0()().boundaryField()[patch.index()]; + + gradient += n*threeKalpha*(T - T0); + } + } + + // Higher order non-linear terms + if + ( + nonLinear == nonLinearGeometry::UPDATED_LAGRANGIAN + || nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + // no extra relaxation + gradient -= + (n & (mu*(gradField & gradField.T()))) + // + 0.5*n*lambda*(gradField && gradField); + 0.5*n*lambda*tr(gradField & gradField.T()); - //- tensorial identity - //- tr(gradField & gradField.T())*I == (gradField && gradField)*I - if (fieldName == "DU" && nonLinear == "totalLagrangian") - { - // gradU is const in a time step - const fvPatchField& gradU = - patch.lookupPatchField("grad(U)"); + if + ( + incremental + && nonLinear == nonLinearGeometry::TOTAL_LAGRANGIAN + ) + { + // gradU is const in a time step + const fvPatchTensorField& gradU = + patch.lookupPatchField("grad(U)"); - gradient -= - (n & - (mu*( (gradField & gradU.T()) - + (gradU & gradField.T()) )) - ) - + 0.5*n*lambda*tr( (gradField & gradU.T()) - + (gradU & gradField.T()) ); - } - } + gradient -= + ( + n & + ( + mu* + ( + (gradField & gradU.T()) + + (gradU & gradField.T()) + ) + ) + ) + + 0.5*n*lambda*tr + ( + (gradField & gradU.T()) + + (gradU & gradField.T()) + ); + } + } - gradient /= (2.0*mu + lambda); - } + gradient /= (2.0*mu + lambda); + } return tgradient; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam // ************************************************************************* // diff --git a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H index d638e8bd1..a004ebb73 100644 --- a/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H +++ b/src/solidModels/constitutiveModel/tractionBoundaryGradient/tractionBoundaryGradient.H @@ -35,6 +35,7 @@ SourceFiles Author Philip Cardiff UCD + Clean-up and re-factoring Hrvoje Jasak \*---------------------------------------------------------------------------*/ @@ -47,6 +48,7 @@ Author #include "volFields.H" #include "tmp.H" #include "rheologyLaw.H" +#include "nonLinearGeometry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,49 +61,38 @@ namespace Foam class tractionBoundaryGradient { - public: - //- Runtime type information - TypeName("tractionBoundaryGradient"); - - // Constructors - - tractionBoundaryGradient() - {} - - - // Destructor - - virtual ~tractionBoundaryGradient() - {} - - - // Member functions + // Static member functions //- Return the boundary Cauchy traction corresponding to // the given gradient - tmp traction + static tmp traction ( const tensorField& gradField, - const word fieldName, + const word& workingFieldName, // Working variable + const word& integralFieldName, // Integrated displacement const fvPatch& patch, - Switch orthotropic, - word nonLinear - ) const; + const bool orthotropic, + const nonLinearGeometry::nonLinearType& nonLinear, + const bool incremental + ); // Operators - tmp operator() + //- Return surface-normal gradient given traction and pressure + static tmp snGrad ( const vectorField& traction, const scalarField& pressure, - const word fieldName, + const word& workingFieldName, // Working variable + const word& integralFieldName, // Integrated displacement const fvPatch& patch, - Switch orthotropic, - word nonLinear - ) const; + const bool orthotropic, + const nonLinearGeometry::nonLinearType& nonLinear, + const bool incremental + ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/solidModels/contactModels/frictionContactModels/dirichletNeumannFriction/dirichletNeumannFriction.C b/src/solidModels/contactModels/frictionContactModels/dirichletNeumannFriction/dirichletNeumannFriction.C index 38d5c4a55..c750c72e3 100644 --- a/src/solidModels/contactModels/frictionContactModels/dirichletNeumannFriction/dirichletNeumannFriction.C +++ b/src/solidModels/contactModels/frictionContactModels/dirichletNeumannFriction/dirichletNeumannFriction.C @@ -269,18 +269,24 @@ Foam::dirichletNeumannFriction::dirichletNeumannFriction const fvPatch& slavePatch = mesh.boundary()[slavePatchIndex]; const fvPatchField& gradField = slavePatch.lookupPatchField - ("grad("+fieldName+")"); - vectorField slaveShearTraction = - (I - sqr(slaveFaceNormals)) - & - tractionBoundaryGradient().traction - ( - gradField, - fieldName, - slavePatch, - orthotropic, - nonLinear - ); + ("grad(" + fieldName + ")"); + + bool incremental(fieldName == "DU"); + + vectorField slaveShearTraction + ( + (I - sqr(slaveFaceNormals)) + & tractionBoundaryGradient::traction + ( + gradField, + fieldName, + "U", + slavePatch, + orthotropic, + nonLinearGeometry::nonLinearNames_[nonLinear], + incremental + ) + ); // algorithm diff --git a/src/solidModels/contactModels/normalContactModels/dirichletNeumann/dirichletNeumann.C b/src/solidModels/contactModels/normalContactModels/dirichletNeumann/dirichletNeumann.C index dd60e5fb8..8ebe07e62 100644 --- a/src/solidModels/contactModels/normalContactModels/dirichletNeumann/dirichletNeumann.C +++ b/src/solidModels/contactModels/normalContactModels/dirichletNeumann/dirichletNeumann.C @@ -117,57 +117,59 @@ dirichletNeumann::dirichletNeumann contactFilePtr_(NULL) { // master proc open contact info file - if (Pstream::master()) + if (Pstream::master()) { - word masterName = mesh_.boundary()[masterPatchID].name(); - word slaveName = mesh_.boundary()[slavePatchID].name(); - contactFilePtr_ = - new OFstream - (fileName("normalContact_"+masterName+"_"+slaveName+".txt")); - OFstream& contactFile = *contactFilePtr_; - int width = 20; - contactFile << "time"; - contactFile.width(width); - contactFile << "iter"; - contactFile.width(width); - contactFile << "contactFaces"; - contactFile.width(width); - contactFile << "settledFaces"; - contactFile.width(width); - contactFile << "minPen"; - contactFile.width(width); - contactFile << "maxPress"; - contactFile.width(width); - contactFile << "corrPoints" << endl; - } + word masterName = mesh_.boundary()[masterPatchID].name(); + word slaveName = mesh_.boundary()[slavePatchID].name(); + contactFilePtr_ = + new OFstream + (fileName("normalContact_"+masterName+"_"+slaveName+".txt")); + OFstream& contactFile = *contactFilePtr_; + int width = 20; + contactFile << "time"; + contactFile.width(width); + contactFile << "iter"; + contactFile.width(width); + contactFile << "contactFaces"; + contactFile.width(width); + contactFile << "settledFaces"; + contactFile.width(width); + contactFile << "minPen"; + contactFile.width(width); + contactFile << "maxPress"; + contactFile.width(width); + contactFile << "corrPoints" << endl; + } - // calc point points for missed vertices - if (correctMissedVertices_) + // calc point points for missed vertices + if (correctMissedVertices_) { - calcSlavePointPoints(slavePatchID); + calcSlavePointPoints(slavePatchID); } } -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - void dirichletNeumann::correct - ( - const PrimitivePatch& masterFaceZonePatch, - const PrimitivePatch& slaveFaceZonePatch, - const intersection::algorithm alg, - const intersection::direction dir, - word fieldName, - const Switch orthotropic, - const word nonLinear, - vectorField& slaveFaceNormals, - GGIInterpolation< PrimitivePatch< face, List, pointField >, - PrimitivePatch< face, List, pointField > - >* ggiInterpolatorPtr - ) - { +void dirichletNeumann::correct +( + const PrimitivePatch& masterFaceZonePatch, + const PrimitivePatch& slaveFaceZonePatch, + const intersection::algorithm alg, + const intersection::direction dir, + word fieldName, + const Switch orthotropic, + const word nonLinear, + vectorField& slaveFaceNormals, + GGIInterpolation + < + PrimitivePatch< face, List, pointField >, + PrimitivePatch< face, List, pointField > + >* ggiInterpolatorPtr +) +{ if (!settleContact_ || (iCorr_ < settleIterationNumber_)) - { + { //Info << "Correcting contact..." << flush; const fvMesh& mesh = mesh_; @@ -186,11 +188,11 @@ dirichletNeumann::dirichletNeumann >, PrimitivePatch > masterToSlavePatchToPatchInterpolator ( - masterFaceZonePatch, // from zone - slaveFaceZonePatch, // to zone - alg, - dir - ); + masterFaceZonePatch, // from zone + slaveFaceZonePatch, // to zone + alg, + dir + ); //- calculate intersection distances //- this is the slowest part of the contact correction @@ -205,43 +207,40 @@ dirichletNeumann::dirichletNeumann (mesh.boundaryMesh()[slavePatchID()].nPoints(), 0.0); label numCorrectedPoints = 0; if (distanceMethod_ == "point") - { + { // pointDistanceToIntersection() sometimes gives a seg fault when the // momentum equation diverges - globalSlavePointPenetration - = masterToSlavePatchToPatchInterpolator.pointDistanceToIntersection(); + globalSlavePointPenetration = + masterToSlavePatchToPatchInterpolator.pointDistanceToIntersection(); // get local point values from global values forAll(slavePointPenetration, pointI) - { - // the local point values seem to be kept at the start - // of the global field - slavePointPenetration[pointI] = - globalSlavePointPenetration - [ - pointI - ]; + { + // the local point values seem to be kept at the start + // of the global field + slavePointPenetration[pointI] = + globalSlavePointPenetration[pointI]; - //- 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 - if (limitPenetration_) - { - if (slavePointPenetration[pointI] < penetrationLimit_) - { - slavePointPenetration[pointI] = 0.0; - } - } - } + //- when the master surface surrounds the slave (like the pelvis and + // femur head) then + //- the slave penetration can sometimes calculate the distance through + // the femur head + //- to the pelvis which is wrong so I limit slavePenetration here + if (limitPenetration_) + { + if (slavePointPenetration[pointI] < penetrationLimit_) + { + slavePointPenetration[pointI] = 0.0; + } + } + } if (correctMissedVertices_) - { - scalarField& slavePointPenetration_ = slavePointPenetration; + { + scalarField& slavePointPenetration_ = slavePointPenetration; # include "iterativePenaltyCorrectMissedVertices.H" - } + } minSlavePointPenetration = gMin(globalSlavePointPenetration); @@ -485,7 +484,7 @@ dirichletNeumann::dirichletNeumann // remove tengential component slaveDisp_ = slaveFaceNormals*(slaveFaceNormals & slaveDisp_); - //--------Try to remove any oscillations----------// + //--------Try to remove any oscillations----------// if (oscillationCorr_) { if (smoothingSteps_ < 1) @@ -502,15 +501,16 @@ dirichletNeumann::dirichletNeumann (mesh.boundaryMesh()[slavePatchIndex].nPoints(), vector::zero); for (int i=0; i(slaveDisp_); - slaveDisp_ = - localSlaveInterpolator.pointToFaceInterpolate(slaveDispPoints); + { + slaveDispPoints = + localSlaveInterpolator.faceToPointInterpolate(slaveDisp_); - // make sure no tangential component - slaveDisp_ = slaveFaceNormals*(slaveFaceNormals & slaveDisp_); - } + slaveDisp_ = localSlaveInterpolator.pointToFaceInterpolate + (slaveDispPoints); + + // make sure no tangential component + slaveDisp_ = slaveFaceNormals*(slaveFaceNormals & slaveDisp_); + } } @@ -530,66 +530,80 @@ dirichletNeumann::dirichletNeumann // calculate current slave traction { - const fvPatch& slavePatch = mesh.boundary()[slavePatchIndex]; - const fvPatchField& gradField = - slavePatch.lookupPatchField - ("grad("+fieldName+")"); - slavePressure_ = tractionBoundaryGradient().traction + const fvPatch& slavePatch = mesh.boundary()[slavePatchIndex]; + const fvPatchField& gradField = + slavePatch.lookupPatchField + ( + "grad(" + fieldName + ")" + ); + + bool incremental(fieldName == "DU"); + + slavePressure_ = tractionBoundaryGradient::traction ( - gradField, - fieldName, - slavePatch, - orthotropic, - nonLinear - ); + gradField, + fieldName, + "U", + slavePatch, + orthotropic, + nonLinearGeometry::nonLinearNames_[nonLinear], + incremental + ); - // set traction to zero on faces not in contact - // and set tensile stresses to zero - //const scalar maxMagSlavePressure = gMax(mag(slavePressure_)); - scalar maxMagSlavePressure = 0.0; - if (slavePressure_.size() > 0) - { - maxMagSlavePressure = max(mag(slavePressure_)); - } - reduce(maxMagSlavePressure, maxOp()); - - forAll(touchFraction_, facei) + // set traction to zero on faces not in contact + // and set tensile stresses to zero + //const scalar maxMagSlavePressure = gMax(mag(slavePressure_)); + scalar maxMagSlavePressure = 0.0; + if (slavePressure_.size() > 0) { - if (touchFraction_[facei] < SMALL - || - ( (slaveFaceNormals[facei] & slavePressure_[facei]) - > 1e-3*maxMagSlavePressure) - ) - { - slavePressure_[facei] = vector::zero; - slaveValueFrac_[facei] = symmTensor::zero; - slaveDisp_[facei] = - slaveFaceNormals[facei] - *(slaveFaceNormals[facei]&oldSlaveDisp[facei]); - } + maxMagSlavePressure = max(mag(slavePressure_)); } + reduce(maxMagSlavePressure, maxOp()); - // relax traction - slavePressure_ = - relaxFactor_*slavePressure_ + (1-relaxFactor_)*oldSlavePressure_; - - // remove any shears - slavePressure_ = slaveFaceNormals*(slaveFaceNormals & slavePressure_); - - // limit pressure to help convergence - if (limitPressure_) + forAll(touchFraction_, facei) { - forAll(slavePressure_, facei) - { - if ( (slaveFaceNormals[facei]&slavePressure_[facei]) < -pressureLimit_) + if + ( + touchFraction_[facei] < SMALL + || ( + (slaveFaceNormals[facei] & slavePressure_[facei]) + > 1e-3*maxMagSlavePressure + ) + ) { - slavePressure_[facei] = -pressureLimit_*slaveFaceNormals[facei]; + slavePressure_[facei] = vector::zero; + slaveValueFrac_[facei] = symmTensor::zero; + slaveDisp_[facei] = slaveFaceNormals[facei] + *(slaveFaceNormals[facei]&oldSlaveDisp[facei]); } } + + // relax traction + slavePressure_ = + relaxFactor_*slavePressure_ + (1-relaxFactor_)*oldSlavePressure_; + + // remove any shears + slavePressure_ = slaveFaceNormals*(slaveFaceNormals & slavePressure_); + + // limit pressure to help convergence + if (limitPressure_) + { + forAll(slavePressure_, facei) + { + if + ( + (slaveFaceNormals[facei] & slavePressure_[facei]) + < -pressureLimit_ + ) + { + slavePressure_[facei] = + -pressureLimit_*slaveFaceNormals[facei]; + } + } } - // update old slave traction - oldSlavePressure_ = slavePressure_; + // update old slave traction + oldSlavePressure_ = slavePressure_; } // in parallel, the log is poluted with warnings that @@ -604,36 +618,36 @@ dirichletNeumann::dirichletNeumann } reduce(maxMagMasterTraction, maxOp()); - // under-relax value fraction - slaveValueFrac_ = - relaxFactor_*slaveValueFrac_ + (1-relaxFactor_)*oldSlaveValueFrac_; - oldSlaveValueFrac_ = slaveValueFrac_; + // under-relax value fraction + slaveValueFrac_ = + relaxFactor_*slaveValueFrac_ + (1-relaxFactor_)*oldSlaveValueFrac_; + oldSlaveValueFrac_ = slaveValueFrac_; - //--------MASTER PROCS WRITES CONTACT INFO FILE----------// - if (Pstream::master() && (contactIterNum_ % infoFreq_ == 0)) - { - OFstream& contactFile = *contactFilePtr_; - int width = 20; - contactFile << mesh.time().value(); - contactFile.width(width); - contactFile << contactIterNum_; - contactFile.width(width); - contactFile << numSlaveContactFaces; - contactFile.width(width); - contactFile << numSlaveSettledFaces; - contactFile.width(width); - contactFile << minSlavePointPenetration; - contactFile.width(width); - contactFile << maxMagMasterTraction; - contactFile.width(width); - contactFile << numCorrectedPoints; - if (aitkenRelaxation_) - { - contactFile.width(width); - contactFile << aitkenTheta_; - } - contactFile << endl; - } + //--------MASTER PROCS WRITES CONTACT INFO FILE----------// + if (Pstream::master() && (contactIterNum_ % infoFreq_ == 0)) + { + OFstream& contactFile = *contactFilePtr_; + int width = 20; + contactFile << mesh.time().value(); + contactFile.width(width); + contactFile << contactIterNum_; + contactFile.width(width); + contactFile << numSlaveContactFaces; + contactFile.width(width); + contactFile << numSlaveSettledFaces; + contactFile.width(width); + contactFile << minSlavePointPenetration; + contactFile.width(width); + contactFile << maxMagMasterTraction; + contactFile.width(width); + contactFile << numCorrectedPoints; + if (aitkenRelaxation_) + { + contactFile.width(width); + contactFile << aitkenTheta_; + } + contactFile << endl; + } //Info << "\tdone" << endl; } diff --git a/src/solidModels/fvPatchFields/fixedDisplacementOrSolidTraction/fixedDisplacementOrSolidTractionFvPatchVectorField.C b/src/solidModels/fvPatchFields/fixedDisplacementOrSolidTraction/fixedDisplacementOrSolidTractionFvPatchVectorField.C index cbafb9380..43854a1b2 100644 --- a/src/solidModels/fvPatchFields/fixedDisplacementOrSolidTraction/fixedDisplacementOrSolidTractionFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/fixedDisplacementOrSolidTraction/fixedDisplacementOrSolidTractionFvPatchVectorField.C @@ -200,21 +200,22 @@ void fixedDisplacementOrSolidTractionFvPatchVectorField::updateCoeffs() if ( mag(timeSeries_(this->db().time().timeOutputValue())) < SMALL) { - // traction boundary + // traction boundary - // set valueFraction to zero - this->valueFraction() = symmTensor::zero; + // set valueFraction to zero + this->valueFraction() = symmTensor::zero; - // set gradient to enfore specified traction - refGrad() = tractionBoundaryGradient() - ( - traction_, - pressure_, - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + // set gradient to enfore specified traction + refGrad() = tractionBoundaryGradient::snGrad + ( + traction_, + pressure_, + fieldName_, + "U", + patch(), + orthotropic_, + nonLinearGeometry::nonLinearNames_[nonLinear_] + ); } else { diff --git a/src/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C b/src/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C index 323443ee1..d48138e28 100644 --- a/src/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/fixedDisplacementZeroShear/fixedDisplacementZeroShearFvPatchVectorField.C @@ -130,31 +130,32 @@ fixedDisplacementZeroShearFvPatchVectorField << "non-orthogonal correction to be right" << endl; } - this->refGrad() = vector::zero; + this->refGrad() = vector::zero; - vectorField n = patch().nf(); - this->valueFraction() = sqr(n); + vectorField n = patch().nf(); + this->valueFraction() = sqr(n); - if (dict.found("value")) + if (dict.found("value")) { - Field::operator=(vectorField("value", dict, p.size())); + Field::operator=(vectorField("value", dict, p.size())); } - else + else { - FatalError << "value entry not found for patch " << patch().name() - << exit(FatalError); + FatalError << "value entry not found for patch " << patch().name() + << exit(FatalError); } - this->refValue() = *this; - Field normalValue = transform(valueFraction(), refValue()); + this->refValue() = *this; - Field gradValue = - this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); + Field normalValue = transform(valueFraction(), refValue()); - Field transformGradValue = - transform(I - valueFraction(), gradValue); + Field gradValue = + this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); - Field::operator=(normalValue + transformGradValue); + Field transformGradValue = + transform(I - valueFraction(), gradValue); + + Field::operator=(normalValue + transformGradValue); } @@ -223,15 +224,19 @@ void fixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() // this->valueFraction() = sqr(nCurrent); // } - refGrad() = tractionBoundaryGradient() - ( - vectorField(patch().size(), vector::zero), - scalarField(patch().size(), 0.0), - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + bool incremental(fieldName_ == "DU"); + + refGrad() = tractionBoundaryGradient::snGrad + ( + vectorField(patch().size(), vector::zero), + scalarField(patch().size(), 0.0), + fieldName_, + "U", + patch(), + orthotropic_, + nonLinear_, + incremental + ); directionMixedFvPatchVectorField::updateCoeffs(); } diff --git a/src/solidModels/fvPatchFields/fixedDisplacementZeroShearOrSolidTraction/fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField.C b/src/solidModels/fvPatchFields/fixedDisplacementZeroShearOrSolidTraction/fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField.C index e13489cc9..1d9e096f0 100644 --- a/src/solidModels/fvPatchFields/fixedDisplacementZeroShearOrSolidTraction/fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/fixedDisplacementZeroShearOrSolidTraction/fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField.C @@ -201,48 +201,51 @@ void fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField::rmap } -void fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField::updateCoeffs() +void +fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField::updateCoeffs() { if (this->updated()) { return; } - if ( mag(timeSeries_(this->db().time().timeOutputValue())) < SMALL) + if (mag(timeSeries_(this->db().time().timeOutputValue())) < SMALL) { - // traction boundary + // traction boundary - // set valueFraction to zero - this->valueFraction() = symmTensor::zero; + // set valueFraction to zero + this->valueFraction() = symmTensor::zero; - // set gradient to enfore specified traction - refGrad() = tractionBoundaryGradient() - ( - traction_, - pressure_, - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + // set gradient to enfore specified traction + refGrad() = tractionBoundaryGradient::snGrad + ( + traction_, + pressure_, + fieldName_, + "U", + patch(), + orthotropic_, + nonLinearGeometry::nonLinearNames_[nonLinear_] + ); } else - { - // fixed displacement zero shear + { + // fixed displacement zero shear - // set valueFraction to fix normal - this->valueFraction() = sqr(fixedNormal_); + // set valueFraction to fix normal + this->valueFraction() = sqr(fixedNormal_); - // force zero shear stresses - refGrad() = tractionBoundaryGradient() - ( - vectorField(traction_.size(), vector::zero), - scalarField(traction_.size(), 0.0), - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + // force zero shear stresses + refGrad() = tractionBoundaryGradient::snGrad + ( + vectorField(traction_.size(), vector::zero), + scalarField(traction_.size(), 0.0), + fieldName_, + "U", + patch(), + orthotropic_, + nonLinearGeometry::nonLinearNames_[nonLinear_] + ); // set displacement refValue() = displacement_; @@ -256,7 +259,7 @@ void fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField::updateCoeffs() void fixedDisplacementZeroShearOrSolidTractionFvPatchVectorField::write ( Ostream& os - ) const +) const { directionMixedFvPatchVectorField::write(os); os.writeKeyword("nonLinear") diff --git a/src/solidModels/fvPatchFields/solidContact/solidContactFvPatchVectorField.C b/src/solidModels/fvPatchFields/solidContact/solidContactFvPatchVectorField.C index fb05c7eae..e9b2d2c9b 100644 --- a/src/solidModels/fvPatchFields/solidContact/solidContactFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/solidContact/solidContactFvPatchVectorField.C @@ -767,6 +767,8 @@ void solidContactFvPatchVectorField::updateCoeffs() } // set boundary conditions + bool incremental(fieldName_ == "DU"); + if (!master_) { // set refValue, refGrad and valueFraction @@ -778,16 +780,18 @@ void solidContactFvPatchVectorField::updateCoeffs() //refGrad - set traction refGrad() = - tractionBoundaryGradient() + tractionBoundaryGradient::snGrad ( frictionContactModelPtr_->slaveTraction() + normalContactModelPtr_->slavePressure(), scalarField(patch().size(),0.0), - word(fieldName_), + fieldName_, + "U", patch(), orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + nonLinear_, + incremental + ); //valueFraction valueFraction() = @@ -805,32 +809,35 @@ void solidContactFvPatchVectorField::updateCoeffs() { // set to master to traction free if it is rigid refGrad() = - tractionBoundaryGradient() + tractionBoundaryGradient::snGrad ( vectorField(patch().size(),vector::zero), scalarField(patch().size(),0.0), - word(fieldName_), + fieldName_, + "U", patch(), orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + nonLinear_, + incremental + ); } else { - refGrad() = - tractionBoundaryGradient() + refGrad() = tractionBoundaryGradient::snGrad + ( + interpolateSlaveToMaster ( - interpolateSlaveToMaster - ( - -frictionContactModelPtr_->slaveTraction() - -normalContactModelPtr_->slavePressure() - ), - scalarField(patch().size(),0.0), - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + -frictionContactModelPtr_->slaveTraction() + -normalContactModelPtr_->slavePressure() + ), + scalarField(patch().size(),0.0), + fieldName_, + "U", + patch(), + orthotropic_, + nonLinear_, + incremental + ); } } } // if correction freqeuncy @@ -840,28 +847,33 @@ void solidContactFvPatchVectorField::updateCoeffs() else { // set refGrad to traction free for master and slave + bool incremental(fieldName_ == "DU"); + refGrad() = - tractionBoundaryGradient() + tractionBoundaryGradient::snGrad ( vectorField(patch().size(),vector::zero), scalarField(patch().size(),0.0), - word(fieldName_), + fieldName_, + "U", patch(), orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + nonLinear_, + incremental + ); } directionMixedFvPatchVectorField::updateCoeffs(); } + // Interpolate traction from slave to master tmp solidContactFvPatchVectorField::interpolateSlaveToMaster ( const vectorField slaveField ) { - if (!master_) + if (!master_) { FatalError << "only the master may call the function " @@ -1315,85 +1327,96 @@ snGrad() const //- Increment of dissipated energy due to friction tmp solidContactFvPatchVectorField::Qc() const { - tmp tQc(new scalarField(patch().size(), 0.0)); - scalarField& Qc = tQc(); + tmp tQc(new scalarField(patch().size(), 0.0)); + scalarField& Qc = tQc(); - // Integrate energy using trapezoidal rule - // 0.5*averageForce*incrementOfDisplacement + // Integrate energy using trapezoidal rule + // 0.5*averageForce*incrementOfDisplacement - // displacement increment - const vectorField& curDU = *this; + // displacement increment + const vectorField& curDU = *this; - // average force - const fvPatchField& gradField = - patch().lookupPatchField("grad("+fieldName_+")"); - // current Cauchy traction for nonlinear - const vectorField curTrac = - tractionBoundaryGradient().traction - ( - gradField, - fieldName_, - patch(), - orthotropic_, - word(nonLinearGeometry::nonLinearNames_[nonLinear_]) - ); + // average force + const fvPatchField& gradField = + patch().lookupPatchField + ( + "grad(" + fieldName_ + ")" + ); - vectorField Sf = patch().Sf(); - if (nonLinear_ != nonLinearGeometry::OFF - && nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN) + // current Cauchy traction for nonlinear + bool incremental(fieldName_ == "DU"); + + const vectorField curTrac = + tractionBoundaryGradient::traction + ( + gradField, + fieldName_, + "U", + patch(), + orthotropic_, + nonLinear_, + incremental + ); + + vectorField Sf = patch().Sf(); + if + ( + nonLinear_ != nonLinearGeometry::OFF + && nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN + ) { - // current areas - const fvPatchField& gradU = - patch().lookupPatchField("grad(U)"); - tensorField F = I + gradField + gradU; - tensorField Finv = inv(F); - scalarField J = det(F); - Sf = J*(Finv & Sf); - } - const scalarField magSf = mag(Sf); - - const vectorField curForce = magSf * curTrac; - - const fvPatchField& oldSigma = - patch().lookupPatchField("sigma_0"); - - vectorField oldSf = patch().Sf(); - if (nonLinear_ != nonLinearGeometry::OFF) - { - // current areas - //tensorField F = I + gradField; - if (nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN) - { - const fvPatchField& gradU = + // current areas + const fvPatchField& gradU = patch().lookupPatchField("grad(U)"); - tensorField F = I + gradU; - tensorField Finv = inv(F); - scalarField J = det(F); - // rotate initial reference area to area of previous time-step - oldSf = J*(Finv & Sf); - } - else if (nonLinear_ == nonLinearGeometry::UPDATED_LAGRANGIAN) + tensorField F = I + gradField + gradU; + tensorField Finv = inv(F); + scalarField J = det(F); + Sf = J*(Finv & Sf); + } + const scalarField magSf = mag(Sf); + + const vectorField curForce = magSf*curTrac; + + const fvPatchField& oldSigma = + patch().lookupPatchField("sigma_0"); + + vectorField oldSf = patch().Sf(); + if (nonLinear_ != nonLinearGeometry::OFF) + { + // current areas + //tensorField F = I + gradField; + if (nonLinear_ == nonLinearGeometry::TOTAL_LAGRANGIAN) { - tensorField F = I + gradField; - tensorField Finv = inv(F); - scalarField J = det(F); - // rotate current area to area of previous time-step - oldSf = (F & Sf)/J; + const fvPatchField& gradU = + patch().lookupPatchField("grad(U)"); + tensorField F = I + gradU; + tensorField Finv = inv(F); + scalarField J = det(F); + // rotate initial reference area to area of previous time-step + oldSf = J*(Finv & Sf); } - else + else if (nonLinear_ == nonLinearGeometry::UPDATED_LAGRANGIAN) { - FatalError << "solidContact::Qc() nonLinear type not known!" - << exit(FatalError); + tensorField F = I + gradField; + tensorField Finv = inv(F); + scalarField J = det(F); + // rotate current area to area of previous time-step + oldSf = (F & Sf)/J; + } + else + { + FatalError << "solidContact::Qc() nonLinear type not known!" + << exit(FatalError); } } - const vectorField oldForce = oldSf & oldSigma; - const vectorField avForce = 0.5*(oldForce + curForce); + const vectorField oldForce = oldSf & oldSigma; + const vectorField avForce = 0.5*(oldForce + curForce); - // Increment of dissiptaed frictional energy for this timestep - Qc = mag(0.5*(avForce & curDU)); + // Increment of dissiptaed frictional energy for this timestep + Qc = mag(0.5*(avForce & curDU)); - return tQc; + return tQc; } diff --git a/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C b/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C index 1746fda7f..591902529 100644 --- a/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.C @@ -210,15 +210,19 @@ void solidTractionFvPatchVectorField::updateCoeffs() return; } - gradient() = tractionBoundaryGradient() - ( - traction_, - pressure_, - word(fieldName_), - patch(), - orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + bool incremental(fieldName_ == "DU"); + + gradient() = tractionBoundaryGradient::snGrad + ( + traction_, + pressure_, + fieldName_, + "U", + patch(), + orthotropic_, + nonLinear_, + incremental + ); fixedGradientFvPatchVectorField::updateCoeffs(); } @@ -243,14 +247,14 @@ void solidTractionFvPatchVectorField::evaluate(const Pstream::commsTypes) //- non-orthogonal correction vectors vectorField k = delta - n*(n&delta); - Field::operator= + vectorField::operator= ( this->patchInternalField() + (k&gradField.patchInternalField()) + gradient()/this->patch().deltaCoeffs() ); - fvPatchField::evaluate(); + fvPatchVectorField::evaluate(); } // Write diff --git a/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H b/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H index f939ac5f7..ccb8a64c7 100644 --- a/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H +++ b/src/solidModels/fvPatchFields/solidTraction/solidTractionFvPatchVectorField.H @@ -53,7 +53,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class solidTractionFvPatchVectorField Declaration + Class solidTractionFvPatchVectorField Declaration \*---------------------------------------------------------------------------*/ class solidTractionFvPatchVectorField diff --git a/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C b/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C index 4381bd73f..889a5dc05 100644 --- a/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.C @@ -75,9 +75,9 @@ solidTractionFreeFvPatchVectorField if (dict.found("nonLinear")) { nonLinear_ = nonLinearGeometry::nonLinearNames_.read - ( - dict.lookup("nonLinear") - ); + ( + dict.lookup("nonLinear") + ); if (nonLinear_ == nonLinearGeometry::UPDATED_LAGRANGIAN) { @@ -191,15 +191,19 @@ void solidTractionFreeFvPatchVectorField::updateCoeffs() return; } - gradient() = tractionBoundaryGradient() + bool incremental(fieldName_ == "DU"); + + gradient() = tractionBoundaryGradient::snGrad ( vectorField(patch().size(), vector::zero), scalarField(patch().size(), 0.0), - word(fieldName_), + fieldName_, + "U", patch(), orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] - )(); + nonLinear_, + incremental + ); fixedGradientFvPatchVectorField::updateCoeffs(); } @@ -226,7 +230,7 @@ void solidTractionFreeFvPatchVectorField::evaluate(const Pstream::commsTypes) Field::operator= ( this->patchInternalField() - + (k&gradField.patchInternalField()) + + (k & gradField.patchInternalField()) + gradient()/this->patch().deltaCoeffs() ); diff --git a/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H b/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H index 1457588d7..740038b58 100644 --- a/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H +++ b/src/solidModels/fvPatchFields/solidTractionFree/solidTractionFreeFvPatchVectorField.H @@ -66,7 +66,7 @@ class solidTractionFreeFvPatchVectorField //- Name of the displacement field const word fieldName_; - //- if it is a non linear solver + //- Is it a non linear solver nonLinearGeometry::nonLinearType nonLinear_; //- Is it an orthropic solver diff --git a/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C b/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C index a02015dfb..5b24a90c2 100644 --- a/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C +++ b/src/solidModels/fvPatchFields/timeVaryingFixedDisplacementZeroShear/timeVaryingFixedDisplacementZeroShearFvPatchVectorField.C @@ -233,14 +233,18 @@ void timeVaryingFixedDisplacementZeroShearFvPatchVectorField::updateCoeffs() //vectorField n = patch().nf(); //this->valueFraction() = sqr(n); - refGrad() = tractionBoundaryGradient() + bool incremental(fieldName_ == "DU"); + + refGrad() = tractionBoundaryGradient::snGrad ( vectorField(patch().size(), vector::zero), scalarField(patch().size(), 0), - word(fieldName_), + fieldName_, + "U", patch(), orthotropic_, - nonLinearGeometry::nonLinearNames_[nonLinear_] + nonLinear_, + incremental ); directionMixedFvPatchVectorField::updateCoeffs(); diff --git a/src/solidModels/nonLinearGeometry/nonLinearGeometry.H b/src/solidModels/nonLinearGeometry/nonLinearGeometry.H index 7a100f693..fce826279 100644 --- a/src/solidModels/nonLinearGeometry/nonLinearGeometry.H +++ b/src/solidModels/nonLinearGeometry/nonLinearGeometry.H @@ -53,7 +53,7 @@ class nonLinearGeometry { public: - //- non-linear solver options + //- Non-linear solver options enum nonLinearType { OFF, diff --git a/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/0/DU b/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/0/DU index 64367517e..a19c42bed 100644 --- a/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/0/DU +++ b/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/0/DU @@ -28,10 +28,10 @@ boundaryField right { - type timeVaryingSolidTraction; - nonLinear off; - outOfBounds clamp; - fileName "$FOAM_CASE/constant/timeVsRightTraction"; + type timeVaryingSolidTraction; + nonLinear off; + outOfBounds clamp; + fileName "$FOAM_CASE/constant/timeVsRightTraction"; } down diff --git a/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/constant/polyMesh/boundary index 8b4279666..1f798d9a7 100644 --- a/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticIncrSolidFoam/incrPlateHole/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/solidMechanics/elasticSolidFoam/plateHole/0/U b/tutorials/solidMechanics/elasticSolidFoam/plateHole/0/U index 6dcdc00d9..5f1a3c347 100644 --- a/tutorials/solidMechanics/elasticSolidFoam/plateHole/0/U +++ b/tutorials/solidMechanics/elasticSolidFoam/plateHole/0/U @@ -27,19 +27,20 @@ boundaryField } right { - type analyticalPlateHoleTraction; +// type analyticalPlateHoleTraction; + type solidTraction; + traction uniform (0 0 0); + pressure uniform 1e7; } - down { type symmetryPlane; } - up { - type analyticalPlateHoleTraction; +// type analyticalPlateHoleTraction; + type solidTractionFree; } - hole { type solidTractionFree; diff --git a/tutorials/solidMechanics/elasticSolidFoam/plateHole/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticSolidFoam/plateHole/constant/polyMesh/boundary index 8b4279666..1f798d9a7 100644 --- a/tutorials/solidMechanics/elasticSolidFoam/plateHole/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticSolidFoam/plateHole/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ From bb03a935fa8a46ac4498f873aa61264e8ed6a1d8 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Sun, 23 Feb 2014 10:54:20 +0000 Subject: [PATCH 031/197] Solid models update: clean-up --- .../calculateRelativeResidual.H | 3 +- .../elasticIncrSolidFoam/createFields.H | 2 +- .../elasticIncrSolidFoam.C | 5 +- .../readDivDSigmaExpMethod.H | 31 +++-- .../elasticIncrSolidFoam/writeFields.H | 58 ++++---- .../elasticNonLinTLSolidFoam/createFields.H | 6 +- .../elasticNonLinTLSolidFoam.C | 80 +++++------ .../elasticNonLinULSolidFoam/moveMesh.H | 19 +-- .../elasticSolidFoam/aitkenRelaxation.H | 40 +++--- .../elasticSolidFoam/createFields.H | 63 ++++----- .../elasticSolidFoam/elasticSolidFoam.C | 128 +++++++++--------- 11 files changed, 224 insertions(+), 211 deletions(-) diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateRelativeResidual.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateRelativeResidual.H index d5eccd36b..36430dbbb 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateRelativeResidual.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/calculateRelativeResidual.H @@ -16,7 +16,6 @@ ( DU.internalField() - DU.prevIter().internalField() - ) - /magDU + )/magDU ); } diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/createFields.H index 659025e96..c0ec0e32f 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 diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C index cc059029b..4f6a0497f 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) # include "calculateDivDSigmaExp.H" - //- linear momentum equation + // Linear momentum equation fvVectorMatrix DUEqn ( fvm::d2dt2(rho, DU) @@ -127,7 +127,8 @@ int main(int argc, char *argv[]) && ++iCorr < nCorr ); - Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name() + Info<< nl << "Time " << runTime.value() + << ", Solving for " << DU.name() << ", Initial residual = " << initialResidual << ", Final residual = " << solverPerf.initialResidual() << ", Relative residual = " << relativeResidual diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H index c75f4c342..de2a549e7 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,22 @@ -//- how explicit component of sigma is to be calculated -word divDSigmaExpMethod(mesh.solutionDict().subDict("solidMechanics").lookup("divSigmaExp")); -Info << "Selecting divSigmaExp calculation method " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { - FatalError << "divSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } + const dictionary& stressControl = + mesh.solutionDict().subDict("solidMechanics"); + + // Read how explicit component of sigma is to be calculated + word divDSigmaExpMethod(stressControl.lookup("divSigmaExp")); + + Info<< "Selecting divSigmaExp calculation method: " + << divDSigmaExpMethod << endl; + + if + ( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" + ) + { + FatalErrorIn(args.executable()) + << "divSigmaExp method " << divDSigmaExpMethod << " not found! " + << "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..f666ec12b 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/writeFields.H @@ -1,36 +1,34 @@ 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; + 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))) - ); - - Info<< "Max sigmaEq = " << max(sigmaEq).value() - << endl; - + ( + 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; + runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H index 81a6f557f..0a420cee6 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/createFields.H @@ -25,11 +25,11 @@ IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), - mesh, - dimensionedSymmTensor("zero", dimless, symmTensor::zero) + mesh, + dimensionedSymmTensor("zero", dimless, symmTensor::zero) ); - //- second Piola-Kirchhoff stress tensor + //- Second Piola-Kirchhoff stress tensor volSymmTensorField sigma ( IOobject diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C index 749a9e238..c6479e3cd 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C @@ -44,21 +44,21 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" -# include "createFields.H" -# include "createSolidInterfaceNonLin.H" +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" +# include "createFields.H" +# include "createSolidInterfaceNonLin.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nStarting time loop\n" << endl; + Info<< "\nStarting time loop\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readSolidMechanicsControls.H" +# include "readSolidMechanicsControls.H" int iCorr = 0; scalar initialResidual = 0; @@ -70,36 +70,40 @@ int main(int argc, char *argv[]) { U.storePrevIter(); - surfaceTensorField shearGradU = - ((I - n*n)&fvc::interpolate(gradU)); + surfaceTensorField shearGradU + ( + "shearGradU", + (I - sqr(n)) & fvc::interpolate(gradU) + ); fvVectorMatrix UEqn + ( + fvm::d2dt2(rho, U) + == + fvm::laplacian(2*muf + lambdaf, 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)" +// ) + + fvc::div ( - fvm::d2dt2(rho, U) - == - fvm::laplacian(2*muf + lambdaf, 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)" - // ) - + fvc::div( - mesh.magSf() - *( - - (muf + lambdaf)*(fvc::snGrad(U)&(I - n*n)) - + lambdaf*tr(shearGradU&(I - n*n))*n - + muf*(shearGradU&n) - + muf * (n & fvc::interpolate(gradU & gradU.T())) - + 0.5*lambdaf - *(n * tr(fvc::interpolate(gradU & gradU.T()))) - + (n & fvc::interpolate( sigma & gradU )) - ) - ) - ); + mesh.magSf()* + ( + - (muf + lambdaf)*(fvc::snGrad(U) & (I - n*n)) + + lambdaf*tr(shearGradU & (I - n*n))*n + + muf*(shearGradU & n) + + muf*(n & fvc::interpolate(gradU & gradU.T())) + + 0.5*lambdaf*(n*tr(fvc::interpolate(gradU & gradU.T()))) + + (n & fvc::interpolate(sigma & gradU)) + ) + ) + ); if (solidInterfaceCorr) { @@ -153,9 +157,9 @@ int main(int argc, char *argv[]) << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H index 807c713fd..fe91884e1 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/moveMesh.H @@ -1,15 +1,16 @@ 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 +} +else +{ + FatalErrorIn(args.executable()) + << "move mesh method " << moveMeshMethod << " not recognised" << nl << "available methods are:" << nl << "inverseDistance" << nl << "leastSquares" << exit(FatalError); - } +} diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/aitkenRelaxation.H b/applications/solvers/solidMechanics/elasticSolidFoam/aitkenRelaxation.H index e82330f12..779839046 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/aitkenRelaxation.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/aitkenRelaxation.H @@ -1,4 +1,4 @@ -// aitken acceleration +// aitken acceleration aitkenDelta.storePrevIter(); @@ -7,26 +7,26 @@ aitkenDelta = (U - U.prevIter()) / aitkenInitialRes; // update relaxation factor if(iCorr == 0) - { +{ aitkenTheta = 0.1; - } - else - { - vectorField b = aitkenDelta.internalField() - aitkenDelta.prevIter().internalField(); - // scalar sumMagB = gSum(mag(b)); - scalar sumMagB = gSum(magSqr(b)); - if(sumMagB < SMALL) - { - // Warning << "Aitken under-relaxation: denominator less then SMALL" - // << endl; - sumMagB += SMALL; - } - - aitkenTheta = -aitkenTheta* - gSum(aitkenDelta.prevIter().internalField() & b) - / - sumMagB; - } +} +else +{ + vectorField b = aitkenDelta.internalField() + - aitkenDelta.prevIter().internalField(); + + scalar sumMagB = gSum(magSqr(b)); + if(sumMagB < SMALL) + { + // Warning << "Aitken under-relaxation: denominator less then SMALL" + // << endl; + sumMagB += SMALL; + } + + aitkenTheta = -aitkenTheta* + gSum(aitkenDelta.prevIter().internalField() & b)/ + sumMagB; +} // correction to the latest U U += aitkenTheta*aitkenDelta*aitkenInitialRes; diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H index 9e916fb44..c26827227 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticSolidFoam/createFields.H @@ -12,21 +12,20 @@ mesh ); - // volTensorField gradU = fvc::grad(U); volTensorField gradU ( IOobject ( - "grad(U)", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "grad(U)", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedTensor("zero", dimless, tensor::zero) - ); - //surfaceVectorField snGradU = fvc::snGrad(U); + ); + surfaceVectorField snGradU ( IOobject @@ -38,7 +37,7 @@ IOobject::NO_WRITE ), mesh, - dimensionedVector("zero", dimless, vector::zero) + dimensionedVector("zero", dimless, vector::zero) ); volVectorField V @@ -85,19 +84,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", dimForce/dimVolume, vector::zero) - ); + ); constitutiveModel rheology(sigma, U); @@ -127,18 +126,20 @@ // for aitken relaxation volVectorField aitkenDelta - ( - IOobject - ( - "aitkenDelta", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedVector("zero", dimLength, vector::zero) - ); + ( + IOobject + ( + "aitkenDelta", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedVector("zero", dimLength, vector::zero) + ); + + // aitken relaxation factor scalar aitkenInitialRes = 1.0; scalar aitkenTheta = 0.1; diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C index d5977e294..905dc47b0 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; while(runTime.loop()) - { + { Info<< "Time: " << runTime.timeName() << nl << endl; # include "readSolidMechanicsControls.H" @@ -74,84 +74,80 @@ int main(int argc, char *argv[]) lduMatrix::debug = 0; 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 - { - U.storePrevIter(); + { + U.storePrevIter(); # include "calculateDivSigmaExp.H" - // linear momentum equation - fvVectorMatrix UEqn - ( - rho*fvm::d2dt2(U) - == - fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") - + divSigmaExp - ); + // linear momentum equation + fvVectorMatrix UEqn + ( + rho*fvm::d2dt2(U) + == + fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") + + divSigmaExp + ); - if (solidInterfaceCorr) - { - solidInterfacePtr->correct(UEqn); - } + if (solidInterfaceCorr) + { + solidInterfacePtr->correct(UEqn); + } -// if (relaxEqn) -// { -// UEqn.relax(); -// } + solverPerf = UEqn.solve(); - solverPerf = UEqn.solve(); + if (iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + aitkenInitialRes = gMax(mag(U.internalField())); + } - if (iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - aitkenInitialRes = gMax(mag(U.internalField())); - } - - if (aitkenRelax) - { + if (aitkenRelax) + { # include "aitkenRelaxation.H" - } - else - { - U.relax(); - } + } + else + { + U.relax(); + } - gradU = fvc::grad(U); + gradU = fvc::grad(U); # include "calculateRelativeResidual.H" - if (iCorr % infoFrequency == 0) - { - Info<< "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << U.name() - << " using " << solverPerf.solverName() - << ", res = " << solverPerf.initialResidual() - << ", rel res = " << relativeResidual; - if (aitkenRelax) - { - Info<< ", aitken = " << aitkenTheta; - } - Info<< ", inner iters = " << solverPerf.nIterations() << endl; - } - } + if (iCorr % infoFrequency == 0) + { + Info<< "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << U.name() + << " using " << solverPerf.solverName() + << ", res = " << solverPerf.initialResidual() + << ", rel res = " << relativeResidual; + + if (aitkenRelax) + { + Info<< ", aitken = " << aitkenTheta; + } + Info<< ", inner iters = " << solverPerf.nIterations() << endl; + } + } while - ( - iCorr++ == 0 - || - (solverPerf.initialResidual() > convergenceTolerance - //relativeResidual > convergenceTolerance - && - iCorr < nCorr) - ); + ( + iCorr++ == 0 + || ( + solverPerf.initialResidual() > convergenceTolerance + //relativeResidual > convergenceTolerance + && iCorr < nCorr + ) + ); Info<< nl << "Time " << runTime.value() << ", Solving for " << U.name() << ", Initial residual = " << initialResidual @@ -178,9 +174,9 @@ int main(int argc, char *argv[]) << " s\n\n" << endl; } - Info<< "End\n" << endl; + Info<< "End\n" << endl; - return(0); + return(0); } From 6a6c4903f33f20b8181b00835c54fd2530c53f63 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Tue, 25 Feb 2014 18:55:33 +0100 Subject: [PATCH 032/197] Support building Pstream against MVAPICH2 --- etc/bashrc | 2 +- etc/settings.sh | 36 ++++++++++++++++++++++++++++ src/Pstream/Allwmake | 2 +- wmake/rules/linux64Gcc/mplibMVAPICH2 | 0 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 wmake/rules/linux64Gcc/mplibMVAPICH2 diff --git a/etc/bashrc b/etc/bashrc index 6aad1f6ce..323d1a9dc 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -143,7 +143,7 @@ export WM_COMPILER_LIB_ARCH= # WM_COMPILE_OPTION = Opt | Debug | Prof : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION -# WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI +# WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI | MVAPICH2 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB # WM_NCOMPPROCS = diff --git a/etc/settings.sh b/etc/settings.sh index e85bf95e8..6a2bc3c7d 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -333,6 +333,42 @@ SYSTEMOPENMPI) unset mpi_version ;; +MVAPICH2) + mpi_version=mvapich2 + + if [ -n "${MVAPICH2_BIN_DIR}" ] && [ -d "${MVAPICH2_BIN_DIR}" ] + then + _foamAddPath $MVAPICH2_BIN_DIR + else + MVAPICH2_BIN_DIR=$(dirname `which mpicc`) + fi + + if which mpicc >/dev/null + then + mpicc -v 2>/dev/null | grep -q "mpicc for MVAPICH2" || + echo "Warning: `which mpicc` does not appear to be for MVAPICH2" + else + echo "Warning: mpicc not available" + fi + + export MPI_HOME=`dirname $MVAPICH2_BIN_DIR` + export MPI_ARCH_PATH=$MPI_HOME + + export PINC="`mpicc -show -cc= -nativelinking`" + export PLIBS="`mpicc -show -cc= | sed "s%$PINC%%"`" + + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo " Environment variables defined for MVAPICH2:" + echo " MPI_ARCH_PATH : $MPI_ARCH_PATH" + echo " PINC : $PINC" + echo " PLIBS : $PLIBS" + fi + + export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version + unset mpi_version + ;; + MPICH) mpi_version=mpich-1.2.4 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake index a01538cc3..6c4131068 100755 --- a/src/Pstream/Allwmake +++ b/src/Pstream/Allwmake @@ -5,7 +5,7 @@ set -x wmake libso dummy case "$WM_MPLIB" in -*MPI*) +*MPI* | MVAPICH*) set +x echo echo "Note: ignore spurious warnings about missing mpicxx.h headers" diff --git a/wmake/rules/linux64Gcc/mplibMVAPICH2 b/wmake/rules/linux64Gcc/mplibMVAPICH2 new file mode 100644 index 000000000..e69de29bb From b3604684923677379d550e211ab7ec710ca81d47 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Wed, 5 Mar 2014 17:46:16 +0100 Subject: [PATCH 033/197] Add csh bits for MVAPICH2 build support --- etc/cshrc | 2 +- etc/settings.csh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/etc/cshrc b/etc/cshrc index b130f8c75..a565149d4 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -128,7 +128,7 @@ if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt #setenv WM_COMPILE_OPTION Opt #setenv WM_COMPILE_OPTION Debug -# WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI +# WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI | MVAPICH2 if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI # WM_NCOMPPROCS = diff --git a/etc/settings.csh b/etc/settings.csh index 6d3435b38..0b8674384 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -282,6 +282,36 @@ case SYSTEMOPENMPI: unset mpi_version breaksw +case MVAPICH2: + set mpi_version=mvapich2 + + if ($?MVAPICH2_BIN_DIR != 0) then + if (-d "${MVAPICH2_BIN_DIR}" ) then + _foamAddPath $MVAPICH2_BIN_DIR + endif + else + set mpicc_cmd=`which mpicc` + setenv MVAPICH2_BIN_DIR `dirname $mpicc_cmd` + unset mpicc_cmd + endif + + setenv MPI_HOME `dirname $MVAPICH2_BIN_DIR` + setenv MPI_ARCH_PATH $MPI_HOME + + setenv PINC "`mpicc -show -cc= -nativelinking`" + setenv PLIBS "`mpicc -show -cc= | sed "s%$PINC%%"`" + + if ($?FOAM_VERBOSE && $?prompt) then + echo " Environment variables defined for MVAPICH2:" + echo " MPI_ARCH_PATH : $MPI_ARCH_PATH" + echo " PINC : $PINC" + echo " PLIBS : $PLIBS" + endif + + setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version + unset mpi_version + breaksw + case MPICH: set mpi_version=mpich-1.2.4 setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version From 240d710a6e48661d9590de85563c0dd6c12cecbe Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Thu, 13 Mar 2014 17:52:52 +0100 Subject: [PATCH 034/197] Adaption to new boxes available on vagrantcloud.com (use vagrant 1.5) --- vagrantSandbox/README | 16 ++++++-- vagrantSandbox/Vagrantfile | 51 ++++++++++++++++---------- vagrantSandbox/initCentOSRHELScript.sh | 5 ++- vagrantSandbox/initGeneralScript.sh | 5 +++ 4 files changed, 52 insertions(+), 25 deletions(-) diff --git a/vagrantSandbox/README b/vagrantSandbox/README index 41d8b0f16..367925f24 100644 --- a/vagrantSandbox/README +++ b/vagrantSandbox/README @@ -3,7 +3,10 @@ * Prerequisites These virtual machines require - VirtualBox :: for running from [[https://www.virtualbox.org]] - - Vagrant :: to automatically set them up from [[http://www.vagrantup.com]] + - Vagrant :: to automatically set them up from + [[http://www.vagrantup.com]] Make sure that you have at + least version 1.5 to be able to use the base boxes from + https://vagrantcloud.com/ To make sure that for the boxes the have the newest VirtualBox-additions do : vagrant plugin install vagrant-vbguest @@ -31,7 +34,7 @@ doing * Virtual machines Currently existing virtual machines are - - precise :: Latest LTS Ubuntu. + - precise :: Latest LTS Ubuntu. Currently the default machine to use - lucid :: Previous LTS Ubuntu. Currently problems with automatic setting up (something with the =postfix=-package) @@ -39,8 +42,13 @@ =lucid=-machine. Not yet working - centos65 :: A CentOS 6.5 machine with preinstalled development tools - - freebsd92 :: FreeBSD 9.2 32-bit machine. Does not work because - FreeBSD does not support shared folders + - freebsd92 :: FreeBSD 9.2 64-bit machine. Currently this machine + does not provision automatically. After the first + failure log in and do +: sudo pkg_add -r rsync +: sudo pkg_add -r bash + then halt the machine and bring it up again (with the + =--provision=-option) - freebsd10 :: FreeBSD 10.0 32-big machine. Tries to set up shared folders via NFS. Currently not working - opensuse12 :: OpenSUSE 12.3 machine. Currently not completely diff --git a/vagrantSandbox/Vagrantfile b/vagrantSandbox/Vagrantfile index 081f8ab5b..d3b3eedd4 100644 --- a/vagrantSandbox/Vagrantfile +++ b/vagrantSandbox/Vagrantfile @@ -12,6 +12,28 @@ Vagrant.configure("2") do |config| vb.customize ["modifyvm", :id, "--memory", "1024"] end + # default + config.vm.define :precise do |precise| + precise.vm.box = "hashicorp/precise64" + precise.vm.box_check_update = true + # precise.vm.box_url = "http://files.vagrantup.com/precise64.box" + precise.vm.provision :shell do |s| + s.args = "precise" + s.path = "initUbunutuScript.sh" + end + end + + config.vm.define :centos65 do |centos65| + centos65.vm.box = "chef/centos-6.5" + centos65.vm.box_check_update = true + # centos65.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" + centos65.vm.provision :shell do |s| + s.args = "centos65" + s.path = "initCentOSRHELScript.sh" + end + end + + # legacy config.vm.define :lucid do |lucid| lucid.vm.box = "lucid64" lucid.vm.box_url = "http://files.vagrantup.com/lucid64.box" @@ -21,6 +43,7 @@ Vagrant.configure("2") do |config| end end + #legacy config.vm.define :maverick do |maverick| maverick.vm.box = "maverick64" maverick.vm.box_url = "http://mathie-vagrant-boxes.s3.amazonaws.com/maverick64.box" @@ -30,34 +53,21 @@ Vagrant.configure("2") do |config| end end - config.vm.define :precise do |precise| - precise.vm.box = "precise64" - precise.vm.box_url = "http://files.vagrantup.com/precise64.box" - precise.vm.provision :shell do |s| - s.args = "precise" - s.path = "initUbunutuScript.sh" - end - end - - config.vm.define :centos65 do |centos65| - centos65.vm.box = "centos65" - centos65.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" - centos65.vm.provision :shell do |s| - s.args = "centos65" - s.path = "initCentOSRHELScript.sh" - end - end - + # experimental config.vm.define :freebsd92 do |freebsd92| - freebsd92.vm.box = "freebsd92" + freebsd92.vm.box = "chef/freebsd-9.2" + freebsd92.vm.box_check_update = true # freebsd92.vm.box_url = "https://wunki.org/files/freebsd-9.2-amd64-wunki.box" - freebsd92.vm.box_url = "http://iris.hosting.lv/freebsd-9.2-i386.box" +# freebsd92.vm.box_url = "http://iris.hosting.lv/freebsd-9.2-i386.box" freebsd92.vm.provision :shell do |s| s.args = "freebsd92" s.path = "initFreeBSDScript.sh" end + freebsd92.vm.synced_folder "..", "/FOAM-sources", type: "rsync", rsync__exclude: "vagrantSandbox/" + freebsd92.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: "ccache4vm/" end + # legacy/experimental config.vm.define :freebsd10 do |freebsd10| freebsd10.vm.box = "freebsd10" # freebsd10.vm.box_url = "https://wunki.org/files/freebsd-10.0-amd64-wunki.box" @@ -78,6 +88,7 @@ Vagrant.configure("2") do |config| freebsd10.vm.synced_folder "..", "/FOAM-sources", :nfs => true end + # legacy config.vm.define :opensuse12 do |opensuse12| opensuse12.vm.box = "opensuse12" opensuse12.vm.box_url = "http://sourceforge.net/projects/opensusevagrant/files/12.3/opensuse-12.3-64.box/download" diff --git a/vagrantSandbox/initCentOSRHELScript.sh b/vagrantSandbox/initCentOSRHELScript.sh index b96b1f71e..4aca9927e 100755 --- a/vagrantSandbox/initCentOSRHELScript.sh +++ b/vagrantSandbox/initCentOSRHELScript.sh @@ -6,9 +6,12 @@ echo echo "Init script for $boxName" echo +echo "Install the EPEL-repository for additional software" +rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm + # some of these packages are already installed. But lets be sure -neededPackages=(gcc-g++ mercurial git flex bison make ccache rpm-build wget zlib-devel binutils-devel) +neededPackages=(gcc-c++ gcc-gfortran mercurial git flex bison make ccache rpm-build wget zlib-devel binutils-devel) bonusPackages=(emacs csh tcsh zsh) for p in ${neededPackages[@]}; do diff --git a/vagrantSandbox/initGeneralScript.sh b/vagrantSandbox/initGeneralScript.sh index 672f49af0..0a0025808 100755 --- a/vagrantSandbox/initGeneralScript.sh +++ b/vagrantSandbox/initGeneralScript.sh @@ -37,8 +37,12 @@ then then echo echo "Parent is git" + echo "Cloning. This may take some time" echo + + # su -c not correctly working on FreeBSD su vagrant - -c "git clone $OFParent $OFClone" + echo echo "Git cloned: TODO: set same branch as parent" echo @@ -52,6 +56,7 @@ then # sed removes + in case of a 'tainted' parent echo "Parent is on id $idName" + echo "Cloning. This may take some time" su vagrant - -c "hg clone -u $idName $OFParent $OFClone" echo else From d1d83c21f45ab27c1c7be627232b92b39956481c Mon Sep 17 00:00:00 2001 From: Bernhard Gschaider Date: Thu, 13 Mar 2014 18:33:45 +0100 Subject: [PATCH 035/197] Changes necessary for FreeBSD --- vagrantSandbox/initFreeBSDScript.sh | 4 ++-- vagrantSandbox/initGeneralScript.sh | 2 +- vagrantSandbox/skel/bootstrapFoam.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vagrantSandbox/initFreeBSDScript.sh b/vagrantSandbox/initFreeBSDScript.sh index 48f738557..a5c0514ec 100755 --- a/vagrantSandbox/initFreeBSDScript.sh +++ b/vagrantSandbox/initFreeBSDScript.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /usr/bin/env bash boxName=$1 @@ -8,7 +8,7 @@ echo pkg install -fy virtualbox-ose-additions -neededPackages=(mercurial git flex bison ccache rpm wget) +neededPackages=(mercurial git flex bison ccache rpm4 wget) bonusPackages=(emacs24 zsh) for p in ${neededPackages[@]}; do diff --git a/vagrantSandbox/initGeneralScript.sh b/vagrantSandbox/initGeneralScript.sh index 0a0025808..2dcc0af87 100755 --- a/vagrantSandbox/initGeneralScript.sh +++ b/vagrantSandbox/initGeneralScript.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /usr/bin/env bash echo echo "Copying stuff from skeleton" diff --git a/vagrantSandbox/skel/bootstrapFoam.sh b/vagrantSandbox/skel/bootstrapFoam.sh index c589bb4cc..8bbd921b7 100755 --- a/vagrantSandbox/skel/bootstrapFoam.sh +++ b/vagrantSandbox/skel/bootstrapFoam.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /usr/bin/env bash # Just to be sure export WM_SCHEDULER=ccache From a3b9ee8fac50db3decf0715003e3f05dcb819923 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:45:26 +0100 Subject: [PATCH 036/197] Update and clean-up of solid mechanics --- applications/solvers/solidMechanics/Allwmake | 2 + .../solidMechanics/deprecatedSolvers/Allwmake | 2 - .../stressFemFoam/calculateStress.H | 53 ------ .../calculateDEpsilonDSigma.H | 4 +- .../calculateDivDSigmaExp.H | 101 +++++----- .../calculateDivDSigmaNonLinExp.H | 103 ++++++---- .../elasticPlasticNonLinTLSolidFoam.C | 178 +++++++++--------- .../readDivDSigmaExpMethod.H | 25 ++- .../writeFields.H | 159 ++++++++-------- .../stressFemFoam/Make/files | 0 .../stressFemFoam/Make/options | 0 .../stressFemFoam/calculateStress.H | 120 ++++++++++++ .../stressFemFoam/createFemFields.H | 0 .../stressFemFoam/createFemMesh.H | 0 .../stressFemFoam/createFields.H | 0 .../Traction/TractionPointPatchVectorField.C | 13 +- .../Traction/TractionPointPatchVectorField.H | 0 .../tractionTetPolyPatchVectorField.C | 0 .../tractionTetPolyPatchVectorField.H | 0 .../stressFemFoam/readControls.H | 0 .../stressFemFoam/readMechanicalProperties.H | 0 .../stressFemFoam/stressFemFoam.C | 4 +- .../stressFemFoam/Allclean | 0 .../stressFemFoam/Allrun | 0 .../stressFemFoam/plateHole/0/U | 0 .../plateHole/constant/mechanicalProperties | 0 .../plateHole/constant/polyMesh/blockMeshDict | 60 +++--- .../plateHole/constant/polyMesh/boundary | 2 +- .../plateHole/system/controlDict | 6 +- .../stressFemFoam/plateHole/system/fvSchemes | 0 .../stressFemFoam/plateHole/system/fvSolution | 0 .../plateHole/system/tetFemSolution | 10 +- 32 files changed, 483 insertions(+), 359 deletions(-) delete mode 100644 applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/calculateStress.H rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/Make/files (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/Make/options (100%) create mode 100644 applications/solvers/solidMechanics/stressFemFoam/calculateStress.H rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/createFemFields.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/createFemMesh.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/createFields.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C (96%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/femStress/tractionTetPolyPatchVectorField.C (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/femStress/tractionTetPolyPatchVectorField.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/readControls.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/readMechanicalProperties.H (100%) rename applications/solvers/solidMechanics/{deprecatedSolvers => }/stressFemFoam/stressFemFoam.C (97%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/Allclean (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/Allrun (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/0/U (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/constant/mechanicalProperties (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict (72%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/constant/polyMesh/boundary (96%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/system/controlDict (94%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/system/fvSchemes (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/system/fvSolution (100%) rename tutorials/solidMechanics/{deprecatedTutorials => }/stressFemFoam/plateHole/system/tetFemSolution (86%) diff --git a/applications/solvers/solidMechanics/Allwmake b/applications/solvers/solidMechanics/Allwmake index 7c7dc0f32..58381dd5b 100755 --- a/applications/solvers/solidMechanics/Allwmake +++ b/applications/solvers/solidMechanics/Allwmake @@ -20,5 +20,7 @@ wmake elasticThermalSolidFoam wmake icoFsiElasticNonLinULSolidFoam wmake viscoElasticSolidFoam +wmake stressFemFoam + (cd utilities ; wmake all) (cd deprecatedSolvers ; ./Allwmake) \ No newline at end of file diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/Allwmake b/applications/solvers/solidMechanics/deprecatedSolvers/Allwmake index 1e2a5ecab..612815a04 100755 --- a/applications/solvers/solidMechanics/deprecatedSolvers/Allwmake +++ b/applications/solvers/solidMechanics/deprecatedSolvers/Allwmake @@ -11,8 +11,6 @@ wmake contactStressFoam wmake newStressedFoam wmake newContactStressFoam -wmake stressFemFoam - wmake icoFsiFoam wmake solidDisplacementFoam diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/calculateStress.H b/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/calculateStress.H deleted file mode 100644 index f81f620cb..000000000 --- a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/calculateStress.H +++ /dev/null @@ -1,53 +0,0 @@ - if (runTime.outputTime()) - { - // Displacement gradient - tetPointTensorField gradU = tetFec::grad(U); - - // Stress tensor - tetPointSymmTensorField sigma = - rho*(2.0*mu*symm(gradU) + lambda*I*tr(gradU)); - - // sigmaXX - tetPointScalarField sigmaXX - ( - IOobject - ( - "sigmaXX", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sigma.component(symmTensor::XX) - ); - - // sigmaYY - tetPointScalarField sigmaYY - ( - IOobject - ( - "sigmaYY", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sigma.component(symmTensor::YY) - ); - - // sigmaXY - tetPointScalarField sigmaXY - ( - IOobject - ( - "sigmaXY", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - sigma.component(symmTensor::XY) - ); - - runTime.write(); - } diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDEpsilonDSigma.H b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDEpsilonDSigma.H index dd03be9eb..50b2d2e95 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDEpsilonDSigma.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDEpsilonDSigma.H @@ -1,5 +1,5 @@ -//- Increment of Green finite strain tensor +// Increment of Green finite strain tensor DEpsilon = symm(gradDU) + 0.5*symm((gradDU & gradU.T()) + (gradU & gradDU.T()) + (gradDU & gradDU.T())); -//- Increment of second Piola-Kirchhoff stress tensor +// Increment of second Piola-Kirchhoff stress tensor DSigma = 2*mu*(DEpsilon - DEpsilonP) + lambda*(I*tr(DEpsilon)); diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaExp.H b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaExp.H index c938e46ed..831730cf9 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaExp.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaExp.H @@ -1,45 +1,46 @@ 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( - mesh.magSf() - *( - muf*(n&fvc::interpolate(gradDU.T())) - + lambdaf*tr(fvc::interpolate(gradDU))*n - - (muf + lambdaf)*(n&fvc::interpolate(gradDU)) - ) - ); + ( + (mu*gradDU.T()) + + (lambda*(I*tr(gradDU))) + - ((mu + lambda)*gradDU), + "div(sigma)" + ); +} +else if(divDSigmaExpMethod == "surface") +{ + divDSigmaExp = fvc::div + ( + mesh.magSf()* + ( + muf*(n & fvc::interpolate(gradDU.T())) + + lambdaf*tr(fvc::interpolate(gradDU))*n + - (muf + lambdaf)*(n & fvc::interpolate(gradDU)) + ) + ); + // 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)); +} +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) - ) - ); + divDSigmaExp = fvc::div + ( + mesh.magSf()* + ( + - (muf + lambdaf)*(fvc::snGrad(DU) & (I - n*n)) + + lambdaf*tr(shearGradDU & (I - n*n))*n + + muf*(shearGradDU & n) + ) + ); + // divDSigmaExp = fvc::div // ( // mesh.magSf() @@ -49,19 +50,21 @@ if(divDSigmaExpMethod == "standard") // + 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; - } +} +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 +{ + FatalErrorIn(args.executable()) + << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" + << abort(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaNonLinExp.H b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaNonLinExp.H index 535509f4e..d95d0c730 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaNonLinExp.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/calculateDivDSigmaNonLinExp.H @@ -1,32 +1,69 @@ if(divDSigmaNonLinExpMethod == "standard") - { +{ divDSigmaNonLinExp = fvc::div - ( - ( mu * ( - (gradDU & gradU.T()) - + (gradU & gradDU.T()) - + (gradDU & gradDU.T()) - ) ) - + ( lambda * 0.5 * tr( (gradDU & gradU.T()) - + (gradU & gradDU.T()) - + (gradDU & gradDU.T()) - ) * I ) - + ( DSigma & gradU ) - + ( (sigma + DSigma) & gradDU ), - "div(sigma)" - ); - } - else if(divDSigmaNonLinExpMethod == "surface") - { - divDSigmaNonLinExp = - fvc::div( - mesh.magSf() - *( - ( muf * (n & fvc::interpolate( (gradU & gradDU.T()) + (gradDU & gradU.T()) + (gradDU & gradDU.T()) )) ) - + ( 0.5*lambdaf * (n * tr(fvc::interpolate( (gradU & gradDU.T()) + (gradDU & gradU.T()) + (gradDU & gradDU.T()) ))) ) - + (n & fvc::interpolate( (DSigma & gradU) + ((sigma + DSigma) & gradDU) )) - ) - ); + ( + ( + mu* + ( + (gradDU & gradU.T()) + + (gradU & gradDU.T()) + + (gradDU & gradDU.T()) + ) + ) + + ( + 0.5*lambda* + tr + ( + (gradDU & gradU.T()) + + (gradU & gradDU.T()) + + (gradDU & gradDU.T()) + )*I + ) + + (DSigma & gradU) + + ((sigma + DSigma) & gradDU), + "div(sigma)" + ); +} +else if(divDSigmaNonLinExpMethod == "surface") +{ + divDSigmaNonLinExp = fvc::div + ( + mesh.magSf()* + ( + ( + muf* + ( + n & fvc::interpolate + ( + (gradU & gradDU.T()) + + (gradDU & gradU.T()) + + (gradDU & gradDU.T()) + ) + ) + ) + + ( + 0.5*lambdaf* + ( + n*tr + ( + fvc::interpolate + ( + (gradU & gradDU.T()) + + (gradDU & gradU.T()) + + (gradDU & gradDU.T()) + ) + ) + ) + ) + + ( + n & fvc::interpolate + ( + (DSigma & gradU) + + ((sigma + DSigma) & gradDU) + ) + ) + ) + ); // divDSigmaNonLinExp = // fvc::div @@ -48,8 +85,10 @@ if(divDSigmaNonLinExpMethod == "standard") // + ( (sigma + DSigma) & gradDU ) // ) ) // ); - } - else - { - FatalError << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" << endl; - } +} +else +{ + FatalErrorIn(args.executable()) + << "divDSigmaExp method " << divDSigmaExpMethod << " not found!" + << abort(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C index 1f2b203a9..5e24bf0be 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C @@ -66,114 +66,116 @@ int main(int argc, char *argv[]) scalar initialResidual = 0; lduMatrix::solverPerformance solverPerf; scalar relativeResidual = GREAT; - lduMatrix::debug=0; + lduMatrix::debug = 0; do - { - DU.storePrevIter(); + { + DU.storePrevIter(); # include "calculateDivDSigmaExp.H" # include "calculateDivDSigmaNonLinExp.H" - // Incremental form of the - // linear momentum conservation - // ensuring conservation of total momentum - fvVectorMatrix DUEqn - ( - fvm::d2dt2(rho, DU) - == - fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") - + divDSigmaExp - + divDSigmaNonLinExp - //- fvc::div(2*mu*DEpsilonP, "div(sigma)") - - fvc::div - ( - 2*muf*( mesh.Sf() & fvc::interpolate(DEpsilonP)) - ) - ); + // Incremental form of the + // linear momentum conservation + // ensuring conservation of total momentum + fvVectorMatrix DUEqn + ( + fvm::d2dt2(rho, DU) + == + fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)") + + divDSigmaExp + + divDSigmaNonLinExp + //- fvc::div(2*mu*DEpsilonP, "div(sigma)") + - fvc::div + ( + 2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP)) + ) + ); - if (largeStrainOverRelax) - { - // the terms (gradDU & gradU.T()) and (gradU & gradDU.T()) - // are linearly dependent of DU and represent initial - // displacement effect - // which can cause convergence difficulties when treated - // explicitly - // so we implicitly over-relax with gradU & gradDU here - // which tends to help convergence - // this should improve convergence when gradU is large - // but maybe not execution time - DUEqn -= - fvm::laplacian - ( - (2*mu + lambda)*gradU, DU, "laplacian(DDU,DU)" - ) - - fvc::div( (2*mu + lambda)*(gradU&gradDU), "div(sigma)"); - } + if (largeStrainOverRelax) + { + // the terms (gradDU & gradU.T()) and (gradU & gradDU.T()) + // are linearly dependent of DU and represent initial + // displacement effect + // which can cause convergence difficulties when treated + // explicitly + // so we implicitly over-relax with gradU & gradDU here + // which tends to help convergence + // this should improve convergence when gradU is large + // but maybe not execution time + DUEqn -= + fvm::laplacian + ( + (2*mu + lambda)*gradU, DU, "laplacian(DDU,DU)" + ) + - fvc::div((2*mu + lambda)*(gradU & gradDU), "div(sigma)"); + } - if (nonLinearSemiImplicit) - { - // experimental - // we can treat the nonlinear term (gradDU & gradDU.T()) in a - // semi-implicit over-relaxed manner - // this should improve convergence when gradDU is large - // but maybe not execution time - DUEqn -= - fvm::laplacian - ( - (2*mu + lambda)*gradDU, DU, "laplacian(DDU,DU)" - ) - - fvc::div( (2*mu + lambda)*(gradDU&gradDU), "div(sigma)"); - } + if (nonLinearSemiImplicit) + { + // experimental + // we can treat the nonlinear term (gradDU & gradDU.T()) in a + // semi-implicit over-relaxed manner + // this should improve convergence when gradDU is large + // but maybe not execution time + DUEqn -= + fvm::laplacian + ( + (2*mu + lambda)*gradDU, DU, "laplacian(DDU,DU)" + ) + - fvc::div((2*mu + lambda)*(gradDU & gradDU), "div(sigma)"); + } - solverPerf = DUEqn.solve(); + solverPerf = DUEqn.solve(); - if (iCorr == 0) - { - initialResidual = solverPerf.initialResidual(); - } + if (iCorr == 0) + { + initialResidual = solverPerf.initialResidual(); + } - if (aitkenRelax) - { + if (aitkenRelax) + { # include "aitkenRelaxation.H" - } - else - { - DU.relax(); - } + } + else + { + DU.relax(); + } - gradDU = fvc::grad(DU); + gradDU = fvc::grad(DU); - // correct plasticty term - rheology.correct(); + // correct plasticty term + rheology.correct(); # include "calculateDEpsilonDSigma.H" # include "calculateRelativeResidual.H" - if (iCorr % infoFrequency == 0) - { - Info << "\tTime " << runTime.value() - << ", Corrector " << iCorr - << ", Solving for " << DU.name() - << " using " << solverPerf.solverName() - << ", res = " << solverPerf.initialResidual() - << ", rel res = " << relativeResidual; - if (aitkenRelax) - { - Info << ", aitken = " << aitkenTheta; - } - Info << ", iters = " << solverPerf.nIterations() << endl; - } - } + if (iCorr % infoFrequency == 0) + { + Info<< "\tTime " << runTime.value() + << ", Corrector " << iCorr + << ", Solving for " << DU.name() + << " using " << solverPerf.solverName() + << ", res = " << solverPerf.initialResidual() + << ", rel res = " << relativeResidual; + + if (aitkenRelax) + { + Info << ", aitken = " << aitkenTheta; + } + Info << ", iters = " << solverPerf.nIterations() << endl; + } + } while + ( + iCorr++ == 0 + || ( - iCorr++ == 0 - || - (//solverPerf.initialResidual() > convergenceTolerance - relativeResidual > convergenceTolerance - && - iCorr < nCorr) - ); + //solverPerf.initialResidual() > convergenceTolerance + relativeResidual > convergenceTolerance + && iCorr < nCorr + ) + ); Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name() << ", Initial residual = " << initialResidual diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/readDivDSigmaExpMethod.H b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/readDivDSigmaExpMethod.H index 1615c5211..421acb29d 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/readDivDSigmaExpMethod.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/readDivDSigmaExpMethod.H @@ -1,9 +1,20 @@ //- how explicit component of sigma is to be calculated -word divDSigmaExpMethod(mesh.solutionDict().subDict("solidMechanics").lookup("divSigmaExp")); +word divDSigmaExpMethod +( + mesh.solutionDict().subDict("solidMechanics").lookup("divSigmaExp") +); + Info << "divSigmaExp method " << divDSigmaExpMethod << endl; -if(divDSigmaExpMethod != "standard" && divDSigmaExpMethod != "surface" && divDSigmaExpMethod != "decompose" && divDSigmaExpMethod != "laplacian") - { - FatalError << "divSigmaExp method " << divDSigmaExpMethod << " not found!" << nl - << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" - << exit(FatalError); - } +if +( + divDSigmaExpMethod != "standard" + && divDSigmaExpMethod != "surface" + && divDSigmaExpMethod != "decompose" + && divDSigmaExpMethod != "laplacian" +) +{ + FatalErrorIn(args.executable()) + << "divSigmaExp method " << divDSigmaExpMethod << " not found!" << nl + << "valid methods are:\nstandard\nsurface\ndecompose\nlaplacian" + << exit(FatalError); +} diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/writeFields.H b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/writeFields.H index a3de4657b..c2db3454e 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/writeFields.H +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/writeFields.H @@ -1,100 +1,95 @@ if (runTime.outputTime()) - { +{ volScalarField epsilonEq - ( - 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; + ( + 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; volScalarField epsilonPEq - ( - IOobject - ( - "epsilonPEq", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE + ( + IOobject + ( + "epsilonPEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE ), - sqrt((2.0/3.0)*magSqr(dev(epsilonP))) - ); - Info<< "Max epsilonPEq = " << max(epsilonPEq).value() - << endl; + sqrt((2.0/3.0)*magSqr(dev(epsilonP))) + ); + Info<< "Max epsilonPEq = " << max(epsilonPEq).value()<< endl; volScalarField sigmaEq - ( - 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; + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigma))) + ); - // deformation gradient + Info<< "Max sigmaEq = " << max(sigmaEq).value() << endl; + + // Deformation gradient volTensorField F = I + gradU; volScalarField J = det(F); - //- Calculate Cauchy stress + // Calculate Cauchy stress 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 + // Cauchy von Mises stress volScalarField sigmaCauchyEq - ( - 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; + ( + IOobject + ( + "sigmaCauchyEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + sqrt((3.0/2.0)*magSqr(dev(sigmaCauchy))) + ); - //volTensorField Finv = inv(F); - // volSymmTensorField epsilonAlmansi -// ( -// IOobject -// ( -// "epsilonAlmansi", -// runTime.timeName(), -// mesh, -// IOobject::NO_READ, -// IOobject::AUTO_WRITE -// ), -// symm(Finv & epsilon & Finv.T()) -// ); + Info<< "Max sigmaCauchyEq = " << max(sigmaCauchyEq).value() << endl; +// volTensorField Finv = inv(F); +// volSymmTensorField epsilonAlmansi +// ( +// IOobject +// ( +// "epsilonAlmansi", +// runTime.timeName(), +// mesh, +// IOobject::NO_READ, +// IOobject::AUTO_WRITE +// ), +// symm(Finv & epsilon & Finv.T()) +// ); runTime.write(); - } +} diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/Make/files b/applications/solvers/solidMechanics/stressFemFoam/Make/files similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/Make/files rename to applications/solvers/solidMechanics/stressFemFoam/Make/files diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/Make/options b/applications/solvers/solidMechanics/stressFemFoam/Make/options similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/Make/options rename to applications/solvers/solidMechanics/stressFemFoam/Make/options diff --git a/applications/solvers/solidMechanics/stressFemFoam/calculateStress.H b/applications/solvers/solidMechanics/stressFemFoam/calculateStress.H new file mode 100644 index 000000000..3e4619cef --- /dev/null +++ b/applications/solvers/solidMechanics/stressFemFoam/calculateStress.H @@ -0,0 +1,120 @@ + if (runTime.outputTime()) + { + // Displacement gradient + tetPointTensorField gradU = tetFec::grad(U); + + // Stress tensor + tetPointSymmTensorField sigma = + rho*(2.0*mu*symm(gradU) + lambda*I*tr(gradU)); + + + // Create pointMesh for field post-processing + const pointMesh& pMesh = pointMesh::New(mesh); + + // U + pointVectorField Up + ( + IOobject + ( + "Up", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + U.dimensions() + ); + + Up.internalField() = vectorField::subField + ( + U.internalField(), + pMesh.size() + ); + + // sigmaEq + pointScalarField sigmaEq + ( + IOobject + ( + "sigmaEq", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + sigma.dimensions() + ); + + sigmaEq.internalField() = scalarField::subField + ( + sqrt((3.0/2.0)*magSqr(dev(sigma.internalField())))(), + pMesh.size() + ); + + // sigmaXX + pointScalarField sigmaXX + ( + IOobject + ( + "sigmaXX", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + sigma.dimensions() + ); + + sigmaXX.internalField() = scalarField::subField + ( + sigma.component(symmTensor::XX)().internalField(), + pMesh.size() + ); + + // sigmaYY + pointScalarField sigmaYY + ( + IOobject + ( + "sigmaYY", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + sigma.dimensions() + ); + + sigmaYY.internalField() = scalarField::subField + ( + sigma.component(symmTensor::YY)().internalField(), + pMesh.size() + ); + + // sigmaXY + pointScalarField sigmaXY + ( + IOobject + ( + "sigmaXY", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pMesh, + sigma.dimensions() + ); + + sigmaXY.internalField() = scalarField::subField + ( + sigma.component(symmTensor::XY)().internalField(), + pMesh.size() + ); + + runTime.write(); + } diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFemFields.H b/applications/solvers/solidMechanics/stressFemFoam/createFemFields.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFemFields.H rename to applications/solvers/solidMechanics/stressFemFoam/createFemFields.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFemMesh.H b/applications/solvers/solidMechanics/stressFemFoam/createFemMesh.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFemMesh.H rename to applications/solvers/solidMechanics/stressFemFoam/createFemMesh.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFields.H b/applications/solvers/solidMechanics/stressFemFoam/createFields.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/createFields.H rename to applications/solvers/solidMechanics/stressFemFoam/createFields.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C b/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C similarity index 96% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C rename to applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C index b5cf8cb66..a10dadc9d 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C +++ b/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C @@ -46,8 +46,9 @@ template class PointPatch, template class MatrixType > -void TractionPointPatchVectorField -::checkFieldSize() const +void +TractionPointPatchVectorField:: +checkFieldSize() const { if ( @@ -229,7 +230,7 @@ addBoundarySourceDiag const vectorField& pointNormals = this->patch().pointNormals(); const label nFaces = this->patch().nFaces(); - vectorField& source = matrix.source(); + vectorField& b = matrix.b(); for (label faceI = 0; faceI < nFaces; faceI++) { @@ -240,7 +241,7 @@ addBoundarySourceDiag { const triFace& tri = faceTriangles[triI]; - source[meshPoints[tri[0]]] += + b[meshPoints[tri[0]]] += tri.mag(points)* ( traction_[faceI]/6.0 @@ -251,7 +252,7 @@ addBoundarySourceDiag - pressure_[faceI]*pointNormals[tri[2]]/12.0 ); - source[meshPoints[tri[1]]] += + b[meshPoints[tri[1]]] += tri.mag(points)* ( traction_[faceI]/6.0 @@ -262,7 +263,7 @@ addBoundarySourceDiag - pressure_[faceI]*pointNormals[tri[0]]/12.0 ); - source[meshPoints[tri[2]]] += + b[meshPoints[tri[2]]] += tri.mag(points)* ( traction_[faceI]/6.0 diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.H b/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.H rename to applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/tractionTetPolyPatchVectorField.C b/applications/solvers/solidMechanics/stressFemFoam/femStress/tractionTetPolyPatchVectorField.C similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/tractionTetPolyPatchVectorField.C rename to applications/solvers/solidMechanics/stressFemFoam/femStress/tractionTetPolyPatchVectorField.C diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/tractionTetPolyPatchVectorField.H b/applications/solvers/solidMechanics/stressFemFoam/femStress/tractionTetPolyPatchVectorField.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/femStress/tractionTetPolyPatchVectorField.H rename to applications/solvers/solidMechanics/stressFemFoam/femStress/tractionTetPolyPatchVectorField.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/readControls.H b/applications/solvers/solidMechanics/stressFemFoam/readControls.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/readControls.H rename to applications/solvers/solidMechanics/stressFemFoam/readControls.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/readMechanicalProperties.H b/applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H similarity index 100% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/readMechanicalProperties.H rename to applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/stressFemFoam.C b/applications/solvers/solidMechanics/stressFemFoam/stressFemFoam.C similarity index 97% rename from applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/stressFemFoam.C rename to applications/solvers/solidMechanics/stressFemFoam/stressFemFoam.C index 65b8fae2a..50daab29a 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/stressFemFoam/stressFemFoam.C +++ b/applications/solvers/solidMechanics/stressFemFoam/stressFemFoam.C @@ -36,6 +36,8 @@ Description #include "fvCFD.H" +#include "pointMesh.H" +#include "pointFields.H" #include "tetPolyMesh.H" #include "tetPointFields.H" #include "tetFem.H" @@ -69,7 +71,7 @@ int main(int argc, char *argv[]) + tetFem::laplacianTrace(lambda, U) ); - solve(UEqn); + UEqn.solve(); # include "calculateStress.H" diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/Allclean b/tutorials/solidMechanics/stressFemFoam/Allclean similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/Allclean rename to tutorials/solidMechanics/stressFemFoam/Allclean diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/Allrun b/tutorials/solidMechanics/stressFemFoam/Allrun similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/Allrun rename to tutorials/solidMechanics/stressFemFoam/Allrun diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/0/U b/tutorials/solidMechanics/stressFemFoam/plateHole/0/U similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/0/U rename to tutorials/solidMechanics/stressFemFoam/plateHole/0/U diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/mechanicalProperties b/tutorials/solidMechanics/stressFemFoam/plateHole/constant/mechanicalProperties similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/mechanicalProperties rename to tutorials/solidMechanics/stressFemFoam/plateHole/constant/mechanicalProperties diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict b/tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict similarity index 72% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict rename to tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict index 8b27dc96d..227250905 100644 --- a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict +++ b/tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/blockMeshDict @@ -19,28 +19,28 @@ convertToMeters 1; vertices ( - (0.5 0 0) - (1 0 0) - (2 0 0) - (2 0.707107 0) - (0.707107 0.707107 0) - (0.353553 0.353553 0) - (2 2 0) - (0.707107 2 0) - (0 2 0) - (0 1 0) - (0 0.5 0) - (0.5 0 0.5) - (1 0 0.5) - (2 0 0.5) - (2 0.707107 0.5) - (0.707107 0.707107 0.5) - (0.353553 0.353553 0.5) - (2 2 0.5) - (0.707107 2 0.5) - (0 2 0.5) - (0 1 0.5) - (0 0.5 0.5) + (0.5 0 -0.1) + (1 0 -0.1) + (2 0 -0.1) + (2 0.707107 -0.1) + (0.707107 0.707107 -0.1) + (0.353553 0.353553 -0.1) + (2 2 -0.1) + (0.707107 2 -0.1) + (0 2 -0.1) + (0 1 -0.1) + (0 0.5 -0.1) + (0.5 0 0.1) + (1 0 0.1) + (2 0 0.1) + (2 0.707107 0.1) + (0.707107 0.707107 0.1) + (0.353553 0.353553 0.1) + (2 2 0.1) + (0.707107 2 0.1) + (0 2 0.1) + (0 1 0.1) + (0 0.5 0.1) ); blocks @@ -54,14 +54,14 @@ blocks edges ( - arc 0 5 (0.469846 0.17101 0) - arc 5 10 (0.17101 0.469846 0) - arc 1 4 (0.939693 0.34202 0) - arc 4 9 (0.34202 0.939693 0) - arc 11 16 (0.469846 0.17101 0.5) - arc 16 21 (0.17101 0.469846 0.5) - arc 12 15 (0.939693 0.34202 0.5) - arc 15 20 (0.34202 0.939693 0.5) + arc 0 5 (0.469846 0.17101 -0.1) + arc 5 10 (0.17101 0.469846 -0.1) + arc 1 4 (0.939693 0.34202 -0.1) + arc 4 9 (0.34202 0.939693 -0.1) + arc 11 16 (0.469846 0.17101 0.1) + arc 16 21 (0.17101 0.469846 0.1) + arc 12 15 (0.939693 0.34202 0.1) + arc 15 20 (0.34202 0.939693 0.1) ); patches diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/boundary b/tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/boundary similarity index 96% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/boundary rename to tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/boundary index f7b45bdb7..1401a1b37 100644 --- a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/stressFemFoam/plateHole/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/controlDict b/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict similarity index 94% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/controlDict rename to tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict index 8a9087959..80f2e4a5f 100644 --- a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/controlDict +++ b/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application stressFemFoam; +application stressFemFoam; startFrom startTime; @@ -23,13 +23,13 @@ startTime 0; stopAt endTime; -endTime 100; +endTime 1; deltaT 1; writeControl timeStep; -writeInterval 20; +writeInterval 1; purgeWrite 0; diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/fvSchemes b/tutorials/solidMechanics/stressFemFoam/plateHole/system/fvSchemes similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/fvSchemes rename to tutorials/solidMechanics/stressFemFoam/plateHole/system/fvSchemes diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/fvSolution b/tutorials/solidMechanics/stressFemFoam/plateHole/system/fvSolution similarity index 100% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/fvSolution rename to tutorials/solidMechanics/stressFemFoam/plateHole/system/fvSolution diff --git a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/tetFemSolution b/tutorials/solidMechanics/stressFemFoam/plateHole/system/tetFemSolution similarity index 86% rename from tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/tetFemSolution rename to tutorials/solidMechanics/stressFemFoam/plateHole/system/tetFemSolution index 91a9a7218..85927aea3 100644 --- a/tutorials/solidMechanics/deprecatedTutorials/stressFemFoam/plateHole/system/tetFemSolution +++ b/tutorials/solidMechanics/stressFemFoam/plateHole/system/tetFemSolution @@ -19,11 +19,15 @@ solvers { U { - solver PCG; - preconditioner DIC; + solver CG; + preconditioner Cholesky; + minIter 1; + maxIter 2000; + tolerance 1e-06; - relTol 0.1; + relTol 0; } } + // ************************************************************************* // From 8269d111b2b6d75d3689f073c58f4c6648cac62a Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:46:24 +0100 Subject: [PATCH 037/197] High-level CoeffFields --- .../fields/CoeffField/CoeffFieldFunctions.C | 2 +- src/foam/fields/CoeffField/coeffFields.H | 4 + .../fields/CoeffField/diagTensorCoeffField.C | 141 ++++++++++++++++++ .../fields/CoeffField/diagTensorCoeffField.H | 101 +++++++++++++ .../CoeffField/symmTensor4thOrderCoeffField.C | 141 ++++++++++++++++++ .../CoeffField/symmTensor4thOrderCoeffField.H | 105 +++++++++++++ 6 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 src/foam/fields/CoeffField/diagTensorCoeffField.C create mode 100644 src/foam/fields/CoeffField/diagTensorCoeffField.H create mode 100644 src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.C create mode 100644 src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.H diff --git a/src/foam/fields/CoeffField/CoeffFieldFunctions.C b/src/foam/fields/CoeffField/CoeffFieldFunctions.C index bf6c70647..ec954e916 100644 --- a/src/foam/fields/CoeffField/CoeffFieldFunctions.C +++ b/src/foam/fields/CoeffField/CoeffFieldFunctions.C @@ -328,7 +328,7 @@ Foam::tmp > Foam::operator op \ // Operator multiply is not available for all types, as it expands rank // HJ, 17/Jun/2010 -// BINARY_OPERATOR_R(Type, Type, *, multiply) +BINARY_OPERATOR_R(Type, Type, *, multiply) #undef BINARY_OPERATOR_R #undef BINARY_OPERATOR_FF diff --git a/src/foam/fields/CoeffField/coeffFields.H b/src/foam/fields/CoeffField/coeffFields.H index 10c98f4ab..d403c39e0 100644 --- a/src/foam/fields/CoeffField/coeffFields.H +++ b/src/foam/fields/CoeffField/coeffFields.H @@ -37,8 +37,10 @@ Author #include "scalarCoeffField.H" #include "sphericalTensorCoeffField.H" +#include "diagTensorCoeffField.H" #include "symmTensorCoeffField.H" #include "tensorCoeffField.H" +#include "symmTensor4thOrderCoeffField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,8 +52,10 @@ namespace Foam typedef CoeffField scalarCoeffField; typedef CoeffField vectorCoeffField; typedef CoeffField sphericalTensorCoeffField; +typedef CoeffField diagTensorCoeffField; typedef CoeffField symmTensorCoeffField; typedef CoeffField tensorCoeffField; +typedef CoeffField symmTensor4thOrderCoeffField; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/foam/fields/CoeffField/diagTensorCoeffField.C b/src/foam/fields/CoeffField/diagTensorCoeffField.C new file mode 100644 index 000000000..ce554e2c4 --- /dev/null +++ b/src/foam/fields/CoeffField/diagTensorCoeffField.C @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "diagTensorCoeffField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CoeffField::CoeffField(const label size) +: + DecoupledCoeffField(size) +{} + + +Foam::CoeffField::CoeffField +( + const CoeffField& f +) +: + DecoupledCoeffField(f) +{} + + +Foam::CoeffField::CoeffField +( + const DecoupledCoeffField& f +) +: + DecoupledCoeffField(f) +{} + + +Foam::CoeffField::CoeffField +( + const tmp >& tf +) +: + DecoupledCoeffField(tf()) +{} + + +Foam::CoeffField::CoeffField(Istream& is) +: + DecoupledCoeffField(is) +{} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::CoeffField::operator= +( + const CoeffField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp >& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const CoeffField::scalarTypeField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp::scalarTypeField>& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const CoeffField::linearTypeField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp::linearTypeField>& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +/* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */ + +Foam::tmp > Foam::inv +( + const CoeffField& f +) +{ + const DecoupledCoeffField& df = f; + + return tmp > + ( + new CoeffField(inv(df)()) + ); +} + + +// ************************************************************************* // diff --git a/src/foam/fields/CoeffField/diagTensorCoeffField.H b/src/foam/fields/CoeffField/diagTensorCoeffField.H new file mode 100644 index 000000000..4a28f6a4c --- /dev/null +++ b/src/foam/fields/CoeffField/diagTensorCoeffField.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Class + CoeffField + +Description + Template specialisation for diagTensor coefficients + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + diagTensorCoeffField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef diagTensorCoeffField_H +#define diagTensorCoeffField_H + +#include "CoeffField.H" +#include "DecoupledCoeffField.H" +#include "diagTensor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<> +class CoeffField +: + public DecoupledCoeffField +{ +public: + + // Constructors + + //- Construct given size + explicit CoeffField(const label); + + //- Construct as copy + CoeffField(const CoeffField&); + + //- Construct as copy of base + explicit CoeffField(const DecoupledCoeffField&); + + //- Construct as copy of base + explicit CoeffField(const tmp >&); + + //- Construct from Istream + explicit CoeffField(Istream&); + + + // Member operators + + void operator=(const CoeffField&); + void operator=(const tmp >&); + + void operator=(const scalarTypeField&); + void operator=(const tmp&); + void operator=(const linearTypeField&); + void operator=(const tmp&); + +}; + + +/* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */ + +tmp > inv(const CoeffField& f); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.C b/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.C new file mode 100644 index 000000000..ee609e1a5 --- /dev/null +++ b/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.C @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "symmTensor4thOrderCoeffField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CoeffField::CoeffField(const label size) +: + DecoupledCoeffField(size) +{} + + +Foam::CoeffField::CoeffField +( + const CoeffField& f +) +: + DecoupledCoeffField(f) +{} + + +Foam::CoeffField::CoeffField +( + const DecoupledCoeffField& f +) +: + DecoupledCoeffField(f) +{} + + +Foam::CoeffField::CoeffField +( + const tmp >& tf +) +: + DecoupledCoeffField(tf()) +{} + + +Foam::CoeffField::CoeffField(Istream& is) +: + DecoupledCoeffField(is) +{} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::CoeffField::operator= +( + const CoeffField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp >& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const CoeffField::scalarTypeField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp::scalarTypeField>& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const CoeffField::linearTypeField& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +void Foam::CoeffField::operator= +( + const tmp::linearTypeField>& f +) +{ + DecoupledCoeffField::operator=(f); +} + + +/* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */ + +Foam::tmp > Foam::inv +( + const CoeffField& f +) +{ + const DecoupledCoeffField& df = f; + + return tmp > + ( + new CoeffField(inv(df)()) + ); +} + + +// ************************************************************************* // diff --git a/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.H b/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.H new file mode 100644 index 000000000..3981b081b --- /dev/null +++ b/src/foam/fields/CoeffField/symmTensor4thOrderCoeffField.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Class + CoeffField + +Description + Template specialisation for symmTensor4thOrder coefficients + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + symmTensor4thOrderCoeffField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef symmTensor4thOrderCoeffField_H +#define symmTensor4thOrderCoeffField_H + +#include "CoeffField.H" +#include "DecoupledCoeffField.H" +#include "symmTensor4thOrder.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template<> +class CoeffField +: + public DecoupledCoeffField +{ +public: + + // Constructors + + //- Construct given size + explicit CoeffField(const label); + + //- Construct as copy + CoeffField(const CoeffField&); + + //- Construct as copy of base + explicit CoeffField(const DecoupledCoeffField&); + + //- Construct as copy of base + explicit CoeffField + ( + const tmp >& + ); + + //- Construct from Istream + explicit CoeffField(Istream&); + + + // Member operators + + void operator=(const CoeffField&); + void operator=(const tmp >&); + + void operator=(const scalarTypeField&); + void operator=(const tmp&); + void operator=(const linearTypeField&); + void operator=(const tmp&); + +}; + + +/* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */ + +tmp > +inv(const CoeffField& f); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 91ca61dfd2cccb46b71dccf359a7a067245a5811 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:46:56 +0100 Subject: [PATCH 038/197] Scaling factor fix --- .../mesh/manipulation/deformedTetFemGeom/deformedTetFemGeom.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/deformedTetFemGeom/deformedTetFemGeom.C b/applications/utilities/mesh/manipulation/deformedTetFemGeom/deformedTetFemGeom.C index 9e418a905..803206174 100644 --- a/applications/utilities/mesh/manipulation/deformedTetFemGeom/deformedTetFemGeom.C +++ b/applications/utilities/mesh/manipulation/deformedTetFemGeom/deformedTetFemGeom.C @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" - scalar scaleFactor(readScalar(IStringStream(args.args()[3])())); + scalar scaleFactor(readScalar(IStringStream(args.additionalArgs()[0])())); # include "createTime.H" # include "createPolyMesh.H" From 39fac12c97a4e010a5a60c30c00fd35ebf5592ef Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:47:21 +0100 Subject: [PATCH 039/197] Update of old format dimension set --- src/thermophysicalModels/basic/basicThermo/basicThermo.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 60f975175..d9834738e 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -182,7 +182,7 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh, const objectRegistry& obj) IOobject::NO_WRITE ), mesh, - dimensionSet(0, -2, 2, 0, 0) + dimensionSet(0, -2, 2, 0, 0, 0, 0) ), T_ From 84227f7290eb12f7590eb6f9731533c672c77c52 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:48:03 +0100 Subject: [PATCH 040/197] Update tutorial to better initial conditions --- .../incompressible/icoDyMFoam/movingConeMotion/0/U | 2 +- .../movingConeMotion/constant/polyMesh/boundary | 2 +- .../icoDyMFoam/movingConeMotion/system/controlDict | 4 ++-- .../icoDyMFoam/movingConeMotion/system/tetFemSolution | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tutorials/incompressible/icoDyMFoam/movingConeMotion/0/U b/tutorials/incompressible/icoDyMFoam/movingConeMotion/0/U index cbdb2c4e1..3f109e186 100644 --- a/tutorials/incompressible/icoDyMFoam/movingConeMotion/0/U +++ b/tutorials/incompressible/icoDyMFoam/movingConeMotion/0/U @@ -23,7 +23,7 @@ boundaryField movingWall { type fixedValue; - value uniform (1 0 0); + value uniform (0 0 0); } farFieldMoving diff --git a/tutorials/incompressible/icoDyMFoam/movingConeMotion/constant/polyMesh/boundary b/tutorials/incompressible/icoDyMFoam/movingConeMotion/constant/polyMesh/boundary index 9a4c35057..8b7c0bae0 100644 --- a/tutorials/incompressible/icoDyMFoam/movingConeMotion/constant/polyMesh/boundary +++ b/tutorials/incompressible/icoDyMFoam/movingConeMotion/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/controlDict b/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/controlDict index eea021ff0..c7c0c6914 100644 --- a/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/controlDict +++ b/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/controlDict @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application icoDyMFoam; +application icoDyMFoam; startFrom startTime; @@ -28,7 +28,7 @@ deltaT 2e-05; writeControl timeStep; -writeInterval 10; +writeInterval 1; purgeWrite 0; diff --git a/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/tetFemSolution b/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/tetFemSolution index 30e0dfe6f..8884625af 100644 --- a/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/tetFemSolution +++ b/tutorials/incompressible/icoDyMFoam/movingConeMotion/system/tetFemSolution @@ -18,14 +18,14 @@ solvers { motionU { - solver PCG; - preconditioner DIC; + solver CG; + preconditioner Cholesky; minIter 0; maxIter 1000; tolerance 1e-6; - relTol 0.01; - }; + relTol 0.0; + } // motionU // { // solver amgSolver; @@ -43,7 +43,7 @@ solvers // maxIter 500; // tolerance 1e-8; // relTol 0.0; -// }; +// } } // ************************************************************************* // From b6a35f93438596713b8bf8925ff3b9393efc8e27 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:58:14 +0100 Subject: [PATCH 041/197] Formatting --- src/foam/matrices/constraint/constraintTools.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/foam/matrices/constraint/constraintTools.C b/src/foam/matrices/constraint/constraintTools.C index 8ecf9ea34..f822c240a 100644 --- a/src/foam/matrices/constraint/constraintTools.C +++ b/src/foam/matrices/constraint/constraintTools.C @@ -175,7 +175,8 @@ void constraint::eliminateEquation const unallocLabelList& owner = matrix.psi().mesh().lduAddr().lowerAddr(); const unallocLabelList& neighbour = matrix.psi().mesh().lduAddr().upperAddr(); - const unallocLabelList& losort = matrix.psi().mesh().lduAddr().losortAddr(); + const unallocLabelList& losort = + matrix.psi().mesh().lduAddr().losortAddr(); // My index = rowID if (matrix.symmetric()) From b3db6d226ffea0a1ce1790d55a8287a965b11bd8 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 17:59:45 +0100 Subject: [PATCH 042/197] Formatting --- .../PointPatchFields/PointPatchField/PointPatchField.H | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/foam/fields/PointPatchFields/PointPatchField/PointPatchField.H b/src/foam/fields/PointPatchFields/PointPatchField/PointPatchField.H index e4966e607..a3cca1f92 100644 --- a/src/foam/fields/PointPatchFields/PointPatchField/PointPatchField.H +++ b/src/foam/fields/PointPatchFields/PointPatchField/PointPatchField.H @@ -279,7 +279,8 @@ public: } //- Return internal field reference - const DimensionedField& dimensionedInternalField() const + const DimensionedField& + dimensionedInternalField() const { return internalField_; } @@ -555,7 +556,7 @@ public: // This function is added as a hack to enable simple backward compatability -// with verions using referenceLevel in GeometicField +// with versions using referenceLevel in GeometricField template < template class PatchField, @@ -564,7 +565,8 @@ template template class MatrixType, class Type > -const PointPatchField& operator+ +const PointPatchField& +operator+ ( const PointPatchField& ppf, const Type& @@ -735,7 +737,7 @@ typedef Type##PointPatchField \ typedef Type##PointPatchField \ \ type##pointPatchType##DiagTensorField; \ -typedef Type##PointPatchField \ +typedef Type##PointPatchField \ \ type##pointPatchType##TensorField; From 2ba267c767f7c707d334e25b40bb37b19b3fd30b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 18:01:10 +0100 Subject: [PATCH 043/197] Issue with the rank of 4th order symm tensors --- .../SymmTensor4thOrder/SymmTensor4thOrder.H | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/foam/primitives/SymmTensor4thOrder/SymmTensor4thOrder.H b/src/foam/primitives/SymmTensor4thOrder/SymmTensor4thOrder.H index e873556b3..5353cc8de 100644 --- a/src/foam/primitives/SymmTensor4thOrder/SymmTensor4thOrder.H +++ b/src/foam/primitives/SymmTensor4thOrder/SymmTensor4thOrder.H @@ -85,6 +85,8 @@ public: rank = 2 // Hacked by PC: Actual rank of SymmTensor4thOrder is 4 }; + //HJ, reconsider and fix. HJ, 23/Feb/2014 + // Static data members @@ -172,22 +174,22 @@ public: }; -// template -// class typeOfRank -// { -// public: +template +class typeOfRank +{ +public: -// typedef SymmTensor4thOrder type; -// }; + typedef SymmTensor4thOrder type; +}; -// template -// class symmTypeOfRank -// { -// public: +template +class symmTypeOfRank +{ +public: -// typedef SymmTensor4thOrder type; -// }; + typedef SymmTensor4thOrder type; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From c456128f912d39dfafda315f58cdc913b9f7a4a9 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 18:01:40 +0100 Subject: [PATCH 044/197] Formatting --- .../viscoelasticFluidFoam/Oldroyd-B/constant/polyMesh/boundary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/constant/polyMesh/boundary b/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/constant/polyMesh/boundary index ea7a3b4ad..b3b623bdf 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/constant/polyMesh/boundary +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ From 118ac4349e425f1b3eef221a14d933521c83a73b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 18:03:08 +0100 Subject: [PATCH 045/197] Formatting --- .../fields/fvPatchFields/basic/coupled/coupledFvPatchField.H | 1 + 1 file changed, 1 insertion(+) diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H index d545d6034..a06704958 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H @@ -213,6 +213,7 @@ public: "(Field& f) const" ); } + //- Initialise neighbour matrix update virtual void initInterfaceMatrixUpdate ( From 979bc9da146d323c24b7e71546ff908f3a10a906 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 18:03:36 +0100 Subject: [PATCH 046/197] Access to patch --- .../constraint/cyclicGgi/cyclicGgiFvPatchField.C | 4 +++- .../constraint/cyclicGgi/cyclicGgiFvPatchField.H | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C index 89511f94c..015f56640 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C @@ -298,7 +298,9 @@ void cyclicGgiFvPatchField::initInterfaceMatrixUpdate const Pstream::commsTypes commsType ) const { - notImplemented("void cyclicGgiFvPatchField::initInterfaceMatrixUpdate" + notImplemented + ( + "void cyclicGgiFvPatchField::initInterfaceMatrixUpdate" " for block-coupled matrices of tensor types" ) } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H index 1c4046614..6738cc56e 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H @@ -129,6 +129,15 @@ public: // Member functions + // Access + + //- Return access to cyclic ggi patch + const cyclicGgiFvPatch& cyclicGgiPatch() const + { + return cyclicGgiPatch_; + } + + // Evaluation functions //- Return neighbour field From 45576c2dea9f50a97d5983d72b47edb852403233 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 20:39:06 +0100 Subject: [PATCH 047/197] Update for segregated stress solver --- .../solidMechanics/stressFemFoam/plateHole/system/controlDict | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict b/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict index 80f2e4a5f..19b5d3a2d 100644 --- a/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict +++ b/tutorials/solidMechanics/stressFemFoam/plateHole/system/controlDict @@ -23,13 +23,13 @@ startTime 0; stopAt endTime; -endTime 1; +endTime 100; deltaT 1; writeControl timeStep; -writeInterval 1; +writeInterval 20; purgeWrite 0; From e732980a533627c6cbb03e8ec6e1db61023755e6 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 20:54:24 +0100 Subject: [PATCH 048/197] Tutorial fix elasticThermalSolidFoam --- .../elasticThermalSolidFoam/createFields.H | 57 +++--- .../elasticThermalSolidFoam.C | 171 +++++++++--------- .../elasticThermalSolidFoam/hotCylinder/0/T | 18 +- .../elasticThermalSolidFoam/hotCylinder/0/U | 19 +- .../hotCylinder/Allrun | 2 +- .../constant/polyMesh/blockMeshDict | 59 +++--- .../hotCylinder/constant/polyMesh/boundary | 34 ++-- .../hotCylinder/constant/thermalProperties | 11 +- 8 files changed, 181 insertions(+), 190 deletions(-) diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/createFields.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/createFields.H index e789e67f2..0ab66ab7e 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/createFields.H @@ -12,21 +12,20 @@ mesh ); - // volTensorField gradU = fvc::grad(U); volTensorField gradU ( IOobject ( - "grad(U)", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "grad(U)", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedTensor("zero", dimless, tensor::zero) - ); - //surfaceVectorField snGradU = fvc::snGrad(U); + ); + surfaceVectorField snGradU ( IOobject @@ -38,7 +37,7 @@ IOobject::NO_WRITE ), mesh, - dimensionedVector("zero", dimless, vector::zero) + dimensionedVector("zero", dimless, vector::zero) ); volSymmTensorField epsilon @@ -115,31 +114,33 @@ thermalModel thermal(T); volScalarField C = thermal.C(); - volScalarField k = thermal.k(); + volScalarField k + ( + "DT", + thermal.k() + ); volScalarField threeKalpha = rheology.threeK()*rho*thermal.alpha(); - surfaceScalarField threeKalphaf = fvc::interpolate(threeKalpha, "threeKalpha"); + surfaceScalarField threeKalphaf = + fvc::interpolate(threeKalpha, "threeKalpha"); volScalarField T0 = thermal.T0(); volScalarField rhoC = rho*C; -// for aitken relaxation -volVectorField aitkenDelta - ( + // for aitken relaxation + volVectorField aitkenDelta + ( IOobject ( - "aitkenDelta", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "aitkenDelta", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), mesh, dimensionedVector("zero", dimLength, vector::zero) ); -// aitken relaxation factor -scalar aitkenInitialRes = 1.0; -scalar aitkenTheta = 0.01; -// if(mesh.relax(U.name())) -// { -// aitkenTheta = mesh.relaxationFactor(U.name()); -// } + + // aitken relaxation factor + scalar aitkenInitialRes = 1.0; + scalar aitkenTheta = 0.01; diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C index 3fe868901..c90b1096e 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C @@ -46,100 +46,99 @@ Author int main(int argc, char *argv[]) { -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" -# include "createFields.H" -# include "readDivSigmaExpMethod.H" +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" +# include "createFields.H" +# include "readDivSigmaExpMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Info<< "\nStarting time loop\n" << endl; + Info<< "\nStarting time loop\n" << endl; - while(runTime.loop()) + while(runTime.loop()) { - Info<< "Time: " << runTime.timeName() << nl << endl; + Info<< "Time: " << runTime.timeName() << nl << endl; -# include "readSolidMechanicsControls.H" +# include "readSolidMechanicsControls.H" - int iCorr = 0; - scalar initialResidual = 1.0; - scalar relResT = 1.0; - scalar relResU = 1.0; - lduMatrix::solverPerformance solverPerfU; - lduMatrix::solverPerformance solverPerfT; - lduMatrix::debug = 0; + int iCorr = 0; + scalar initialResidual = 1.0; + scalar relResT = 1.0; + scalar relResU = 1.0; + lduMatrix::solverPerformance solverPerfU; + lduMatrix::solverPerformance solverPerfT; + lduMatrix::debug = 0; - // solve energy equation for temperature - // the loop is for non-orthogonal corrections - Info<< "Solving for " << T.name() << nl; - do - { - T.storePrevIter(); + // solve energy equation for temperature + // the loop is for non-orthogonal corrections + Info<< "Solving for " << T.name() << nl; + do + { + T.storePrevIter(); - fvScalarMatrix TEqn - ( - rhoC*fvm::ddt(T) == fvm::laplacian(k, T, "laplacian(k,T)") - ); + fvScalarMatrix TEqn + ( + rhoC*fvm::ddt(T) == fvm::laplacian(k, T, "laplacian(k,T)") + ); - solverPerfT = TEqn.solve(); + solverPerfT = TEqn.solve(); - T.relax(); + T.relax(); -# include "calculateRelResT.H" +# include "calculateRelResT.H" - if (iCorr % infoFrequency == 0) - { - Info<< "\tCorrector " << iCorr - << ", residual = " << solverPerfT.initialResidual() - << ", relative res = " << relResT - << ", inner iters = " << solverPerfT.nIterations() << endl; - } - } - while - ( - relResT > convergenceToleranceT - && - ++iCorr < nCorr - ); + if (iCorr % infoFrequency == 0) + { + Info<< "\tCorrector " << iCorr + << ", residual = " << solverPerfT.initialResidual() + << ", relative res = " << relResT + << ", inner iters = " << solverPerfT.nIterations() << endl; + } + } + while + ( + relResT > convergenceToleranceT + && ++iCorr < nCorr + ); - Info<< "Solved for " << T.name() - << " using " << solverPerfT.solverName() - << " in " << iCorr << " iterations" - << ", residual = " << solverPerfT.initialResidual() - << ", relative res = " << relResT << nl - << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << ", ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info<< "Solved for " << T.name() + << " using " << solverPerfT.solverName() + << " in " << iCorr << " iterations" + << ", residual = " << solverPerfT.initialResidual() + << ", relative res = " << relResT << nl + << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << ", ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; - // solve momentum equation for displacement - iCorr = 0; - volVectorField gradThreeKalphaDeltaT = - fvc::grad(threeKalpha*(T-T0), "grad(threeKalphaDeltaT)"); - surfaceVectorField threeKalphaDeltaTf = - mesh.Sf()*threeKalphaf*fvc::interpolate(T-T0, "deltaT"); + // Solve momentum equation for displacement + iCorr = 0; + volVectorField gradThreeKalphaDeltaT = + fvc::grad(threeKalpha*(T-T0), "grad(threeKalphaDeltaT)"); + surfaceVectorField threeKalphaDeltaTf = + mesh.Sf()*threeKalphaf*fvc::interpolate(T-T0, "deltaT"); - Info<< "Solving for " << U.name() << nl; - do + Info<< "Solving for " << U.name() << nl; + do { U.storePrevIter(); -# include "calculateDivSigmaExp.H" +# include "calculateDivSigmaExp.H" // Linear momentum equaiton fvVectorMatrix UEqn - ( - rho*fvm::d2dt2(U) - == - fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") - + divSigmaExp - ); + ( + rho*fvm::d2dt2(U) + == + fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)") + + divSigmaExp + ); solverPerfU = UEqn.solve(); if (aitkenRelax) { -# include "aitkenRelaxation.H" +# include "aitkenRelaxation.H" } else { @@ -148,7 +147,7 @@ int main(int argc, char *argv[]) gradU = fvc::grad(U); -# include "calculateRelResU.H" +# include "calculateRelResU.H" if (iCorr == 0) { @@ -160,6 +159,7 @@ int main(int argc, char *argv[]) Info<< "\tCorrector " << iCorr << ", residual = " << solverPerfU.initialResidual() << ", relative res = " << relResU; + if (aitkenRelax) { Info << ", aitken = " << aitkenTheta; @@ -167,25 +167,24 @@ int main(int argc, char *argv[]) Info<< ", inner iters = " << solverPerfU.nIterations() << endl; } } - while - ( - iCorr++ == 0 - || - (//solverPerfU.initialResidual() > convergenceTolerance - relResU > convergenceToleranceU - && - iCorr < nCorr) - ); + while + ( + iCorr++ == 0 + || ( + relResU > convergenceToleranceU + && iCorr < nCorr + ) + ); - Info<< "Solved for " << U.name() - << " using " << solverPerfU.solverName() - << " in " << iCorr << " iterations" - << ", initial res = " << initialResidual - << ", final res = " << solverPerfU.initialResidual() - << ", final rel res = " << relResU << nl - << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << ", ClockTime = " << runTime.elapsedClockTime() << " s" - << endl; + Info<< "Solved for " << U.name() + << " using " << solverPerfU.solverName() + << " in " << iCorr << " iterations" + << ", initial res = " << initialResidual + << ", final res = " << solverPerfU.initialResidual() + << ", final rel res = " << relResU << nl + << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << ", ClockTime = " << runTime.elapsedClockTime() << " s" + << endl; # include "calculateEpsilonSigma.H" # include "writeFields.H" diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/T b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/T index a693bb903..4824e3cc0 100644 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/T +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/T @@ -32,27 +32,23 @@ boundaryField inside { - type fixedValue; - value uniform 100; + type fixedValue; + value uniform 100; } - outside { - type fixedValue; - value uniform 100; + type fixedValue; + value uniform 100; } - front { - type empty; - //type symmetryPlane; + type empty; } - back { - type empty; - //type symmetryPlane; + type empty; } } + // ************************************************************************* // diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/U b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/U index cbe770106..dd1957b17 100644 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/U +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/0/U @@ -29,32 +29,31 @@ boundaryField { type symmetryPlane; } - inside { - type solidTraction; - traction uniform ( 0 0 0 ); - pressure uniform 50e6; - value uniform (0 0 0); + type solidTraction; + traction uniform ( 0 0 0 ); + pressure uniform 50e6; + DT k; + value uniform (0 0 0); } - outside { type solidTraction; traction uniform ( 0 0 0 ); pressure uniform 0.1e6; + DT k; value uniform (0 0 0); } - front { - type empty; + type empty; } - back { - type empty; + type empty; } } + // ************************************************************************* // diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/Allrun b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/Allrun index 1eb6aec58..394b0dcf8 100755 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/Allrun +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/Allrun @@ -9,4 +9,4 @@ runApplication blockMesh runApplication $application (cd analyticalHotCylinder && runApplication wmake) -runApplication analyticalHotCylinder \ No newline at end of file +runApplication analyticalHotCylinder diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/blockMeshDict b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/blockMeshDict index 5cd413a66..e0274395f 100644 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/blockMeshDict +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/blockMeshDict @@ -19,15 +19,14 @@ convertToMeters 1; vertices ( - (0 0.5 0) - (0.5 0 0) - (0.7 0 0) - (0 0.7 0) - (0 0.5 0.1) - (0.5 0 0.1) - (0.7 0 0.1) - (0 0.7 0.1) - + (0 0.5 0) + (0.5 0 0) + (0.7 0 0) + (0 0.7 0) + (0 0.5 0.1) + (0.5 0 0.1) + (0.7 0 0.1) + (0 0.7 0.1) ); blocks @@ -45,34 +44,30 @@ edges patches ( - + symmetryPlane left + ( + (4 7 3 0) + ) + symmetryPlane bottom + ( + (1 2 6 5) + ) + patch inside + ( + (0 1 5 4) + ) + patch outside + ( + (7 6 2 3) + ) empty back ( - (3 2 1 0) + (3 2 1 0) ) empty front ( - (4 5 6 7) - ) - - symmetryPlane left - ( - (4 7 3 0) - ) - - symmetryPlane bottom - ( - (1 2 6 5) - ) - - patch inside - ( - (0 1 5 4) - ) - patch outside - ( - (7 6 2 3) - ) + (4 5 6 7) + ) ); mergePatchPairs diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/boundary b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/boundary index 498479cec..44af09850 100644 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/boundary +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.0 | +| \\ / O peration | Version: 3.0 | | \\ / A nd | Web: http://www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -17,41 +17,41 @@ FoamFile 6 ( - back - { - type empty; - nFaces 600; - startFace 1130; - } - front - { - type empty; - nFaces 600; - startFace 1730; - } left { type symmetryPlane; nFaces 10; - startFace 2330; + startFace 1130; } bottom { type symmetryPlane; nFaces 10; - startFace 2340; + startFace 1140; } inside { type patch; nFaces 60; - startFace 2350; + startFace 1150; } outside { type patch; nFaces 60; - startFace 2410; + startFace 1210; + } + back + { + type empty; + nFaces 600; + startFace 1270; + } + front + { + type empty; + nFaces 600; + startFace 1870; } ) diff --git a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/thermalProperties b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/thermalProperties index 41a212479..a9d516ba9 100644 --- a/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/thermalProperties +++ b/tutorials/solidMechanics/elasticThermalSolidFoam/hotCylinder/constant/thermalProperties @@ -16,11 +16,12 @@ FoamFile thermal { - type constant; - C C [0 2 -2 -1 0 0 0] 434; - k k [1 1 -3 -1 0 0 0] 250; - alpha alpha [0 0 0 -1 0 0 0] 2.3e-05; - T0 T0 [0 0 0 1 0 0 0] 0; + type constant; + C C [0 2 -2 -1 0 0 0] 434; + k k [1 1 -3 -1 0 0 0] 250; + alpha alpha [0 0 0 -1 0 0 0] 2.3e-05; + T0 T0 [0 0 0 1 0 0 0] 0; } + // ************************************************************************* // From dd8104299811ec2ebb1c5c1ca155dfae38166a4a Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 10 Apr 2014 20:55:00 +0100 Subject: [PATCH 049/197] Update for segregated FEM matrix --- .../femStress/Traction/TractionPointPatchVectorField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C b/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C index a10dadc9d..e86c31a73 100644 --- a/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C +++ b/applications/solvers/solidMechanics/stressFemFoam/femStress/Traction/TractionPointPatchVectorField.C @@ -230,7 +230,7 @@ addBoundarySourceDiag const vectorField& pointNormals = this->patch().pointNormals(); const label nFaces = this->patch().nFaces(); - vectorField& b = matrix.b(); + vectorField& b = matrix.source(); for (label faceI = 0; faceI < nFaces; faceI++) { From 9db44eed51fc031dd6e676b759701b814d29c6c6 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 11 Apr 2014 15:47:17 +0100 Subject: [PATCH 050/197] Added option to write empty sets --- .../parallelProcessing/decomposeSets/decomposeSets.C | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C index 765a9788b..ed3eb01e8 100644 --- a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C +++ b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C @@ -43,11 +43,16 @@ int main(int argc, char *argv[]) argList::noParallel(); # include "addRegionOption.H" + // Add option to write empty sets + argList::validOptions.insert("writeEmptySets", ""); + # include "setRootCase.H" # include "createTime.H" Info<< "Time = " << runTime.timeName() << endl; + bool writeEmptySets = args.optionFound("writeEmptySets"); + // Determine the processor count directly label nProcs = 0; while (isDir(args.path()/(word("processor") + name(nProcs)))) @@ -133,7 +138,7 @@ int main(int argc, char *argv[]) } } - if (!procSet.empty()) + if (!procSet.empty() || writeEmptySets) { // Set created, write it Info<< "Writing point set " << set.name() @@ -179,7 +184,7 @@ int main(int argc, char *argv[]) } } - if (!procSet.empty()) + if (!procSet.empty() || writeEmptySets) { // Set created, write it Info<< "Writing face set " << set.name() @@ -223,7 +228,7 @@ int main(int argc, char *argv[]) } } - if (!procSet.empty()) + if (!procSet.empty() || writeEmptySets) { // Set created, write it Info<< "Writing cell set " << set.name() From 9e35f5c2c4b0636e4d711c1a98ff6527e390a4b2 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 11 Apr 2014 15:48:13 +0100 Subject: [PATCH 051/197] Removed size check: may interfere with parallel communication --- src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 1c10647b7..8f25b622c 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -738,7 +738,7 @@ Foam::tmp > Foam::fvMatrix::DD() const { const fvPatchField& ptf = psi_.boundaryField()[patchI]; - if (!ptf.coupled() && ptf.size()) + if (!ptf.coupled()) { addToInternalField ( From 1ed37f5e88029728d14b88cbb4931b5b66d2c0a5 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 11 Apr 2014 15:49:20 +0100 Subject: [PATCH 052/197] Formatting --- src/finiteVolume/fvMesh/wallDist/reflectionVectors.C | 3 +-- src/finiteVolume/fvMesh/wallDist/wallDist.C | 5 +++-- src/finiteVolume/fvMesh/wallDist/wallDistData.C | 3 ++- src/meshTools/cellDist/cellDistFuncs.H | 4 +++- src/meshTools/cellDist/patchWave/patchWave.C | 1 + src/meshTools/cellDist/patchWave/patchWave.H | 2 +- src/meshTools/cellDist/wallPoint/wallPoint.H | 8 +++++--- src/meshTools/cellDist/wallPoint/wallPointData.H | 2 +- src/meshTools/meshSearch/meshSearch.H | 8 ++++---- .../meshToMesh/calculateMeshToMeshAddressing.C | 10 ++++------ 10 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/finiteVolume/fvMesh/wallDist/reflectionVectors.C b/src/finiteVolume/fvMesh/wallDist/reflectionVectors.C index 39ce85dfd..b2a5a6d57 100644 --- a/src/finiteVolume/fvMesh/wallDist/reflectionVectors.C +++ b/src/finiteVolume/fvMesh/wallDist/reflectionVectors.C @@ -49,13 +49,12 @@ Foam::reflectionVectors::reflectionVectors(const Foam::fvMesh& mesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::reflectionVectors::correct() { const fvMesh& mesh = n_.mesh(); const fvPatchList& patches = mesh.boundary(); - forAll(patches, patchi) + forAll (patches, patchi) { // find the nearest face for every cell if (patches[patchi].isWall()) diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist.C b/src/finiteVolume/fvMesh/wallDist/wallDist.C index cc51ec843..65fb89159 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDist.C @@ -69,7 +69,8 @@ void Foam::wallDist::correct() // AJ: make sure to pick up all patches that are specified as a wall const polyBoundaryMesh& bMesh = cellDistFuncs::mesh().boundaryMesh(); labelHashSet wallPatchIDs(bMesh.size()); - forAll(bMesh, patchI) + + forAll (bMesh, patchI) { if (bMesh[patchI].isWall()) { @@ -87,7 +88,7 @@ void Foam::wallDist::correct() transfer(wave.distance()); // Transfer values on patches into boundaryField of *this - forAll(boundaryField(), patchI) + forAll (boundaryField(), patchI) { if (!isA(boundaryField()[patchI])) { diff --git a/src/finiteVolume/fvMesh/wallDist/wallDistData.C b/src/finiteVolume/fvMesh/wallDist/wallDistData.C index 5315c75f3..3f6cb68de 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDistData.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDistData.C @@ -72,7 +72,8 @@ Foam::wallDistData::~wallDistData() template void Foam::wallDistData::correct() { - Info<< "wallDistData.correct() called" << endl; + Info<< "wallDistData.correct() called" << endl; + const polyMesh& mesh = cellDistFuncs::mesh(); // diff --git a/src/meshTools/cellDist/cellDistFuncs.H b/src/meshTools/cellDist/cellDistFuncs.H index 978c1d25f..ffe18704c 100644 --- a/src/meshTools/cellDist/cellDistFuncs.H +++ b/src/meshTools/cellDist/cellDistFuncs.H @@ -80,10 +80,12 @@ class cellDistFuncs //- Disallow default bitwise assignment void operator=(const cellDistFuncs&); + public: ClassName("cellDistFuncs"); + // Constructors //- Construct from mesh @@ -101,7 +103,7 @@ public: //- Get patchIDs of named patches labelHashSet getPatchIDs(const wordList&) const; - //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch') + //- Get patchIDs of/derived off certain type (e.g. processorPolyPatch) // Uses isA, not isType template labelHashSet getPatchIDs() const; diff --git a/src/meshTools/cellDist/patchWave/patchWave.C b/src/meshTools/cellDist/patchWave/patchWave.C index 219e21362..0c5367b83 100644 --- a/src/meshTools/cellDist/patchWave/patchWave.C +++ b/src/meshTools/cellDist/patchWave/patchWave.C @@ -126,6 +126,7 @@ Foam::label Foam::patchWave::getValues(const MeshWave& waveInfo) } } } + return nIllegal; } diff --git a/src/meshTools/cellDist/patchWave/patchWave.H b/src/meshTools/cellDist/patchWave/patchWave.H index 75501a7d9..235e86a37 100644 --- a/src/meshTools/cellDist/patchWave/patchWave.H +++ b/src/meshTools/cellDist/patchWave/patchWave.H @@ -109,6 +109,7 @@ public: bool correctWalls = true ); + // Destructor virtual ~patchWave(); @@ -145,7 +146,6 @@ public: { return patchDistance_; } - }; diff --git a/src/meshTools/cellDist/wallPoint/wallPoint.H b/src/meshTools/cellDist/wallPoint/wallPoint.H index 9304bf545..dc86944f2 100644 --- a/src/meshTools/cellDist/wallPoint/wallPoint.H +++ b/src/meshTools/cellDist/wallPoint/wallPoint.H @@ -71,6 +71,7 @@ class wallPoint //- normal distance (squared) from cellcenter to origin scalar distSqr_; + // Private Member Functions //- Evaluate distance to point. Update distSqr, origin from whomever @@ -88,7 +89,7 @@ public: // Static data members - //- initial point far away. + //- Initial point far away static point greatPoint; @@ -130,7 +131,8 @@ public: // still contains original (invalid) value. inline bool valid() const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data + // Used for cyclics checking inline bool sameGeometry ( const polyMesh&, @@ -138,7 +140,7 @@ public: const scalar ) const; - //- Convert any absolute coordinates into relative to (patch)face + //- Convert any absolute coordinates into relative to (patch) face // centre inline void leaveDomain ( diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.H b/src/meshTools/cellDist/wallPoint/wallPointData.H index 9001478f8..007f41eba 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointData.H +++ b/src/meshTools/cellDist/wallPoint/wallPointData.H @@ -65,7 +65,7 @@ class wallPointData { // Private data - //- data at nearest wall center + //- Data at nearest wall center Type data_; diff --git a/src/meshTools/meshSearch/meshSearch.H b/src/meshTools/meshSearch/meshSearch.H index 110b8c84e..00017fc4c 100644 --- a/src/meshTools/meshSearch/meshSearch.H +++ b/src/meshTools/meshSearch/meshSearch.H @@ -135,7 +135,7 @@ class meshSearch ) const; //- Calculate offset vector in direction dir with as length a - // fraction of the cell size (of the cell straddling boundary face) + // fraction of the cell size of the cell straddling boundary face vector offset ( const point& bPoint, @@ -183,14 +183,14 @@ public: return mesh_; } - //- Get (demand driven) reference to octree holding all + //- Get demand driven reference to octree holding all // boundary faces const indexedOctree& boundaryTree() const; - //- Get (demand driven) reference to octree holding all cells + //- Get demand driven reference to octree holding all cells const indexedOctree& cellTree() const; - //- Get (demand driven) reference to octree holding all cell centres + //- Get demand driven reference to octree holding all cell centres const indexedOctree& cellCentreTree() const; diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C index 760b37c0a..296fb963c 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C @@ -244,10 +244,9 @@ void meshToMesh::cellAddresses bool forceFind ) const { - label nCellsOutsideAddressing = 0; - // the implemented search method is a simple neighbour array search. + // The implemented search method is a simple neighbour array search. // It starts from a cell zero, searches its neighbours and finds one // which is nearer to the target point than the current position. // The location of the "current position" is reset to that cell and @@ -264,7 +263,6 @@ void meshToMesh::cellAddresses forAll (points, toI) { - scalar localTol = cellCentreDistanceTol; bool isBoundary = false; @@ -272,7 +270,7 @@ void meshToMesh::cellAddresses // pick up target position const vector& p = points[toI]; - // set the sqr-distance + // Set the sqr-distance scalar distSqr = magSqr(p - centresFrom[curCell]); bool closer; @@ -281,7 +279,7 @@ void meshToMesh::cellAddresses { closer = false; - // set the current list of neighbouring cells + // Set the current list of neighbouring cells const labelList& neighbours = cc[curCell]; forAll (neighbours, nI) @@ -289,7 +287,7 @@ void meshToMesh::cellAddresses scalar curDistSqr = magSqr(p - centresFrom[neighbours[nI]]); - // search through all the neighbours. + // Search through all the neighbours. // If the cell is closer, reset current cell and distance if (curDistSqr < (1 - SMALL)*distSqr) { From 1cdd6a6f0c486ddf0e0f02d1ab53c4d905453a99 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Sat, 12 Apr 2014 20:27:41 +0200 Subject: [PATCH 053/197] Library needed to allow dynamic loading on Mac OS X --- src/decompositionMethods/scotchDecomp/Make/options | 1 + 1 file changed, 1 insertion(+) diff --git a/src/decompositionMethods/scotchDecomp/Make/options b/src/decompositionMethods/scotchDecomp/Make/options index 0b79ad423..24093b515 100644 --- a/src/decompositionMethods/scotchDecomp/Make/options +++ b/src/decompositionMethods/scotchDecomp/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ ifeq ($(WM_ARCH_BASE), darwin) /* No librt for Mac OS X */ LIB_LIBS = \ + -lfoam \ -L$(SCOTCH_LIB_DIR) -lscotch \ -L$(SCOTCH_LIB_DIR) -lscotcherrexit else From 56cebd6a39f7df22169dc21e5a53062df774f7b0 Mon Sep 17 00:00:00 2001 From: wyldckat Date: Sun, 13 Apr 2014 09:52:16 +0100 Subject: [PATCH 054/197] README.ThirdParty and AllMake.stage5: Changed tabs to spaces, for editing coherence. --- ThirdParty/AllMake.stage5 | 48 ++++++++++++++++++------------------ ThirdParty/README.ThirdParty | 4 +-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ThirdParty/AllMake.stage5 b/ThirdParty/AllMake.stage5 index 2db7ef8b5..ef9d5ad42 100755 --- a/ThirdParty/AllMake.stage5 +++ b/ThirdParty/AllMake.stage5 @@ -70,42 +70,42 @@ then # centralized under the same scratch area if [ ! -e ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION ]; then - echo "Checking for a Mercurial client: hg" + echo "Checking for a Mercurial client: hg" command -v hg >/dev/null if [ $? -eq 0 ]; - then - echo "Using Mercurial/hg to download the source code for swak4Foam" - ( - cd ./rpmBuild/BUILD; - hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION; - cd swak4Foam-$SWAK_RELEASE_VERSION; - hg checkout version_${SWAK_RELEASE_VERSION}_v2.x - ) + then + echo "Using Mercurial/hg to download the source code for swak4Foam" + ( + cd ./rpmBuild/BUILD; + hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION; + cd swak4Foam-$SWAK_RELEASE_VERSION; + hg checkout version_${SWAK_RELEASE_VERSION}_v2.x + ) else - echo "Warning: Mercurial/hg is not installed. Switching to an alternate Subversion repository" + echo "Warning: Mercurial/hg is not installed. Switching to an alternate Subversion repository" command -v svn >/dev/null if [ $? -eq 0 ]; - then - echo "Using Subversion/svn to download the source code for swak4Foam" - echo "Error: current Subversion-version does not support foam3. Please install mercurial" - exit -1 - (cd ./rpmBuild/BUILD; svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.7/libraries/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION) + then + echo "Using Subversion/svn to download the source code for swak4Foam" + echo "Error: current Subversion-version does not support foam3. Please install mercurial" + exit -1 + (cd ./rpmBuild/BUILD; svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.7/libraries/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION) else - echo "Error: Please install either a Mercurial or Subversion client in order to download the source code for swak4Foam" - exit -1 - fi - fi + echo "Error: Please install either a Mercurial or Subversion client in order to download the source code for swak4Foam" + exit -1 + fi + fi # We move the compilation results directly to $FOAM_SITE_APPBIN and $FOAM_SITE_LIBBIN # If you prefer to keep the libraries and tools under $FOAM_USER_LIBBIN and $FOAM_USER_APPBIN, simply # comment out the next two lines - (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name files | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g") - (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name options | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g") + (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name files | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g") + (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; find . -name options | xargs -n 1 sed -i.old "s/FOAM_USER/FOAM_SITE/g") # We recompile everything - (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; ./Allwclean; ./Allwmake) + (cd ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION; ./Allwclean; ./Allwmake) else - echo "The source code for swak4Foam is already present under ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION" - echo "Please remove this directory if you want to refresh your installation of swak4Foam" + echo "The source code for swak4Foam is already present under ./rpmBuild/BUILD/swak4Foam-$SWAK_RELEASE_VERSION" + echo "Please remove this directory if you want to refresh your installation of swak4Foam" fi echo "" else diff --git a/ThirdParty/README.ThirdParty b/ThirdParty/README.ThirdParty index d7c141b0a..4381be5e7 100644 --- a/ThirdParty/README.ThirdParty +++ b/ThirdParty/README.ThirdParty @@ -136,7 +136,7 @@ through when starting the compilation from scratch: - The .rpm files will be located under the directory $WM_THIRD_PARTY_DIR/rpmBuild/RPMS - - The .tgz files will be located under the directory + - The .tgz files will be located under the directory $WM_THIRD_PARTY_DIR/rpmBuild/TGZS e: The default installation root directory is "$WM_THIRD_PARTY_DIR". @@ -158,7 +158,7 @@ Warning: This section is a bit advanced, and as of yet, I have no evidence that this feature has ever been used by anybody. So please feel free to skip this section if you don't need to relocate your ThirdParty packages installation directory, which you should not have do on most - installation anyway. + installation anyway. a: All the generated RPMs can be relocated, meaning that you can override the hard-coded root installation directory when using those RPMs for From 2301f8e58f55a8d793c236a3d1d8d1c3eca1d6a6 Mon Sep 17 00:00:00 2001 From: wyldckat Date: Sun, 13 Apr 2014 09:54:23 +0100 Subject: [PATCH 055/197] AllMake.stage5: Changed SVN repo for swak4Foam to 2.0, since it's the one to be used for FOAM-Extend 3.0. --- ThirdParty/AllMake.stage5 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ThirdParty/AllMake.stage5 b/ThirdParty/AllMake.stage5 index ef9d5ad42..ef6ca0cdc 100755 --- a/ThirdParty/AllMake.stage5 +++ b/ThirdParty/AllMake.stage5 @@ -87,9 +87,7 @@ then if [ $? -eq 0 ]; then echo "Using Subversion/svn to download the source code for swak4Foam" - echo "Error: current Subversion-version does not support foam3. Please install mercurial" - exit -1 - (cd ./rpmBuild/BUILD; svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.7/libraries/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION) + (cd ./rpmBuild/BUILD; svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/libraries/swak4Foam swak4Foam-$SWAK_RELEASE_VERSION) else echo "Error: Please install either a Mercurial or Subversion client in order to download the source code for swak4Foam" exit -1 From a9ea67f54a1bb8f9b0349b4488688ccce5679404 Mon Sep 17 00:00:00 2001 From: wyldckat Date: Sun, 13 Apr 2014 10:17:28 +0100 Subject: [PATCH 056/197] vtkPV4Foam/Make/options: Added missing reference to '-lfoam', through using the generic the more '-l$(WM_PROJECT)' reference. --- .../graphics/PV4FoamReader/vtkPV4Foam/Make/options | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/utilities/postProcessing/graphics/PV4FoamReader/vtkPV4Foam/Make/options b/applications/utilities/postProcessing/graphics/PV4FoamReader/vtkPV4Foam/Make/options index 879a02de4..eed716426 100644 --- a/applications/utilities/postProcessing/graphics/PV4FoamReader/vtkPV4Foam/Make/options +++ b/applications/utilities/postProcessing/graphics/PV4FoamReader/vtkPV4Foam/Make/options @@ -6,6 +6,7 @@ EXE_INC = \ -I../PV4FoamReader LIB_LIBS = \ + -l$(WM_PROJECT) \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ From 324993b1a633493a4cbff956746950e974375fd3 Mon Sep 17 00:00:00 2001 From: wyldckat Date: Sun, 13 Apr 2014 10:42:30 +0100 Subject: [PATCH 057/197] foamToTecplot360/tecio/tecsrc/Make/tecioOptions: Added '-DENGINE', so that building tecio doesn't require X.org development files. --- .../foamToTecplot360/tecio/tecsrc/Make/tecioOptions | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions index 951b3978c..cb1c12e73 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions @@ -1,24 +1,24 @@ #if defined(linux64) - TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 -DENGINE #elif defined(darwinIntel) || defined(darwinIntel64) || defined(darwinPpc) || defined(darwinPpc64) - TECIO_FLAGS = -DMAKEARCHIVE -DDARWIN -DUSEENUM -DTHREED -U_WIN32 + TECIO_FLAGS = -DMAKEARCHIVE -DDARWIN -DUSEENUM -DTHREED -U_WIN32 -DENGINE #elif defined(linuxIA64) - TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUXI64 -DUSEENUM -DTHREED -U_WIN32 + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUXI64 -DUSEENUM -DTHREED -U_WIN32 -DENGINE #elif defined(linux) - TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 -DENGINE #elif defined(darwinIntel) # warning "DarwinIntel architecture detected" - TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 -DENGINE #else From 78877f093028b2a8cde999b01b6527def532160f Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Fri, 2 May 2014 16:43:01 +0200 Subject: [PATCH 058/197] FEAT: foamMeshToElmer & fluentMeshToElmer utilities --- .../conversion/fluent3DMeshToElmer/Make/files | 3 + .../fluent3DMeshToElmer/Make/options | 9 + .../fluent3DMeshToElmer/fluent3DMeshToElmer.L | 1392 +++++++++++++++++ .../conversion/foamMeshToElmer/Make/files | 3 + .../conversion/foamMeshToElmer/Make/options | 6 + .../foamMeshToElmer/foamMeshToElmer.C | 122 ++ .../conversion/foamMeshToElmer/getTimeIndex.H | 51 + src/conversion/Make/files | 1 + .../meshWriter/elmer/ElmerMeshWriter.C | 560 +++++++ .../meshWriter/elmer/ElmerMeshWriter.H | 93 ++ 10 files changed, 2240 insertions(+) create mode 100644 applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/files create mode 100644 applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/options create mode 100644 applications/utilities/mesh/conversion/fluent3DMeshToElmer/fluent3DMeshToElmer.L create mode 100644 applications/utilities/mesh/conversion/foamMeshToElmer/Make/files create mode 100644 applications/utilities/mesh/conversion/foamMeshToElmer/Make/options create mode 100644 applications/utilities/mesh/conversion/foamMeshToElmer/foamMeshToElmer.C create mode 100644 applications/utilities/mesh/conversion/foamMeshToElmer/getTimeIndex.H create mode 100644 src/conversion/meshWriter/elmer/ElmerMeshWriter.C create mode 100644 src/conversion/meshWriter/elmer/ElmerMeshWriter.H diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/files b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/files new file mode 100644 index 000000000..e5892c56d --- /dev/null +++ b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/files @@ -0,0 +1,3 @@ +fluent3DMeshToElmer.L + +EXE = $(FOAM_APPBIN)/fluent3DMeshToElmer diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/options b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/options new file mode 100644 index 000000000..4803cbfb1 --- /dev/null +++ b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/conversion/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lconversion \ + -ldynamicMesh diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToElmer/fluent3DMeshToElmer.L b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/fluent3DMeshToElmer.L new file mode 100644 index 000000000..02a76d7e5 --- /dev/null +++ b/applications/utilities/mesh/conversion/fluent3DMeshToElmer/fluent3DMeshToElmer.L @@ -0,0 +1,1392 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Application + fluent3DMeshToFoam + +Description + Converts a Fluent mesh to FOAM format. + +\*---------------------------------------------------------------------------*/ + +%{ +#undef yyFlexLexer + + /* ------------------------------------------------------------------------ *\ + ------ local definitions + \* ------------------------------------------------------------------------ */ + +#include "argList.H" +#include "objectRegistry.H" +#include "Time.H" +#include "polyMesh.H" +#include "directTopoChange.H" +#include "polyMeshZipUpCells.H" +#include "wallPolyPatch.H" +#include "symmetryPolyPatch.H" +#include "cyclicPolyPatch.H" +#include "Swap.H" +#include "IFstream.H" +#include "wordIOList.H" +#include "readHexLabel.H" +#include "ElmerMeshWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Line number +label lineNo = 1; + +// Scale factor used to scale points (optional command line argument) +scalar scaleFactor = 1.0; + +label dimensionOfGrid = 0; +label nPoints = 0; +label nFaces = 0; +label nCells = 0; + +bool hangingNodes = false; + +pointField points(0); +faceList faces(0); +labelList owner(0); +labelList neighbour(0); + +// Group type and name +Map groupType(100); +Map groupName(100); + +// Point groups +DynamicList