diff --git a/CHANGELOG.md b/CHANGELOG.md index d9da880393f3aab057a58c593b10db1c268fb2c1..e996d6c934571b05d82de60337886b945a300455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +Differences Between DuMuX 2.11 and DuMuX 2.12 +============================================= + +* IMPORTANT NOTES: + - DuMuX 2.12 is expected to run based on Dune 2.4.1, 2.5 and the Dune + master. We will try to keep the compatibility with the Dune master + as long as it is technically feasible and our resources allow it. If + you want to use Dumux multidomain models, you have to stick with the + Dune 2.4 core and specific versions of other modules, see + `test/multidomain/README` for details. + + - DuMux 2.12 requires at least GCC 4.9 or Clang 3.5 in their C++-14 mode. + + - For employing corner-point grids by means of opm-grid (former + dune-cornerpoint), the OPM release 2016.04 has to be used. + +* IMPROVEMENTS and ENHANCEMENTS: + +* IMMEDIATE INTERFACE CHANGES not allowing/requiring a deprecation period: + - gnuplotinterface.hh: The add...ToPlot() functions have changed signature, + the curve name/title is not mandatory anymore and can be specified together + with the curve options. + +* Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.12: BEWARE: The + compiler will not print any warning if a deprecated property or parameter name + is used. If possible, a run-time warning will appear in the summary lines + after the corresponding run. + +* Deprecated CLASSES/FILES, to be removed after 2.12: + +* Deprecated MEMBER FUNCTIONS, to be removed after 2.12: + +* DELETED classes/files, property names, constants/enums, + member functions, which have been deprecated in DuMuX 2.11 : + - Everything listed as deprecated below has been removed. + + Differences Between DuMuX 2.10 and DuMuX 2.11 ============================================= @@ -15,11 +52,63 @@ Differences Between DuMuX 2.10 and DuMuX 2.11 dune-cornerpoint), the OPM release 2016.04 has to be used. * IMPROVEMENTS and ENHANCEMENTS: + - The two-component models using a mass-based formulation together with a + total mass balance (`ReplaceCompEqIdx`) do now consider the diffusive mass + fluxes of the components in the total mass balance. The sum of the two + diffusive mass fluxes do not cancel out, because the Fickian diffusion + assumes the two diffusive mole fluxes to cancel out. + + - The calculation of the gas viscosity for the component `Air` has been + improved, making it more accurate. + + - For the `TwoPTwoC` models, the Kelvin equation was implemented, which + accounts for a lowering of the saturated vapor pressure due to high + capillary pressures. + + - A grid creator for piece-of-cake-type grids has been added. It is capable + of creating meshes with gradually in- and decreasing distances between + nodes. It also allows the creation of a 360° cake where the last elements + are connected to the first elements. + + - An absolute residual criterion has been implemented for the Newton solver. + The criterion is enabled by using the property + `EnableAbsoluteResidualCriterion`. The property `MaxAbsoluteResidual` + speficies the convergence tolerance. + + - The folder `bin/moduleutil` was added. It contains two scripts: + `getusedversions.sh` to extract the versions used for each Dune/Dumux + module and `extractmodulepart.sh` to extract a Dumux module only + containing the necessary files for compiling specified executables (this + script was used to create the dumux-pub modules). + + - A python script `l2error.py` for the post-process calculation of the L2 + error from Vtk files has been added in `bin/postprocessing`. * IMMEDIATE INTERFACE CHANGES not allowing/requiring a deprecation period: - - In the ZeroEq models, the properties BBoxMinIsWall and BBoxMaxIsWall have - been replaced by the functions bBoxMaxIsWall() and bBoxMaxIsWall() in the - problem file. + - `shouldWriteRestartFile()` is now, as `shouldWriteOutput()` already was, + called before the time level is advanced. So it might be necessary to use + `...WillBeFinished` instead of `...IsFinished` for writing restart files at + the correct time. + + - In the `ZeroEq` models, the properties `BBoxMinIsWall` and `BBoxMaxIsWall` + have been replaced by the functions `bBoxMaxIsWall()` and + `bBoxMaxIsWall()` in the problem file. + + - In the `TwoPNC` (and, consequently the `TwoPNCMin`) models, the old + formulations `pgSl`, `plSg` as well as `pnSw` and `pwSg` have been + replaced by the `pnsw` and `pwsn`, to satisfy the naming convention and be + consistent with `TwoPTwoC`. + + - In the `TwoPTwoC` model, the indices are no longer dependent on the + formulation. Further, the values of `nPhaseOnly` and `bothPhases` + have been harmonized with those in `TwoPNC`. + + - In the `NC` models, the initial phase presence is now set by the function + `initialPhasePresenceAtPos(globalPos)` instead of + `initialPhasePresence(vertex, vIdxGlobal, globalPos)` in the problem file. + + - The script `fix_includes.sh` was removed, which was only necessary + for transition from 2.8 to 2.9 * Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.11: BEWARE: The compiler will not print any warning if a deprecated property or parameter name @@ -27,6 +116,7 @@ Differences Between DuMuX 2.10 and DuMuX 2.11 after the corresponding run. * Deprecated CLASSES/FILES, to be removed after 2.11: + - `ComputeFromReferencePhase2pNC` is replaced by `ComputeFromReferencePhase2p` * Deprecated MEMBER FUNCTIONS, to be removed after 2.11: @@ -97,6 +187,10 @@ Differences Between DuMuX 2.9 and DuMuX 2.10 This is important if you implement problem classes not deriving from the base problem classes in Dumux (`ImplicitProblem`, `OneModelProblem`, `ImpetProblem`, and `MultidomainProblem`). + - All name-related methods that previously returned / received `const char*` + do now use the type-safe alternative `std::string`. An example is + `FluidSystem::componentName()`. If you need a + `const char*` for special operation use the string member `c_str()`. * Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.10: BEWARE: The compiler will not print any warning if a deprecated property or parameter name diff --git a/LICENSE.md b/LICENSE.md index 64c8aa6d7c7575936b860d79f7516bc697ced49e..cc5d10056089f7d2e308a6c9edd18a160a9e70ac 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -6,10 +6,10 @@ Copyright holders | Year | Name | |------------|----------------------------| -| 2016 | Sina Ackermann | +| 2016-2017 | Sina Ackermann | | 2010-2014 | Katherina Baber | -| 2015-2016 | Martin Beck | -| 2013-2016 | Beatrix Becker | +| 2015-2017 | Martin Beck | +| 2013-2017 | Beatrix Becker | | 2014 | Markus Blatt | | 2010 | Felix Bode | | 2007-2011 | Yufei Cao | @@ -18,37 +18,39 @@ Copyright holders | 2008-2009 | Onur Dogan | | 2009-2011 | Karin Erbertseder | | 2009-2014 | Benjamin Faigle | -| 2013-2016 | Thomas Fetzer | -| 2007-2016 | Bernd Flemisch | +| 2013-2017 | Thomas Fetzer | +| 2007-2017 | Bernd Flemisch | | 2007-2010 | Jochen Fritz | | 2015-2016 | Georg Futter | -| 2015-2016 | Dennis Gläser | -| 2012-2016 | Christoph Grüninger | -| 2016 | Katharina Heck | -| 2015-2016 | Johannes Hommel | +| 2015-2017 | Dennis Gläser | +| 2012-2017 | Christoph Grüninger | +| 2016-2017 | Katharina Heck | +| 2017 | Rainer Helmig | +| 2015-2017 | Johannes Hommel | | 2012-2015 | Vishal Jambhekar | | 2013-2014 | Muhammad Adil Javed | -| 2012-2016 | Alexander Kissinger | -| 2013-2016 | Timo Koch | +| 2017 | Kata Kurgyis | +| 2012-2017 | Alexander Kissinger | +| 2013-2017 | Timo Koch | | 2008-2012 | Andreas Lauser | | 2008-2014 | Klaus Mosthaf | | 2009-2014 | Philipp Nuske | | 2014 | Mirka Papenheim | | 2013-2014 | Dominik Riesterer | | 2008 | Irina Rybak | -| 2013-2016 | Martin Schneider | +| 2013-2017 | Martin Schneider | | 2015 | Simon Scholz | | 2009 | Anneli Schöniger | | 2015-2016 | Natalie Schröder | | 2010-2016 | Nicolas Schwenck | -| 2015-2016 | Gabriele Seitz | +| 2015-2017 | Gabriele Seitz | | 2011 | Michael Sinsbeck | | 2010 | Leopold Stadler | | 2012-2014 | Alexandru Tatomir | -| 2015-2016 | Larissa de Vries | +| 2015-2017 | Larissa de Vries | | 2013 | Katharina Türk | | 2010-2014 | Lena Walter | -| 2015-2016 | Kilian Weishaupt | +| 2015-2017 | Kilian Weishaupt | | 2010-2011 | David Werner | | 2015 | Hao Wu | | 2008-2013 | Markus Wolff | diff --git a/README.md b/README.md index c554a5b256942dfaf066a08c4a3ffcfa8a87411c..dfd5bbce2346b5fe180cbf7ca2f774fe50cf42b6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -Readme -====== +dumux logo What is DuMuX? --------------- +=============== [DuMuX][0] is a simulation toolbox mainly aimed at flow and transport processes in porous media. DuMuX is based on the [DUNE][1] @@ -14,14 +13,14 @@ description of the goals and motivations behind DuMuX. Installation ------------- +=============== Have a look at the [installation guide][3] or use the [DuMuX handbook] [4], chapter 2. License -------- +======== DuMuX is licensed under the terms and conditions of the GNU General Public License (GPL) version 2 or - at your option - any later @@ -38,11 +37,11 @@ license. See the file `LICENSE.md` for full copying permissions. Automated Testing ------------------ +================== DuMuX features many tests (some unit tests and test problems) that can be run manually. We have experimental support for automated testing with buildbot. -Click here +Click here (buildbot) to see the latest builds (clicking on a build number will show a detailed overview of the build). diff --git a/bin/codeutil/fix_includes.sh b/bin/codeutil/fix_includes.sh deleted file mode 100755 index 6ab3cc5216a2547a9d6aa89c2431ff850f84483d..0000000000000000000000000000000000000000 --- a/bin/codeutil/fix_includes.sh +++ /dev/null @@ -1,384 +0,0 @@ -#! /bin/bash - -if [ $# -eq 0 ] - then - echo "No arguments supplied." - echo "Usage: bash ./fix_includes.sh file1 [file2 ...]" -fi - -for TMP in $@; do - echo "File: $TMP" - sed -i \ -" -s%dumux/implicit/common/implicitassembler.hh%dumux/implicit/assembler.hh%g; -s%dumux/implicit/common/implicitlocaljacobian.hh%dumux/implicit/localjacobian.hh%g; -s%dumux/implicit/common/implicitlocalresidual.hh%dumux/implicit/localresidual.hh%g; -s%dumux/implicit/common/implicitmodel.hh%dumux/implicit/model.hh%g; -s%dumux/implicit/common/implicitproblem.hh%dumux/implicit/problem.hh%g; -s%dumux/implicit/common/implicitproperties.hh%dumux/implicit/properties.hh%g; -s%dumux/implicit/common/implicitpropertydefaults.hh%dumux/implicit/propertydefaults.hh%g; -s%dumux/implicit/common/implicitvolumevariables.hh%dumux/implicit/volumevariables.hh%g; -s%dumux/implicit/common/implicitdarcyfluxvariables.hh%dumux/porousmediumflow/implicit/darcyfluxvariables.hh%g; -s%dumux/implicit/common/implicitforchheimerfluxvariables.hh%dumux/porousmediumflow/implicit/forchheimerfluxvariables.hh%g; -s%dumux/implicit/common/implicitporousmediaproblem.hh%dumux/porousmediumflow/implicit/problem.hh%g; -s%dumux/implicit/common/implicitvelocityoutput.hh%dumux/porousmediumflow/implicit/velocityoutput.hh%g; -s%dumux/implicit/box/boxassembler.hh%dumux/implicit/box/assembler.hh%g; -s%dumux/implicit/box/boxelementboundarytypes.hh%dumux/implicit/box/elementboundarytypes.hh%g; -s%dumux/implicit/box/boxelementvolumevariables.hh%dumux/implicit/box/elementvolumevariables.hh%g; -s%dumux/implicit/box/boxfvelementgeometry.hh%dumux/implicit/box/fvelementgeometry.hh%g; -s%dumux/implicit/box/boxlocalresidual.hh%dumux/implicit/box/localresidual.hh%g; -s%dumux/implicit/box/boxproperties.hh%dumux/implicit/box/properties.hh%g; -s%dumux/implicit/box/boxpropertydefaults.hh%dumux/implicit/box/propertydefaults.hh%g; -s%dumux/implicit/cellcentered/ccassembler.hh%dumux/implicit/cellcentered/assembler.hh%g; -s%dumux/implicit/cellcentered/ccelementboundarytypes.hh%dumux/implicit/cellcentered/elementboundarytypes.hh%g; -s%dumux/implicit/cellcentered/ccelementvolumevariables.hh%dumux/implicit/cellcentered/elementvolumevariables.hh%g; -s%dumux/implicit/cellcentered/ccfvelementgeometry.hh%dumux/implicit/cellcentered/fvelementgeometry.hh%g; -s%dumux/implicit/cellcentered/cclocalresidual.hh%dumux/implicit/cellcentered/localresidual.hh%g; -s%dumux/implicit/cellcentered/ccproperties.hh%dumux/implicit/cellcentered/properties.hh%g; -s%dumux/implicit/cellcentered/ccpropertydefaults.hh%dumux/implicit/cellcentered/propertydefaults.hh%g; -s%dumux/implicit/cornerpoint/cpelementvolumevariables.hh%dumux/implicit/cornerpoint/elementvolumevariables.hh%g; -s%dumux/implicit/cornerpoint/cpfvelementgeometry.hh%dumux/implicit/cornerpoint/fvelementgeometry.hh%g; -s%dumux/implicit/cornerpoint/cpdarcyfluxvariables.hh%dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh%g; -s%dumux/implicit/nonisothermal/nifluxvariables.hh%dumux/porousmediumflow/nonisothermal/implicit/fluxvariables.hh%g; -s%dumux/implicit/nonisothermal/niindices.hh%dumux/porousmediumflow/nonisothermal/implicit/indices.hh%g; -s%dumux/implicit/nonisothermal/nilocalresidual.hh%dumux/porousmediumflow/nonisothermal/implicit/localresidual.hh%g; -s%dumux/implicit/nonisothermal/nimodel.hh%dumux/porousmediumflow/nonisothermal/implicit/model.hh%g; -s%dumux/implicit/nonisothermal/niproperties.hh%dumux/porousmediumflow/nonisothermal/implicit/properties.hh%g; -s%dumux/implicit/nonisothermal/nipropertydefaults.hh%dumux/porousmediumflow/nonisothermal/implicit/propertydefaults.hh%g; -s%dumux/implicit/nonisothermal/nivolumevariables.hh%dumux/porousmediumflow/nonisothermal/implicit/volumevariables.hh%g; -s%dumux/implicit/1p/1pindices.hh%dumux/porousmediumflow/1p/implicit/indices.hh%g; -s%dumux/implicit/1p/1plocalresidual.hh%dumux/porousmediumflow/1p/implicit/localresidual.hh%g; -s%dumux/implicit/1p/1pmodel.hh%dumux/porousmediumflow/1p/implicit/model.hh%g; -s%dumux/implicit/1p/1pproperties.hh%dumux/porousmediumflow/1p/implicit/properties.hh%g; -s%dumux/implicit/1p/1ppropertydefaults.hh%dumux/porousmediumflow/1p/implicit/propertydefaults.hh%g; -s%dumux/implicit/1p/1pvolumevariables.hh%dumux/porousmediumflow/1p/implicit/volumevariables.hh%g; -s%dumux/implicit/2p/2pgridadaptindicator.hh%dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh%g; -s%dumux/implicit/2p/2pindices.hh%dumux/porousmediumflow/2p/implicit/indices.hh%g; -s%dumux/implicit/2p/2plocalresidual.hh%dumux/porousmediumflow/2p/implicit/localresidual.hh%g; -s%dumux/implicit/2p/2pmodel.hh%dumux/porousmediumflow/2p/implicit/model.hh%g; -s%dumux/implicit/2p/2pproperties.hh%dumux/porousmediumflow/2p/implicit/properties.hh%g; -s%dumux/implicit/2p/2ppropertydefaults.hh%dumux/porousmediumflow/2p/implicit/propertydefaults.hh%g; -s%dumux/implicit/2p/2pvolumevariables.hh%dumux/porousmediumflow/2p/implicit/volumevariables.hh%g; -s%dumux/implicit/3p/3pindices.hh%dumux/porousmediumflow/3p/implicit/indices.hh%g; -s%dumux/implicit/3p/3plocalresidual.hh%dumux/porousmediumflow/3p/implicit/localresidual.hh%g; -s%dumux/implicit/3p/3pmodel.hh%dumux/porousmediumflow/3p/implicit/model.hh%g; -s%dumux/implicit/3p/3pproperties.hh%dumux/porousmediumflow/3p/implicit/properties.hh%g; -s%dumux/implicit/3p/3ppropertydefaults.hh%dumux/porousmediumflow/3p/implicit/propertydefaults.hh%g; -s%dumux/implicit/3p/3pvolumevariables.hh%dumux/porousmediumflow/3p/implicit/volumevariables.hh%g; -s%dumux/implicit/1p2c/1p2cfluxvariables.hh%dumux/porousmediumflow/1p2c/implicit/fluxvariables.hh%g; -s%dumux/implicit/1p2c/1p2cindices.hh%dumux/porousmediumflow/1p2c/implicit/indices.hh%g; -s%dumux/implicit/1p2c/1p2clocalresidual.hh%dumux/porousmediumflow/1p2c/implicit/localresidual.hh%g; -s%dumux/implicit/1p2c/1p2cmodel.hh%dumux/porousmediumflow/1p2c/implicit/model.hh%g; -s%dumux/implicit/1p2c/1p2cproperties.hh%dumux/porousmediumflow/1p2c/implicit/properties.hh%g; -s%dumux/implicit/1p2c/1p2cpropertydefaults.hh%dumux/porousmediumflow/1p2c/implicit/propertydefaults.hh%g; -s%dumux/implicit/1p2c/1p2cvolumevariables.hh%dumux/porousmediumflow/1p2c/implicit/volumevariables.hh%g; -s%dumux/implicit/2p2c/2p2cfluxvariables.hh%dumux/porousmediumflow/2p2c/implicit/fluxvariables.hh%g; -s%dumux/implicit/2p2c/2p2cindices.hh%dumux/porousmediumflow/2p2c/implicit/indices.hh%g; -s%dumux/implicit/2p2c/2p2clocalresidual.hh%dumux/porousmediumflow/2p2c/implicit/localresidual.hh%g; -s%dumux/implicit/2p2c/2p2cmodel.hh%dumux/porousmediumflow/2p2c/implicit/model.hh%g; -s%dumux/implicit/2p2c/2p2cnewtoncontroller.hh%dumux/porousmediumflow/2p2c/implicit/newtoncontroller.hh%g; -s%dumux/implicit/2p2c/2p2cproperties.hh%dumux/porousmediumflow/2p2c/implicit/properties.hh%g; -s%dumux/implicit/2p2c/2p2cpropertydefaults.hh%dumux/porousmediumflow/2p2c/implicit/propertydefaults.hh%g; -s%dumux/implicit/2p2c/2p2cvolumevariables.hh%dumux/porousmediumflow/2p2c/implicit/volumevariables.hh%g; -s%dumux/implicit/3p3c/3p3cfluxvariables.hh%dumux/porousmediumflow/3p3c/implicit/fluxvariables.hh%g; -s%dumux/implicit/3p3c/3p3cindices.hh%dumux/porousmediumflow/3p3c/implicit/indices.hh%g; -s%dumux/implicit/3p3c/3p3clocalresidual.hh%dumux/porousmediumflow/3p3c/implicit/localresidual.hh%g; -s%dumux/implicit/3p3c/3p3cmodel.hh%dumux/porousmediumflow/3p3c/implicit/model.hh%g; -s%dumux/implicit/3p3c/3p3cnewtoncontroller.hh%dumux/porousmediumflow/3p3c/implicit/newtoncontroller.hh%g; -s%dumux/implicit/3p3c/3p3cproperties.hh%dumux/porousmediumflow/3p3c/implicit/properties.hh%g; -s%dumux/implicit/3p3c/3p3cpropertydefaults.hh%dumux/porousmediumflow/3p3c/implicit/propertydefaults.hh%g; -s%dumux/implicit/3p3c/3p3cvolumevariables.hh%dumux/porousmediumflow/3p3c/implicit/volumevariables.hh%g; -s%dumux/implicit/2pnc/2pncfluxvariables.hh%dumux/porousmediumflow/2pnc/implicit/fluxvariables.hh%g; -s%dumux/implicit/2pnc/2pncindices.hh%dumux/porousmediumflow/2pnc/implicit/indices.hh%g; -s%dumux/implicit/2pnc/2pnclocalresidual.hh%dumux/porousmediumflow/2pnc/implicit/localresidual.hh%g; -s%dumux/implicit/2pnc/2pncmodel.hh%dumux/porousmediumflow/2pnc/implicit/model.hh%g; -s%dumux/implicit/2pnc/2pncnewtoncontroller.hh%dumux/porousmediumflow/2pnc/implicit/newtoncontroller.hh%g; -s%dumux/implicit/2pnc/2pncproperties.hh%dumux/porousmediumflow/2pnc/implicit/properties.hh%g; -s%dumux/implicit/2pnc/2pncpropertydefaults.hh%dumux/porousmediumflow/2pnc/implicit/propertydefaults.hh%g; -s%dumux/implicit/2pnc/2pncvolumevariables.hh%dumux/porousmediumflow/2pnc/implicit/volumevariables.hh%g; -s%dumux/implicit/2pncmin/2pncminfluxvariables.hh%dumux/porousmediumflow/2pncmin/implicit/fluxvariables.hh%g; -s%dumux/implicit/2pncmin/2pncminindices.hh%dumux/porousmediumflow/2pncmin/implicit/indices.hh%g; -s%dumux/implicit/2pncmin/2pncminlocalresidual.hh%dumux/porousmediumflow/2pncmin/implicit/localresidual.hh%g; -s%dumux/implicit/2pncmin/2pncminmodel.hh%dumux/porousmediumflow/2pncmin/implicit/model.hh%g; -s%dumux/implicit/2pncmin/2pncminproperties.hh%dumux/porousmediumflow/2pncmin/implicit/properties.hh%g; -s%dumux/implicit/2pncmin/2pncminpropertydefaults.hh%dumux/porousmediumflow/2pncmin/implicit/propertydefaults.hh%g; -s%dumux/implicit/2pncmin/2pncminvolumevariables.hh%dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh%g; -s%dumux/implicit/2pdfm/2pdfmfluxvariables.hh%dumux/porousmediumflow/2pdfm/implicit/fluxvariables.hh%g; -s%dumux/implicit/2pdfm/2pdfmindices.hh%dumux/porousmediumflow/2pdfm/implicit/indices.hh%g; -s%dumux/implicit/2pdfm/2pdfmlocalresidual.hh%dumux/porousmediumflow/2pdfm/implicit/localresidual.hh%g; -s%dumux/implicit/2pdfm/2pdfmmodel.hh%dumux/porousmediumflow/2pdfm/implicit/model.hh%g; -s%dumux/implicit/2pdfm/2pdfmproblem.hh%dumux/porousmediumflow/2pdfm/implicit/problem.hh%g; -s%dumux/implicit/2pdfm/2pdfmproperties.hh%dumux/porousmediumflow/2pdfm/implicit/properties.hh%g; -s%dumux/implicit/2pdfm/2pdfmpropertydefaults.hh%dumux/porousmediumflow/2pdfm/implicit/propertydefaults.hh%g; -s%dumux/implicit/2pdfm/2pdfmvolumevariables.hh%dumux/porousmediumflow/2pdfm/implicit/volumevariables.hh%g; -s%dumux/implicit/2pminc/2pmincfluxvariables.hh%dumux/porousmediumflow/2pminc/implicit/fluxvariables.hh%g; -s%dumux/implicit/2pminc/2pmincindices.hh%dumux/porousmediumflow/2pminc/implicit/indices.hh%g; -s%dumux/implicit/2pminc/2pminclocalresidual.hh%dumux/porousmediumflow/2pminc/implicit/localresidual.hh%g; -s%dumux/implicit/2pminc/2pmincmodel.hh%dumux/porousmediumflow/2pminc/implicit/model.hh%g; -s%dumux/implicit/2pminc/2pmincproperties.hh%dumux/porousmediumflow/2pminc/implicit/properties.hh%g; -s%dumux/implicit/2pminc/2pmincpropertydefaults.hh%dumux/porousmediumflow/2pminc/implicit/propertydefaults.hh%g; -s%dumux/implicit/2pminc/2pmincvolumevariables.hh%dumux/porousmediumflow/2pminc/implicit/volumevariables.hh%g; -s%dumux/implicit/co2/co2model.hh%dumux/porousmediumflow/co2/implicit/model.hh%g; -s%dumux/implicit/co2/co2volumevariables.hh%dumux/porousmediumflow/co2/implicit/volumevariables.hh%g; -s%dumux/implicit/richards/richardsfluxvariables.hh%dumux/porousmediumflow/richards/implicit/fluxvariables.hh%g; -s%dumux/implicit/richards/richardsindices.hh%dumux/porousmediumflow/richards/implicit/indices.hh%g; -s%dumux/implicit/richards/richardslocalresidual.hh%dumux/porousmediumflow/richards/implicit/localresidual.hh%g; -s%dumux/implicit/richards/richardsmodel.hh%dumux/porousmediumflow/richards/implicit/model.hh%g; -s%dumux/implicit/richards/richardsnewtoncontroller.hh%dumux/porousmediumflow/richards/implicit/newtoncontroller.hh%g; -s%dumux/implicit/richards/richardsproblem.hh%dumux/porousmediumflow/richards/implicit/problem.hh%g; -s%dumux/implicit/richards/richardsproperties.hh%dumux/porousmediumflow/richards/implicit/properties.hh%g; -s%dumux/implicit/richards/richardspropertydefaults.hh%dumux/porousmediumflow/richards/implicit/propertydefaults.hh%g; -s%dumux/implicit/richards/richardsvolumevariables.hh%dumux/porousmediumflow/richards/implicit/volumevariables.hh%g; -s%dumux/implicit/mpnc/mpncfluxvariables.hh%dumux/porousmediumflow/mpnc/implicit/fluxvariables.hh%g; -s%dumux/implicit/mpnc/mpncindices.hh%dumux/porousmediumflow/mpnc/implicit/indices.hh%g; -s%dumux/implicit/mpnc/mpnclocalresidual.hh%dumux/porousmediumflow/mpnc/implicit/localresidual.hh%g; -s%dumux/implicit/mpnc/mpncmodel.hh%dumux/porousmediumflow/mpnc/implicit/model.hh%g; -s%dumux/implicit/mpnc/mpncmodelkinetic.hh%dumux/porousmediumflow/mpnc/implicit/modelkinetic.hh%g; -s%dumux/implicit/mpnc/mpncnewtoncontroller.hh%dumux/porousmediumflow/mpnc/implicit/newtoncontroller.hh%g; -s%dumux/implicit/mpnc/mpncproperties.hh%dumux/porousmediumflow/mpnc/implicit/properties.hh%g; -s%dumux/implicit/mpnc/mpncpropertieskinetic.hh%dumux/porousmediumflow/mpnc/implicit/propertieskinetic.hh%g; -s%dumux/implicit/mpnc/mpncpropertydefaults.hh%dumux/porousmediumflow/mpnc/implicit/propertydefaults.hh%g; -s%dumux/implicit/mpnc/mpncpropertydefaultskinetic.hh%dumux/porousmediumflow/mpnc/implicit/propertydefaultskinetic.hh%g; -s%dumux/implicit/mpnc/mpncvolumevariables%dumux/porousmediumflow/mpnc/implicit/volumevariables%g; -s%dumux/implicit/mpnc/mpncvtkwriter%dumux/porousmediumflow/mpnc/implicit/vtkwriter%g; -s%dumux/implicit/mpnc/velomodelnewtoncontroller.hh%dumux/porousmediumflow/mpnc/implicit/velomodelnewtoncontroller.hh%g; -s%dumux/implicit/mpnc/diffusion%dumux/porousmediumflow/mpnc/implicit/diffusion%g; -s%dumux/implicit/mpnc/energy/mpncfluxvariablesenergy%dumux/porousmediumflow/mpnc/implicit/energy/fluxvariables%g; -s%dumux/implicit/mpnc/energy/mpncindicesenergy%dumux/porousmediumflow/mpnc/implicit/energy/indices%g; -s%dumux/implicit/mpnc/energy/mpnclocalresidualenergy%dumux/porousmediumflow/mpnc/implicit/energy/localresidual%g; -s%dumux/implicit/mpnc/energy/mpncvolumevariablesenergy%dumux/porousmediumflow/mpnc/implicit/energy/volumevariables%g; -s%dumux/implicit/mpnc/energy/mpncvtkwriterenergy%dumux/porousmediumflow/mpnc/implicit/energy/vtkwriter%g; -s%dumux/implicit/mpnc/mass/mpncindicesmass%dumux/porousmediumflow/mpnc/implicit/mass/indices%g; -s%dumux/implicit/mpnc/mass/mpnclocalresidualmass%dumux/porousmediumflow/mpnc/implicit/mass/localresidual%g; -s%dumux/implicit/mpnc/mass/mpncvolumevariablesmass%dumux/porousmediumflow/mpnc/implicit/mass/volumevariables%g; -s%dumux/implicit/mpnc/mass/mpncvtkwritermass%dumux/porousmediumflow/mpnc/implicit/mass/vtkwriter%g; -s%dumux/freeflow/stokes/stokesfluxvariables.hh%dumux/freeflow/stokes/fluxvariables.hh%g; -s%dumux/freeflow/stokes/stokesindices.hh%dumux/freeflow/stokes/indices.hh%g; -s%dumux/freeflow/stokes/stokeslocaljacobian.hh%dumux/freeflow/stokes/localjacobian.hh%g; -s%dumux/freeflow/stokes/stokeslocalresidual.hh%dumux/freeflow/stokes/localresidual.hh%g; -s%dumux/freeflow/stokes/stokesmodel.hh%dumux/freeflow/stokes/model.hh%g; -s%dumux/freeflow/stokes/stokesnewtoncontroller.hh%dumux/freeflow/stokes/newtoncontroller.hh%g; -s%dumux/freeflow/stokes/stokesproblem.hh%dumux/freeflow/stokes/problem.hh%g; -s%dumux/freeflow/stokes/stokesproperties.hh%dumux/freeflow/stokes/properties.hh%g; -s%dumux/freeflow/stokes/stokespropertydefaults.hh%dumux/freeflow/stokes/propertydefaults.hh%g; -s%dumux/freeflow/stokes/stokesvolumevariables.hh%dumux/freeflow/stokes/volumevariables.hh%g; -s%dumux/freeflow/stokesnc/stokesncfluxvariables.hh%dumux/freeflow/stokesnc/fluxvariables.hh%g; -s%dumux/freeflow/stokesnc/stokesncindices.hh%dumux/freeflow/stokesnc/indices.hh%g; -s%dumux/freeflow/stokesnc/stokesnclocalresidual.hh%dumux/freeflow/stokesnc/localresidual.hh%g; -s%dumux/freeflow/stokesnc/stokesncmodel.hh%dumux/freeflow/stokesnc/model.hh%g; -s%dumux/freeflow/stokesnc/stokesncproperties.hh%dumux/freeflow/stokesnc/properties.hh%g; -s%dumux/freeflow/stokesnc/stokesncpropertydefaults.hh%dumux/freeflow/stokesnc/propertydefaults.hh%g; -s%dumux/freeflow/stokesnc/stokesncvolumevariables.hh%dumux/freeflow/stokesnc/volumevariables.hh%g; -s%dumux/freeflow/stokesncni/stokesncnifluxvariables.hh%dumux/freeflow/stokesncni/fluxvariables.hh%g; -s%dumux/freeflow/stokesncni/stokesncniindices.hh%dumux/freeflow/stokesncni/indices.hh%g; -s%dumux/freeflow/stokesncni/stokesncnilocalresidual.hh%dumux/freeflow/stokesncni/localresidual.hh%g; -s%dumux/freeflow/stokesncni/stokesncnimodel.hh%dumux/freeflow/stokesncni/model.hh%g; -s%dumux/freeflow/stokesncni/stokesncniproperties.hh%dumux/freeflow/stokesncni/properties.hh%g; -s%dumux/freeflow/stokesncni/stokesncnipropertydefaults.hh%dumux/freeflow/stokesncni/propertydefaults.hh%g; -s%dumux/freeflow/stokesncni/stokesncnivolumevariables.hh%dumux/freeflow/stokesncni/volumevariables.hh%g; -s%dumux/freeflow/zeroeq/zeroeqfluxvariables.hh%dumux/freeflow/zeroeq/fluxvariables.hh%g; -s%dumux/freeflow/zeroeq/zeroeqindices.hh%dumux/freeflow/zeroeq/indices.hh%g; -s%dumux/freeflow/zeroeq/zeroeqmodel.hh%dumux/freeflow/zeroeq/model.hh%g; -s%dumux/freeflow/zeroeq/zeroeqproblem.hh%dumux/freeflow/zeroeq/problem.hh%g; -s%dumux/freeflow/zeroeq/zeroeqproperties.hh%dumux/freeflow/zeroeq/properties.hh%g; -s%dumux/freeflow/zeroeq/zeroeqpropertydefaults.hh%dumux/freeflow/zeroeq/propertydefaults.hh%g; -s%dumux/freeflow/zeroeqnc/zeroeqncfluxvariables.hh%dumux/freeflow/zeroeqnc/fluxvariables.hh%g; -s%dumux/freeflow/zeroeqnc/zeroeqncindices.hh%dumux/freeflow/zeroeqnc/indices.hh%g; -s%dumux/freeflow/zeroeqnc/zeroeqncmodel.hh%dumux/freeflow/zeroeqnc/model.hh%g; -s%dumux/freeflow/zeroeqnc/zeroeqncproperties.hh%dumux/freeflow/zeroeqnc/properties.hh%g; -s%dumux/freeflow/zeroeqnc/zeroeqncpropertydefaults.hh%dumux/freeflow/zeroeqnc/propertydefaults.hh%g; -s%dumux/freeflow/zeroeqncni/zeroeqncnifluxvariables.hh%dumux/freeflow/zeroeqncni/fluxvariables.hh%g; -s%dumux/freeflow/zeroeqncni/zeroeqncniindices.hh%dumux/freeflow/zeroeqncni/indices.hh%g; -s%dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh%dumux/freeflow/zeroeqncni/model.hh%g; -s%dumux/freeflow/zeroeqncni/zeroeqncniproperties.hh%dumux/freeflow/zeroeqncni/properties.hh%g; -s%dumux/freeflow/zeroeqncni/zeroeqncnipropertydefaults.hh%dumux/freeflow/zeroeqncni/propertydefaults.hh%g; -s%dumux/geomechanics/elastic/elasticfluxvariables.hh%dumux/geomechanics/elastic/fluxvariables.hh%g; -s%dumux/geomechanics/elastic/elasticindices.hh%dumux/geomechanics/elastic/indices.hh%g; -s%dumux/geomechanics/elastic/elasticlocalresidual.hh%dumux/geomechanics/elastic/localresidual.hh%g; -s%dumux/geomechanics/elastic/elasticmodel.hh%dumux/geomechanics/elastic/model.hh%g; -s%dumux/geomechanics/elastic/elasticproperties.hh%dumux/geomechanics/elastic/properties.hh%g; -s%dumux/geomechanics/elastic/elasticpropertydefaults.hh%dumux/geomechanics/elastic/propertydefaults.hh%g; -s%dumux/geomechanics/elastic/elasticvolumevariables.hh%dumux/geomechanics/elastic/volumevariables.hh%g; -s%dumux/geomechanics/el1p2c/el1p2celementvolumevariables.hh%dumux/geomechanics/el1p2c/elementvolumevariables.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cfluxvariables.hh%dumux/geomechanics/el1p2c/fluxvariables.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cindices.hh%dumux/geomechanics/el1p2c/indices.hh%g; -s%dumux/geomechanics/el1p2c/el1p2clocaljacobian.hh%dumux/geomechanics/el1p2c/localjacobian.hh%g; -s%dumux/geomechanics/el1p2c/el1p2clocalresidual.hh%dumux/geomechanics/el1p2c/localresidual.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cmodel.hh%dumux/geomechanics/el1p2c/model.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cproperties.hh%dumux/geomechanics/el1p2c/properties.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cpropertydefaults.hh%dumux/geomechanics/el1p2c/propertydefaults.hh%g; -s%dumux/geomechanics/el1p2c/el1p2cvolumevariables.hh%dumux/geomechanics/el1p2c/volumevariables.hh%g; -s%dumux/geomechanics/el2p/el2pamgbackend.hh%dumux/geomechanics/el2p/amgbackend.hh%g; -s%dumux/geomechanics/el2p/el2passembler.hh%dumux/geomechanics/el2p/assembler.hh%g; -s%dumux/geomechanics/el2p/el2pbasemodel.hh%dumux/geomechanics/el2p/basemodel.hh%g; -s%dumux/geomechanics/el2p/el2pelementvolumevariables.hh%dumux/geomechanics/el2p/elementvolumevariables.hh%g; -s%dumux/geomechanics/el2p/el2pfluxvariables.hh%dumux/geomechanics/el2p/fluxvariables.hh%g; -s%dumux/geomechanics/el2p/el2pindices.hh%dumux/geomechanics/el2p/indices.hh%g; -s%dumux/geomechanics/el2p/el2plocaljacobian.hh%dumux/geomechanics/el2p/localjacobian.hh%g; -s%dumux/geomechanics/el2p/el2plocaloperator.hh%dumux/geomechanics/el2p/localoperator.hh%g; -s%dumux/geomechanics/el2p/el2plocalresidual.hh%dumux/geomechanics/el2p/localresidual.hh%g; -s%dumux/geomechanics/el2p/el2pmodel.hh%dumux/geomechanics/el2p/model.hh%g; -s%dumux/geomechanics/el2p/el2pnewtoncontroller.hh%dumux/geomechanics/el2p/newtoncontroller.hh%g; -s%dumux/geomechanics/el2p/el2pproperties.hh%dumux/geomechanics/el2p/properties.hh%g; -s%dumux/geomechanics/el2p/el2ppropertydefaults.hh%dumux/geomechanics/el2p/propertydefaults.hh%g; -s%dumux/geomechanics/el2p/el2pvolumevariables.hh%dumux/geomechanics/el2p/volumevariables.hh%g; -s%dumux/geomechanics/el2p/el2pamgbackend.hh%dumux/geomechanics/el2p/amgbackend.hh%g; -s%dumux/multidomain/common/multidomainassembler.hh%dumux/multidomain/assembler.hh%g; -s%dumux/multidomain/common/multidomainconvergencewriter.hh%dumux/multidomain/convergencewriter.hh%g; -s%dumux/multidomain/common/multidomainlocaloperator.hh%dumux/multidomain/localoperator.hh%g; -s%dumux/multidomain/common/multidomainmodel.hh%dumux/multidomain/model.hh%g; -s%dumux/multidomain/common/multidomainnewtoncontroller.hh%dumux/multidomain/newtoncontroller.hh%g; -s%dumux/multidomain/common/multidomainproblem.hh%dumux/multidomain/problem.hh%g; -s%dumux/multidomain/common/multidomainproperties.hh%dumux/multidomain/properties.hh%g; -s%dumux/multidomain/common/multidomainpropertydefaults.hh%dumux/multidomain/propertydefaults.hh%g; -s%dumux/multidomain/common/boxcouplinglocalresidual.hh%dumux/multidomain/boxcouplinglocalresidual.hh%g; -s%dumux/multidomain/common/splitandmerge.hh%dumux/multidomain/splitandmerge.hh%g; -s%dumux/multidomain/common/subdomainproperties.hh%dumux/multidomain/subdomainproperties.hh%g; -s%dumux/multidomain/common/subdomainpropertydefaults.hh%dumux/multidomain/subdomainpropertydefaults.hh%g; -s%dumux/multidomain/2cnistokes2p2cni/2cnistokes2p2cnilocaloperator.hh%dumux/multidomain/2cnistokes2p2cni/localoperator.hh%g; -s%dumux/multidomain/2cnistokes2p2cni/2cnistokes2p2cniproperties.hh%dumux/multidomain/2cnistokes2p2cni/properties.hh%g; -s%dumux/multidomain/2cnistokes2p2cni/2cnistokes2p2cnipropertydefaults.hh%dumux/multidomain/2cnistokes2p2cni/propertydefaults.hh%g; -s%dumux/multidomain/2cstokes2p2c/2cstokes2p2clocaloperator.hh%dumux/multidomain/2cstokes2p2c/localoperator.hh%g; -s%dumux/multidomain/2cstokes2p2c/2cstokes2p2cnewtoncontroller.hh%dumux/multidomain/2cstokes2p2c/newtoncontroller.hh%g; -s%dumux/multidomain/2cstokes2p2c/2cstokes2p2cproperties.hh%dumux/multidomain/2cstokes2p2c/properties.hh%g; -s%dumux/multidomain/2cstokes2p2c/2cstokes2p2cpropertydefaults.hh%dumux/multidomain/2cstokes2p2c/propertydefaults.hh%g; -s%dumux/material/fluidstates/2p2cfluidstate.hh%dumux/material/fluidstates/2p2c.hh%g; -s%dumux/material/fluidstates/compositionalfluidstate.hh%dumux/material/fluidstates/compositional.hh%g; -s%dumux/material/fluidstates/immisciblefluidstate.hh%dumux/material/fluidstates/immiscible.hh%g; -s%dumux/material/fluidstates/isothermalimmisciblefluidstate.hh%dumux/material/fluidstates/isothermalimmiscible.hh%g; -s%dumux/material/fluidstates/nonequilibriumenergyfluidstate.hh%dumux/material/fluidstates/nonequilibriumenergy.hh%g; -s%dumux/material/fluidstates/nonequilibriumfluidstate.hh%dumux/material/fluidstates/nonequilibrium.hh%g; -s%dumux/material/fluidstates/nonequilibriummassfluidstate.hh%dumux/material/fluidstates/nonequilibriummass.hh%g; -s%dumux/material/fluidstates/pressureoverlayfluidstate.hh%dumux/material/fluidstates/pressureoverlay.hh%g; -s%dumux/material/fluidstates/pseudo1p2cfluidstate.hh%dumux/material/fluidstates/pseudo1p2c.hh%g; -s%dumux/material/fluidstates/saturationoverlayfluidstate.hh%dumux/material/fluidstates/saturationoverlay.hh%g; -s%dumux/material/fluidstates/temperatureoverlayfluidstate.hh%dumux/material/fluidstates/temperatureoverlay.hh%g; -s%dumux/material/fluidsystems/1pfluidsystem.hh%dumux/material/fluidsystems/1p.hh%g; -s%dumux/material/fluidsystems/2pimmisciblefluidsystem.hh%dumux/material/fluidsystems/2pimmiscible.hh%g; -s%dumux/material/fluidsystems/basefluidsystem.hh%dumux/material/fluidsystems/base.hh%g; -s%dumux/material/fluidsystems/brineairfluidsystem.hh%dumux/material/fluidsystems/brineair.hh%g; -s%dumux/material/fluidsystems/brineco2fluidsystem.hh%dumux/material/fluidsystems/brineco2.hh%g; -s%dumux/material/fluidsystems/h2oairfluidsystem.hh%dumux/material/fluidsystems/h2oair.hh%g; -s%dumux/material/fluidsystems/h2oairmesitylenefluidsystem.hh%dumux/material/fluidsystems/h2oairmesitylene.hh%g; -s%dumux/material/fluidsystems/h2oairxylenefluidsystem.hh%dumux/material/fluidsystems/h2oairxylene.hh%g; -s%dumux/material/fluidsystems/h2on2fluidsystem.hh%dumux/material/fluidsystems/h2on2.hh%g; -s%dumux/material/fluidsystems/h2on2liquidphasefluidsystem.hh%dumux/material/fluidsystems/h2on2liquidphase.hh%g; -s%dumux/material/fluidsystems/h2on2o2fluidsystem.hh%dumux/material/fluidsystems/h2on2o2.hh%g; -s%dumux/material/fluidsystems/purewatersimplefluidsystem.hh%dumux/material/fluidsystems/purewatersimple.hh%g; -s%dumux/material/fluidsystems/spe5fluidsystem.hh%dumux/material/fluidsystems/spe5.hh%g; -s%dumux/material/fluidsystems/h2on2fluidsystemkinetic.hh%dumux/material/fluidsystems/h2on2kinetic.hh%g; -s%dumux/material/spatialparams/fvspatialparams.hh%dumux/material/spatialparams/fv.hh%g; -s%dumux/material/spatialparams/implicitspatialparams.hh%dumux/material/spatialparams/implicit.hh%g; -s%dumux/material/spatialparams/fvspatialparams1p.hh%dumux/material/spatialparams/fv1p.hh%g; -s%dumux/material/spatialparams/implicitspatialparams1p.hh%dumux/material/spatialparams/implicit1p.hh%g; -s%dumux/decoupled/1p/1pindices.hh%dumux/porousmediumflow/1p/sequential/indices.hh%g; -s%dumux/decoupled/1p/1pproperties.hh%dumux/porousmediumflow/1p/sequential/properties.hh%g; -s%dumux/decoupled/1p/celldata1p.hh%dumux/porousmediumflow/1p/sequential/celldata.hh%g; -s%dumux/decoupled/1p/fluxdata1p.hh%dumux/porousmediumflow/1p/sequential/fluxdata.hh%g; -s%dumux/decoupled/1p/diffusion/diffusionproperties1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/properties.hh%g; -s%dumux/decoupled/1p/diffusion/diffusionproblem1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/problem.hh%g; -s%dumux/decoupled/1p/diffusion/fv/fvpressure1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressure.hh%g; -s%dumux/decoupled/1p/diffusion/fv/fvpressureproperties1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressureproperties.hh%g; -s%dumux/decoupled/1p/diffusion/fv/fvpressurevelocity1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressurevelocity.hh%g; -s%dumux/decoupled/1p/diffusion/fv/fvpressurevelocityproperties1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressurevelocityproperties.hh%g; -s%dumux/decoupled/1p/diffusion/fv/fvvelocity1p.hh%dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/velocity.hh%g; -s%dumux/decoupled/common/gridadapt.hh%dumux/porousmediumflow/sequential/gridadapt.hh%g; -s%dumux/decoupled/common/gridadaptinitializationindicatordefault.hh%dumux/porousmediumflow/sequential/gridadaptinitializationindicatordefault.hh%g; -s%dumux/decoupled/common/gridadaptinitializationindicator.hh%dumux/porousmediumflow/sequential/gridadaptinitializationindicator.hh%g; -s%dumux/decoupled/common/gridadaptproperties.hh%dumux/porousmediumflow/sequential/gridadaptproperties.hh%g; -s%dumux/decoupled/common/impet.hh%dumux/porousmediumflow/sequential/impet.hh%g; -s%dumux/decoupled/common/impetproblem.hh%dumux/porousmediumflow/sequential/impetproblem.hh%g; -s%dumux/decoupled/common/impetproperties.hh%dumux/porousmediumflow/sequential/impetproperties.hh%g; -s%dumux/decoupled/common/onemodelproblem.hh%dumux/porousmediumflow/sequential/onemodelproblem.hh%g; -s%dumux/decoupled/common/pressureproperties.hh%dumux/porousmediumflow/sequential/pressureproperties.hh%g; -s%dumux/decoupled/common/decoupledproperties.hh%dumux/porousmediumflow/sequential/properties.hh%g; -s%dumux/decoupled/common/transportproperties.hh%dumux/porousmediumflow/sequential/transportproperties.hh%g; -s%dumux/decoupled/common/variableclassadaptive.hh%dumux/porousmediumflow/sequential/variableclassadaptive.hh%g; -s%dumux/decoupled/common/variableclass.hh%dumux/porousmediumflow/sequential/variableclass.hh%g; -s%dumux/decoupled/common/fv/fvpressure.hh%dumux/porousmediumflow/sequential/cellcentered/pressure.hh%g; -s%dumux/decoupled/common/fv/fvtransport.hh%dumux/porousmediumflow/sequential/cellcentered/transport.hh%g; -s%dumux/decoupled/common/fv/fvvelocitydefault.hh%dumux/porousmediumflow/sequential/cellcentered/velocitydefault.hh%g; -s%dumux/decoupled/common/fv/fvvelocity.hh%dumux/porousmediumflow/sequential/cellcentered/velocity.hh%g; -s%dumux/decoupled/common/fv/mpfa/fvmpfaproperties.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/properties.hh%g; -s%dumux/decoupled/common/fv/mpfa/fvmpfavelocityintransport.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/velocityintransport.hh%g; -s%dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3dadaptive.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/linteractionvolume3dadaptive.hh%g; -s%dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume3d.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/linteractionvolume3d.hh%g; -s%dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/linteractionvolume.hh%g; -s%dumux/decoupled/common/fv/mpfa/mpfaointeractionvolume.hh%dumux/porousmediumflow/sequential/cellcentered/mpfa/ointeractionvolume.hh%g; -s%dumux/decoupled/common/mimetic/mimeticproperties.hh%dumux/porousmediumflow/sequential/mimetic/properties.hh%g; -s%dumux/decoupled/2p2c/2p2cadaptiveproperties.hh%dumux/porousmediumflow/2p2c/sequential/adaptiveproperties.hh%g; -s%dumux/decoupled/2p2c/2p2cfluidstate.hh%dumux/porousmediumflow/2p2c/sequential/fluidstate.hh%g; -s%dumux/decoupled/2p2c/2p2cproblem.hh%dumux/porousmediumflow/2p2c/sequential/problem.hh%g; -s%dumux/decoupled/2p2c/2p2cproperties.hh%dumux/porousmediumflow/2p2c/sequential/properties.hh%g; -s%dumux/decoupled/2p2c/celldata2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/celldataadaptive.hh%g; -s%dumux/decoupled/2p2c/celldata2p2c.hh%dumux/porousmediumflow/2p2c/sequential/celldata.hh%g; -s%dumux/decoupled/2p2c/celldata2p2cmultiphysics.hh%dumux/porousmediumflow/2p2c/sequential/celldatamultiphysics.hh%g; -s%dumux/decoupled/2p2c/fluxdata2p2c.hh%dumux/porousmediumflow/2p2c/sequential/fluxdata.hh%g; -s%dumux/decoupled/2p2c/fv2dpressure2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/fv2dpressureadaptive.hh%g; -s%dumux/decoupled/2p2c/fv2dtransport2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/fv2dtransportadaptive.hh%g; -s%dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/fv3dpressureadaptive.hh%g; -s%dumux/decoupled/2p2c/fv3dtransport2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/fv3dtransportadaptive.hh%g; -s%dumux/decoupled/2p2c/fvmpfal3d2p2cinteractionvolumecontaineradaptive.hh%dumux/porousmediumflow/2p2c/sequential/fvmpfal3dinteractionvolumecontaineradaptive.hh%g; -s%dumux/decoupled/2p2c/fvpressure2p2c.hh%dumux/porousmediumflow/2p2c/sequential/fvpressure.hh%g; -s%dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh%dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh%g; -s%dumux/decoupled/2p2c/fvpressurecompositional.hh%dumux/porousmediumflow/2p2c/sequential/fvpressurecompositional.hh%g; -s%dumux/decoupled/2p2c/fvtransport2p2c.hh%dumux/porousmediumflow/2p2c/sequential/fvtransport.hh%g; -s%dumux/decoupled/2p2c/fvtransport2p2cmultiphysics.hh%dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh%g; -s%dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh%dumux/porousmediumflow/2p2c/sequential/pseudo1p2cfluidstate.hh%g; -s%dumux/decoupled/2p2c/variableclass2p2cadaptive.hh%dumux/porousmediumflow/2p2c/sequential/variableclassadaptive.hh%g; -s%dumux/decoupled/2p/2pindices.hh%dumux/porousmediumflow/2p/sequential/indices.hh%g; -s%dumux/decoupled/2p/2pproperties.hh%dumux/porousmediumflow/2p/sequential/properties.hh%g; -s%dumux/decoupled/2p/celldata2padaptive.hh%dumux/porousmediumflow/2p/sequential/celldataadaptive.hh%g; -s%dumux/decoupled/2p/celldata2p.hh%dumux/porousmediumflow/2p/sequential/celldata.hh%g; -s%dumux/decoupled/2p/fluxdata2p.hh%dumux/porousmediumflow/2p/sequential/fluxdata.hh%g; -s%dumux/decoupled/2p/diffusion/diffusionproblem2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/problem.hh%g; -s%dumux/decoupled/2p/diffusion/diffusionproperties2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/properties.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressureadaptive.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressure.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressureproperties2padaptive.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressurepropertiesadaptive.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressureproperties.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressurevelocity2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressurevelocity.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvpressurevelocityproperties2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressurevelocityproperties.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocityadaptive.hh%g; -s%dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocity.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressureproperties2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureproperties%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressurevelocity2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocity%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dtransmissibilitycalculator.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dtransmissibilitycalculator.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dvelocity2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocity%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainerad%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontainer%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressureproperties2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressureproperties%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocity%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dtransmissibilitycalculator.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dtransmissibilitycalculator.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2p%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocity%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressure.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressureproperties2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressureproperties.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressurevelocity2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressurevelocity.hh%g; -s%dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dvelocity2p.hh%dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dvelocity.hh%g; -s%dumux/decoupled/2p/diffusion/mimetic/croperator2p%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/croperator%g; -s%dumux/decoupled/2p/diffusion/mimetic/localstiffness.hh%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/localstiffness.hh%g; -s%dumux/decoupled/2p/diffusion/mimetic/mimetic2p%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic%g; -s%dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/operator%g; -s%dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure%g; -s%dumux/decoupled/2p/diffusion/mimetic/mimeticpressureproperties2p%dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureproperties%g; -s%dumux/decoupled/2p/impes/gridadaptionindicator2p.hh%dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicator.hh%g; -s%dumux/decoupled/2p/impes/gridadaptionindicator2plocalflux.hh%dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh%g; -s%dumux/decoupled/2p/impes/gridadaptionindicator2plocal.hh%dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocal.hh%g; -s%dumux/decoupled/2p/impes/impesproblem2p.hh%dumux/porousmediumflow/2p/sequential/impes/problem.hh%g; -s%dumux/decoupled/2p/impes/impesproperties2padaptive.hh%dumux/porousmediumflow/2p/sequential/impes/propertiesadaptive.hh%g; -s%dumux/decoupled/2p/impes/impesproperties2p.hh%dumux/porousmediumflow/2p/sequential/impes/properties.hh%g; -s%dumux/decoupled/2p/transport/transportproblem2p.hh%dumux/porousmediumflow/2p/sequential/transport/problem.hh%g; -s%dumux/decoupled/2p/transport/transportproperties2p.hh%dumux/porousmediumflow/2p/sequential/transport/properties.hh%g; -s%dumux/decoupled/2p/transport/fv/capillarydiffusion.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/capillarydiffusion.hh%g; -s%dumux/decoupled/2p/transport/fv/convectivepart.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/convectivepart.hh%g; -s%dumux/decoupled/2p/transport/fv/diffusivepart.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/diffusivepart.hh%g; -s%dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxcoats.hh%g; -s%dumux/decoupled/2p/transport/fv/evalcflfluxdefault.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxdefault.hh%g; -s%dumux/decoupled/2p/transport/fv/evalcflflux.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflflux.hh%g; -s%dumux/decoupled/2p/transport/fv/fvsaturation2p.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/saturation.hh%g; -s%dumux/decoupled/2p/transport/fv/fvtransportproperties2p.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/properties.hh%g; -s%dumux/decoupled/2p/transport/fv/gravitypart.hh%dumux/porousmediumflow/2p/sequential/transport/cellcentered/gravitypart.hh%g; -" \ -$TMP -done diff --git a/bin/fuzzycomparevtu.py b/bin/fuzzycomparevtu.py deleted file mode 100644 index 3b55a1b7631d62462957343dd526f89a6dc3b81d..0000000000000000000000000000000000000000 --- a/bin/fuzzycomparevtu.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys -print("\n") -print("#########################################################################################\n") -print("# Warning: bin/fuzzycomparevtu.py is deprecated and will be deleted after release 2.10. #\n") -print("# bin/testing/fuzzycomparevtu.py instead. #\n") -print("#########################################################################################\n") -sys.exit(1) diff --git a/bin/installexternal.sh b/bin/installexternal.sh index 51e02936cb16cc93946e266b034379d4410033a2..fce3c517564ec156f87b49329a81b11edf688c82 100755 --- a/bin/installexternal.sh +++ b/bin/installexternal.sh @@ -63,7 +63,7 @@ installErt() fi if [ ! -e ert ]; then - git clone -b release/2016.04 https://github.com/Ensembles/ert.git + git clone -b release/2016.10 https://github.com/Ensembles/ert.git fi if test "$DOWNLOAD_ONLY" == "y"; then @@ -80,7 +80,7 @@ installErt() cd $TOPDIR/ert mkdir build cd build - cmake ../devel + cmake .. make # show additional information @@ -294,25 +294,29 @@ installOPM() fi if [ ! -e opm-common ]; then - git clone -b release/2016.04 https://github.com/OPM/opm-common + git clone -b release/2016.10 https://github.com/OPM/opm-common fi if [ ! -e opm-core ]; then - git clone -b release/2016.04 https://github.com/OPM/opm-core + git clone -b release/2016.10 https://github.com/OPM/opm-core fi if [ ! -e opm-material ]; then - git clone -b release/2016.04 https://github.com/OPM/opm-material + git clone -b release/2016.10 https://github.com/OPM/opm-material fi if [ ! -e opm-parser ]; then - git clone -b release/2016.04 https://github.com/OPM/opm-parser + git clone -b release/2016.10 https://github.com/OPM/opm-parser fi if [ ! -e opm-grid ]; then - git clone -b release/2016.04 https://github.com/OPM/opm-grid + git clone -b release/2016.10 https://github.com/OPM/opm-grid fi + if [ ! -e opm-output ]; then + git clone -b release/2016.10 https://github.com/OPM/opm-output + fi + if test "$DOWNLOAD_ONLY" == "y"; then return fi @@ -323,6 +327,7 @@ installOPM() rm -rf opm-material rm -rf opm-parser rm -rf opm-grid + rm -rf opm-output return fi @@ -344,6 +349,8 @@ installOPM() echo " -Dopm-core_PREFIX=/path/to/opm-core \\" echo " -Dopm-material_PREFIX=/path/to/opm-material \\" echo " -Dopm-parser_PREFIX=/path/to/opm-parser \\" + echo " -Dopm-output_PREFIX=/path/to/opm-output \\" + echo " -DUSE_MPI=ON \\" echo " -DHAVE_OPM_GRID=1 \\" cd $TOPDIR @@ -384,7 +391,7 @@ installTypeTree() fi if [ ! -e dune-typetree ]; then - git clone -b releases/2.3 https://gitlab.dune-project.org/pdelab/dune-typetree.git + git clone -b releases/2.3 https://gitlab.dune-project.org/staging/dune-typetree.git fi if test "$DOWNLOAD_ONLY" == "y"; then diff --git a/bin/moduleutil/extractmodulepart.sh b/bin/moduleutil/extractmodulepart.sh new file mode 100755 index 0000000000000000000000000000000000000000..0ee074e126266bb3318937c4b7eff1de9227a88c --- /dev/null +++ b/bin/moduleutil/extractmodulepart.sh @@ -0,0 +1,417 @@ +#! /bin/bash + +# check if help is needed +if test "$1" = "--help" || test "$1" = "-help" \ + || test "$1" = "help" || test "$1" = ""; then + echo "" + echo "USAGE: $0 MODULE_DIR PATH_1 [PATH_2 ...]" + echo "" + echo "MODULE_DIR is the folder containing the DUNE module from which you" + echo "want to extract. The script has to be called one level above it." + echo "" + echo "The PATHs need to indicate subfolders of MODULE_DIR. At least one" + echo "of them has to contain a source file *.cc of an executable for which" + echo "you would like to timber a table in dumux-pub." + exit 0 +fi + +MODULE_DIR=$1 +# if MODULE_DIR contains a slash as last character, delete it +MODULE_DIR=$(echo $MODULE_DIR | sed s'/\/$//') +# check if we are above MODULE_DIR +if (! [ -d $MODULE_DIR ]); then + echo "ERROR: you need to run the script one level above the folder $MODULE_DIR." + echo "Run \"$0 --help\" for details." + exit 1 +fi + +# determine all source files in the paths passed as arguments +cd $MODULE_DIR +MODULE_FULL_PATH=$(pwd) +ALL_SOURCES="" +ALL_DIRECTORIES="" +for DIR_PATH in ${*:2}; do + STRIPPED_PATH=$(sed 's%.*'"$MODULE_DIR"'/%%g' <(echo "$DIR_PATH")) + ALL_DIRECTORIES="$ALL_DIRECTORIES $STRIPPED_PATH" + ALL_SOURCES="$ALL_SOURCES $(find $STRIPPED_PATH -name '*.cc' 2>/dev/null)" +done +cd .. + +# check if sources have been obtained +CONTRACTED="$(echo "$ALL_SOURCES" | tr -d " \t\n\r")" +if test "$CONTRACTED" = ""; then + echo "ERROR: no source files *.cc found in the directories ${*:2}." + echo "Be sure to provide a list of paths as arguments to this script." + echo "Run \"$0 --help\" for details." + exit 1; +fi + +# try to find the duneproject script +if hash duneproject 2>/dev/null; then + DUNE_PROJECT="duneproject" +else + DUNE_PROJECT=$(find . -name 'duneproject') +fi +if test "$DUNE_PROJECT" = ""; then + echo "ERROR: Could not find duneproject." + echo "Be sure to either have duneproject in your search path" + echo "or to run this script from a directory that contains duneproject." + exit 1; +fi + +# give explanations +echo "" +echo "This script will" +echo "- extract the following sub-folders of $MODULE_DIR:" +echo "" +for DIR_PATH in $ALL_DIRECTORIES; do + echo " $DIR_PATH," +done +echo "" +echo " and all headers in $MODULE_DIR that are required to build the" +echo " executables from the sources" +echo "" +for SOURCE in $ALL_SOURCES; do + echo " $SOURCE," +done +echo "" +echo "- copy the extracted files into a freshly created DUNE module, retaining the" +echo " directory structure," +echo "" +echo "- update/create all required files like CMakeLists.txt," +echo "" +echo "- store the versions of all used Dune module" +echo "" +echo "- and extract their modifications as patches." +echo "" +echo "Thus, you receive a fully-working DUNE module containing the subset of" +echo "$MODULE_DIR that is required to run your application." +echo "" +echo "duneproject will be run now. The new module should NOT depend on the" +echo "module in $MODULE_DIR." +echo "" +read -p "Read the above and press [Enter] to proceed..." + +# run duneproject +OLD_LS="$(ls)" +$DUNE_PROJECT +NEW_LS="$(ls)" + +# determine the new module/directory name +DIFF_OUTPUT=$(diff <(echo "$OLD_LS" ) <(echo "$NEW_LS")) +FOUND="0" +MODULE_NAME="" +for WORD in $DIFF_OUTPUT; do + if test "$FOUND" = "1"; then + MODULE_NAME=$WORD + fi + if test "$WORD" = ">"; then + FOUND="1" + fi +done +if test "$MODULE_NAME" = ""; then + echo "ERROR: could not find new module. Aborting." + exit 1 +else + echo "" + echo "$(basename $0): Found new module $MODULE_NAME" +fi + +echo -n "Determining required headers..." +cd $MODULE_DIR + +# initialize lists to hold required headers +LAST_REQUIRED_HEADERS="" +REQUIRED_HEADERS="$ALL_SOURCES" + +while test "$LAST_REQUIRED_HEADERS" != "$REQUIRED_HEADERS"; do + echo -n "." + LAST_REQUIRED_HEADERS="$REQUIRED_HEADERS" + + # remove the file that stores all required headers line by line + rm -f tmp_header_file + + for HEADER in $REQUIRED_HEADERS; do + # if tmp_header_file does not exist, create it + if test "$(ls tmp_header_file 2>/dev/null)" = ""; then + touch tmp_header_file + fi + + # append header name to tmp_header_file + echo "$HEADER" >> tmp_header_file + + # obtain the base name and the directory name of the header that is considered + HEADER_BASE_NAME=$(basename $HEADER) + HEADER_DIR_NAME=$(dirname $HEADER) + + # create a list of all files that are included from the header + sed -i 's/#include/#include /' $HEADER + INCLUDE_LIST=$(tr -s " " < $HEADER | tr -d '><"' | awk '/#include/{print $2}') + sed -i 's/#include /#include/' $HEADER + + # look at each of the included files + for INCLUDED_HEADER in $INCLUDE_LIST; do + # don't include config.h + if test "$INCLUDED_HEADER" = "config.h"; then + continue + fi + + INCLUDED_BASE_NAME=$(basename $INCLUDED_HEADER) + INCLUDED_DIR_NAME=$(dirname $INCLUDED_HEADER) + + # if the header file exists, add it + if test "$(ls $INCLUDED_HEADER 2>/dev/null)" = "$INCLUDED_HEADER"; then + echo "$INCLUDED_HEADER" >> tmp_header_file + continue + fi + + # try the header preceded by its path + INCLUDED_HEADER_WITH_PATH="${HEADER_DIR_NAME}/${INCLUDED_HEADER}" + + # if the header file actually exists, add it + if test "$(ls $INCLUDED_HEADER_WITH_PATH 2>/dev/null)" = "$INCLUDED_HEADER_WITH_PATH"; then + # remove "../" from the path + cd $(dirname $INCLUDED_HEADER_WITH_PATH) + HEADER_FULL_PATH=$(pwd) + HEADER_RELATIVE_PATH=${HEADER_FULL_PATH#$MODULE_FULL_PATH} + HEADER_RELATIVE_PATH=$(echo $HEADER_RELATIVE_PATH | sed 's/^.//') + INCLUDED_HEADER_WITH_PATH="${HEADER_RELATIVE_PATH}/${INCLUDED_BASE_NAME}" + cd $MODULE_FULL_PATH + echo "$INCLUDED_HEADER_WITH_PATH" >> tmp_header_file + fi + done + done + + # sort the required headers, eliminate copies + REQUIRED_HEADERS=$(sort -u tmp_header_file) +done + +# remove the file that stores all required headers line by line +rm -f tmp_header_file + +# provide some output and copy everything to the new module +echo "" +echo -n "Number of required headers: " +echo "$REQUIRED_HEADERS" | wc -w +for HEADER in $REQUIRED_HEADERS; do + echo $HEADER + rsync -R $HEADER ../$MODULE_NAME +done +for DIR_PATH in $ALL_DIRECTORIES; do + rsync -rR $DIR_PATH ../$MODULE_NAME +done + +# delete all architecture-dependent files +cd ../$MODULE_NAME +find . -name Makefile.in -delete +find . -name Makefile -delete +find . -name '*.o' -delete +find . -wholename '*.deps/*' -delete +find . -path '*.deps' -delete +echo "Removed architecture-dependent files." + +# remove directories that are not required +sed -i '/"dune"/d' CMakeLists.txt +sed -i '/"src"/d' CMakeLists.txt +sed -i '/"m4"/d' CMakeLists.txt +rm -rf dune/ +rm -rf src/ +rm -rf m4/ + +# create a list of the subfolders +EMPTY_DIR_NAME="." +rm -f tmp_subdir_file +for HEADER in $REQUIRED_HEADERS; do + + # move through every header, cutting off the last folder + while test "$HEADER" != $EMPTY_DIR_NAME; do + if test "$(dirname $HEADER)" != $EMPTY_DIR_NAME; then + dirname $HEADER >> tmp_subdir_file + fi + + HEADER=$(dirname $HEADER) + done + + # finally add the topmost folder + if test "$(basename $HEADER)" != $EMPTY_DIR_NAME; then + basename $HEADER >> tmp_subdir_file + fi +done +SUBDIR_LIST=$(sort -u tmp_subdir_file) +rm -f tmp_subdir_file + +# treat every subfolder +START_DIR=$PWD +INITIAL_SUBDIR_LIST="" +for SUBDIR in $SUBDIR_LIST; do + if test "$SUBDIR" = "$(basename $SUBDIR)"; then + INITIAL_SUBDIR_LIST="$INITIAL_SUBDIR_LIST $SUBDIR" + fi + + cd $SUBDIR + + # create lists of files and folders + FILE_LIST="" + DIR_LIST="" + for FILE_OR_FOLDER in $( ls ); do + if ([ -f $FILE_OR_FOLDER ]); then + FILE_LIST="$FILE_LIST $FILE_OR_FOLDER" + fi + + if ([ -d $FILE_OR_FOLDER ]); then + DIR_LIST="$DIR_LIST $FILE_OR_FOLDER" + fi + done + + # create CMakeLists.txt if not present + if ([ ! -f CMakeLists.txt ]); then + # add subfolder information + for DIR in $DIR_LIST; do + echo "add_subdirectory(\"$DIR\")" >> CMakeLists.txt + done + + # determine whether to add file information + ADD_FILE_INFO="0" + for FILE in $FILE_LIST; do + if ([ -f $FILE ]); then + ADD_FILE_INFO="1" + fi + done + + # add file information + if test "$ADD_FILE_INFO" = "1"; then + echo "" >> CMakeLists.txt + echo "install(FILES" >> CMakeLists.txt + + for FILE in $FILE_LIST; do + echo " $FILE" >> CMakeLists.txt + done + + echo " DESTINATION \${CMAKE_INSTALL_INCLUDEDIR}/$SUBDIR)" >> CMakeLists.txt + fi + fi + + cd $START_DIR + +done + +# update top CMakeLists.txt +for INITIAL_SUBDIR in $INITIAL_SUBDIR_LIST; do + sed -i '/add_subdirectory("doc")/a add_subdirectory('"$INITIAL_SUBDIR"')' CMakeLists.txt +done +echo "Updated and created CMakeLists.txt's." +cd .. + +# add includes to the automatically generated file *Macros.cmake +MACROS_FILE="$(find $MODULE_NAME -name '*Macros.cmake')" +if test "$(find $MODULE_NAME -type f -name 'CMakeLists.txt' -exec grep add_csv_file_links {} \; 2>/dev/null)" != ""; then + cp dumux-devel/cmake/modules/AddCSVFileLinks.cmake $MODULE_NAME/cmake/modules/. + echo "include(AddCSVFileLinks)" >>$MACROS_FILE +fi +if test "$(find $MODULE_NAME -type f -name 'CMakeLists.txt' -exec grep add_executable_all {} \; 2>/dev/null)" != ""; then + cp dumux-devel/cmake/modules/AddExecutableAll.cmake $MODULE_NAME/cmake/modules/. + echo "include(AddExecutableAll)" >>$MACROS_FILE +fi +if test "$(find $MODULE_NAME -type f -name 'CMakeLists.txt' -exec grep add_file_link {} \; 2>/dev/null)" != ""; then + cp dumux-devel/cmake/modules/AddFileLink.cmake $MODULE_NAME/cmake/modules/. + echo "include(AddFileLink)" >>$MACROS_FILE +fi +if test "$(find $MODULE_NAME -type f -name 'CMakeLists.txt' -exec grep add_folder_link {} \; 2>/dev/null)" != ""; then + cp dumux-devel/cmake/modules/AddFolderLink.cmake $MODULE_NAME/cmake/modules/. + echo "include(AddFolderLink)" >>$MACROS_FILE +fi +if test "$(find $MODULE_NAME -type f -name 'CMakeLists.txt' -exec grep add_gnuplot_file_links {} \; 2>/dev/null)" != ""; then + cp dumux-devel/cmake/modules/AddGnuplotFileLinks.cmake $MODULE_NAME/cmake/modules/. + echo "include(AddGnuplotFileLinks)" >>$MACROS_FILE +fi + +# create $README_FILE +README_FILE="README.md" +mv $MODULE_NAME/README $MODULE_NAME/$README_FILE +echo "This file has been created automatically. Please adapt it to your needs." >$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +echo "===============================" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +echo "The content of this DUNE module was extracted from the module $MODULE_DIR." >>$MODULE_NAME/$README_FILE +echo "In particular, the following subfolders of $MODULE_DIR have been extracted:" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +for DIR_PATH in $ALL_DIRECTORIES; do + echo " $DIR_PATH," >>$MODULE_NAME/$README_FILE +done +echo "" >>$MODULE_NAME/$README_FILE +echo "Additionally, all headers in $MODULE_DIR that are required to build the" >>$MODULE_NAME/$README_FILE +echo "executables from the sources" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +for SOURCE in $ALL_SOURCES; do + echo " $SOURCE," >>$MODULE_NAME/$README_FILE +done +echo "" >>$MODULE_NAME/$README_FILE +echo "have been extracted. You can build the module just like any other DUNE" >>$MODULE_NAME/$README_FILE +echo "module. For building and running the executables, please go to the folders" >>$MODULE_NAME/$README_FILE +echo "containing the sources listed above." >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE +echo "" >>$MODULE_NAME/$README_FILE + +# get versions from modules we are depeding on +# create patches for un-pushed commits and uncomitted changes + +# try to find the dunecontrol script +if hash dunecontrol 2>/dev/null; then + DUNE_CONTROL="dunecontrol" +else + DUNE_CONTROL=$(find . -type f -executable -name 'dunecontrol') +fi +if test "$DUNE_CONTROL" = ""; then + echo "ERROR: Could not find dunecontrol." + echo "Be sure to either have dunecontrol in your search path" + echo "or to run this script from a directory that contains dunecontrol." + exit +fi +# get names of all modules we are depeding on +echo "Extracting dependencies to other Dune modules" +DEPENDING_MODULE_NAMES=$($DUNE_CONTROL --module=$MODULE_NAME 2>/dev/null | head -n 1) +DEPENDING_MODULE_NAMES=$(sed 's/--- going to build //' <<< "$DEPENDING_MODULE_NAMES") +DEPENDING_MODULE_NAMES=$(sed 's/ ---//' <<< "$DEPENDING_MODULE_NAMES") +# load script +CALL_FROM_EXTERNAL_SCRIPT="yes" +SCRIPT_DIR="${BASH_SOURCE%/*}" +if [[ ! -d "$SCRIPT_DIR" ]]; then + SCRIPT_DIR="$PWD"; +fi +# create install script +touch $MODULE_NAME/install$MODULE_NAME.sh +. "$SCRIPT_DIR/getusedversions.sh" +# execute function from script +echo "Extracting Git status of dependencies and creating patches" +for MOD in $DEPENDING_MODULE_NAMES +do + if [ $MOD != $MODULE_NAME ]; then + MODULE_DIR=${MOD%*/} + getVersionGit $MODULE_DIR $(pwd)/$MODULE_NAME/install$MODULE_NAME.sh >>$MODULE_NAME/$README_FILE + fi +done + +# move patches folder into module if existing +if [[ -d patches ]]; then + mv patches $MODULE_NAME +fi + +# output guidence for users +echo "" +echo "*************************************************************************" +echo "The extracted module is contained in the subfolder \"$MODULE_NAME\"." +echo "You can build it using \"dunecontrol ... --only=$MODULE_NAME all\"." +echo "*************************************************************************" +echo "BEFORE building, you can add the module to dumux-pub by something like:" +echo "(Rename module name if it does not match the AuthorLastNameYearx scheme" +echo "and commit it to the Git repository dumux-pub)" +echo "git clone https://git.iws.uni-stuttgart.de/dumux-pub/AuthorLastNameYearx.git" +echo "sed -i '/Module:/c\Module: AuthorLastNameYearx' $MODULE_NAME/dune.module" +echo "mv $MODULE_NAME/* dumux-pub/AuthorLastNameYearx/." +echo "cd AuthorLastNameYearx" +echo "git commit -a" +echo "git push" + +exit 0 diff --git a/bin/moduleutil/getusedversions.sh b/bin/moduleutil/getusedversions.sh new file mode 100755 index 0000000000000000000000000000000000000000..6dc2c1d9d4b3593a91eeafe8c3773ebde5e2fb54 --- /dev/null +++ b/bin/moduleutil/getusedversions.sh @@ -0,0 +1,105 @@ +# !/bin/bash + +# skript to extract Git version information +# including automating patch extraction and handling of uncommitted changes +# +# (c) 2016 Thomas Fetzer +# (c) 2016 Christoph Grüninger +# + +if [ "${args[1]}" = "-h" ]; then + echo "USAGE: ./getDumuxDuneVersions.sh" + echo; exit +fi + +OUTFILE=versionNumbers.txt + +# create patches from get local commits +# $1 directory /which is local copy of Git repository to check, assumed to be identical with module name +# $2 script file to append command for checking out Git repository +function getPatchesGit +{ + # if not yet existing, create common patch directory + if [ ! -d ../patches ]; then + mkdir ../patches + fi + # create directory for patches of module + mkdir ../patches-$1 + + # create patch for local commits + git format-patch --output-directory ../patches-$1 @{upstream} + # create extra patch for uncommitted changes if necessary + if [[ `git status --porcelain | grep -v "build.*"` ]]; then + git diff > ../patches-$1/9999-uncommitted-changes.patch + fi + + # move and rename all patches to common patch directory + MODULE_PWD=$PWD + cd ../patches-$1 ; + for file in *.patch + do + mv $file ../patches/$1_$file + printf "Created patch %s\n" $1_$file + echo "patch -p1 < ../patches/$1_$file" >> $2 + done + cd $MODULE_PWD + # remove helper dirctory + rm -r ../patches-$1 +} + +# get version from Git, output and write to file +# $1 directory which is local copy of Git repository to check, assumed to be identical with module name +# $2 script file to append command for checking out Git repository +function getVersionGit +{ + # enter directory + cd $1 + # get URL from remote a.k.a. the repository + GIT_REMOTE="$(git ls-remote --get-url)" + # get revision, date, author and branch of last remote/upstream commit + GIT_UPSTREAM_REVISION="$(git log -n 1 --format=%H @{upstream})" + GIT_UPSTREAM_DATE="$(git log -n 1 --format=%ai @{upstream})" + GIT_UPSTREAM_AUTHOR="$(git log -n 1 --format=%an @{upstream})" + GIT_UPSTREAM_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + printf "%-25s %-15s %-15s\n" $1 $GIT_UPSTREAM_BRANCH $GIT_UPSTREAM_REVISION + echo "# $1" >> $2 + echo "# $GIT_UPSTREAM_BRANCH # $GIT_UPSTREAM_REVISION # $GIT_UPSTREAM_DATE # $GIT_UPSTREAM_AUTHOR" >> $2 + echo "git clone $GIT_REMOTE" >> $2 + echo "cd $1" >> $2 + echo "git checkout $GIT_UPSTREAM_BRANCH" >> $2 + echo "git reset --hard $GIT_UPSTREAM_REVISION" >> $2 + # check for untracked files and error out if found, but ignore build* + if [[ `git ls-files --others --exclude-standard | grep -v "build*" | grep -v "\.[A-Za-z]*"` ]]; then + echo "Error: Found untracked files in module $1. Please commit, stash or remove them." + echo "You might want to delete the folder patches/ and the module just created." + exit + fi + # create patches if number of commits is not zero + if [[ "$(git rev-list HEAD ^@{upstream} --count)" > 0 ]] || [[ `git status --porcelain | grep -v "build.*" | grep -v "\.[A-Za-z]*"` ]]; then + getPatchesGit $1 $2 + fi + echo "cd .." >> $2 + echo "" >> $2 + cd .. +} + +# run script from comand line +# suppressed for use of external script when variable set accordingly +if [ "$CALL_FROM_EXTERNAL_SCRIPT" == "no" ]; then + echo "# DUNE/DUMUX VERSIONS" > $OUTFILE + + echo "Creating file containing the version numbers:" + for dir in dune-* dumux* + do + DIR=${dir%*/} + # echo $DIR + # skip folders that are no Git repository + if [ -d $DIR/.git ]; then + getVersionGit $DIR ../$OUTFILE + fi + done + + echo "done" + + exit +fi diff --git a/bin/postprocessing/extractlinedata.py b/bin/postprocessing/extractlinedata.py index 12861212f12d658a01c5d1cbd072fbd40a7f2a20..c0144c367c65d985145b2a37caf241eca0f44337 100644 --- a/bin/postprocessing/extractlinedata.py +++ b/bin/postprocessing/extractlinedata.py @@ -5,10 +5,9 @@ import os # parse arguments parser = argparse.ArgumentParser( - prog='pvpython ' + sys.argv[0], + prog='\033[1m\033[94m' + 'pvpython' + '\033[0m' + ' ' + sys.argv[0], description='Extract data from the paraview plotOverLine filter.' ) -parser = argparse.ArgumentParser() parser.add_argument('-f', '--files', nargs='+', required=True, help="vtu files to be processed") parser.add_argument('-o', '--outputDirectory', default='', help="Directory to which the data files are written") parser.add_argument('-of', '--outFile', default='', help="Basename of the written csv file") @@ -18,7 +17,10 @@ parser.add_argument('-r', '--resolution', type=int, default=1000, help='Resoluti parser.add_argument('-v', '--verbosity', type=int, default=2, help='Verbosity of the output. 1 = print progress. 2 = print data columns') args = vars(parser.parse_args()) -from paraview.simple import * +try: + from paraview.simple import * +except ImportError: + print("`paraview.simple` not found. Make sure using pvpython instead of python.") # import locations commonOutDirectory = False diff --git a/bin/postprocessing/extractpointdataovertime.py b/bin/postprocessing/extractpointdataovertime.py index d3c78c4da9b3506477961468eef3958a93b3c014..2fcf9394dd768f750134a8a0ba0e1bbf55e5443d 100644 --- a/bin/postprocessing/extractpointdataovertime.py +++ b/bin/postprocessing/extractpointdataovertime.py @@ -6,7 +6,7 @@ import sys # parse arguments parser = argparse.ArgumentParser( - prog='pvpython ' + sys.argv[0], + prog='\033[1m\033[94m' + 'pvpython' + '\033[0m' + ' ' + sys.argv[0], description='Extract data from the paraview probeLocation and plotOverTime filters.' ) parser.add_argument('-f', '--files', nargs='+', required=True, help="pvd files to be processed") @@ -16,7 +16,10 @@ parser.add_argument('-p', '--point', type=float, nargs=3, required=True, help='C parser.add_argument('-v', '--verbosity', type=int, default=2, help='Verbosity of the output. 1 = print progress. 2 = print data columns') args = vars(parser.parse_args()) -from paraview.simple import * +try: + from paraview.simple import * +except ImportError: + print("`paraview.simple` not found. Make sure using pvpython instead of python.") # import locations commonOutDirectory = False diff --git a/bin/postprocessing/l2error.py b/bin/postprocessing/l2error.py new file mode 100644 index 0000000000000000000000000000000000000000..5f27863785e15b718975bac271bd66f2f5aef109 --- /dev/null +++ b/bin/postprocessing/l2error.py @@ -0,0 +1,99 @@ +import argparse +import csv +import sys + +#Auxiliary function that provides a handy parser +parser = argparse.ArgumentParser(prog='python ' + sys.argv[0], description='Calculate the l2 error of csv data files.') +parser.add_argument('-f1', '--reference', type=str, required=True, help='Reference csv-file') +parser.add_argument('-f2', '--newSolution', type=str, required=True, help='NewSolution csv-file') +parser.add_argument('-xMin', '--xMin', type=float, required=False, default=-1e99, help='Restrict data to x>xMin') +parser.add_argument('-xMax', '--xMax', type=float, required=False, default=1e99, help='Restrict data to x>xMax') +group1 = parser.add_mutually_exclusive_group(required=True) +group1.add_argument('-x1', '--xData1', type=int, help='Column index of x data in reference') +group1.add_argument('-x1Name', '--xDataName1', type=str, help='Name x data in reference') +group2 = parser.add_mutually_exclusive_group(required=True) +group2.add_argument('-x2', '--xData2', type=int, help='Column index of x data in newSolution') +group2.add_argument('-x2Name', '--xDataName2', type=str, help='Name x data in newSolution') +group3 = parser.add_mutually_exclusive_group(required=True) +group3.add_argument('-y1', '--yData1', type=int, help='Column index of y data in reference') +group3.add_argument('-y1Name', '--yDataName1', type=str, help='Name y data in reference') +group4 = parser.add_mutually_exclusive_group(required=True) +group4.add_argument('-y2', '--yData2', type=int, help='Column index of y data in newSolution') +group4.add_argument('-y2Name', '--yDataName2', type=str, help='Name y data in newSolution') +parser.add_argument('-p', '--percent', action='store_true', help='Print errors in percent') +parser.add_argument('-f', '--force', action='store_true', help='Ignore \'not-matching\' errors') +parser.add_argument('-v', '--verbose', action='store_true', help='Verbosity of the script') +args = vars(parser.parse_args()) + +with open(args['reference'], 'rb') as referenceFile: + reader = csv.reader(referenceFile) + reference = list(reader) + if(args['xDataName1'] is not None): + indexReferenceX = reference[0].index(args['xDataName1']) + else: + indexReferenceX = args['xData1'] + if(args['yDataName1'] is not None): + indexReferenceY = reference[0].index(args['yDataName1']) + else: + indexReferenceY = args['yData1'] + +with open(args['newSolution'], 'rb') as newSolutionFile: + reader = csv.reader(newSolutionFile) + newSolution = list(reader) + if(args['xDataName2'] is not None): + indexNewSolutionX = reference[0].index(args['xDataName2']) + else: + indexNewSolutionX = args['xData2'] + if(args['yDataName2'] is not None): + indexNewSolutionY = reference[0].index(args['yDataName2']) + else: + indexNewSolutionY = args['yData2'] + +if (reference[0][indexReferenceX] != reference[0][indexNewSolutionX] and not args['force']): + print "X-Identifier not equal: ref=", reference[0][indexReferenceX], ",new=", reference[0][indexNewSolutionX], ". Aborting! (Use -f to continue anyway)" + exit (1) + +if (reference[0][indexReferenceY] != newSolution[0][indexNewSolutionY] and not args['force']): + print "Y-Identifier not equal. ref=", reference[0][indexReferenceY], ",new=", newSolution[0][indexNewSolutionY], ". Aborting! (Use -f to continue anyway)" + exit (2) + +if (len(reference) != len(newSolution)): + print "Length of reference and newSolution not equal: ref=", len(reference), ",new=", len(newSolution), ". Aborting!" + exit (3) + +distanceOld = 0.0 +sumError = 0.0 +sumReference = 0.0 +sumDistance = 0.0 +numPoints = 0 + +for i in range(1,len(reference)): + coord_ref = float(reference[i][indexReferenceX]) + coord_newSolution = float(newSolution[i][indexNewSolutionX]) + if (coord_ref != coord_newSolution): + print "Coordinates not equal: ref=", coord_ref, ",new=", coord_newSolution, ". Aborting!" + exit (4) + if (coord_ref < float(args['xMin']) or coord_ref > float(args['xMax'])): + continue + + if (i == 1): + distance = 0.5*(float(reference[2][indexReferenceX]) - float(reference[1][indexReferenceX])) + elif (i == len(reference)-1): + distance = 0.5*(float(reference[len(reference)-1][indexReferenceX]) - float(reference[len(reference)-2][indexReferenceX])) + else: + distance = 0.5*(float(reference[i+1][indexReferenceX]) - float(reference[i-1][indexReferenceX])) + sumError += ((float(reference[i][indexReferenceY])-float(newSolution[i][indexNewSolutionY]))**2)*distance + sumReference += ((float(reference[i][indexReferenceY]))**2)*distance + sumDistance += distance + numPoints += 1 + +if (numPoints < 999 and not args['force']): + print "Warning: numPoints=", numPoints, " is low, could result in bad the error approximation. (Use -f to suppress this warning)" + +l2normAbs = (sumError/sumDistance)**0.5 # numPoints is needed, resulting from the equidistant integration +l2normRel = (sumError/sumReference)**0.5 # numPoints cancels out for equidistant integration + +if (args['percent']): + print "L2_Error_in_%: ", "{0:.5f}%".format(l2normAbs*100), "Rel_L2_Error_in_%: ", "{0:.5f}%".format(l2normRel*100) +else: + print "L2_Error: ", "{0:.5e}".format(l2normAbs), " Rel_L2_Error: ", "{0:.5e}".format(l2normRel) diff --git a/bin/runtest.py b/bin/runtest.py deleted file mode 100644 index 7cc4a82ebe1ed7657ef8b168710c624c1bcbe11f..0000000000000000000000000000000000000000 --- a/bin/runtest.py +++ /dev/null @@ -1,8 +0,0 @@ -import sys -print("") -print("#################################################################################") -print("# Warning: bin/runtest.py is deprecated and will be deleted after release 2.10. #") -print("# Use bin/testing/runtest.py instead. #") -print("#################################################################################") -print("") -sys.exit(1) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 5927abb75b6ef27ea23ce8e33e01176af6f63fed..4c2a8184d871a452b049b3c4249df9d246b56ee3 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -4,7 +4,10 @@ set(modules DumuxDoxygen.cmake DumuxMacros.cmake DumuxTestMacros.cmake + FindGLPK.cmake FindGstat.cmake + FindNLOPT.cmake + FindPVPython.cmake FindValgrind.cmake) include(GNUInstallDirs) install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR}) diff --git a/cmake/modules/DumuxMacros.cmake b/cmake/modules/DumuxMacros.cmake index 97ea267aa20896c27b595383c0da5ffef223763a..d89484b592551353e431229e845e437df7bef7b5 100644 --- a/cmake/modules/DumuxMacros.cmake +++ b/cmake/modules/DumuxMacros.cmake @@ -5,10 +5,10 @@ include(DumuxDoxygen) include(DumuxTestMacros) find_package(GLPK) -find_package(Gstat) find_package(Gnuplot) set(HAVE_GNUPLOT ${GNUPLOT_FOUND}) - +find_package(Gstat) find_package(NLOPT) -find_package(Valgrind) find_package(PTScotch) +find_package(PVPython) +find_package(Valgrind) diff --git a/cmake/modules/DumuxTestMacros.cmake b/cmake/modules/DumuxTestMacros.cmake index ef5d5381743ada68fdf2f60c6260f206d7ebfbe8..71b6881d7a0142613096c724f781a3a72cb66e71 100644 --- a/cmake/modules/DumuxTestMacros.cmake +++ b/cmake/modules/DumuxTestMacros.cmake @@ -54,7 +54,8 @@ macro(add_dumux_test dumux_test dumux_test_executable dumux_test_executable_sour else() dune_add_test(NAME ${dumux_test} TARGET ${dumux_test_executable} - COMMAND ${dumux_test_args}) + COMMAND ${dumux_test_args} + TIMEOUT 600) # set default timeout # tests always require the executable to run set_tests_properties(${dumux_test} PROPERTIES REQUIRED_FILES ${dumux_test_executable}) endif() diff --git a/cmake/modules/FindPVPython.cmake b/cmake/modules/FindPVPython.cmake new file mode 100644 index 0000000000000000000000000000000000000000..0419008b4ec6009adf468d3b12e8d4b0826108e0 --- /dev/null +++ b/cmake/modules/FindPVPython.cmake @@ -0,0 +1,45 @@ +# .. cmake_module:: +# +# Find the pvpython library +# +# You may set the following variables to modify the +# behaviour of this module: +# +# :ref:`PVPYTHON_ROOT` +# Path list to search for pvpython. +# +# Sets the following variables: +# +# :code:`PVPYTHON_FOUND` +# True if the pvpython library was found. +# +# :code:`PVPYTHON_EXECUTABLE` +# Path to pvpython executable +# +# .. cmake_variable:: PVPYTHON_ROOT +# +# You may set this variable to have :ref:`FindPVPython" look +# for the pvpython library in the given path before inspecting +# system paths. +# + +# look for header files, only at positions given by the user +find_program(PVPYTHON_EXECUTABLE + NAMES pvpython + PATHS "${PVPYTHON_ROOT}/" + "${CMAKE_SOURCE_DIR}/../" + "/usr/bin/" + PATH_SUFFIXES "pvpython" + NO_DEFAULT_PATH +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + "PVPython" + DEFAULT_MSG + PVPYTHON_EXECUTABLE +) + +# set macros for config.h +set(HAVE_PVPYTHON ${PVPYTHON_FOUND}) +set(PVPYTHON_EXECUTABLE ${PVPYTHON_EXECUTABLE}) diff --git a/doc/doxygen/Doxylocal b/doc/doxygen/Doxylocal index b45d87babb0442b42f01e48e74a0a31e22bd4eba..fcf6e7271f042d5209912c0f35c924da536bcc38 100644 --- a/doc/doxygen/Doxylocal +++ b/doc/doxygen/Doxylocal @@ -1,5 +1,5 @@ # This file contains local changes to the doxygen configuration -# please us '+=' to add file/directories to the lists +# please use '+=' to add file/directories to the lists PREDEFINED += "NEW_PROP_TAG(name)=Property tag name" \ "NEW_TYPE_TAG(name)=Type tag name" \ @@ -10,6 +10,7 @@ INPUT += @srcdir@/mainpage.txt \ @top_srcdir@/dumux \ @top_srcdir@/test \ @top_srcdir@/tutorial \ + @srcdir@/extradoc/binaries.txt \ @srcdir@/extradoc/parameterlist.txt \ @srcdir@/extradoc/featurelist.txt diff --git a/doc/doxygen/extradoc/binaries.txt b/doc/doxygen/extradoc/binaries.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88910ba1c18582788e97bc76220db92a34e132f --- /dev/null +++ b/doc/doxygen/extradoc/binaries.txt @@ -0,0 +1,14 @@ +/*! + * \page Binaries Scripts + * + * \brief List of auxiliary scripts provided with DuMuX + * + * | Folder | Filename | Functionality | + * | :- | :- | :- | + * | bin | installexternal.sh | Easily install external modules (e.g. opm, dune-pdelab, gstat, ug, ...). | + * | bin/postprocessing | extractlinedata.py | Extract all data point from a vtu over a defined line (requires pvpython). | + * | bin/postprocessing | extractpointdataovertime.py | Extract transient data from a .pvd for a specific point (requires pvpython). | + * | bin/postprocessing | l2error.py | Calculate the L2-error between two vectors. | + * | bin/testing | fuzzycomparevtu.py | Compare to vtu files allowing for a tiny mismatch. | + * | bin/testing | runtest.py | Start a test including fuzzy-comparison. | + */ diff --git a/doc/doxygen/extradoc/featurelist.txt b/doc/doxygen/extradoc/featurelist.txt index 091b69f3641a0879a454807cf87e1685f9644fd3..7293950a9aa0e00dd56b7309fa10ab3751b32073 100644 --- a/doc/doxygen/extradoc/featurelist.txt +++ b/doc/doxygen/extradoc/featurelist.txt @@ -1,8 +1,6 @@ /*! - *\file - *\ingroup Feature - * - *\brief List of Features implemented in the DuMuX-test-problems + * \page featureList Feature List + * \brief List of Features implemented in the DuMuX-test-problems * * The list gives an overview over features that are already * implemented in DuMuX and in which respective test problem diff --git a/doc/doxygen/extradoc/parameterlist.txt b/doc/doxygen/extradoc/parameterlist.txt index 130e603aec960bbba3add9e6a8f38da93641ca3e..3d29b563869fb43a651318efe3d8e5e42230c51c 100644 --- a/doc/doxygen/extradoc/parameterlist.txt +++ b/doc/doxygen/extradoc/parameterlist.txt @@ -1,8 +1,7 @@ /*! - *\file - *\ingroup Parameter + * \page parameterList Parameter List * - *\brief List of currently useable run-time parameters + * \brief List of currently useable run-time parameters * * The listed run-time parameters are in general available, * but we point out that a certain model might not be able @@ -11,8 +10,9 @@ * | Group | Parameter | Type | Default Value | Explanation | * | :- | :- | :- | :- | :- * | - | ParameterFile | std::string | executable.input | name of the parameter file | - * | \b BoundaryLayer | Model | int | 0 | 0 for none, 1 Blasius, 2 and 3 turbulent BL, 9 constant thickness | - * | | ConstThickness | Scalar | - | constant BL thickness (BL model 9) | + * | \b BoundaryLayer | Model | int | 0 | 0 for none; 1 constant thickness; 2 Blasius laminar; 3 turbulent; 4, 5, 6, 7 viscous sublayer | + * | | ConstThickness | Scalar | - | constant BL thickness (BL model 1) | + * | | HydraulicDiameter | Scalar | - | hydraulic diameter for BL model 7 | * | | Offset | Scalar | - | virtual run-up distance for BL models | * | | RoughnessLength | Scalar | - | Equivalent sand grain roughness [m] | * | | YPlus | Scalar | - | Conversion factor between dimensionless wall distance y^+ and actual wall distance | @@ -20,13 +20,10 @@ * | | RefTemperature | Scalar | - | free stream temperature | * | | RefVelocity | Scalar | - | free stream velocity | * | \b Grid | File | std::string | - | name of the grid file, if a corresponding GridCreator is used | - * | | InterfacePosX | Scalar | 0.0 | x-coordinate of the refinement point/line (only Interface-GridCreator) | - * | | InterfacePosY | Scalar | 0.0 | y-coordinate of the refinement point/line (only Interface-GridCreator) | * | | LowerLeft | globalPosition | - | coordinates of the lower front left corner for the Cube/Simplex/Interface-GridCreator | * | | Cells | globalPosition | - | number of cells in respective coordinate directions for the Cube/SimplexGridCreator | - * | | RefineTopX | bool | false | Refine to the right of the domain (only Interface-GridCreator) | - * | | RefineTopY | bool | false | Refine to the top of the domain (only Interface-GridCreator) | * | | UpperRight | globalPosition | - | coordinates of the upper back right corner for the Cube/Simplex/Interface-GridCreator | + * | | Verbosity | bool | - | whether the grid construction should output to standard out | * | \b GridAdapt | AdaptionInterval | int | 1 | time step interval for adaption | * | | CoarsenPercentileFlux | Scalar | 0.2 | percentile of cells coarsened because of flux criterion | * | | CoarsenPercentileSat | Scalar | 0.2 | percentile of cells coarsened because of saturation criterion | @@ -98,10 +95,12 @@ * | | WriteConvergence | bool | false | specifies whether the convergence rate and the global residual gets written out to disk for every Newton iteration | * | \b Pardiso | NumProcessors | int | - | | * | \b Problem | EnableGravity | bool | true | returns whether gravity is considered in the problem | - * | | GasDensity | Scalar | - | The density of the gas (only components/constant.hh) | - * | | GasKinematicViscosity | Scalar | - | The kinematic viscosity of the gas (only components/constant.hh) | - * | | LiquidDensity | Scalar | - | The density of the liquid (only components/constant.hh) | - * | | LiquidKinematicViscosity | Scalar | - | The kinematic viscosity of the liquid (only components/constant.hh) | + * | | GasDensity | Scalar | 1.0 | The density of the gas (only components/constant.hh) | + * | | GasKinematicViscosity | Scalar | 1.0 | The kinematic viscosity of the gas (only components/constant.hh) | + * | | InteractingContinuaType | int | 0 | defines interaction of the nested continua (0: constant volume fractions, 1: equally distanced nested continua, 2: DFM generated volume fractions) | + * | | LiquidDensity | Scalar | 1.0 | The density of the liquid (only components/constant.hh) | + * | | LiquidKinematicViscosity | Scalar | 1.0 | The kinematic viscosity of the liquid (only components/constant.hh) | + * | | MolarMass | Scalar | 1.0 | The molar mass (only components/constant.hh) | * | | Name | std::string | - | The name of the current problem, used for output | * | | Salinity | Scalar | 1e-3 | | * | \b SpatialParams | ForchCoeff | Scalar | 0.55 | property for the forchheimer coefficient | diff --git a/doc/doxygen/mainpage.txt b/doc/doxygen/mainpage.txt index f608923d87cd4dae576b8d06daf70746163839ee..80eacb795c57032fd5222a37571b8d2e67c2e5f9 100644 --- a/doc/doxygen/mainpage.txt +++ b/doc/doxygen/mainpage.txt @@ -1,9 +1,3 @@ -/*! - * \file - * - * \brief documentation for the doxygen main page - */ - /** \mainpage DuMuX Documentation \section intro Introduction @@ -12,17 +6,19 @@ Welcome to the DuMuX documentation pages. This documentation has been generated using Doxygen, a free source code documentation system for documenting C/C++ code. -\section mods Modules - -The best way to start is from the page Modules which gives -you access to the documentation by category. +\section relatedPages Related pages -\section params Parameters +The Related Pages gives a good overview on everything beyond the +actual DuMuX code. +This includes a Bibliography of the publications DuMuX is based on.
+Further, a \ref parameterList containing all implemented parameters and +a \ref featureList of special features used in the test problems is available.
+Auxiliary script files can be find in \ref Binaries.
+In addition, the current Todo List, Warning List, and Deprecated List are given (if available). -An overview of all availabe parameters is given in \ref parameterlist.txt. - -\section features Features +\section mods Modules -An overview of special features implemented in the DuMuX-test-problems is given in \ref featurelist.txt. +The best way to start is from the page Modules which gives +you access to the documentation by the model categories. */ diff --git a/doc/doxygen/modules.txt b/doc/doxygen/modules.txt index 11a3cc1fae44be0faf5da24e28ec75cfb68d7e71..55d99389c7d02ddc51c5563b757681fc3cbd2b21 100644 --- a/doc/doxygen/modules.txt +++ b/doc/doxygen/modules.txt @@ -1,17 +1,12 @@ -/*! - * \file - * - * \brief This file contains all module definitions for the doxygen documentation. - * - */ - /* ***************** Porousmediaflow ******************/ /*! - * \defgroup Porousmediaflow Porous-Medium Flow (fully implicit if not denoted otherwise) + * \defgroup Porousmediaflow Porous-Medium Flow + * \brief fully implicit if not denoted otherwise */ /*! * \ingroup Porousmediaflow - * \defgroup OnePModels 1p (one-phase Darcy flow) + * \defgroup OnePModels 1p + * \brief one-phase Darcy flow */ /*! * \ingroup OnePModels @@ -27,13 +22,15 @@ */ /*! * \ingroup Porousmediaflow - * \defgroup OnePTwoCModel 1p2c (one-phase, two-component Darcy flow) + * \defgroup OnePTwoCModel 1p2c + * \brief one-phase, two-component Darcy flow * * \copydetails Dumux::OnePTwoCModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPModels 2p (two-phase Darcy flow) + * \defgroup TwoPModels 2p + * \brief two-phase Darcy flow */ /*! * \ingroup TwoPModels @@ -56,19 +53,22 @@ */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPOneCModel 2p1c (two-phase, one-component Darcy flow) + * \defgroup TwoPOneCModel 2p1c + * \brief two-phase, one-component Darcy flow * * \copydetails Dumux::TwoPOneCModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPOneCModel 2p1c (two-phase, one-component Darcy flow) + * \defgroup TwoPOneCModel 2p1c + * \brief two-phase, one-component Darcy flow * * \copydetails Dumux::TwoPOneCModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPTwoCModels 2p2c (two-phase, two-component Darcy flow) + * \defgroup TwoPTwoCModels 2p2c + * \brief two-phase, two-component Darcy flow */ /*! * \ingroup TwoPTwoCModels @@ -88,67 +88,78 @@ */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPDFMModel 2pdfm (two-phase Darcy flow in discrete fracture-matrix) + * \defgroup TwoPDFMModel 2pdfm + * \brief two-phase Darcy flow in discrete fracture-matrix * * \copydetails Dumux::TwoPDFMModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPMincModel 2pminc (two-phase Darcy flow dual continuum) + * \defgroup TwoPMincModel 2pminc + * \brief two-phase Darcy flow dual continuum * * \copydetails Dumux::TwoPMincModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPNCModel 2pnc (two-phase, n-component Darcy flow) + * \defgroup TwoPNCModel 2pnc + * \brief two-phase, n-component Darcy flow * * \copydetails Dumux::TwoPNCModel */ /*! * \ingroup Porousmediaflow - * \defgroup TwoPNCMinModel 2pncmin (two-phase, n-component Darcy flow with mineralization) + * \defgroup TwoPNCMinModel 2pncmin + * \brief two-phase, n-component Darcy flow with mineralization * * \copydetails Dumux::TwoPNCMinModel */ /*! * \ingroup Porousmediaflow - * \defgroup ThreePModel 3p (three-phase Darcy flow) + * \defgroup ThreePModel 3p + * \brief three-phase Darcy flow * * \copydetails Dumux::ThreePModel */ /*! * \ingroup Porousmediaflow - * \defgroup ThreePThreeCModel 3p3c (three-phase, three-component Darcy flow) + * \defgroup ThreePThreeCModel 3p3c + * \brief three-phase, three-component Darcy flow * * \copydetails Dumux::ThreePThreeCModel */ /*! * \ingroup Porousmediaflow - * \defgroup ThreePWaterOilModel 3pwateroil (three-phase, two-component Darcy flow) + * \defgroup ThreePWaterOilModel 3pwateroil + * \brief three-phase, two-component Darcy flow * * \copydetails Dumux::ThreePWaterOilModel */ /*! * \ingroup Porousmediaflow - * \defgroup CO2Model CO2 (two-phase, two-component Darcy flow) + * \defgroup CO2Model CO2 + * \brief two-phase, two-component Darcy flow * * \copydetails Dumux::CO2Model */ /*! * \ingroup Porousmediaflow - * \defgroup MPNCModel MpNc (m-phase, n-component Darcy flow) + * \defgroup MPNCModel MpNc + * \brief m-phase, n-component Darcy flow * * \copydetails Dumux::MPNCModel */ /*! * \ingroup Porousmediaflow - * \defgroup NIModel Non-isothermal (energy equation, to be added to an isothermal model) + * \defgroup NIModel Non-isothermal + * \brief energy equation, to be added to an isothermal model * * \copydetails Dumux::NIModel */ /*! * \ingroup Porousmediaflow - * \defgroup RichardsModel Richards (Richards flow) + * \defgroup RichardsModel Richards + * \brief Richards flow * * \copydetails Dumux::RichardsModel */ @@ -159,19 +170,22 @@ */ /*! * \ingroup Geomechanics - * \defgroup ElOnePTwoCBoxModel El1p2c (one-phase, two-component Darcy flow, linear elastic deformation model) + * \defgroup ElOnePTwoCBoxModel El1p2c + * \brief one-phase, two-component Darcy flow, linear elastic deformation model * * \copydetails Dumux::ElOnePTwoCModel */ /*! * \ingroup Geomechanics - * \defgroup ElTwoPBoxModel El2p (two-phase Darcy flow, linear elastic deformation model) + * \defgroup ElTwoPBoxModel El2p + * \brief two-phase Darcy flow, linear elastic deformation model * * \copydetails Dumux::ElTwoPModel */ /*! * \ingroup Geomechanics - * \defgroup ElasticBoxModel Elastic (linear elastic deformation model) + * \defgroup ElasticBoxModel Elastic + * \brief linear elastic deformation model * * \copydetails Dumux::ElasticModel */ @@ -182,37 +196,43 @@ */ /*! * \ingroup Freeflow - * \defgroup BoxStokesModel Stokes (one-phase Stokes flow) + * \defgroup BoxStokesModel Stokes + * \brief one-phase Stokes flow * * \copydetails Dumux::StokesModel */ /*! * \ingroup Freeflow - * \defgroup BoxStokesncModel Stokesnc (one-phase, n-component Stokes flow) + * \defgroup BoxStokesncModel Stokesnc + * \brief one-phase, n-component Stokes flow * * \copydetails Dumux::StokesncModel */ /*! * \ingroup Freeflow - * \defgroup BoxStokesncniModel Stokesncni (one-phase, n-component, non-isothermal Stokes flow) + * \defgroup BoxStokesncniModel Stokesncni + * \brief one-phase, n-component, non-isothermal Stokes flow * * \copydetails Dumux::StokesncniModel */ /*! * \ingroup Freeflow - * \defgroup BoxZeroEqModel Zeroeq (one-phase Stokes flow with zero-eq turbulence model) + * \defgroup BoxZeroEqModel Zeroeq + * \brief one-phase Stokes flow with zero-eq turbulence model * * \copydetails Dumux::ZeroEqModel */ /*! * \ingroup Freeflow - * \defgroup BoxZeroEqncModel Zeroeqnc (one-phase, n-component Stokes flow with zero-eq turbulence model) + * \defgroup BoxZeroEqncModel Zeroeqnc + * \brief one-phase, n-component Stokes flow with zero-eq turbulence model * * \copydetails Dumux::ZeroEqncModel */ /*! * \ingroup Freeflow - * \defgroup BoxZeroEqncniModel Zeroeqncni (one-phase, n-component, non-isothermal Stokes flow with zero-eq turbulence model) + * \defgroup BoxZeroEqncniModel Zeroeqncni + * \brief one-phase, n-component, non-isothermal Stokes flow with zero-eq turbulence model * * \copydetails Dumux::ZeroEqncniModel */ @@ -224,10 +244,12 @@ /*! * \ingroup Multidomain * \defgroup MultidomainModel Multidomain + * \brief Multidomain */ /*! * \ingroup Multidomain - * \defgroup TwoPTwoCStokesTwoCModel 2cstokes2p2c (1p2c Stokes flow coupled to 2p2c Darcy flow) + * \defgroup TwoPTwoCStokesTwoCModel 2cstokes2p2c + * \brief 1p2c Stokes flow coupled to 2p2c Darcy flow * * # Coupling Conditions * \copydetails Dumux::TwoCStokesTwoPTwoCLocalOperator @@ -240,7 +262,8 @@ */ /*! * \ingroup Multidomain - * \defgroup TwoPTwoCNIStokesTwoCNIModel 2cnistokes2p2cni (1p2cni Stokes flow coupled to 2p2cni Darcy flow) + * \defgroup TwoPTwoCNIStokesTwoCNIModel 2cnistokes2p2cni + * \brief 1p2cni Stokes flow coupled to 2p2cni Darcy flow * * # Coupling Conditions * \copydetails Dumux::TwoCNIStokesTwoPTwoCNILocalOperator @@ -256,7 +279,8 @@ */ /*! * \ingroup Multidomain - * \defgroup TwoPTwoCZeroEqTwoCModel 2czeroeq2p2c (1p2c Stokes flow with zero-eq turbulence model coupled to 2p2c Darcy flow) + * \defgroup TwoPTwoCZeroEqTwoCModel 2czeroeq2p2c + * \brief 1p2c Stokes flow with zero-eq turbulence model coupled to 2p2c Darcy flow * * # Coupling Conditions * \copydetails Dumux::TwoCStokesTwoPTwoCLocalOperator @@ -269,7 +293,8 @@ */ /*! * \ingroup Multidomain - * \defgroup TwoPTwoCNIZeroEqTwoCNIModel 2cnizeroeq2p2cni (1p2cni Stokes flow with zero-eq turbulence model coupled to 2p2cni Darcy flow) + * \defgroup TwoPTwoCNIZeroEqTwoCNIModel 2cnizeroeq2p2cni + * \brief 1p2cni Stokes flow with zero-eq turbulence model coupled to 2p2cni Darcy flow * * # Coupling Conditions * \copydetails Dumux::TwoCNIStokesTwoPTwoCNILocalOperator @@ -286,70 +311,85 @@ /* ***************** Fully Implicit ******************/ /*! - * \defgroup ImplicitModel Fully-Coupled Fully-Implicit Scheme + * \defgroup ImplicitModel Implicit Scheme + * \brief Fully-Coupled Fully-Implicit Scheme */ /*! * \ingroup ImplicitModel * \defgroup ImplicitBaseProblems Base Problems + * \brief Base Problems */ /*! * \ingroup ImplicitModel * \defgroup Discretizations Discretizations + * \brief Discretizations */ /*! * \ingroup Discretizations - * \defgroup CCModel Fully-implicit cell-centered discretization + * \defgroup CCModel CCModel + * \brief Fully-implicit cell-centered discretization */ /*! * \ingroup Discretizations - * \defgroup BoxModel Fully-implicit box discretization + * \defgroup BoxModel BoxModel + * \brief Fully-implicit box discretization */ /*! * \ingroup ImplicitModel * \defgroup ImplicitBoundaryTypes Boundary Types + * \brief Boundary Types */ /*! * \ingroup ImplicitModel * \defgroup ImplicitFluxVariables Flux Variables + * \brief Flux Variables */ /*! * \ingroup ImplicitModel * \defgroup ImplicitIndices Indices + * \brief Indices */ /*! * \ingroup ImplicitModel * \defgroup ImplicitLocalJacobian Local Jacobian + * \brief Local Jacobian */ /*! * \ingroup ImplicitModel * \defgroup ImplicitLocalResidual Local Residual + * \brief Local Residual */ /*! * \ingroup ImplicitModel * \defgroup ImplicitProperties Properties + * \brief Properties */ /*! * \ingroup ImplicitModel * \defgroup ImplicitVolumeVariables Volume Variables + * \brief Volume Variables */ /* ***************** Sequential ******************/ /*! - * \defgroup Sequential Sequential Scheme (Implicit Pressure, Explicit Transport) + * \defgroup Sequential Sequential Scheme + * \brief Implicit Pressure, Explicit Transport */ /*! * \ingroup Sequential - * \defgroup IMPETproblems Base Problems + * \defgroup IMPETproblems Base problems + * \brief Base Problems */ /*! * \ingroup Sequential * \defgroup IMPETProperties Properties + * \brief Properties */ /* ***************** Material ******************/ /*! * \defgroup Material Material and Fluid Framework - * Short description of the most important concepts of the material and fluid framework: + * \brief Short description of the most important concepts of the material and fluid framework: * * - __Binary coefficient:__ @copydoc Binarycoefficients * @@ -380,8 +420,10 @@ /*! * \ingroup Material * \defgroup Binarycoefficients Binary Coefficients - * Binary coefficients describe the relations - * of a mixture of two components. Typical binary coefficients are + * \brief Binary coefficients describe the relations + * of a mixture of two components. + * + * Typical binary coefficients are * Henry coefficients or binary molecular diffusion * coefficients. So far, the programming interface for accessing binary * coefficients has not been standardized in Dumux. @@ -389,9 +431,11 @@ /*! * \ingroup Material * \defgroup Components Components - * Components are fluid systems which provide the + * \brief Components are fluid systems which provide the * thermodynamic relations for the liquid and gas phase of a single - * chemical species or a fixed mixture of species. Their main purpose + * chemical species or a fixed mixture of species. + * + * Their main purpose * is to provide a convenient way to access these quantities from * full-fledged fluid systems. Components are not supposed to be used * by models directly. @@ -399,13 +443,16 @@ /*! * \ingroup Components * \defgroup IAPWS IAPWS + * \brief Properties of water and steam, see \cite IAPWS1997 */ /*! * \ingroup Material * \defgroup ConstraintSolver Constraint Solver - * Constraint solvers are auxiliary tools to + * \brief Constraint solvers are auxiliary tools to * make sure that a fluid state is consistent with some thermodynamic - * constraints. All constraint solvers specify a well defined set of + * constraints. + * + * All constraint solvers specify a well defined set of * input variables and make sure that the resulting fluid state is * consistent with a given set of thermodynamic equations. * Constraint solvers connect the thermodynamic relations expressed by @@ -416,20 +463,25 @@ */ /*! * \ingroup Material - * \defgroup EOS Equation of State + * \defgroup EOS Equations of State + * \brief Equation of State * - * Equations of state (EOS) are auxiliary + * \brief Equations of state (EOS) are auxiliary * classes which provide relations between a fluid phase's temperature, - * pressure, composition and density. Since these classes are only used + * pressure, composition and density. + * + * Since these classes are only used * internally in fluid systems, their programming interface is * currently ad-hoc. */ /*! * \ingroup Material * \defgroup FluidStates Fluid States - * Fluid states are responsible for representing the + * \brief Fluid states are responsible for representing the * complete thermodynamic configuration of a system at a given spatial - * and temporal position. A fluid state always provides access methods + * and temporal position. + * + * A fluid state always provides access methods * to __all__ thermodynamic quantities, but the concept of a fluid state does not * mandate what assumptions are made to store these thermodynamic * quantities. What fluid states also do __not__ do is to make sure @@ -439,9 +491,11 @@ /*! * \ingroup Material * \defgroup Fluidsystems Fluid Systems - * Fluid systems express the thermodynamic relations + * \brief Fluid systems express the thermodynamic relations. * Strictly speaking, these relations are - * functions, mathematically.} between quantities. Since functions do + * functions, dealing mathematically between quantities. + * + * Since functions do * not exhibit any internal state, fluid systems are stateless classes, * i.e. all member functions are static. This is a conscious * decision since the thermodynamic state of the system is expressed by @@ -450,30 +504,35 @@ /*! * \ingroup Material * \defgroup fluidmatrixinteractions Fluid-Matrix Interactions - * Some parameters are functions of the fluid state as well as parameters of - * the matrix. For example the capillary pressure is a function of the phase saturation + * \brief Some parameters are functions of the fluid state as well as parameters of + * the matrix. + * + * For example the capillary pressure is a function of the phase saturation * and the shape parameter \f$\lambda\f$ which is dependent on the material. All such relations * are gathered in this module. */ /*! * \ingroup fluidmatrixinteractions * \defgroup fluidmatrixinteractionslaws Laws for Fluid-Matrix Interactions + * \brief Laws for Fluid-Matrix Interactions */ /*! * \ingroup fluidmatrixinteractions * \defgroup fluidmatrixinteractionsparams Parameters for Fluid-Matrix Interactions + * \brief Parameters for Fluid-Matrix Interactions */ /*! * \ingroup Material * \defgroup ParameterCache Parameter Cache - * Fluid systems sometimes require + * \brief Fluid systems sometimes require * computationally expensive parameters for multiple relations. Such * parameters can be cached using a so-called parameter - * cache. Parameter cache objects are specific for each fluid system + * cache. + * + * Parameter cache objects are specific for each fluid system * but they must provide a common interface to update the internal * parameters depending on the quantities which changed since the last - * update. - * All fluid systems must export a type for their __ParameterCache__ + * update. All fluid systems must export a type for their __ParameterCache__ * objects. Parameter caches can be used to cache parameter that are * expensive to compute and are required in multiple thermodynamic * relations. For fluid systems which do need to cache parameters, @@ -486,7 +545,7 @@ * Note, that the parameter cache interface only guarantees that if a * more specialized update() method is called, it is not slower * than the next more-general method (e.g. calling updateSingleMoleFraction() - * may be as expensive as updateAll()}. It is thus advisable to + * may be as expensive as updateAll(). It is thus advisable to * rather use a more general update() method once than multiple * calls to specialized update() methods. * To make usage of parameter caches easier for the case where all cached @@ -497,9 +556,11 @@ /*! * \ingroup Material * \defgroup SpatialParameters Spatial Parameters - * All parameters which depend on the matrix and + * \brief All parameters which depend on the matrix and * therefore on the position within the model domain are defined as spatial - * parameters. For example permeability, porosity etc. + * parameters. + * + * For example permeability, porosity etc. * */ @@ -510,45 +571,55 @@ /*! * \ingroup Common * \defgroup BC Boundary Conditions + * \brief Boundary Conditions */ /*! * \ingroup Common * \defgroup Math Elementary Math Functions + * \brief Elementary Math Functions */ /*! * \ingroup Common * \defgroup Exception Exceptions + * \brief Exceptions */ /*! * \ingroup Common * \defgroup Linear Linear Solver Backends + * \brief Linear Solver Backends */ /*! * \ingroup Common * \defgroup Newton Newton Solver + * \brief Newton Solver */ /*! * \ingroup Common * \defgroup Parameter Parameters - * See the file parameterlist for available parameters. + * \brief See the \ref parameterList for available parameters. */ /*! * \ingroup Common * \defgroup Properties Property System + * \brief Property System */ /*! * \ingroup Common * \defgroup Spline Splines + * \brief Splines */ /*! * \ingroup Common * \defgroup Start Starting the Simulation + * \brief Starting the Simulation */ /*! * \ingroup Common * \defgroup SimControl Time Manager + * \brief Time Manager */ /*! * \ingroup Common * \defgroup Valgrind Valgrind + * \brief Valgrind */ diff --git a/doc/doxygen/sanitizelinks.sh b/doc/doxygen/sanitizelinks.sh index f23c1417bd50ac515cbdf71db756eda02913c623..bd1d9ef8e304f67c389b2ef7dc622fb1c452e7ba 100755 --- a/doc/doxygen/sanitizelinks.sh +++ b/doc/doxygen/sanitizelinks.sh @@ -3,10 +3,16 @@ sanitizelinks () { NEW_FILE=`grep -l "\"title\">$1" html/*html | egrep -o [0-9]+` OLD_FILE=`awk -v a=$NEW_FILE 'BEGIN {printf("%05d", a-1)}'` - sed -i "s/$OLD_FILE/$NEW_FILE/g" html/*html +# echo $1: $OLD_FILE $NEW_FILE + if [ $OLD_FILE -gt 0 ]; then + sed -i "s#$OLD_FILE#$NEW_FILE#g" html/a*html + sed -i "s# $1 # $1 #g" html/index.html + sed -i "s# $1,# $1,#g" html/index.html + fi } -sanitizelinks "Todo List" +sanitizelinks "Deprecated List" # has to be called before Todo List +sanitizelinks "Todo List" # has to be called before Warning List +sanitizelinks "Warning List" sanitizelinks "Bug List" -sanitizelinks "Deprecated List" sanitizelinks "Bibliography" diff --git a/doc/handbook/0_dumux-handbook.tex b/doc/handbook/0_dumux-handbook.tex index 2a942326544ae93992954917166de085865346de..cac88ce86d211841b298492669cc3a29b6cb7284 100644 --- a/doc/handbook/0_dumux-handbook.tex +++ b/doc/handbook/0_dumux-handbook.tex @@ -13,6 +13,7 @@ \usepackage{graphicx} \usepackage{listings} \usepackage{makeidx} +\usepackage[square,numbers]{natbib} \usepackage{pdflscape} \usepackage{rotating} \usepackage{subfig} @@ -39,7 +40,7 @@ % Dune and Dumux logo \newcommand{\Dune}{{DUNE}\xspace} \newcommand{\Dumux}{\texorpdfstring{Du\-Mu$^\text{x}$\xspace}{DuMuX\xspace}} -\newcommand{\DumuxVersion}{2.10} +\newcommand{\DumuxVersion}{2.11} \definecolor{dumuxYellow}{HTML}{E19417} \definecolor{dumuxBlue}{HTML}{0C73CF} @@ -142,10 +143,9 @@ in deeper modifications of underlying \Dumux models, classes, functions, etc. \input{5_spatialdiscretizations} \input{5_stepsofasimulation} \input{5_propertysystem} -\input{5_fluidframework} \input{5_grids} -\bibliographystyle{plain} +\bibliographystyle{plainnat} \bibliography{dumux-handbook} \printindex \end{document} diff --git a/doc/handbook/1_introduction.tex b/doc/handbook/1_introduction.tex index 5ef762f3fdfc0e5102dad6b710358b85bf64b492..526f021c8ae803a42309073bac542d5bdbc8626e 100644 --- a/doc/handbook/1_introduction.tex +++ b/doc/handbook/1_introduction.tex @@ -18,7 +18,7 @@ for all possible cases, so \Dumux is build on top of \Dune, the \textbf{D}istributed and \textbf{U}nified \textbf{N}umerics \textbf{E}nvironment~\cite{DUNE-HP}. \Dune provides a generic interface to many existing grid management libraries such as UG~\cite{UG-HP}, -ALUGrid~\cite{ALUGRID-HP} and a few more. +ALUGrid~\cite{ALUGRID-HP,alugrid2016} and a few more. DUNE also extensively uses template programming in order to achieve minimal overhead when accessing the underlying grid libraries\footnote{In fact, the performance penalty resulting from the diff --git a/doc/handbook/2_detailedinstall.tex b/doc/handbook/2_detailedinstall.tex index 625f4e563bf5923396deef8c293cacc75d5d77b2..4b601b736b8d8cdbd6ceadaa294e0e7b9daf45f1 100644 --- a/doc/handbook/2_detailedinstall.tex +++ b/doc/handbook/2_detailedinstall.tex @@ -14,9 +14,10 @@ Please check in said paragraph whether you can fulfill them. In addition, sectio In a technical sense \Dumux is a module of \Dune. Thus, the installation procedure of \Dumux is the same as that of \Dune. -Details regarding the installation of \Dune are provided on the \Dune website \cite{DUNE-INST}. +Details regarding the installation of \Dune are provided on the \Dune website \cite{DUNE-HP}. If you are interested in more details about the build system that is used, -they can be found in the {\Dune} CMake FAQs \cite{DUNE-CMAKE} and CMake's documentation \cite{CMAKE-DOC}. +they can be found in the \Dune buildsystem documentation\footnote{\url{https://www.dune-project.org/buildsystem/}} and +CMake's documentation\footnote{\url{https://cmake.org/documentation/}}. All \Dune modules, including \Dumux, get extracted into a common directory, as it is done in an ordinary \Dune installation. @@ -122,7 +123,7 @@ Then, enter the previously created directory and check out the desired modules. As you see below, the check-out uses two different servers for getting the sources, one for \Dune and one for \Dumux. The \Dune modules of the stable 2.4 release branch are checked out as described -on the \Dune website \cite{DUNE-DOWNLOAD-GIT}: +on the \Dune website \cite{DUNE-HP}: \begin{lstlisting}[style=Bash] $ mkdir DUNE-ROOT @@ -137,13 +138,14 @@ $ git clone -b releases/2.0 https://gitlab.dune-project.org/PDELab/dune-pdelab.g \end{lstlisting} The newest and maybe unstable developments are also provided in these repositories and can be found in the \emph{master} branch. -Please check the \Dune website \cite{DUNE-DOWNLOAD-GIT} for further information. We always try to keep up with the latest developments of \Dune. +Please check the \Dune website \cite{DUNE-HP} for further information. We always try to keep up with the latest developments of \Dune. However, the current \Dumux release is based on the stable 2.4 release and it might not compile without further adaptations using the newest versions of \Dune. Furthermore, if you wish to install the optional \Dune Grid-Howto which provides a tutorial on the Dune grid interface, act similar. -The \texttt{dumux} module is checked out as described below (see also the \Dumux website \cite{DUMUX-HP}). +The \texttt{dumux} module is checked out as described below (see also the \Dumux website: +\url{http://www.dumux.org/}). Its file tree has to be created in the \Dune-Root directory, where the \Dune modules have also been checked out to. Subsequently, the next command is executed there, too. The dumux root directory is called \texttt{dumux} here. @@ -198,7 +200,7 @@ This enhances \texttt{dumux} by providing maybe unstable code from the developer Doxygen documentation is done by especially formatted comments integrated in the source code, which can get extracted by the program \texttt{doxygen}. Beside extracting these comments, \texttt{doxygen} builds up a web-browsable code structure documentation -like class hierarchy of code displayed as graphs, see \cite{DOXYGEN-HP}. +like class hierarchy of code displayed as graphs, see \url{http://www.stack.nl/~dimitri/doxygen/}. The Doxygen documentation of a module can be built, if \texttt{doxygen} is installed, by running \texttt{dunecontrol}, entering the \texttt{build-*}directory, and execute @@ -208,13 +210,16 @@ This should also work for other \Dune modules. \subsubsection{Handbook} To build the \Dumux handbook go into the \texttt{build-}directory and -run \texttt{make doc} or \texttt{make dumux-handbook\_pdf}. The pdf can then be found -in \texttt{MODULE\_BUILD\_DIRECTORY/doc/handbook/dumux-handbook.pdf}. +run \texttt{make doc} or \texttt{make 0\_dumux-handbook\_pdf}. The pdf can then be found +in \texttt{MODULE\_BUILD\_DIRECTORY/doc/handbook/0\_dumux-handbook.pdf}. \subsection{External Libraries and Modules} \label{sec:external-modules-libraries} The libraries described below provide additional functionality but are not generally required to run \Dumux. -If you are going to use an external library check the information provided on the \Dune website \cite{DUNE-EXT-LIB}. -If you are going to use an external \Dune module the website on external modules \cite{DUNE-EXT-MOD} can be helpful. +If you are going to use an external library check the information provided on the \Dune website% +\footnote{DUNE: External libraries, \url{https://www.dune-project.org/doc/external-libraries/}}. +If you are going to use an external \Dune module the website on external modules% +\footnote{DUNE: External modules, \url{https://www.dune-project.org/groups/external/}} +can be helpful. Installing an external library can require additional libraries which are also used by \Dune. For some libraries, such as BLAS or MPI, multiple versions can be installed on the system. @@ -236,40 +241,40 @@ and some more libraries and tools which are prerequisites for their use. \begin{itemize} \item \textbf{dune-ALUGrid}: Grid library, comes as a \Dune module. - The parallel version needs also a graph partitioner, such as \texttt{ParMETIS}. - Download: \texttt{\url{https://gitlab.dune-project.org/extensions/dune-alugrid}} + The parallel version needs also a graph partitioner, such as {ParMETIS}. + Download: \url{https://gitlab.dune-project.org/extensions/dune-alugrid} \item \textbf{dune-foamgrid}: External grid module. One- and two-dimensional grids in a physical space of arbitrary dimension; non-manifold grids, growth, element paramterizations, and movable vertices. This makes FoamGrid the grid data structure of choice for simulating structures such as foams, discrete fracture networks, or network flow problems. - Download: \texttt{\url{https://gitlab.dune-project.org/extensions/dune-foamgrid}} + Download: \url{https://gitlab.dune-project.org/extensions/dune-foamgrid} \item \textbf{\Dune-multidomaingrid} and \textbf{\Dune-multidomain}: External modules which offer a meta grid that has different sub-domains. Each sub-domain can have a local operator that is coupled by a coupling condition. They are used for multi-physics approaches or domain decomposition methods. Download: - \texttt{\url{https://github.com/smuething/dune-multidomaingrid}} - and \texttt{\url{https://github.com/smuething/dune-multidomain}} + \url{https://github.com/smuething/dune-multidomaingrid} + and \url{https://github.com/smuething/dune-multidomain} \item \textbf{\Dune-PDELab}: External module to write more easily discretizations. PDELab provides a sound number of discretizations like FEM or discontinuous Galerkin methods. - Download: \texttt{\url{http://www.dune-project.org/pdelab}} + Download: \url{https://gitlab.dune-project.org/pdelab/dune-pdelab} \item \textbf{PARDISO}: External library for solving linear equations. The package PARDISO is a thread-safe, high-performance, robust, memory efficient and easy to use software for solving large sparse symmetric and asymmetric linear systems of equations on shared memory multiprocessors. The precompiled binary - can be downloaded after personal registration from the PARDISO website: \texttt{\url{http://www.pardiso-project.org}} + can be downloaded after personal registration from the PARDISO website: \url{http://www.pardiso-project.org} \item \textbf{SuperLU}: External library for solving linear equations. SuperLU is a general purpose library for the direct solution of large, sparse, non-symmetric systems of linear equations. - Download: \texttt{\url{http://crd.lbl.gov/~xiaoye/SuperLU}} + Download: \url{http://crd.lbl.gov/~xiaoye/SuperLU} \item \textbf{UMFPack}: External library for solving linear equeations. It is part of SuiteSparse. \item \textbf{UG}: External library for use as grid. UG is a toolbox for unstructured grids, released under GPL. To build UG the tools \texttt{lex}/\texttt{yacc} or the GNU variants of \texttt{flex}/\texttt{bison} must be provided. - Download: \texttt{\url{http://www.iwr.uni-heidelberg.de/frame/iwrwikiequipment/software/ug}} + Download: \url{https://gitlab.dune-project.org/staging/dune-uggrid} \end{itemize} The following are dependencies of some of the used libraries. You will need them @@ -289,4 +294,4 @@ depending on which modules of \Dune and which external libraries you use. \item \textbf{Compilers}: Beside \texttt{g++}, \Dune can be built with Clang from the LLVM project and Intel \Cplusplus compiler. C and Fortran compilers are needed for some external libraries. As code of different compilers is linked together they have to be be compatible with each other. -\end{itemize} \ No newline at end of file +\end{itemize} diff --git a/doc/handbook/2_quickinstall.tex b/doc/handbook/2_quickinstall.tex index 7a0b681fa0d2e97516ed7bfc728485a59a6143b4..ec0a7d25fbe40d9f0217017dbe48bcb592d14b06 100644 --- a/doc/handbook/2_quickinstall.tex +++ b/doc/handbook/2_quickinstall.tex @@ -11,7 +11,7 @@ instructions in Section \ref{install}. The shell-script \texttt{checkout-dumux} facilitates setting up a {\Dune}/{\Dumux} directory tree. -It is available after obtaining a download link, but not directly from the \texttt{dumux} website \cite{DUMUX-DOWNLOAD}. +It is available after obtaining a download link via \url{http://www.dumux.org/download/}. For example the second line below will check out the required \Dune modules and \texttt{dumux}, \texttt{dumux-devel} and the \texttt{external} folder, which contains some useful external software and libraries. Again, \texttt{joeuser} needs to be replaced by the actual user name. @@ -24,19 +24,20 @@ Be aware that you cannot get \texttt{dumux-devel} or the external libraries from you have an GitLab account with the right privileges. If you want to install \Dune and \Dumux without the help of \texttt{checkout-dumux} script a complete installation -guide can be found in chapter \ref{install} or on the \Dune website \cite{DUNE-INST}. +guide can be found in chapter \ref{install}. \subsection{Build of \Dune and \Dumux} \label{buildIt} -Building of \Dune and \Dumux is done by the command-line script \texttt{dunecontrol} as described in \Dune Installation Notes \cite{DUNE-INST}. -More details about the build-system can be found in the \Dune CMake FAQs \cite{DUNE-CMAKE}. +Building of \Dune and \Dumux is done by the command-line script \texttt{dunecontrol} as described in +\Dune Installation Notes\footnote{\url{https://www.dune-project.org/doc/installation/}}. +More details about the build-system can be found in the \Dune buildsystem documentation\footnote{\url{https://www.dune-project.org/buildsystem/}}. If something fails during the execution of \texttt{dunecontrol} feel free to report it to the \Dune or \Dumux developer mailing list, but also try to include error details. It is possible to compile \Dumux with nearly no explicit options to the build system. -However, for the successful compilation of \Dune and \Dumux, it is currently necessary to pass the -the option \texttt{-fno-strict-aliasing} to the \Cplusplus compiler -\cite{WIKIPED-ALIASING}, which is done here via a command-line argument to \texttt{dunecontrol}: +However, for the successful compilation of \Dune and \Dumux, it is currently necessary to pass +the option \texttt{-fno-strict-aliasing} to the \Cplusplus compiler, +which is done here via a command-line argument to \texttt{dunecontrol}: \begin{lstlisting}[style=Bash] $ # make sure you are in the directory DUNE-Root $ ./dune-common/bin/dunecontrol --configure-opts="CXXFLAGS=-fno-strict-aliasing" --use-cmake all diff --git a/doc/handbook/3_tutorialimplicit.tex b/doc/handbook/3_tutorialimplicit.tex index 03196ac4ae8240516f2f98ee1ee18dafc29e396c..f908bceec97881751f9a8f23ec3efc04ada86a40 100644 --- a/doc/handbook/3_tutorialimplicit.tex +++ b/doc/handbook/3_tutorialimplicit.tex @@ -146,7 +146,7 @@ two-phase model uses the \texttt{TwoPImmiscibleFluidSystem}, which assumes immiscibility of the phases, but requires the components used for the wetting and non-wetting phases to be explicitly set. In this case, liquid water which uses the relations from -IAPWS'97~\cite{IAPWS1997} is chosen as the wetting phase on line +IAPWS'97~\cite{IAPWS-HP} is chosen as the wetting phase on line \ref{tutorial-implicit:wettingPhase} and liquid oil is chosen as the non-wetting phase on line \ref{tutorial-implicit:nonwettingPhase}. The last property, which is set in line \ref{tutorial-implicit:gravity}, @@ -248,7 +248,7 @@ of mixtures such as density or enthalpy are of interest. These interactions are defined by {\em fluid systems}, which are located in \verb+dumux/material/fluidsystems+. A more thorough overview of the \Dumux fluid framework can be found -at \url{http://www.dumux.org/doxygen-stable/html-2.10/modules.php} +at \url{http://www.dumux.org/doxygen-stable/html-\DumuxVersion/modules.php} %in chapter~\ref{sec:fluidframework}. % In this example, a class for the definition of a two-phase system is used. This allows for the choice @@ -412,7 +412,7 @@ To do that, you have to select different components via the property system in t If you want to take a closer look on how the fluid classes are defined and which substances are already available please browse through the files in the directory \texttt{/dumux/material/components} and read -the doxygen documentation \url{http://www.dumux.org/doxygen-stable/html-2.10/modules.php}. +the doxygen documentation \url{http://www.dumux.org/doxygen-stable/html-\DumuxVersion/modules.php}. %chapter~\ref{sec:fluidframework}. \item \textbf{Use a Full-Fledged Fluid System} \\ diff --git a/doc/handbook/4_developingdumux.tex b/doc/handbook/4_developingdumux.tex index 4232a69197b32c34f597e081fbbf64afe4ff1c7a..e5c02ee1cbc6174a20b4d876f7b8d02aed99365b 100644 --- a/doc/handbook/4_developingdumux.tex +++ b/doc/handbook/4_developingdumux.tex @@ -3,19 +3,20 @@ \subsection{Communicate with \Dumux Developers} -\paragraph{GitLab Issues} -The bug-tracking system \emph{GitLab Issues} offers the possibility to report bugs or -discuss new development requests. Feel free to register (if you don't have a \emph{Git} account alreay) and to constribute +\paragraph{Issues and Bug Tracking} +The bug-tracking system \emph{GitLab Issues} offers the possibility to report bugs or discuss new development requests. +Feel free to register (if you don't have a \emph{Git} account already) and to constribute at \url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/issues}. -\paragraph{Flyspray} -The bug-tracking system \emph{Flyspray} has been replaced by \emph{GitLab Issues} and will not -be used anymore. +\paragraph{Commits, Merges, etc.} +To be up-to-date with the latest changes made to any git-repository you can use RSS Feeds. +Simply click on \emph{Issues} or \emph{Activity} and then select a tab you are interested in +and use your favorite RSS-application for receiving the news. \paragraph{Automatic Testing Dashboard} The automatic testing using \emph{BuildBot} helps to constantly check the \Dumux problems for compiling and running correctly. It is available at -\url{http://www.dumux.org/dashboard.php}. +\url{https://git.iws.uni-stuttgart.de/buildbot/#/builders}. \paragraph{The General Mailing List:} If you have questions, specific problems (which you really struggle to solve on your own), @@ -24,11 +25,6 @@ You can subscribe to the mailing list via \url{https://listserv.uni-stuttgart.de/mailman/listinfo/dumux}, then you will be informed about upcoming releases or events. -\paragraph{The Commit Mailing List:} -If you want to be informed about \Dumux-commits you can subscribe to the mailing list: -\url{https://listserv.uni-stuttgart.de/mailman/listinfo/dumux-commits}. - - \subsection{Tips and Tricks} \Dumux users and developers at the LH2 are also referred to the internal Wiki for more information. @@ -98,10 +94,10 @@ Dune::dinfo << "message"; // will NOT be printed \end{lstlisting} \paragraph{Make headercheck:} -To check one header file for all necessary includes to compile the contained -code, use \texttt{make headercheck}. Go to the top level in your build-directory -and type \texttt{make headercheck} to check all headers or press 'tab' to use the -auto-completion to search for a specific header. +To check one header file for all necessary includes to compile the contained code, use \texttt{make headercheck}. +Include the option \texttt{-DENABLE\_HEADERCHECK=1} in your opts file and run \texttt{dunecontrol}. +Then go to the top level in your build-directory and type \texttt{make headercheck} to check all headers +or press 'tab' to use the auto-completion to search for a specific header. \paragraph{Naming conventions} General guidelines for naming conventions are specified in Section \ref{sc_guidelines}. diff --git a/doc/handbook/4_guidelines.tex b/doc/handbook/4_guidelines.tex index a710f08549a01cf79d5cf35caa513972b3520525..76573f90339936fb324f98791f1df90df26bb1bc 100644 --- a/doc/handbook/4_guidelines.tex +++ b/doc/handbook/4_guidelines.tex @@ -3,8 +3,8 @@ Writing code in a readable manner is very important, especially for future code developers (e.g. for adding features, debugging, etc.). This section is inspired by the DUNE coding guidelines -\url{http://www.dune-project.org/doc/devel/codingstyle.html}, which is strongly -recommended. +% this site is currently down (27.02.2017), hope it will be online soon again +\url{http://www.dune-project.org/doc/devel/codingstyle.html}, which is strongly recommended. \paragraph{Documentation:} Please document freely what each part of your code does. All comments/ documentation diff --git a/doc/handbook/4_structure.tex b/doc/handbook/4_structure.tex index d685f33b095b25db4dc1a47cfa17b98b9df9ee8b..66d97a6c83b610a53490f2e7461b9e3385dfe1d5 100644 --- a/doc/handbook/4_structure.tex +++ b/doc/handbook/4_structure.tex @@ -3,65 +3,18 @@ \Dumux has the following folder structure, which is similar to other \Dune modules. \begin{itemize} -\item \texttt{bin}: contains binaries, e.g. used for the automatic testing +\item \texttt{bin}: binaries, e.g. used for the automatic testing, postprocessing, installation \item \texttt{cmake}: the configuration options for building \Dumux -\item \texttt{doc}: contains the Doxygen documentation (\texttt{doc/doxygen/html/index.html}), - this handbook, and various logos +\item \texttt{doc}: files necessary for the Doxygen documentation and this handbook, and various logos \item \texttt{dumux}: the main folder, containing the source files, see \ref{fig:dumux-structure} for a visualized structure. For more information on the models have a look at the Doxygen documentation. - \begin{itemize} - \item \texttt{common}: general methods shared by all models, - like the \texttt{start.hh} or the time manager - - \item \texttt{freeflow}: single-phase free-flow models. All models are discretized - fully implicitly using the box-method. - - \item \texttt{geomechanics}: models for solving rock mechanics and flow. - - \item \texttt{implicit}: contains the general methods shared - by all implicit models, together with specilized methods - for the two discretization types \texttt{box} and \texttt{cellcentered}. - The \texttt{adaptive} folder contains methods for grid adaption. - The specialized model files can be found - at \texttt{porousmediumflow/model of interest/implicit/}, - \texttt{freeflow/model of interest/}, or \texttt{geomechanics/model of interest/}. - - \item \texttt{io}: additional in-/output possibilities like restart files, - gnuplot-interface and a VTKWriter. - - \item \texttt{linear}: contains linear solver backends. - - \item \texttt{material}: all material parameters and constitutive equations. - Properties of a pure chemical (pseudo)substance (e.g. water, air) are located - in \texttt{components}. The fluidsystems collect information from the \texttt{components} and - \texttt{binarycoefficients} (like Henry coefficients), and combines them with fluid phase characteristics - (e.g. viscosity, density). - The folder \texttt{spatialparams} contains all spatially dependend variables, like permeability and porosity. - The class in \texttt{implicitspatialparameters.hh} provides spatial averaging routines. - Constitutive relations are found in \texttt{fluidmatrixinteractions}. - - \item \texttt{multidomain}: coupling handling and coupling conditions for connecting - different model types in different subdomains. - - \item \texttt{nonlinear}: Newton's method. - - \item \texttt{parallel}: helper files for parallel simulations. - - \item \texttt{porousmediumflow}: contains all models for porous media setups. - - \item \texttt{sequential}: contains the general methods shared - by all sequential models. The specialized model files can be found - at \texttt{porousmediumflow/model of interest/sequential/}. -\end{itemize} - \item \texttt{test}: tests for each numerical model and some functionality. The structure is equivalent to the dumux folder, the \texttt{references} folder contains solutions for the automatic testing. Each test program consist of source - \texttt{*.cc}, the problem definition \texttt{*problem.hh}, the definition of the spatially dependent - parameters \texttt{*spatialparameters.hh} and an input file \texttt{*.input}. + \texttt{*.cc}, the problem definition \texttt{*problem.hh}, and an input file \texttt{*.input}. + If necessary, spatially dependent parameters are defined in \texttt{*spatialparameters.hh}. For more detailed descriptions of the tests, please have a look at the Doxygen documentation. - \item \texttt{tutorial}: contains the tutorials described in Chapter \ref{chp:tutorial}. \end{itemize} @@ -102,27 +55,30 @@ [.\node[draw=dumuxYellow, ultra thick] {dumux}; [.\node[FirstLevel] {common}; \node[ThirdLevel] { - Common files of the implicit (box and cell centered) models and the - sequential models: time integration, start routine, the property - system, ...}; + Common files of the implicit and the sequential models: + time integration, start routine \texttt{start.hh}, the property system, ...}; ] [.\node[FirstLevel] {freeflow}; [.\node[SecondLevel] {\emph{models}}; - \node[ThirdLevel] {Specific model definition for free flow problems using the (Navier-) Stokes - and algebraic turbulence models.}; + \node[ThirdLevel] {Single-phase free flow models using Navier-Stokes + and algebraic turbulence models. + All models are discretized with the box-method.}; ] ] [.\node[FirstLevel] {geomechanics}; [.\node[SecondLevel] {\emph{models}}; - \node[ThirdLevel] {Specific model definition for coupled flow and geomechnics simulations.}; + \node[ThirdLevel] {Specific model files for coupling flow and rock mechanisms.}; ] ] [.\node[FirstLevel] {implicit}; % [.\node[SecondLevel] {\emph{models}}; \node[ThirdLevel] {Common functionality of cell centered and box formulation: - assembling in implicitlocaljacobian.hh, evaluation of partial derivative - in implicitlocalresidual.hh, base classes for model and problem definition.}; + assembling in localjacobian.hh, evaluation of partial derivative + in localresidual.hh, base classes for model and problem definition.}; % ] + [.\node[SecondLevel] {adaptive}; + \node[ThirdLevel] {Contains the methods for grid adaption.}; + ] [.\node[SecondLevel] {box}; \node[ThirdLevel] {Specific files for the gerenal fully implicit boxmethod: assembler, dual mesh geometry in fvelementgeometry.hh, @@ -133,10 +89,13 @@ mesh geometry in fvelementgeometry.hh, base classes for model and problem definition.}; ] + [.\node[SecondLevel] {cornerpoint}; + \node[ThirdLevel] {Files need for handling cornerpoint grids.}; + ] ] [.\node[FirstLevel] {io}; - \node[ThirdLevel] {Additional in-/output possibilities like restart files, gnuplot-interface - and a VTKWriter extension. Grid Creator files.}; + \node[ThirdLevel] {Additional in-/output possibilities like restart files, gnuplot-interface, + VTKWriter extensions and files for grid generation.}; ] [.\node[FirstLevel] {linear}; \node[ThirdLevel] {Linear solver backend.}; @@ -146,13 +105,15 @@ \node[ThirdLevel] {Binary coefficients (like binary diffusion coefficients) and those needed for the constitutive relationships (e.g. Henry coefficient)}; ] + [.\node[SecondLevel] {chemistry}; + \node[ThirdLevel] {Files needed to account for, e.g. electrochemical processes as in a fuel cell.}; + ] [.\node[SecondLevel] {components}; \node[ThirdLevel] {Properties of a pure chemical substance (e.g. water) or pseudo substance (e.g. air).}; ] [.\node[SecondLevel] {constraintsolvers}; - \node[ThirdLevel] {Constraint solvers specify a well defined set of input variables - and make sure that the resulting fluid state is consistent with a + \node[ThirdLevel] {Constraint solvers to make sure that the resulting fluid state is consistent with a given set of thermodynamic equations.}; ] [.\node[SecondLevel] {eos}; @@ -161,16 +122,16 @@ and density.}; ] [.\node[SecondLevel] {fluidmatrixint.}; - \node[ThirdLevel] {Constitutive relationships (e.g. capillary pressure - saturation - curve}; + \node[ThirdLevel] {Constitutive relationships (e.g. capillary pressures, relative permeabilities}; ] [.\node[SecondLevel] {fluidstates}; - \node[ThirdLevel] {Fluid states are responsible for representing the complete thermodynamic + \node[ThirdLevel] {Fluid states are responsible for caching the thermodynamic configuration of a system at a given spatial and temporal position.}; ] [.\node[SecondLevel] {fluidsystems}; \node[ThirdLevel] {Fluid systems express the thermodynamic relations between quantities.}; ] - [.\node[SecondLevel] {spatialparameters}; + [.\node[SecondLevel] {spatialparams}; \node[ThirdLevel] {Base class for all spatially dependent variables, like permeability and porosity. Includes spatial averaging routines. All other properties are specified in the specific files of the respective models.}; @@ -178,8 +139,8 @@ ] [.\node[FirstLevel] {multidomain}; [.\node[SecondLevel] {\emph{models}}; - \node[ThirdLevel] {Localoperators, which implement the correct coupling and - communication between the submodels, and model specific properties.}; + \node[ThirdLevel] {Localoperators, which implement the coupling and communication + between models in different subdomains, and model specific properties.}; ] [.\node[SecondLevel] {common}; \node[ThirdLevel] {The multidomain wrappers, generic functions, and properties.}; @@ -192,22 +153,16 @@ \node[ThirdLevel] {Newton's method.}; ] [.\node[FirstLevel] {parallel}; - \node[ThirdLevel] {Files for parallel programming.}; - ] + \node[ThirdLevel] {Helper files for parallel simulations.}; + ] [.\node[FirstLevel] {porousmediumflow}; [.\node[SecondLevel] {\emph{models}}; \node[ThirdLevel] {Specific model definition for porous medium flow simulations, - in both \emph{implicit} or \emph{sequential} formulation: + in both \texttt{implicit} or \texttt{sequential} formulation: implementation of equations, model specific properties and indices.}; ] ] - [.\node[FirstLevel] {sequential}; -% [.\node[SecondLevel] {\emph{models}}; - \node[ThirdLevel] { - General model definitions for the sequential formulation.}; -% ] - ] ] \end{tikzpicture} \caption{Structure of the directory \texttt{dumux} containing the \Dumux source files.} diff --git a/doc/handbook/5_fluidframework.tex b/doc/handbook/5_fluidframework.tex deleted file mode 100644 index 2a242f22e897168c4e747205508f4502069a6c67..0000000000000000000000000000000000000000 --- a/doc/handbook/5_fluidframework.tex +++ /dev/null @@ -1,6 +0,0 @@ -\section{Material and Fluid Framework} -\label{sec:fluidframework} - -Detailed explanations for the \Dumux material and fluid framework can be found in the Doxygen documentation via \texttt{Modules -> Material and Fluid Framework}. - - diff --git a/doc/handbook/5_grids.tex b/doc/handbook/5_grids.tex index 9e4fd4161ab22cc546318cd4e9371b34b8b659ed..8ba3270638bd34c80a78e76523e571421c7b2d20 100644 --- a/doc/handbook/5_grids.tex +++ b/doc/handbook/5_grids.tex @@ -8,7 +8,7 @@ construction of a structured grid is fairly easy. We will subsequently introduce and briefly mention how to customize and deal with common other grid formats. \subsection{Supported file formats} -\Dumux can read grids from file using the Dune Grid Format (DGF) or the Gmsh mesh format (only unstructured grids). +\Dumux can read grids from file using the Dune Grid Format (DGF) or the Gmsh mesh format. \subsubsection{Dune Grid Format} Most of our \Dumux tests and tutorials use the Dune Grid Format (DGF) to read in grids. A detailed description @@ -125,8 +125,7 @@ To add the parameters to your DGF you have to make changes to the header \texttt \href{http://www.topologica.org/toplog/wp/}{ArtMesh} is a 3D mesh generation software. It has its own mesh file format which can be read by \Dumux via the \texttt{ArtGridCreator}. Traditionally it was used within \Dumux for fracture simulations with the discrete fracture matrix model (\texttt{2pdfm}). A detailed description of the fracture network creation and gridding -can be found for example in the dissertation of \href{http://elib.uni --stuttgart.de/opus/frontdoor.php?source_opus=8047&la=de}{Tatomir}, pp. 68. +can be found for example in \cite{Tatomir2012a}, pp. 68. \subsubsection{ICEM} For complex geometries a graphical tool to create grids might be appropriate. One possibility to mesh for example CAD diff --git a/doc/handbook/5_models.tex b/doc/handbook/5_models.tex index fdac66149f7860a567940a031ad170f486d401a5..b3e5b7d2e3036fb6873931200b4d0f23aad3ebfe 100644 --- a/doc/handbook/5_models.tex +++ b/doc/handbook/5_models.tex @@ -127,7 +127,7 @@ $\boldsymbol{v}_\alpha$ & velocity (Darcy or free flow)& & \\ \subsection{Available Models} We distinguish fully-implicit and sequential models. A list of all available models can be found in the Doxygen documentation at -\url{http://www.dumux.org/doxygen-stable/html-2.10/modules.php}. +\url{http://www.dumux.org/doxygen-stable/html-\DumuxVersion/modules.php}. The documentation includes a detailed description for every model. \subsubsection{Fully-Implicit Models} diff --git a/doc/handbook/CMakeLists.txt b/doc/handbook/CMakeLists.txt index c639c9fc34faa153faec412321b738a9d52f7204..f2f89dcb575b7b07f9ee84414275c978b9f7da04 100644 --- a/doc/handbook/CMakeLists.txt +++ b/doc/handbook/CMakeLists.txt @@ -18,7 +18,6 @@ set(TEX_INPUTS 4_restartsimulations.tex 4_structure.tex 5_stepsofasimulation.tex - 5_fluidframework.tex 5_grids.tex 5_models.tex 5_propertysystem.tex diff --git a/doc/handbook/dumux-handbook.bib b/doc/handbook/dumux-handbook.bib index 982fc1904083500b42e29f5fbcc00d5ff816f5dc..709a0fe9b5b2a59a2844133630999a29c155c3c7 100644 --- a/doc/handbook/dumux-handbook.bib +++ b/doc/handbook/dumux-handbook.bib @@ -1,18 +1,34 @@ -% This file was created with JabRef 2.6. % Encoding: UTF-8 -@BOOK{DEBOOR1978, - title = {{A Practical Guide to Splines}}, - publisher = {Springer}, - year = {1978}, - author = {C. {de Boor}}, - edition = {1} +@Article{Schluender1988a, + author = {Schlünder, E.-U.}, + title = {{\"Uber den Mechanismus des ersten Trocknungsabschnittes und seine m\"ogliche Bedeutung für diffusionskontrollierte katalytische Gasphasen-Reaktionen}}, + journal = {Chem. Ing. Tech.}, + year = {1988}, + volume = {60}, + pages = {117--120}, + number = {2}, + doi = {10.1002/cite.330600209}, + url = {https://dx.doi.org/10.1002/cite.330600209} +} + +@Manual{ANSYSUserGuide12, + Title = {{ANSYS FLUENT 12.0 - User's Guide}}, + Author = {{ANSYS, Inc.}}, + Edition = {12.0}, + Organization = {{ANSYS, Inc.}}, + Year = {2009}, +} + +@MISC{STL-REF-HP, + title = {{A {STL} Reference: \url{http://www.cplusplus.com/reference/stl/}}}, + key = {STL} } @ARTICLE{VANGENUCHTEN1980, author = {M. T. {van Genuchten}}, title = {{A Closed-form Equation for Predicting the Hydraulic Conductivity - of Unsaturated Soils}}, + of Unsaturated Soils}}, journal = {Journal of the Soil Science Society of America}, year = {1980}, pages = {892--898}, @@ -20,276 +36,180 @@ key = {Gen80} } -@PHDTHESIS{A3:oelmann:2006a, - author = {\"Olmann, Ulrich}, - title = {{Behandlung anisotroper Mobilit\"aten als Resultat von Upscalingverfahren - mittels Mehrpunktflu{\ss}approximationen}}, - school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, - year = {to be published 2006} -} - -@PHDTHESIS{wolff2013a, - author = {Markus Wolff}, - title = {{ Multi-scale modeling of two-phase flow in porous media including capillary pressure effects}}, - school = {Institut f\"ur Wasser- und Umweltsystemmodellierung, Universit\"at Stuttgart}, - url = {http://elib.uni-stuttgart.de/opus/volltexte/2013/8661/}, - year = {2013} -} - - -@INBOOK{wolff2013b, - author={Wolff, Markus and Cao, Yufei and Flemisch, Bernd and Helmig, Rainer and Wohlmuth, Barbara}, - title={Multi-point flux approximation L-method in 3D: numerical convergence and application to two-phase flow through porous media}, - publisher = {De Gruyter}, - year={2013}, - pages={39--80}, - editor={P. Bastian, J. Kraus, R. Scheichl, and M. Wheeler}, - series = {Simulation of Flow in Porous Media: Applications in Energy and Environment} -} - - -@MISC{A3:oelmann:2006b, - author = {\"Olmann, U. and Aavatsmark, I. and Helmig, R.}, - title = {{Buckley-Leverett heterogen --- Konstruktion der L\"osung mit der - Charakteristikenmethode}}, - howpublished = {Preprint-Reihe des SFB404}, - month = {March}, - year = {2006}, - note = {2006/05} -} - -@ARTICLE{A3:aavatsmark:2002, - author = {Aavatsmark, Ivar}, - title = {{An introduction to multipoint flux approximations for quadrilateral - grids}}, - journal = {Computational Geosciences}, - year = {2002}, - volume = {6}, - pages = {405--432} +@PHDTHESIS{Fritz2010, + author = {J. Fritz}, + title = {{A Decoupled Model for Compositional Non-Isothermal Multiphase Flow + in Porous Media and Multiphysics Approaches for Two-Phase Flow}}, + school = {Universit\"at Stuttgart}, + year = {2010}, + owner = {rodrigog}, + timestamp = {2011.02.07} } -@ARTICLE{A3:aavatsmark:1996, - author = {Aavatsmark, I. and Barkve, T. and B{\o}e, {\O}. and Mannseth, T.}, - title = {{Discretization on Non-Orthogonal, Quadrilateral Grids for Inhomogeneous - Anisotropic Media}}, - journal = {Journal of Computational Physics}, - year = {1996}, - volume = {127}, - pages = {2--14} -} -@INPROCEEDINGS{A3:aavatsmark:1994, - author = {Aavatsmark, I. and Barkve, T. and B{\o}e, {\O}. and Mannseth, T.}, - title = {{Discretization on non-orthogonal, curvilinear grids for multiphase - flow}}, +@INPROCEEDINGS{A3:edwards:1994, + author = {Edwards, M. G. and Rogers, C. F.}, + title = {{A flux continuous scheme for the full tensor pressure equation}}, booktitle = {Proc.\ of the 4th European Conf.\ on the Mathematics of Oil Recovery}, year = {1994}, address = {Norway} } -@ARTICLE{A3:acosta:2006, - author = {Acosta, M. and Merten, C. and Eigenberger, G. and Class, H. and Helmig, - R. and Thoben, B. and M\"uller-Steinhagen, H.}, - title = {{Modeling non-isothermal two-phase multicomponent flow in the cathode - of PEM fuel cells}}, - journal = {Journal of Power Sources}, - year = {2006}, - pages = {in print}, - url={https://dx.doi.org/10.1016/j.jpowsour.2005.12.068} -} - -@article{adams2002, - title={{Equations of state for basin geofluids: algorithm review and intercomparison for brines}}, - author={Adams, J. J. and Bachu, S.}, - journal={Geofluids}, - volume={2}, - number={4}, - pages={257--271}, - year={2002}, - publisher={Wiley Online Library}, - url = {https://dx.doi.org/10.1046/j.1468-8123.2002.00041.x} +@Article{BASTIAN2008, + author = {P. Bastian and M. Blatt and A. Dedner and C. Engwer and R. Kl\"{o}fkorn and R. Kornhuber and M. Ohlberger and O. Sander}, + title = {{A Generic Grid Interface For Parallel and Adaptive Scientific Computing. Part II: implementation and tests in {DUNE}}}, + journal = {Computing}, + year = {2008}, + volume = {82}, + number = {2}, + pages = {121--138}, + doi = {10.1007/s00607-008-0004-9}, + url = {https://dx.doi.org/10.1007/s00607-008-0004-9} } - -@inproceedings{adebiyi2003, - title={{Formulations for the thermodynamic properties of pure substances}}, - author={Adebiyi, G. A.}, - booktitle={ASME 2003 International Mechanical Engineering Congress and Exposition}, - pages={183--188}, - year={2003}, - organization={American Society of Mechanical Engineers}, - url = {https://dx.doi.org/10.1115/IMECE2003-41299} +@article{palliser1998, + title={{A model for deep geothermal brines, III: Thermodynamic properties--enthalpy and viscosity}}, + author={Palliser, C. and McKibbin, R.}, + journal={Transport in Porous Media}, + volume={33}, + number={1-2}, + pages={155--171}, + year={1998}, + publisher={Springer}, + url={https://dx.doi.org/10.1023/A:1006549810989} } -@ARTICLE{AGRAWAL2001, - author = {K. Agrawal and P. N. Loezos and M. Syamlal and S. Sundaresan}, - title = {{The Role of Meso-Scale Structures in Rapid Gas-Solid Flows}}, - journal = {Journal of Fluid Mechanics}, - year = {2001}, - pages = {151--185}, - number = {445} +@ARTICLE{LENHARD1987, + author = {R. J. Lenhard and J. C. Parker}, + title = {{A Model for Hysteretic Constitutive Relations Governing Multiphase + Flow. 2. Permeability-Saturation Relations}}, + journal = {Water Resources Research}, + year = {1987}, + volume = {23}, + pages = {2197--2206}, + number = {12} } -@INPROCEEDINGS{A3:allan:1998, - author = {Allan, J. and Ewing, J. and Helmig, R. and Braun, J.}, - title = {{Scale effects in multiphase flow modeling}}, - booktitle = {1. International conference on remediation of chlorinated and recalcitrant - compounds}, - year = {1998}, - editor = {Wickramanayake, G.B. and Hinchee, R.E.}, - address = {Monterey, California, USA}, - month = {18th--21st of may}, - publisher = {Battelle Press, Columbus, OH, USA} +@ARTICLE{LHHW2011, + author = {A. Lauser and C. Hager and R. Helmig and B. Wohlmuth}, + title = {{A new approach for phase transitions in miscible multi-phase flow in porous media}}, + journal = {Advances in Water Resources}, + year = {2011}, + pages = {957--966}, + volume = {34}, + number = {8} } -@article{ambrose1989, - title={{Vapour pressures up to their critical temperatures of normal alkanes and 1-alkanols}}, - author={Ambrose, D. and Walton, J.}, - journal={Pure and Applied Chemistry}, - volume={61}, - number={8}, - pages={1395--1403}, - year={1989}, - url={https://dx.doi.org/10.1351/pac198961081395} +@INPROCEEDINGS{A3:freiboth:2004, + author = {S. H\"olzemann and H. Class and R. Helmig}, + title = {{A New Concept for the Numerical Simulation and Parameter Identification + of Multiphase Flow and Transport Processes in Cohesive Soils}}, + booktitle = {{Unsaturated Soils: Numerical and Theoretical Approaches -- Proceedings + of the International Conference ``From Experimental Evidence towards + Numerical Modelling of Unsaturated Soils'' (18. - 19. September 2003, + Bauhaus-Universit\"at Weimar)}}, + year = {2004}, + editor = {Schanz, T.}, + publisher = {Springer-Verlag}, + note = {ISBN: 3-540-21122-5} } - -@BOOK{ANDERSON-CFD-95, - title = {{Computational Fluid Mechanics}}, - publisher = {McGraw-Hill}, - year = {1995}, - author = {J. D. Anderson}, - edition = {1}, - subtitle = {The Basics with Applications} +@article{span1996, + title={{A new equation of state for carbon dioxide covering the fluid region from the triple-point temperature to 1100 K at pressures up to 800 MPa}}, + author={Span, R. and Wagner, W.}, + journal={Journal of physical and chemical reference data}, + volume={25}, + number={6}, + pages={1509--1596}, + year={1996}, + publisher={AIP Publishing}, + url={https://dx.doi.org/10.1063/1.555991} } -@BOOK{ARFKEN2005, - title = {{Mathematical Methods for Physicists}}, - publisher = {Academic Press}, - year = {2005}, - author = {G. B. Arfken and H. J. Weber}, - edition = {6} +@Article{aavatsmark2010, + author = {Aavatsmark, I. and Eigestad, G. T. and Heimsund, B. and Mallison, B. and Nordbotten, J. and {\O}ian, E. and others}, + title = {{A new finite-volume approach to efficient discretization on challenging grids}}, + journal = {SPE Journal}, + year = {2010}, + volume = {15}, + number = {03}, + pages = {658--669}, + publisher = {Society of Petroleum Engineers}, + url= {https://doi.org/10.2118/106435-PA} } -@BOOK{A3:aziz:1979, - title = {{Petroleum Reservoir Simulation}}, - publisher = {Applied Science Publishers, London}, - year = {1979}, - author = {Aziz, K. and Settari, A.} -} -@MISC{GSIMSKRIPT, - author = {P. Bastian}, - title = {{Grundlagen der Modellbildung und Simulation}}, - howpublished = {University of Stuttgart, Lecture Notes}, - year = {2007} +@ARTICLE{MUALEM1976, + author = {Y. Mualem}, + title = {{A new model for predicting the hydraulic conductivity of unsaturated + porous media}}, + journal = {Water Resources Research}, + year = {1976}, + volume = {12}, + pages = {513--522}, + number = {3} } -@MISC{NUMPDESKRIPT, - author = {P. Bastian}, - title = {{Numerische L\"{o}sung partieller Differentialgleichungen}}, - howpublished = {University of Stutt\-gart, Lecture Notes}, - year = {2007} +@article{peng1976, + title={{A new two-constant equation of state}}, + author={Peng, D.-Y. and Robinson, D. B.}, + journal={Industrial \& Engineering Chemistry Fundamentals}, + volume={15}, + number={1}, + pages={59--64}, + year={1976}, + publisher={ACS Publications}, + url={https://dx.doi.org/10.1021/i160057a011} } -@BOOK{BEAR1972, - title = {Dynamics of Fluids in Porous Media}, - author = {Bear, Jacob}, - isbn = {9780486656755}, - series = {Dover Civil and Mechanical Engineering Series}, - year = {1972}, - publisher = {Dover} +@ARTICLE{PARKER1987, + author = {J. C. Parker and R. J. Lenhard and T. Kuppusamy}, + title = {{A Parametric Model for Constitutive Properties Governing Multiphase + Flow in Porous Media}}, + journal = {Water Resources Research}, + year = {1987}, + volume = {23}, + pages = {618--624}, + number = {4} } -@BOOK{BASTIAN1999, - title = {{Numerical Computation of Multiphase Flows in Porous Media}}, - publisher = {Habilitationsschrift, University of Kiel}, - year = {1999}, - author = {P. Bastian}, +@BOOK{DEBOOR1978, + title = {{A Practical Guide to Splines}}, + publisher = {Springer}, + year = {1978}, + author = {C. {de Boor}}, edition = {1} } -@INBOOK{A3:bastian:1997, - pages = {27--40}, - title = {{UG: A flexible software toolbox for solving partial differential - equations.}}, - publisher = {Springer Verlag}, - year = {1997}, - author = {Bastian, P. and Birken, K. and Lang, S. and Johannsen, K. and Neuss, - N. and Rentz-Reichert, H. and Wieners, C.}, - volume = {1}, - series = {Computing and Visualization in Science} +@article{span2000, + title={{A reference equation of state for the thermodynamic properties of nitrogen for temperatures from 63.151 to 1000 K and pressures to 2200 MPa}}, + author={Span, R. and Lemmon, E. W. and Jacobsen, R. T. and Wagner, W. and Yokozeki, A.}, + journal={Journal of Physical and Chemical Reference Data}, + volume={29}, + number={6}, + pages={1361--1433}, + year={2000}, + publisher={AIP Publishing}, + url={https://dx.doi.org/10.1063/1.1349047} } -@ARTICLE{BASTIAN2008, - author = {P. Bastian and M. Blatt and A. Dedner and C. Engwer and R. Kl\"{o}fkorn - and R. Kornhuber and M. Ohlberger and O. Sander}, - title = {{A Generic Grid Interface For Parallel and Adaptive Scientific Computing. - Part II: implementation and tests in {DUNE}}}, - journal = {Computing}, - year = {2008}, - volume = {82}, - pages = {121--138}, - number = {2} -} - -@INBOOK{A3:bastian:2000, - pages = {52--71}, - title = {{Numerical Simulation of Multiphase Flow in Fractured Porous Media.}}, - publisher = {Springer Verlag}, - year = {2000}, - author = {Bastian, P. and Chen, Z. and Ewing, R. E. and Helmig, R. and Jakobs - H. and Reichenberger V.}, - series = {Lecture Notes in Physics, Chen, Ewing and Shi (eds.)} -} - -@ARTICLE{A3:bastian:1999, - author = {Bastian, P. and Helmig, R.}, - title = {{Efficient Fully-Coupled Solution Techniques for Two Phase Flow in - Porous Media. Parallel Multigrid Solution and Large Scale Computations}}, - journal = {Advances in Water Resources}, - year = {1999} -} - -@ARTICLE{BASTIAN-HELMIG1999, - author = {P. Bastian and R. Helmig}, - title = {{Efficient Fully-Coupled Solution Techniques for Two Phase Flow in - Porous Media. Parallel Multigrid Solution and Large Scale Computations}}, - journal = {Advances in Water Resources}, - year = {1999}, - volume = {23}, - pages = {199--216}, - number = {3} -} - -@article{batzle1992, - title={{Seismic properties of pore fluids}}, - author={Batzle, M. and Wang, Z.}, - journal={Geophysics}, - volume={57}, - number={11}, - pages={1396--1408}, - year={1992}, - publisher={Society of Exploration Geophysicists}, - url={https://dx.doi.org/10.1190/1.1443207} -} - - -@ARTICLE{BEAUCHEMIN1995, - author = {S. S. Beauchemin and J. L. Barron}, - title = {{The computation of optical flow}}, - journal = {ACM Computing Surveys}, - year = {1995}, - volume = {27}, - pages = {433--466}, - number = {3} +@Article{rutqvist2002, + author = {Rutqvist, Jonny and Tsang, Chin-Fu}, + title = {{A study of caprock hydromechanical changes associated with CO2-injection into a brine formation}}, + journal = {Environmental Geology}, + year = {2002}, + volume = {42}, + number = {2-3}, + pages = {296--305}, + publisher = {Springer}, + url={https://doi.org/10.1007/s00254-001-0499-2} } @ARTICLE{BELIAEV2001, author = {A. Y. Beliaev and S. M. Hassanizadeh}, title = {{A Theoretical Model of Hysteresis and Dynamic Effects in the Capillary - Relation for Two-phase Flow in Porous Media}}, + Relation for Two-phase Flow in Porous Media}}, journal = {Transport in Porous Media}, year = {2001}, volume = {43}, @@ -297,47 +217,6 @@ number = {3} } -@PHDTHESIS{A3:bielinski:2006, - author = {Bielinski, A.}, - title = {{Numerical Simulation of CO$_2$ Sequestration in Geological Formations}}, - school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, - year = {2006} -} - -@ARTICLE{A3:Braun:2002, - author = {Braun, C. and Helmig, R. and Manthey, S.}, - title = {{Determination of constitutive relationships for two-phase flow processes - in heterogeneous porous media with emphasis on the relative permeability-saturation-relationship}}, - journal = {Journal of Contaminant Hydrology}, - year = {2005} -} - -@BOOK{BRONSTEIN-93, - title = {{Taschenbuch der Mathematik}}, - publisher = {Verlag Harri Deutsch}, - year = {1993}, - author = {I. N. Bronstein and K. A. Semendjajew and G. Musiol and H. M\"{u}hlig}, - edition = {6} -} - -@TECHREPORT{BROOKS1964, - author = {R. H. Brooks and A. T. Corey.}, - title = {{Hydraulic properties of porous media}}, - institution = {Colorado State University, Fort Collins}, - year = {1964}, - note = {Hydrology Paper No. 3, 27 pp.} -} - -@ARTICLE{BURDINE1953, - author = {N. T. Burdine}, - title = {{Relative permeability calculations from pore size distribution data}}, - journal = {Transactions of the American Institute of Mining and Metallurgical - Engineers}, - year = {1953}, - volume = {198}, - pages = {71--78} -} - @INPROCEEDINGS{BURRI2006, author = {A. Burri and A. Dedner and R. Kl\"{o}fkorn and M. Ohlberger}, title = {{An efficient implementation of an adaptive and parallel grid in DUNE.}}, @@ -348,22 +227,54 @@ publisher = {Springer} } -@ARTICLE{CARMAN1937, - author = {Carman, Philip C.}, - title = {Fluid flow through granular beds}, - journal = {Transactions, Institution of Chemical Engineers}, - year = {1937}, - volume = {15}, - pages = {150--166}, - number = {}, - doi = {10.1016/S0263-8762(97)80003-2}, - note = {reprinted in \emph{Chemical Engineering Research and Design}, 75:S32--S48, 1997} + +@ARTICLE{TENG2000, + author = {H. Teng and T. S. Zhao}, + title = {{An extension of Darcy's law to non-Stokes flow in porous media}}, + journal = {Chemical engineering science}, + year = {2000}, + volume = {55}, + pages = {2727--2735}, + number = {14} +} + +@article{duan2003, + title={{An improved model calculating CO 2 solubility in pure water and aqueous NaCl solutions from 273 to 533 K and from 0 to 2000 bar}}, + author={Duan, Z. and Sun, R.}, + journal={Chemical geology}, + volume={193}, + number={3}, + pages={257--271}, + year={2003}, + publisher={Elsevier}, + url={https://dx.doi.org/10.1016/S0009-2541(02)00263-2} +} + +@Article{prydz1972, + author = {Prydz, R.}, + title = {{An Improved Oxygen Vapor Pressure Representation}}, + journal = {Metrologia}, + year = {1972}, + volume = {8}, + number = {1}, + pages = {1}, + publisher = {IOP Publishing}, + url = {https://dx.doi.org/10.1088/0026-1394/8/1/002} +} + +@ARTICLE{A3:aavatsmark:2002, + author = {Aavatsmark, Ivar}, + title = {{An introduction to multipoint flux approximations for quadrilateral grids}}, + journal = {Computational Geosciences}, + year = {2002}, + volume = {6}, + pages = {405--432} } @ARTICLE{Chen2000, author = {Z. Chen and Q. Guan and R. E. Ewing}, - title = {{Analysis of a compositional model for fluid flow in porous media}, - journal = {SIAM Journal on Applied Mathematics}}, + title = {{Analysis of a compositional model for fluid flow in porous media}}, + journal = {SIAM Journal on Applied Mathematics}, year = {2000}, volume = {60}, pages = {747-777}, @@ -371,96 +282,79 @@ owner = {faigle} } -@BOOK{CLASS2007, - title = {{Models for Non-Isothermal Compositional Gas-Liquid Flow and Transport - in Porous Media}}, - publisher = {University of Stuttgart}, - year = {2007}, - author = {H. Class}, - edition = {1} -} - -@BOOK{A3:class:2001, - title = {{Theorie und numerische Modellierung nichtisothermer Mehrphasenprozesse - in NAPL-kontaminierten por\"osen Medien}}, - publisher = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, - year = {2001}, - author = {Class, H.}, - volume = {105}, - series = {Mitteilungsheft} +@ARTICLE{A3:deneef:1997, + author = {De Neef, M. and Molenaar, J.}, + title = {{Analysis of DNAPL infiltration in a Medium with a low-permeable lens}}, + journal = {Computational Geosciences}, + year = {1997}, + volume = {1}, + pages = {191-214} } -@PHDTHESIS{CLASS2001, - author = {H. Class}, - title = {{Theorie und numerische Modellierung nichtisothermer Mehrphasenprozesse - in NAPL-kontaminierten por\"{o}sen Medien.}}, - school = {University of Stuttgart}, - year = {2001} +@INBOOK{A3:sfb404:2003, + chapter = {A3}, + pages = {69--98}, + title = {{Arbeits- und Ergebnisbericht 2003}}, + publisher = {SFB 404}, + year = {2003}, + author = {Helmig, R. and Class, H. and Jakobs, H. and Bierlinski, A. and \"Olmann, + U.}, + month = {May} } -@ARTICLE{A3:class:2002b, - author = {Class, H. and Helmig, R.}, - title = {{Numerical Simulation of Nonisothermal Multiphase Multicomponent Processes - in Porous Media -- 2. Applications for the Injection of Steam and - Air}}, - journal = {Advances in Water Resources}, - year = {2002}, - volume = {25}, - pages = {551--564} +@PHDTHESIS{A3:oelmann:2006a, + author = {\"Olmann, Ulrich}, + title = {{Behandlung anisotroper Mobilit\"aten als Resultat von Upscalingverfahren + mittels Mehrpunktflu{\ss}approximationen}}, + school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, + year = {to be published 2006} } -@ARTICLE{A3:class:2002a, - author = {Class, H. and Helmig, R. and Bastian, P.}, - title = {{Numerical Simulation of Nonisothermal Multiphase Multicomponent Processes - in Porous Media -- 1. An Efficient Solution Technique}}, - journal = {Advances in Water Resources}, - year = {2002}, - volume = {25}, - pages = {533--550} -} -@ARTICLE{A3:coats:1974, - author = {Coats, K. H. and Chieh Chu, W. D. G. and Marcum, B. E.}, - title = {{Three-dimensional simulation of steamflooding}}, - journal = {Society of Petroleum Engineers Journal}, - year = {1974}, - month = {December} +@MISC{A3:oelmann:2006b, + author = {\"Olmann, U. and Aavatsmark, I. and Helmig, R.}, + title = {{Buckley-Leverett heterogen --- Konstruktion der L\"osung mit der + Charakteristikenmethode}}, + howpublished = {Preprint-Reihe des SFB404}, + month = {March}, + year = {2006}, + note = {2006/05} } -@phdthesis{darcis2013, - author = {Melanie Yvonne Darcis}, - title = {Coupling models of different complexity for the simulation of CO2 storage in deep saline aquifers}, - school = {Universit\"at Stuttgart}, - year = {2013}, - address = {Holzgartenstr. 16, 70174 Stuttgart}, - language = {eng}, - URL = {http://elib.uni-stuttgart.de/opus/volltexte/2013/8141}, - ISBN = {978-3-942036-22-1}, +@ARTICLE{LAND1968, + author = {C. S. Land}, + title = {{Calculation of Imbibition Relative Permeability for Two- and Three-Phase + Flow from Rock Properties}}, + journal = {Journal of the Society of Petroleum Engineers}, + year = {1968}, + volume = {8}, + pages = {149--156}, + number = {2} } -@MISC{DARCY1856, - author = {H. Darcy}, - title = {L{es Fontaines publiques de la ville de Dijon}}, - howpublished = {Paris}, - year = {1856}, - key = {Dar1856} -} -% no doi or link available -@book{daubert1989, - title={{Physical and Thermodynamic Properties of Pure Chemicals: Design institute for physical property data, American institute of chemical engineers. vp}}, - author={Daubert, T. E. and Danner, R. P.}, - year={1989}, - publisher={Hemisphere Publishing Corporation} +@article{spycher2005, + title={{CO 2-H 2 O mixtures in the geological sequestration of CO 2. II. Partitioning in chloride brines at 12--100 C and up to 600 bar}}, + author={Spycher, N. and Pruess, K.}, + journal={Geochimica et Cosmochimica Acta}, + volume={69}, + number={13}, + pages={3309--3320}, + year={2005}, + publisher={Elsevier}, + url={https://dx.doi.org/10.1016/j.gca.2005.01.015} } -@ARTICLE{A3:deneef:1997, - author = {De Neef, M. and Molenaar, J.}, - title = {{Analysis of DNAPL infiltration in a Medium with a low-permeable lens}}, - journal = {Computational Geosciences}, - year = {1997}, - volume = {1}, - pages = {191-214} +@Article{spycher2003, + author = {Spycher, N. and Pruess, K. and Ennis-King, J.}, + title = {{CO_2-H_2O mixtures in the geological sequestration of CO_2. I. Assessment and calculation of mutual solubilities from 12 to 100 C and up to 600 bar}}, + journal = {Geochimica et cosmochimica acta}, + year = {2003}, + volume = {67}, + number = {16}, + pages = {3015--3031}, + publisher = {Elsevier}, + url = {https://dx.doi.org/10.1016/S0016-7037(03)00273-4} } @article{delshad1989, @@ -475,61 +369,74 @@ url={https://dx.doi.org/10.1007/BF00134742} } - -@ARTICLE{DITTERICH1996, - author = {E. Ditterich}, - title = {{Wirbel um den Bodenschutz}}, - journal = {Umweltmagazin}, - year = {1996}, - pages = {46--48}, - number = {4} +@misc{sander1999, + title={{Compilation of Henry's law constants for inorganic and organic species of potential importance in environmental chemistry}}, + author={Sander, R.}, + year={1999}, + publisher={Max-Planck Institute of Chemistry, Air Chemistry Department Mainz, Germany}, + url={http://enviromap.utah.gov/businesses/E/EnSolutions/depleteduranium/performassess/compliancereport/docs/2014/07Jul/supinfo/appreferences/Sander1999.pdf} } -@article{duan2003, - title={{An improved model calculating CO 2 solubility in pure water and aqueous NaCl solutions from 273 to 533 K and from 0 to 2000 bar}}, - author={Duan, Z. and Sun, R.}, - journal={Chemical geology}, - volume={193}, - number={3}, - pages={257--271}, - year={2003}, - publisher={Elsevier}, - url={https://dx.doi.org/10.1016/S0009-2541(02)00263-2} +@PHDTHESIS{HUBER2000, + author = {R. U. Huber}, + title = {{Compositional Multiphase Flow and Transport in Heterogeneous Porous + Media}}, + school = {University of Stuttgart}, + year = {2000} } -@phdthesis{ebigbo2005, - title={{Thermal effects of carbon dioxide sequestration in the subsurface}}, - author={Ebigbo, A.}, - year={2005}, - school={Master’s thesis, Institut f{\"u}r Wasserbau, Universit{\"a}t Stuttgart}, - url={https://www.hydrosys.uni-stuttgart.de/institut/hydrosys/publikationen/paper/Dipl_Anozie_Ebigbo.pdf} -} +@BOOK{ANDERSON-CFD-95, + title = {{Computational Fluid Mechanics}}, + publisher = {McGraw-Hill}, + year = {1995}, + author = {J. D. Anderson}, + edition = {1}, + subtitle = {The Basics with Applications} +} -@INPROCEEDINGS{A3:edwards:1994, - author = {Edwards, M. G. and Rogers, C. F.}, - title = {{A flux continuous scheme for the full tensor pressure equation}}, - booktitle = {Proc.\ of the 4th European Conf.\ on the Mathematics of Oil Recovery}, - year = {1994}, - address = {Norway} +@article{nield2006, + title={{Convection with Change of Phase}}, + author={Nield, D. A. and Bejan, A.}, + journal={Convection in Porous Media}, + pages={403--452}, + year={2006}, + publisher={Springer}, + url={https://dx.doi.org/10.1007/0-387-33431-9_10} } -@PHDTHESIS{A3:emmert:1997, - author = {Emmert, M.}, - title = {{Numerische Simulation von isothermen/nichtisothermen Mehrphasenprozessen - unter Ber\"ucksichtigung der Ver\"anderung der Fluideigenschaften}}, - school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, - year = {1997} +@BOOK{kays2005, + title = {{Convective heat and mass transfer}}, + publisher = {McGraw-Hill Higher Education}, + year = {2005}, + isbn={9780071238298}, + author = {W. M. Kays and M. E. Crawford and B. Weigand}, + edition = {4}, } -@ARTICLE{A3:falta:1992, - author = {Falta, R. W. and Pruess, K. and Javandel, I. and Witherspoon, P. A.}, - title = {{Numerical Modeling of Steam Injection for the Removal of Nonaqueous - Phase Liquids From the Subsurface. 1. Numerical Formulation}}, - journal = {Water Resoures Research}, - year = {1992}, - volume = {28,2}, - pages = {433--449} +@PhdThesis{darcis2013, + author = {Melanie Yvonne Darcis}, + title = {{Coupling models of different complexity for the simulation of CO2 storage in deep saline aquifers}}, + school = {Universit\"at Stuttgart}, + year = {2013}, + address = {Holzgartenstr. 16, 70174 Stuttgart}, + isbn = {978-3-942036-22-1}, + language = {eng}, + url = {http://elib.uni-stuttgart.de/opus/volltexte/2013/8141} +} + +@ARTICLE{A3:Braun:2002, + author = {Braun, C. and Helmig, R. and Manthey, S.}, + title = {{Determination of constitutive relationships for two-phase flow processes + in heterogeneous porous media with emphasis on the relative permeability-saturation-relationship}}, + journal = {Journal of Contaminant Hydrology}, + year = {2005} +} +@mastersthesis{nuske2009, + title={{Determination of interfacial area-capillary pressure-saturation relationships for a single fracture}}, + author={Nuske, K. P.}, + year={2009}, + school={Universit{\"a}t Stuttgart} } @article{ferrell1967, @@ -544,158 +451,402 @@ url={https://dx.doi.org/10.1021/je60032a036} } -@book{finsterle1993, - title={{Inverse Modellierung zur Bestimmung hydrogeologischer Parameter eines Zweiphasensystems}}, - author={Finsterle, Stefan}, - year={1993}, - publisher={VAW}, - url={http://tocs.ulb.tu-darmstadt.de/26322307.pdf} +@article{xu2003, + title={{Diffusion of water in liquid and supercritical carbon dioxide: an NMR study}}, + author={Xu, B. and Nagashima, K. and DeSimone, J. M. and Johnson, C. S.}, + journal={The Journal of Physical Chemistry A}, + volume={107}, + number={1}, + pages={1--3}, + year={2003}, + publisher={ACS Publications}, + url={https://dx.doi.org/10.1021/jp021943g} } +@INPROCEEDINGS{A3:aavatsmark:1994, + author = {Aavatsmark, I. and Barkve, T. and B{\o}e, {\O}. and Mannseth, T.}, + title = {{Discretization on non-orthogonal, curvilinear grids for multiphase + flow}}, + booktitle = {Proc.\ of the 4th European Conf.\ on the Mathematics of Oil Recovery}, + year = {1994}, + address = {Norway} +} -@TECHREPORT{A3:forsyth:1993, - author = {Forsyth, P. A.}, - title = {{Three dimensional modeling of steam flush for DNAPL site remediation}}, - institution = {Dep. of Computer Science}, - year = {1993}, - address = {University of Waterloo}, - note = {CS-93-56} +@ARTICLE{A3:aavatsmark:1996, + author = {Aavatsmark, I. and Barkve, T. and B{\o}e, {\O}. and Mannseth, T.}, + title = {{Discretization on Non-Orthogonal, Quadrilateral Grids for Inhomogeneous + Anisotropic Media}}, + journal = {Journal of Computational Physics}, + year = {1996}, + volume = {127}, + pages = {2--14} } -@PHDTHESIS{Fritz2010, - author = {J. Fritz}, - title = {{A Decoupled Model for Compositional Non-Isothermal Multiphase Flow - in Porous Media and Multiphysics Approaches for Two-Phase Flow}}, - school = {Universit\"at Stuttgart}, - year = {2010}, - owner = {rodrigog}, - timestamp = {2011.02.07} +@Book{BEAR1972, + title = {{Dynamics of Fluids in Porous Media}}, + publisher = {Dover}, + year = {1972}, + author = {Bear, Jacob}, + series = {Dover Civil and Mechanical Engineering Series}, + isbn = {9780486656755} } -@ARTICLE{A3:gimse:1992, - author = {Gimse, T. and Risebro, N. H.}, - title = {{Solution of the Cauchy Problem for a Conservation Law with a Discontinuous - Flux Function}}, - journal = {SIAM J.\ Math.\ Anal.}, - year = {1992}, +@ARTICLE{A3:bastian:1999, + author = {Bastian, P. and Helmig, R.}, + title = {{Efficient Fully-Coupled Solution Techniques for Two Phase Flow in + Porous Media. Parallel Multigrid Solution and Large Scale Computations}}, + journal = {Advances in Water Resources}, + year = {1999} +} + +@ARTICLE{BASTIAN-HELMIG1999, + author = {P. Bastian and R. Helmig}, + title = {{Efficient Fully-Coupled Solution Techniques for Two Phase Flow in + Porous Media. Parallel Multigrid Solution and Large Scale Computations}}, + journal = {Advances in Water Resources}, + year = {1999}, volume = {23}, - pages = {635-648}, + pages = {199--216}, number = {3} } -@INPROCEEDINGS{A3:gimse:1991, - author = {Gimse, T. and Risebro, N. H.}, - title = {{Riemann Problems with a Discontinuous Flux Function}}, - booktitle = {Proc.\ 3rd Internat.\ Conf.\ Hyperbolic Problems}, - year = {1991}, - pages = {488-502}, - address = {Uppsala} +@article {Aguilar2008a, + author = {Aguilar, G. and Gaspar, F. and Lisbona, F. and Rodrigo, C.}, + title = {{Numerical stabilization of Biot's consolidation model by a perturbation on the flow equation}}, + journal = {International Journal for Numerical Methods in Engineering}, + volume = {75}, + number = {11}, + publisher = {John Wiley & Sons, Ltd.}, + issn = {1097-0207}, + url = {http://dx.doi.org/10.1002/nme.2295}, + doi = {10.1002/nme.2295}, + pages = {1282--1300}, + keywords = {Biot's model, finite elements, stabilization}, + year = {2008}, +} + +@article{Biot1941a, + author = {Maurice A. Biot}, + title = {{General Theory of Three‐Dimensional Consolidation}}, + journal = {Journal of Applied Physics}, + volume = {12}, + number = {2}, + pages = {155-164}, + year = {1941}, + doi = {10.1063/1.1712886}, + URL = {http://dx.doi.org/10.1063/1.1712886}, +} + +@article{adams2002, + title={{Equations of state for basin geofluids: algorithm review and intercomparison for brines}}, + author={Adams, J. J. and Bachu, S.}, + journal={Geofluids}, + volume={2}, + number={4}, + pages={257--271}, + year={2002}, + publisher={Wiley Online Library}, + url = {https://dx.doi.org/10.1046/j.1468-8123.2002.00041.x} +} + +@article{oliveira2003, + title={{Estimation of primary drainage three-phase relative permeability for organic liquid transport in the vadose zone}}, + author={Oliveira, L. I. and Demond, A. H.}, + journal={Journal of Contaminant Hydrology}, + volume={66}, + number={3}, + pages={261--285}, + year={2003}, + publisher={Elsevier}, + url={https://dx.doi.org/10.1016/S0169-7722(03)00029-9} +} + +@ARTICLE{SPAETH1969, + author = {H. Sp{\"{a}}th}, + title = {{Exponential Spline Interpolation}}, + journal = {Computing}, + year = {1969}, + volume = {4}, + pages = {225--233}, + number = {3}, + key = {Spa69} +} + +@BOOK{PRANDTL2002, + title = {{F\"{u}hrer durch die Str\"{o}mungslehre}}, + publisher = {Vieweg}, + year = {2002}, + author = {L. Prandtl and H. Oertel}, + edition = {11} +} + +@ARTICLE{SPE5, + author = {J. E. Killough and C. A. Kossack}, + title = {{Fifth Comparative Solution Project: Evaluation of Miscible Flood Simulators}}, + journal = {Society of Petroleum Engineers}, + year = {1987}, + volume = {SPE 16000}, + url={https://doi.org/10.2118/16000-MS} +} + +@ARTICLE{WHITAKER1985, + author = {S. Whitaker}, + title = {{Flow in porous media I: A theoretical derivation of Darcy's law}}, + journal = {Transport in Porous Media}, + year = {1985}, + volume = {1}, + pages = {3--25}, + number = {1} +} + +@Article{CARMAN1937, + author = {Carman, Philip C.}, + title = {{Fluid flow through granular beds}}, + journal = {Transactions, Institution of Chemical Engineers}, + year = {1937}, + volume = {15}, + pages = {150--166}, + note = {reprinted in \emph{Chemical Engineering Research and Design}, 75:S32--S48, 1997}, + url = {https://dx.doi.org/10.1016/S0263-8762(97)80003-2} +} + + +@inproceedings{adebiyi2003, + title={{Formulations for the thermodynamic properties of pure substances}}, + author={Adebiyi, G. A.}, + booktitle={ASME 2003 International Mechanical Engineering Congress and Exposition}, + pages={183--188}, + year={2003}, + organization={American Society of Mechanical Engineers}, + url = {https://dx.doi.org/10.1115/IMECE2003-41299} +} + +@PhdThesis{Tatomir2012a, + author = {Tatomir, Alexandru-Bogdan}, + title = {{From discrete to continuum concepts of flow in fractured porous media}}, + school = {Universität Stuttgart}, + year = {2012}, + comment = {10.18419/opus-476}, + timestamp = {2017.02.27}, + url = {http://dx.doi.org/10.18419/opus-476} +} + +@Article{GEUZAINE2009, + author = {Geuzaine, C. and Remacle, J. - F.}, + title = {{Gmsh: A 3-{D} finite element mesh generator with built-in pre-and post-processing facilities}}, + journal = {International Journal for Numerical Methods in Engineering}, + year = {2009}, + volume = {79}, + number = {11}, + pages = {1309--1331}, + doi = {10.1002/nme.2579}, + publisher = {Wiley Online Library}, + url = {http://dx.doi.org/10.1002/nme.2579} +} + +@BOOK{HYDROSKRIPT, + title = {{Grundlagen der Hydromechanik}}, + publisher = {Shaker}, + year = {2005}, + author = {R. Helmig and H. Class}, + edition = {1} +} + +@MISC{GSIMSKRIPT, + author = {P. Bastian}, + title = {{Grundlagen der Modellbildung und Simulation}}, + howpublished = {University of Stuttgart, Lecture Notes}, + year = {2007} +} + +@Article{Pebesma1998a, + author = {Edzer J. Pebesma and Cees G. Wesseling}, + title = {{Gstat: a program for geostatistical modelling, prediction and simulation}}, + journal = {Computers \& Geosciences}, + year = {1998}, + volume = {24}, + pages = {17--31}, + number = {1}, + doi = {http://dx.doi.org/10.1016/S0098-3004(97)00082-4}, + issn = {0098-3004}, + url = {http://dx.doi.org/10.1016/S0098-3004(97)00082-4} +} + +@article{watanabe2004, + title={{Guideline on the Henry's Constant and Vapor-Liquid Distribution Constant for Gases in H2O and D2O at High Temperatures}}, + author={Watanabe, K. and Dooley, R. B.}, + journal={International Association for the Properties of Water and Steam}, + year={2004}, + url={http://www.iapws.org/relguide/HenGuide.pdf} +} + +@BOOK{MEYBERG2000, + title = {{H\"{o}here Mathematik 1}}, + publisher = {Springer}, + year = {2001}, + author = {K. Meyberg and P. Vachenauer}, + edition = {6} +} + +@article{lyman1990, + title={{Handbook of chemical property estimation methods: environmental behavior of organic compounds}}, + author={Lyman, W. J. and Reehl, W. F. and Rosenblatt, D. H.}, + year={1990}, + publisher={Washington, DC (United States); American Chemical Society}, + url={https://www.osti.gov/scitech/biblio/6902382} +} + +@ARTICLE{HASSANIZADEH1987, + author = {S. M. Hassanizadeh and W. G. Gray}, + title = {{High velocity flow in porous media}}, + journal = {Transport in Porous Media}, + year = {1987} +} + +@TECHREPORT{BROOKS1964, + author = {R. H. Brooks and A. T. Corey.}, + title = {{Hydraulic properties of porous media}}, + institution = {Colorado State University, Fort Collins}, + year = {1964}, + note = {Hydrology Paper No. 3, 27 pp.} +} + +@ARTICLE{A3:nordbotten:2005a, + author = {Nordbotten, J. M. and Celia, M. A. and Bachu, S.}, + title = {{Injection and Storage of {CO$_2$} in Deep Saline Aquifers: Analytical + Solution for {CO$_2$} Plume Evolution During Injection}}, + journal = {Transport in Porous Media}, + year = {2005}, + volume = {58(3)}, + pages = {339--360} +} + +@article{joekar2008, + title={{Insights into the relationships among capillary pressure, saturation, interfacial area and relative permeability using pore-network modeling}}, + author={Joekar-Niasar, V. and Hassanizadeh, S. M. and Leijnse, A.}, + journal={Transport in Porous Media}, + volume={74}, + number={2}, + pages={201--219}, + year={2008}, + publisher={Springer}, + url={https://dx.doi.org/10.1007/s11242-007-9191-7} +} + +@ARTICLE{NIESSNER2005, + author = {J. Niessner and R. Helmig and H. Jakobs and J. Roberts}, + title = {{Interface Condition and Exact Linearization in the Newton Iterations + for Two-phase Flow in Heterogeneous Porous Media}}, + journal = {Advances in Water Resources}, + year = {2005}, + volume = {28}, + pages = {671--687}, + number = {7} +} + +@BOOK{A3:Stauffer:1984, + title = {{Introduction to Percolation Theory}}, + publisher = {Taylor \& Francis}, + year = {1994}, + author = {Stauffer, F. and Aharnony, A.} } -@TECHREPORT{subgrid, - author = {C. Gr\"aser and O. Sander}, - title = {{The dune-subgrid Module and Some Applications}}, - year = {2009}, - note = {Matheon 566} +@book{finsterle1993, + title={{Inverse Modellierung zur Bestimmung hydrogeologischer Parameter eines Zweiphasensystems}}, + author={Finsterle, Stefan}, + year={1993}, + publisher={VAW}, + url={https://www.ethz.ch/content/dam/ethz/special-interest/baug/vaw/vaw-dam/documents/das-institut/mitteilungen/1990-1999/121.pdf} } -@MASTERSTHESIS{A3:grass:2005, - author = {Grass, C.}, - title = {{Untersuchung von Randbedingungen bei der numerischen Simulation von - Zweiphasenstr\"omungen in por\"osen Medien}}, - school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, - year = {2005}, - month = {January} -} -@BOOK{GRIEBEL2003, - title = {{Numerische Simulation in der Molek\"{u}ldynamik}}, - publisher = {Springer}, - year = {2003}, - author = {M. Griebel and S. Knapek and G. Zumbusch and A. Caglar}, +@BOOK{ORTEGA2000, + title = {{Iterative Solution of Nonlinear Equations in Several Variables}}, + publisher = {Society for Industrial and Applied Mathematics}, + year = {2000}, + author = {J. M. Ortega and W. C. Rheinboldt}, + address = {Philadelphia, PA, USA}, edition = {1} } -@article{gudbjerg2004, -title = {{On spurious water flow during numerical simulation of steam injection into water-saturated soil}}, -author = {{J. Gudbjerg and O. Trötschler and A. Färber and T.O. Sonnenborg and K.H. Jensen}}, -journal = {{Journal of Contaminant Hydrology}}, -volume = {75}, -number = {3–4}, -pages = {297 - 318}, -year = {2004}, -doi = {http://dx.doi.org/10.1016/j.jconhyd.2004.07.003}, -url = {http://www.sciencedirect.com/science/article/pii/S0169772204001160} +@BOOK{GLADROW2000, + title = {{Lattice-Gas Cellular Automata and Lattice Boltzmann Models: An Introduction}}, + publisher = {Springer}, + year = {2000}, + author = {D. A. Wolf-Gladrow}, + edition = {1} } -@INPROCEEDINGS{A3:freiboth:2004, - author = {S. H\"olzemann and H. Class and R. Helmig}, - title = {{A New Concept for the Numerical Simulation and Parameter Identification - of Multiphase Flow and Transport Processes in Cohesive Soils}}, - booktitle = {{Unsaturated Soils: Numerical and Theoretical Approaches -- Proceedings - of the International Conference ``From Experimental Evidence towards - Numerical Modelling of Unsaturated Soils'' (18. - 19. September 2003, - Bauhaus-Universit\"at Weimar)}}, - year = {2004}, - editor = {Schanz, T.}, - publisher = {Springer-Verlag}, - note = {ISBN: 3-540-21122-5} +@Misc{DARCY1856, + author = {H. Darcy}, + title = {{Les Fontaines publiques de la ville de Dijon}}, + howpublished = {Paris}, + year = {1856}, + key = {Dar1856} } -@ARTICLE{HASSANIZADEH1987, - author = {S. M. Hassanizadeh and W. G. Gray}, - title = {{High velocity flow in porous media}}, - journal = {Transport in Porous Media}, - year = {1987} +@BOOK{ARFKEN2005, + title = {{Mathematical Methods for Physicists}}, + publisher = {Academic Press}, + year = {2005}, + author = {G. B. Arfken and H. J. Weber}, + edition = {6} } -@BOOK{A3:helmig:1997, - title = {{Multiphase Flow and Transport Processes in the Subsurface --- A Contribution - to the Modeling of Hydrosystems}}, - publisher = {Springer Verlag}, - year = {1997}, - author = {Helmig, R.} +@BOOK{SAENDIG-05, + title = {{Mathematische Methoden in der Kontinuumsmechanik}}, + publisher = {Institut f\"{u}r Angewandte Analysis und Numerische Simulation}, + year = {2005}, + author = {A. - M. S{\"{a}}ndig}, + edition = {1}, + key = {Sae05} } -@BOOK{HELMIG1997, - title = {{Multiphase Flow and Transport Processes in the Subsurface: A Contribution - to the Modeling of Hydrosystems}}, +@BOOK{KARNIADAKIS2005, + title = {{Microflows and Nanoflows: Fundamentals and Simulation}}, publisher = {Springer}, - year = {1997}, - author = {R. Helmig}, + year = {2005}, + author = {G. Karniadakis and A. Be{\c c}k\"{o}k and N. R. Aluru}, edition = {1} } -@article{hollis1996, - title={{Real-Gas Flow Properties for NASA Langley Research Center Aerothermodynamic Facilities Complex Wind Tunnels}}, - author={Hollis, B. R.}, - year={1996}, - publisher={NASA Langley Technical Report Server}, - url = {{http://dl.acm.org/citation.cfm?id=886001}} +@PHDTHESIS{DeNEFF2000, + author = {de Neef, M. J.}, + title = {{Modeling Capillary Effects in Heterogeneous Porous Media}}, + school = {Technical University Delft}, + year = {2000} } -@BOOK{HYDROSKRIPT, - title = {{Grundlagen der Hydromechanik}}, - publisher = {Shaker}, - year = {2005}, - author = {R. Helmig and H. Class}, +@ARTICLE{A3:acosta:2006, + author = {Acosta, M. and Merten, C. and Eigenberger, G. and Class, H. and Helmig, + R. and Thoben, B. and M\"uller-Steinhagen, H.}, + title = {{Modeling non-isothermal two-phase multicomponent flow in the cathode + of PEM fuel cells}}, + journal = {Journal of Power Sources}, + year = {2006}, + pages = {in print}, + url={https://dx.doi.org/10.1016/j.jpowsour.2005.12.068} +} + +@BOOK{CLASS2007, + title = {{Models for Non-Isothermal Compositional Gas-Liquid Flow and Transport + in Porous Media}}, + publisher = {University of Stuttgart}, + year = {2007}, + author = {H. Class}, edition = {1} } -@INBOOK{A3:sfb404:2003, - chapter = {A3}, - pages = {69--98}, - title = {{Arbeits- und Ergebnisbericht 2003}}, - publisher = {SFB 404}, - year = {2003}, - author = {Helmig, R. and Class, H. and Jakobs, H. and Bierlinski, A. and \"Olmann, - U.}, - month = {May} +@UNPUBLISHED{A3:nordbotten:2005c, + author = {Nordbotten, J. M. and Aavatsmark, I. and Eigestad, G. T.}, + title = {{Monotonicity of Control Volume Methods}}, + note = {submitted to Numerische Mathematik}, + year = {2005} } @INPROCEEDINGS{A3:HelmigEtAl:2006, author = {Helmig, R. and Miller, C. T. and Jakobs, H. and Class, H. and Hilpert, - M. and Kees, C. E. and Niessner, J.}, + M. and Kees, C. E. and Niessner, J.}, title = {{Multiphase Flow and Transport Modeling in Heterogeneous Porous Media}}, booktitle = {Progress in Industrial Mathematics at ECMI 2004}, year = {2006}, @@ -708,33 +859,21 @@ url = {http://www.sciencedirect.com/science/article/pii/S0169772204001160} type = {Plenary lecture} } -@PHDTHESIS{HUBER2000, - author = {R. U. Huber}, - title = {{Compositional Multiphase Flow and Transport in Heterogeneous Porous - Media}}, - school = {University of Stuttgart}, - year = {2000} -} - -@article{joekar2008, - title={{Insights into the relationships among capillary pressure, saturation, interfacial area and relative permeability using pore-network modeling}}, - author={Joekar-Niasar, V. and Hassanizadeh, S. M. and Leijnse, A.}, - journal={Transport in Porous Media}, - volume={74}, - number={2}, - pages={201--219}, - year={2008}, - publisher={Springer}, - url={https://dx.doi.org/10.1007/s11242-007-9191-7} +@BOOK{A3:helmig:1997, + title = {{Multiphase Flow and Transport Processes in the Subsurface --- A Contribution + to the Modeling of Hydrosystems}}, + publisher = {Springer Verlag}, + year = {1997}, + author = {Helmig, R.} } - -@techreport{johansen1977, - title={{Thermal conductivity of soils}}, - author={Johansen, O.}, - year={1977}, - institution={DTIC Document}, - url={http://oai.dtic.mil/oai/oai?verb=getRecord&metadataPrefix=html&identifier=ADA044002} +@BOOK{HELMIG1997, + title = {{Multiphase Flow and Transport Processes in the Subsurface: A Contribution + to the Modeling of Hydrosystems}}, + publisher = {Springer}, + year = {1997}, + author = {R. Helmig}, + edition = {1} } @@ -748,96 +887,38 @@ url = {http://www.sciencedirect.com/science/article/pii/S0169772204001160} number = {1} } -@BOOK{KARNIADAKIS2005, - title = {{Microflows and Nanoflows: Fundamentals and Simulation}}, - publisher = {Springer}, - year = {2005}, - author = {G. Karniadakis and A. Be{\c c}k\"{o}k and N. R. Aluru}, - edition = {1} -} - -% no doi or link available -@BOOK{kays2005, - title = {{Convective heat and mass transfer}}, - publisher = {McGraw-Hill Higher Education}, - year = {2005}, - author = {W. M. Kays and M. E. Crawford and B. Weigand}, - edition = {4}, -} - -@ARTICLE{A3:King:1996, - author = {King, P. R.}, - title = {{Upscaling Permeability: Error Analysis for Renormalisation}}, - journal = {Transport in Porous Media}, - year = {1996}, - volume = {23}, - pages = {337--354} -} - -@ARTICLE{KOOL1987, - author = {J. Kool and J. C. Parker and M. T. van Genuchten}, - title = {{Parameter Estimation for Unsaturated Flow and Transport Models - - A Review}}, - journal = {Journal of Hydrology}, - year = {1987}, - volume = {91}, - pages = {255--293} -} - -@Article{Kunz2016, -author={{Kunz, P. -and Zarikos, I. M. -and Karadimitriou, N. K. -and Huber, M. -and Nieken, U. -and Hassanizadeh, S. M.}}, -title={{Study of Multi-phase Flow in Porous Media: Comparison of SPH Simulations with Micro-model Experiments}}, -journal={{Transport in Porous Media}}, -year={2016}, -volume={114}, -number={2}, -pages={581--600}, -doi={10.1007/s11242-015-0599-1}, -url={http://dx.doi.org/10.1007/s11242-015-0599-1} -} - -@BOOK{A3:lancaster:1969, - title = {{Theory of Matrices}}, - publisher = {Academic Press, Inc.\ (London) Ltd.}, - year = {1969}, - author = {Lancaster, Peter} -} - -@ARTICLE{LAND1968, - author = {C. S. Land}, - title = {{Calculation of Imbibition Relative Permeability for Two- and Three-Phase - Flow from Rock Properties}}, - journal = {Journal of the Society of Petroleum Engineers}, - year = {1968}, - volume = {8}, - pages = {149--156}, - number = {2} -} - -@ARTICLE{LENHARD1987, - author = {R. J. Lenhard and J. C. Parker}, - title = {{A Model for Hysteretic Constitutive Relations Governing Multiphase - Flow. 2. Permeability-Saturation Relations}}, - journal = {Water Resources Research}, - year = {1987}, - volume = {23}, - pages = {2197--2206}, - number = {12} +@InBook{wolff2013b, + pages = {39--80}, + title = {{Multi-point flux approximation L-method in 3D: numerical convergence and application to two-phase flow through porous media}}, + publisher = {De Gruyter}, + year = {2013}, + author = {Wolff, Markus and Cao, Yufei and Flemisch, Bernd and Helmig, Rainer and Wohlmuth, Barbara}, + editor = {P. Bastian, J. Kraus, R. Scheichl, and M. Wheeler}, + series = {Simulation of Flow in Porous Media: Applications in Energy and Environment} } -@ARTICLE{LHHW2011, - author = {A. Lauser and C. Hager and R. Helmig and B. Wohlmuth}, - title = {{A new approach for phase transitions in miscible multi-phase flow in porous media}}, - journal = {Advances in Water Resources}, - year = {2011}, - pages = {957--966}, - volume = {34}, - number = {8} +@PhdThesis{wolff2013a, + author = {Markus Wolff}, + title = {{Multi-scale modeling of two-phase flow in porous media including capillary pressure effects}}, + school = {Institut f\"ur Wasser- und Umweltsystemmodellierung, Universit\"at Stuttgart}, + year = {2013}, + url = {http://elib.uni-stuttgart.de/opus/volltexte/2013/8661/} +} + +@BOOK{BASTIAN1999, + title = {{Numerical Computation of Multiphase Flows in Porous Media}}, + publisher = {Habilitationsschrift, University of Kiel}, + year = {1999}, + author = {P. Bastian}, + edition = {1} +} + +@PHDTHESIS{PAPAFOTIOU2008, + author = {A. Papafotiou}, + title = {{Numerical investigations of the role of hysteresis in heterogeneous + two-phase flow systems}}, + school = {University of Stuttgart}, + year = {2008} } @@ -856,314 +937,276 @@ url={http://dx.doi.org/10.1007/s11242-015-0599-1} edition = {2} } -@BOOK{A3:looney:2000, - title = {{Vadose Zone}}, - publisher = {Batelle Press, Columbus OH}, - year = {2000}, - author = {Looney, B. B. and Falta, R. W.} -} - -@article{lyman1990, - title={{Handbook of chemical property estimation methods: environmental behavior of organic compounds}}, - author={Lyman, W. J. and Reehl, W. F. and Rosenblatt, D. H.}, - year={1990}, - publisher={Washington, DC (United States); American Chemical Society}, - url={https://www.osti.gov/scitech/biblio/6902382} -} - -@BOOK{MEISTER2008, - title = {{Numerik linearer Gleichungssysteme: Eine Einf\"{u}hrung in moderne - Verfahren.}}, - publisher = {Vieweg}, - year = {2008}, - author = {A. Meister}, - edition = {3} -} - -@BOOK{MEYBERG2000, - title = {{H\"{o}here Mathematik 1}}, - publisher = {Springer}, - year = {2001}, - author = {K. Meyberg and P. Vachenauer}, - edition = {6} -} - -@article{michaelides1981, - title={{Thermodynamic properties of geothermal fluids}}, - author={Michaelides, E. E.}, - journal={Trans.-Geotherm. Resour. Counc.;(United States)}, - volume={5}, - number={CONF-811015-}, - year={1981}, - publisher={Univ. of Delaware, Newark}, - url={https://www.osti.gov/scitech/biblio/6760030} -} - -@Article{MILLINGTON1961, -author ={Millington, R. J. and Quirk, J. P.}, -title ={Permeability of porous solids}, -journal ={Trans. Faraday Soc.}, -year ={1961}, -volume ={57}, -issue ={0}, -pages ={1200--1207}, -doi ={10.1039/TF9615701200} -} - - -@ARTICLE{MUALEM1976, - author = {Y. Mualem}, - title = {{A new model for predicting the hydraulic conductivity of unsaturated - porous media}}, - journal = {Water Resources Research}, - year = {1976}, - volume = {12}, - pages = {513--522}, - number = {3} -} - -@ARTICLE{MUCCINO1998, - author = {J. C. Muccino and W. G. G. Gray and L. A. Ferrand}, - title = {{Toward an Improved Understanding of Multiphase Flow in Porous Media}, - journal = {Reviews of Geophysics}}, - year = {1998}, - volume = {36}, - pages = {401--422}, - number = {3} -} - -@BOOK{MUSKAT1937, - title = {{The Flow of Homogeneous Fluids Through Porous Media}}, - publisher = {McGraw-Hill}, - year = {1937}, - author = {M. Muskat}, - edition = {1} +@ARTICLE{A3:falta:1992, + author = {Falta, R. W. and Pruess, K. and Javandel, I. and Witherspoon, P. A.}, + title = {{Numerical Modeling of Steam Injection for the Removal of Nonaqueous + Phase Liquids From the Subsurface. 1. Numerical Formulation}}, + journal = {Water Resoures Research}, + year = {1992}, + volume = {28,2}, + pages = {433--449} } -@PHDTHESIS{DeNEFF2000, - author = {de Neef, M. J.}, - title = {{Modeling Capillary Effects in Heterogeneous Porous Media}}, - school = {Technical University Delft}, - year = {2000} +@PhdThesis{A3:bielinski:2006, + author = {Bielinski, A.}, + title = {{Numerical Simulation of CO$_2$ Sequestration in Geological Formations}}, + school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, + year = {2006}, + doi = {http://dx.doi.org/10.18419/opus-252}, + url = {http://dx.doi.org/10.18419/opus-252} } -@article{nield2006, - title={{Convection with Change of Phase}}, - author={Nield, D. A. and Bejan, A.}, - journal={Convection in Porous Media}, - pages={403--452}, - year={2006}, - publisher={Springer}, - url={https://dx.doi.org/10.1007/0-387-33431-9_10} +@INBOOK{A3:bastian:2000, + pages = {52--71}, + title = {{Numerical Simulation of Multiphase Flow in Fractured Porous Media.}}, + publisher = {Springer Verlag}, + year = {2000}, + author = {Bastian, P. and Chen, Z. and Ewing, R. E. and Helmig, R. and Jakobs + H. and Reichenberger V.}, + series = {Lecture Notes in Physics, Chen, Ewing and Shi (eds.)} } -@ARTICLE{NIESSNER2005, - author = {J. Niessner and R. Helmig and H. Jakobs and J. Roberts}, - title = {{Interface Condition and Exact Linearization in the Newton Iterations - for Two-phase Flow in Heterogeneous Porous Media}}, +@Article{A3:class:2002a, + author = {Class, H. and Helmig, R. and Bastian, P.}, + title = {{Numerical Simulation of Nonisothermal Multiphase Multicomponent Processes in Porous Media -- 1. An Efficient Solution Technique}}, journal = {Advances in Water Resources}, - year = {2005}, - volume = {28}, - pages = {671--687}, - number = {7} + year = {2002}, + volume = {25}, + pages = {533--550}, + doi = {10.1016/S0309-1708(02)00014-3}, + url = {http://dx.doi.org/10.1016/S0309-1708(02)00014-3} } -@ARTICLE{A3:nordbotten:2005a, - author = {Nordbotten, J. M. and Celia, M. A. and Bachu, S.}, - title = {{Injection and Storage of {CO$_2$} in Deep Saline Aquifers: Analytical - Solution for {CO$_2$} Plume Evolution During Injection}}, - journal = {Transport in Porous Media}, - year = {2005}, - volume = {58(3)}, - pages = {339--360} +@ARTICLE{A3:class:2002b, + author = {Class, H. and Helmig, R.}, + title = {{Numerical Simulation of Nonisothermal Multiphase Multicomponent Processes + in Porous Media -- 2. Applications for the Injection of Steam and + Air}}, + journal = {Advances in Water Resources}, + year = {2002}, + volume = {25}, + pages = {551--564}, + url = {http://dx.doi.org/10.1016/S0309-1708(02)00015-5} } -@ARTICLE{A3:nordbotten:2005b, - author = {Nordbotten, J. M. and Celia, M. A. and Bachu, S. and Dahle, H.}, - title = {{Semi-Analytical Solution for {CO$_2$} Leakage through an Abandoned - Well}}, - journal = {Environmental Science and Technology}, - year = {2005}, - volume = {39(2)}, - pages = {602--611} +@BOOK{MEISTER2008, + title = {{Numerik linearer Gleichungssysteme: Eine Einf\"{u}hrung in moderne + Verfahren.}}, + publisher = {Vieweg}, + year = {2008}, + author = {A. Meister}, + edition = {3} } -@UNPUBLISHED{A3:nordbotten:2005c, - author = {Nordbotten, J. M. and Aavatsmark, I. and Eigestad, G. T.}, - title = {{Monotonicity of Control Volume Methods}}, - note = {submitted to Numerische Mathematik}, - year = {2005} +@MISC{NUMPDESKRIPT, + author = {P. Bastian}, + title = {{Numerische L\"{o}sung partieller Differentialgleichungen}}, + howpublished = {University of Stutt\-gart, Lecture Notes}, + year = {2007} } - -@article{aavatsmark2010, - title={A new finite-volume approach to efficient discretization on challenging grids}, - author={Aavatsmark, I. and Eigestad, G. T. and Heimsund, B. and Mallison, B. and Nordbotten, J. and {\O}ian, E. and others}, - journal={SPE Journal}, - volume={15}, - number={03}, - pages={658--669}, - year={2010}, - publisher={Society of Petroleum Engineers} +@Book{stoer2005, + title = {{Numerische Mathematik 1}}, + publisher = {Springer}, + year = {2005}, + author = {Stoer, Josef and Bulirsch, Roland}, + address = {Berlin}, + edition = {9} } - -@book{stoer2005, - address = {Berlin}, - author = {Stoer, Josef and Bulirsch, Roland}, +@BOOK{GRIEBEL2003, + title = {{Numerische Simulation in der Molek\"{u}ldynamik}}, publisher = {Springer}, - title = {Numerische Mathematik 1}, - edition={9}, - year = {2005} + year = {2003}, + author = {M. Griebel and S. Knapek and G. Zumbusch and A. Caglar}, + edition = {1} } - -%no doi or link available -@phdthesis{nuske2009, - title={{Determination of interfacial area-capillary pressure-saturation relationships for a single fracture}}, - author={Nuske, K. P.}, - year={2009}, - school={Master’s thesis, Universit{\"a}t Stuttgart} +@PHDTHESIS{A3:emmert:1997, + author = {Emmert, M.}, + title = {{Numerische Simulation von isothermen/nichtisothermen Mehrphasenprozessen + unter Ber\"ucksichtigung der Ver\"anderung der Fluideigenschaften}}, + school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, + year = {1997} } - -@article{ochs2008, - title={{Structural and electrochemical characterization of zirconium and silicon based sol-gel coatings for corrosion protection}}, - author={Ochs, C. J. and Sittner, F. and Ugas-Carri{\'o}n, R. and Yekehtaz, M. and Ensinger, W.}, - journal={Current Topics in Electrochemistry}, - volume={13}, - pages={59--65}, - year={2008}, - url={https://www.researchgate.net/profile/Christopher_Ochs/publication/229811805_Structural_and_electrochemical_characterization_of_zirconium_and_silicon_based_sol-gel_coatings_for_corrosion_protection/links/09e41501118fbee7b2000000.pdf} +@article{gudbjerg2004, +title = {{On spurious water flow during numerical simulation of steam injection into water-saturated soil}}, +author = {{J. Gudbjerg and O. Trötschler and A. Färber and T.O. Sonnenborg and K.H. Jensen}}, +journal = {{Journal of Contaminant Hydrology}}, +volume = {75}, +number = {3–4}, +pages = {297 - 318}, +year = {2004}, +doi = {http://dx.doi.org/10.1016/j.jconhyd.2004.07.003}, +url = {http://www.sciencedirect.com/science/article/pii/S0169772204001160} } -@article{oliveira2003, - title={{Estimation of primary drainage three-phase relative permeability for organic liquid transport in the vadose zone}}, - author={Oliveira, L. I. and Demond, A. H.}, - journal={Journal of Contaminant Hydrology}, - volume={66}, - number={3}, - pages={261--285}, - year={2003}, - publisher={Elsevier}, - url={https://dx.doi.org/10.1016/S0169-7722(03)00029-9} +@ARTICLE{KOOL1987, + author = {J. Kool and J. C. Parker and M. T. van Genuchten}, + title = {{Parameter Estimation for Unsaturated Flow and Transport Models - + A Review}}, + journal = {Journal of Hydrology}, + year = {1987}, + volume = {91}, + pages = {255--293} } - -@BOOK{ORTEGA2000, - title = {{Iterative Solution of Nonlinear Equations in Several Variables}}, - publisher = {Society for Industrial and Applied Mathematics}, - year = {2000}, - author = {J. M. Ortega and W. C. Rheinboldt}, - address = {Philadelphia, PA, USA}, - edition = {1} +@Article{MILLINGTON1961, + author = {Millington, R. J. and Quirk, J. P.}, + title = {{Permeability of porous solids}}, + journal = {Trans. Faraday Soc.}, + year = {1961}, + volume = {57}, + pages = {1200--1207}, + doi = {10.1039/TF9615701200}, + url = {http://dx.doi.org/10.1039/TF9615701200}, + issue = {0} } -@PHDTHESIS{PAPAFOTIOU2008, - author = {A. Papafotiou}, - title = {{Numerical investigations of the role of hysteresis in heterogeneous - two-phase flow systems}}, - school = {University of Stuttgart}, - year = {2008} +@BOOK{A3:aziz:1979, + title = {{Petroleum Reservoir Simulation}}, + publisher = {Applied Science Publishers, London}, + year = {1979}, + author = {Aziz, K. and Settari, A.} } - -@ARTICLE{PARKER1987, - author = {J. C. Parker and R. J. Lenhard and T. Kuppusamy}, - title = {{A Parametric Model for Constitutive Properties Governing Multiphase - Flow in Porous Media}}, - journal = {Water Resources Research}, - year = {1987}, - volume = {23}, - pages = {618--624}, - number = {4} +@book{daubert1989, + title={{Physical and Thermodynamic Properties of Pure Chemicals: Design institute for physical property data, American institute of chemical engineers. vp}}, + author={Daubert, T. E. and Danner, R. P.}, + year={1989}, + publisher={Hemisphere Publishing Corporation} } -@Article{Pebesma1998a, - author = {Edzer J. Pebesma and Cees G. Wesseling}, - title = {{Gstat: a program for geostatistical modelling, prediction and simulation}}, - journal = {Computers \& Geosciences}, - year = {1998}, - volume = {24}, - pages = {17--31}, - number = {1}, - doi = {http://dx.doi.org/10.1016/S0098-3004(97)00082-4}, - issn = {0098-3004}, - url = {http://dx.doi.org/10.1016/S0098-3004(97)00082-4} +@article{hollis1996, + title={{Real-Gas Flow Properties for NASA Langley Research Center Aerothermodynamic Facilities Complex Wind Tunnels}}, + author={Hollis, B. R.}, + year={1996}, + publisher={NASA Langley Technical Report Server}, + url = {{http://dl.acm.org/citation.cfm?id=886001}} } -@BOOK{PRANDTL2002, - title = {{F\"{u}hrer durch die Str\"{o}mungslehre}}, - publisher = {Vieweg}, - year = {2002}, - author = {L. Prandtl and H. Oertel}, - edition = {11} +@ARTICLE{BURDINE1953, + author = {N. T. Burdine}, + title = {{Relative permeability calculations from pore size distribution data}}, + journal = {Transactions of the American Institute of Mining and Metallurgical + Engineers}, + year = {1953}, + volume = {198}, + pages = {71--78} +} +@misc{cooper2008, + title={{Release of the IAPWS formulation 2008 for the viscosity of ordinary water substance}}, + author={Cooper, J. R. and Dooley, R. B.}, + year={2008}, + publisher={The International Association of the Properties of Water and Steam, Berlin, Germany}, + number = {IAPWS R12-08}, + address = {Berlin, Germany}, + pages = {9}, + url={http://www.iapws.org/relguide/visc.pdf} } @MISC{A3:IAPWS:2003, author = {IAPWS (The International Association for the Properties of Water - and Steam)}, + and Steam)}, title = {{Revised Release on the IAPS Formulation 1985 for the Viscosity of - Ordinary Water Substance}}, + Ordinary Water Substance}}, howpublished = {\url{http://www.iapws.org/}}, year = {2003} } @MISC{IAPWS1997, author = {IAPWS (The International Association for the Properties of Water - and Steam)}, + and Steam)}, title = {{Revised Release on the IAPWS Industrial Formulation 1997 for the - Thermodynamic Properties of Water and Steam}}, - howpublished = {\url{http://www.iapws.org/IF97-Rev.pdf}}, - year = {1997} + Thermodynamic Properties of Water and Steam}}, + url={http://www.iapws.org/relguide/IF97-Rev.pdf}, + year = {1997}, + number = {IAPWS R7-97(2012)}, + address = {Lucerne, Switzerland}, + pages = {49}, } -% no doi or link available -@misc{cooper2008, - title={{Release of the IAPWS formulation 2008 for the viscosity of ordinary water substance}}, - author={Cooper, J. R. and Dooley, R. B.}, - year={2008}, - publisher={The International Association of the Properties of Water and Steam, Berlin, Germany} +@INPROCEEDINGS{A3:gimse:1991, + author = {Gimse, T. and Risebro, N. H.}, + title = {{Riemann Problems with a Discontinuous Flux Function}}, + booktitle = {Proc.\ 3rd Internat.\ Conf.\ Hyperbolic Problems}, + year = {1991}, + pages = {488-502}, + address = {Uppsala} } -@BOOK{reid1987, - title = {{The Properties of Gases and Liquids}}, - publisher = {McGraw-Hill Inc.}, - year = {1987}, - author = {Reid, R. C. and Prausnitz, J.M. and Poling, B. E.}, - url={https://www.osti.gov/scitech/biblio/6504847} +@INPROCEEDINGS{A3:allan:1998, + author = {Allan, J. and Ewing, J. and Helmig, R. and Braun, J.}, + title = {{Scale effects in multiphase flow modeling}}, + booktitle = {1. International conference on remediation of chlorinated and recalcitrant + compounds}, + year = {1998}, + editor = {Wickramanayake, G.B. and Hinchee, R.E.}, + address = {Monterey, California, USA}, + month = {18th--21st of may}, + publisher = {Battelle Press, Columbus, OH, USA} } -@article{rutqvist2002, - title={A study of caprock hydromechanical changes associated with CO2-injection into a brine formation}, - author={Rutqvist, Jonny and Tsang, Chin-Fu}, - journal={Environmental Geology}, - volume={42}, - number={2-3}, - pages={296--305}, - year={2002}, - publisher={Springer} +@article{batzle1992, + title={{Seismic properties of pore fluids}}, + author={Batzle, M. and Wang, Z.}, + journal={Geophysics}, + volume={57}, + number={11}, + pages={1396--1408}, + year={1992}, + publisher={Society of Exploration Geophysicists}, + url={https://dx.doi.org/10.1190/1.1443207} } -@article{palliser1998, - title={{A model for deep geothermal brines, III: Thermodynamic properties--enthalpy and viscosity}}, - author={Palliser, C. and McKibbin, R.}, - journal={Transport in Porous Media}, - volume={33}, - number={1-2}, - pages={155--171}, - year={1998}, - publisher={Springer}, - url={https://dx.doi.org/10.1023/A:1006549810989} +@ARTICLE{A3:nordbotten:2005b, + author = {Nordbotten, J. M. and Celia, M. A. and Bachu, S. and Dahle, H.}, + title = {{Semi-Analytical Solution for {CO$_2$} Leakage through an Abandoned + Well}}, + journal = {Environmental Science and Technology}, + year = {2005}, + volume = {39(2)}, + pages = {602--611} +} + +@ARTICLE{A3:Williams:1989, + author = {Williams, J. K.}, + title = {{Simple Renormalisation Schemes for Calculating Effective Properties + of Heterogeneous Reservoirs}}, + journal = {1st European Conference on the Mathematics of Oil Recovery, Cambridge, + UK, July 1989}, + year = {1989} } +@PHDTHESIS{SHETA1999, + author = {H. Sheta}, + title = {{Simulation von Mehrphasenvorg\"{a}engen in por\"{o}sen Medien unter + Einbeziehung von Hystereseeffekten}}, + school = {University of Stuttgart}, + year = {1999} +} -@book{poling2001, - title={{The properties of gases and liquids}}, - author={Poling, B. E. and Prausnitz, J. M. and O'Connell, J. P. and others}, - volume={5}, - year={2001}, - publisher={McGraw-Hill New York}, - url={https://dx.doi.org/10.1036/0070116822} +@Article{lashanizadegan2008, + author = {Lashanizadegan, A and Ayatollahi, Sh and Homayoni, M}, + title = {{Simultaneous heat and fluid flow in porous media: case study: steam injection for tertiary oil recovery}}, + journal = {Chemical Engineering Communications}, + year = {2008}, + volume = {195}, + number = {5}, + pages = {521--535}, + publisher = {Taylor \& Francis}, + url = {http://dx.doi.org/10.1080/00986440701709699} +} + +@ARTICLE{A3:gimse:1992, + author = {Gimse, T. and Risebro, N. H.}, + title = {{Solution of the Cauchy Problem for a Conservation Law with a Discontinuous + Flux Function}}, + journal = {SIAM J.\ Math.\ Anal.}, + year = {1992}, + volume = {23}, + pages = {635-648}, + number = {3} } @@ -1181,104 +1224,162 @@ doi ={10.1039/TF9615701200} url = {\url{http://www.sciencedirect.com/science/article/B6V06-49NXY7J-F/2/e8260e5d8f19639019cddea4776c024c}} } -@article{peng1976, - title={{A new two-constant equation of state}}, - author={Peng, D.-Y. and Robinson, D. B.}, - journal={Industrial \& Engineering Chemistry Fundamentals}, - volume={15}, - number={1}, - pages={59--64}, - year={1976}, - publisher={ACS Publications}, - url={https://dx.doi.org/10.1021/i160057a011} + +@article{ochs2008, + title={{Structural and electrochemical characterization of zirconium and silicon based sol-gel coatings for corrosion protection}}, + author={Ochs, C. J. and Sittner, F. and Ugas-Carri{\'o}n, R. and Yekehtaz, M. and Ensinger, W.}, + journal={Current Topics in Electrochemistry}, + volume={13}, + pages={59--65}, + year={2008}, + url={https://www.researchgate.net/profile/Christopher_Ochs/publication/229811805_Structural_and_electrochemical_characterization_of_zirconium_and_silicon_based_sol-gel_coatings_for_corrosion_protection/links/09e41501118fbee7b2000000.pdf} } +@techreport{walker1981, + title={{Studies of heat transfer and water migration in soils. Final report}}, + author={Walker, W. R. and Sabey, J. D. and Hampton, D. R.}, + year={1981}, + institution={Colorado State Univ., Fort Collins (USA). Solar Energy Applications Lab.}, + url={https://www.osti.gov/scitech/biblio/6149346} +} -@article{prydz1972, - title={An Improved Oxygen Vapor Pressure Representation}, - author={Prydz, R.}, - journal={Metrologia}, - volume={8}, - number={1}, - pages={1}, - year={1972}, - publisher={IOP Publishing}, - url={https://dx.doi.org/10.1088/0026-1394/8/1/002} +@Article{Kunz2016, +author={{Kunz, P. +and Zarikos, I. M. +and Karadimitriou, N. K. +and Huber, M. +and Nieken, U. +and Hassanizadeh, S. M.}}, +title={{Study of Multi-phase Flow in Porous Media: Comparison of SPH Simulations with Micro-model Experiments}}, +journal={{Transport in Porous Media}}, +year={2016}, +volume={114}, +number={2}, +pages={581--600}, +doi={10.1007/s11242-015-0599-1}, +url={http://dx.doi.org/10.1007/s11242-015-0599-1} } -@misc{sander1999, - title={{Compilation of Henry's law constants for inorganic and organic species of potential importance in environmental chemistry}}, - author={Sander, R.}, - year={1999}, - publisher={Max-Planck Institute of Chemistry, Air Chemistry Department Mainz, Germany}, - url={http://enviromap.utah.gov/businesses/E/EnSolutions/depleteduranium/performassess/compliancereport/docs/2014/07Jul/supinfo/appreferences/Sander1999.pdf} +@article{vargaftik1975, + title={{Tables on the thermophysical properties of liquids and gases in normal and dissociated states}}, + author={Vargaftik, Natan B}, + year={1975}, + publisher={Hemisphere}, + url={https://cds.cern.ch/record/101055} } -@PHDTHESIS{SHETA1999, - author = {H. Sheta}, - title = {{Simulation von Mehrphasenvorg\"{a}engen in por\"{o}sen Medien unter - Einbeziehung von Hystereseeffekten}}, - school = {University of Stuttgart}, - year = {1999} +@BOOK{BRONSTEIN-93, + title = {{Taschenbuch der Mathematik}}, + publisher = {Verlag Harri Deutsch}, + year = {1993}, + author = {I. N. Bronstein and K. A. Semendjajew and G. Musiol and H. M\"{u}hlig}, + edition = {6} } -@ARTICLE{SPAETH1969, - author = {H. Sp{\"{a}}th}, - title = {{Exponential Spline Interpolation}}, - journal = {Computing}, - year = {1969}, - volume = {4}, - pages = {225--233}, - number = {3}, - key = {Spa69} +@MISC{FENICS-HP, + title = {{The {FEniCS} Project: \url{http://www.fenicsproject.org/}}}, + key = {FENICS} } -@article{span1996, - title={{A new equation of state for carbon dioxide covering the fluid region from the triple-point temperature to 1100 K at pressures up to 800 MPa}}, - author={Span, R. and Wagner, W.}, - journal={Journal of physical and chemical reference data}, - volume={25}, - number={6}, - pages={1509--1596}, - year={1996}, - publisher={AIP Publishing}, - url={https://dx.doi.org/10.1063/1.555991} +@MISC{APACHE-SUBVERSION-HP, + title = {{The Apache Subversion Website: \url{http://subversion.apache.org/}}}, + key = {APACHE-SUBVERSION} +} + + +@ARTICLE{BEAUCHEMIN1995, + author = {S. S. Beauchemin and J. L. Barron}, + title = {{The computation of optical flow}}, + journal = {ACM Computing Surveys}, + year = {1995}, + volume = {27}, + pages = {433--466}, + number = {3} +} + +@Article{alugrid2016, + author = {Martin Alkämper and Andreas Dedner and Robert Klöfkorn and Martin Nolte}, + title = {{The DUNE-ALUGrid Module}}, + journal = {Archive of Numerical Software}, + year = {2016}, + volume = {4}, + number = {1}, + pages = {1--28}, + doi = {10.11588/ans.2016.1.23252}, + issn = {2197-8263}, + keywords = {Numerical software, Adaptive-parallel grid, Load Balancing, DUNE}, + url = {http://journals.ub.uni-heidelberg.de/index.php/ans/article/view/23252} +} + +@TECHREPORT{subgrid, + author = {C. Gr\"aser and O. Sander}, + title = {{The dune-subgrid Module and Some Applications}}, + year = {2009}, + note = {Matheon 566} +} + +@BOOK{MUSKAT1937, + title = {{The Flow of Homogeneous Fluids Through Porous Media}}, + publisher = {McGraw-Hill}, + year = {1937}, + author = {M. Muskat}, + edition = {1} +} + +@BOOK{A3:whitaker:1999, + title = {{The Method of Volume Averaging}}, + publisher = {Kluwer Academic Publishers}, + year = {1999}, + author = {Whitaker, S.}, + volume = {13}, + series = {Theory and Applications of Transport in Porous Media}, + address = {Dordrecht} +} + + +@book{poling2001, + title={{The properties of gases and liquids}}, + author={Poling, B. E. and Prausnitz, J. M. and O'Connell, J. P.}, + volume={5}, + year={2001}, + publisher={McGraw-Hill New York}, + url = { http://www.academia.edu/download/39241893/_EBOOK__Properties_of_Gases_and_Liquids_Prausnitz_5th.pdf} } -@article{span2000, - title={{A reference equation of state for the thermodynamic properties of nitrogen for temperatures from 63.151 to 1000 K and pressures to 2200 MPa}}, - author={Span, R. and Lemmon, E. W. and Jacobsen, R. T. and Wagner, W. and Yokozeki, A.}, - journal={Journal of Physical and Chemical Reference Data}, - volume={29}, - number={6}, - pages={1361--1433}, - year={2000}, - publisher={AIP Publishing}, - url={https://dx.doi.org/10.1063/1.1349047} +@BOOK{reid1987, + title = {{The Properties of Gases and Liquids}}, + publisher = {McGraw-Hill Inc.}, + year = {1987}, + author = {Reid, R. C. and Prausnitz, J.M. and Poling, B. E.}, + url={https://www.osti.gov/scitech/biblio/6504847} } -@ARTICLE{SPE5, - author = {J. E. Killough and C. A. Kossack}, - title = {{Fifth Comparative Solution Project: Evaluation of Miscible Flood Simulators}}, - journal = {Society of Petroleum Engineers}, - year = {1987}, - volume = {SPE 16000} + +@ARTICLE{AGRAWAL2001, + author = {K. Agrawal and P. N. Loezos and M. Syamlal and S. Sundaresan}, + title = {{The Role of Meso-Scale Structures in Rapid Gas-Solid Flows}}, + journal = {Journal of Fluid Mechanics}, + year = {2001}, + pages = {151--185}, + number = {445} } -@BOOK{A3:Stauffer:1984, - title = {{Introduction to Percolation Theory}}, - publisher = {Taylor \& Francis}, - year = {1994}, - author = {Stauffer, F. and Aharnony, A.} +@PHDTHESIS{A3:class:2001, + author = {Holger Class}, + title = {{Theorie und numerische Modellierung nichtisothermer Mehrphasenprozesse in NAPL-kontaminierten porösen Medien}}, + school = {Technische Universität Braunschweig}, + year = {2001}, + note = {\doi{10.18419/opus-223}}, + doi = {10.18419/opus-223}, + file = {Class2001a-Diss.pdf:Class2001a-Diss.pdf:PDF}, + url = {http://dx.doi.org/10.18419/opus-223} } -@BOOK{SAENDIG-05, - title = {{Mathematische Methoden in der Kontinuumsmechanik}}, - publisher = {Institut f\"{u}r Angewandte Analysis und Numerische Simulation}, - year = {2005}, - author = {A. - M. S{\"{a}}ndig}, - edition = {1}, - key = {Sae05} +@BOOK{A3:lancaster:1969, + title = {{Theory of Matrices}}, + publisher = {Academic Press, Inc.\ (London) Ltd.}, + year = {1969}, + author = {Lancaster, Peter} } @article{somerton1974, @@ -1294,48 +1395,63 @@ doi ={10.1039/TF9615701200} } -@article{spycher2003, - title={{CO 2-H 2 O mixtures in the geological sequestration of CO 2. I. Assessment and calculation of mutual solubilities from 12 to 100 C and up to 600 bar}}, - author={Spycher, N. and Pruess, K. and Ennis-King, J.}, - journal={Geochimica et cosmochimica acta}, - volume={67}, - number={16}, - pages={3015--3031}, - year={2003}, - publisher={Elsevier}, - url={https://dx.doi.org/10.1016/S0016-7037(03)00273-4} +@techreport{johansen1977, + title={{Thermal conductivity of soils}}, + author={Johansen, O.}, + year={1977}, + institution={DTIC Document}, + url={http://oai.dtic.mil/oai/oai?verb=getRecord&metadataPrefix=html&identifier=ADA044002} } - -@article{spycher2005, - title={{CO 2-H 2 O mixtures in the geological sequestration of CO 2. II. Partitioning in chloride brines at 12--100 C and up to 600 bar}}, - author={Spycher, N. and Pruess, K.}, - journal={Geochimica et Cosmochimica Acta}, - volume={69}, - number={13}, - pages={3309--3320}, +@mastersthesis{ebigbo2005, + title={{Thermal effects of carbon dioxide sequestration in the subsurface}}, + author={Ebigbo, A.}, year={2005}, - publisher={Elsevier}, - url={https://dx.doi.org/10.1016/j.gca.2005.01.015} + school={Master’s thesis, Institut f{\"u}r Wasserbau, Universit{\"a}t Stuttgart} +} + +@article{michaelides1981, + title={{Thermodynamic properties of geothermal fluids}}, + author={Michaelides, E. E.}, + journal={Trans.-Geotherm. Resour. Counc.;(United States)}, + volume={5}, + number={CONF-811015-}, + year={1981}, + publisher={Univ. of Delaware, Newark}, + url={https://www.osti.gov/scitech/biblio/6760030} } -%no doi or link available -@article{tchobanoglous1985, - title={Water Quality: Characteristics}, - author={Tchobanoglous, G. and Schroeder, E. D.}, - journal={Modeling, Modification: Addison-Wesley}, - year={1985} +@MISC{NIST, + title = {{Thermophysical Properties of Fluid Systems: \url{http://webbook.nist.gov/chemistry/fluid/}}}, + key = {NIST} } -@ARTICLE{TENG2000, - author = {H. Teng and T. S. Zhao}, - title = {{An extension of Darcy's law to non-Stokes flow in porous media}}, - journal = {Chemical engineering science}, - year = {2000}, - volume = {55}, - pages = {2727--2735}, - number = {14} +@TECHREPORT{A3:forsyth:1993, + author = {Forsyth, P. A.}, + title = {{Three dimensional modeling of steam flush for DNAPL site remediation}}, + institution = {Dep. of Computer Science}, + year = {1993}, + address = {University of Waterloo}, + note = {CS-93-56} +} + +@ARTICLE{A3:coats:1974, + author = {Coats, K. H. and Chieh Chu, W. D. G. and Marcum, B. E.}, + title = {{Three-dimensional simulation of steamflooding}}, + journal = {Society of Petroleum Engineers Journal}, + year = {1974}, + month = {December} +} + +@ARTICLE{MUCCINO1998, + author = {J. C. Muccino and W. G. G. Gray and L. A. Ferrand}, + title = {{Toward an Improved Understanding of Multiphase Flow in Porous Media}, + journal = {Reviews of Geophysics}}, + year = {1998}, + volume = {36}, + pages = {401--422}, + number = {3} } @article{ward1964, @@ -1349,6 +1465,27 @@ doi ={10.1039/TF9615701200} publisher={ASCE} } +@INBOOK{A3:bastian:1997, + pages = {27--40}, + title = {{UG: A flexible software toolbox for solving partial differential + equations.}}, + publisher = {Springer Verlag}, + year = {1997}, + author = {Bastian, P. and Birken, K. and Lang, S. and Johannsen, K. and Neuss, + N. and Rentz-Reichert, H. and Wieners, C.}, + volume = {1}, + series = {Computing and Visualization in Science} +} + +@MASTERSTHESIS{A3:grass:2005, + author = {Grass, C.}, + title = {{Untersuchung von Randbedingungen bei der numerischen Simulation von + Zweiphasenstr\"omungen in por\"osen Medien}}, + school = {Institut f\"ur Wasserbau, Universit\"at Stuttgart}, + year = {2005}, + month = {January} +} + @ARTICLE{A3:Wen:1996, author = {Wen, X. H. and G\'{o}mez-Hern\'{a}ndez, J. J.}, @@ -1359,52 +1496,20 @@ doi ={10.1039/TF9615701200} pages = {ix--xxxii} } -@BOOK{A3:whitaker:1999, - title = {{The Method of Volume Averaging}}, - publisher = {Kluwer Academic Publishers}, - year = {1999}, - author = {Whitaker, S.}, - volume = {13}, - series = {Theory and Applications of Transport in Porous Media}, - address = {Dordrecht} -} - -@ARTICLE{WHITAKER1985, - author = {S. Whitaker}, - title = {{Flow in porous media I: A theoretical derivation of Darcy's law}}, +@ARTICLE{A3:King:1996, + author = {King, P. R.}, + title = {{Upscaling Permeability: Error Analysis for Renormalisation}}, journal = {Transport in Porous Media}, - year = {1985}, - volume = {1}, - pages = {3--25}, - number = {1} -} - -@ARTICLE{A3:Williams:1989, - author = {Williams, J. K.}, - title = {{Simple Renormalisation Schemes for Calculating Effective Properties - of Heterogeneous Reservoirs}}, - journal = {1st European Conference on the Mathematics of Oil Recovery, Cambridge, - UK, July 1989}, - year = {1989} -} - -@ARTICLE{GEUZAINE2009, - title={{Gmsh: A 3-{D} finite element mesh generator with built-in pre-and post-processing facilities}}, - author={Geuzaine, C. and Remacle, J. - F.}, - journal={International Journal for Numerical Methods in Engineering}, - volume={79}, - number={11}, - pages={1309--1331}, - year={2009}, - publisher={Wiley Online Library} + year = {1996}, + volume = {23}, + pages = {337--354} } -@BOOK{GLADROW2000, - title = {{Lattice-Gas Cellular Automata and Lattice Boltzmann Models: An Introduction}}, - publisher = {Springer}, +@BOOK{A3:looney:2000, + title = {{Vadose Zone}}, + publisher = {Batelle Press, Columbus OH}, year = {2000}, - author = {D. A. Wolf-Gladrow}, - edition = {1} + author = {Looney, B. B. and Falta, R. W.} } @article{gmehling1980, @@ -1419,124 +1524,79 @@ doi ={10.1039/TF9615701200} url={https://dx.doi.org/10.1021/je60084a016} } -@article{vargaftik1975, - title={{Tables on the thermophysical properties of liquids and gases in normal and dissociated states}}, - author={Vargaftik, Natan B}, - year={1975}, - publisher={Hemisphere}, - url={https://cds.cern.ch/record/101055} -} - -@article{watanabe2004, - title={{Guideline on the Henry's Constant and Vapor-Liquid Distribution Constant for Gases in H2O and D2O at High Temperatures}}, - author={Watanabe, K. and Dooley, R. B.}, - journal={International Association for the Properties of Water and Steam}, - year={2004}, - url={http://www.iapws.org/relguide/HenGuide.pdf} -} - -@techreport{walker1981, - title={{Studies of heat transfer and water migration in soils. Final report}}, - author={Walker, W. R. and Sabey, J. D. and Hampton, D. R.}, - year={1981}, - institution={Colorado State Univ., Fort Collins (USA). Solar Energy Applications Lab.}, - url={https://www.osti.gov/scitech/biblio/6149346} -} - -@article{xu2003, - title={{Diffusion of water in liquid and supercritical carbon dioxide: an NMR study}}, - author={Xu, B. and Nagashima, K. and DeSimone, J. M. and Johnson, C. S.}, - journal={The Journal of Physical Chemistry A}, - volume={107}, - number={1}, - pages={1--3}, - year={2003}, - publisher={ACS Publications}, - url={https://dx.doi.org/10.1021/jp021943g} -} - -@MISC{ALUGRID-HP, - title = {T{he {ALUG}rid Website: \url{http://www.mathematik.uni-freiburg.de/IAM/Research/alugrid/}}}, - key = {ALU} -} - -@MISC{APACHE-SUBVERSION-HP, - title = {{The Apache Subversion Website: \url{http://subversion.apache.org/}}}, - key = {APACHE-SUBVERSION} -} - -@MISC{CMAKE-DOC, - title = {{{CMake} Documentation: \url{http://www.cmake.org/documentation/}}}, - key = {CMAKE} -} - -@MISC{DOXYGEN-HP, - title = {{Doxygen Homepage: \url{http://www.stack.nl/~dimitri/doxygen/}}}, - key = {DOXYGEN} -} - -@MISC{DUMUX-HP, - title = {{{DuMuX} homepage: \url{http://www.dumux.org/}}}, - key = {DUMUX} -} - -@MISC{DUMUX-DOWNLOAD, - title = {{{DuMuX} download folder: \url{http://www.dumux.org/download/}}}, - key = {DUMUX-DOWNLOAD} -} - -@MISC{DUNE-CMAKE, - title = {{Building Dune with CMake -- Frequently Asked Questions}: \url{http://www.dune-project.org/doc/buildsystem/cmakefaq.pdf}}, - key = {DUNE-CMAKE} -} - -@MISC{DUNE-DOWNLOAD-GIT, - title = {{Download of {DUNE} via Git: \url{http://www.dune-project.org/downloadgit.html}}}, - key = {DUNE-DOWNLOAD-GIT} +@article{ambrose1989, + title={{Vapour pressures up to their critical temperatures of normal alkanes and 1-alkanols}}, + author={Ambrose, D. and Walton, J.}, + journal={Pure and Applied Chemistry}, + volume={61}, + number={8}, + pages={1395--1403}, + year={1989}, + url={https://dx.doi.org/10.1351/pac198961081395} } -@MISC{DUNE-EXT-LIB, - title = {{Use of external libraries in DUNE \url{http://www.dune-project.org/external_libraries/index.html}}}, - key = {DUNE-EXTERNAL-LIBRARIES} +@Article{tchobanoglous1985, + author = {Tchobanoglous, G. and Schroeder, E. D.}, + title = {{Water Quality: Characteristics}}, + journal = {Modeling, Modification: Addison-Wesley}, + year = {1985} } -@MISC{DUNE-EXT-MOD, - title = {{Use of external modules in DUNE \url{http://www.dune-project.org/downloadext.html}}}, - key = {DUNE-EXTERNAL-MODULES} -} -@MISC{DUNE-HP, - title = {{The {DUNE} Project: \url{http://www.dune-project.org/}}}, - key = {DUNE} +@ARTICLE{DITTERICH1996, + author = {E. Ditterich}, + title = {{Wirbel um den Bodenschutz}}, + journal = {Umweltmagazin}, + year = {1996}, + pages = {46--48}, + number = {4} } -@MISC{DUNE-INST, - title = {{Installation notes to {DUNE}: \url{http://www.dune-project.org/doc/installation-notes.html}}}, - key = {DUNE-INST} +@Misc{ALUGRID-HP, + author = {{ALUGrid Homepage}}, + timestamp = {2017.02.27}, + url = {https://www.dune-project.org/modules/dune-alugrid/} } -@MISC{FENICS-HP, - title = {{The {FEniCS} Project: \url{http://www.fenicsproject.org/}}}, - key = {FENICS} +@Misc{DUNE-HP, + author = {{DUNE Homepage}}, + url = {http://www.dune-project.org} } -@MISC{NIST, - title = {{Thermophysical Properties of Fluid Systems: \url{http://webbook.nist.gov/chemistry/fluid/}}}, - key = {NIST} +@Misc{IAPWS-HP, + author = {{IAPWS Homepage}}, + timestamp = {2017.02.27}, + url = {http://www.iapws.org/} } -@MISC{STL-REF-HP, - title = {{A {STL} Reference: \url{http://www.cplusplus.com/reference/stl/}}}, - key = {STL} +@Misc{UG-HP, + author = {{UG Homepage}}, + key = {UG}, + url = {https://www.dune-project.org/modules/dune-uggrid/} } -@MISC{UG-HP, - title = {{{UG} Homepage: \url{http://www.iwr.uni-heidelberg.de/frame/iwrwikiequipment/software/ug}}}, - key = {UG} +@Techreport{IAPWS_ThCond, + author = {IAPWS}, + title = {{Release on the IAPWS Formulation 2011 for the Thermal Conductivity of Ordinary Water Substance}}, + institution = {The International Association for the Properties of Water and Steam}, + year = {2011}, + number = {IAPWS R15-11}, + address = {Plzeň, Czech Republic}, + url = {http://www.iapws.org/relguide/ThCond.pdf} } -@MISC{WIKIPED-ALIASING, - title = {{Wikipedia about aliasing data location in memory: \url{http://en.wikipedia.org/wiki/Aliasing\_(computing)}}}, - key = {WikipediaAliasing} +@Article{Lemmon2004a, + author = {Lemmon, E. W. and Jacobsen, R. T.}, + title = {{Viscosity and Thermal Conductivity Equations for Nitrogen, Oxygen, Argon, and Air}}, + journal = {International Journal of Thermophysics}, + year = {2004}, + volume = {25}, + pages = {21--69}, + number = {1}, + abstract = {New formulations for the viscosity and thermal conductivity for nitrogen, oxygen, argon, and air are given. Air is treated as a pseudo-pure fluid using an approach adopted from previous research on the equation of state for air. The equations are valid over all liquid and vapor states, and a simplified cross-over equation was used to model the behavior of the critical enhancement for thermal conductivity. The extrapolation behavior of the equations for nitrogen and argon well below their triple points was monitored so that both could be used as reference equations for extended corresponding states applications. The uncertainties of calculated values from the equations are generally within 2{\%} for nitrogen and argon and within 5{\%} for oxygen and air, except in the critical region where the uncertainties are higher. Comparisons with the available experimental data are given.}, + doi = {10.1023/B:IJOT.0000022327.04529.f3}, + issn = {1572-9567}, + owner = {fetzer}, + timestamp = {2017.05.11}, + url = {http://dx.doi.org/10.1023/B:IJOT.0000022327.04529.f3} } - diff --git a/dumux/common/boundingboxtree.hh b/dumux/common/boundingboxtree.hh index 51d1c7b8936ce364135d007d917c8752d5405d22..5a55febf9a782fc35e0411ba608ac32eb3a559c8 100644 --- a/dumux/common/boundingboxtree.hh +++ b/dumux/common/boundingboxtree.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_BOUNDINGBOXTREE_HH #define DUMUX_BOUNDINGBOXTREE_HH +#include #include #include #include @@ -250,7 +251,8 @@ public: // first check if we are in the plane of the triangle // if not we can return early const double t = v.dot(n); - if (std::abs(t) > v1.two_norm()*eps_) // take |v1| as scale + using std::abs; + if (abs(t) > v1.two_norm()*eps_) // take |v1| as scale return false; // compute the normal to the triangle made of point and first edge @@ -300,10 +302,7 @@ public: // we know the points are aligned // if the dot product is positive and the length in range // the point is in the interval - if (v1.dot(v2) > 0.0 && v2norm < v1norm*(1 + eps_)) - return true; - - return false; + return (v1.dot(v2) > 0.0 && v2norm < v1norm*(1 + eps_)); } /*! @@ -546,10 +545,7 @@ public: // we know the points are aligned // if the dot product is positive and the length in range // the point is in the interval - if (v1.dot(v2) > 0.0 && v2norm < v1norm*(1 + eps_)) - return true; - - return false; + return (v1.dot(v2) > 0.0 && v2norm < v1norm*(1 + eps_)); } /*! @@ -695,10 +691,10 @@ public: // the point is inside if the length is // small than the interval length and the // sign of v1 & v2 are the same - if (std::signbit(v1) == std::signbit(v2) - && std::abs(v1) < std::abs(v2)*(1 + eps_)) - return true; - return false; + using std::abs; + using std::signbit; + return (signbit(v1) == signbit(v2) + && abs(v1) < abs(v2)*(1 + eps_)); } /*! @@ -1175,8 +1171,10 @@ private: corner = geometry.corner(vLocalIdx); for (std::size_t dimIdx = 0; dimIdx < dimworld; ++dimIdx) { - xMin[dimIdx] = std::min(xMin[dimIdx], corner[dimIdx]); - xMax[dimIdx] = std::max(xMax[dimIdx], corner[dimIdx]); + using std::max; + using std::min; + xMin[dimIdx] = min(xMin[dimIdx], corner[dimIdx]); + xMax[dimIdx] = max(xMax[dimIdx], corner[dimIdx]); } } } diff --git a/dumux/common/defaultusagemessage.hh b/dumux/common/defaultusagemessage.hh index cc2989908e122b1f6b9834830c1453840a6b80f1..c2b7ba4bfec907b76e5fc49e90ea394a197915a7 100644 --- a/dumux/common/defaultusagemessage.hh +++ b/dumux/common/defaultusagemessage.hh @@ -23,6 +23,8 @@ #ifndef DUMUX_DEFAULT_USAGE_MESSAGE_HH #define DUMUX_DEFAULT_USAGE_MESSAGE_HH +#include + namespace Dumux { diff --git a/dumux/common/dimensionlessnumbers.hh b/dumux/common/dimensionlessnumbers.hh index 702d492edcde7f7ef7a76b4dbfb5004a4a038e0d..2934f884d673b69712110e97b6d777510fa7a43f 100644 --- a/dumux/common/dimensionlessnumbers.hh +++ b/dumux/common/dimensionlessnumbers.hh @@ -27,6 +27,8 @@ #ifndef DIMENSIONLESS_NUMBERS_HH #define DIMENSIONLESS_NUMBERS_HH +#include + #include namespace Dumux @@ -148,13 +150,15 @@ static Scalar nusseltNumberForced(const Scalar reynoldsNumber, * Dittus, F.W and Boelter, L.M.K, Heat Transfer in Automobile Radiators of the Tubular Type, * Publications in Engineering, Vol. 2, pages 443-461, 1930 */ - return 0.023 * pow(reynoldsNumber, 0.8) * pow(prandtlNumber,0.33); + using std::pow; + return 0.023 * pow(reynoldsNumber, 0.8) * pow(prandtlNumber,0.33); } else if (formulation == NusseltFormulation::WakaoKaguei){ /* example: flow through porous medium *single phase*, fit to many different data * Wakao and Kaguei, Heat and mass Transfer in Packed Beds, Gordon and Breach Science Publishers, page 293 */ + using std::pow; return 2. + 1.1 * pow(prandtlNumber,(1./3.)) * pow(reynoldsNumber, 0.6); } @@ -163,6 +167,8 @@ static Scalar nusseltNumberForced(const Scalar reynoldsNumber, * valid for 0.1 #include -namespace Dumux -{ +#include "math.hh" -template -int sign(const ValueType& value) +namespace Dumux { - return (value < 0 ? -1 : 1); -} template void identityMatrix(Matrix& matrix) @@ -54,11 +51,13 @@ double calcOffDiagonalNorm(Matrix& matrix) norm += matrix[i][j] * matrix[i][j]; } - return std::sqrt(norm); + using std::sqrt; + return sqrt(norm); } -//! Function to calculate eigenvalues of n x n matrices -/* +/*! + * \brief Function to calculate eigenvalues of n x n matrices + * * \param eigVel Vector for storing the eigenvalues * \param matrix n x n matrices for which eigenvalues have to be calculated * \param relativeTolerance tolerance for the relative convergence criterion (default: 0.01) @@ -73,13 +72,16 @@ bool calculateEigenValues(EVVectorType &eigVel, MatrixType& matrix, double relat double b = -(matrix[0][0] + matrix[1][1]); double c = matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]; + using std::sqrt; eigVel[0] = (-b + sqrt(b * b - 4.0 * c)) / 2.0; eigVel[1] = (-b - sqrt(b * b - 4.0 * c)) / 2.0; - if (std::isnan(eigVel[0]) || std::isinf(eigVel[0])) + using std::isnan; + using std::isinf; + if (isnan(eigVel[0]) || isinf(eigVel[0])) return false; - if (std::isnan(eigVel[1]) || std::isinf(eigVel[1])) + if (isnan(eigVel[1]) || isinf(eigVel[1])) return false; return true; @@ -103,9 +105,10 @@ bool calculateEigenValues(EVVectorType &eigVel, MatrixType& matrix, double relat double theta = (evMatrix[i][i] - evMatrix[j][j]) / (2 * evMatrix[i][j]); - double t = sign(theta) - / (std::abs(theta) + std::sqrt(1 + theta * theta)); - double c = 1 / std::sqrt(1 + t * t); + using std::abs; + using std::sqrt; + double t = sign(theta) / (abs(theta) + sqrt(1 + theta * theta)); + double c = 1 / sqrt(1 + t * t); double s = c * t; rotationMatrix[i][i] = c; @@ -129,7 +132,9 @@ bool calculateEigenValues(EVVectorType &eigVel, MatrixType& matrix, double relat for (int i = 0; i < dim; i++) { eigVel[i] = evMatrix[i][i]; - if (std::isnan(eigVel[i]) || std::isinf(eigVel[i])) + using std::isinf; + using std::isnan; + if (isnan(eigVel[i]) || isinf(eigVel[i])) return false; } @@ -168,9 +173,10 @@ bool calculateEigenValues(EVVectorType &eigVel, MatrixType& eigVec, MatrixType& double theta = (evMatrix[i][i] - evMatrix[j][j]) / (2 * evMatrix[i][j]); - double t = sign(theta) - / (std::abs(theta) + std::sqrt(1 + theta * theta)); - double c = 1 / std::sqrt(1 + t * t); + using std::abs; + using std::sqrt; + double t = sign(theta) / (abs(theta) + sqrt(1 + theta * theta)); + double c = 1 / sqrt(1 + t * t); double s = c * t; rotationMatrix[i][i] = c; @@ -195,7 +201,9 @@ bool calculateEigenValues(EVVectorType &eigVel, MatrixType& eigVec, MatrixType& for (int i = 0; i < dim; i++) { eigVel[i] = evMatrix[i][i]; - if (std::isnan(eigVel[i]) || std::isinf(eigVel[i])) + using std::isinf; + using std::isnan; + if (isnan(eigVel[i]) || isinf(eigVel[i])) return false; for (int j = 0; j < dim; j++) { diff --git a/dumux/common/geometrycollision.hh b/dumux/common/geometrycollision.hh index 44d7bc7002322a3e8707a3922edaf8006c06ff75..d148a578a364be5a777b9c5147052319aa839bb2 100644 --- a/dumux/common/geometrycollision.hh +++ b/dumux/common/geometrycollision.hh @@ -125,7 +125,8 @@ public: // if denominator is zero the segment in parallel to // the plane. If the distance is positive there is no intersection - if (std::abs(denom) < eps) + using std::abs; + if (abs(denom) < eps) { if (dist > eps) return false; @@ -134,7 +135,8 @@ public: { const Scalar t = -dist / denom; // if entering half space cut tfirst if t is larger - if (std::signbit(denom)) + using std::signbit; + if (signbit(denom)) { if (t > tfirst) tfirst = t; diff --git a/dumux/common/math.hh b/dumux/common/math.hh index 307a1438c8a4e76c52a8b3e5f565b84182058247..8c54aeaab016dda102f9828b8207253e0df8f0d7 100644 --- a/dumux/common/math.hh +++ b/dumux/common/math.hh @@ -23,12 +23,12 @@ #ifndef DUMUX_MATH_HH #define DUMUX_MATH_HH +#include +#include + #include #include -#include -#include - namespace Dumux { /*! @@ -58,7 +58,8 @@ Scalar geometricMean(Scalar x, Scalar y) { if (x*y <= 0) return 0; - return std::sqrt(x*y)*((x < 0)?-1:1); + using std::sqrt; + return sqrt(x*y)*sign(x); } /*! @@ -147,13 +148,17 @@ int invertQuadraticPolynomial(SolContainer &sol, if (Delta < 0) return 0; // no real roots - Delta = std::sqrt(Delta); + using std::sqrt; + Delta = sqrt(Delta); sol[0] = (- b + Delta)/(2*a); sol[1] = (- b - Delta)/(2*a); // sort the result if (sol[0] > sol[1]) - std::swap(sol[0], sol[1]); + { + using std::swap; + swap(sol[0], sol[1]); + } return 2; // two real roots } @@ -178,7 +183,8 @@ void invertCubicPolynomialPostProcess_(SolContainer &sol, x -= fOld/fPrime; Scalar fNew = d + x*(c + x*(b + x*a)); - if (std::abs(fNew) < std::abs(fOld)) + using std::abs; + if (abs(fNew) < abs(fOld)) sol[i] = x; } } @@ -233,9 +239,8 @@ int invertCubicPolynomial(SolContainer *sol, // t^3 + q = 0, // // i. e. single real root at t=curt(q) - Scalar t; - if (-q > 0) t = std::pow(-q, 1./3); - else t = - std::pow(q, 1./3); + using std::cbrt; + Scalar t = cbrt(q); sol[0] = t - b/3; return 1; @@ -250,9 +255,10 @@ int invertCubicPolynomial(SolContainer *sol, } // two additional real roots at t = sqrt(-p) and t = -sqrt(-p) - sol[0] = -std::sqrt(-p) - b/3; + using std::sqrt; + sol[0] = -sqrt(-p) - b/3; sol[1] = 0.0 - b/3; - sol[2] = std::sqrt(-p) - b/3; + sol[2] = sqrt(-p) - b/3; return 3; } @@ -290,9 +296,9 @@ int invertCubicPolynomial(SolContainer *sol, Scalar wDisc = q*q/4 + p*p*p/27; if (wDisc >= 0) { // the positive discriminant case: // calculate the cube root of - q/2 + sqrt(q^2/4 + p^3/27) - Scalar u = - q/2 + std::sqrt(wDisc); - if (u < 0) u = - std::pow(-u, 1.0/3); - else u = std::pow(u, 1.0/3); + using std::cbrt; + using std::sqrt; + Scalar u = cbrt(-q/2 + sqrt(wDisc)); // at this point, u != 0 since p^3 = 0 is necessary in order // for u = 0 to hold, so @@ -305,10 +311,13 @@ int invertCubicPolynomial(SolContainer *sol, } else { // the negative discriminant case: Scalar uCubedRe = - q/2; - Scalar uCubedIm = std::sqrt(-wDisc); + using std::sqrt; + Scalar uCubedIm = sqrt(-wDisc); // calculate the cube root of - q/2 + sqrt(q^2/4 + p^3/27) - Scalar uAbs = std::pow(std::sqrt(uCubedRe*uCubedRe + uCubedIm*uCubedIm), 1.0/3); - Scalar phi = std::atan2(uCubedIm, uCubedRe)/3; + using std::cbrt; + Scalar uAbs = cbrt(sqrt(uCubedRe*uCubedRe + uCubedIm*uCubedIm)); + using std::atan2; + Scalar phi = atan2(uCubedIm, uCubedRe)/3; // calculate the length and the angle of the primitive root @@ -350,7 +359,8 @@ int invertCubicPolynomial(SolContainer *sol, // values for phi which differ by 2/3*pi. This allows to // calculate the three real roots of the polynomial: for (int i = 0; i < 3; ++i) { - sol[i] = std::cos(phi)*(uAbs - p/(3*uAbs)) - b/3; + using std::cos; + sol[i] = cos(phi)*(uAbs - p/(3*uAbs)) - b/3; phi += 2*M_PI/3; } @@ -359,7 +369,8 @@ int invertCubicPolynomial(SolContainer *sol, invertCubicPolynomialPostProcess_(sol, 3, a, b, c, d); // sort the result - std::sort(sol, sol + 3); + using std::sort; + sort(sol, sol + 3); return 3; } @@ -469,7 +480,21 @@ Scalar antoine(Scalar temperature, Scalar C) { const Scalar ln10 = 2.3025850929940459; - return std::exp(ln10*(A - B/(C + temperature))); + using std::exp; + return exp(ln10*(A - B/(C + temperature))); +} + +/*! + * \brief Sign or signum function. + * + * Returns 1 for a positive argument. + * Returns -1 for a negative argument. + * Returns 0 if the argument is zero. + */ +template +int sign(const ValueType& value) +{ + return (ValueType(0) < value) - (value < ValueType(0)); } /*! diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh index f06f2d1c2cca33615b7c768387faa18c83042c16..9ae02e04c694bb7d1c66a5acd767ad242dffa458 100644 --- a/dumux/common/parameters.hh +++ b/dumux/common/parameters.hh @@ -278,6 +278,10 @@ void print(std::ostream &os = std::cout) const char *getString_(const char *foo = 0) { return foo; } +/*! + * \ingroup Parameter + * \brief Class sorting params and runTimeParams + */ template class Param { diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index 33607ce412e5196831170cb2fb5db56d7b402f44..a7ce7c56936f679dc231c16c6b54874ddc90102e 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -25,6 +25,8 @@ #ifndef DUMUX_POINTSOURCE_HH #define DUMUX_POINTSOURCE_HH +#include + #include #include #include @@ -47,6 +49,10 @@ NEW_PROP_TAG(TimeManager); } // end namespace Properties // forward declarations +/*! + * \ingroup Common + * \brief A point helper class + */ template class PointSourceHelper; diff --git a/dumux/common/reorderingdofmapper.hh b/dumux/common/reorderingdofmapper.hh index e15fc113918c76220131d1245e7b24fd31cf64be..e5883d825abececbaa322ce35a37d6da818689e0 100644 --- a/dumux/common/reorderingdofmapper.hh +++ b/dumux/common/reorderingdofmapper.hh @@ -32,7 +32,9 @@ namespace Dumux { - +/*! + * \brief An SCSG element mapper that sorts the indices in order to optimize the matrix sparsity pattern + */ template class ReorderingDofMapper : public Dune::Mapper, typename GridView::IndexSet::IndexType> diff --git a/dumux/common/splinecommon_.hh b/dumux/common/splinecommon_.hh index c02c972017a8450a93b359e54bfa52750f8c114b..ed99383ebac13f8e1a11653f518bdcfa08d2d694 100644 --- a/dumux/common/splinecommon_.hh +++ b/dumux/common/splinecommon_.hh @@ -23,14 +23,15 @@ #ifndef DUMUX_SPLINE_COMMON__HH #define DUMUX_SPLINE_COMMON__HH +#include #include #include #include #include -#include "valgrind.hh" #include "math.hh" +#include "valgrind.hh" namespace Dumux { @@ -55,19 +56,19 @@ public: bool applies(Scalar x) const { return x_(0) <= x && x <= x_(numSamples_() - 1); - }; + } /*! * \brief Return the x value of the leftmost sampling point. */ Scalar xMin() const - { return x_(0); }; + { return x_(0); } /*! * \brief Return the x value of the rightmost sampling point. */ Scalar xMax() const - { return x_(numSamples_() - 1); }; + { return x_(numSamples_() - 1); } /*! * \brief Prints k tuples of the format (x, y, dx/dy, isMonotonic) @@ -88,8 +89,10 @@ public: */ void printCSV(Scalar xi0, Scalar xi1, int k) const { - Scalar x0 = std::min(xi0, xi1); - Scalar x1 = std::max(xi0, xi1); + using std::max; + using std::min; + Scalar x0 = min(xi0, xi1); + Scalar x1 = max(xi0, xi1); const int n = numSamples_() - 1; for (int i = 0; i <= k; ++i) { double x = i*(x1 - x0)/k + x0; @@ -116,7 +119,7 @@ public: else { y = eval(x); dy_dx = evalDerivative(x); - mono = monotonic(std::max(x_(0), x), std::min(x_(n), x_p1)); + mono = monotonic(max(x_(0), x), min(x_(n), x_p1)); } std::cout << x << " " << y << " " << dy_dx << " " << mono << "\n"; @@ -190,7 +193,7 @@ public: Scalar intersect(Scalar a, Scalar b, Scalar c, Scalar d) const { return intersectIntervall(xMin(), xMax(), a, b, c, d); - }; + } /*! * \brief Find the intersections of the spline with a cubic @@ -222,7 +225,7 @@ public: "Spline has no intersection"); //< x1) - std::swap(x0, x1); - - assert(x0 < x1); + { + using std::swap; + swap(x0, x1); + } // corner case where the whole spline is a constant if (moment_(0) == 0 && @@ -287,7 +291,7 @@ public: protected: // this is an internal class, so everything is protected! SplineCommon_() - { Valgrind::SetUndefined(asImp_()); }; + { Valgrind::SetUndefined(asImp_()); } /*! * \brief Set the sampling point vectors. @@ -551,7 +555,8 @@ protected: // not exhibit any extrema. return (x0*(x0*3*a + 2*b) + c > 0) ? 1 : -1; } - disc = std::sqrt(disc); + using std::sqrt; + disc = sqrt(disc); Scalar xE1 = (-2*b + disc)/(6*a); Scalar xE2 = (-2*b - disc)/(6*a); @@ -562,7 +567,7 @@ protected: // to determine whether we're monotonically increasing // or decreasing x0 = x1; - return (x0*(x0*3*a + 2*b) + c > 0) ? 1 : -1; + return sign(x0*(x0*3*a + 2*b) + c); } if ((x0 < xE1 && xE1 < x1) || (x0 < xE2 && xE2 < x1)) @@ -573,7 +578,7 @@ protected: // no extremum in range (x0, x1) x0 = (x0 + x1)/2; // pick point in the middle of the interval // to avoid extrema on the boundaries - return (x0*(x0*3*a + 2*b) + c > 0) ? 1 : -1; + return sign(x0*(x0*3*a + 2*b) + c); } /*! @@ -590,8 +595,9 @@ protected: b_(segIdx) - b, c_(segIdx) - c, d_(segIdx) - d); - x0 = std::max(x_(segIdx), x0); - x1 = std::max(x_(segIdx+1), x1); + using std::max; + x0 = max(x_(segIdx), x0); + x1 = max(x_(segIdx+1), x1); // filter the intersections outside of the specified intervall int k = 0; diff --git a/dumux/common/tabulated2dfunction.hh b/dumux/common/tabulated2dfunction.hh index a4cdc7a4c6185a55b9508a36bd45abf5f1953fb5..81bcbcb383557fc3b8fe90e2dcadd28bae55511e 100644 --- a/dumux/common/tabulated2dfunction.hh +++ b/dumux/common/tabulated2dfunction.hh @@ -79,7 +79,7 @@ public: yMin_ = yMin; yMax_ = yMax; - }; + } /*! * \brief Return the position on the x-axis of the i-th interval. @@ -89,7 +89,7 @@ public: assert(0 <= i && i < m_); return xMin_ + i*(xMax_ - xMin_)/(m_ - 1); - }; + } /*! * \brief Return the position on the y-axis of the j-th interval. @@ -99,7 +99,7 @@ public: assert(0 <= j && j < n_); return yMin_ + j*(yMax_ - yMin_)/(n_ - 1); - }; + } /*! * \brief Return the interval index of a given position on the x-axis. @@ -112,7 +112,7 @@ public: Scalar xToI(Scalar x) const { return (x - xMin_)/(xMax_ - xMin_)*m_; - }; + } /*! @@ -126,7 +126,7 @@ public: Scalar yToJ(Scalar y) const { return (y - yMin_)/(yMax_ - yMin_)*n_; - }; + } /*! @@ -140,7 +140,7 @@ public: assert(0 <= j && j < n_); return samples_[j*m_ + i]; - }; + } /*! * \brief Set the value of the sample point which is at the @@ -153,7 +153,7 @@ public: assert(0 <= j && j < n_); samples_[j*m_ + i] = value; - }; + } /*! * \brief Return an interpolated value. @@ -163,8 +163,10 @@ public: Scalar alpha = xToI(x); Scalar beta = yToJ(y); - int i = std::max(0, std::min(m_, static_cast(alpha))); - int j = std::max(0, std::min(n_, static_cast(beta))); + using std::max; + using std::min; + int i = max(0, min(m_, static_cast(alpha))); + int j = max(0, min(n_, static_cast(beta))); alpha -= i; beta -= j; diff --git a/dumux/common/timemanager.hh b/dumux/common/timemanager.hh index 0fe4b470b0e4c2e4f208c1e636ada15a04f008e0..9b93ff399dba98564267dcdae8e575759c38ad1c 100644 --- a/dumux/common/timemanager.hh +++ b/dumux/common/timemanager.hh @@ -23,6 +23,8 @@ #ifndef DUMUX_TIME_MANAGER_HH #define DUMUX_TIME_MANAGER_HH +#include + #include #include #include @@ -201,7 +203,10 @@ public: * \param dt The new value for the time step size \f$\mathrm{[s]}\f$ */ void setTimeStepSize(Scalar dt) - { timeStepSize_ = std::min(dt, maxTimeStepSize()); } + { + using std::min; + timeStepSize_ = min(dt, maxTimeStepSize()); + } /*! * \brief Returns the suggested time step length \f$\mathrm{[s]}\f$ so that we @@ -259,10 +264,11 @@ public: if (finished()) return 0.0; - return - std::min(std::min(episodeMaxTimeStepSize(), - problem_->maxTimeStepSize()), - std::max(0.0, endTime() - time())); + using std::max; + using std::min; + return min(min(episodeMaxTimeStepSize(), + problem_->maxTimeStepSize()), + max(0.0, endTime() - time())); } /* @@ -331,17 +337,16 @@ public: * \brief Returns true if the current episode is finished at the * current time. */ - bool episodeIsOver() const + bool episodeIsFinished() const { return time() >= episodeStartTime_ + episodeLength(); } /*! * \brief Returns true if the current episode will be finished * after the current time step. */ - bool episodeWillBeOver() const + bool episodeWillBeFinished() const { return time() + timeStepSize() >= episodeStartTime_ + episodeLength(); } - /*! * \brief Aligns the time step size to the episode boundary if the * current time step crosses the boundary of the current episode. @@ -352,14 +357,13 @@ public: // wants to give it some extra time, we will return // the time step size it suggested instead of trying // to align it to the end of the episode. - if (episodeIsOver()) + if (episodeIsFinished()) return 0.0; // make sure that we don't exceed the end of the // current episode. - return - std::max(0.0, - episodeLength() - (time() - episodeStartTime())); + using std::max; + return max(0.0, episodeLength() - (time() - episodeStartTime())); } /* @@ -396,6 +400,10 @@ public: // prepare the model for the next time integration problem_->advanceTimeLevel(); + // write restart file if mandated by the problem + if (problem_->shouldWriteRestartFile()) + problem_->serialize(); + // advance the simulated time by the current time step size time_ += dt; ++timeStepIdx_; @@ -409,12 +417,8 @@ public: <<"\n"; } - // write restart file if mandated by the problem - if (problem_->shouldWriteRestartFile()) - problem_->serialize(); - // notify the problem if an episode is finished - if (episodeIsOver()) { + if (episodeIsFinished()) { //define what to do at the end of an episode in the problem problem_->episodeEnd(); @@ -422,7 +426,8 @@ public: if (Dune::FloatCmp::eq(dt, timeStepSize())) { // set the initial time step size of a an episode to the last real time step size before the episode - Scalar nextDt = std::max(previousTimeStepSize_, timeStepSize()); + using std::max; + Scalar nextDt = max(previousTimeStepSize_, timeStepSize()); previousTimeStepSize_ = nextDt; setTimeStepSize(nextDt); } @@ -463,8 +468,8 @@ public: res.serializeStream() << episodeIndex_ << " " << episodeStartTime_ << " " << episodeLength_ << " " - << time_ << " " - << timeStepIdx_ << " "; + << time_ + timeStepSize() << " " + << timeStepIdx_ + 1 << " "; res.serializeSectionEnd(); } diff --git a/dumux/freeflow/boundarylayermodel.hh b/dumux/freeflow/boundarylayermodel.hh index 7ffb70f0e288f0e260a481b8f78a9af35e46584b..5f4ce929375e83e15430ecff9aeb5c1186202e21 100644 --- a/dumux/freeflow/boundarylayermodel.hh +++ b/dumux/freeflow/boundarylayermodel.hh @@ -101,6 +101,10 @@ public: Scalar reynoldsX = velocity_ * distance_ / kinematicViscosity_; Scalar reynoldsD = velocity_ * hydraulicDiamater_ / kinematicViscosity_; + using std::sqrt; + using std::pow; + using std::log10; + // no boundary layer model if (boundaryLayerModel_ == 0) { @@ -116,20 +120,20 @@ public: // laminar: Blasius (analytical solution) else if (boundaryLayerModel_ == 2) { - boundaryLayerThickness = 5.0 * distance_ / std::sqrt(reynoldsX); + boundaryLayerThickness = 5.0 * distance_ / sqrt(reynoldsX); } // turbulent, smooth: turbulent boundary layer thickness // source: http://en.wikipedia.org/wiki/Boundary_layer_thickness else if (boundaryLayerModel_ == 3) { - boundaryLayerThickness = 0.37 * distance_ / std::pow(reynoldsX, 0.2); + boundaryLayerThickness = 0.37 * distance_ / pow(reynoldsX, 0.2); } // turbulent, smooth: viscous sublayer thickness via friction coefficient (after Schultz-Grunow) // source: Pope, S. B. Turbulent flows Cambridge University Press, 2006, XXXIV, p. 307 else if (boundaryLayerModel_ == 4) { - Scalar cf = 0.37 * std::pow(std::log10(reynoldsX), -2.584); - boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * std::sqrt(cf / 2.0)); + Scalar cf = 0.37 * pow(log10(reynoldsX), -2.584); + boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * sqrt(cf / 2.0)); } // turbulent, fully rough: viscous sublayer thickness via friction coefficient // source: Truckenbrodt, E. Elementare Strömungsvorgänge dichteveränderlicher Fluide Fluidmechanik, @@ -140,13 +144,13 @@ public: assert (roughnessLength_ > 1e-10); // application is bounded to specific roughness length assert (1e-6 < roughnessLength_ / distance_ && roughnessLength_ / distance_ < 1e-2); - Scalar cf = std::pow(1.89 - 1.62 * std::log10(roughnessLength_ / distance_), -2.5); + Scalar cf = pow(1.89 - 1.62 * log10(roughnessLength_ / distance_), -2.5); // application is bounded to rough cases, indicated by the line in the chart in Truckenbrodt // NOTE: disabling the assertion assumes that the cf of the hydrodynamically // rough region is a good approximation of the cf in the hydrodynamically // smooth case - assert (130.0e-3 * std::pow(reynoldsX, -0.1872) < cf); - boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * std::sqrt(cf / 2.0)); + assert (130.0e-3 * pow(reynoldsX, -0.1872) < cf); + boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * sqrt(cf / 2.0)); } // turbulent, fully rough: viscous sublayer thickness via friction coefficient // source: Truckenbrodt, E. Elementare Strömungsvorgänge dichteveränderlicher Fluide Fluidmechanik, @@ -155,8 +159,8 @@ public: { // roughness length has to be positive assert (roughnessLength_ > 1e-10); - Scalar cf = 0.024 * std::pow(roughnessLength_ / distance_, 1.0/6.0); - boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * std::sqrt(cf / 2.0)); + Scalar cf = 0.024 * pow(roughnessLength_ / distance_, 1.0/6.0); + boundaryLayerThickness = yPlus_ * distance_ / (reynoldsX * sqrt(cf / 2.0)); } // turbulent, smooth, aerodynamically smooth and aerodynamically rough // estimation of the viscous sublayer thickness via friction factor @@ -172,10 +176,10 @@ public: assert (roughnessLength_ > 1e-10); // hydraulic diameter has to be positive assert (hydraulicDiamater_ > 1e-10); - Scalar sqrtF = 1.0 / (-1.8 * std::log10(std::pow(roughnessLength_ / hydraulicDiamater_ / 3.7, 1.11) + Scalar sqrtF = 1.0 / (-1.8 * log10(pow(roughnessLength_ / hydraulicDiamater_ / 3.7, 1.11) + 6.9 / reynoldsD)); boundaryLayerThickness = yPlus_ * distance_ - / (reynoldsX * std::sqrt(0.25 * sqrtF * sqrtF / 2.0)); + / (reynoldsX * sqrt(0.25 * sqrtF * sqrtF / 2.0)); // assert we are not in the fully rough case assert (roughnessLength_ < boundaryLayerThickness); } diff --git a/dumux/freeflow/masstransfermodel.hh b/dumux/freeflow/masstransfermodel.hh index 4d14ac40138c395c10019431ab5c1fcd74db7540..b170f2e7c1e726b82cc92ff0ceeacffabe9dc71d 100644 --- a/dumux/freeflow/masstransfermodel.hh +++ b/dumux/freeflow/masstransfermodel.hh @@ -20,6 +20,8 @@ * \file * \brief This files contains a class to adapt the mass transfer in the * boundary layer of the free flow, near to a porous-interface. + * + * This model bases on work published by Schlünder 1988 \cite Schluender1988a. */ #ifndef DUMUX_MASS_TRANSFER_MODEL_HH #define DUMUX_MASS_TRANSFER_MODEL_HH @@ -29,17 +31,13 @@ namespace Dumux { -/*! - * \brief This files contains a class to adapt the mass transfer in the - * boundary layer of the free flow, near to a porous-interface. - */ template class MassTransferModel { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; /*! - * \brief This files contains a class to adapt the mass transfer in the + * \brief This class adapts the mass transfer in the * boundary layer of the free flow, near to a porous-interface. * * \param saturation Saturation of the component's phase inside the porous medium @@ -80,7 +78,7 @@ public: * Provides different options for the determining the mass transfer coefficient:
* 0) no mass transfer model
* 1) exponential law with a saturation as base and a mass transfer coefficient as exponent
- * 2) the conventional Schlünder model with one characteristic pore size
+ * 2) the conventional Schlünder \cite Schluender1988a model with one characteristic pore size
* 3) the Schlünder model with a variable characteristic pore size deduced from the * two-phase relations (Van Genuchten curve)
* 4) a manually adapted Schlünder model @@ -89,6 +87,9 @@ public: { Scalar massTransferCoeff = 1.0; + using std::sqrt; + using std::pow; + // no mass transfer model if (massTransferModel_ == 0) { @@ -99,7 +100,7 @@ public: { // use meaningful transfer coefficients assert (0 < massTransferCoeff_ && massTransferCoeff_ < 1.0); - massTransferCoeff = std::pow(saturation_, massTransferCoeff_); + massTransferCoeff = pow(saturation_, massTransferCoeff_); } // Schlünder model (Schlünder, CES 1988) else if (massTransferModel_ == 2) @@ -107,8 +108,8 @@ public: // check if characteristic pore radius was set assert (charPoreRadius_ < 9e9); massTransferCoeff = 1. + 2./M_PI * charPoreRadius_ / blThickness_ - * std::sqrt(M_PI/(4.*moistureContent_)) - * (std::sqrt(M_PI/(4.*moistureContent_)) - 1.); + * sqrt(M_PI/(4.*moistureContent_)) + * (sqrt(M_PI/(4.*moistureContent_)) - 1.); massTransferCoeff = 1./massTransferCoeff; } @@ -121,8 +122,8 @@ public: Scalar charPoreRadius = 2 * surfaceTension / capillaryPressure_; massTransferCoeff = 1. + 2./M_PI * charPoreRadius / blThickness_ - * std::sqrt(M_PI/(4.*moistureContent_)) - * (std::sqrt(M_PI/(4.*moistureContent_)) - 1.); + * sqrt(M_PI/(4.*moistureContent_)) + * (sqrt(M_PI/(4.*moistureContent_)) - 1.); massTransferCoeff = 1./massTransferCoeff; } diff --git a/dumux/freeflow/stokes/fluxvariables.hh b/dumux/freeflow/stokes/fluxvariables.hh index 98fd0c743fd6fee63541e12a9b0f5c7e60eb66dd..3a44cb7cdd11c6fc3a53e057f84dfb6b1953d8ef 100644 --- a/dumux/freeflow/stokes/fluxvariables.hh +++ b/dumux/freeflow/stokes/fluxvariables.hh @@ -171,7 +171,10 @@ protected: downstreamIdx_ = face().j; if (normalVelocity() < 0) - std::swap(upstreamIdx_, downstreamIdx_); + { + using std::swap; + swap(upstreamIdx_, downstreamIdx_); + } } public: diff --git a/dumux/freeflow/stokes/localjacobian.hh b/dumux/freeflow/stokes/localjacobian.hh index 5e4119fca880169dd486623f1c0e3c47f8f1dc1d..241bf741de0243b8e89afd8fb7425a5a7f101749 100644 --- a/dumux/freeflow/stokes/localjacobian.hh +++ b/dumux/freeflow/stokes/localjacobian.hh @@ -49,10 +49,11 @@ public: const int pvIdx) const { Scalar pv = this->curVolVars_[scvIdx].priVars()[pvIdx]; + using std::abs; if (pvIdx < GridView::dimension){ - return 1e-7*(std::abs(pv) + 1); + return 1e-7*(abs(pv) + 1); } - return 1e-9*(std::abs(pv) + 1); + return 1e-9*(abs(pv) + 1); } }; } diff --git a/dumux/freeflow/stokesnc/localresidual.hh b/dumux/freeflow/stokesnc/localresidual.hh index b23474c4a3446aaa03c5ecf6d1082dcb2b86aabe..44321052a98e13e1c78df617c651122cb39ca009 100644 --- a/dumux/freeflow/stokesnc/localresidual.hh +++ b/dumux/freeflow/stokesnc/localresidual.hh @@ -207,21 +207,26 @@ public: { if (conti0EqIdx+compIdx != massBalanceIdx) { - flux[conti0EqIdx+compIdx] -= fluxVars.moleFractionGrad(compIdx) - * fluxVars.face().normal - * (fluxVars.diffusionCoeff(compIdx) + fluxVars.eddyDiffusivity()) - * fluxVars.molarDensity(); + flux[conti0EqIdx+compIdx] += -(fluxVars.moleFractionGrad(compIdx) * fluxVars.face().normal) + * (fluxVars.diffusionCoeff(compIdx) + fluxVars.eddyDiffusivity()) + * fluxVars.molarDensity(); Valgrind::CheckDefined(flux[conti0EqIdx+compIdx]); } } } else { - flux[transportEqIdx] -= fluxVars.moleFractionGrad(transportCompIdx) - * fluxVars.face().normal - * (fluxVars.diffusionCoeff(transportCompIdx) + fluxVars.eddyDiffusivity()) - * fluxVars.molarDensity() - * FluidSystem::molarMass(transportCompIdx);// Multiplied by molarMass [kg/mol] to convert form [mol/m^3 s] to [kg/m^3 s] + Scalar diffusiveMolarFlux = -(fluxVars.moleFractionGrad(transportCompIdx) * fluxVars.face().normal) + * (fluxVars.diffusionCoeff(transportCompIdx) + fluxVars.eddyDiffusivity()) + * fluxVars.molarDensity(); + // Multiply by molarMass [kg/mol] to convert form [mol/m^3 s] to [kg/m^3 s] + flux[transportEqIdx] += diffusiveMolarFlux * FluidSystem::molarMass(transportCompIdx); + // Add the diffusive fluxes to the total mass balance, this is necessary as + // diffusive mole fluxes cancel out, but not the diffusive mass fluxes + // NOTE: for the phaseCompIdx the diffusiveMolarFlux is inverted, because it was calculated + // by moleFractionGrad(transportCompIdx) + flux[massBalanceIdx] += diffusiveMolarFlux * FluidSystem::molarMass(transportCompIdx); + flux[massBalanceIdx] += -diffusiveMolarFlux * FluidSystem::molarMass(phaseCompIdx); Valgrind::CheckDefined(flux[transportEqIdx]); } } diff --git a/dumux/freeflow/stokesnc/model.hh b/dumux/freeflow/stokesnc/model.hh index 6d0c28882323e4ee3e66e8ab3db87028de33f751..d0ab9cff344b6699fa23dcb4e292b0aa5c12e6a5 100644 --- a/dumux/freeflow/stokesnc/model.hh +++ b/dumux/freeflow/stokesnc/model.hh @@ -35,7 +35,7 @@ namespace Dumux { * \brief Adaption of the box scheme to the compositional Stokes model. * * This model implements an isothermal n-component Stokes flow of a fluid - * solving a momentum balance, a mass balance and conservation equations for \f$n-1\f$ + * solving a momentum balance, a total mass balance and conservation equations for \f$n-1\f$ * components. When using mole fractions naturally the densities represent molar * densities * @@ -54,10 +54,14 @@ namespace Dumux { * \f] * is added to the momentum balance equation. * - * The mass balance equation: + * The total mass balance equation: * \f[ * \frac{\partial \varrho_g}{\partial t} - * + \text{div} \left(\varrho_g {\boldsymbol{v}}_g\right) - q_g = 0 + * + \text{div} \left( + * \varrho_g {\boldsymbol{v}}_g + * - \sum_\kappa D^\kappa_g \varrho_g \frac{M^\kappa}{M_g} \textbf{grad}\, x_g^\kappa + * \right) + * - q_g = 0 * \f] * * The component mass balance equations: @@ -96,6 +100,12 @@ class StokesncModel : public StokesModel public: + StokesncModel() + { + static_assert(useMoles || numComponents < 3, + "This model is restricted to 2 components when using mass fractions! To use mole fractions set property UseMoles true."); + } + //! \copydoc ImplicitModel::addOutputVtkFields template void addOutputVtkFields(const SolutionVector &sol, diff --git a/dumux/freeflow/stokesnc/volumevariables.hh b/dumux/freeflow/stokesnc/volumevariables.hh index 13819e5c29a09146d09647bfa1c694371d9a5d66..df2faef099d6b2bdb624de81690f7e3ec5cce57b 100644 --- a/dumux/freeflow/stokesnc/volumevariables.hh +++ b/dumux/freeflow/stokesnc/volumevariables.hh @@ -81,14 +81,6 @@ public: const int scvIdx, const bool isOldSol) { - - // Model is restricted to 2 components when using mass fractions - if (!useMoles && numComponents>2) - { - DUNE_THROW(Dune::NotImplemented, "This model is restricted to 2 components when using mass fractions!\ - To use mole fractions set property UseMoles true ..."); - } - // set the mole fractions first completeFluidState(priVars, problem, element, fvGeometry, scvIdx, this->fluidState(), isOldSol); diff --git a/dumux/freeflow/stokesncni/model.hh b/dumux/freeflow/stokesncni/model.hh index 7e5d83834db58842616b949a36bc6ca6e964cb59..4c10bd69fd46e9ad8bcbe96f18ed62e676b12dfe 100644 --- a/dumux/freeflow/stokesncni/model.hh +++ b/dumux/freeflow/stokesncni/model.hh @@ -37,7 +37,7 @@ namespace Dumux { * n-component Stokes model. * * This model implements a non-isothermal n-component Stokes flow of a fluid - * solving a momentum balance, a mass balance, conservation equations for \f$n-1\f$ components, + * solving a momentum balance, a total mass balance, conservation equations for \f$n-1\f$ components, * and one balance equation for the energy. * * The momentum balance: @@ -55,10 +55,14 @@ namespace Dumux { * \f] * is added to the momentum balance equation. * - * The mass balance equation: + * The total mass balance equation: * \f[ * \frac{\partial \varrho_g}{\partial t} - * + \text{div} \left(\varrho_g {\boldsymbol{v}}_g\right) - q_g = 0 + * + \text{div} \left( + * \varrho_g {\boldsymbol{v}}_g + * - \sum_\kappa D^\kappa_g \varrho_g \frac{M^\kappa}{M_g} \textbf{grad}\, x_g^\kappa + * \right) + * - q_g = 0 * \f] * * The component mass balance equations: @@ -75,8 +79,7 @@ namespace Dumux { * \f[ * \frac{\partial (\varrho_g u_g)}{\partial t} * + \text{div} \left( \varrho_g h_g {\boldsymbol{v}}_g - * - \sum_\kappa \left[ h^\kappa_g D^\kappa_g \varrho_g \frac{M^\kappa}{M_g} - * \textbf{grad}\, x^\kappa_g \right] + * - \sum_\kappa h^\kappa_g D^\kappa_g \varrho_g \frac{M^\kappa}{M_g} \textbf{grad}\, x^\kappa_g * - \lambda_g \textbf{grad}\, T \right) - q_T = 0 * \f] * diff --git a/dumux/freeflow/turbulenceproperties.hh b/dumux/freeflow/turbulenceproperties.hh new file mode 100644 index 0000000000000000000000000000000000000000..211abd2a6dac42bd52486a98c2a9c7adddd39ec1 --- /dev/null +++ b/dumux/freeflow/turbulenceproperties.hh @@ -0,0 +1,224 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program. If not, see . * + *****************************************************************************/ +/** \file + * \brief This file contains different functions for estimating turbulence properties. + */ + +#ifndef DUMUX_TURBULENCE_PROPERTIES_HH +#define DUMUX_TURBULENCE_PROPERTIES_HH + +#include + +namespace Dumux { + +/** + * \brief This class contains different functions for estimating turbulence properties. + */ +template +class TurbulenceProperties +{ +public: + + //! \brief Constructor + TurbulenceProperties() + { } + + /** + * \brief Estimates dimensionless wall distance \f$ y^+ \f$ based on a formula given in + * http://www.cfd-online.com/Wiki/Y_plus_wall_distance_estimation + */ + Scalar yPlusEstimation(const Scalar velocity, + const Dune::FieldVector position, + const Scalar kinematicViscosity, + const Scalar density, + int yCoordDim=dim-1, + bool print=verbose) const + { + using std::pow; + using std::log10; + using std::sqrt; + const Scalar re_x = reynoldsNumber(velocity, position[0], kinematicViscosity, false); + const Scalar c_f = pow((2.0 * log10(re_x) - 0.65), -2.3); // for re_x < 10^9 + const Scalar wallShearStress = 0.5 * c_f * density * velocity * velocity; + const Scalar frictionVelocity = sqrt(wallShearStress / density); + const Scalar yPlus = position[yCoordDim] * frictionVelocity / kinematicViscosity; + if (print) + { + std::cout << "turbulence properties at ("; + for (unsigned int dimIdx = 0; dimIdx < dim; ++dimIdx) + std::cout << position[dimIdx] << ","; + std::cout << ")" << std::endl; + std::cout << "estimated Re_x : " << re_x << " [-]" << std::endl; + std::cout << "estimated c_f : " << c_f << " [-]" << std::endl; + std::cout << "estimated tau_w : " << wallShearStress << " [kg/(m*s^2)]" << std::endl; + std::cout << "estimated UStar : " << frictionVelocity << " [m/s]" << std::endl; + std::cout << "estimated yPlus : " << yPlus << " [-]" << std::endl; + std::cout << std::endl; + } + return yPlus; + } + + /** + * \brief Estimates the entrance length for this pipe + */ + Scalar entranceLength(const Scalar velocity, + const Scalar diameter, + const Scalar kinematicViscosity, + bool print=verbose) const + { + using std::pow; + const Scalar re_d = reynoldsNumber(velocity, diameter, kinematicViscosity, false); + const Scalar entranceLength = 4.4 * pow(re_d, 1.0/6.0) * diameter; + if (print) + { + std::cout << "estimated Re_d : " << re_d << " [-]" << std::endl; + std::cout << "estimated l_ent : " << entranceLength << " [m]"<< std::endl; + std::cout << std::endl; + } + return entranceLength; + } + + /** + * \brief Calculates the Reynolds number + */ + Scalar reynoldsNumber(const Scalar velocity, + const Scalar charLengthScale/*e.g. diameter*/, + const Scalar kinematicViscosity, + bool print=verbose) const + { + return velocity * charLengthScale / kinematicViscosity; + } + + /** + * \brief Estimates the turbulence intensity based on a formula given + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + */ + Scalar turbulenceIntensity(const Scalar reynoldsNumber, + bool print=verbose) const + { + using std::pow; + const Scalar turbulenceIntensity = 0.16 * pow(reynoldsNumber, -0.125); + if (print) + { + std::cout << "estimated I : " << turbulenceIntensity << " [-]" << std::endl; + } + return turbulenceIntensity; + } + + /** + * \brief Estimates the turbulence length scale based on a formula given + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + */ + Scalar turbulenceLengthScale(const Scalar charLengthScale/*e.g. diameter*/, + bool print=verbose) const + { + const Scalar turbulenceLengthScale = 0.07 * charLengthScale; + if (print) + { + std::cout << "estimated l_turb: " << turbulenceLengthScale << " [m]" << std::endl; + } + return turbulenceLengthScale; + } + + /** + * \brief Estimates the turbulent kinetic energy based on a formula given + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + */ + Scalar turbulentKineticEnergy(const Scalar velocity, + const Scalar diameter, + const Scalar kinematicViscosity, + bool print=verbose) const + { + const Scalar re_d = reynoldsNumber(velocity, diameter, kinematicViscosity, false); + const Scalar k = 1.5 * velocity * velocity + * turbulenceIntensity(re_d, false) * turbulenceIntensity(re_d, false); + if (print) + { + std::cout << "estimated k : " << k << " [m^2/s^2]" << std::endl; + } + return k; + } + + /** + * \brief Estimates the dissipation based on a formula given + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + */ + Scalar dissipation(const Scalar velocity, + const Scalar diameter, + const Scalar kinematicViscosity, + bool print=verbose) const + { + using std::pow; + const Scalar k = turbulentKineticEnergy(velocity, diameter, kinematicViscosity, false); + const Scalar factor = 0.1643; // = cMu^(3/4) = 0.09^(3/4) + const Scalar epsilon = factor * pow(k, 1.5) / turbulenceLengthScale(diameter, false); + if (print) + { + std::cout << "estimated eps. : " << epsilon << " [m^2/s^3]" << std::endl; + } + return epsilon; + } + + /** + * \brief Estimates the dissipation rate based on a formula given + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + * \f[ \omega = \frac{k^{1/2}}{C_{\mu}^{1/4}L} \f] + */ + Scalar dissipationRate(const Scalar velocity, + const Scalar diameter, + const Scalar kinematicViscosity, + bool print=verbose) const + { + using std::pow; + const Scalar k = turbulentKineticEnergy(velocity, diameter, kinematicViscosity, false); + const Scalar factor = 0.54772; // = cMu^(1/4) = 0.09^(1/4) + const Scalar L = turbulenceLengthScale(diameter , false); + const Scalar omega = pow(k, 0.5) / (L*factor); + if (print) + { + std::cout << "estimated Omega : " << omega << " [1/s]" << std::endl; + + } + return omega; + } + + /** + * \brief Estimates the viscosity tilde based on a formula given in + * in the ANSYS Fluent user guide \cite ANSYSUserGuide12 + */ + Scalar viscosityTilde(const Scalar velocity, + const Scalar diameter, + const Scalar kinematicViscosity, + bool print=verbose) const + { + using std::sqrt; + const Scalar re_d = reynoldsNumber(velocity, diameter, kinematicViscosity, false); + const Scalar viscosityTilde = sqrt(1.5) * velocity + * turbulenceIntensity(re_d) + * turbulenceLengthScale(diameter); + if (print) + { + std::cout << "estimated nu~ : " << viscosityTilde << " [m^2/s]" << std::endl; + } + return viscosityTilde; + } +}; +} // end namespace Dumux + +#endif // DUMUX_TURBULENCE_PROPERTIES_HH diff --git a/dumux/freeflow/zeroeq/fluxvariables.hh b/dumux/freeflow/zeroeq/fluxvariables.hh index 42dea265b0fd7a001ae9de9f2f5aaceebcaf0647..4f6b1663f7ea7592a2bc183b6ea1ee07ba7ae3fe 100644 --- a/dumux/freeflow/zeroeq/fluxvariables.hh +++ b/dumux/freeflow/zeroeq/fluxvariables.hh @@ -95,13 +95,15 @@ public: fz_ = 0.0; posIdx_ = problem.model().getPosIdx(globalPos()); wallIdx_ = problem.model().getWallIdx(globalPos(), posIdx_); - distanceToWallRough_ = std::abs(problem.model().distanceToWallRough(globalPos(), wallIdx_, posIdx_)); - distanceToWallReal_ = std::abs(problem.model().distanceToWallReal(globalPos(), wallIdx_, posIdx_)); + using std::abs; + distanceToWallRough_ = abs(problem.model().distanceToWallRough(globalPos(), wallIdx_, posIdx_)); + distanceToWallReal_ = abs(problem.model().distanceToWallReal(globalPos(), wallIdx_, posIdx_)); for (int dimIdx = 0; dimIdx < dim; ++dimIdx) maxVelocity_[dimIdx] = problem.model().wall[wallIdx_].maxVelocity[posIdx_][dimIdx]; for (int dimIdx = 0; dimIdx < dim; ++dimIdx) minVelocity_[dimIdx] = problem.model().wall[wallIdx_].minVelocity[posIdx_][dimIdx]; velGrad_ = this->velocityGrad_[flowNormal_][wallNormal_]; + using std::sqrt; frictionVelocityWall_ = sqrt(problem.model().wall[wallIdx_].wallShearStress[posIdx_] / problem.model().wall[wallIdx_].wallDensity[posIdx_]); yPlusRough_ = distanceToWallRough_ * frictionVelocityWall_ / problem.model().wall[wallIdx_].wallKinematicViscosity[posIdx_]; @@ -130,6 +132,11 @@ protected: const Element &element, const ElementVolumeVariables &elemVolVars) { + using std::sqrt; + using std::abs; + using std::pow; + using std::exp; + // no turbulence model if (eddyViscosityModel_ == EddyViscosityIndices::noEddyViscosityModel) return; @@ -139,7 +146,7 @@ protected: else if (eddyViscosityModel_ == EddyViscosityIndices::prandtl) { mixingLength_ = distanceToWallRough_ * karmanConstant_; - dynamicEddyViscosity_ = this->density() * mixingLength() * mixingLength() * std::abs(velGrad_); + dynamicEddyViscosity_ = this->density() * mixingLength() * mixingLength() * abs(velGrad_); } // modified Van-Driest @@ -152,10 +159,10 @@ protected: mixingLength_ = 0.0; if (distanceToWallRough_ > 0.0 && yPlusRough_ > 0.0) mixingLength_= karmanConstant_ * distanceToWallRough_ - * (1.0 - std::exp(-yPlusRough_ / aPlus )) - / std::sqrt(1.0 - std::exp(-bPlus * yPlusRough_)); + * (1.0 - exp(-yPlusRough_ / aPlus )) + / sqrt(1.0 - exp(-bPlus * yPlusRough_)); - dynamicEddyViscosity_ = this->density() * mixingLength() * mixingLength() * std::abs(velGrad_); + dynamicEddyViscosity_ = this->density() * mixingLength() * mixingLength() * abs(velGrad_); } // Baldwin and Lomax @@ -174,7 +181,7 @@ protected: mixingLength_ = 0.0; if (distanceToWallRough_ > 0.0 && yPlusRough_ > 0.0) mixingLength_ = karmanConstant_ * distanceToWallRough_ - * (1.0 - std::exp(-yPlusRough_ / aPlus )); + * (1.0 - exp(-yPlusRough_ / aPlus )); Scalar omega1 = this->velocityGrad_[0][1] - this->velocityGrad_[1][0]; Scalar omega2 = 0.0; Scalar omega3 = 0.0; @@ -189,15 +196,16 @@ protected: // Calculate muOuter fz_ = 0.0; if (distanceToWallRough_ > 0.0 && yPlusRough_ > 0.0) - fz_ = distanceToWallRough_ * omega * (1.0 - std::exp(-yPlusRough_ / aPlus )); + fz_ = distanceToWallRough_ * omega * (1.0 - exp(-yPlusRough_ / aPlus )); Scalar fMax = problem.model().wall[wallIdx_].fMax[posIdx_]; - Scalar yMax = std::abs(problem.model().wall[wallIdx_].yMax[posIdx_]); + Scalar yMax = abs(problem.model().wall[wallIdx_].yMax[posIdx_]); Scalar uDiff = maxVelocity_.two_norm() - minVelocity_.two_norm(); Scalar f1 = yMax * fMax; Scalar f2 = cWK * yMax * uDiff * uDiff / fMax; - Scalar fWake = fmin(f1, f2); - Scalar fKleb = 1 / (1 + 5.5 * std::pow(cKleb * distanceToWallRough_ / yMax, 6.0)); + using std::min; + Scalar fWake = min(f1, f2); + Scalar fKleb = 1 / (1 + 5.5 * pow(cKleb * distanceToWallRough_ / yMax, 6.0)); dynamicEddyViscosityOuter_ = this->density() * kUpper * cCP * fWake * fKleb; bool inner = problem.model().useViscosityInner(this->face().ipGlobal, posIdx_); diff --git a/dumux/freeflow/zeroeq/model.hh b/dumux/freeflow/zeroeq/model.hh index 53f1d2c356640f9c076af783239c9c04927a9fb7..24b963ce5c5d350cfea0ef110c9968eac190d913 100644 --- a/dumux/freeflow/zeroeq/model.hh +++ b/dumux/freeflow/zeroeq/model.hh @@ -530,6 +530,9 @@ public: if (GET_PARAM_FROM_GROUP(TypeTag, Scalar, ZeroEq, BBoxMaxSandGrainRoughness) < eps_&& !wall[wallIdx].isBBoxMinWall) { return distanceToWallReal (globalPos, wallIdx, posIdx); } + using std::sqrt; + using std::exp; + using std::abs; Scalar ksPlus = wall[wallIdx].sandGrainRoughness[posIdx] * sqrt(wall[wallIdx].wallShearStress[posIdx] / wall[wallIdx].wallDensity[posIdx]) / wall[wallIdx].wallKinematicViscosity[posIdx]; @@ -554,7 +557,7 @@ public: delta = 0.9 * wall[wallIdx].wallKinematicViscosity[posIdx] / sqrt(wall[wallIdx].wallShearStress[posIdx] / wall[wallIdx].wallDensity[posIdx]) * (sqrt(ksPlus) - ksPlus * exp(- 1.0 * ksPlus / 6.0)); } - int sign = std::abs(globalPos[wallNormal_] - wall[wallIdx].wallPos[posIdx]) / (globalPos[wallNormal_] - wall[wallIdx].wallPos[posIdx]); + int sign = abs(globalPos[wallNormal_] - wall[wallIdx].wallPos[posIdx]) / (globalPos[wallNormal_] - wall[wallIdx].wallPos[posIdx]); return globalPos[wallNormal_] - wall[wallIdx].wallPos[posIdx] + sign * delta; } @@ -629,22 +632,23 @@ public: { int posIdx = getPosIdx(globalPos); int wallIdx = getWallIdx(globalPos, posIdx); + using std::abs; for (int dimIdx = 0; dimIdx < dim; ++dimIdx) { - if (std::abs(wall[wallIdx].maxVelocity[posIdx][dimIdx]) < std::abs(fluxVars.velocity()[dimIdx])) + if (abs(wall[wallIdx].maxVelocity[posIdx][dimIdx]) < abs(fluxVars.velocity()[dimIdx])) { wall[wallIdx].maxVelocity[posIdx][dimIdx] = fluxVars.velocity()[dimIdx]; // // if the values in the middle should be set on both wall // for (int wIdx = 0; wIdx < wall.size(); ++wIdx) -// if (std::abs(distanceToWallReal(globalPos, wallIdx, posIdx)) < std::abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-5)) +// if (abs(distanceToWallReal(globalPos, wallIdx, posIdx)) < abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-5)) // wall[wIdx].maxVelocity[posIdx][dimIdx] = fluxVars.velocity()[dimIdx]; // set it as maxVelocityAbs - if (std::abs(wall[wallIdx].maxVelocityAbs[posIdx][dimIdx]) < std::abs(fluxVars.velocity()[dimIdx])) + if (abs(wall[wallIdx].maxVelocityAbs[posIdx][dimIdx]) < abs(fluxVars.velocity()[dimIdx])) for (int wIdx = 0; wIdx < wall.size(); ++wIdx) wall[wIdx].maxVelocityAbs[posIdx][dimIdx] = fluxVars.velocity()[dimIdx]; wall[wallIdx].fluxValuesCount[posIdx]++; } - if (std::abs(wall[wallIdx].minVelocity[posIdx][dimIdx]) > std::abs(fluxVars.velocity()[dimIdx])) + if (abs(wall[wallIdx].minVelocity[posIdx][dimIdx]) > abs(fluxVars.velocity()[dimIdx])) wall[wallIdx].minVelocity[posIdx][dimIdx] = fluxVars.velocity()[dimIdx]; } @@ -655,7 +659,7 @@ public: wall[wallIdx].yMax[posIdx] = distanceToWallRough(globalPos, wallIdx, posIdx); // // if the values in the middle should be set on both wall // for (int wIdx = 0; wIdx < wall.size(); ++wIdx) -// if (std::abs(distanceToWall(globalPos, wIdx, posIdx)) < std::abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-4)) +// if (abs(distanceToWall(globalPos, wIdx, posIdx)) < abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-4)) // { // wall[wIdx].fMax[posIdx] = fluxVars.fz(); // wall[wIdx].yMax[posIdx] = distanceToWall(globalPos, wallIdx, posIdx); @@ -696,14 +700,15 @@ public: int wallIdx = getWallIdx(globalPos, posIdx); // muCross + using std::abs; if (fluxVars.dynamicEddyViscosityOuter() < fluxVars.dynamicEddyViscosityInner() && useViscosityInner(globalPos, posIdx)) { wall[wallIdx].crossLength[posIdx] = distanceToWallReal(globalPos, wallIdx, posIdx); } - if (std::abs(fluxVars.velocity()[flowNormal_]) >= 0.99 * std::abs(wall[wallIdx].maxVelocity[posIdx][flowNormal_]) - && std::abs(wall[wallIdx].boundaryLayerThicknessCalculated[posIdx]) > std::abs(distanceToWallReal(globalPos, wallIdx, posIdx))) + if (abs(fluxVars.velocity()[flowNormal_]) >= 0.99 * abs(wall[wallIdx].maxVelocity[posIdx][flowNormal_]) + && abs(wall[wallIdx].boundaryLayerThicknessCalculated[posIdx]) > abs(distanceToWallReal(globalPos, wallIdx, posIdx))) { wall[wallIdx].boundaryLayerThicknessCalculated[posIdx] = distanceToWallReal(globalPos, wallIdx, posIdx); } @@ -713,8 +718,8 @@ public: wall[wallIdx].viscousSublayerThicknessCalculated[posIdx] = wall[wallIdx].boundaryLayerThicknessCalculated[posIdx]; } else if ((fluxVars.velocity()[flowNormal_] / fluxVars.frictionVelocityWall() <= 5.0) - && (std::abs(wall[wallIdx].viscousSublayerThicknessCalculated[posIdx]) - < std::abs(distanceToWallReal(globalPos, wallIdx, posIdx)))) + && (abs(wall[wallIdx].viscousSublayerThicknessCalculated[posIdx]) + < abs(distanceToWallReal(globalPos, wallIdx, posIdx)))) { wall[wallIdx].viscousSublayerThicknessCalculated[posIdx] = distanceToWallReal(globalPos, wallIdx, posIdx); } @@ -790,6 +795,7 @@ public: if (globalPos[wallNormal_] > wall[wallIdx].wallPos[posIdx] - 1e-8 && globalPos[wallNormal_] < wall[wallIdx].wallPos[posIdx] + 1e-8) { + using std::abs; wall[wallIdx].wallValuesCount[posIdx] += 1; wall[wallIdx].wallDensity[posIdx] = (wall[wallIdx].wallDensity[posIdx] * (wall[wallIdx].wallValuesCount[posIdx] - 1) + boundaryVars.density()) @@ -802,7 +808,7 @@ public: / wall[wallIdx].wallValuesCount[posIdx]; wall[wallIdx].wallShearStress[posIdx] = (wall[wallIdx].wallShearStress[posIdx] * (wall[wallIdx].wallValuesCount[posIdx] - 1) - + std::abs(boundaryVars.velocityGrad()[flowNormal_][wallNormal_]) * boundaryVars.dynamicViscosity()) + + abs(boundaryVars.velocityGrad()[flowNormal_][wallNormal_]) * boundaryVars.dynamicViscosity()) / wall[wallIdx].wallValuesCount[posIdx]; } } @@ -967,7 +973,7 @@ public: /*! * \brief Returns the name of the used eddy viscosity model. */ - const char *eddyViscosityModelName() const + std::string eddyViscosityModelName() const { switch (GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, EddyViscosityModel)) { diff --git a/dumux/freeflow/zeroeqnc/fluxvariables.hh b/dumux/freeflow/zeroeqnc/fluxvariables.hh index 098147d6f9aec2f7c3bd3ba91315f9cc3650471d..b75948139309d36d87d409253123c4fcbee8073b 100644 --- a/dumux/freeflow/zeroeqnc/fluxvariables.hh +++ b/dumux/freeflow/zeroeqnc/fluxvariables.hh @@ -134,6 +134,10 @@ protected: const ElementVolumeVariables &elemVolVars) { // no eddy diffusivity model + using std::abs; + using std::sqrt; + using std::exp; + if (eddyDiffusivityModel_ == EddyDiffusivityIndices::noEddyDiffusivityModel) return; @@ -155,10 +159,10 @@ protected: mixingLengthDiffusivity_ = 0.0; if (this->distanceToWallReal() > 0.0 && yPlusReal_ > 0.0) mixingLengthDiffusivity_ = this->karmanConstant() * this->distanceToWallReal() - * (1.0 - std::exp(-yPlusReal_ / aPlus)) - / std::sqrt(1.0 - std::exp(-bPlus * yPlusReal_)); + * (1.0 - exp(-yPlusReal_ / aPlus)) + / sqrt(1.0 - exp(-bPlus * yPlusReal_)); - eddyDiffusivity_ = mixingLengthDiffusivity_ * mixingLengthDiffusivity_ * std::abs(velGrad_); + eddyDiffusivity_ = mixingLengthDiffusivity_ * mixingLengthDiffusivity_ * abs(velGrad_); } // Deissler near wall law @@ -168,9 +172,9 @@ protected: { const Scalar deisslerConstant = 0.124; const Scalar beta = this->density() * deisslerConstant * deisslerConstant - * std::abs(this->velocity()[flowNormal_]) + * abs(this->velocity()[flowNormal_]) * this->distanceToWallReal(); - eddyDiffusivity_ = beta * (1.0 - std::exp(-beta / this->dynamicViscosity())); + eddyDiffusivity_ = beta * (1.0 - exp(-beta / this->dynamicViscosity())); eddyDiffusivity_ /= this->density(); } @@ -180,13 +184,13 @@ protected: { // Sc_t at flow = 0.86 // Sc_t in wall = 1.34 - Scalar kappaMeier = this->karmanConstant() / std::sqrt(0.86); - Scalar aPlusMeier = std::sqrt(1.34) / std::sqrt(0.86) * 26.0; + Scalar kappaMeier = this->karmanConstant() / sqrt(0.86); + Scalar aPlusMeier = sqrt(1.34) / sqrt(0.86) * 26.0; mixingLengthDiffusivity_ = 0.0; if (this->distanceToWallReal() > 0.0 && yPlusReal_ > 0.0) mixingLengthDiffusivity_ = kappaMeier * this->distanceToWallReal() - * (1.0 - std::exp(- yPlusReal_ / aPlusMeier)); - eddyDiffusivity_ = mixingLengthDiffusivity_ * mixingLengthDiffusivity_ * std::abs(velGrad_); + * (1.0 - exp(- yPlusReal_ / aPlusMeier)); + eddyDiffusivity_ = mixingLengthDiffusivity_ * mixingLengthDiffusivity_ * abs(velGrad_); } // exponential (after Mamayev) @@ -197,7 +201,7 @@ protected: if (velGradWall_ == 0) // means incredible high Ri eddyDiffusivity_ = 0.0; else - eddyDiffusivity_ = std::exp(-m * richardsonNumber()) + eddyDiffusivity_ = exp(-m * richardsonNumber()) * this->kinematicEddyViscosity(); } diff --git a/dumux/freeflow/zeroeqnc/model.hh b/dumux/freeflow/zeroeqnc/model.hh index 38d24e68ccd8ac0eb0386d146ea22ed101c87350..2f953519481b201966f6dd5e8b0e5a732bbadd64 100644 --- a/dumux/freeflow/zeroeqnc/model.hh +++ b/dumux/freeflow/zeroeqnc/model.hh @@ -35,14 +35,18 @@ namespace Dumux * \brief Adaption of the box scheme to the compositional ZeroEq model. * * This model implements an single-phase isothermal compositional free flow - * solving the mass and the momentum balance. For the momentum balance + * solving the total mass and the momentum balance. For the momentum balance * the Reynolds-averaged Navier-Stokes (RANS) equation with zero equation * (algebraic) turbulence model is used. * - * Mass balance: + * Total Mass balance: * \f[ * \frac{\partial \varrho_\textrm{g}}{\partial t} - * + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} \right) + * + \text{div} \left( + * \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} + * - \sum_\kappa \left[ D^\kappa_\textrm{g} + D^\kappa_\textrm{g,t} \right] + * \varrho_\textrm{g} \frac{M^\kappa}{M_\textrm{g}} \textbf{grad}\, x_\textrm{g}^\kappa + * \right) * - q_\textrm{g} = 0 * \f] * @@ -59,7 +63,7 @@ namespace Dumux * - \varrho_\textrm{g} {\bf g} = 0 * \f] * - * Component mass balance equations: + * Component mass balance equations, needed \f$n-1\f$ times: * \f[ * \frac{\partial \left(\varrho_\textrm{g} X_\textrm{g}^\kappa\right)}{\partial t} * + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} X_\textrm{g}^\kappa @@ -348,7 +352,7 @@ public: /*! * \brief Returns the name of used the eddy diffusivity model. */ - const char *eddyDiffusivityModelName() const + std::string eddyDiffusivityModelName() const { switch (GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, EddyDiffusivityModel)) { diff --git a/dumux/freeflow/zeroeqncni/fluxvariables.hh b/dumux/freeflow/zeroeqncni/fluxvariables.hh index 994fc983d316b01c3e61f8bb98f7635fc2eaceb3..8d9bb196b36c1d58c02196b2f80c4c35205b97cb 100644 --- a/dumux/freeflow/zeroeqncni/fluxvariables.hh +++ b/dumux/freeflow/zeroeqncni/fluxvariables.hh @@ -118,6 +118,9 @@ protected: const Element &element, const ElementVolumeVariables &elemVolVars) { + using std::abs; + using std::sqrt; + using std::exp; // IMPORTANT: // the temperatureEddyConductivity_ a_t [m^2/s] is converted to // thermalEddyConductivity \lambda_t [W/(m K)] by the convenience function @@ -144,11 +147,11 @@ protected: mixingLengthConductivity_ = 0.0; if (this->distanceToWallReal() > 0.0 && yPlusReal_ > 0.0) mixingLengthConductivity_ = this->karmanConstant() * this->distanceToWallReal() - * (1.0 - std::exp(-yPlusReal_ / aPlus)) - / std::sqrt(1.0 - std::exp(-bPlus * yPlusReal_)); + * (1.0 - exp(-yPlusReal_ / aPlus)) + / sqrt(1.0 - exp(-bPlus * yPlusReal_)); temperatureEddyConductivity_ = mixingLengthConductivity_ * mixingLengthConductivity_ - * std::abs(velGrad_); + * abs(velGrad_); } // Deissler near wall law @@ -158,9 +161,9 @@ protected: { const Scalar deisslerConstant = 0.124; const Scalar beta = this->density() * deisslerConstant * deisslerConstant - * std::abs(this->velocity()[flowNormal_]) + * abs(this->velocity()[flowNormal_]) * this->distanceToWallReal(); - temperatureEddyConductivity_ = beta * (1.0 - std::exp(-beta / this->dynamicViscosity())); + temperatureEddyConductivity_ = beta * (1.0 - exp(-beta / this->dynamicViscosity())); temperatureEddyConductivity_ /= this->density(); } @@ -170,13 +173,13 @@ protected: { // Pr_t at flow = 0.86 // Pr_t in wall = 1.34 - Scalar kappaMeier = this->karmanConstant() / std::sqrt(0.86); - Scalar aPlusMeier = std::sqrt(1.34) / std::sqrt(0.86) * 26.0; + Scalar kappaMeier = this->karmanConstant() / sqrt(0.86); + Scalar aPlusMeier = sqrt(1.34) / sqrt(0.86) * 26.0; mixingLengthConductivity_ = 0.0; if (this->distanceToWallReal() > 0.0 && yPlusReal_ > 0.0) mixingLengthConductivity_ = kappaMeier * this->distanceToWallReal() - * (1.0 - std::exp(- yPlusReal_ / aPlusMeier)); - temperatureEddyConductivity_ = mixingLengthConductivity_ * mixingLengthConductivity_ * std::abs(velGrad_); + * (1.0 - exp(- yPlusReal_ / aPlusMeier)); + temperatureEddyConductivity_ = mixingLengthConductivity_ * mixingLengthConductivity_ * abs(velGrad_); } else diff --git a/dumux/freeflow/zeroeqncni/model.hh b/dumux/freeflow/zeroeqncni/model.hh index 20b1afc4f7cf734d700752fe7143b82984bb8e98..8e3213e6b294c450ebf361e28db7a102b5c109a3 100644 --- a/dumux/freeflow/zeroeqncni/model.hh +++ b/dumux/freeflow/zeroeqncni/model.hh @@ -40,10 +40,14 @@ namespace Dumux * the Reynolds-averaged Navier-Stokes (RANS) equation with zero equation * (algebraic) turbulence model is used. * - * Mass balance: + * Total mass balance: * \f[ * \frac{\partial \varrho_\textrm{g}}{\partial t} - * + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} \right) + * + \text{div} \left( + * \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} + * - \sum_\kappa \left[ D^\kappa_\textrm{g} + D^\kappa_\textrm{g,t} \right] + * \varrho_\textrm{g} \frac{M^\kappa}{M_\textrm{g}} \textbf{grad}\, x_\textrm{g}^\kappa + * \right) * - q_\textrm{g} = 0 * \f] * @@ -60,7 +64,7 @@ namespace Dumux * - \varrho_\textrm{g} {\bf g} = 0 * \f] * - * Component mass balance equations: + * Component mass balance equations, needed \f$n-1\f$ times: * \f[ * \frac{\partial \left(\varrho_\textrm{g} X_\textrm{g}^\kappa\right)}{\partial t} * + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} X_\textrm{g}^\kappa @@ -360,7 +364,7 @@ public: /*! * \brief Returns the name of used the eddy conductivity model. */ - const char *eddyConductivityModelName() const + std::string eddyConductivityModelName() const { switch (GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, EddyConductivityModel)) { diff --git a/dumux/geomechanics/el1p2c/localresidual.hh b/dumux/geomechanics/el1p2c/localresidual.hh index 2e2e7628784362e952c95e618be6c15dc33bdaff..2e8e6795d80f08e0ab93b8453c43c8327fdfd4a4 100644 --- a/dumux/geomechanics/el1p2c/localresidual.hh +++ b/dumux/geomechanics/el1p2c/localresidual.hh @@ -270,35 +270,28 @@ namespace Dumux void computeDiffusiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const { - Scalar tmp(0); + // diffusive flux of the transported component + Scalar tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); + tmp *= fluxVars.diffCoeffPM(); + + // dispersive flux of transported component + DimVector normalDisp; + fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); + tmp -= (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); - // diffusive flux of second component if(useMoles) { - // diffusive flux of the second component - mole fraction - tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); - tmp *= fluxVars.diffCoeffPM(); - - // dispersive flux of second component - mole fraction - DimVector normalDisp; - fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); - tmp -= (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); - flux[transportEqIdx] += tmp; } else { - // diffusive flux of the second component - mass fraction - tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); - tmp *= fluxVars.diffCoeffPM(); - - // dispersive flux of second component - mass fraction - DimVector normalDisp; - fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); - tmp -= (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); - // convert it to a mass flux and add it flux[transportEqIdx] += tmp * FluidSystem::molarMass(transportCompIdx); + + // account for diffusive fluxes in the total mass balance + // in contrast to a molar formulation they do not cancel out + flux[conti0EqIdx] += tmp * FluidSystem::molarMass(transportCompIdx); + flux[conti0EqIdx] -= tmp * FluidSystem::molarMass(phaseIdx); } } diff --git a/dumux/geomechanics/el1p2c/model.hh b/dumux/geomechanics/el1p2c/model.hh index a04dbe03a79f5dcb57671af90d24a64239c39d2d..3fc84a1acbdfc68214324b74171cc1a16ac0a2a8 100644 --- a/dumux/geomechanics/el1p2c/model.hh +++ b/dumux/geomechanics/el1p2c/model.hh @@ -35,7 +35,7 @@ namespace Dumux { * * This model implements a one-phase flow of an incompressible fluid, that consists of two components. * The deformation of the solid matrix is described with a quasi-stationary momentum balance equation. - * The influence of the pore fluid is accounted for through the effective stress concept (Biot 1941). + * The influence of the pore fluid is accounted for through the effective stress concept (Biot 1941 \cite Biot1941a). * The total stress acting on a rock is partially supported by the rock matrix and partially supported * by the pore fluid. The effective stress represents the share of the total stress which is supported * by the solid rock matrix and can be determined as a function of the strain according to Hooke's law. @@ -49,8 +49,11 @@ namespace Dumux { * Gravity can be enabled or disabled via the property system. * By inserting this into the volume balance of the solid-fluid mixture, one gets \f[ - \frac{\partial \text{div} \textbf{u}}{\partial t} - \text{div} \left\{ - \frac{\textbf K}{\mu} \left(\textbf{grad}\, p - \varrho_w {\textbf g} \right)\right\} = q \;, + \frac{\partial \text{div} \textbf{u}}{\partial t} + - \text{div} \left\{ + \frac{\textbf K}{\mu} \left(\textbf{grad}\, p - \varrho_w {\textbf g} \right) + + \sum_\kappa D^\kappa_\text{pm} \frac{M^\kappa}{M_\alpha} \textbf{grad} x^\kappa + \right\} = q \;, \f] * * The transport of the components \f$\kappa \in \{ w, a \}\f$ is described by the following equation: @@ -64,7 +67,7 @@ namespace Dumux { \f] * * If the model encounters stability problems, a stabilization term can be switched on. The stabilization - * term is defined in Aguilar et al (2008): + * term is defined in Aguilar et al. (2008) \cite Aguilar2008a. \f[ \beta \text{div} \textbf{grad} \frac{\partial p}{\partial t} \f] @@ -77,10 +80,12 @@ namespace Dumux { * The balance equations * with the stabilization term are given below: \f[ - \frac{\partial \text{div} \textbf{u}}{\partial t} - \text{div} \left\{ + \frac{\partial \text{div} \textbf{u}}{\partial t} + - \text{div} \left\{ \frac{\textbf K}{\mu} \left(\textbf{grad}\, p - \varrho_w {\textbf g} \right) + + \sum_\kappa D^\kappa_\text{pm} \frac{M^\kappa}{M_\alpha} \textbf{grad} x^\kappa + \varrho_w \beta \textbf{grad} \frac{\partial p}{\partial t} - \right\} = q \;, + \right\} = q \;, \f] * * The transport of the components \f$\kappa \in \{ w, a \}\f$ is described by the following equation: @@ -464,17 +469,10 @@ public: writer.attachVertexData(pressure, "P"); - char nameMoleFraction0[42], nameMoleFraction1[42]; - snprintf(nameMoleFraction0, 42, "x_%s", FluidSystem::componentName(0)); - snprintf(nameMoleFraction1, 42, "x_%s", FluidSystem::componentName(1)); - writer.attachVertexData(moleFraction0, nameMoleFraction0); - writer.attachVertexData(moleFraction1, nameMoleFraction1); - - char nameMassFraction0[42], nameMassFraction1[42]; - snprintf(nameMassFraction0, 42, "X_%s", FluidSystem::componentName(0)); - snprintf(nameMassFraction1, 42, "X_%s", FluidSystem::componentName(1)); - writer.attachVertexData(massFraction0, nameMassFraction0); - writer.attachVertexData(massFraction1, nameMassFraction1); + writer.attachVertexData(moleFraction0, "x_" + FluidSystem::componentName(0)); + writer.attachVertexData(moleFraction1, "x_" + FluidSystem::componentName(1)); + writer.attachVertexData(massFraction0, "X_" + FluidSystem::componentName(0)); + writer.attachVertexData(massFraction1, "X_" + FluidSystem::componentName(1)); writer.attachVertexData(displacement, "u", dim); writer.attachVertexData(density, "rho"); diff --git a/dumux/geomechanics/el2p/assembler.hh b/dumux/geomechanics/el2p/assembler.hh index ca1daca18c0e7e14f786d39a89057d8d8342815c..f995b84864d778cc6c742468dc2e5d07ec6d2b8c 100644 --- a/dumux/geomechanics/el2p/assembler.hh +++ b/dumux/geomechanics/el2p/assembler.hh @@ -264,6 +264,7 @@ public: // update the vector with the distances of the current // evaluation point used for linearization from the original // evaluation point + using std::abs; for (int i = 0; i < vertexDelta_.size(); ++i) { PrimaryVariables uCurrent(u[i]); PrimaryVariables uNext(uCurrent); @@ -274,7 +275,7 @@ public: Scalar dist = model_().relativeErrorVertex(i, uCurrent, uNext); - vertexDelta_[i] += std::abs(dist); + vertexDelta_[i] += abs(dist); } } @@ -315,8 +316,9 @@ public: // the relative tolerance vertexColor_[i] = Red; } + using std::max; nextReassembleTolerance_ = - std::max(nextReassembleTolerance_, vertexDelta_[i]); + max(nextReassembleTolerance_, vertexDelta_[i]); }; // Mark all red elements diff --git a/dumux/geomechanics/el2p/basemodel.hh b/dumux/geomechanics/el2p/basemodel.hh index bb2850a4987fcbdd4ab58a9e4b0521fd1fa4fae7..35f1a67ff36eb1bdf4d829d4463eea4b5926a9be 100644 --- a/dumux/geomechanics/el2p/basemodel.hh +++ b/dumux/geomechanics/el2p/basemodel.hh @@ -218,7 +218,8 @@ public: Dune::ForwardCommunication); } - return std::sqrt(result2); + using std::sqrt; + return sqrt(result2); } /*! @@ -355,11 +356,13 @@ public: const PrimaryVariables &priVars2) { Scalar result = 0.0; + using std::abs; + using std::max; for (int j = 0; j < numEq; ++j) { - Scalar eqErr = std::abs(priVars1[j] - priVars2[j]); - eqErr /= std::max(1.0, std::abs(priVars1[j] + priVars2[j])/2); + Scalar eqErr = abs(priVars1[j] - priVars2[j]); + eqErr /= max(1.0, abs(priVars1[j] + priVars2[j])/2); - result = std::max(result, eqErr); + result = max(result, eqErr); } return result; } diff --git a/dumux/geomechanics/el2p/localoperator.hh b/dumux/geomechanics/el2p/localoperator.hh index acd7cb90af1a7cc292abb4f552b91eb15db03c7b..3720aff1ec3f4ac880657575108b0b979556b93c 100644 --- a/dumux/geomechanics/el2p/localoperator.hh +++ b/dumux/geomechanics/el2p/localoperator.hh @@ -600,11 +600,12 @@ public: alphaMomentum(eg, lfsu, u, lfsv, downView); // loop over all columns (number of element vertices * number of equations) + using std::abs; for (int j = 0; j < n; j++) { // vary the solution vector entry (lfsu,j) by a small value delta (forward differencing) // this comprises presure, saturation, ux, uy and uz - Scalar delta = 1e-4*(1.0+std::abs(u(lfsu,j))); + Scalar delta = 1e-4*(1.0+abs(u(lfsu,j))); u(lfsu,j) += delta; // evaluate momentum balance residual for the varied solution vector diff --git a/dumux/geomechanics/el2p/model.hh b/dumux/geomechanics/el2p/model.hh index 9837b85c788c0739eebf01c1297403f5469cfa3b..10278c70229938abafd43b258192b6e7a6b7e9fe 100644 --- a/dumux/geomechanics/el2p/model.hh +++ b/dumux/geomechanics/el2p/model.hh @@ -43,7 +43,7 @@ NEW_PROP_TAG(InitialPressSat); //!< The initial pressure and saturation function * * This model implements a two-phase flow of compressible immiscible fluids \f$\alpha \in \{ w, n \}\f$. * The deformation of the solid matrix is described with a quasi-stationary momentum balance equation. - * The influence of the pore fluid is accounted for through the effective stress concept (Biot 1941). + * The influence of the pore fluid is accounted for through the effective stress concept (Biot 1941 \cite Biot1941a). * The total stress acting on a rock is partially supported by the rock matrix and partially supported * by the pore fluid. The effective stress represents the share of the total stress which is supported * by the solid rock matrix and can be determined as a function of the strain according to Hooke's law. @@ -65,7 +65,7 @@ NEW_PROP_TAG(InitialPressSat); //!< The initial pressure and saturation function \f] * * - * A quasi-stationary momentum balance equation is solved for the changes with respect to the initial conditions (Darcis 2012), note + * A quasi-stationary momentum balance equation is solved for the changes with respect to the initial conditions, note * that this implementation assumes the soil mechanics sign convention (i.e. compressive stresses are negative): \f[ \text{div}\left( \boldsymbol{\Delta \sigma'}- \Delta p_{eff} \boldsymbol{I} \right) + \Delta \varrho_b {\textbf g} = 0 \;, @@ -391,6 +391,7 @@ public: exponent = 22.2 * (elemVolVars[scvIdx].effPorosity / elemVolVars[scvIdx].porosity() - 1); Keff = this->problem_().spatialParams().intrinsicPermeability( element, fvGeometry, scvIdx)[0][0]; + using std::exp; Keff *= exp(exponent); effKx[eIdx] += Keff/ numScv; effectivePressure[eIdx] += (pn[vIdxGlobal] * sn[vIdxGlobal] @@ -547,8 +548,9 @@ public: for (int i = 0; i < dim; i++) { - if (std::isnan(eigenValues[i])) - eigenValues[i] = 0.0; + using std::isnan; + if (isnan(eigenValues[i])) + eigenValues[i] = 0.0; } // sort principal stresses: principalStress1 >= principalStress2 >= principalStress3 @@ -619,7 +621,11 @@ public: Scalar S0 = 0.0; taum = (principalStress1[eIdx] - principalStress3[eIdx]) / 2; sigmam = (principalStress1[eIdx] + principalStress3[eIdx]) / 2; - Scalar Psc = -fabs(taum) / sin(theta) + S0 * cos(theta) / sin(theta) + + using std::abs; + using std::sin; + using std::cos; + Scalar Psc = -abs(taum) / sin(theta) + S0 * cos(theta) / sin(theta) + sigmam; // Pressure margins according to J. Rutqvist et al. / International Journal of Rock Mecahnics & Mining Sciences 45 (2008), 132-143 Pcrtens[eIdx] = Peff - principalStress3[eIdx]; diff --git a/dumux/geomechanics/el2p/newtoncontroller.hh b/dumux/geomechanics/el2p/newtoncontroller.hh index fef843b5aa3464f43571fecc7c55ba7ab324b327..f0b174f863e5d8fd1936c508c92f0ff418b4bd5f 100644 --- a/dumux/geomechanics/el2p/newtoncontroller.hh +++ b/dumux/geomechanics/el2p/newtoncontroller.hh @@ -18,7 +18,14 @@ *****************************************************************************/ /*! * \file + * + * \brief An el2p specific controller for the newton solver. + * + * This controller 'knows' what a 'physically meaningful' solution is + * which allows the newton method to abort quicker if the solution is + * way out of bounds. */ + #ifndef DUMUX_EL2P_NEWTON_CONTROLLER_HH #define DUMUX_EL2P_NEWTON_CONTROLLER_HH @@ -66,9 +73,11 @@ public: // deflection in any degree of freedom. this->shift_ = 0; + using std::abs; + using std::max; for (int i = 0; i < int(uOld.base().size()); ++i) { - Scalar vertErr = std::abs(deltaU.base()[i]/(1.0 + std::abs((uOld.base()[i]) + uOld.base()[i] - deltaU.base()[i])/2)); - this->shift_ = std::max(this->shift_, vertErr); + Scalar vertErr = abs(deltaU.base()[i]/(1.0 + abs((uOld.base()[i]) + uOld.base()[i] - deltaU.base()[i])/2)); + this->shift_ = max(this->shift_, vertErr); } this->shift_ = this->gridView_().comm().max(this->shift_); @@ -102,6 +111,7 @@ public: SolutionVector &x, SolutionVector &b) { + using std::min; try { if (this->numSteps_ == 0) { @@ -109,7 +119,8 @@ public: if (this->gridView_().comm().size() > 1) norm2 = this->gridView_().comm().sum(norm2); - initialAbsoluteError_ = std::sqrt(norm2); + using std::sqrt; + initialAbsoluteError_ = sqrt(norm2); lastAbsoluteError_ = initialAbsoluteError_; } diff --git a/dumux/geomechanics/el2p/propertydefaults.hh b/dumux/geomechanics/el2p/propertydefaults.hh index 251008ce06e0a98914dc4c8d4038441fee61175b..0f3b634b386d1589d54327fe916f53badb199703 100644 --- a/dumux/geomechanics/el2p/propertydefaults.hh +++ b/dumux/geomechanics/el2p/propertydefaults.hh @@ -386,6 +386,8 @@ public: typedef Dune::FieldVector type; }; +/*! @copydoc Properties::NonoverlappingSolverTraits + */ template class ElasticTwoPSolverTraits : public NonoverlappingSolverTraits @@ -394,6 +396,8 @@ public: typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; }; +/*! @copydoc Properties::NonoverlappingSolverTraits + */ template class ElasticTwoPSolverTraits : public NonoverlappingSolverTraits diff --git a/dumux/implicit/adaptive/adaptionhelper.hh b/dumux/implicit/adaptive/adaptionhelper.hh index 36ddbb7eec79deb3f05c5bb718fdd4b24df7f679..b74bad049be97ae79c023cc9aa2e7bf41f07cc2d 100644 --- a/dumux/implicit/adaptive/adaptionhelper.hh +++ b/dumux/implicit/adaptive/adaptionhelper.hh @@ -67,9 +67,10 @@ public: //! Constructs an adaptive helper object /** * In addition to providing a storage object for cell-centered Methods, this class provides - * mapping functionality to adapt the grid. + * mapping functionality to adapt the grid. It uses gridView, a DUNE gridview object corresponding + * to diffusion and transport equation * - * @param gridView a DUNE gridview object corresponding to diffusion and transport equation + * @param problem The current problem */ ImplicitAdaptionHelper(Problem& problem) {} diff --git a/dumux/implicit/adaptive/gridadaptinitializationindicator.hh b/dumux/implicit/adaptive/gridadaptinitializationindicator.hh index abf0076c17a6668437d746e85d8a3be864e4a4ce..b106447be6b16703bc81d256bcdbc208fb543e24 100644 --- a/dumux/implicit/adaptive/gridadaptinitializationindicator.hh +++ b/dumux/implicit/adaptive/gridadaptinitializationindicator.hh @@ -214,11 +214,13 @@ public: int globalIdxI = problem_.elementMapper().index(element); int level = element.level(); - maxLevel_ = std::max(level, maxLevel_); + using std::max; + using std::min; + maxLevel_ = max(level, maxLevel_); if (level < minAllowedLevel_) { - nextMaxLevel_ = std::min(std::max(level + 1, nextMaxLevel_), maxAllowedLevel_); + nextMaxLevel_ = min(max(level + 1, nextMaxLevel_), maxAllowedLevel_); indicatorVector_[globalIdxI] = refineCell; continue; } @@ -237,7 +239,7 @@ public: { if(hasSource_(element, fvGeometry, elemVolVars)) { - nextMaxLevel_ = std::min(std::max(level + 1, nextMaxLevel_), maxAllowedLevel_); + nextMaxLevel_ = min(max(level + 1, nextMaxLevel_), maxAllowedLevel_); indicatorVector_[globalIdxI] = refineCell; continue; } @@ -257,7 +259,7 @@ public: { if(hasRefineBC_(bcTypes, element, intersection, fvGeometry, elemVolVars)) { - nextMaxLevel_ = std::min(std::max(level + 1, nextMaxLevel_), maxAllowedLevel_); + nextMaxLevel_ = min(max(level + 1, nextMaxLevel_), maxAllowedLevel_); indicatorVector_[globalIdxI] = refineCell; break; } diff --git a/dumux/implicit/assembler.hh b/dumux/implicit/assembler.hh index b2ab1c8f5277dbf8865c3e2a6d3c029e1cb7e5ad..450b119b411aee7b6df3d4efde521a1dc1a524d3 100644 --- a/dumux/implicit/assembler.hh +++ b/dumux/implicit/assembler.hh @@ -283,7 +283,8 @@ public: // this vertex Scalar dist = model_().relativeShiftAtDof(currentPriVars, nextPriVars); - delta_[i] += std::abs(dist); + using std::abs; + delta_[i] += abs(dist); } } diff --git a/dumux/implicit/box/assembler.hh b/dumux/implicit/box/assembler.hh index 2afef023667c38e8f06e401c6baf931b91d7b42c..7ed02124a2af2f4e2a1305f74a06b0f6d4a224c8 100644 --- a/dumux/implicit/box/assembler.hh +++ b/dumux/implicit/box/assembler.hh @@ -82,13 +82,14 @@ private: // linearization which actually will get achieved this->nextReassembleAccuracy_ = 0; for (unsigned int i = 0; i < this->vertexColor_.size(); ++i) { + using std::max; if (this->delta_[i] > relTol) // mark vertex as red if discrepancy is larger than // the relative tolerance this->vertexColor_[i] = ParentType::Red; else this->nextReassembleAccuracy_ = - std::max(this->nextReassembleAccuracy_, this->delta_[i]); + max(this->nextReassembleAccuracy_, this->delta_[i]); } // Mark all red elements @@ -312,7 +313,8 @@ private: // update the right hand side this->residual_[globI] += this->model_().localJacobian().residual(i); for (int j = 0; j < this->residual_[globI].dimension; ++j) { - if (!std::isfinite(this->residual_[globI][j])) { + using std::isfinite; + if (!isfinite(this->residual_[globI][j])) { DUNE_THROW(NumericalProblem, "residual_[" << globI << "][" << j << "] is not finite"); } diff --git a/dumux/implicit/box/fvelementgeometry.hh b/dumux/implicit/box/fvelementgeometry.hh index 3057aef1dec96508e7ab54d397283af9c2d22d57..daf47028b465b42318cbebc0bde41905bea56a74 100644 --- a/dumux/implicit/box/fvelementgeometry.hh +++ b/dumux/implicit/box/fvelementgeometry.hh @@ -598,7 +598,8 @@ class BoxFVElementGeometry Scalar quadrilateralArea(const GlobalPosition& p0, const GlobalPosition& p1, const GlobalPosition& p2, const GlobalPosition& p3) { - return 0.5*std::abs((p3[0] - p1[0])*(p2[1] - p0[1]) - (p3[1] - p1[1])*(p2[0] - p0[0])); + using std::abs; + return 0.5*abs((p3[0] - p1[0])*(p2[1] - p0[1]) - (p3[1] - p1[1])*(p2[0] - p0[0])); } void crossProduct(GlobalPosition& c, const GlobalPosition& a, const GlobalPosition& b) @@ -640,7 +641,8 @@ class BoxFVElementGeometry a = p5 - p0; - return std::abs(1.0/6.0*(n*a)); + using std::abs; + return abs(1.0/6.0*(n*a)); } Scalar hexahedronVolume (const GlobalPosition& p0, const GlobalPosition& p1, @@ -899,7 +901,10 @@ public: int i = referenceElement.subEntity(scvfIdx, dim-1, 0, dim); int j = referenceElement.subEntity(scvfIdx, dim-1, 1, dim); if (numScvf == 4 && (i == 2 || j == 2)) - std::swap(i, j); + { + using std::swap; + swap(i, j); + } scvFace.i = i; scvFace.j = j; @@ -940,6 +945,10 @@ public: this->crossProduct(elemNormal, elemVec1, elemVec2); this->crossProduct(scvFace.normal, faceVec, elemNormal); + // scale normal vector by the area + scvFace.normal /= scvFace.normal.two_norm(); + scvFace.normal *= faceVec.two_norm(); + const auto diffVec = subContVol[j].global - subContVol[i].global; // make sure the normal points to the right direction if (scvFace.normal * diffVec < 0) diff --git a/dumux/implicit/cellcentered/assembler.hh b/dumux/implicit/cellcentered/assembler.hh index 8619bc4870120b569fd0829795a918ede2f358a1..6ef9132894cdaf139bd617737a81f422bc1f9a6a 100644 --- a/dumux/implicit/cellcentered/assembler.hh +++ b/dumux/implicit/cellcentered/assembler.hh @@ -85,8 +85,9 @@ private: else { this->elementColor_[eIdx] = ParentType::Green; + using std::max; this->nextReassembleAccuracy_ = - std::max(this->nextReassembleAccuracy_, this->delta_[eIdx]); + max(this->nextReassembleAccuracy_, this->delta_[eIdx]); } } @@ -192,8 +193,9 @@ private: // update the right hand side this->residual_[globalI] = this->model_().localJacobian().residual(0); + using std::isfinite; for (int j = 0; j < this->residual_[globalI].dimension; ++j) - assert(std::isfinite(this->residual_[globalI][j])); + assert(isfinite(this->residual_[globalI][j])); if (this->enableJacobianRecycling_()) { this->storageTerm_[globalI] += this->model_().localJacobian().storageTerm(0); diff --git a/dumux/implicit/localjacobian.hh b/dumux/implicit/localjacobian.hh index 4ba53f954b9386f13cfb224e592c6182307612d6..d91885b76510ca1043364cb6a04de426be0ccded 100644 --- a/dumux/implicit/localjacobian.hh +++ b/dumux/implicit/localjacobian.hh @@ -291,7 +291,8 @@ public: // the epsilon value used for the numeric differentiation is // now scaled by the absolute value of the primary variable... Scalar priVar = this->curVolVars_[scvIdx].priVar(pvIdx); - return baseEps*(std::abs(priVar) + 1.0); + using std::abs; + return baseEps*(abs(priVar) + 1.0); } protected: diff --git a/dumux/implicit/model.hh b/dumux/implicit/model.hh index 40b2d0cec6d2da4667bc65d77c0171a0e4789c3e..8edcd96150a1bb90522488e574c479ff46116af2 100644 --- a/dumux/implicit/model.hh +++ b/dumux/implicit/model.hh @@ -254,8 +254,8 @@ public: Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); } - - return std::sqrt(result2); + using std::sqrt; + return sqrt(result2); } /*! @@ -388,11 +388,13 @@ public: const PrimaryVariables &priVars2) { Scalar result = 0.0; + using std::abs; + using std::max; for (int j = 0; j < numEq; ++j) { - Scalar eqErr = std::abs(priVars1[j] - priVars2[j]); - eqErr /= std::max(1.0, std::abs(priVars1[j] + priVars2[j])/2); + Scalar eqErr = abs(priVars1[j] - priVars2[j]); + eqErr /= max(1.0,abs(priVars1[j] + priVars2[j])/2); - result = std::max(result, eqErr); + result = max(result, eqErr); } return result; } @@ -865,7 +867,7 @@ protected: { return problem_().gridView(); } /*! - * \brief Reference to the local residal object + * \brief Reference to the local residual object */ LocalResidual &localResidual_() { return localJacobian_.localResidual(); } @@ -996,7 +998,7 @@ protected: mutable std::vector prevHints_; // the problem we want to solve. defines the constitutive - // relations, matxerial laws, etc. + // relations, material laws, etc. Problem *problemPtr_; // calculates the local jacobian matrix for a given element diff --git a/dumux/implicit/problem.hh b/dumux/implicit/problem.hh index 460968ce5d7dbed8d3b1cbe84dc4921fd12312d5..81e9c326597abafd8cabf469588c1d76d38718fb 100644 --- a/dumux/implicit/problem.hh +++ b/dumux/implicit/problem.hh @@ -112,8 +112,10 @@ public: // calculate the bounding box of the local partition of the grid view for (const auto& vertex : vertices(gridView)) { for (int i=0; i #include #include +#include #include "properties.hh" #include "model.hh" @@ -44,7 +45,7 @@ namespace Dumux { // forward declarations template class NewtonController; -template class ILU0BiCGSTABBackend; +template class AMGBackend; namespace Properties { ////////////////////////////////////////////////////////////////// @@ -134,8 +135,8 @@ public: typedef typename Dune::BCRSMatrix type; }; -//! use the stabilized BiCG solver preconditioned by the ILU-0 by default -SET_TYPE_PROP(ImplicitBase, LinearSolver, ILU0BiCGSTABBackend ); +//! use the AMGBackend solver by default +SET_TYPE_PROP(ImplicitBase, LinearSolver, Dumux::AMGBackend ); // if the deflection of the newton method is large, we do not // need to solve the linear approximation accurately. Assuming diff --git a/dumux/io/adaptivegridrestart.hh b/dumux/io/adaptivegridrestart.hh index 468f3188356b831f9f8ba5db5490996dea1af125..060fa0ede501cc8cac646dcfaf915a000702bd30 100644 --- a/dumux/io/adaptivegridrestart.hh +++ b/dumux/io/adaptivegridrestart.hh @@ -105,12 +105,11 @@ public: #if HAVE_DUNE_ALUGRID Dune::BackupRestoreFacility::backup(problem.grid(), gridName); #else - double time = problem.timeManager().time(); problem.grid().template writeGrid #if ! DUNE_VERSION_NEWER(DUNE_COMMON, 2, 5) #endif // Dune < 3.0 - (gridName, time); + (gridName, problem.timeManager().time() + problem.timeManager().timeStepSize()); #endif } @@ -139,7 +138,8 @@ private: std::cerr << "Be sure to provide a parameter Problem.Name if you want to restart." << std::endl; oss << problem.name(); } - oss << "_time=" << problem.timeManager().time() << "_rank=" << rank << ".grs"; + oss << "_time=" << problem.timeManager().time() + problem.timeManager().timeStepSize() + << "_rank=" << rank << ".grs"; return oss.str(); } }; diff --git a/dumux/io/artgridcreator.hh b/dumux/io/artgridcreator.hh index 1cde782284d9dc53eb6bbd40dbc7d1a368b46fca..cb4d18abde9e026e0d7be23a1f9b8b4732bc205a 100644 --- a/dumux/io/artgridcreator.hh +++ b/dumux/io/artgridcreator.hh @@ -501,6 +501,9 @@ class FractureMapper typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; public: // mapper: one data element in every entity + /*! + * \brief Maps one data element in every entity + */ template struct FaceLayout { diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/cakegridcreator.hh new file mode 100644 index 0000000000000000000000000000000000000000..67b8c269a9db30d5b3fd8ffcef89d1bc5e299bf6 --- /dev/null +++ b/dumux/io/cakegridcreator.hh @@ -0,0 +1,552 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program. If not, see . * + *****************************************************************************/ +/*! + * \file + * + * \brief Provides a grid creator for a piece of cake grid + */ + +#ifndef DUMUX_CAKE_GRID_CREATOR_HH +#define DUMUX_CAKE_GRID_CREATOR_HH + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace Dumux +{ + +namespace Properties +{ +NEW_PROP_TAG(Scalar); +NEW_PROP_TAG(Grid); +} + +/*! + * \brief Provides a grid creator with a method for creating creating vectors + * with polar Coordinates and one for creating a cartesian grid from + * these polar coordinates. + */ +template +class CakeGridCreator +{ + using ThisType = CakeGridCreator; + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using Grid = typename GET_PROP_TYPE(TypeTag, Grid); + using GridFactory = Dune::GridFactory; + using GridPointer = std::shared_ptr; + + enum { dim = Grid::dimension, + dimWorld = Grid::dimensionworld + }; + + using ScalarVector = std::vector; + using CellArray = std::array; + using GlobalPosition = Dune::FieldVector; + +public: + /*! + * \brief Make the grid. + */ + static void makeGrid() + { + static_assert(dim == 2 || dim == 3, "The CakeGridCreator is only implemented for 2D and 3D."); + + bool verbose = false; + try { verbose = GET_RUNTIME_PARAM_FROM_GROUP_CSTRING(TypeTag, bool, GET_PROP_VALUE(TypeTag, GridParameterGroup).c_str(), Verbosity);} + catch (Dumux::ParameterException &e) { } + + std::array polarCoordinates; + // Indices specifing in which direction the piece of cake is oriented + Dune::FieldVector indices(-1); + + createVectors(polarCoordinates, indices, verbose); + gridPtr() = ThisType::createCakeGrid(polarCoordinates, indices, verbose); + } + + /*! + * \brief Create vectors containing polar coordinates of all points. + * + * All keys are expected to be in group GridParameterGroup. + * The following keys are recognized: + * - Radial : min/max value for radial coordinate + * - Angular : min/max value for angular coordinate + * - Axial : min/max value for axial coordinate + * Adding 0, 1 (or 2 in 3D) specifies in which direction (x, y and z, respectively) + * the radial, angular and axial direction are oriented + * - Cells : number of cells array for x-coordinate (Again, an added 0, 1 or 3 specifies x, y or z + * - Grading : grading factor array for x-coordinate (Same here) + * - Verbosity : whether the grid construction should output to standard out + * + * The grading factor \f$ g \f$ specifies the ratio between the next and the current cell size: + * \f$ g = \frac{h_{i+1}}{h_i} \f$. + * Negative grading factors are converted to + * \f$ g = -\frac{1}{g_\textrm{negative}} \f$ + * to avoid issues with imprecise fraction numbers. + */ + static void createVectors(std::array &polarCoordinates, + Dune::FieldVector &indices, + bool verbose = false) + { + // Only construction from the input file is possible + // Look for the necessary keys to construct from the input file + try + { + // The positions + std::array positions; + + for (int i = 0; i < dim; ++i) + { + const auto paramNameRadial = GET_PROP_VALUE(TypeTag, GridParameterGroup) + + ".Radial" + std::to_string(i); + try + { + positions[i] = GET_RUNTIME_PARAM_CSTRING(TypeTag, ScalarVector, paramNameRadial.c_str()); + indices[0] = i; // Index specifing radial direction + } + catch (Dumux::ParameterException &e) { } + + const auto paramNameAngular = GET_PROP_VALUE(TypeTag, GridParameterGroup) + + ".Angular" + std::to_string(i); + try + { + positions[i] = GET_RUNTIME_PARAM_CSTRING(TypeTag, ScalarVector, paramNameAngular.c_str()); + indices[1] = i; // Index specifing angular direction + } + catch (Dumux::ParameterException &e) { } + + if (dim == 3) + { + const auto paramNameAxial = GET_PROP_VALUE(TypeTag, GridParameterGroup) + + ".Axial" + std::to_string(i); + try + { + positions[i] = GET_RUNTIME_PARAM_CSTRING(TypeTag, ScalarVector, paramNameAxial.c_str()); + indices[2] = i; // Index specifing axial direction + } + catch (Dumux::ParameterException &e) { } + } + } + + if (dim == 3) + { + if ( !( ((3 > indices[0]) && (indices[0] >= 0) + && (3 > indices[1]) && (indices[1] >= 0) + && (3 > indices[2]) && (indices[2] >= 0)) + && ((indices[2] != indices[1]) && (indices[2] != indices[0]) + && (indices[1] != indices[0])) + && (indices[2] + indices[1] + indices[0] == 3) ) ) + { + if (verbose) + std::cout << " indices[0] " << indices[0] + << " indices[1] " << indices[1] + << " indices[2] " << indices[2] << std::endl; + DUNE_THROW(Dune::RangeError, "Please specify Positions Angular and Radial correctly and unambiguously!" << std::endl); + } + } + else + { + if ( !( ((2 > indices[0]) && (indices[0] >= 0) + && (2 > indices[1]) && (indices[1] >= 0)) + && (indices[1] != indices[0]) + && (indices[1] + indices[0] == 1) ) ) + { + if (verbose) + std::cout << " indices[0] " << indices[0] + << " indices[1] " << indices[1] << std::endl; + DUNE_THROW(Dune::RangeError, "Please specify Positions Angular and Radial correctly and unambiguously!" << std::endl); + } + } + + // the number of cells (has a default) + std::array, dim> cells; + for (int i = 0; i < dim; ++i) + { + const auto paramName = GET_PROP_VALUE(TypeTag, GridParameterGroup) + + ".Cells" + std::to_string(i); + try { cells[i] = GET_RUNTIME_PARAM_CSTRING(TypeTag, std::vector, paramName.c_str()); } + catch (Dumux::ParameterException &e) { cells[i].resize(positions[i].size()-1, 1.0); } + } + + // grading factor (has a default) + std::array grading; + for (int i = 0; i < dim; ++i) + { + const auto paramName = GET_PROP_VALUE(TypeTag, GridParameterGroup) + + ".Grading" + std::to_string(i); + try { grading[i] = GET_RUNTIME_PARAM_CSTRING(TypeTag, ScalarVector, paramName.c_str()); } + catch (Dumux::ParameterException &e) { grading[i].resize(positions[i].size()-1, 1.0); } + } + + // make the grid + // sanity check of the input parameters + for (int dimIdx = 0; dimIdx < dim; ++dimIdx) + { + // check that cells and position have same size + if (cells[dimIdx].size() + 1 != positions[dimIdx].size()) + DUNE_THROW(Dune::RangeError, "Make sure to specify correct \"Cells\" and \"Positions\" arrays"); + + // check that grading and position have same size + else if (grading[dimIdx].size() + 1 != positions[dimIdx].size()) + DUNE_THROW(Dune::RangeError, "Make sure to specify correct \"Grading\" and \"Positions\" arrays"); + + // make sure we have monotonically increasing positions + for (unsigned int posIdx = 0; posIdx < positions[dimIdx].size(); ++posIdx) + if (!std::is_sorted(positions[dimIdx].begin(), positions[dimIdx].end())) + DUNE_THROW(Dune::GridError, "Make sure to specify a monotone increasing \"Positions\" array"); + } + + std::array globalPositions; + using std::pow; + for (int dimIdx = 0; dimIdx < dim; dimIdx++) + { + std::size_t numGlobalPositions = 0; + for (int zoneIdx = 0; zoneIdx < cells[dimIdx].size(); ++zoneIdx) + numGlobalPositions += cells[dimIdx][zoneIdx] + 1; + + globalPositions[dimIdx].resize(numGlobalPositions); + std::size_t posIdx = 0; + for (int zoneIdx = 0; zoneIdx < cells[dimIdx].size(); ++zoneIdx) + { + const Scalar lower = positions[dimIdx][zoneIdx]; + const Scalar upper = positions[dimIdx][zoneIdx+1]; + const int numCells = cells[dimIdx][zoneIdx]; + Scalar gradingFactor = grading[dimIdx][zoneIdx]; + const Scalar length = upper - lower; + Scalar height = 1.0; + bool increasingCellSize = false; + + if (verbose) + { + std::cout << "dim " << dimIdx + << " lower " << lower + << " upper " << upper + << " numCells " << numCells + << " grading " << gradingFactor; + } + + if (gradingFactor > 1.0) + increasingCellSize = true; + + // take absolute values and reverse cell size increment to achieve + // reverse behavior for negative values + if (gradingFactor < 0.0) + { + using std::abs; + gradingFactor = abs(gradingFactor); + + if (gradingFactor < 1.0) + increasingCellSize = true; + } + + // if the grading factor is exactly 1.0 do equal spacing + if (gradingFactor > 1.0 - 1e-7 && gradingFactor < 1.0 + 1e-7) + { + height = 1.0 / numCells; + if (verbose) + std::cout << " -> h " << height * length << std::endl; + } + + // if grading factor is not 1.0, do power law spacing + else + { + height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells)); + + if (verbose) + { + std::cout << " -> grading_eff " << gradingFactor + << " h_min " << height * pow(gradingFactor, 0) * length + << " h_max " << height * pow(gradingFactor, numCells-1) * length + << std::endl; + } + } + + // the positions inside a global segment + Dune::DynamicVector localPositions(numCells, 0.0); + for (int i = 1; i < numCells; i++) + { + Scalar hI = height; + if (!(gradingFactor < 1.0 + 1e-7 && gradingFactor > 1.0 - 1e-7)) + { + if (increasingCellSize) + hI *= pow(gradingFactor, i-1); + + else + hI *= pow(gradingFactor, numCells-i); + } + localPositions[i] = localPositions[i-1] + hI; + } + + localPositions *= length; + localPositions += lower; + + for (int i = 0; i < numCells; ++i) + globalPositions[dimIdx][posIdx++] = localPositions[i]; + } + + globalPositions[dimIdx][posIdx] = positions[dimIdx].back(); + } + + polarCoordinates[0] = globalPositions[indices[0]]; + polarCoordinates[1] = globalPositions[indices[1]]; + if (dim == 3) + polarCoordinates[2] = globalPositions[dim - indices[0] - indices[1]]; + + // convert angular coordinates into radians + std::transform(polarCoordinates[1].begin(), polarCoordinates[1].end(), + polarCoordinates[1].begin(), + [](Scalar s){ return s*M_PI/180; }); + + } + catch (Dumux::ParameterException &e) + { + DUNE_THROW(Dumux::ParameterException, "Please supply all mandatory parameters:" << std::endl + << GET_PROP_VALUE(TypeTag, GridParameterGroup) + << ".Positions0, ..." << std::endl); + } + catch (...) { throw; } + } + + /*! + * \brief Creates cartesian grid from polar coordinates. + * + * \param polarCoordinates Vector containing radial, angular and axial coordinates (in this order) + * \param indices Indices specifing the radial, angular and axial direction (in this order) + */ + static std::shared_ptr createCakeGrid(std::array &polarCoordinates, + Dune::FieldVector &indices, + bool verbose = false) + { + ScalarVector dR = polarCoordinates[0]; + ScalarVector dA = polarCoordinates[1]; + + GridFactory gridFactory; + Dune::GeometryType type; type.makeCube(dim); + + // create nodes + if (dim == 3) + { + ScalarVector dZ = polarCoordinates[2]; + for (int j = 0; j <= dA.size() - 1; ++j) + { + for (int l = 0; l <= dZ.size() - 1; ++l) + { + for (int i = 0; i <= dR.size()- 1; ++i) + { + // Get radius for the well (= a hole) in the center + const Scalar wellRadius = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Grid, WellRadius); + + // transform into cartesian Coordinates + using std::cos; + using std::sin; + Dune::FieldVector v(0.0); + v[indices[2]] = dZ[l]; + v[indices[0]] = cos(dA[j])*wellRadius + cos(dA[j])*dR[i]; + v[indices[1]] = sin(dA[j])*wellRadius + sin(dA[j])*dR[i]; + if (verbose) + { + std::cout << "Coordinates of : " + << v[0] << " " << v[1] << " " << v[2] << std::endl; + } + gridFactory.insertVertex(v); + } + } + } + + if (verbose) + std::cout << "Filled node vector" << std::endl; + + // assign nodes + unsigned int z = 0; + unsigned int t = 0; + for (int j = 0; j < dA.size() - 1; ++j) + { + for (int l = 0; l < dZ.size() - 1; ++l) + { + if (j < dA.size() - 2) + { + for (int i = 0; i < dR.size() - 1; ++i) + { + unsigned int rSize = dR.size(); + unsigned int zSize = dZ.size(); + std::vector vid({z, z+1, z+rSize*zSize, + z+rSize*zSize+1, z+rSize, z+rSize+1, + z+rSize*zSize+rSize, z+rSize*zSize+rSize+1}); + + if (verbose) + { + std::cout << "element vertex ids: "; + for (int k = 0; k < vid.size(); ++k) + std::cout << vid[k] << " "; + std::cout << std::endl; + } + + gridFactory.insertElement(type, vid); + + z = z+1; + } + z = z+1; + } + else + { + // assign nodes for 360°-cake + for (int i = 0; i < dR.size() - 1; ++i) + { + // z = z + 1; + unsigned int rSize = dR.size(); + std::vector vid({z, z+1, t, + t+1, z+rSize, z+rSize+1, + t+rSize, t+rSize+1}); + + if (verbose) + { + std::cout << "element vertex ids: "; + for (int k = 0; k < vid.size(); ++k) + std::cout << vid[k] << " "; + std::cout << std::endl; + } + + gridFactory.insertElement(type, vid); + t = t + 1; + z = z+1; + } + t = t + 1; + z = z+1; + } + if (verbose) + std::cout << "assign nodes 360° ends..." << std::endl; + } + + z = z + dR.size(); + } + } + + // for dim = 2 + else + { + for (int j = 0; j <= dA.size() - 1; ++j) + { + for (int i = 0; i <= dR.size()- 1; ++i) + { + // Get radius for the well (= a hole) in the center + const Scalar wellRadius = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Grid, WellRadius); + + // transform into cartesian Coordinates + Dune::FieldVector v(0.0); + + v[indices[0]] = cos(dA[j])*wellRadius + cos(dA[j])*dR[i]; + v[indices[1]] = sin(dA[j])*wellRadius + sin(dA[j])*dR[i]; + if(verbose) std::cout << "Coordinates of : " << v[0] << " " << v[1] << std::endl; + gridFactory.insertVertex(v); + } + } + std::cout << "Filled node vector" << std::endl; + + // assign nodes + unsigned int z = 0; + unsigned int t = 0; + for (int j = 0; j < dA.size() - 1; ++j) + { + if (j < dA.size() - 2) + { + for (int i = 0; i < dR.size() - 1; ++i) + { + unsigned int rSize = dR.size(); + std::vector vid({z, z+1, z+rSize, z+rSize+1}); + + if (verbose) + { + std::cout << "element vertex ids: "; + for (int k = 0; k < vid.size(); ++k) + std::cout << vid[k] << " "; + std::cout << std::endl; + } + + gridFactory.insertElement(type, vid); + z = z+1; + } + z = z+1; + } + else + { + // assign nodes for 360°-cake + for (int i = 0; i < dR.size() - 1; ++i) + { + // z = z + 1; + std::vector vid({z, z+1, t, t+1}); + + if (verbose) + { + std::cout << "element vertex ids: "; + for (int k = 0; k < vid.size(); ++k) + std::cout << vid[k] << " "; + std::cout << std::endl; + } + + gridFactory.insertElement(type, vid); + t = t + 1; + z = z+1; + } + t = t + 1; + z = z+1; + } + std::cout << "assign nodes 360 ends..." << std::endl; + } + } + // return the grid pointer + return std::shared_ptr(gridFactory.createGrid()); + + } + + /*! + * \brief Returns a reference to the grid. + */ + static Grid &grid() + { + return *gridPtr(); + } + + /*! + * \brief Distributes the grid on all processes of a parallel + * computation. + */ + static void loadBalance() + { + gridPtr()->loadBalance(); + } + + /*! + * \brief Returns a reference to the shared pointer to the grid. + */ + static GridPointer &gridPtr() + { + static GridPointer cakeGrid; + return cakeGrid; + } +}; + +} + +#endif diff --git a/dumux/io/container.hh b/dumux/io/container.hh index 5e5f495abd0e7e7b1cda1f7450b65c20f917c328..c596918fee84913eb440b240a3cfdb9c60467d7b 100644 --- a/dumux/io/container.hh +++ b/dumux/io/container.hh @@ -28,6 +28,7 @@ #include #include +#include namespace Dumux { diff --git a/dumux/io/cpgridcreator.hh b/dumux/io/cpgridcreator.hh index 741f9209282119df4793add0092f8719dcc88c51..b14f47845b6d0793e8ec7c34d173a77e49f12a7f 100644 --- a/dumux/io/cpgridcreator.hh +++ b/dumux/io/cpgridcreator.hh @@ -50,6 +50,7 @@ class CpGridCreator typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; typedef std::shared_ptr GridPointer; + typedef Opm::Deck Deck; public: /*! @@ -59,12 +60,11 @@ public: { std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Grid, File); - parser_() = *(new Opm::ParserPtr(new Opm::Parser())); - Opm::ParseContext parseContext; - deck() = *(new Opm::DeckConstPtr(parser_()->parseFile(fileName, parseContext))); + deck() = Opm::Parser().parseFile(fileName); + Opm::EclipseGrid ecl_grid(deck()); gridPtr() = std::make_shared(*(new Grid())); - gridPtr()->processEclipseFormat(deck(), 0.0, false, false); + gridPtr()->processEclipseFormat(ecl_grid, false, false); } /*! @@ -89,9 +89,9 @@ public: * * The input deck can be used to read parameters like porosity/permeability. */ - static Opm::DeckConstPtr &deck() + static Deck &deck() { - static Opm::DeckConstPtr deck_; + static Deck deck_; return deck_; } @@ -102,13 +102,6 @@ public: { gridPtr()->loadBalance(); } - -private: - static Opm::ParserPtr &parser_() - { - static Opm::ParserPtr parser; - return parser; - } }; } #endif // HAVE_OPM_GRID diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh index ea23705a49f63f8168d300f5838e7b71ef23431d..bd37789ea1fdca6928613805d5772657f58e458d 100644 --- a/dumux/io/gnuplotinterface.hh +++ b/dumux/io/gnuplotinterface.hh @@ -56,23 +56,21 @@ class GnuplotInterface { public: typedef std::vector StringVector; - enum PlotStyle - { - lines, points, linesPoints, impulses, dots - }; + enum class CurveType + { function, file, data }; + typedef std::vector CurveTypeVector; //! \brief The constructor GnuplotInterface(bool persist = true) : pipe_(0), openPlotWindow_(true), persist_(persist), - datafileSeparator_(' '), plotStyle_("lines"), - curveFile_(0), curveOptions_(0), curveTitle_(0), - xRangeMin_(1e100), xRangeMax_(-1e100), - yRangeMin_(1e100), yRangeMax_(-1e100), + terminalType_("x11"), outputDirectory_("./"), + datafileSeparator_(' '), linetype_("solid"), + xRangeIsSet_(false), yRangeIsSet_(false), xLabel_(""), yLabel_(""), - plotOptions_(""), gnuplotPath_(GNUPLOT_EXECUTABLE) { open(persist_); + resetPlot(); } //! \brief The destructor @@ -88,39 +86,62 @@ public: * \param plottingWindowNumber Change the number of the window in which the plot is shown * \param terminalType Set the terminal type for the graphical output */ - void plot(const std::string &title, const unsigned int plottingWindowNumber = 0, const std::string& terminalType = "x11") + DUNE_DEPRECATED_MSG("The signature of plot(string, int, string) has been changed to plot(string).") + void plot(const std::string &title, const unsigned int plottingWindowNumber, const std::string& terminalType = "x11") + { + setTerminalType(terminalType); + plot(title); + } + + /*! + * \brief Plots the files for a specific window number, writes a gnuplot and png file. + * + * \param filename The name of the output file + */ + void plot(const std::string &filename = "") { // set correct terminal and general options std::string plot = "reset\n"; - plot += "set datafile separator \'" + convertToString(datafileSeparator_) + "\'\n"; - if (plottingWindowNumber != 0) - plot += "set term " + terminalType + " " + convertToString(plottingWindowNumber) + " \n"; - if (xRangeMin_ < 1e100 || xRangeMax_ > -1e100) - { - plot += "set xrange [" + convertToString(xRangeMin_) - + ":" + convertToString(xRangeMax_) + "]" + "\n"; - } - if (yRangeMin_ < 1e100 || yRangeMax_ > -1e100) - { - plot += "set yrange [" + convertToString(yRangeMin_) - + ":" + convertToString(yRangeMax_) + "]" + "\n"; - } + plot += "set datafile separator \'" + std::string(1, datafileSeparator_) + "\'\n"; + + // set the terminal if the defaults were overwritten + if (terminalType_.compare("x11") != 0 || linetype_.compare("solid") != 0) + plot += "set term " + terminalType_ + " " + linetype_ + " " + " \n"; + + // set the labels and axes ranges plot += "set xlabel \"" + xLabel_ + "\"\n"; plot += "set ylabel \"" + yLabel_ + "\"\n"; + if (xRangeIsSet_) + plot += "set xrange [" + std::to_string(xRangeMin_) + ":" + std::to_string(xRangeMax_) + "]" + "\n"; + if (yRangeIsSet_) + plot += "set yrange [" + std::to_string(yRangeMin_) + ":" + std::to_string(yRangeMax_) + "]" + "\n"; // set user defined options plot += plotOptions_ + "\n"; // plot curves plot += "plot"; - for (unsigned int i = 0; i < curveFile_.size(); ++i) + std::string plotCommandForFile(plot); + for (unsigned int i = 0; i < curve_.size(); ++i) { - plot += + " " + curveFile_[i] - + " " + curveOptions_[i] - + " title '" + curveTitle_[i] + "'"; - if (i < curveFile_.size()-1) + if (curveType_[i] == CurveType::function) + { + plot += + " " + curve_[i] + " " + curveOptions_[i]; + plotCommandForFile += + " " + curve_[i] + " " + curveOptions_[i]; + } + else + { + plot += + " '" + outputDirectory_ + curve_[i] + "' " + curveOptions_[i]; + plotCommandForFile += + " '" + curve_[i] + "' " + curveOptions_[i]; + } + + if (i < curve_.size()-1) + { plot += ",\\"; + plotCommandForFile += ",\\"; + } plot += "\n"; + plotCommandForFile += "\n"; } // live plot of the results if gnuplot is installed @@ -129,28 +150,19 @@ public: executeGnuplot(plot.c_str()); #endif - // create a gnuplot file for output a png - plot += "\n"; - plot += "set term pngcairo size 800,600\n"; - plot += "set output \"" + title + ".png\"\n"; - plot += "replot\n"; - std::string fileName = title + ".gp"; - std::ofstream file; - file.open(fileName); - file << plot; - file.close(); - } - - /*! - * \brief Deletes all plots from a plotting window and resets user-defined options - */ - DUNE_DEPRECATED_MSG("reset() is deprecated. Use resetPlot() instead.") - void reset() - { - curveFile_.resize(0); - curveOptions_.resize(0); - curveTitle_.resize(0); - plotOptions_ = ""; + // create a gnuplot file if a filename is specified + if (filename.compare("") != 0) + { + plotCommandForFile += "\n"; + plotCommandForFile += "set term pngcairo size 800,600 " + linetype_ + " \n"; + plotCommandForFile += "set output \"" + filename + ".png\"\n"; + plotCommandForFile += "replot\n"; + std::string gnuplotFileName = outputDirectory_ + filename + ".gp"; + std::ofstream file; + file.open(gnuplotFileName); + file << plotCommandForFile; + file.close(); + } } /*! @@ -168,14 +180,13 @@ public: */ void resetPlot() { - curveFile_.resize(0); - curveOptions_.resize(0); - curveTitle_.resize(0); + curve_.clear(); + curveOptions_.clear(); plotOptions_ = ""; } /*! - * \brief Closes gnuplot + * \brief Opens gnuplot */ void open(const bool persist = true) { @@ -194,80 +205,82 @@ public: assert("Could not close pipe to Gnuplot!"); } + DUNE_DEPRECATED_MSG("The signature of addFunctionToPlot(string, string, string) has been changed to addFunctionToPlot(string, string).") + void addFunctionToPlot(const std::string function, + const std::string plotName, + const std::string plotOptions) + { + addFunctionToPlot(function, "title '" + plotName + "' " + plotOptions); + } + /*! - * \brief Adds a function to list of plotted lines + * \brief Adds a function to list of plots * * \param function Function to be plotted - * \param plotName The name of the data set - * \param plotOptions Specific gnuplot options passed to this plot + * \param options Specific gnuplot options passed to this plot */ void addFunctionToPlot(const std::string function, - const std::string plotName, - const std::string plotOptions = "with lines") + const std::string options = "with lines") + { + curve_.push_back(function); + curveOptions_.push_back(options); + curveType_.push_back(CurveType::function); + } + + DUNE_DEPRECATED_MSG("The signature of addFileToPlot(string, string, string) has been changed to addFileToPlot(string, string).") + void addFileToPlot(const std::string file, + const std::string plotName, + const std::string plotOptions) { - curveFile_.push_back(function); - curveOptions_.push_back(plotOptions); - curveTitle_.push_back(plotName); + addFileToPlot(file, "title '" + plotName + "' " + plotOptions); } /*! - * \brief Adds a file to list of plotted lines + * \brief Adds a file to list of plots * - * \param file Function to be plotted - * \param plotName The name of the data set - * \param plotOptions Specific gnuplot options passed to this plot + * \param fileName Name and path of the file to be plotted + * \param options Specific gnuplot options passed to this plot */ - void addFileToPlot(const std::string file, - const std::string plotName, - const std::string plotOptions = "with lines") + void addFileToPlot(const std::string fileName, + const std::string options = "with lines") { - curveFile_.push_back("'" + file + "'"); - curveOptions_.push_back(plotOptions); - curveTitle_.push_back(plotName); + curve_.push_back(fileName); + curveOptions_.push_back(options); + curveType_.push_back(CurveType::file); } /*! * \brief Adds a data set and writes a data file * + * The title of the plot can be changed by setting the title in the options + * * \param x Vector containing the x-axis data points * \param y Vector containing the y-axis data points - * \param plotName The name of the data set - * \param plotOptions Specific gnuplot options passed to this plot + * \param fileName The name of the written data file + * \param options Specific gnuplot options passed to this plot */ void addDataSetToPlot(const std::vector& x, const std::vector& y, - const std::string plotName, - const std::string plotOptions = "with lines") + const std::string fileName, + const std::string options = "with lines") { assert(x.size() == y.size()); - //write data to file - std::string fileName = plotName + ".dat"; + // write data to file std::ofstream file; - file.open(fileName); + file.open(outputDirectory_ + fileName); for (unsigned int i = 0; i < x.size(); i++) { - checkNumber(x[i], "x[i] i=" + convertToString(i) + " in " + fileName); - checkNumber(y[i], "y[i] i=" + convertToString(i) + " in " + fileName); + checkNumber(x[i], "x[i] i=" + std::to_string(i) + " in " + fileName); + checkNumber(y[i], "y[i] i=" + std::to_string(i) + " in " + fileName); file << x[i] << datafileSeparator_ << y[i] << std::endl; } file.close(); // adding file to list of plotted lines - curveFile_.push_back("'" + fileName + "'"); - curveOptions_.push_back(plotOptions); - curveTitle_.push_back(plotName); - } - - /*! - * \brief Set whether a gnuplot window will be opened or not - * - * \param interaction Open window or not - */ - DUNE_DEPRECATED_MSG("setInteraction() is deprecated. Use setOpenPlotWindow() instead.") - void setInteraction(bool interaction) - { - setOpenPlotWindow(interaction); + curve_.push_back(fileName); + curveOptions_.push_back(options); + curveType_.push_back(CurveType::data); } /*! @@ -293,25 +306,27 @@ public: /*! * \brief Sets the range for the x-axis * - * \param lowerEnd The lowest plotted value for the x-axis - * \param upperEnd The highest plotted value for the x-axis + * \param min The lowest plotted value for the x-axis + * \param max The highest plotted value for the x-axis */ - void setXRange(Scalar lowerEnd, Scalar upperEnd) + void setXRange(Scalar min, Scalar max) { - xRangeMin_ = std::min(xRangeMin_, lowerEnd); - xRangeMax_ = std::max(xRangeMax_, upperEnd); + xRangeMin_ = min; + xRangeMax_ = max; + xRangeIsSet_ = true; } /*! * \brief Sets the range for the y-axis * - * \param lowerEnd The lowest plotted value for the y-axis - * \param upperEnd The highest plotted value for the y-axis + * \param min The lowest plotted value for the y-axis + * \param max The highest plotted value for the y-axis */ - void setYRange(Scalar lowerEnd, Scalar upperEnd) + void setYRange(Scalar min, Scalar max) { - yRangeMin_ = std::min(yRangeMin_, lowerEnd); - yRangeMax_ = std::max(yRangeMax_, upperEnd); + yRangeMin_ = min; + yRangeMax_ = max; + yRangeIsSet_ = true; } /*! @@ -344,6 +359,36 @@ public: datafileSeparator_ = separator; } + /*! + * \brief Sets the terminal used for interactive outpu + * + * \param terminal The user-specified terminal + */ + void setTerminalType(std::string terminal) + { + terminalType_ = terminal; + } + + /*! + * \brief Sets the output directory for data and gnuplot files + * + * \param outputDirectory The user-specified terminal + */ + void setOutputDirectory(std::string outputDirectory) + { + outputDirectory_ = outputDirectory + "/"; + } + + /*! + * \brief Use dashed (true) or solid (false) lines + * + * \param dashed Use dashed lines + */ + void useDashedLines(bool dashed) + { + linetype_ = dashed ? "dashed" : "solid"; + } + private: // Give plot command to gnuplot void executeGnuplot(const std::string& plotCommand) const @@ -355,34 +400,31 @@ private: // Check validity of number void checkNumber(Scalar number, std::string text = "") const { - if (std::isnan(number)) + using std::isnan; + using std::isinf; + if (isnan(number)) Dune::dwarn << "warning: " << text << " is not a number, adjust your data range" << std::endl; - if (std::isinf(number)) + if (isinf(number)) Dune::dwarn << "warning: " << text << " is infinity, adjust your data range" << std::endl; } - // Convert number or character to string - template - std::string convertToString(const T input) const - { - std::ostringstream stream; - stream << input; - return stream.str(); - } - std::FILE * pipe_; bool openPlotWindow_; bool persist_; + std::string terminalType_; + std::string outputDirectory_; char datafileSeparator_; - std::string plotStyle_; - StringVector curveFile_; + std::string linetype_; + StringVector curve_; StringVector curveOptions_; - StringVector curveTitle_; + CurveTypeVector curveType_; bool interaction_; Scalar xRangeMin_; Scalar xRangeMax_; + Scalar xRangeIsSet_; Scalar yRangeMin_; Scalar yRangeMax_; + Scalar yRangeIsSet_; std::string xLabel_; std::string yLabel_; std::string plotOptions_; diff --git a/dumux/io/gridcreator.hh b/dumux/io/gridcreator.hh index a972c38d58215a8af7a9fc216952a7f9e66da68e..94f18994a79f1454d027447f1a5ba25706595449 100644 --- a/dumux/io/gridcreator.hh +++ b/dumux/io/gridcreator.hh @@ -765,6 +765,7 @@ public: } std::array globalPositions; + using std::pow; for (int dimIdx = 0; dimIdx < dim; dimIdx++) { for (int zoneIdx = 0; zoneIdx < cells[dimIdx].size(); ++zoneIdx) @@ -775,7 +776,7 @@ public: Scalar gradingFactor = grading[dimIdx][zoneIdx]; Scalar length = upper - lower; Scalar height = 1.0; - bool reverse = false; + bool increasingCellSize = false; if (verbose) { @@ -786,6 +787,24 @@ public: << " grading " << gradingFactor; } + if (gradingFactor > 1.0) + { + increasingCellSize = true; + } + + // take absolute values and reverse cell size increment to achieve + // reverse behavior for negative values + if (gradingFactor < 0.0) + { + using std::abs; + gradingFactor = abs(gradingFactor); + if (gradingFactor < 1.0) + { + increasingCellSize = true; + } + } + + // if the grading factor is exactly 1.0 do equal spacing if (gradingFactor > 1.0 - 1e-7 && gradingFactor < 1.0 + 1e-7) { height = 1.0 / numCells; @@ -794,31 +813,16 @@ public: std::cout << " -> h " << height * length << std::endl; } } + // if grading factor is not 1.0, do power law spacing else { - if (gradingFactor < -1.0) - { - gradingFactor = -gradingFactor; - } - else if (gradingFactor > 0.0 && gradingFactor < 1.0) - { - gradingFactor = 1.0 / gradingFactor; - } - else if (gradingFactor > 1.0) - { - reverse = true; - } - else - { - DUNE_THROW(Dune::NotImplemented, "This grading factor is not implemented."); - } - height = (1.0 - gradingFactor) / (1.0 - std::pow(gradingFactor, numCells)); + height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells)); if (verbose) { std::cout << " -> grading_eff " << gradingFactor - << " h_min " << height * std::pow(gradingFactor, 0) * length - << " h_max " << height * std::pow(gradingFactor, numCells-1) * length + << " h_min " << height * pow(gradingFactor, 0) * length + << " h_max " << height * pow(gradingFactor, numCells-1) * length << std::endl; } } @@ -830,13 +834,13 @@ public: Scalar hI = height; if (!(gradingFactor < 1.0 + 1e-7 && gradingFactor > 1.0 - 1e-7)) { - if (reverse) + if (increasingCellSize) { - hI *= std::pow(gradingFactor, i); + hI *= pow(gradingFactor, i); } else { - hI *= std::pow(gradingFactor, numCells-i-1); + hI *= pow(gradingFactor, numCells-i-1); } } localPositions.push_back(localPositions[i] + hI); diff --git a/dumux/io/ploteffectivediffusivitymodel.hh b/dumux/io/ploteffectivediffusivitymodel.hh index d850723b747178197ad6fdcd80a97482d6041f46..f28322afd3d658dfa329a9648c501f9c74b12068 100644 --- a/dumux/io/ploteffectivediffusivitymodel.hh +++ b/dumux/io/ploteffectivediffusivitymodel.hh @@ -24,8 +24,6 @@ #ifndef DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH #define DUMUX_PLOT_EFFECTIVE_DIFFUSIVITY_MODEL_HH -#include - #include #include @@ -48,14 +46,6 @@ class PlotEffectiveDiffusivityModel typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; public: - //! Constructor - DUNE_DEPRECATED_MSG("PlotEffectiveDiffusivityModel(bool) is deprecated. Use PlotEffectiveDiffusivityModel() instead.") - PlotEffectiveDiffusivityModel(bool interaction) - : numIntervals_(1000) - { - gnuplot_.setInteraction(interaction); - } - //! Constructor PlotEffectiveDiffusivityModel() : numIntervals_(1000) @@ -65,7 +55,7 @@ public: * \brief Add a effective diffusion factor-saturation data set to the plot * * \param gnuplot The gnuplot interface - * \param params The material law parameters + * \param porosity The porosity * \param lowerSat Minimum x-value for data set * \param upperSat Maximum x-value for data set * \param curveName Name of the data set @@ -94,46 +84,8 @@ public: gnuplot.addDataSetToPlot(sw, deff, curveName, curveOptions); } - /*! - * \brief Plot the effective diffusion factor-saturation curve - * - * \param porosity The porosity of the porous medium - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotdeff() is deprecated. Use adddeffcurve() instead.") - void plotdeff(Scalar porosity, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw(numIntervals_+1); - std::vector deff(numIntervals_+1); - Scalar satInterval = upperSat - lowerSat; - Scalar deffMin = 1e100; - Scalar deffMax = -1e100; - - for (int i = 0; i <= numIntervals_; i++) - { - sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - deff[i] = EffectiveDiffusivityModel::effectiveDiffusivity(porosity, sw[i], - 1.0 /*Diffusion Coefficient*/); - deffMin = std::min(deffMin, deff[i]); - deffMax = std::max(deffMax, deff[i]); - } - - gnuplot_.setXRange(lowerSat, upperSat); - gnuplot_.setYRange(deffMin, deffMax); - gnuplot_.setXlabel("phase saturation [-]"); - gnuplot_.setYlabel("effective diffusion/molecular diffusion [-]"); - gnuplot_.addDataSetToPlot(sw, deff, curveTitle + "_d_eff"); - gnuplot_.plot("deff"); - } - private: int numIntervals_; - GnuplotInterface gnuplot_; }; } // end of namespace diff --git a/dumux/io/plotmateriallaw.hh b/dumux/io/plotmateriallaw.hh index 00188c06a10e9175889055c6c4035805acba3761..0191a1303edeb4536ad149d48d18829166d1bb33 100644 --- a/dumux/io/plotmateriallaw.hh +++ b/dumux/io/plotmateriallaw.hh @@ -24,8 +24,6 @@ #ifndef DUMUX_PLOT_FLUID_MATRIX_LAW_HH #define DUMUX_PLOT_FLUID_MATRIX_LAW_HH -#include - #include #include @@ -50,19 +48,6 @@ class PlotMaterialLaw typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; public: - //! Constructor - DUNE_DEPRECATED_MSG("PlotMaterialLaw(bool) is deprecated. Use PlotMaterialLaw() instead.") - PlotMaterialLaw(bool interaction) - : numIntervals_(1000) - { - gnuplotpcsw_.setInteraction(interaction); - gnuplotswpc_.setInteraction(interaction); - gnuplotdpcdsw_.setInteraction(interaction); - gnuplotdswdpc_.setInteraction(interaction); - gnuplotkr_.setInteraction(interaction); - gnuplotkrdsw_.setInteraction(interaction); - } - //! Constructor PlotMaterialLaw() : numIntervals_(1000) @@ -100,55 +85,6 @@ public: gnuplot.addDataSetToPlot(sw, pc, curveName, curveOptions); } - /*! - * \brief Plot the capillary pressure-saturation curve - * - * \param params The material law parameters - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotpcsw() is deprecated. Use addpcswcurve() instead.") - void plotpcsw(const MaterialLawParams ¶ms, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw; - std::vector pc; - Scalar satInterval = upperSat - lowerSat; - Scalar pcMin = 0.0; - Scalar pcMax = -1e100; - - Scalar swTemp, pcTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - pcTemp = MaterialLaw::pc(params, swTemp); - if (checkValues_(swTemp, pcTemp)) - { - sw.push_back(swTemp); - pc.push_back(pcTemp); - pcMin = std::min(pcMin, pcTemp); - pcMax = std::max(pcMax, pcTemp); - } - } - - // use log scale for very high capillary pressures - if (pcMax / std::max(pcMin, 1.0) > 1e6) - { - gnuplotpcsw_.setOption("set log y"); - pcMin = std::max(pcMin, 1.0); - } - - gnuplotpcsw_.setXRange(lowerSat, upperSat); - gnuplotpcsw_.setYRange(pcMin, pcMax); - gnuplotpcsw_.setXlabel("wetting phase saturation [-]"); - gnuplotpcsw_.setYlabel("capillary pressure [Pa]"); - gnuplotpcsw_.addDataSetToPlot(sw, pc, curveTitle + "_pc-Sw"); - gnuplotpcsw_.plot("pc-Sw"); - } - /*! * \brief Add a saturation-capillary pressure data set to the plot * @@ -187,48 +123,6 @@ public: gnuplot.addDataSetToPlot(pc, sw, curveName, curveOptions); } - /*! - * \brief Plot the saturation-capillary pressure curve - * - * \param params The material law parameters - * \param lowerpc Minimum x-value - * \param upperpc Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotswpc() is deprecated. Use addswpccurve() instead.") - void plotswpc(const MaterialLawParams ¶ms, - Scalar lowerpc = 0.0, - Scalar upperpc = 5000.0, - std::string curveTitle = "") - { - std::vector sw; - std::vector pc; - Scalar pcInterval = upperpc - lowerpc; - Scalar swMin = 1e100; - Scalar swMax = -1e100; - - Scalar pcTemp, swTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_); - swTemp = MaterialLaw::sw(params, pcTemp); - if (checkValues_(pcTemp, swTemp)) - { - pc.push_back(pcTemp); - sw.push_back(swTemp); - swMin = std::min(swMin, swTemp); - swMax = std::max(swMax, swTemp); - } - } - - gnuplotswpc_.setXRange(lowerpc, upperpc); - gnuplotswpc_.setYRange(swMin, swMax); - gnuplotswpc_.setXlabel("capillary pressure [Pa]"); - gnuplotswpc_.setYlabel("wetting phase saturation [-]"); - gnuplotswpc_.addDataSetToPlot(pc, sw, curveTitle + "_Sw-pc"); - gnuplotswpc_.plot("sw-pc"); - } - /*! * \brief Add a capillary pressure-saturation gradient data set to the plot * @@ -267,48 +161,6 @@ public: gnuplot.addDataSetToPlot(sw, dpcdsw, curveName, curveOptions); } - /*! - * \brief Plot the gradient of the capillary pressure-saturation curve - * - * \param params The material law parameters - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotdpcdsw() is deprecated. Use adddpcdswcurve() instead.") - void plotdpcdsw(const MaterialLawParams ¶ms, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw; - std::vector dpcdsw; - Scalar satInterval = upperSat - lowerSat; - Scalar dpcdswMin = 1e100; - Scalar dpcdswMax = -1e100; - - Scalar swTemp, dpcdswTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - dpcdswTemp = MaterialLaw::dpc_dsw(params, swTemp); - if (checkValues_(swTemp, dpcdsw)) - { - sw.push_back(swTemp); - dpcdsw.push_back(dpcdswTemp); - dpcdswMin = std::min(dpcdswMin, dpcdswTemp); - dpcdswMax = std::max(dpcdswMax, dpcdswTemp); - } - } - - gnuplotdpcdsw_.setXRange(lowerSat, upperSat); - gnuplotdpcdsw_.setYRange(dpcdswMin, dpcdswMax); - gnuplotdpcdsw_.setXlabel("wetting phase saturation [-]"); - gnuplotdpcdsw_.setYlabel("gradient of the pc-Sw curve [Pa]"); - gnuplotdpcdsw_.addDataSetToPlot(sw, dpcdsw, curveTitle + "_dpcdSw-Sw"); - gnuplotdpcdsw_.plot("dpcdsw"); - } - /*! * \brief Add a saturation-capillary pressure gradient data set to the plot * @@ -347,48 +199,6 @@ public: gnuplot.addDataSetToPlot(pc, dswdpc, curveName, curveOptions); } - /*! - * \brief Plot the gradient of the saturation-capillary pressure curve - * - * \param params The material law parameters - * \param lowerpc Minimum x-value - * \param upperpc Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotdswdpc() is deprecated. Use adddswdpccurve() instead.") - void plotdswdpc(const MaterialLawParams ¶ms, - Scalar lowerpc = 0.0, - Scalar upperpc = 5000.0, - std::string curveTitle = "") - { - std::vector pc; - std::vector dswdpc; - Scalar pcInterval = upperpc - lowerpc; - Scalar dswdpcMin = 1e100; - Scalar dswdpcMax = -1e100; - - Scalar dswdpcTemp, pcTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_); - dswdpcTemp = MaterialLaw::dsw_dpc(params, pcTemp); - if (checkValues_(pcTemp, dswdpcTemp)) - { - pc.push_back(pcTemp); - dswdpc.push_back(dswdpcTemp); - dswdpcMin = std::min(dswdpcMin, dswdpcTemp); - dswdpcMax = std::max(dswdpcMax, dswdpcTemp); - } - } - - gnuplotdswdpc_.setXRange(lowerpc, upperpc); - gnuplotdswdpc_.setYRange(dswdpcMin, dswdpcMax); - gnuplotdswdpc_.setXlabel("capillary pressure [Pa]"); - gnuplotdswdpc_.setYlabel("gradient of the Sw-pc curve [1/Pa]"); - gnuplotdswdpc_.addDataSetToPlot(pc, dswdpc, curveTitle + "_dSwdpc-pc"); - gnuplotdswdpc_.plot("dswdpc"); - } - /*! * \brief Add relative permeabilities data sets to the plot * @@ -431,52 +241,6 @@ public: gnuplot.addDataSetToPlot(sw, krn, curveName + "_krn", curveOptions); } - /*! - * \brief Plot the relative permeabilities - * - * \param params The material law parameters - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotkr() is deprecated. Use addkrcurves() instead.") - void plotkr(const MaterialLawParams ¶ms, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw; - std::vector krw; - std::vector krn; - Scalar satInterval = upperSat - lowerSat; - Scalar krMin = 1e100; - Scalar krMax = -1e100; - - Scalar swTemp, krwTemp, krnTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - krwTemp = MaterialLaw::krw(params, swTemp); - krnTemp = MaterialLaw::krn(params, swTemp); - if (checkValues_(swTemp, krwTemp) && checkValues_(swTemp, krnTemp)) - { - sw.push_back(swTemp); - krw.push_back(krwTemp); - krn.push_back(krnTemp); - krMin = std::min({krMin, krwTemp, krnTemp}); - krMax = std::max({krMax, krwTemp, krnTemp}); - } - } - - gnuplotkr_.setXRange(lowerSat, upperSat); - gnuplotkr_.setYRange(krMin, krMax); - gnuplotkr_.setXlabel("wetting phase saturation [-]"); - gnuplotkr_.setYlabel("relative permeability [-]"); - gnuplotkr_.addDataSetToPlot(sw, krw, curveTitle + "_krw"); - gnuplotkr_.addDataSetToPlot(sw, krn, curveTitle + "_krn"); - gnuplotkr_.plot("kr"); - } - /*! * \brief Add relative permeabilities gradients data sets to the plot * @@ -519,52 +283,6 @@ public: gnuplot.addDataSetToPlot(sw, dkrn_dsw, curveName + "_dkrn_dsw", curveOptions); } - /*! - * \brief Plot the gradient of the relative permeabilities - * - * \param params The material law parameters - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotdkrdsw() is deprecated. Use adddkrdswcurves() instead.") - void plotdkrdsw(const MaterialLawParams ¶ms, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw; - std::vector dkrw_dsw; - std::vector dkrn_dsw; - Scalar satInterval = upperSat - lowerSat; - Scalar dkrdswMin = 1e100; - Scalar dkrdswMax = -1e100; - - Scalar swTemp, dkrwdswTemp, dkrndswTemp = 0.0; - for (int i = 0; i <= numIntervals_; i++) - { - swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - dkrwdswTemp = MaterialLaw::dkrw_dsw(params, swTemp); - dkrndswTemp = MaterialLaw::dkrn_dsw(params, swTemp); - if (checkValues_(swTemp, dkrwdswTemp) && checkValues_(swTemp, dkrndswTemp)) - { - sw.push_back(swTemp); - dkrw_dsw.push_back(dkrwdswTemp); - dkrn_dsw.push_back(dkrndswTemp); - dkrdswMin = std::min({dkrdswMin, dkrwdswTemp, dkrndswTemp}); - dkrdswMax = std::max({dkrdswMax, dkrwdswTemp, dkrndswTemp}); - } - } - - gnuplotkrdsw_.setXRange(lowerSat, upperSat); - gnuplotkrdsw_.setYRange(dkrdswMin, dkrdswMax); - gnuplotkrdsw_.setXlabel("wetting phase saturation [-]"); - gnuplotkrdsw_.setYlabel("gradient of the kr-Sw function [-]"); - gnuplotkrdsw_.addDataSetToPlot(sw, dkrw_dsw, curveTitle + "_dkrw_dsw"); - gnuplotkrdsw_.addDataSetToPlot(sw, dkrn_dsw, curveTitle + "_dkrn_dsw"); - gnuplotkrdsw_.plot("dkrndsw"); - } - private: /*! * \brief Check the values for occurrences of nan and inf @@ -574,17 +292,13 @@ private: */ bool checkValues_(Scalar value1, Scalar value2) { - return !std::isnan(value1) && !std::isinf(value1) - && !std::isnan(value2) && !std::isinf(value2); + using std::isnan; + using std::isinf; + return !isnan(value1) && !isinf(value1) + && !isnan(value2) && !isinf(value2); } int numIntervals_; - GnuplotInterface gnuplotpcsw_; - GnuplotInterface gnuplotswpc_; - GnuplotInterface gnuplotdpcdsw_; - GnuplotInterface gnuplotdswdpc_; - GnuplotInterface gnuplotkr_; - GnuplotInterface gnuplotkrdsw_; }; } // end of namespace diff --git a/dumux/io/plotmateriallaw3p.hh b/dumux/io/plotmateriallaw3p.hh index e49b7d5bcf6aec70fb08682fb819d18254da1677..901e74901232191d062816a67d3132efb72887ca 100644 --- a/dumux/io/plotmateriallaw3p.hh +++ b/dumux/io/plotmateriallaw3p.hh @@ -102,12 +102,14 @@ public: { swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); pcTemp = MaterialLaw::pcgw(params, swTemp); + using std::max; + using std::min; if (checkValues_(swTemp, pcTemp)) { sw.push_back(swTemp); pc.push_back(pcTemp); - pcMin = std::min(pcMin, pcTemp); - pcMax = std::max(pcMax, pcTemp); + pcMin = min(pcMin, pcTemp); + pcMax = max(pcMax, pcTemp); } } @@ -143,12 +145,14 @@ public: { swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); pcTemp = MaterialLaw::pcnw(params, swTemp); + using std::max; + using std::min; if (checkValues_(swTemp, pcTemp)) { sw.push_back(swTemp); pc.push_back(pcTemp); - pcMin = std::min(pcMin, pcTemp); - pcMax = std::max(pcMax, pcTemp); + pcMin = min(pcMin, pcTemp); + pcMax = max(pcMax, pcTemp); } } @@ -184,12 +188,14 @@ public: { stTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); pcTemp = MaterialLaw::pcgn(params, stTemp); + using std::max; + using std::min; if (checkValues_(stTemp, pcTemp)) { st.push_back(stTemp); pc.push_back(pcTemp); - pcMin = std::min(pcMin, pcTemp); - pcMax = std::max(pcMax, pcTemp); + pcMin = min(pcMin, pcTemp); + pcMax = max(pcMax, pcTemp); } } @@ -230,6 +236,8 @@ public: krwTemp = MaterialLaw::krw(params, swTemp, 0.0); krnTemp = MaterialLaw::krn(params, swTemp, 1.0 - swTemp); krgTemp = MaterialLaw::krg(params, swTemp, 0.0); + using std::max; + using std::min; if (checkValues_(swTemp, krwTemp) && checkValues_(swTemp, krnTemp) && checkValues_(swTemp, krgTemp)) @@ -238,8 +246,8 @@ public: krw.push_back(krwTemp); krn.push_back(krnTemp); krg.push_back(krgTemp); - krMin = std::min({krMin, krwTemp, krnTemp, krgTemp}); - krMax = std::max({krMax, krwTemp, krnTemp, krgTemp}); + krMin = min({krMin, krwTemp, krnTemp, krgTemp}); + krMax = max({krMax, krwTemp, krnTemp, krgTemp}); } } @@ -277,12 +285,14 @@ public: { snTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); alphaTemp = MaterialLaw::pcAlpha(params, snTemp); + using std::max; + using std::min; if (checkValues_(snTemp, alphaTemp)) { sn.push_back(snTemp); alpha.push_back(alphaTemp); - alphaMin = std::min(alphaMin, alphaTemp); - alphaMax = std::max(alphaMax, alphaTemp); + alphaMin = min(alphaMin, alphaTemp); + alphaMax = max(alphaMax, alphaTemp); } } @@ -303,8 +313,10 @@ private: */ bool checkValues_(Scalar value1, Scalar value2) { - return !std::isnan(value1) && !std::isinf(value1) - && !std::isnan(value2) && !std::isinf(value2); + using std::isnan; + using std::isinf; + return !isnan(value1) && !isinf(value1) + && !isnan(value2) && !isinf(value2); } int numIntervals_; diff --git a/dumux/io/plotthermalconductivitymodel.hh b/dumux/io/plotthermalconductivitymodel.hh index 45d934bbc9903bf8990cd77e539dcbce4d7f5ce6..74b3e2b41d8af45216f794416f9ae0dd7c0c3787 100644 --- a/dumux/io/plotthermalconductivitymodel.hh +++ b/dumux/io/plotthermalconductivitymodel.hh @@ -24,8 +24,6 @@ #ifndef DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH #define DUMUX_PLOT_THERMAL_CONDUCTIVITY_LAW_HH -#include - #include #include #include @@ -61,30 +59,6 @@ class PlotThermalConductivityModel }; public: - /*! - * \brief Constructor - * - * Initializes the fluid system. - * - * \param temperature temperature in \f$\mathrm{[K]}\f$ - * \param pressure reference pressure in \f$\mathrm{[Pa]}\f$ - * \param interaction Specifies whether a live output via a gnuplot window is wanted - */ - DUNE_DEPRECATED_MSG("PlotThermalConductivityModel(Scalar, Scalar, bool) is deprecated. Use PlotThermalConductivityModel(Scalar, Scalar) instead.") - PlotThermalConductivityModel(Scalar temperature, - Scalar pressure, - bool interaction) - : numIntervals_(1000) - { - FluidState fluidstate; - fluidstate.setTemperature(temperature); - fluidstate.setPressure(wPhaseIdx, pressure); - fluidstate.setPressure(nPhaseIdx, pressure); - lambdaW_ = FluidSystem::template thermalConductivity(fluidstate, wPhaseIdx); - lambdaN_ = FluidSystem::template thermalConductivity(fluidstate, nPhaseIdx); - gnuplot_.setInteraction(interaction); - } - /*! * \brief Constructor * @@ -109,7 +83,9 @@ public: * \brief Add a effective thermal conductivity-saturation curve to the plot * * \param gnuplot The gnuplot interface - * \param params The material law parameters + * \param porosity The porosity + * \param rhoSolid The solid density + * \param lambdaSolid Thermal conductivity of the solid * \param lowerSat Minimum x-value for data set * \param upperSat Maximum x-value for data set * \param curveName Name of the data set @@ -141,51 +117,8 @@ public: gnuplot.addDataSetToPlot(sw, lambda, curveName, curveOptions); } - /*! - * \brief Plot the effective thermal conductivity-saturation curve - * - * \param porosity The porosity of the porous medium - * \param rhoSolid The density of the solid material - * \param lambdaSolid The thermal conductivity of the solid material - * \param lowerSat Minimum x-value - * \param upperSat Maximum x-value - * \param curveTitle Name of the plotted curve - */ - DUNE_DEPRECATED_MSG("plotlambdaeff() is deprecated. Use addlambdaeffcurve() instead.") - void plotlambdaeff(Scalar porosity, - Scalar rhoSolid, - Scalar lambdaSolid, - Scalar lowerSat = 0.0, - Scalar upperSat = 1.0, - std::string curveTitle = "") - { - std::vector sw(numIntervals_+1); - std::vector lambda(numIntervals_+1); - Scalar satInterval = upperSat - lowerSat; - Scalar lambdaMin = 0.0; - Scalar lambdaMax = -1e100; - - for (int i = 0; i <= numIntervals_; i++) - { - sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_); - lambda[i] = ThermalConductivityModel::effectiveThermalConductivity(sw[i], lambdaW_, - lambdaN_, lambdaSolid, - porosity, rhoSolid); - lambdaMin = std::min(lambdaMin, lambda[i]); - lambdaMax = std::max(lambdaMax, lambda[i]); - } - - gnuplot_.setXRange(lowerSat, upperSat); - gnuplot_.setYRange(lambdaMin, lambdaMax); - gnuplot_.setXlabel("wetting phase saturation [-]"); - gnuplot_.setYlabel("effective thermal conductivity [W/(m K)]"); - gnuplot_.addDataSetToPlot(sw, lambda, curveTitle + "_lambda_eff"); - gnuplot_.plot("lambdaeff"); - } - private: int numIntervals_; - GnuplotInterface gnuplot_; Scalar lambdaN_; Scalar lambdaW_; }; diff --git a/dumux/io/restart.hh b/dumux/io/restart.hh index cd1fc50fa0fbb69d9a4b24a059c12f609b55754e..10dab4014fb78c9cc3b924c34673def17e3e2c45 100644 --- a/dumux/io/restart.hh +++ b/dumux/io/restart.hh @@ -93,7 +93,7 @@ public: const std::string magicCookie = magicRestartCookie_(problem.gridView()); fileName_ = restartFileName_(problem.gridView(), problem.name(), - problem.timeManager().time()); + problem.timeManager().time()+problem.timeManager().timeStepSize()); // open output file and write magic cookie outStream_.open(fileName_.c_str()); diff --git a/dumux/io/vtknestedfunction.hh b/dumux/io/vtknestedfunction.hh index 3bbda4cd7b5f5d6ddbb29d5fd39b7740f60c46ae..e9c3feafc35c35f82c8e2d67205b60e76d0b050c 100644 --- a/dumux/io/vtknestedfunction.hh +++ b/dumux/io/vtknestedfunction.hh @@ -105,7 +105,8 @@ public: " fields are supported so far."); double val = buf_[idx][mycomp]; - if (std::abs(val) < std::numeric_limits::min()) + using std::abs; + if (abs(val) < std::numeric_limits::min()) val = 0; return val; diff --git a/dumux/linear/amgparallelhelpers.hh b/dumux/linear/amgparallelhelpers.hh index 23a95661faf4584e61597042f576acd06aead2d5..7775afd943b94984c5fb973858f7b7ebacabb3ad 100644 --- a/dumux/linear/amgparallelhelpers.hh +++ b/dumux/linear/amgparallelhelpers.hh @@ -25,14 +25,20 @@ #ifndef DUMUX_AMGPARALLELHELPERS_HH #define DUMUX_AMGPARALLELHELPERS_HH -#include -#include -#include -#include +#include +#include + +#include "linearsolverproperties.hh" namespace Dumux { +namespace Properties +{ +//! The type traits required for using the AMG backend +NEW_PROP_TAG(AmgTraits); +} + /*! * \brief A parallel helper class providing a nonoverlapping * decomposition of all degrees of freedom @@ -219,13 +225,14 @@ class ParallelISTLHelper template void scatter (MessageBuffer& buff, const EntityType& e, size_t n) { + using std::min; std::size_t x; std::size_t& data = ranks_[this->index(e)]; buff.read(x); if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity) data = x; else - data = std::min(data,x); + data = min(data,x); } private: std::vector& ranks_; @@ -372,9 +379,10 @@ class ParallelISTLHelper template void scatter (MessageBuffer& buff, const EntityType& e, size_t n) { + using std::min; DataType x; buff.read(x); - gindices_[this->index(e)] = std::min(gindices_[this->index(e)], x); + gindices_[this->index(e)] = min(gindices_[this->index(e)], x); } private: std::vector& gindices_; diff --git a/dumux/linear/amgproperties.hh b/dumux/linear/amgproperties.hh index dbbb9780032bd7b1b1a5afcf71df3936281d1eeb..da2e6ccd9850f864bac83432a48107db703ad1d2 100644 --- a/dumux/linear/amgproperties.hh +++ b/dumux/linear/amgproperties.hh @@ -52,6 +52,8 @@ namespace Properties //! The type traits required for using the AMG backend NEW_PROP_TAG(AmgTraits); +/*! \brief Non-overlapping solver traits for parallel computing + */ template class NonoverlappingSolverTraits { @@ -63,6 +65,8 @@ public: }; #if HAVE_MPI +/*! \brief Non-overlapping solver traits for parallel computing if MPI available + */ template class NonoverlappingSolverTraits { @@ -95,7 +99,8 @@ public: typedef typename SolverTraits::ScalarProduct ScalarProduct; typedef typename SolverTraits::Smoother Smoother; }; - +/*! \brief Overlapping solver traits for parallel computing + */ template class OverlappingSolverTraits { @@ -107,6 +112,8 @@ public: }; #if HAVE_MPI +/*! \brief Non-overlapping solver traits for parallel computing if MPI available + */ template class OverlappingSolverTraits { diff --git a/dumux/linear/pardisobackend.hh b/dumux/linear/pardisobackend.hh index 682b4f9e01593da1c4271de11e38e148f5f46d8d..b3fb49782ef4bad1faaae8974d076835661a25f5 100644 --- a/dumux/linear/pardisobackend.hh +++ b/dumux/linear/pardisobackend.hh @@ -18,7 +18,7 @@ *****************************************************************************/ /*! * \file - * \brief Dumux solver backend the Pardiso direct solver. + * \brief Dumux solver backend for the Pardiso direct solver. */ #ifndef DUMUX_PARDISO_BACKEND_HH #define DUMUX_PARDISO_BACKEND_HH @@ -86,8 +86,9 @@ public: Matrix ATemp(A); int numProcs = 1; + using std::max; if (ParameterTree::tree().hasKey("Pardiso.NumProcessors")) - numProcs = std::max(numProcs, GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Pardiso, NumProcessors)); + numProcs = max(numProcs, GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Pardiso, NumProcessors)); Pardiso precond(ATemp, verbosity > 0, numProcs); diff --git a/dumux/linear/scotchbackend.hh b/dumux/linear/scotchbackend.hh index 9121848cdf3234fa5dce79a85b238f4aa299c511..86fceed8192955aa617602e5a4dcecc8d43d455c 100644 --- a/dumux/linear/scotchbackend.hh +++ b/dumux/linear/scotchbackend.hh @@ -39,7 +39,9 @@ extern "C" namespace Dumux { - +/*! + * \brief An interface to the scotch library for matrix reordering + */ template class ScotchBackend { diff --git a/dumux/linear/seqsolverbackend.hh b/dumux/linear/seqsolverbackend.hh index eca6d4a666cb7f4bc04c84f2bb4dd6cb556cc0c9..a729428ff8a47bad8bc9424b28b89c6881dddbf1 100644 --- a/dumux/linear/seqsolverbackend.hh +++ b/dumux/linear/seqsolverbackend.hh @@ -38,6 +38,22 @@ namespace Dumux /*! * \ingroup Linear * \brief A general solver backend allowing arbitrary preconditioners and solvers. + * + * This class is used as a base class for specific solver-preconditioner + * combinations. Several parameters from the group LinearSolver are read to + * customize the solver and preconditioner: + * + * Verbosity: determines how verbose the linear solver should print output. + * + * MaxIterations: the maximum number of iterations for the linear solver. + * + * ResidualReduction: the threshold for declaration of convergence. + * + * PreconditionerRelaxation: relaxation parameter for the preconditioner. + * + * PreconditionerIterations: usually specifies the number of times the + * preconditioner is applied. In case of ILU(n), it specifies the order of the + * applied ILU. */ template class IterativePrecondSolverBackend @@ -104,7 +120,20 @@ private: /*! * \ingroup Linear - * \brief Sequential ILUn-preconditioned BiCSTAB solver. + * \brief Sequential ILU(n)-preconditioned BiCSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. It can be applied to + * nonsymmetric matrices.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: ILU(n) incomplete LU factorization. The order n can be + * provided by the parameter LinearSolver.PreconditionerIterations and controls + * the fill-in. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILUnBiCGSTABBackend: public IterativePrecondSolverBackend @@ -130,6 +159,19 @@ public: /*! * \ingroup Linear * \brief Sequential SOR-preconditioned BiCSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. It can be applied to + * nonsymmetric matrices.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: SOR successive overrelaxation method. The relaxation is + * controlled by the parameter LinearSolver.PreconditionerRelaxation. In each + * preconditioning step, it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class SORBiCGSTABBackend: public IterativePrecondSolverBackend @@ -154,7 +196,20 @@ public: /*! * \ingroup Linear - * \brief Sequential SSOR-preconditioned BiCSTAB solver. + * \brief Sequential SSOR-preconditioned BiCGSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. While, it can be + * applied to nonsymmetric matrices, the preconditioner SSOR assumes symmetry.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: SSOR symmetric successive overrelaxation method. The + * relaxation is controlled by the parameter LinearSolver.PreconditionerRelaxation. + * In each preconditioning step, it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class SSORBiCGSTABBackend: public IterativePrecondSolverBackend @@ -179,7 +234,20 @@ public: /*! * \ingroup Linear - * \brief Sequential GS-preconditioned BiCSTAB solver. + * \brief Sequential GS-preconditioned BiCGSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. While, it can be + * applied to nonsymmetric matrices, the preconditioner SSOR assumes symmetry.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: GS Gauss-Seidel method. It can be damped by the relaxation + * parameter LinearSolver.PreconditionerRelaxation. In each preconditioning step, + * it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class GSBiCGSTABBackend: public IterativePrecondSolverBackend @@ -205,6 +273,18 @@ public: /*! * \ingroup Linear * \brief Sequential Jacobi-preconditioned BiCSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. While, it can be + * applied to nonsymmetric matrices, the preconditioner SSOR assumes symmetry.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: Jacobi method. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation. In each preconditioning step, it is + * applied as often as given by the parameter LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class JacBiCGSTABBackend: public IterativePrecondSolverBackend @@ -229,7 +309,19 @@ public: /*! * \ingroup Linear - * \brief Sequential ILUn-preconditioned CG solver. + * \brief Sequential ILU(n)-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: ILU(n) incomplete LU factorization. The order n can be + * provided by the parameter LinearSolver.PreconditionerIterations and controls + * the fill-in. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILUnCGBackend: public IterativePrecondSolverBackend @@ -255,6 +347,18 @@ public: /*! * \ingroup Linear * \brief Sequential SOR-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: SOR successive overrelaxation method. The relaxation is + * controlled by the parameter LinearSolver.PreconditionerRelaxation. In each + * preconditioning step, it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class SORCGBackend: public IterativePrecondSolverBackend @@ -280,6 +384,18 @@ public: /*! * \ingroup Linear * \brief Sequential SSOR-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: SSOR symmetric successive overrelaxation method. The + * relaxation is controlled by the parameter LinearSolver.PreconditionerRelaxation. + * In each preconditioning step, it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class SSORCGBackend: public IterativePrecondSolverBackend @@ -305,6 +421,18 @@ public: /*! * \ingroup Linear * \brief Sequential GS-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: GS Gauss-Seidel method. It can be damped by the relaxation + * parameter LinearSolver.PreconditionerRelaxation. In each preconditioning step, + * it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class GSCGBackend: public IterativePrecondSolverBackend @@ -330,6 +458,17 @@ public: /*! * \ingroup Linear * \brief Sequential Jacobi-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: Jacobi method. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation. In each preconditioning step, it is + * applied as often as given by the parameter LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class JacCGBackend: public IterativePrecondSolverBackend @@ -355,6 +494,19 @@ public: /*! * \ingroup Linear * \brief Sequential SSOR-preconditioned GMRes solver. + * + * Solver: The GMRes (generalized minimal residual) method is an iterative + * method for the numerical solution of a nonsymmetric system of linear + * equations.\n + * See: Saad, Y., Schultz, M. H. (1986). "GMRES: A generalized minimal residual + * algorithm for solving nonsymmetric linear systems." SIAM J. Sci. and Stat. + * Comput. 7: 856–869. + * + * Preconditioner: SSOR symmetric successive overrelaxation method. The + * relaxation is controlled by the parameter LinearSolver.PreconditionerRelaxation. + * In each preconditioning step, it is applied as often as given by the parameter + * LinearSolver.PreconditionerIterations.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class SSORRestartedGMResBackend: public IterativePrecondSolverBackend @@ -381,6 +533,18 @@ public: /*! * \ingroup Linear * \brief Base class for backend combinations of linear solvers and a ILU0 preconditioner + * + * This class is used as a base class for combinations of a specific linear + * solver with the ILU(0) preconditioner. Several parameters from the group + * LinearSolver are read to customize the solver and preconditioner: + * + * Verbosity: determines how verbose the linear solver should print output. + * + * MaxIterations: the maximum number of iterations for the linear solver. + * + * ResidualReduction: the threshold for declaration of convergence. + * + * PreconditionerRelaxation: relaxation parameter for the preconditioner. */ template class ILU0SolverBackend @@ -445,7 +609,19 @@ private: /*! * \ingroup Linear - * \brief Sequential ILU0-preconditioned BiCGSTAB solver. + * \brief Sequential ILU(0)-preconditioned BiCGSTAB solver. + * + * Solver: The BiCGSTAB (stabilized biconjugate gradients method) solver has + * faster and smoother convergence than the original BiCG. It can be applied to + * nonsymmetric matrices.\n + * See: Van der Vorst, H. A. (1992). "Bi-CGSTAB: A Fast and Smoothly Converging + * Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems". + * SIAM J. Sci. and Stat. Comput. 13 (2): 631–644. doi:10.1137/0913035. + * + * Preconditioner: ILU(0) incomplete LU factorization. The order 0 indicates + * that no fill-in is allowed. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILU0BiCGSTABBackend : public ILU0SolverBackend @@ -470,7 +646,18 @@ class ILU0BiCGSTABBackend : public ILU0SolverBackend /*! * \ingroup Linear - * \brief Sequential ILU0-preconditioned CG solver. + * \brief Sequential ILU(0)-preconditioned CG solver. + * + * Solver: CG (conjugate gradient) is an iterative method for solving linear + * systems with a symmetric, positive definite matrix.\n + * See: Helfenstein, R., Koko, J. (2010). "Parallel preconditioned conjugate + * gradient algorithm on GPU", Journal of Computational and Applied Mathematics, + * Volume 236, Issue 15, Pages 3584–3590, http://dx.doi.org/10.1016/j.cam.2011.04.025. + * + * Preconditioner: ILU(0) incomplete LU factorization. The order 0 indicates + * that no fill-in is allowed. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILU0CGBackend : public ILU0SolverBackend @@ -496,6 +683,18 @@ public: /*! * \ingroup Linear * \brief Sequential ILU0-preconditioned GMRes solver. + * + * Solver: The GMRes (generalized minimal residual) method is an iterative + * method for the numerical solution of a nonsymmetric system of linear + * equations.\n + * See: Saad, Y., Schultz, M. H. (1986). "GMRES: A generalized minimal residual + * algorithm for solving nonsymmetric linear systems." SIAM J. Sci. and Stat. + * Comput. 7: 856–869. + * + * Preconditioner: ILU(0) incomplete LU factorization. The order 0 indicates + * that no fill-in is allowed. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILU0RestartedGMResBackend : public ILU0SolverBackend @@ -521,7 +720,20 @@ public: /*! * \ingroup Linear - * \brief Sequential ILUn-preconditioned GMRes solver. + * \brief Sequential ILU(n)-preconditioned GMRes solver. + * + * Solver: The GMRes (generalized minimal residual) method is an iterative + * method for the numerical solution of a nonsymmetric system of linear + * equations.\n + * See: Saad, Y., Schultz, M. H. (1986). "GMRES: A generalized minimal residual + * algorithm for solving nonsymmetric linear systems." SIAM J. Sci. and Stat. + * Comput. 7: 856–869. + * + * Preconditioner: ILU(n) incomplete LU factorization. The order n can be + * provided by the parameter LinearSolver.PreconditionerIterations and controls + * the fill-in. It can be damped by the relaxation parameter + * LinearSolver.PreconditionerRelaxation.\n + * See: Golub, G. H., and Van Loan, C. F. (2012). Matrix computations. JHU Press. */ template class ILUnRestartedGMResBackend : public IterativePrecondSolverBackend @@ -546,6 +758,14 @@ public: }; #if HAVE_SUPERLU +/*! + * \ingroup Linear + * \brief Direct linear solver using the SuperLU library. + * + * See: Li, X. S. (2005). "An overview of SuperLU: Algorithms, implementation, + * and user interface." ACM Transactions on Mathematical Software (TOMS) 31(3): 302-325. + * http://crd-legacy.lbl.gov/~xiaoye/SuperLU/ + */ template class SuperLUBackend { @@ -577,7 +797,9 @@ public: { for (int j = 0; j < blockSize; j++) { - if (std::isnan(x[i][j]) || std::isinf(x[i][j])) + using std::isnan; + using std::isinf; + if (isnan(x[i][j]) || isinf(x[i][j])) { result_.converged = false; break; @@ -602,6 +824,14 @@ private: #if HAVE_UMFPACK +/*! + * \ingroup Linear + * \brief Direct linear solver using the UMFPack library. + * + * See: Davis, Timothy A. (2004). "Algorithm 832". ACM Transactions on + * Mathematical Software 30 (2): 196–199. doi:10.1145/992200.992206. + * http://faculty.cse.tamu.edu/davis/suitesparse.html + */ template class UMFPackBackend { @@ -633,7 +863,9 @@ public: { for (int j = 0; j < blockSize; j++) { - if (std::isnan(x[i][j]) || std::isinf(x[i][j])) + using std::isnan; + using std::isinf; + if (isnan(x[i][j]) || isinf(x[i][j])) { result_.converged = false; break; diff --git a/dumux/material/binarycoefficients/air_mesitylene.hh b/dumux/material/binarycoefficients/air_mesitylene.hh index e748f77763cfabce07ac44cc4320fe4b0d9b669e..269bd4e09aa1c30ec257e332bc56e8ae2ced8498 100644 --- a/dumux/material/binarycoefficients/air_mesitylene.hh +++ b/dumux/material/binarycoefficients/air_mesitylene.hh @@ -50,7 +50,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for air and mesitylene. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for air and mesitylene. * I used the method according to Wilke and Lee * see W.J. Lyman, W.F. Reehl, D.H. Rosenblatt (1990) \cite lyman1990
* \param temperature temperature in \f$\mathrm{[K]}\f$ @@ -63,31 +63,36 @@ public: typedef Dumux::Air Air; typedef Dumux::Mesitylene Mesitylene; - temperature = std::max(temperature, 1e-9); // regularization - temperature = std::min(temperature, 500.0); // regularization - pressure = std::max(pressure, 0.0); // regularization - pressure = std::min(pressure, 1e8); // regularization + using std::min; + using std::max; + temperature = max(temperature, 1e-9); // regularization + temperature = min(temperature, 500.0); // regularization + pressure = max(pressure, 0.0); // regularization + pressure = min(pressure, 1e8); // regularization + using std::pow; + using std::sqrt; + using std::exp; const Scalar M_m = 1e3*Mesitylene::molarMass(); // [g/mol] molecular weight of mesitylene const Scalar M_a = 1e3*Air::molarMass(); // [g/mol] molecular weight of air const Scalar Tb_m = 437.9; // [K] boiling temperature of mesitylene const Scalar sigma_a = 3.711; // charact. length of air const Scalar T_scal_a = 78.6; // [K] (molec. energy of attraction/Boltzmann constant) const Scalar V_B_m = 162.6; // [cm^3/mol] LeBas molal volume of mesitylene - const Scalar sigma_m = 1.18*std::pow(V_B_m, 0.333); // charact. length of mesitylene + const Scalar sigma_m = 1.18*pow(V_B_m, 0.333); // charact. length of mesitylene const Scalar sigma_am = 0.5*(sigma_a + sigma_m); const Scalar T_scal_m = 1.15*Tb_m; - const Scalar T_scal_am = std::sqrt(T_scal_a*T_scal_m); + const Scalar T_scal_am = sqrt(T_scal_a*T_scal_m); Scalar T_star = temperature/T_scal_am; - T_star = std::max(T_star, 1e-5); // regularization + T_star = max(T_star, 1e-5); // regularization - const Scalar Omega = 1.06036/std::pow(T_star, 0.1561) + 0.193/std::exp(T_star*0.47635) - + 1.03587/std::exp(T_star*1.52996) + 1.76474/std::exp(T_star*3.89411); - const Scalar B_ = 0.00217 - 0.0005*std::sqrt(1.0/M_a + 1.0/M_m); + const Scalar Omega = 1.06036/pow(T_star, 0.1561) + 0.193/exp(T_star*0.47635) + + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411); + const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_a + 1.0/M_m); const Scalar Mr = (M_a + M_m)/(M_a*M_m); - const Scalar D_am = (B_*std::pow(temperature, 1.5) * std::sqrt(Mr)) - /(1e-5*pressure*std::pow(sigma_am, 2.0) * Omega); // [cm^2/s] + const Scalar D_am = (B_*pow(temperature, 1.5) * sqrt(Mr)) + /(1e-5*pressure*pow(sigma_am, 2.0) * Omega); // [cm^2/s] return 1e-4*D_am; // [m^2/s] } diff --git a/dumux/material/binarycoefficients/air_xylene.hh b/dumux/material/binarycoefficients/air_xylene.hh index c8393550f5ffaaed445228c3838a48372ae51a83..63ff3141992e879dc95e34ff2ef2c66bc48af17d 100644 --- a/dumux/material/binarycoefficients/air_xylene.hh +++ b/dumux/material/binarycoefficients/air_xylene.hh @@ -63,31 +63,36 @@ public: typedef Dumux::Air Air; typedef Dumux::Xylene Xylene; - temperature = std::max(temperature, 1e-9); // regularization - temperature = std::min(temperature, 500.0); // regularization - pressure = std::max(pressure, 0.0); // regularization - pressure = std::min(pressure, 1e8); // regularization + using std::min; + using std::max; + temperature = max(temperature, 1e-9); // regularization + temperature = min(temperature, 500.0); // regularization + pressure = max(pressure, 0.0); // regularization + pressure = min(pressure, 1e8); // regularization + using std::pow; + using std::sqrt; + using std::exp; const Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene const Scalar M_a = 1e3*Air::molarMass(); // [g/mol] molecular weight of air const Scalar Tb_x = 412.0; // [K] boiling temperature of xylene const Scalar sigma_a = 3.711; // charact. length of air const Scalar T_scal_a = 78.6; // [K] (molec. energy of attraction/Boltzmann constant) const Scalar V_B_x = 140.4; // [cm^3/mol] LeBas molal volume of xylene - const Scalar sigma_x = 1.18*std::pow(V_B_x, 0.333); // charact. length of xylene + const Scalar sigma_x = 1.18*pow(V_B_x, 0.333); // charact. length of xylene const Scalar sigma_ax = 0.5*(sigma_a + sigma_x); const Scalar T_scal_x = 1.15*Tb_x; - const Scalar T_scal_ax = std::sqrt(T_scal_a*T_scal_x); + const Scalar T_scal_ax = sqrt(T_scal_a*T_scal_x); Scalar T_star = temperature/T_scal_ax; - T_star = std::max(T_star, 1e-5); // regularization + T_star = max(T_star, 1e-5); // regularization - const Scalar Omega = 1.06036/std::pow(T_star, 0.1561) + 0.193/std::exp(T_star*0.47635) - + 1.03587/std::exp(T_star*1.52996) + 1.76474/std::exp(T_star*3.89411); - const Scalar B_ = 0.00217 - 0.0005*std::sqrt(1.0/M_a + 1.0/M_x); + const Scalar Omega = 1.06036/pow(T_star, 0.1561) + 0.193/exp(T_star*0.47635) + + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411); + const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_a + 1.0/M_x); const Scalar Mr = (M_a + M_x)/(M_a*M_x); - const Scalar D_ax = (B_*std::pow(temperature,1.5)*std::sqrt(Mr)) - /(1e-5*pressure*std::pow(sigma_ax, 2.0)*Omega); // [cm^2/s] + const Scalar D_ax = (B_*pow(temperature,1.5)*sqrt(Mr)) + /(1e-5*pressure*pow(sigma_ax, 2.0)*Omega); // [cm^2/s] return D_ax*1e-4; // [m^2/s] } diff --git a/dumux/material/binarycoefficients/brine_air.hh b/dumux/material/binarycoefficients/brine_air.hh index 53521c7496f21dc8dccc486668dc4ffb2f63a090..9f7665054ae1ee88da7d5ef8177062f335479081 100644 --- a/dumux/material/binarycoefficients/brine_air.hh +++ b/dumux/material/binarycoefficients/brine_air.hh @@ -46,7 +46,7 @@ class Brine_Air { public: /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ of water in the Air phase. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ of water in the Air phase. * * According to B. Xu et al. (2003) \cite xu2003
* \param temperature the temperature \f$\mathrm{[K]}\f$ @@ -67,7 +67,7 @@ public: /*! * Lacking better data on water-air diffusion in liquids, we use at the * moment the diffusion coefficient of the air's main component nitrogen!! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. * * The empirical equations for estimating the diffusion coefficient in * infinite solution which are presented in Reid, 1987 all show a @@ -167,6 +167,9 @@ public: static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol) Scalar lnPhiAir, phiAir; + using std::log; + using std::pow; + using std::exp; lnPhiAir = log(V / (V - b_Air)) + b_Air / (V - b_Air) - 2 * a_Air / (R * pow(T, 1.5) * b_Air) * log((V + b_Air) / V) + a_Air * b_Air / (R * pow(T, 1.5) * b_Air * b_Air) * (log((V + b_Air) / V) @@ -195,6 +198,9 @@ public: static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol) Scalar lnPhiH2O, phiH2O; + using std::log; + using std::pow; + using std::exp; lnPhiH2O = log(V / (V - b_Air)) + b_H2O / (V - b_Air) - 2 * a_Air_H2O / (R * pow(T, 1.5) * b_Air) * log((V + b_Air) / V) + a_Air * b_H2O / (R * pow(T, 1.5) * b_Air * b_Air) * (log((V + b_Air) @@ -266,6 +272,7 @@ private: Scalar xi = computeXi_(temperature, pg); // Xi_{Air-Na+-Cl-} Scalar lnGammaStar = 2 * lambda * molalityNaCl + xi * molalityNaCl * molalityNaCl; + using std::exp; Scalar gammaStar = exp(lnGammaStar); return gammaStar; // molal activity coefficient of Air in brine } @@ -285,6 +292,7 @@ private: Scalar k0_H2O = equilibriumConstantH2O_(T); // equilibrium constant for H2O at 1 bar Scalar phi_H2O = fugacityCoefficientH2O(T, pg); // fugacity coefficient of H2O for the water-Air system Scalar pg_bar = pg / 1.e5; + using std::exp; Scalar A = k0_H2O / (phi_H2O * pg_bar) * exp(deltaP * v_av_H2O / (R * T)); return A; @@ -305,6 +313,7 @@ private: Scalar k0_Air = equilibriumConstantAir_(T); // equilibrium constant for Air at 1 bar Scalar phi_Air = fugacityCoefficientAir(T, pg); // fugacity coefficient of Air for the water-Air system Scalar pg_bar = pg / 1.e5; + using std::exp; Scalar B = phi_Air * pg_bar / (55.508 * k0_Air) * exp(-(deltaP * v_av_Air) / (R * T)); return B; @@ -322,9 +331,10 @@ private: static const Scalar c[6] = { -0.411370585, 6.07632013E-4, 97.5347708, -0.0237622469, 0.0170656236, 1.41335834E-5 }; + using std::log; Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ lambda = c[0] + c[1] * T + c[2] / T + c[3] * pg_bar / T + c[4] * pg_bar - / (630.0 - T) + c[5] * T * std::log(pg_bar); + / (630.0 - T) + c[5] * T * log(pg_bar); return lambda; } @@ -434,6 +444,9 @@ public: const Scalar pgAir = partialPressureAir_(temperature, pg); const Scalar phiAir = fugacityCoeffAir_(temperature, pgAir, rhoAir); + using std::log; + using std::pow; + using std::exp; const Scalar exponent = A - log(phiAir) + 2*B*mol_NaCl + C*pow(mol_NaCl,2); const Scalar mol_Airw = pgAir / (1e5 * exp(exponent)); /* paper: equation (6) */ @@ -468,6 +481,7 @@ private: const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ const Scalar Tr = 630.0 - T; + using std::log; return c[0] + c[1]*T + @@ -498,13 +512,14 @@ private: const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ + using std::log; return c1 + c2*T + c3/T + c8*pg_bar/T + c9*pg_bar/(630.0-T) + - c11*T*std::log(pg_bar); + c11*T*log(pg_bar); } /*! * \brief computation of C @@ -543,7 +558,7 @@ private: } /*! - * \brief The fugacity coefficent of Air for a Air-H2O mixture. + * \brief The fugacity coefficient of Air for a Air-H2O mixture. * * \param temperature the temperature [K] * \param pg the gas phase pressure [Pa] @@ -595,6 +610,8 @@ private: const Scalar C = a[6] + a[7] / (Tr * Tr) + a[8] / (Tr * Tr * Tr); const Scalar D = a[9] + a[10] / (Tr * Tr) + a[11] / (Tr * Tr * Tr); + using std::log; + using std::exp; const Scalar lnphiAir = Z - 1 - log(Z) + @@ -608,9 +625,9 @@ private: a[13] + 1 - ( a[13] + 1 + a[14]/(Vr*Vr) - )*std::exp(-a[14]/(Vr*Vr))); + )*exp(-a[14]/(Vr*Vr))); - return std::exp(lnphiAir); + return exp(lnphiAir); } }; diff --git a/dumux/material/binarycoefficients/brine_co2.hh b/dumux/material/binarycoefficients/brine_co2.hh index ba3abc68815ce4afb26de98adafb85a02ed4cd71..7f3a12d56ebb3dcdd9421c9ef068f209c8304fdc 100644 --- a/dumux/material/binarycoefficients/brine_co2.hh +++ b/dumux/material/binarycoefficients/brine_co2.hh @@ -150,6 +150,9 @@ public: static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol) Scalar lnPhiCO2, phiCO2; + using std::log; + using std::exp; + using std::pow; lnPhiCO2 = log(V / (V - b_CO2)) + b_CO2 / (V - b_CO2) - 2 * a_CO2 / (R * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2 * b_CO2 / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2) / V) @@ -178,10 +181,14 @@ public: static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol) Scalar lnPhiH2O, phiH2O; + using std::log; + using std::pow; + using std::exp; lnPhiH2O = log(V / (V - b_CO2)) + b_H2O / (V - b_CO2) - 2 * a_CO2_H2O / (R * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2 * b_H2O / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2) / V) - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T)); + phiH2O = exp(lnPhiH2O); // fugacity coefficient of H2O return phiH2O; } @@ -247,6 +254,7 @@ private: Scalar xi = computeXi_(temperature, pg); // Xi_{CO2-Na+-Cl-} Scalar lnGammaStar = 2 * lambda * molalityNaCl + xi * molalityNaCl * molalityNaCl; + using std::exp; Scalar gammaStar = exp(lnGammaStar); return gammaStar; // molal activity coefficient of CO2 in brine } @@ -266,6 +274,7 @@ private: Scalar k0_H2O = equilibriumConstantH2O_(T); // equilibrium constant for H2O at 1 bar Scalar phi_H2O = fugacityCoefficientH2O(T, pg); // fugacity coefficient of H2O for the water-CO2 system Scalar pg_bar = pg / 1.e5; + using std::exp; Scalar A = k0_H2O / (phi_H2O * pg_bar) * exp(deltaP * v_av_H2O / (R * T)); return A; @@ -286,6 +295,7 @@ private: Scalar k0_CO2 = equilibriumConstantCO2_(T); // equilibrium constant for CO2 at 1 bar Scalar phi_CO2 = fugacityCoefficientCO2(T, pg); // fugacity coefficient of CO2 for the water-CO2 system Scalar pg_bar = pg / 1.e5; + using std::exp; Scalar B = phi_CO2 * pg_bar / (55.508 * k0_CO2) * exp(-(deltaP * v_av_CO2) / (R * T)); return B; @@ -303,9 +313,10 @@ private: static const Scalar c[6] = { -0.411370585, 6.07632013E-4, 97.5347708, -0.0237622469, 0.0170656236, 1.41335834E-5 }; + using std::log; Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ lambda = c[0] + c[1] * T + c[2] / T + c[3] * pg_bar / T + c[4] * pg_bar - / (630.0 - T) + c[5] * T * std::log(pg_bar); + / (630.0 - T) + c[5] * T * log(pg_bar); return lambda; } @@ -338,6 +349,7 @@ private: Scalar TinC = T - 273.15; //temperature in °C static const Scalar c[3] = { 1.189, 1.304e-2, -5.446e-5 }; Scalar logk0_CO2 = c[0] + c[1] * TinC + c[2] * TinC * TinC; + using std::pow; Scalar k0_CO2 = pow(10, logk0_CO2); return k0_CO2; } @@ -353,6 +365,7 @@ private: static const Scalar c[4] = { -2.209, 3.097e-2, -1.098e-4, 2.048e-7 }; Scalar logk0_H2O = c[0] + c[1] * TinC + c[2] * TinC * TinC + c[3] * TinC * TinC * TinC; + using std::pow; Scalar k0_H2O = pow(10, logk0_H2O); return k0_H2O; } @@ -414,8 +427,11 @@ public: const Scalar pgCO2 = partialPressureCO2_(temperature, pg); const Scalar phiCO2 = fugacityCoeffCO2_(temperature, pgCO2, rhoCO2); + using std::log; + using std::pow; const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*pow(mol_NaCl,2); + using std::exp; const Scalar mol_CO2w = pgCO2 / (1e5 * exp(exponent)); /* paper: equation (6) */ const Scalar x_CO2w = mol_CO2w / (mol_CO2w + 55.56); /* conversion: molality to mole fraction */ @@ -448,6 +464,7 @@ private: const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ const Scalar Tr = 630.0 - T; + using std::log; return c[0] + c[1]*T + @@ -478,13 +495,14 @@ private: const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */ + using std::log; return c1 + c2*T + c3/T + c8*pg_bar/T + c9*pg_bar/(630.0-T) + - c11*T*std::log(pg_bar); + c11*T*log(pg_bar); } /*! * \brief computation of C @@ -523,7 +541,7 @@ private: } /*! - * \brief The fugacity coefficent of CO2 for a CO2-H2O mixture. + * \brief The fugacity coefficient of CO2 for a CO2-H2O mixture. * * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pg the gas phase pressure \f$\mathrm{[Pa]}\f$ @@ -575,6 +593,8 @@ private: const Scalar C = a[6] + a[7] / (Tr * Tr) + a[8] / (Tr * Tr * Tr); const Scalar D = a[9] + a[10] / (Tr * Tr) + a[11] / (Tr * Tr * Tr); + using std::log; + using std::exp; const Scalar lnphiCO2 = Z - 1 - log(Z) + @@ -588,9 +608,9 @@ private: a[13] + 1 - ( a[13] + 1 + a[14]/(Vr*Vr) - )*std::exp(-a[14]/(Vr*Vr))); + )*exp(-a[14]/(Vr*Vr))); - return std::exp(lnphiCO2); + return exp(lnphiCO2); } }; diff --git a/dumux/material/binarycoefficients/fullermethod.hh b/dumux/material/binarycoefficients/fullermethod.hh index 0d5383024d35097296c73cb02d70e830bc58aaae..27646cc341a45c08a5112e4020d71da0e808fb97 100644 --- a/dumux/material/binarycoefficients/fullermethod.hh +++ b/dumux/material/binarycoefficients/fullermethod.hh @@ -31,7 +31,7 @@ namespace BinaryCoeff { /*! * \ingroup Binarycoefficients - * \brief Estimate binary diffusion coefficents \f$\mathrm{[m^2/s]}\f$ in gases according to + * \brief Estimate binary diffusion coefficients \f$\mathrm{[m^2/s]}\f$ in gases according to * the method by Fuller. * * \param M molar masses \f$\mathrm{[g/mol]}\f$ @@ -39,7 +39,7 @@ namespace BinaryCoeff * \param temperature The temperature \f$\mathrm{[K]}\f$ * \param pressure phase pressure \f$\mathrm{[Pa]}\f$ * - * This function estimates the diffusion coefficents in binary gases + * This function estimates the diffusion coefficients in binary gases * using to the method proposed by Fuller. This method and is only * valid at "low" pressures. * @@ -55,6 +55,8 @@ inline Scalar fullerMethod(const Scalar *M, // molar masses [g/mol] Scalar Mab = harmonicMean(M[0], M[1]); // Fuller's method + using std::pow; + using std::sqrt; Scalar tmp = pow(SigmaNu[0], 1./3) + pow(SigmaNu[1], 1./3); return 1e-4 * (143.0*pow(temperature, 1.75))/(pressure*sqrt(Mab)*tmp*tmp); } diff --git a/dumux/material/binarycoefficients/h2o_air.hh b/dumux/material/binarycoefficients/h2o_air.hh index 7f83054788429327deaa78451e9e438e3f78f78d..ef688f0e28e52a244c9893c77544544d3acb511d 100644 --- a/dumux/material/binarycoefficients/h2o_air.hh +++ b/dumux/material/binarycoefficients/h2o_air.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_BINARY_COEFF_H2O_AIR_HH #define DUMUX_BINARY_COEFF_H2O_AIR_HH +#include + namespace Dumux { @@ -48,9 +50,10 @@ public: template static Scalar henry(Scalar temperature) { - Scalar r = (0.8942+1.47*exp(-0.04394*(temperature-273.15)))*1.E-10; + using std::exp; + Scalar r = (0.8942+1.47*exp(-0.04394*(temperature-273.15)))*1.E-10; - return 1./r; + return 1./r; } /*! @@ -73,6 +76,7 @@ public: const Scalar T0=273.15; /* reference temperature */ Scalar Dgaw; + using std::pow; Dgaw=Daw*(pg0/pressure)*pow((temperature/T0),Theta); return Dgaw; @@ -93,9 +97,7 @@ public: * Himmelblau by the temperature. * * See: - * * R. Reid et al. (1987, pp. 599) \cite reid1987
- * * R. Ferrell, D. Himmelblau (1967, pp. 111-115) \cite ferrell1967 */ template diff --git a/dumux/material/binarycoefficients/h2o_heavyoil.hh b/dumux/material/binarycoefficients/h2o_heavyoil.hh index 5318b230b3e5fd23a07879a7a1bd43a53400a9fc..cead97c2f5147da6159fed9bb45bf574bd07a896 100644 --- a/dumux/material/binarycoefficients/h2o_heavyoil.hh +++ b/dumux/material/binarycoefficients/h2o_heavyoil.hh @@ -39,7 +39,7 @@ class H2O_HeavyOil { public: /*! - * \brief Henry coefficent \f$[N/m^2]\f$ for heavy oil in liquid water. + * \brief Henry coefficient \f$[N/m^2]\f$ for heavy oil in liquid water. * * See: * @@ -55,7 +55,7 @@ public: } /*! - * \brief Henry coefficent \f$[N/m^2]\f$ for water in liquid heavy oil. + * \brief Henry coefficient \f$[N/m^2]\f$ for water in liquid heavy oil. * * See: * @@ -70,7 +70,7 @@ public: /*! - * \brief Binary diffusion coefficent [m^2/s] for molecular water and heavy oil. + * \brief Binary diffusion coefficient [m^2/s] for molecular water and heavy oil. * */ template @@ -80,7 +80,7 @@ public: } /*! - * \brief Diffusion coefficent [m^2/s] for tce in liquid water. + * \brief Diffusion coefficient [m^2/s] for tce in liquid water. * * \todo */ diff --git a/dumux/material/binarycoefficients/h2o_mesitylene.hh b/dumux/material/binarycoefficients/h2o_mesitylene.hh index 7e5d8c537036c510bdff0fbf63ab562fc2be0935..517fc43b6d92b45961985f6853027d6570766294 100644 --- a/dumux/material/binarycoefficients/h2o_mesitylene.hh +++ b/dumux/material/binarycoefficients/h2o_mesitylene.hh @@ -39,7 +39,7 @@ class H2O_Mesitylene { public: /*! - * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for mesitylene in liquid water. + * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for mesitylene in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * See: * @@ -57,7 +57,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular water and mesitylene. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and mesitylene. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the pressure \f$\mathrm{[Pa]}\f$ * @@ -68,39 +68,44 @@ public: typedef Dumux::H2O H2O; typedef Dumux::Mesitylene Mesitylene; - temperature = std::max(temperature, 1e-9); // regularization - temperature = std::min(temperature, 500.0); // regularization - pressure = std::max(pressure, 0.0); // regularization - pressure = std::min(pressure, 1e8); // regularization + using std::min; + using std::max; + temperature = max(temperature, 1e-9); // regularization + temperature = min(temperature, 500.0); // regularization + pressure = max(pressure, 0.0); // regularization + pressure = min(pressure, 1e8); // regularization + using std::sqrt; + using std::pow; + using std::exp; const Scalar M_m = 1e3*Mesitylene::molarMass(); // [g/mol] molecular weight of mesitylene const Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water const Scalar Tb_m = 437.9; // [K] boiling temperature of mesitylen const Scalar Tb_w = 373.15; // [K] boiling temperature of water (at p_atm) const Scalar V_B_w = 18.0; // [cm^3/mol] LeBas molal volume of water - const Scalar sigma_w = 1.18*std::pow(V_B_w, 0.333); // charact. length of air + const Scalar sigma_w = 1.18*pow(V_B_w, 0.333); // charact. length of air const Scalar T_scal_w = 1.15*Tb_w; // [K] (molec. energy of attraction/Boltzmann constant) const Scalar V_B_m = 162.6; // [cm^3/mol] LeBas molal volume of mesitylen - const Scalar sigma_m = 1.18*std::pow(V_B_m, 0.333); // charact. length of mesitylen + const Scalar sigma_m = 1.18*pow(V_B_m, 0.333); // charact. length of mesitylen const Scalar sigma_wm = 0.5*(sigma_w + sigma_m); const Scalar T_scal_m = 1.15*Tb_m; - const Scalar T_scal_wm = std::sqrt(T_scal_w*T_scal_m); + const Scalar T_scal_wm = sqrt(T_scal_w*T_scal_m); Scalar T_star = temperature/T_scal_wm; - T_star = std::max(T_star, 1e-5); // regularization + T_star = max(T_star, 1e-5); // regularization - const Scalar Omega = 1.06036/std::pow(T_star,0.1561) + 0.193/std::exp(T_star*0.47635) - + 1.03587/std::exp(T_star*1.52996) + 1.76474/std::exp(T_star*3.89411); - const Scalar B_ = 0.00217 - 0.0005*std::sqrt(1.0/M_w + 1.0/M_m); + const Scalar Omega = 1.06036/pow(T_star,0.1561) + 0.193/exp(T_star*0.47635) + + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411); + const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_m); const Scalar Mr = (M_w + M_m)/(M_w*M_m); - const Scalar D_wm = (B_*std::pow(temperature,1.6)*std::sqrt(Mr)) - /(1e-5*pressure*std::pow(sigma_wm, 2.0)*Omega); // [cm^2/s] + const Scalar D_wm = (B_*pow(temperature,1.6)*sqrt(Mr)) + /(1e-5*pressure*pow(sigma_wm, 2.0)*Omega); // [cm^2/s] return D_wm*1e-4; // [m^2/s] } /*! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for mesitylene in liquid water. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for mesitylene in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the pressure \f$\mathrm{[Pa]}\f$ * diff --git a/dumux/material/binarycoefficients/h2o_n2.hh b/dumux/material/binarycoefficients/h2o_n2.hh index 8f85c01f999127292bbde4d7efe86deef9d9a09f..51539b8c9c6c65c71825c31d46c40a70a92b862e 100644 --- a/dumux/material/binarycoefficients/h2o_n2.hh +++ b/dumux/material/binarycoefficients/h2o_n2.hh @@ -43,7 +43,7 @@ class H2O_N2 { public: /*! - * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for molecular nitrogen in liquid water. + * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for molecular nitrogen in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ */ template @@ -58,7 +58,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular water and nitrogen. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and nitrogen. * * Uses fullerMethod to determine the diffusion of water in nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ @@ -79,7 +79,7 @@ public: } /*! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the phase pressure \f$\mathrm{[Pa]}\f$ * diff --git a/dumux/material/binarycoefficients/h2o_o2.hh b/dumux/material/binarycoefficients/h2o_o2.hh index 08fe72df381f420790e5689b08395ddf8ebd1711..1326aa1455f7b45ebd599914524dc3e36b78dd18 100644 --- a/dumux/material/binarycoefficients/h2o_o2.hh +++ b/dumux/material/binarycoefficients/h2o_o2.hh @@ -43,7 +43,7 @@ class H2O_O2 { public: /*! - * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for molecular oxygen in liquid water. + * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for molecular oxygen in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ */ template @@ -58,7 +58,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular water and nitrogen. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and nitrogen. * * Uses fullerMethod to determine the diffusion of water in nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ @@ -79,7 +79,7 @@ public: } /*! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular nitrogen in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the phase pressure \f$\mathrm{[Pa]}\f$ * diff --git a/dumux/material/binarycoefficients/h2o_xylene.hh b/dumux/material/binarycoefficients/h2o_xylene.hh index 3762bcfbc30afcd6a8df5d9922446225c06e5943..d4dc12d4b3f2381cee195cacd3dce72384e63f22 100644 --- a/dumux/material/binarycoefficients/h2o_xylene.hh +++ b/dumux/material/binarycoefficients/h2o_xylene.hh @@ -39,7 +39,7 @@ class H2O_Xylene { public: /*! - * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for xylene in liquid water. + * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for xylene in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * * See: @@ -59,7 +59,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular water and xylene. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and xylene. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the pressure \f$\mathrm{[Pa]}\f$ * @@ -70,39 +70,44 @@ public: typedef Dumux::H2O H2O; typedef Dumux::Xylene Xylene; - temperature = std::max(temperature, 1e-9); // regularization - temperature = std::min(temperature, 500.0); // regularization - pressure = std::max(pressure, 0.0); // regularization - pressure = std::min(pressure, 1e8); // regularization + using std::min; + using std::max; + temperature = max(temperature, 1e-9); // regularization + temperature = min(temperature, 500.0); // regularization + pressure = max(pressure, 0.0); // regularization + pressure = min(pressure, 1e8); // regularization + using std::sqrt; + using std::exp; + using std::pow; const Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene const Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water const Scalar Tb_x = 412.9; // [K] boiling temperature of xylene const Scalar Tb_w = 373.15; // [K] boiling temperature of water (at p_atm) const Scalar V_B_w = 18.0; // [cm^3/mol] LeBas molal volume of water - const Scalar sigma_w = 1.18*std::pow(V_B_w, 0.333); // charact. length of air + const Scalar sigma_w = 1.18*pow(V_B_w, 0.333); // charact. length of air const Scalar T_scal_w = 1.15*Tb_w; // [K] (molec. energy of attraction/Boltzmann constant) const Scalar V_B_x = 140.4; // [cm^3/mol] LeBas molal volume of xylene - const Scalar sigma_x = 1.18*std::pow(V_B_x, 0.333); // charact. length of xylene + const Scalar sigma_x = 1.18*pow(V_B_x, 0.333); // charact. length of xylene const Scalar sigma_wx = 0.5*(sigma_w + sigma_x); const Scalar T_scal_x = 1.15*Tb_x; - const Scalar T_scal_wx = std::sqrt(T_scal_w*T_scal_x); + const Scalar T_scal_wx = sqrt(T_scal_w*T_scal_x); Scalar T_star = temperature/T_scal_wx; - T_star = std::max(T_star, 1e-5); // regularization + T_star = max(T_star, 1e-5); // regularization - const Scalar Omega = 1.06036/std::pow(T_star, 0.1561) + 0.193/std::exp(T_star*0.47635) - + 1.03587/std::exp(T_star*1.52996) + 1.76474/std::exp(T_star*3.89411); - const Scalar B_ = 0.00217 - 0.0005*std::sqrt(1.0/M_w + 1.0/M_x); + const Scalar Omega = 1.06036/pow(T_star, 0.1561) + 0.193/exp(T_star*0.47635) + + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411); + const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_x); const Scalar Mr = (M_w + M_x)/(M_w*M_x); - const Scalar D_wx = (B_*std::pow(temperature,1.6)*std::sqrt(Mr)) - /(1e-5*pressure*std::pow(sigma_wx, 2.0)*Omega); // [cm^2/s] + const Scalar D_wx = (B_*pow(temperature,1.6)*sqrt(Mr)) + /(1e-5*pressure*pow(sigma_wx, 2.0)*Omega); // [cm^2/s] return D_wx*1e-4; // [m^2/s] } /*! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for xylene in liquid water. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for xylene in liquid water. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the pressure \f$\mathrm{[Pa]}\f$ * diff --git a/dumux/material/binarycoefficients/henryiapws.hh b/dumux/material/binarycoefficients/henryiapws.hh index d59fb1e09a4b92d7898d148ed1e1e7b1cf17f15e..2ceaf9e7008542e26789713f3aa89aefb3dc71fb 100644 --- a/dumux/material/binarycoefficients/henryiapws.hh +++ b/dumux/material/binarycoefficients/henryiapws.hh @@ -77,6 +77,7 @@ inline Scalar henryIAPWS(Scalar E, static const Scalar q = -0.023767; Scalar f = 0; + using std::pow; for (int i = 0; i < 6; ++i) { f += c[i]*pow(tau, d[i]); } @@ -89,6 +90,7 @@ inline Scalar henryIAPWS(Scalar E, H*tau)* exp((H2O::tripleTemperature() - temperature)/100); + using std::exp; return exp(exponent)*H2O::vaporPressure(temperature); } } diff --git a/dumux/material/binarycoefficients/n2_o2.hh b/dumux/material/binarycoefficients/n2_o2.hh index e300f46b2785a09a089d4b579fb88a99b8d95b19..c6b67c26c373458407ef42b1d1d9045ba84ab53f 100644 --- a/dumux/material/binarycoefficients/n2_o2.hh +++ b/dumux/material/binarycoefficients/n2_o2.hh @@ -43,7 +43,7 @@ class N2_O2 { public: /*! - * \brief Henry coefficent \f$\mathrm{[Pa]}\f$ for molecular oxygen in liquid nitrogen. + * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for molecular oxygen in liquid nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ */ template @@ -53,7 +53,7 @@ public: } /*! - * \brief Binary diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. + * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. * * Uses fullerMethod to determine the diffusion of water in nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ @@ -73,7 +73,7 @@ public: } /*! - * \brief Diffusion coefficent \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. + * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular oxygen in liquid nitrogen. * \param temperature the temperature \f$\mathrm{[K]}\f$ * \param pressure the phase pressure \f$\mathrm{[Pa]}\f$ */ diff --git a/dumux/material/chemistry/electrochemistry/electrochemistry.hh b/dumux/material/chemistry/electrochemistry/electrochemistry.hh index 3d1f4592b14401d1fd398eed83f2517522724d67..b24b0863fb67edf66f9d1f24eafd1c69bdf30424 100644 --- a/dumux/material/chemistry/electrochemistry/electrochemistry.hh +++ b/dumux/material/chemistry/electrochemistry/electrochemistry.hh @@ -155,7 +155,8 @@ public: int iterations = 0; //Newton Solver for current Density - while (std::abs(deltaVoltage) > 1e-6) + using std::abs; + while (abs(deltaVoltage) > 1e-6) { Scalar activationLosses = calculateActivationLosses_(volVars, currentDensity); @@ -222,19 +223,21 @@ private: Scalar losses = 0.0; //Calculate activation losses + using std::log; + using std::abs; if(electroChemistryModel == ElectroChemistryModel::Acosta) { losses = preFactor - *( std::log(std::abs(currentDensity)/std::abs(exchangeCurrentDensity_(volVars))) - - std::log(pO2/refO2PartialPressure) - - std::log(1 - sw) + *( log(abs(currentDensity)/abs(exchangeCurrentDensity_(volVars))) + - log(pO2/refO2PartialPressure) + - log(1 - sw) ); } else { losses = preFactor - *( std::log(std::abs(currentDensity)/std::abs(exchangeCurrentDensity_(volVars))) - - std::log(pO2/refO2PartialPressure) + *( log(abs(currentDensity)/abs(exchangeCurrentDensity_(volVars))) + - log(pO2/refO2PartialPressure) ); } return losses; @@ -257,13 +260,14 @@ private: Scalar losses = 0.0; //Calculate concentration losses + using std::log; if(electroChemistryModel == ElectroChemistryModel::Acosta) { - losses = -1.0*preFactor*(transferCoefficient/2)*std::log(pO2/pO2Inlet); + losses = -1.0*preFactor*(transferCoefficient/2)*log(pO2/pO2Inlet); }else { // +1 is the Nernst part of the equation - losses = -1.0*preFactor*(transferCoefficient/2+1)*std::log(pO2/pO2Inlet); + losses = -1.0*preFactor*(transferCoefficient/2+1)*log(pO2/pO2Inlet); } return losses; @@ -275,6 +279,7 @@ private: */ static Scalar exchangeCurrentDensity_(const VolumeVariables &volVars) { + using std::exp; static Scalar activationBarrier = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.ActivationBarrier); static Scalar surfaceIncreasingFactor = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.SurfaceIncreasingFactor); static Scalar refTemperature = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.RefTemperature); @@ -284,7 +289,7 @@ private: Scalar refExchangeCurrentDensity = -1.0 * refCurrentDensity * surfaceIncreasingFactor - * std::exp(-1.0 * activationBarrier / Constant::R * (1/T-1/refTemperature)); + * exp(-1.0 * activationBarrier / Constant::R * (1/T-1/refTemperature)); return refExchangeCurrentDensity; } diff --git a/dumux/material/components/air.hh b/dumux/material/components/air.hh index e9ecbc4052629816419bd834e883bbcc2388fdad..d4a04652ff97d0c975e8888f708b0d0c08ee00c5 100644 --- a/dumux/material/components/air.hh +++ b/dumux/material/components/air.hh @@ -48,7 +48,7 @@ public: /*! * \brief A human readable name for Air. */ - static const char *name() + static std::string name() { return "Air"; } /*! @@ -63,7 +63,7 @@ public: * \brief Returns the critical temperature \f$\mathrm{[K]}\f$ of Air. */ static Scalar criticalTemperature() - { return 132.531 ; /* [K] */ } + { return 132.6312; /* [K] */ } /*! * \brief Returns the critical pressure \f$\mathrm{[Pa]}\f$ of Air. @@ -110,6 +110,7 @@ public: // Assume an ideal gas return IdealGas::pressure(temperature, density/molarMass()); } + /*! * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of Air at a given pressure and temperature. * @@ -126,40 +127,119 @@ public: * therefore not considered below * the same holds for the correction value kappa for highly polar substances * + * This calculation was introduced into Dumux in 2012 although the method here + * is designed for general polar substances. Air, however, is (a) non-polar, + * and (b) there are more precise methods available + * * \param temperature temperature of component in \f$\mathrm{[K]}\f$ * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ */ - static Scalar gasViscosity(Scalar temperature, Scalar pressure) + static Scalar oldGasViscosity(Scalar temperature, Scalar pressure) { - const Scalar Tc = criticalTemperature(); const Scalar Vc = 84.525138; // critical specific volume [cm^3/mol] const Scalar omega = 0.078; // accentric factor const Scalar M = molarMass() * 1e3; // molar mas [g/mol] - Scalar Fc = 1 - 0.2756*omega; - Scalar Tstar = 1.2593 * temperature/Tc; - Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785 * Fc * std::sqrt(M * temperature) - / (std::cbrt(Vc * Vc) * Omega_v); + const Scalar Fc = 1.0 - 0.2756*omega; + const Scalar Tstar = 1.2593*temperature/Tc; + + using std::exp; + using std::pow; + const Scalar Omega_v = 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(-0.77320*Tstar) + + 2.16178*exp(-2.43787*Tstar); + + using std::cbrt; + using std::sqrt; + const Scalar mu = 40.785 * Fc * sqrt(M * temperature)/(cbrt(Vc * Vc) * Omega_v); // convertion from micro poise to Pa s - return mu/1e6 / 10; + return mu/1.0e6/10.0; + } + + /*! + * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of Air at a given pressure and temperature. + * + * Simple method, already implemented in MUFTE-UG, but pretty accurate. + * + * The pressure correction is even simpler and developed and tested by + * Holger Class in 2016 against the results of the Lemmon and Jacobsen (2004) + * approach \cite Lemmon2004a + * It shows very reasonable results throughout realistic pressure and + * temperature ranges up to several hundred Kelvin and up to 500 bar + * + * \param temperature temperature of component in \f$\mathrm{[K]}\f$ + * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ + */ + static Scalar gasViscosity(Scalar temperature, Scalar pressure) + { + // above 1200 K, the function becomes inaccurate + // since this should realistically never happen, we can live with it + const Scalar tempCelsius = temperature - 273.15; + const Scalar pressureCorrectionFactor = 9.7115e-9*tempCelsius*tempCelsius - 5.5e-6*tempCelsius + 0.0010809; + + using std::sqrt; + const Scalar mu = 1.496e-6 * sqrt(temperature * temperature * temperature) / (temperature + 120.0) + * (1.0 + (pressure/1.0e5 - 1.0)*pressureCorrectionFactor); + return mu; } - // simpler method, from old constrelAir.hh + /*! + * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of Air at a given pressure and temperature. + * + * Simple method, already implemented in MUFTE-UG, but pretty accurate + * at atmospheric pressures. + * Gas viscosity is not very dependent on pressure. Thus, for + * low pressures one might switch the pressure correction off + * + * \param temperature temperature of component in \f$\mathrm{[K]}\f$ + * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ + */ static Scalar simpleGasViscosity(Scalar temperature, Scalar pressure) { - if(temperature < 273.15 || temperature > 660.) - { - DUNE_THROW(NumericalProblem, - "simpleGasViscosity: Temperature out of range! (T = " << temperature << " K)"); - } - return 1.496e-6 * std::sqrt(temperature * temperature * temperature) / (temperature + 120.); + // above 1200 K, the function becomes inaccurate + // since this should realistically never happen, we can live with it + using std::sqrt; + return 1.496e-6 * sqrt(temperature * temperature * temperature) / (temperature + 120.0); + } + + /*! + * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of Air at a given pressure and temperature. + * + * This is a very exact approach by Lemmon and Jacobsen (2004) \cite Lemmon2004a + * All the values and parameters used below are explained in their paper + * Since they use ''eta'' for dyn. viscosity, we do it as well for easier + * comparison with the paper + * + * \param temperature temperature of component in \f$\mathrm{[K]}\f$ + * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ + */ + static Scalar exactGasViscosity(Scalar temperature, Scalar pressure) + { + const Scalar epsk = 103.3; // [K] + + using namespace std; + const Scalar logTstar = log(temperature/epsk); + const Scalar Omega = exp(0.431 + - 0.4623*logTstar + + 0.08406*logTstar*logTstar + + 0.005341*logTstar*logTstar*logTstar + - 0.00331*logTstar*logTstar*logTstar*logTstar); + + const Scalar sigma = 0.36; // [nm] + const Scalar eta0 = 0.0266958*sqrt(1000.0*molarMass()*temperature)/(sigma*sigma*Omega); + const Scalar tau = criticalTemperature()/temperature; + const Scalar rhoc = 10.4477; // [mol/m^3] + const Scalar delta = 0.001*pressure/(temperature*8.3144598)/rhoc; + const Scalar etaR = 10.72 * pow(tau, 0.2) * delta + + 1.122 * pow(tau, 0.05) * pow(delta, 4) + + 0.002019 * pow(tau, 2.4) * pow(delta, 9) + - 8.876 * pow(tau, 0.6) * delta * exp(-delta) + - 0.02916 * pow(tau, 3.6) * pow(delta, 8) * exp(-delta); + + return (eta0 + etaR)*1e-6; } /*! @@ -190,11 +270,9 @@ public: static const Scalar gasInternalEnergy(Scalar temperature, Scalar pressure) { - return - gasEnthalpy(temperature, pressure) - - - IdealGas::R * temperature // = pressure * molar volume for an ideal gas - / molarMass(); // conversion from [J/(mol K)] to [J/(kg K)] + return gasEnthalpy(temperature, pressure) + - IdealGas::R * temperature // = pressure * molar volume for an ideal gas + / molarMass(); // conversion from [J/(mol K)] to [J/(kg K)] } /*! @@ -216,22 +294,22 @@ public: // scale temperature with reference temp of 100K Scalar phi = temperature/100; + using std::pow; Scalar c_p = 0.661738E+01 -0.105885E+01 * phi - +0.201650E+00 * std::pow(phi,2) - -0.196930E-01 * std::pow(phi,3) - +0.106460E-02 * std::pow(phi,4) - -0.303284E-04 * std::pow(phi,5) - +0.355861E-06 * std::pow(phi,6); - c_p += -0.549169E+01 * std::pow(phi,-1) - +0.585171E+01* std::pow(phi,-2) - -0.372865E+01* std::pow(phi,-3) - +0.133981E+01* std::pow(phi,-4) - -0.233758E+00* std::pow(phi,-5) - +0.125718E-01* std::pow(phi,-6); + +0.201650E+00 * pow(phi,2) + -0.196930E-01 * pow(phi,3) + +0.106460E-02 * pow(phi,4) + -0.303284E-04 * pow(phi,5) + +0.355861E-06 * pow(phi,6); + c_p += -0.549169E+01 * pow(phi,-1) + +0.585171E+01 * pow(phi,-2) + -0.372865E+01 * pow(phi,-3) + +0.133981E+01 * pow(phi,-4) + -0.233758E+00 * pow(phi,-5) + +0.125718E-01 * pow(phi,-6); c_p *= IdealGas::R / (molarMass() * 1000); // in J/mol/K * mol / kg / 1000 = kJ/kg/K - return c_p; } diff --git a/dumux/material/components/benzene.hh b/dumux/material/components/benzene.hh index 61f29bfd71e4d6eda9716453b165af255f7b5692..645dc1eb79a20631faf9f6887c7263016c727d2b 100644 --- a/dumux/material/components/benzene.hh +++ b/dumux/material/components/benzene.hh @@ -45,7 +45,7 @@ public: /*! * \brief A human readable name for the benzene */ - static const char *name() + static std::string name() { return "benzene"; } /*! diff --git a/dumux/material/components/brine.hh b/dumux/material/components/brine.hh index 3ec94c47a6cf6150e838cada7e8a6ce5d2b22734..42bb269fbb426e95b51fda8fe019175cdc6691f3 100644 --- a/dumux/material/components/brine.hh +++ b/dumux/material/components/brine.hh @@ -59,7 +59,7 @@ public: /*! * \brief A human readable name for the brine. */ - static const char *name() + static std::string name() { return "Brine"; } /*! @@ -134,12 +134,12 @@ public: static const Scalar liquidEnthalpy(Scalar T, Scalar p, Scalar salinity = constantSalinity) { - /*Numerical coefficents from PALLISER*/ + /*Numerical coefficients from PALLISER*/ static const Scalar f[] = { 2.63500E-1, 7.48368E-6, 1.44611E-6, -3.80860E-10 }; - /*Numerical coefficents from MICHAELIDES for the enthalpy of brine*/ + /*Numerical coefficients from MICHAELIDES for the enthalpy of brine*/ static const Scalar a[4][3] = { { +9633.6, -4080.0, +286.49 }, { +166.58, +68.577, -4.6856 }, @@ -151,7 +151,9 @@ public: const Scalar salSat = f[0] + f[1]*theta + f[2]*theta*theta + f[3]*theta*theta*theta; /*Regularization*/ - salinity = std::min(std::max(salinity,0.0), salSat); + using std::min; + using std::max; + salinity = min(max(salinity,0.0), salSat); const Scalar hw = H2O::liquidEnthalpy(T, p)/1E3; /* kJ/kg */ @@ -161,6 +163,7 @@ public: const Scalar m = (1E3/58.44)*(salinity/(1-salinity)); + using std::pow; Scalar d_h = 0; for (int i = 0; i<=3; i++) { for (int j=0; j<=2; j++) { @@ -281,25 +284,26 @@ public: */ static Scalar liquidDensity(Scalar temperature, Scalar pressure, Scalar salinity = constantSalinity) { + using std::max; const Scalar TempC = temperature - 273.15; const Scalar pMPa = pressure/1.0E6; - salinity = std::max(0.0, salinity); + salinity = max(0.0, salinity); const Scalar rhow = H2O::liquidDensity(temperature, pressure); - const Scalar density = rhow + - 1000*salinity*( - 0.668 + - 0.44*salinity + - 1.0E-6*( - 300*pMPa - - 2400*pMPa*salinity + - TempC*( - 80.0 + - 3*TempC - - 3300*salinity - - 13*pMPa + - 47*pMPa*salinity))); + const Scalar density = rhow + + 1000*salinity*( + 0.668 + + 0.44*salinity + + 1.0E-6*( + 300*pMPa - + 2400*pMPa*salinity + + TempC*( + 80.0 + + 3*TempC - + 3300*salinity - + 13*pMPa + + 47*pMPa*salinity))); assert(density > 0.0); return density; } @@ -330,7 +334,9 @@ public: const Scalar eps = pressure*1e-7; Scalar deltaP = pressure*2; - for (int i = 0; i < 5 && std::abs(pressure*1e-9) < std::abs(deltaP); ++i) { + + using std::abs; + for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) { Scalar f = liquidDensity(temperature, pressure) - density; Scalar df_dp; @@ -370,9 +376,12 @@ public: static Scalar liquidViscosity(Scalar temperature, Scalar pressure, Scalar salinity = constantSalinity) { // regularisation - temperature = std::max(temperature, 275.0); - salinity = std::max(0.0, salinity); + using std::max; + temperature = max(temperature, 275.0); + salinity = max(0.0, salinity); + using std::pow; + using std::exp; const Scalar T_C = temperature - 273.15; const Scalar A = (0.42*pow((pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8); const Scalar mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A); diff --git a/dumux/material/components/ch4.hh b/dumux/material/components/ch4.hh index 6634cbc2aef24f5b916ae29ee37004941d49d504..fe095eec152d3b1d23a66327cc131bf1513309e2 100644 --- a/dumux/material/components/ch4.hh +++ b/dumux/material/components/ch4.hh @@ -51,7 +51,7 @@ public: /*! * \brief A human readable name for methane. */ - static const char *name() + static std::string name() { return "CH4"; } /*! @@ -94,7 +94,7 @@ public: { DUNE_THROW(Dune::NotImplemented, "vaporPressure for CH4"); } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } @@ -112,7 +112,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } @@ -152,7 +152,6 @@ public: // calculate: \int_0^T c_p dT return 1/molarMass()* // conversion from [J/mol] to [J/kg] - T*(cpVapA + T* (cpVapB/2 + T* (cpVapC/3 + T* @@ -204,17 +203,20 @@ public: const Scalar M = molarMass() * 1e3; // molar mas [g/mol] const Scalar dipole = 0.0; // dipole moment [debye] - Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc); + using std::sqrt; + Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); mu_r4 *= mu_r4; mu_r4 *= mu_r4; + using std::exp; + using std::pow; Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; Scalar Tstar = 1.2593 * temperature/Tc; Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785*Fc*std::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v); + 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(- 0.77320*Tstar) + + 2.16178*exp(- 2.43787*Tstar); + Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); // convertion from micro poise to Pa s return mu/1e6 / 10; diff --git a/dumux/material/components/co2.hh b/dumux/material/components/co2.hh index 14b00c851cfa29e1c4908d3f6770c2f004d84e8b..00462085076d01590fcb6039cbcc616049472dac 100644 --- a/dumux/material/components/co2.hh +++ b/dumux/material/components/co2.hh @@ -57,7 +57,7 @@ public: /*! * \brief A human readable name for the CO2. */ - static const char *name() + static std::string name() { return "CO2"; } /*! @@ -133,12 +133,14 @@ public: // this is on page 1524 of the reference Scalar exponent = 0; Scalar Tred = T/criticalTemperature(); - for (int i = 0; i < 5; ++i) { - exponent += a[i]*std::pow(1 - Tred, t[i]); - } + + using std::pow; + for (int i = 0; i < 5; ++i) + exponent += a[i]*pow(1 - Tred, t[i]); exponent *= 1.0/Tred; - return std::exp(exponent)*criticalPressure(); + using std::exp; + return exp(exponent)*criticalPressure(); } /*! @@ -147,7 +149,7 @@ public: static Scalar gasEnthalpy(Scalar temperature, Scalar pressure) { - if ((temperature < criticalTemperature() or pressure < criticalPressure()) and !warningThrown) + if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown) { Dune::dwarn << "Subcritical values: Be aware to use " <<"Tables with sufficient resolution!"<< std::endl; @@ -163,7 +165,7 @@ public: static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure) { - if ((temperature < criticalTemperature() or pressure < criticalPressure()) and !warningThrown) + if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown) { Dune::dwarn << "Subcritical values: Be aware to use " <<"Tables with sufficient resolution!"<< std::endl; @@ -202,7 +204,7 @@ public: */ static Scalar gasDensity(Scalar temperature, Scalar pressure) { - if ((temperature < criticalTemperature() or pressure < criticalPressure()) and !warningThrown) + if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown) { Dune::dwarn << "Subcritical values: Be aware to use " <<"Tables with sufficient resolution!"<< std::endl; @@ -217,7 +219,7 @@ public: */ static Scalar liquidDensity(Scalar temperature, Scalar pressure) { - if ((temperature < criticalTemperature() or pressure < criticalPressure()) and !warningThrown) + if ((temperature < criticalTemperature() || pressure < criticalPressure()) && !warningThrown) { Dune::dwarn << "Subcritical values: Be aware to use " <<"Tables with sufficient resolution!"<< std::endl; @@ -310,16 +312,19 @@ public: TStar = temperature/ESP; /* mu0: viscosity in zero-density limit */ + using std::exp; + using std::log; + using std::sqrt; SigmaStar = exp(a0 + a1*log(TStar) + a2*log(TStar)*log(TStar) + a3*log(TStar)*log(TStar)*log(TStar) + a4*log(TStar)*log(TStar)*log(TStar)*log(TStar) ); - mu0 = 1.00697*sqrt(temperature) / SigmaStar; /* dmu : excess viscosity at elevated density */ rho = gasDensity(temperature, pressure); /* CO2 mass density [kg/m^3] */ + using std::pow; dmu = d11*rho + d21*rho*rho + d64*pow(rho,6)/(TStar*TStar*TStar) + d81*pow(rho,8) + d82*pow(rho,8)/TStar; diff --git a/dumux/material/components/co2tablereader.hh b/dumux/material/components/co2tablereader.hh index 38c0ac65b86c2c85dbcb2e232922570ad6450830..acb8847586b5e11688e85f8109f9d100af39f37b 100644 --- a/dumux/material/components/co2tablereader.hh +++ b/dumux/material/components/co2tablereader.hh @@ -122,7 +122,10 @@ protected: if (Dune::FloatCmp::eq(temperature, maxTemp())) return numTempSteps - 2; const int result = static_cast((temperature - minTemp())/(maxTemp() - minTemp())*(numTempSteps - 1)); - return std::max(0, std::min(result, numTempSteps - 2)); + + using std::min; + using std::max; + return max(0, min(result, numTempSteps - 2)); } int findPressIdx_(Scalar pressure) const @@ -130,7 +133,10 @@ protected: if (Dune::FloatCmp::eq(pressure, maxPress())) return numPressSteps - 2; const int result = static_cast((pressure - minPress())/(maxPress() - minPress())*(numPressSteps - 1)); - return std::max(0, std::min(result, numPressSteps - 2)); + + using std::min; + using std::max; + return max(0, min(result, numPressSteps - 2)); } Scalar temperatureAt_(int i) const diff --git a/dumux/material/components/component.hh b/dumux/material/components/component.hh index b24f699af026f021d6f913f2ef707155a1ead35a..9e6c1321098cb2aec0052c158f78d63c1dcc6f30 100644 --- a/dumux/material/components/component.hh +++ b/dumux/material/components/component.hh @@ -61,19 +61,19 @@ public: { Dune::dwarn << "No init routine defined - make sure that this is not necessary!" << std::endl; } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { DUNE_THROW(Dune::NotImplemented, "Component::gasIsCompressible()"); } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { DUNE_THROW(Dune::NotImplemented, "Component::gasIsCompressible()"); } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { DUNE_THROW(Dune::NotImplemented, "Component::liquidIsCompressible()"); } @@ -81,7 +81,7 @@ public: /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { DUNE_THROW(Dune::NotImplemented, "Component::name()"); } /*! diff --git a/dumux/material/components/constant.hh b/dumux/material/components/constant.hh index eb545337eac4c379dc3c61d6d2c75fb009f5b81f..5298cd86369dbda5e48615f9aa64c2b526af0769 100644 --- a/dumux/material/components/constant.hh +++ b/dumux/material/components/constant.hh @@ -65,7 +65,7 @@ public: /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { return "Constant"; } /*! diff --git a/dumux/material/components/dnapl.hh b/dumux/material/components/dnapl.hh index 57126aec160555b42d9f49ef740c024b491a6d08..485387e1cf2369f74b872746a8b0fe1e2a89af6b 100644 --- a/dumux/material/components/dnapl.hh +++ b/dumux/material/components/dnapl.hh @@ -44,7 +44,7 @@ public: /*! * \brief A human readable name for the dense NAPL TCE. */ - static const char *name() + static std::string name() { return "DNAPL_TCE"; } /*! diff --git a/dumux/material/components/h2.hh b/dumux/material/components/h2.hh index e6ea4c9948c349c305a6023dd7e8bf3948475d75..65af6a93c0351eca50af2a633259aa85af50ba88 100644 --- a/dumux/material/components/h2.hh +++ b/dumux/material/components/h2.hh @@ -51,7 +51,7 @@ public: /*! * \brief A human readable name for the \f$H_2\f$. */ - static const char *name() + static std::string name() { return "H2"; } /*! @@ -103,7 +103,8 @@ public: const Scalar B = 1.45838; const Scalar C = -2.77580; - return 1e5 * std::exp(A - B/(temperature + C)); + using std::exp; + return 1e5 * exp(A - B/(temperature + C)); } /*! @@ -119,13 +120,13 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } @@ -165,7 +166,6 @@ public: // calculate: \int_0^T c_p dT return 1/molarMass()* // conversion from [J/mol] to [J/kg] - T*(cpVapA + T* (cpVapB/2 + T* (cpVapC/3 + T* @@ -192,17 +192,20 @@ public: const Scalar M = molarMass() * 1e3; // molar mas [g/mol] const Scalar dipole = 0.0; // dipole moment [debye] - Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc); + using std::sqrt; + Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); mu_r4 *= mu_r4; mu_r4 *= mu_r4; + using std::pow; + using std::exp; Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; Scalar Tstar = 1.2593 * temperature/Tc; Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785*Fc*std::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v); + 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(- 0.77320*Tstar) + + 2.16178*exp(- 2.43787*Tstar); + Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); // convertion from micro poise to Pa s return mu/1e6 / 10; diff --git a/dumux/material/components/h2o.hh b/dumux/material/components/h2o.hh index 5ac7b94ddd7e037fbff82ea96ac8bd8ddfe21aa4..acf9c76d58b658abf5eb0990ec98d1905eada017 100644 --- a/dumux/material/components/h2o.hh +++ b/dumux/material/components/h2o.hh @@ -50,7 +50,6 @@ namespace Dumux * \tparam Scalar The type used for scalar values * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -71,7 +70,7 @@ public: /*! * \brief A human readable name for the water. */ - static const char *name() + static std::string name() { return "H2O"; } /*! @@ -123,15 +122,16 @@ public: *\param T temperature of component in \f$\mathrm{[K]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", - * http://www.iapws.org/relguide/IF97-Rev.pdf + * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 */ static Scalar vaporPressure(Scalar T) { - T = std::min(T, criticalTemperature()); - T = std::max(T,tripleTemperature()); + using std::min; + using std::max; + T = min(T, criticalTemperature()); + T = max(T,tripleTemperature()); return Region4::saturationPressure(T); } @@ -143,15 +143,16 @@ public: *\param pressure pressure in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 */ static Scalar vaporTemperature(Scalar pressure) { - pressure = std::min(pressure, criticalPressure()); - pressure = std::max(pressure, triplePressure()); + using std::min; + using std::max; + pressure = min(pressure, criticalPressure()); + pressure = max(pressure, triplePressure()); return Region4::vaporTemperature(pressure); } @@ -163,7 +164,6 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -171,12 +171,7 @@ public: static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Enthalpy of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Enthalpy"); // regularization if (pressure < triplePressure() - 100) { @@ -213,7 +208,6 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -221,12 +215,7 @@ public: static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Enthalpy of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region1::checkValidityRange(temperature, pressure, "Enthalpy"); // regularization Scalar pv = vaporPressure(temperature); @@ -254,7 +243,6 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -262,12 +250,7 @@ public: static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Heat capacity of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Heat capacity"); // regularization if (pressure < triplePressure() - 100) { @@ -289,7 +272,6 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -297,12 +279,7 @@ public: static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "heat Capacity of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region1::checkValidityRange(temperature, pressure, "Heat capacity"); // regularization Scalar pv = vaporPressure(temperature); @@ -321,21 +298,14 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", - * http://www.iapws.org/relguide/IF97-Rev.pdf + * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 */ static const Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Internal Energy of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } - + Region1::checkValidityRange(temperature, pressure, "Internal energy"); // regularization Scalar pv = vaporPressure(temperature); @@ -378,19 +348,13 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", - * http://www.iapws.org/relguide/IF97-Rev.pdf + * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 */ static Scalar gasInternalEnergy(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Internal Energy of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Internal energy"); // regularization if (pressure < triplePressure() - 100) { @@ -451,7 +415,6 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Revised Release on the IAPWS Industrial Formulation * 1997 for the Thermodynamic Properties of Water and Steam", * http://www.iapws.org/relguide/IF97-Rev.pdf \cite IAPWS1997 @@ -459,13 +422,7 @@ public: static const Scalar liquidHeatCapacityConstVolume(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Heat capacity of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } - + Region1::checkValidityRange(temperature, pressure, "Heat capacity for a constant volume"); // regularization Scalar pv = vaporPressure(temperature); @@ -492,12 +449,7 @@ public: */ static Scalar gasHeatCapacityConstVolume(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Heat capacity of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Heat capacity for a constant volume"); // regularization if (pressure < triplePressure() - 100) { @@ -513,13 +465,13 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static constexpr bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static constexpr bool liquidIsCompressible() { return true; } @@ -538,12 +490,7 @@ public: */ static Scalar gasDensity(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Density of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Density"); // regularization if (pressure < triplePressure() - 100) { @@ -597,7 +544,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static constexpr bool gasIsIdeal() { return false; } @@ -627,7 +574,9 @@ public: Scalar deltaP = pressure*2; Valgrind::CheckDefined(pressure); Valgrind::CheckDefined(deltaP); - for (int i = 0; i < 5 && std::abs(pressure*1e-9) < std::abs(deltaP); ++i) { + + using std::abs; + for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) { Scalar f = gasDensity(temperature, pressure) - density; Scalar df_dp; @@ -659,12 +608,7 @@ public: */ static Scalar liquidDensity(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Density of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region1::checkValidityRange(temperature, pressure, "Density"); // regularization Scalar pv = vaporPressure(temperature); @@ -726,7 +670,9 @@ public: Scalar eps = pressure*1e-7; Scalar deltaP = pressure*2; - for (int i = 0; i < 5 && std::abs(pressure*1e-9) < std::abs(deltaP); ++i) { + + using std::abs; + for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) { Scalar f = liquidDensity(temperature, pressure) - density; Scalar df_dp; @@ -752,18 +698,12 @@ public: * pressure of water. * * See: - * * IAPWS: "Release on the IAPWS Formulation 2008 for the Viscosity * of Ordinary Water Substance", http://www.iapws.org/relguide/visc.pdf \cite cooper2008 */ static Scalar gasViscosity(Scalar temperature, Scalar pressure) { - if (!Region2::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Viscosity of steam is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region2::checkValidityRange(temperature, pressure, "Viscosity"); Scalar rho = gasDensity(temperature, pressure); return Common::viscosity(temperature, rho); @@ -776,18 +716,12 @@ public: * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ * * See: - * * IAPWS: "Release on the IAPWS Formulation 2008 for the Viscosity * of Ordinary Water Substance", http://www.iapws.org/relguide/visc.pdf \cite cooper2008 */ static Scalar liquidViscosity(Scalar temperature, Scalar pressure) { - if (!Region1::isValid(temperature, pressure)) - { - DUNE_THROW(NumericalProblem, - "Viscosity of water is only implemented for temperatures below 623.15K and " - "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); - } + Region1::checkValidityRange(temperature, pressure, "Viscosity"); Scalar rho = liquidDensity(temperature, pressure); return Common::viscosity(temperature, rho); @@ -800,8 +734,10 @@ public: * freesteam - IAPWS-IF97 steam tables library * copyright (C) 2004-2009 John Pye * - * Appendix B: Recommended Interpolating equation for Industrial Use - * see http://www.iapws.org/relguide/thcond.pdf + * See: + * IAPWS: "Release on the IAPWS Formulation 2011 for the Thermal Conductivity + * of Ordinary Water Substance", http://www.iapws.org/relguide/ThCond.pdf + * \cite IAPWS_ThCond * * \param temperature absolute temperature in \f$\mathrm{[K]}\f$ * \param pressure of the phase in \f$\mathrm{[Pa]}\f$ @@ -810,10 +746,11 @@ public: { // Thermal conductivity of water is empirically fit. // Evaluating that fitting-function outside the area of validity does not make sense. - if( not ( (pressure <= 400e6 and ((273.15<=temperature) and (temperature<=398.15)) ) - or (pressure <= 200e6 and ((398.15bar*/ ) ) + * (3.978 * Tr1 - 3.958 + 1.555*log(p_crit * 1e-5 /*Pa->bar*/ ) ) / (1.07 - Tr1); /* [J/mol] */ /* Variation with temp according to Watson relation eq 7-12.1*/ + using std::pow; const Scalar Tr2 = temperature/criticalTemperature(); const Scalar n = 0.375; - const Scalar DH_vap = DH_v_boil * std::pow(((1.0 - Tr2)/(1.0 - Tr1)), n); + const Scalar DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n); return (DH_vap/molarMass()); // we need [J/kg] } @@ -357,19 +362,19 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { return true; } @@ -383,18 +388,22 @@ public: */ static Scalar gasViscosity(Scalar temperature, Scalar pressure, bool regularize=true) { - temperature = std::min(temperature, 500.0); // regularization - temperature = std::max(temperature, 250.0); + using std::min; + using std::max; + temperature = min(temperature, 500.0); // regularization + temperature = max(temperature, 250.0); // reduced temperature Scalar Tr = temperature/criticalTemperature(); + using std::pow; + using std::exp; Scalar Fp0 = 1.0; Scalar xi = 0.00474; Scalar eta_xi = - Fp0*(0.807*std::pow(Tr,0.618) - - 0.357*std::exp(-0.449*Tr) - + 0.34*std::exp(-4.058*Tr) + Fp0*(0.807*pow(Tr,0.618) + - 0.357*exp(-0.449*Tr) + + 0.34*exp(-4.058*Tr) + 0.018); return eta_xi/xi/1e7; // [Pa s] @@ -403,6 +412,8 @@ public: /*! * \brief The dynamic viscosity \f$\mathrm{[Pa*s]}\f$ of pure heavyoil. * + * Lashanizadegan et al. (2008) \cite lashanizadegan2008
+ * * \param temperature temperature of component in \f$\mathrm{[K]}\f$ * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ */ @@ -412,18 +423,21 @@ public: /* according to Lashanizadegan et al (2008) in Chemical Engineering Communications: */ /* Simultaneous Heat and Fluid Flow in Porous Media: Case Study: Steam Injection for Tertiary Oil Recovery */ - //return 1027919.422*std::exp(-0.04862*temperature); // [Pa s] + //using std::exp; + //return 1027919.422*exp(-0.04862*temperature); // [Pa s] //according to http://www.ecltechnology.com/subsur/reports/pvt_tgb.pdf [Page 10] Scalar temperatureFahrenheit = (9/5)*(temperature-273.15)+32; Scalar API = 9; - return ((std::pow(10,0.10231*std::pow(API,2)-3.9464*API+46.5037))*(std::pow(temperatureFahrenheit,-0.04542*std::pow(API,2)+1.70405*API-19.18)))*0.001; + + using std::pow; + return ((pow(10,0.10231*pow(API,2)-3.9464*API+46.5037))*(pow(temperatureFahrenheit,-0.04542*pow(API,2)+1.70405*API-19.18)))*0.001; } /*! * \brief Specific heat cap of liquid heavyoil \f$\mathrm{[J/kg]}\f$. * - * source : Reid et al. (fourth edition): Missenard group contrib. method (chap 5-7, Table 5-11, s. example 5-8) + * Lashanizadegan et al. (2008) \cite lashanizadegan2008
* * \param temperature temperature of component in \f$\mathrm{[K]}\f$ * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ @@ -432,12 +446,22 @@ public: static Scalar liquidHeatCapacity(const Scalar temperature, const Scalar pressure) { - /* according to Lashanizadegan et al (2008) in Chemical Engineering Communications: */ - /* Simultaneous Heat and Fluid Flow in Porous Media: Case Study: Steam Injection for Tertiary Oil Recovery */ - return 618.; // J/(kg K) } + /*! + * \brief Thermal conductivity \f$\mathrm{[[W/(m*K)]}\f$ of heavy oil + * + * Lashanizadegan et al. (2008) \cite lashanizadegan2008
+ * + * \param temperature absolute temperature in \f$\mathrm{[K]}\f$ + * \param pressure of the phase in \f$\mathrm{[Pa]}\f$ + */ + static Scalar liquidThermalConductivity( Scalar temperature, Scalar pressure) + { + return 0.127; + } + protected: /*! * \brief The molar density of pure heavyoil at a given pressure and temperature @@ -449,12 +473,15 @@ protected: */ static Scalar molarLiquidDensity_(Scalar temperature) { - temperature = std::min(temperature, 500.0); // regularization - temperature = std::max(temperature, 250.0); + using std::min; + using std::max; + temperature = min(temperature, 500.0); // regularization + temperature = max(temperature, 250.0); + using std::pow; const Scalar Z_RA = 0.2556; // from equation - const Scalar expo = 1.0 + std::pow(1.0 - temperature/criticalTemperature(), 2.0/7.0); - Scalar V = Consts::R*criticalTemperature()/criticalPressure()*std::pow(Z_RA, expo); // liquid molar volume [cm^3/mol] + const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0); + Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol] return 1.0/V; // molar density [mol/m^3] } diff --git a/dumux/material/components/iapws/common.hh b/dumux/material/components/iapws/common.hh index 78b42ddcd8e0e545ec4f6b8f1b09f2c09f242390..2bde178bddc38ef70249408b82cf0e54904e7d32 100644 --- a/dumux/material/components/iapws/common.hh +++ b/dumux/material/components/iapws/common.hh @@ -130,11 +130,13 @@ public: muBar += tmp3 * tmp; tmp3 *= 1.0/TBar - 1; } + using std::exp; muBar *= rhoBar; - muBar = std::exp(muBar); + muBar = exp(muBar); // muBar *= muBar_0 - muBar *= 100*std::sqrt(TBar); + using std::sqrt; + muBar *= 100*sqrt(TBar); constexpr Scalar H[4] = { 1.67752, 2.20462, 0.6366564, -0.241605 }; @@ -197,6 +199,7 @@ public: Scalar rhobar = rho / thcond_rhostar; /* fast implementation... minimised calls to 'pow' routine... */ + using std::sqrt; Scalar Troot = sqrt(Tbar); Scalar Tpow = Troot; Scalar lam = 0; @@ -206,11 +209,14 @@ public: Tpow *= Tbar; } + using std::exp; lam += thcond_b0 + thcond_b1 * rhobar + thcond_b2 * exp(thcond_B1 * ((rhobar + thcond_B2)*(rhobar + thcond_B2))); - Scalar DTbar = fabs(Tbar - 1) + thcond_c4; + using std::abs; + using std::pow; + Scalar DTbar = abs(Tbar - 1) + thcond_c4; Scalar DTbarpow = pow(DTbar, 3./5); Scalar Q = 2. + thcond_c5 / DTbarpow; diff --git a/dumux/material/components/iapws/region1.hh b/dumux/material/components/iapws/region1.hh index 40b4e4477ec824e670c69ebeb6d814465916a5e0..eefff15ef6b318d27b7ce8f35b0061b5e03e8926 100644 --- a/dumux/material/components/iapws/region1.hh +++ b/dumux/material/components/iapws/region1.hh @@ -34,6 +34,7 @@ #include #include +#include namespace Dumux { @@ -62,23 +63,22 @@ public: * * \param temperature temperature of component in \f$\mathrm{[K]}\f$ * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ + * \param propertyName the name for which property the check is performed */ - static constexpr bool isValid(Scalar temperature, Scalar pressure) + static void checkValidityRange(Scalar temperature, Scalar pressure, + std::string propertyName = "This property") { - return - temperature <= 623.15 && - pressure <= 100e6; - // actually this is: - /* - return - ( - 273.15 <= temperature && + /* 273.15 <= temperature && temperature <= 623.15 && pressure >= vaporPressure(temperature) && - pressure <= 100e6 - ); - */ + pressure <= 100e6 */ + if (temperature <= 623.15 && pressure <= 100e6) + return; + + DUNE_THROW(NumericalProblem, + propertyName << " of water is only implemented for temperatures below 623.15K and " + "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); } /*! @@ -164,13 +164,13 @@ public: Scalar tau_ = tau(temperature); /* reduced temperature */ Scalar pi_ = pi(pressure); /* reduced pressure */ + using std::pow; Scalar result = 0.0; for (int i = 0; i < 34; i++) { - result += - n(i) * - std::pow(7.1 - pi_, I(i)) * - std::pow(tau_ - 1.222, J(i)-1) * - J(i); + result += n(i) * + pow(7.1 - pi_, I(i)) * + pow(tau_ - 1.222, J(i)-1) * + J(i); } return result; @@ -192,13 +192,13 @@ public: Scalar tau_ = tau(temperature); /* reduced temperature */ Scalar pi_ = pi(pressure); /* reduced pressure */ + using std::pow; Scalar result = 0.0; for (int i = 0; i < 34; i++) { - result += - -n(i) * - I(i) * - std::pow(7.1 - pi_, I(i) - 1) * - std::pow(tau_ - 1.222, J(i)); + result += -n(i) * + I(i) * + pow(7.1 - pi_, I(i) - 1) * + pow(tau_ - 1.222, J(i)); } return result; @@ -221,14 +221,14 @@ public: Scalar tau_ = tau(temperature); /* reduced temperature */ Scalar pi_ = pi(pressure); /* reduced pressure */ + using std::pow; Scalar result = 0.0; for (int i = 0; i < 34; i++) { - result += - -n(i) * - I(i) * - J(i) * - std::pow(7.1 - pi_, I(i) - 1) * - std::pow(tau_ - 1.222, J(i) - 1); + result += -n(i) * + I(i) * + J(i) * + pow(7.1 - pi_, I(i) - 1) * + pow(tau_ - 1.222, J(i) - 1); } return result; @@ -251,14 +251,14 @@ public: Scalar tau_ = tau(temperature); /* reduced temperature */ Scalar pi_ = pi(pressure); /* reduced pressure */ + using std::pow; Scalar result = 0.0; for (int i = 0; i < 34; i++) { - result += - n(i) * - I(i) * - (I(i) - 1) * - std::pow(7.1 - pi_, I(i) - 2) * - std::pow(tau_ - 1.222, J(i)); + result += n(i) * + I(i) * + (I(i) - 1) * + pow(7.1 - pi_, I(i) - 2) * + pow(tau_ - 1.222, J(i)); } return result; @@ -280,14 +280,14 @@ public: Scalar tau_ = tau(temperature); /* reduced temperature */ Scalar pi_ = pi(pressure); /* reduced pressure */ + using std::pow; Scalar result = 0.0; for (int i = 0; i < 34; i++) { - result += - n(i) * - std::pow(7.1 - pi_, I(i)) * - J(i) * - (J(i) - 1) * - std::pow(tau_ - 1.222, J(i) - 2); + result += n(i) * + pow(7.1 - pi_, I(i)) * + J(i) * + (J(i) - 1) * + pow(tau_ - 1.222, J(i) - 2); } return result; diff --git a/dumux/material/components/iapws/region2.hh b/dumux/material/components/iapws/region2.hh index 6a63520f1b8c770a39db529608147987abeadb3e..a7bfe45cfa39d94fb3ed3031cbe7f7c827645e71 100644 --- a/dumux/material/components/iapws/region2.hh +++ b/dumux/material/components/iapws/region2.hh @@ -35,6 +35,7 @@ #include #include +#include namespace Dumux { @@ -64,18 +65,21 @@ public: * * \param temperature temperature of component in \f$\mathrm{[K]}\f$ * \param pressure pressure of component in \f$\mathrm{[Pa]}\f$ + * \param propertyName the name for which property the check is performed */ - static constexpr bool isValid(Scalar temperature, Scalar pressure) + static void checkValidityRange(Scalar temperature, Scalar pressure, + std::string propertyName = "This property") { - return temperature <= 623.15 && pressure <= 100e6; - // actually this is: - /* - return - (273.15 <= temperature && temperature <= 623.15 && pressure <= vaporPressure(temperature)) || + /* (273.15 <= temperature && temperature <= 623.15 && pressure <= vaporPressure(temperature)) || (623.15 < temperature && temperature <= 863.15 && pressure <= auxPressure(temperature)) || - (863.15 < temperature && temperature <= 1073.15 && pressure < 100e6); - */ + (863.15 < temperature && temperature <= 1073.15 && pressure < 100e6); */ + if (temperature <= 623.15 && pressure <= 100e6) + return; + + DUNE_THROW(NumericalProblem, + propertyName << " of steam is only implemented for temperatures below 623.15K and " + "pressures below 100MPa. (T=" << temperature << ", p=" << pressure << ")"); } /*! @@ -140,16 +144,16 @@ public: Scalar result; // ideal gas part + using std::pow; result = ln(pi); for (int i = 0; i < 9; ++i) - result += n_g(i)*std::pow(tau, J_g(i)); + result += n_g(i)*pow(tau, J_g(i)); // residual part for (int i = 0; i < 43; ++i) - result += - n_r(i)* - std::pow(pi, I_r(i))* - std::pow(tau - 0.5, J_r(i)); + result += n_r(i)* + pow(pi, I_r(i))* + pow(tau - 0.5, J_r(i)); return result; } @@ -171,21 +175,20 @@ public: Scalar pi_ = pi(pressure); /* reduced pressure */ // ideal gas part + using std::pow; Scalar result = 0; for (int i = 0; i < 9; i++) { - result += - n_g(i) * - J_g(i) * - std::pow(tau_, J_g(i) - 1); + result += n_g(i) * + J_g(i) * + pow(tau_, J_g(i) - 1); } // residual part for (int i = 0; i < 43; i++) { - result += - n_r(i) * - std::pow(pi_, I_r(i)) * - J_r(i) * - std::pow(tau_ - 0.5, J_r(i) - 1); + result += n_r(i) * + pow(pi_, I_r(i)) * + J_r(i) * + pow(tau_ - 0.5, J_r(i) - 1); } return result; @@ -212,12 +215,12 @@ public: Scalar result = 1/pi_; // residual part + using std::pow; for (int i = 0; i < 43; i++) { - result += - n_r(i) * - I_r(i) * - std::pow(pi_, I_r(i) - 1) * - std::pow(tau_ - 0.5, J_r(i)); + result += n_r(i) * + I_r(i) * + pow(pi_, I_r(i) - 1) * + pow(tau_ - 0.5, J_r(i)); } return result; @@ -244,13 +247,13 @@ public: Scalar result = 0; // residual part + using std::pow; for (int i = 0; i < 43; i++) { - result += - n_r(i) * - I_r(i) * - J_r(i) * - std::pow(pi_, I_r(i) - 1) * - std::pow(tau_ - 0.5, J_r(i) - 1); + result += n_r(i) * + I_r(i) * + J_r(i) * + pow(pi_, I_r(i) - 1) * + pow(tau_ - 0.5, J_r(i) - 1); } return result; @@ -277,13 +280,13 @@ public: Scalar result = -1/(pi_*pi_); // residual part + using std::pow; for (int i = 0; i < 43; i++) { - result += - n_r(i) * - I_r(i) * - (I_r(i) - 1) * - std::pow(pi_, I_r(i) - 2) * - std::pow(tau_ - 0.5, J_r(i)); + result += n_r(i) * + I_r(i) * + (I_r(i) - 1) * + pow(pi_, I_r(i) - 2) * + pow(tau_ - 0.5, J_r(i)); } return result; @@ -307,23 +310,23 @@ public: Scalar pi_ = pi(pressure); /* reduced pressure */ // ideal gas part + using std::pow; Scalar result = 0; for (int i = 0; i < 9; i++) { - result += - n_g(i) * - J_g(i) * - (J_g(i) - 1) * - std::pow(tau_, J_g(i) - 2); + result += n_g(i) * + J_g(i) * + (J_g(i) - 1) * + pow(tau_, J_g(i) - 2); } // residual part + using std::pow; for (int i = 0; i < 43; i++) { - result += - n_r(i) * - std::pow(pi_, I_r(i)) * - J_r(i) * - (J_r(i) - 1.) * - std::pow(tau_ - 0.5, J_r(i) - 2.); + result += n_r(i) * + pow(pi_, I_r(i)) * + J_r(i) * + (J_r(i) - 1.) * + pow(tau_ - 0.5, J_r(i) - 2.); } return result; diff --git a/dumux/material/components/iapws/region4.hh b/dumux/material/components/iapws/region4.hh index bdb7c60347a79e6306c4e8152d23f0c0dc34f69a..e3496ed8af951808da6fec4fff7a0c658c8fe8f5 100644 --- a/dumux/material/components/iapws/region4.hh +++ b/dumux/material/components/iapws/region4.hh @@ -81,7 +81,8 @@ public: Scalar B = (n[2]*sigma + n[3])*sigma + n[4]; Scalar C = (n[5]*sigma + n[6])*sigma + n[7]; - Scalar tmp = 2*C/(std::sqrt(B*B - 4*A*C) - B); + using std::sqrt; + Scalar tmp = 2*C/(sqrt(B*B - 4*A*C) - B); tmp *= tmp; tmp *= tmp; @@ -104,15 +105,17 @@ public: -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849, 0.65017534844798e3 }; + + using std::pow; Scalar beta = pow((pressure/1e6 /*from Pa to MPa*/), (1./4.)); Scalar beta2 = pow(beta, 2.); Scalar E = beta2 + n[2] * beta + n[5]; Scalar F = n[0]*beta2 + n[3]*beta + n[6]; Scalar G = n[1]*beta2 + n[4]*beta + n[7]; - Scalar D = ( 2.*G)/(-F -std::sqrt(pow(F,2.) - 4.*E*G)); - - Scalar temperature = (n[9] + D - std::sqrt(pow(n[9]+D , 2.) - 4.* (n[8] + n[9]*D)) ) * 0.5; + using std::sqrt; + Scalar D = ( 2.*G)/(-F -sqrt(pow(F,2.) - 4.*E*G)); + Scalar temperature = (n[9] + D - sqrt(pow(n[9]+D , 2.) - 4.* (n[8] + n[9]*D)) ) * 0.5; return temperature; } diff --git a/dumux/material/components/lnapl.hh b/dumux/material/components/lnapl.hh index 53eb32238c34f988818fed065d8bf36357d1147a..20000e9b1b2bd1df15f94ee8354f093891896843 100644 --- a/dumux/material/components/lnapl.hh +++ b/dumux/material/components/lnapl.hh @@ -44,11 +44,11 @@ public: /*! * \brief A human readable name for the LNAPL. */ - static const char *name() + static std::string name() { return "LNAPL"; } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { return false; } diff --git a/dumux/material/components/mesitylene.hh b/dumux/material/components/mesitylene.hh index 2204685ef50da93a8e631272797b903f33a5e652..965b01e2ea4fb4a654da5b73e09a71b86aae293c 100644 --- a/dumux/material/components/mesitylene.hh +++ b/dumux/material/components/mesitylene.hh @@ -48,7 +48,7 @@ public: /*! * \brief A human readable name for the mesitylene */ - static const char *name() + static std::string name() { return "mesitylene"; } /*! @@ -106,7 +106,8 @@ public: const Scalar T = temperature - 273.15; - return 100 * 1.334 * std::pow(Scalar(10.0), Scalar(A - (B / (T + C)))); + using std::pow; + return 100 * 1.334 * pow(Scalar(10.0), Scalar(A - (B / (T + C)))); } @@ -131,8 +132,8 @@ public: // Enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input and is // fit over a certain temperature range. This suggests choosing an interval of integration being in the actual fit range. // I.e. choosing T=273.15K as reference point for liquid enthalpy. - - const Scalar sqrt1over3 = std::sqrt(1./3.); + using std::sqrt; + const Scalar sqrt1over3 = sqrt(1./3.); // evaluation points according to Gauss-Legendre integration const Scalar TEval1 = 0.5*(temperature-273.15)* sqrt1over3 + 0.5*(273.15+temperature); // evaluation points according to Gauss-Legendre integration @@ -154,21 +155,25 @@ public: static Scalar heatVap(Scalar temperature, const Scalar pressure) { - temperature = std::min(temperature, criticalTemperature()); // regularization - temperature = std::max(temperature, 0.0); // regularization + using std::min; + using std::max; + temperature = min(temperature, criticalTemperature()); // regularization + temperature = max(temperature, 0.0); // regularization constexpr Scalar T_crit = criticalTemperature(); constexpr Scalar Tr1 = boilingTemperature()/criticalTemperature(); constexpr Scalar p_crit = criticalPressure(); // Chen method, eq. 7-11.4 (at boiling) - const Scalar DH_v_boil = Consts::R * T_crit * Tr1 * (3.978 * Tr1 - 3.958 + 1.555*std::log(p_crit * 1e-5 /*Pa->bar*/ ) ) + using std::log; + const Scalar DH_v_boil = Consts::R * T_crit * Tr1 * (3.978 * Tr1 - 3.958 + 1.555*log(p_crit * 1e-5 /*Pa->bar*/ ) ) / (1.07 - Tr1); /* [J/mol] */ /* Variation with temp according to Watson relation eq 7-12.1*/ + using std::pow; const Scalar Tr2 = temperature/criticalTemperature(); const Scalar n = 0.375; - const Scalar DH_vap = DH_v_boil * std::pow(((1.0 - Tr2)/(1.0 - Tr1)), n); + const Scalar DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n); return (DH_vap/molarMass()); // we need [J/kg] } @@ -213,19 +218,19 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { return false; } @@ -239,18 +244,23 @@ public: */ static Scalar gasViscosity(Scalar temperature, Scalar pressure, bool regularize=true) { - temperature = std::min(temperature, 500.0); // regularization - temperature = std::max(temperature, 250.0); + using std::min; + using std::max; + temperature = min(temperature, 500.0); // regularization + temperature = max(temperature, 250.0); // reduced temperature Scalar Tr = temperature/criticalTemperature(); Scalar Fp0 = 1.0; Scalar xi = 0.00474; + + using std::pow; + using std::exp; Scalar eta_xi = - Fp0*(0.807*std::pow(Tr,0.618) - - 0.357*std::exp(-0.449*Tr) - + 0.34*std::exp(-4.058*Tr) + Fp0*(0.807*pow(Tr,0.618) + - 0.357*exp(-0.449*Tr) + + 0.34*exp(-4.058*Tr) + 0.018); return eta_xi/xi/1e7; // [Pa s] @@ -264,13 +274,16 @@ public: */ static Scalar liquidViscosity(Scalar temperature, Scalar pressure) { - temperature = std::min(temperature, 500.0); // regularization - temperature = std::max(temperature, 250.0); + using std::min; + using std::max; + temperature = min(temperature, 500.0); // regularization + temperature = max(temperature, 250.0); const Scalar A = -6.749; const Scalar B = 2010.0; - return std::exp(A + B/temperature)*1e-3; // [Pa s] + using std::exp; + return exp(A + B/temperature)*1e-3; // [Pa s] } /*! @@ -341,12 +354,16 @@ protected: */ static Scalar molarLiquidDensity_(Scalar temperature) { - temperature = std::min(temperature, 500.0); // regularization - temperature = std::max(temperature, 250.0); + using std::min; + using std::max; + temperature = min(temperature, 500.0); // regularization + temperature = max(temperature, 250.0); const Scalar Z_RA = 0.2556; // from equation - const Scalar expo = 1.0 + std::pow(1.0 - temperature/criticalTemperature(), 2.0/7.0); - Scalar V = Consts::R*criticalTemperature()/criticalPressure()*std::pow(Z_RA, expo); // liquid molar volume [cm^3/mol] + + using std::pow; + const Scalar expo = 1.0 + pow(1.0 - temperature/criticalTemperature(), 2.0/7.0); + Scalar V = Consts::R*criticalTemperature()/criticalPressure()*pow(Z_RA, expo); // liquid molar volume [cm^3/mol] return 1.0/V; // molar density [mol/m^3] } diff --git a/dumux/material/components/n2.hh b/dumux/material/components/n2.hh index 9df5eddd4677ffefa66923bf1915dab749df9912..b9da95dce787a420e9d3b34b884578875c3011e1 100644 --- a/dumux/material/components/n2.hh +++ b/dumux/material/components/n2.hh @@ -51,7 +51,7 @@ public: /*! * \brief A human readable name for nitrogen. */ - static const char *name() + static std::string name() { return "N2"; } /*! @@ -103,15 +103,18 @@ public: // account // note: this is the ancillary equation given on page 1368 + using std::sqrt; Scalar sigma = Scalar(1.0) - T/criticalTemperature(); - Scalar sqrtSigma = std::sqrt(sigma); + Scalar sqrtSigma = sqrt(sigma); const Scalar N1 = -6.12445284; const Scalar N2 = 1.26327220; const Scalar N3 = -0.765910082; const Scalar N4 = -1.77570564; + + using std::exp; return criticalPressure() * - std::exp(criticalTemperature()/T* + exp(criticalTemperature()/T* (sigma*(N1 + sqrtSigma*N2 + sigma*(sqrtSigma*N3 + @@ -131,13 +134,13 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } @@ -257,17 +260,20 @@ public: const Scalar M = molarMass() * 1e3; // molar mas [g/mol] const Scalar dipole = 0.0; // dipole moment [debye] - Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc); + using std::sqrt; + Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); mu_r4 *= mu_r4; mu_r4 *= mu_r4; + using std::pow; + using std::exp; Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; Scalar Tstar = 1.2593 * temperature/Tc; Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785*Fc*std::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v); + 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(- 0.77320*Tstar) + + 2.16178*exp(- 2.43787*Tstar); + Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); // convertion from micro poise to Pa s return mu/1e6 / 10; diff --git a/dumux/material/components/nacl.hh b/dumux/material/components/nacl.hh index 3d3d271f596690dc7154b91e93f484ad1f790f71..6f6acdfa468d45f7b3ccb96bc9285c4b6b259729 100644 --- a/dumux/material/components/nacl.hh +++ b/dumux/material/components/nacl.hh @@ -45,7 +45,7 @@ public: /*! * \brief A human readable name for the NaCl. */ - static const char *name() + static std::string name() { return "NaCl"; } diff --git a/dumux/material/components/o2.hh b/dumux/material/components/o2.hh index 0511cceb926a3b8de898f5b0c8cbbbd3a59bb85f..0ecb4a4daa239c6611d6ac40462234e71804a05d 100644 --- a/dumux/material/components/o2.hh +++ b/dumux/material/components/o2.hh @@ -51,7 +51,7 @@ public: /*! * \brief A human readable name for the \f$O_2\f$. */ - static const char *name() + static std::string name() { return "O2"; } /*! @@ -112,16 +112,13 @@ public: const Scalar D = 3.454481; const Scalar epsilon = 1.514; - return - triplePressure()* - std::exp(X*(A + - X*(B + C*X) + - D*std::pow(1 - X, - epsilon))); + using std::exp; + using std::pow; + return triplePressure()*exp(X*(A + X*(B + C*X) + D*pow(1 - X, epsilon))); } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static constexpr bool gasIsCompressible() { return true; } @@ -141,7 +138,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static constexpr bool gasIsIdeal() { return true; } @@ -181,7 +178,6 @@ public: // calculate: \int_0^T c_p dT return 1/molarMass()* // conversion from [J/mol] to [J/kg] - T*(cpVapA + T* (cpVapB/2 + T* (cpVapC/3 + T* @@ -206,17 +202,21 @@ public: const Scalar M = molarMass() * 1e3; // molar mas [g/mol] const Scalar dipole = 0.0; // dipole moment [debye] - Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc); + using std::sqrt; + Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); mu_r4 *= mu_r4; mu_r4 *= mu_r4; Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; Scalar Tstar = 1.2593 * temperature/Tc; + + using std::pow; + using std::exp; Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785*Fc*std::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v); + 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(- 0.77320*Tstar) + + 2.16178*exp(- 2.43787*Tstar); + Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); // convertion from micro poise to Pa s return mu/1e6 / 10; diff --git a/dumux/material/components/simpleco2.hh b/dumux/material/components/simpleco2.hh index e5af02cdd796c594e936172a22fb12b80a71a01c..51d8e99372e24da3bbdb3ffdfff46c7aa91e94e2 100644 --- a/dumux/material/components/simpleco2.hh +++ b/dumux/material/components/simpleco2.hh @@ -50,7 +50,7 @@ public: /*! * \brief A human readable name for the \f$CO_2\f$. */ - static const char *name() + static std::string name() { return "CO2"; } /*! @@ -126,7 +126,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } @@ -144,7 +144,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } @@ -179,17 +179,20 @@ public: const Scalar M = molarMass() * 1e3; // molar mas [g/mol] const Scalar dipole = 0.0; // dipole moment [debye] - Scalar mu_r4 = 131.3 * dipole / std::sqrt(Vc * Tc); + using std::sqrt; + Scalar mu_r4 = 131.3 * dipole / sqrt(Vc * Tc); mu_r4 *= mu_r4; mu_r4 *= mu_r4; + using std::pow; + using std::exp; Scalar Fc = 1 - 0.2756*omega + 0.059035*mu_r4; Scalar Tstar = 1.2593 * temperature/Tc; Scalar Omega_v = - 1.16145*std::pow(Tstar, -0.14874) + - 0.52487*std::exp(- 0.77320*Tstar) + - 2.16178*std::exp(- 2.43787*Tstar); - Scalar mu = 40.785*Fc*std::sqrt(M*temperature)/(std::pow(Vc, 2./3)*Omega_v); + 1.16145*pow(Tstar, -0.14874) + + 0.52487*exp(- 0.77320*Tstar) + + 2.16178*exp(- 2.43787*Tstar); + Scalar mu = 40.785*Fc*sqrt(M*temperature)/(pow(Vc, 2./3)*Omega_v); // convertion from micro poise to Pa s return mu/1e6 / 10; diff --git a/dumux/material/components/simpleh2o.hh b/dumux/material/components/simpleh2o.hh index 7316c85d2b0b3aac8081166a296093531e0a8a64..787b212313f04798ff72538f9a8092f007ad0157 100644 --- a/dumux/material/components/simpleh2o.hh +++ b/dumux/material/components/simpleh2o.hh @@ -52,7 +52,7 @@ public: /*! * \brief A human readable name for the water. */ - static const char *name() + static std::string name() { return "H2O"; } /*! @@ -117,7 +117,8 @@ public: Scalar B = (n[2]*sigma + n[3])*sigma + n[4]; Scalar C = (n[5]*sigma + n[6])*sigma + n[7]; - Scalar tmp = Scalar(2.0)*C/(std::sqrt(B*B - Scalar(4.0)*A*C) - B); + using std::sqrt; + Scalar tmp = Scalar(2.0)*C/(sqrt(B*B - Scalar(4.0)*A*C) - B); tmp *= tmp; tmp *= tmp; @@ -181,13 +182,13 @@ public: pressure/liquidDensity(temperature, pressure); } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return true; } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { return false; } @@ -205,7 +206,7 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return true; } diff --git a/dumux/material/components/tabulatedcomponent.hh b/dumux/material/components/tabulatedcomponent.hh index 8be50efb14dab5b425b319992b73bc7eb2a82140..3abe60942b73252c28dcd8b3be98da6369db4e0c 100644 --- a/dumux/material/components/tabulatedcomponent.hh +++ b/dumux/material/components/tabulatedcomponent.hh @@ -228,7 +228,7 @@ public: /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { return RawComponent::name(); } /*! @@ -269,8 +269,9 @@ public: */ static Scalar vaporPressure(Scalar T) { + using std::isnan; Scalar result = interpolateT_(vaporPressure_, T); - if (std::isnan(result)) { + if (isnan(result)) { return RawComponent::vaporPressure(T); } return result; @@ -299,7 +300,8 @@ public: Scalar result = interpolateGasTP_(gasEnthalpy_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasEnthalpy", temperature, pressure); return RawComponent::gasEnthalpy(temperature, pressure); } @@ -317,7 +319,8 @@ public: Scalar result = interpolateLiquidTP_(liquidEnthalpy_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidEnthalpy", temperature, pressure); return RawComponent::liquidEnthalpy(temperature, pressure); } @@ -335,7 +338,8 @@ public: Scalar result = interpolateGasTP_(gasHeatCapacity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasHeatCapacity", temperature, pressure); return RawComponent::gasHeatCapacity(temperature, pressure); } @@ -353,7 +357,8 @@ public: Scalar result = interpolateLiquidTP_(liquidHeatCapacity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidHeatCapacity", temperature, pressure); return RawComponent::liquidHeatCapacity(temperature, pressure); } @@ -397,7 +402,8 @@ public: Scalar result = interpolateGasTRho_(gasPressure_, temperature, density); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasPressure", temperature, density); return RawComponent::gasPressure(temperature, density); @@ -416,7 +422,8 @@ public: Scalar result = interpolateLiquidTRho_(liquidPressure_, temperature, density); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidPressure", temperature, density); return RawComponent::liquidPressure(temperature, density); @@ -425,19 +432,19 @@ public: } /*! - * \brief Returns true iff the gas phase is assumed to be compressible + * \brief Returns true if the gas phase is assumed to be compressible */ static bool gasIsCompressible() { return RawComponent::gasIsCompressible(); } /*! - * \brief Returns true iff the liquid phase is assumed to be compressible + * \brief Returns true if the liquid phase is assumed to be compressible */ static bool liquidIsCompressible() { return RawComponent::liquidIsCompressible(); } /*! - * \brief Returns true iff the gas phase is assumed to be ideal + * \brief Returns true if the gas phase is assumed to be ideal */ static bool gasIsIdeal() { return RawComponent::gasIsIdeal(); } @@ -455,7 +462,8 @@ public: Scalar result = interpolateGasTP_(gasDensity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasDensity", temperature, pressure); return RawComponent::gasDensity(temperature, pressure); } @@ -474,7 +482,8 @@ public: Scalar result = interpolateLiquidTP_(liquidDensity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidDensity", temperature, pressure); return RawComponent::liquidDensity(temperature, pressure); } @@ -492,7 +501,8 @@ public: Scalar result = interpolateGasTP_(gasViscosity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasViscosity", temperature, pressure); return RawComponent::gasViscosity(temperature, pressure); } @@ -510,7 +520,8 @@ public: Scalar result = interpolateLiquidTP_(liquidViscosity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidViscosity",temperature, pressure); return RawComponent::liquidViscosity(temperature, pressure); } @@ -528,7 +539,8 @@ public: Scalar result = interpolateGasTP_(gasThermalConductivity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("gasThermalConductivity", temperature, pressure); return RawComponent::gasThermalConductivity(temperature, pressure); } @@ -546,7 +558,8 @@ public: Scalar result = interpolateLiquidTP_(liquidThermalConductivity_, temperature, pressure); - if (std::isnan(result)) { + using std::isnan; + if (isnan(result)) { printWarning_("liquidThermalConductivity", temperature, pressure); return RawComponent::liquidThermalConductivity(temperature, pressure); } @@ -557,7 +570,7 @@ public: private: // prints a warning if the result is not in range or the table has // not been initialized - static void printWarning_(const char *quantity, Scalar arg1, Scalar arg2) + static void printWarning_(std::string quantity, Scalar arg1, Scalar arg2) { #ifndef NDEBUG if (warningPrinted_) @@ -597,15 +610,16 @@ private: if (alphaT < 0 || alphaT >= nTemp_ - 1) { return std::numeric_limits::quiet_NaN(); } - - unsigned iT = std::max(0, std::min(nTemp_ - 2, (int) alphaT)); + using std::min; + using std::max; + unsigned iT = max(0, min(nTemp_ - 2, (int) alphaT)); alphaT -= iT; Scalar alphaP1 = pressLiquidIdx_(p, iT); Scalar alphaP2 = pressLiquidIdx_(p, iT + 1); - unsigned iP1 = std::max(0, std::min(nPress_ - 2, (int) alphaP1)); - unsigned iP2 = std::max(0, std::min(nPress_ - 2, (int) alphaP2)); + unsigned iP1 = max(0, min(nPress_ - 2, (int) alphaP1)); + unsigned iP2 = max(0, min(nPress_ - 2, (int) alphaP2)); alphaP1 -= iP1; alphaP2 -= iP2; @@ -638,13 +652,15 @@ private: return std::numeric_limits::quiet_NaN(); } - unsigned iT = std::max(0, std::min(nTemp_ - 2, (int) alphaT)); + using std::min; + using std::max; + unsigned iT = max(0, min(nTemp_ - 2, (int) alphaT)); alphaT -= iT; Scalar alphaP1 = pressGasIdx_(p, iT); Scalar alphaP2 = pressGasIdx_(p, iT + 1); - unsigned iP1 = std::max(0, std::min(nPress_ - 2, (int) alphaP1)); - unsigned iP2 = std::max(0, std::min(nPress_ - 2, (int) alphaP2)); + unsigned iP1 = max(0, min(nPress_ - 2, (int) alphaP1)); + unsigned iP2 = max(0, min(nPress_ - 2, (int) alphaP2)); alphaP1 -= iP1; alphaP2 -= iP2; @@ -671,14 +687,16 @@ private: // temperature and density static Scalar interpolateGasTRho_(const Scalar *values, Scalar T, Scalar rho) { + using std::min; + using std::max; Scalar alphaT = tempIdx_(T); - unsigned iT = std::max(0, std::min(nTemp_ - 2, (int) alphaT)); + unsigned iT = max(0, min(nTemp_ - 2, (int) alphaT)); alphaT -= iT; Scalar alphaP1 = densityGasIdx_(rho, iT); Scalar alphaP2 = densityGasIdx_(rho, iT + 1); - unsigned iP1 = std::max(0, std::min(nDensity_ - 2, (int) alphaP1)); - unsigned iP2 = std::max(0, std::min(nDensity_ - 2, (int) alphaP2)); + unsigned iP1 = max(0, min(nDensity_ - 2, (int) alphaP1)); + unsigned iP2 = max(0, min(nDensity_ - 2, (int) alphaP2)); alphaP1 -= iP1; alphaP2 -= iP2; @@ -693,14 +711,16 @@ private: // temperature and density static Scalar interpolateLiquidTRho_(const Scalar *values, Scalar T, Scalar rho) { + using std::min; + using std::max; Scalar alphaT = tempIdx_(T); - unsigned iT = std::max(0, std::min(nTemp_ - 2, (int) alphaT)); + unsigned iT = max(0, min(nTemp_ - 2, (int) alphaT)); alphaT -= iT; Scalar alphaP1 = densityLiquidIdx_(rho, iT); Scalar alphaP2 = densityLiquidIdx_(rho, iT + 1); - unsigned iP1 = std::max(0, std::min(nDensity_ - 2, (int) alphaP1)); - unsigned iP2 = std::max(0, std::min(nDensity_ - 2, (int) alphaP2)); + unsigned iP1 = max(0, min(nDensity_ - 2, (int) alphaP1)); + unsigned iP2 = max(0, min(nDensity_ - 2, (int) alphaP2)); alphaP1 -= iP1; alphaP2 -= iP2; @@ -756,40 +776,44 @@ private: // temperature index static Scalar minLiquidPressure_(int tempIdx) { + using std::max; if (!useVaporPressure) return pressMin_; else - return std::max(pressMin_, vaporPressure_[tempIdx] / 1.1); + return max(pressMin_, vaporPressure_[tempIdx] / 1.1); } // returns the maximum tabulized liquid pressure at a given // temperature index static Scalar maxLiquidPressure_(int tempIdx) { + using std::max; if (!useVaporPressure) return pressMax_; else - return std::max(pressMax_, vaporPressure_[tempIdx] * 1.1); + return max(pressMax_, vaporPressure_[tempIdx] * 1.1); } // returns the minumum tabulized gas pressure at a given // temperature index static Scalar minGasPressure_(int tempIdx) { + using std::min; if (!useVaporPressure) return pressMin_; else - return std::min(pressMin_, vaporPressure_[tempIdx] / 1.1 ); + return min(pressMin_, vaporPressure_[tempIdx] / 1.1 ); } // returns the maximum tabulized gas pressure at a given // temperature index static Scalar maxGasPressure_(int tempIdx) { + using std::min; if (!useVaporPressure) return pressMax_; else - return std::min(pressMax_, vaporPressure_[tempIdx] * 1.1); + return min(pressMax_, vaporPressure_[tempIdx] * 1.1); } diff --git a/dumux/material/components/unit.hh b/dumux/material/components/unit.hh index 2007313b5b77cfb558786dbf0d010eb4863aa0f7..844c0c052d5a7c028a9d368b04d3acd923740a81 100644 --- a/dumux/material/components/unit.hh +++ b/dumux/material/components/unit.hh @@ -43,7 +43,7 @@ public: /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { return "Unit"; } /*! diff --git a/dumux/material/components/xylene.hh b/dumux/material/components/xylene.hh index 785685281e92826ef1f65ebfcab16a3445d1d370..dc7ab8711d1b74b83dff32ec299342552c46560e 100644 --- a/dumux/material/components/xylene.hh +++ b/dumux/material/components/xylene.hh @@ -49,7 +49,7 @@ public: /*! * \brief A human readable name for the xylene */ - static const char *name() + static std::string name() { return "xylene"; } /*! @@ -106,7 +106,9 @@ public: const Scalar C = 215.110; Scalar T = temperature - 273.15; - Scalar psat = 1.334*std::pow(10.0, (A - (B/(T + C)))); // in [mbar] + + using std::pow; + Scalar psat = 1.334*pow(10.0, (A - (B/(T + C)))); // in [mbar] psat *= 100.0; // in [Pa] (0.001*1.E5) return psat; @@ -173,8 +175,8 @@ public: // Enthalpy may have arbitrary reference state, but the empirical/fitted heatCapacity function needs Kelvin as input and is // fit over a certain temperature range. This suggests choosing an interval of integration being in the actual fit range. // I.e. choosing T=273.15K as reference point for liquid enthalpy. - - const Scalar sqrt1over3 = std::sqrt(1./3.); + using std::sqrt; + const Scalar sqrt1over3 = sqrt(1./3.); // evaluation points according to Gauss-Legendre integration const Scalar TEval1 = 0.5*(temperature-273.15)* sqrt1over3 + 0.5*(273.15+temperature); // evaluation points according to Gauss-Legendre integration @@ -196,22 +198,26 @@ public: static Scalar heatVap(Scalar temperature, const Scalar pressure) { - temperature = std::min(temperature, criticalTemperature()); // regularization - temperature = std::max(temperature, 0.0); // regularization + using std::min; + using std::max; + temperature = min(temperature, criticalTemperature()); // regularization + temperature = max(temperature, 0.0); // regularization constexpr Scalar T_crit = criticalTemperature(); constexpr Scalar Tr1 = boilingTemperature()/criticalTemperature(); constexpr Scalar p_crit = criticalPressure(); - // Chen method, eq. 7-11.4 (at boiling) - const Scalar DH_v_boil = Consts::R * T_crit * Tr1 - * (3.978 * Tr1 - 3.958 + 1.555*std::log(p_crit * 1e-5 /*Pa->bar*/ ) ) - / (1.07 - Tr1); /* [J/mol] */ + // Chen method, eq. 7-11.4 (at boiling) + using std::log; + const Scalar DH_v_boil = Consts::R * T_crit * Tr1 + * (3.978 * Tr1 - 3.958 + 1.555*log(p_crit * 1e-5 /*Pa->bar*/ ) ) + / (1.07 - Tr1); /* [J/mol] */ /* Variation with temp according to Watson relation eq 7-12.1*/ + using std::pow; const Scalar Tr2 = temperature/criticalTemperature(); const Scalar n = 0.375; - const Scalar DH_vap = DH_v_boil * std::pow(((1.0 - Tr2)/(1.0 - Tr1)), n); + const Scalar DH_vap = DH_v_boil * pow(((1.0 - Tr2)/(1.0 - Tr1)), n); return (DH_vap/molarMass()); // we need [J/kg] } @@ -268,13 +274,16 @@ public: // saturated molar volume according to Lide, CRC Handbook of // Thermophysical and Thermochemical Data, CRC Press, 1994 // valid for 245 < Temp < 600 - temp = std::min(temp, 500.0); // regularization - temp = std::max(temp, 250.0); // regularization + using std::min; + using std::max; + temp = min(temp, 500.0); // regularization + temp = max(temp, 250.0); // regularization + using std::pow; const Scalar A1 = 0.25919; // from table const Scalar A2 = 0.0014569; // from table - const Scalar expo = 1.0 + std::pow((1.0 - temp/criticalTemperature()), (2.0/7.0)); - const Scalar V = A2*std::pow(A1, expo); // liquid molar volume [m^3/mol] + const Scalar expo = 1.0 + pow((1.0 - temp/criticalTemperature()), (2.0/7.0)); + const Scalar V = A2*pow(A1, expo); // liquid molar volume [m^3/mol] return 1.0/V; // molar density [mol/m^3] } @@ -317,15 +326,19 @@ public: */ static Scalar gasViscosity(Scalar temp, Scalar pressure, bool regularize=true) { - temp = std::min(temp, 500.0); // regularization - temp = std::max(temp, 250.0); // regularization - - const Scalar Tr = std::max(temp/criticalTemperature(), 1e-10); + using std::min; + using std::max; + temp = min(temp, 500.0); // regularization + temp = max(temp, 250.0); // regularization + + using std::pow; + using std::exp; + const Scalar Tr = max(temp/criticalTemperature(), 1e-10); const Scalar Fp0 = 1.0; const Scalar xi = 0.004623; - const Scalar eta_xi = Fp0*(0.807*std::pow(Tr, 0.618) - - 0.357*std::exp(-0.449*Tr) - + 0.34*std::exp(-4.058*Tr) + const Scalar eta_xi = Fp0*(0.807*pow(Tr, 0.618) + - 0.357*exp(-0.449*Tr) + + 0.34*exp(-4.058*Tr) + 0.018); Scalar r = eta_xi/xi; // [1e-6 P] r /= 1.0e7; // [Pa s] @@ -341,15 +354,18 @@ public: */ static Scalar liquidViscosity(Scalar temp, Scalar pressure) { - temp = std::min(temp, 500.0); // regularization - temp = std::max(temp, 250.0); // regularization + using std::min; + using std::max; + temp = min(temp, 500.0); // regularization + temp = max(temp, 250.0); // regularization const Scalar A = -3.82; const Scalar B = 1027.0; const Scalar C = -6.38e-4; const Scalar D = 4.52e-7; - Scalar r = std::exp(A + B/temp + C*temp + D*temp*temp); // in [cP] + using std::exp; + Scalar r = exp(A + B/temp + C*temp + D*temp*temp); // in [cP] r *= 1.0e-3; // in [Pa s] return r; // [Pa s] diff --git a/dumux/material/constraintsolvers/compositionfromfugacities.hh b/dumux/material/constraintsolvers/compositionfromfugacities.hh index fa801fcce0a80bcdc076ca8dd3ebe7fed8bc55dd..286592b992283826e91e55ddc85b5a48c7412094 100644 --- a/dumux/material/constraintsolvers/compositionfromfugacities.hh +++ b/dumux/material/constraintsolvers/compositionfromfugacities.hh @@ -276,11 +276,14 @@ protected: Dune::FieldVector origComp; Scalar relError = 0; Scalar sumDelta = 0; + using std::max; + using std::abs; + using std::min; for (unsigned int i = 0; i < numComponents; ++i) { origComp[i] = fluidState.moleFraction(phaseIdx, i); - relError = std::max(relError, std::abs(x[i])); - sumDelta += std::abs(x[i]); + relError = max(relError, abs(x[i])); + sumDelta += abs(x[i]); } // chop update to at most 20% change in composition @@ -295,16 +298,16 @@ protected: // only allow negative mole fractions if the target fugacity is negative if (targetFug[i] > 0) - newx = std::max(0.0, newx); + newx = max(0.0, newx); // only allow positive mole fractions if the target fugacity is positive else if (targetFug[i] < 0) - newx = std::min(0.0, newx); + newx = min(0.0, newx); // if the target fugacity is zero, the mole fraction must also be zero else newx = 0; fluidState.setMoleFraction(phaseIdx, i, newx); - //sumMoleFrac += std::abs(newx); + //sumMoleFrac += abs(newx); } paramCache.updateComposition(fluidState, phaseIdx); @@ -318,10 +321,11 @@ protected: const ComponentVector &targetFug) { Scalar result = 0.0; + using std::abs; for (int i = 0; i < numComponents; ++i) { // sum of the fugacity defect weighted by the inverse // fugacity coefficient - result += std::abs( + result += abs( (targetFug[i] - params.fugacity(phaseIdx, i)) / params.fugacityCoeff(phaseIdx, i) ); diff --git a/dumux/material/constraintsolvers/compositionfromfugacities2pncmin.hh b/dumux/material/constraintsolvers/compositionfromfugacities2pncmin.hh deleted file mode 100644 index 1d17f538ff432d3ff866ba1ebe6093b8ff6586e6..0000000000000000000000000000000000000000 --- a/dumux/material/constraintsolvers/compositionfromfugacities2pncmin.hh +++ /dev/null @@ -1,147 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see . * - *****************************************************************************/ -/*! - * \file - * - * \brief Determines the fluid composition given the component - * fugacities and an arbitary equation of state. - */ -#ifndef DUMUX_COMPOSITION_FROM_FUGACITIES_2PNCMIN_HH -#define DUMUX_COMPOSITION_FROM_FUGACITIES_2PNCMIN_HH - -#include -#include - -#include -#include - -namespace Dumux { - -/*! - * \ingroup ConstraintSolver - * \brief Calculates the chemical equilibrium from the component - * fugacities in a phase. - */ -template -class compositionFromFugacities2pncmin -{ - enum { - numComponents = FluidSystem::numComponents, - numMajorComponents = FluidSystem::numPhases - }; - - typedef typename FluidSystem::ParameterCache ParameterCache; - - -public: - typedef Dune::FieldVector ComponentVector; - - /*! - * \brief Guess an initial value for the composition of the phase. - * \param fluidState Thermodynamic state of the fluids - * \param paramCache Container for cache parameters - * \param phaseIdx The phase index - * \param phasePresence The presence index of the reference phase - * \param fugVec fugacity vector of the component - */ - template - static void guessInitial(FluidState &fluidState, - ParameterCache ¶mCache, - int phaseIdx, - int phasePresence, - const ComponentVector &fugVec) - { - if (FluidSystem::isIdealMixture(phaseIdx)) - return; - - // Pure component fugacities - for (int i = 0; i < numComponents; ++ i) - { - fluidState.setMoleFraction(phaseIdx,i, 1.0/numComponents); - } - } - - /*! - * \brief Calculates the chemical equilibrium from the component - * fugacities in a phase. This constraint solver is developed for drying scenarios where - * salt component is restricted to liquid phase and still for the sake for equilibrium - * calculation some residual salt must be considered in the gas phase. In such cases for - * existence of gas phase only, in the theoretical liquid phase, we set the mole fraction - * of salt to 1e-10. - * \param fluidState Thermodynamic state of the fluids - * \param paramCache Container for cache parameters - * \param phaseIdx The phase index - * \param targetFug target fugacity - * \param phasePresence Presence of the phase - * - * The phase's fugacities must already be set. - */ - template - static void solve(FluidState &fluidState, - ParameterCache ¶mCache, - int phaseIdx, - int phasePresence, - const ComponentVector &targetFug) - { - // use a much more efficient method in case the phase is an - // ideal mixture - if (FluidSystem::isIdealMixture(phaseIdx)) - { - solveIdealMix_(fluidState, paramCache, phaseIdx, phasePresence, targetFug); - return; - } - else - DUNE_THROW(NumericalProblem, "This constraint solver is not tested for non-ideal mixtures: Please refer computefromfugacities.hh for details" ); - } - -protected: - // update the phase composition in case the phase is an ideal - // mixture, i.e. the component's fugacity coefficients are - // independent of the phase's composition. - template - static void solveIdealMix_(FluidState &fluidState, - ParameterCache ¶mCache, - int phaseIdx, - int phasePresence, - const ComponentVector &fugacities) - { - for (int i = 0; i < numComponents; ++ i) - { - Scalar phi = FluidSystem::fugacityCoefficient(fluidState, - paramCache, - phaseIdx, - i); - Scalar gamma = phi * fluidState.pressure(phaseIdx); - fluidState.setFugacityCoefficient(phaseIdx, i, phi); - fluidState.setMoleFraction(phaseIdx, i, fugacities[i]/gamma); - // Special situation for drying PM and n-phase only situation.set the mole fraction of salt to 1e-10. - if (phaseIdx == 0 && i >= numMajorComponents && phasePresence == 2 /*nPhaseOnly*/) - fluidState.setMoleFraction(phaseIdx, i, 1.0e-10); - } - - paramCache.updatePhase(fluidState, phaseIdx); - - Scalar rho = FluidSystem::density(fluidState, paramCache, phaseIdx); - fluidState.setDensity(phaseIdx, rho); - return; - } -}; -} // end namespace Dumux - -#endif diff --git a/dumux/material/constraintsolvers/computefromreferencephase.hh b/dumux/material/constraintsolvers/computefromreferencephase.hh index f12d4aab941fff8648f6b74326e0a92db46ad236..cd7ce8034645a08f94d603fa8d246215704d4848 100644 --- a/dumux/material/constraintsolvers/computefromreferencephase.hh +++ b/dumux/material/constraintsolvers/computefromreferencephase.hh @@ -149,7 +149,8 @@ public: refPhaseIdx)); // compute the fugacities of all components in the reference phase - for (int compIdx = 0; compIdx < numComponents; ++compIdx) { + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + { fluidState.setFugacityCoefficient(refPhaseIdx, compIdx, FluidSystem::fugacityCoefficient(fluidState, @@ -160,7 +161,8 @@ public: } // compute all quantities for the non-reference phases - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + { if (phaseIdx == refPhaseIdx) continue; // reference phase is already calculated diff --git a/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh b/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh deleted file mode 100644 index 52def91eef9e67298fffb3ad84b9c78f267ad81a..0000000000000000000000000000000000000000 --- a/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh +++ /dev/null @@ -1,178 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see . * - *****************************************************************************/ -/*! - * \file - * - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium - */ -#ifndef DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNC_HH -#define DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNC_HH - -#include - -#include -#include - -#include -#include - -namespace Dumux { - -/*! - * \ingroup ConstraintSolver - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium. It assumes the - * following quantities to be set: - * - * - composition (mole+mass fractions) of the *reference* phase - * - temperature of the *reference* phase - * - saturations of *all* phases - * - pressures of *all* phases - * - * after calling the solve() method the following quantities are - * calculated in addition: - * - * - temperature of *all* phases - * - density, molar density, molar volume of *all* phases - * - composition in mole and mass fractions and molaries of *all* phases - * - mean molar masses of *all* phases - * - fugacity coefficients of *all* components in *all* phases - * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases - * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases - */ -template -class ComputeFromReferencePhase2pNC -{ - enum { numPhases = FluidSystem::numPhases }; - enum { numComponents = FluidSystem::numComponents }; - typedef Dumux::CompositionFromFugacities CompositionFromFugacities; - typedef Dune::FieldVector ComponentVector; - -public: - /*! - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium. It assumes the - * following quantities to be set: - * - * - composition (mole+mass fractions) of the *reference* phase - * - temperature of the *all* phases - * - saturations of *all* phases - * - pressures of *all* phases - * - * after calling the solve() method the following quantities are - * calculated in addition: - * - * - temperature of *all* phases - * - density, molar density, molar volume of *all* phases - * - composition in mole and mass fractions and molaries of *all* phases - * - mean molar masses of *all* phases - * - fugacity coefficients of *all* components in *all* phases - * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases - * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases - * - * \param fluidState Thermodynamic state of the fluids - * \param paramCache Container for cache parameters - * \param refPhaseIdx The phase index of the reference phase - * \param setViscosity Specify whether the dynamic viscosity of - * each phase should also be set. - * \param setEnthalpy Specify whether the specific - * enthalpy/internal energy of each phase - * should also be set. - */ - template - static void solve(FluidState &fluidState, - ParameterCache ¶mCache, - int refPhaseIdx, - bool setViscosity, - bool setEnthalpy) - { - ComponentVector fugVec; - - // compute the density and enthalpy of the - // reference phase - paramCache.updatePhase(fluidState, refPhaseIdx); - fluidState.setDensity(refPhaseIdx, - FluidSystem::density(fluidState, - paramCache, - refPhaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(refPhaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - refPhaseIdx)); - - if (setViscosity) - fluidState.setViscosity(refPhaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - refPhaseIdx)); - - // compute the fugacities of all components in the reference phase - for (int compIdx = 0; compIdx < numComponents; ++compIdx) - { - fluidState.setFugacityCoefficient(refPhaseIdx, - compIdx, - FluidSystem::fugacityCoefficient(fluidState, - paramCache, - refPhaseIdx, - compIdx)); - fugVec[compIdx] = fluidState.fugacity(refPhaseIdx, compIdx); - } - - // compute all quantities for the non-reference phases - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - { - if (phaseIdx == refPhaseIdx) - continue; // reference phase is already calculated - - CompositionFromFugacities::guessInitial(fluidState, paramCache, phaseIdx, fugVec); - CompositionFromFugacities::solve(fluidState, paramCache, phaseIdx, fugVec); - - if (setViscosity) - fluidState.setViscosity(phaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - phaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(phaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - phaseIdx)); - } - } -}; - -} // end namespace Dumux - -#endif diff --git a/dumux/material/constraintsolvers/computefromreferencephase2pncmin.hh b/dumux/material/constraintsolvers/computefromreferencephase2pncmin.hh deleted file mode 100644 index 2164109dbd4a226c381fbb20381717ac64a93c7e..0000000000000000000000000000000000000000 --- a/dumux/material/constraintsolvers/computefromreferencephase2pncmin.hh +++ /dev/null @@ -1,178 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program. If not, see . * - *****************************************************************************/ -/*! - * \file - * - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium - */ -#ifndef DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNCMIN_HH -#define DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNCMIN_HH - -#include - -#include -#include - -#include -#include - -namespace Dumux { - -/*! - * \ingroup ConstraintSolver - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium. It assumes the - * following quantities to be set: - * - * - composition (mole+mass fractions) of the *reference* phase - * - temperature of the *reference* phase - * - saturations of *all* phases - * - pressures of *all* phases - * - * after calling the solve() method the following quantities are - * calculated in addition: - * - * - temperature of *all* phases - * - density, molar density, molar volume of *all* phases - * - composition in mole and mass fractions and molaries of *all* phases - * - mean molar masses of *all* phases - * - fugacity coefficients of *all* components in *all* phases - * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases - * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases - */ -template -class ComputeFromReferencePhase2pNCMin -{ - enum { numPhases = FluidSystem::numPhases }; - enum { numComponents = FluidSystem::numComponents }; - typedef Dumux::compositionFromFugacities2pncmin compositionFromFugacities2pncmin; - typedef Dune::FieldVector ComponentVector; - -public: - /*! - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium. It assumes the - * following quantities to be set: - * - * - composition (mole+mass fractions) of the *reference* phase - * - temperature of the *all* phases - * - saturations of *all* phases - * - pressures of *all* phases - * - * after calling the solve() method the following quantities are - * calculated in addition: - * - * - temperature of *all* phases - * - density, molar density, molar volume of *all* phases - * - composition in mole and mass fractions and molaries of *all* phases - * - mean molar masses of *all* phases - * - fugacity coefficients of *all* components in *all* phases - * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases - * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases - * - * \param fluidState Thermodynamic state of the fluids - * \param paramCache Container for cache parameters - * \param refPhaseIdx The phase index of the reference phase - * \param phasePresence The presence index of the reference phase - * \param setViscosity Specify whether the dynamic viscosity of - * each phase should also be set. - * \param setEnthalpy Specify whether the specific - * enthalpy/internal energy of each phase - * should also be set. - */ - template - static void solve(FluidState &fluidState, - ParameterCache ¶mCache, - int refPhaseIdx, - int phasePresence, - bool setViscosity, - bool setEnthalpy) - { - ComponentVector fugVec; - - // compute the density and enthalpy of the - // reference phase - paramCache.updatePhase(fluidState, refPhaseIdx); - fluidState.setDensity(refPhaseIdx, - FluidSystem::density(fluidState, - paramCache, - refPhaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(refPhaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - refPhaseIdx)); - - if (setViscosity) - fluidState.setViscosity(refPhaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - refPhaseIdx)); - - // compute the fugacities of all components in the reference phase - for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - fluidState.setFugacityCoefficient(refPhaseIdx, - compIdx, - FluidSystem::fugacityCoefficient(fluidState, - paramCache, - refPhaseIdx, - compIdx)); - fugVec[compIdx] = fluidState.fugacity(refPhaseIdx, compIdx); - } - - // compute all quantities for the non-reference phases - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - if (phaseIdx == refPhaseIdx) - continue; // reference phase is already calculated - - compositionFromFugacities2pncmin::guessInitial(fluidState, paramCache, phaseIdx, phasePresence,fugVec); - compositionFromFugacities2pncmin::solve(fluidState, paramCache, phaseIdx, phasePresence, fugVec); - - if (setViscosity) - fluidState.setViscosity(phaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - phaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(phaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - phaseIdx)); - } - } -}; - -} // end namespace Dumux - -#endif diff --git a/dumux/material/constraintsolvers/immiscibleflash.hh b/dumux/material/constraintsolvers/immiscibleflash.hh index a5d234a8c78eabd0acfe158ab3eaa35c8e18cdd2..dd257a72ceea7c540f669af0c00fd25ed2ba3b95 100644 --- a/dumux/material/constraintsolvers/immiscibleflash.hh +++ b/dumux/material/constraintsolvers/immiscibleflash.hh @@ -335,18 +335,20 @@ protected: for (int pvIdx = 0; pvIdx < numEq; ++ pvIdx) { Scalar tmp = getQuantity_(fluidState, pvIdx); Scalar delta = deltaX[pvIdx]; - - relError = std::max(relError, std::abs(delta)*quantityWeight_(fluidState, pvIdx)); + using std::max; + using std::abs; + using std::min; + relError = max(relError, abs(delta)*quantityWeight_(fluidState, pvIdx)); if (isSaturationIdx_(pvIdx)) { // dampen to at most 20% change in saturation per // iteration - delta = std::min(0.2, std::max(-0.2, delta)); + delta = min(0.2, max(-0.2, delta)); } else if (isPressureIdx_(pvIdx)) { // dampen to at most 30% change in pressure per // iteration - delta = std::min(0.30*fluidState.pressure(0), std::max(-0.30*fluidState.pressure(0), delta)); + delta = min(0.30*fluidState.pressure(0), max(-0.30*fluidState.pressure(0), delta)); } setQuantityRaw_(fluidState, pvIdx, tmp - delta); @@ -501,7 +503,8 @@ protected: // make sure that the first M-1 saturations does not get // negative - value = std::max(0.0, value); + using std::max; + value = max(0.0, value); fs.setSaturation(phaseIdx, value); } } diff --git a/dumux/material/constraintsolvers/miscible2pnccomposition.hh b/dumux/material/constraintsolvers/miscible2pnccomposition.hh index e281c2f28977124ce9ae12c729f068c523b4747c..167a47b8fdcb131612a30f28764d9d888028be20 100644 --- a/dumux/material/constraintsolvers/miscible2pnccomposition.hh +++ b/dumux/material/constraintsolvers/miscible2pnccomposition.hh @@ -23,8 +23,8 @@ * N-component fluid system assuming that all N phases are * present */ -#ifndef DUMUX_MISCIBLE_MULTIPHASE_COMPOSITION_HH -#define DUMUX_MISCIBLE_MULTIPHASE_COMPOSITION_HH +#ifndef DUMUX_MISCIBLE_TWOPNC_COMPOSITION_HH +#define DUMUX_MISCIBLE_TWOPNC_COMPOSITION_HH #include #include diff --git a/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh b/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh index 5821a9610ab0199c6b72bf27bced5703a40ea17e..28bd6ca3fadd9f1d75629607e94de752e0f9e045 100644 --- a/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh +++ b/dumux/material/constraintsolvers/misciblemultiphasecomposition.hh @@ -57,7 +57,7 @@ namespace Dumux { * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases * - if the setEnthalpy parameter is true, also specific enthalpies of *all* phases */ -template +template class MiscibleMultiPhaseComposition { static constexpr int numPhases = FluidSystem::numPhases; @@ -72,6 +72,14 @@ public: /*! * \brief @copybrief Dumux::MiscibleMultiPhaseComposition * + * This function additionally considers a lowering of the saturation vapor pressure + * of the wetting phase by the Kelvin equation: + * \f[ + * p^\textrm{w}_\textrm{sat,Kelvin} + * = p^\textrm{w}_\textrm{sat} + * \exp \left( -\frac{p_\textrm{c}}{\varrho_\textrm{w} R_\textrm{w} T} \right) + * \f] + * * \param fluidState A container with the current (physical) state of the fluid * \param paramCache A container for iterative calculation of fluid composition * \param setViscosity Should the viscosity be set in the fluidstate? @@ -128,22 +136,43 @@ public: // assemble the equations expressing the fact that the // fugacities of each component are equal in all phases - for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - Scalar entryCol1 = - fluidState.fugacityCoefficient(/*phaseIdx=*/0, compIdx) - * fluidState.pressure(/*phaseIdx=*/0); + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + { int col1Idx = compIdx; - - for (int phaseIdx = 1; phaseIdx < numPhases; ++phaseIdx) { - int rowIdx = (phaseIdx - 1)*numComponents + compIdx; - int col2Idx = phaseIdx*numComponents + compIdx; - - Scalar entryCol2 = - fluidState.fugacityCoefficient(phaseIdx, compIdx) - * fluidState.pressure(phaseIdx); - - M[rowIdx][col1Idx] = entryCol1; - M[rowIdx][col2Idx] = -entryCol2; + Scalar entryPhase0 = 0.0; + for (unsigned int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + { + Scalar entry = fluidState.fugacityCoefficient(phaseIdx, compIdx) + * fluidState.pressure(phaseIdx); + + // modify the saturation vapor pressure of the wetting component by the Kelvin equation + if (compIdx == FluidSystem::wCompIdx + && phaseIdx == FluidSystem::wPhaseIdx + && useKelvinEquation) + { + // a new fluidState is needed, because mole fractions are unknown + FluidState purePhaseFluidState; + // assign all phase pressures, needed for capillary pressure + for (unsigned int idx = 0; idx < numPhases; ++idx) + { + purePhaseFluidState.setPressure(idx, fluidState.pressure(idx)); + } + purePhaseFluidState.setTemperature(fluidState.temperature()); + purePhaseFluidState.setMoleFraction(phaseIdx, compIdx, 1.0); + entry = FluidSystem::kelvinVaporPressure(purePhaseFluidState, phaseIdx, compIdx); + } + + if (phaseIdx == 0) + { + entryPhase0 = entry; + } + else + { + int rowIdx = (phaseIdx - 1)*numComponents + compIdx; + int col2Idx = phaseIdx*numComponents + compIdx; + M[rowIdx][col1Idx] = entryPhase0; + M[rowIdx][col2Idx] = -entry; + } } } diff --git a/dumux/material/constraintsolvers/ncpflash.hh b/dumux/material/constraintsolvers/ncpflash.hh index 8f9b7a4499b2670a605f7d0da6667e7ef0476ba1..e32fc6d9b5b82895c2dc3564d207d7078117a484 100644 --- a/dumux/material/constraintsolvers/ncpflash.hh +++ b/dumux/material/constraintsolvers/ncpflash.hh @@ -416,23 +416,25 @@ protected: for (int pvIdx = 0; pvIdx < numEq; ++ pvIdx) { Scalar tmp = getQuantity_(fluidState, pvIdx); Scalar delta = deltaX[pvIdx]; - - relError = std::max(relError, std::abs(delta)*quantityWeight_(fluidState, pvIdx)); + using std::max; + using std::abs; + using std::min; + relError = max(relError, abs(delta)*quantityWeight_(fluidState, pvIdx)); if (isSaturationIdx_(pvIdx)) { // dampen to at most 20% change in saturation per // iteration - delta = std::min(0.2, std::max(-0.2, delta)); + delta = min(0.2, max(-0.2, delta)); } else if (isMoleFracIdx_(pvIdx)) { // dampen to at most 15% change in mole fraction per // iteration - delta = std::min(0.15, std::max(-0.15, delta)); + delta = min(0.15, max(-0.15, delta)); } else if (isPressureIdx_(pvIdx)) { // dampen to at most 15% change in pressure per // iteration - delta = std::min(0.15*fluidState.pressure(0), std::max(-0.15*fluidState.pressure(0), delta)); + delta = min(0.15*fluidState.pressure(0), max(-0.15*fluidState.pressure(0), delta)); } setQuantityRaw_(fluidState, pvIdx, tmp - delta); diff --git a/dumux/material/eos/pengrobinson.hh b/dumux/material/eos/pengrobinson.hh index e0cb23a160b96de51b7b88d681606cde4c742750..8568d144303fca221d799ed0c5b2a3c300979742 100644 --- a/dumux/material/eos/pengrobinson.hh +++ b/dumux/material/eos/pengrobinson.hh @@ -124,8 +124,8 @@ public: Scalar delta = f/df_dp; pVap = pVap - delta; - - if (std::abs(delta/pVap) < 1e-10) + using std::abs; + if (abs(delta/pVap) < 1e-10) break; } @@ -197,14 +197,16 @@ public: else { // find the extrema (if they are present) Scalar Vmin, Vmax, pmin, pmax; + using std::min; + using std::max; if (findExtrema_(Vmin, Vmax, pmin, pmax, a, b, T)) { if (isGasPhase) - Vm = std::max(Vmax, VmCubic); + Vm = max(Vmax, VmCubic); else - Vm = std::min(Vmin, VmCubic); + Vm = min(Vmin, VmCubic); } else Vm = VmCubic; @@ -212,7 +214,8 @@ public: } Valgrind::CheckDefined(Vm); - assert(std::isfinite(Vm) && Vm > 0); + using std::isfinite; + assert(isfinite(Vm) && Vm > 0); return Vm; } @@ -236,14 +239,16 @@ public: Scalar RT = Constants::R*T; Scalar Z = p*Vm/RT; Scalar Bstar = p*params.b() / RT; - + using std::sqrt; Scalar tmp = - (Vm + params.b()*(1 + std::sqrt(2))) / - (Vm + params.b()*(1 - std::sqrt(2))); - Scalar expo = - params.a()/(RT * 2 * params.b() * std::sqrt(2)); + (Vm + params.b()*(1 + sqrt(2))) / + (Vm + params.b()*(1 - sqrt(2))); + Scalar expo = - params.a()/(RT * 2 * params.b() * sqrt(2)); + using std::exp; + using std::pow; Scalar fugCoeff = - std::exp(Z - 1) / (Z - Bstar) * - std::pow(tmp, expo); + exp(Z - 1) / (Z - Bstar) * + pow(tmp, expo); return fugCoeff; } @@ -272,10 +277,12 @@ protected: { Scalar Vcrit = criticalMolarVolume_(params.a(phaseIdx), params.b(phaseIdx)); + using std::max; + using std::min; if (isGasPhase) - Vm = std::max(Vm, Vcrit); + Vm = max(Vm, Vcrit); else - Vm = std::min(Vm, Vcrit); + Vm = min(Vm, Vcrit); } static void findCriticalPoint_(Scalar &Tcrit, @@ -385,11 +392,12 @@ protected: // above the covolume Scalar V = b*1.1; Scalar delta = 1.0; - for (int i = 0; std::abs(delta) > 1e-9; ++i) { + using std::abs; + for (int i = 0; abs(delta) > 1e-9; ++i) { Scalar f = a5 + V*(a4 + V*(a3 + V*(a2 + V*a1))); Scalar fPrime = a4 + V*(2*a3 + V*(3*a2 + V*4*a1)); - if (std::abs(fPrime) < 1e-20) { + if (abs(fPrime) < 1e-20) { // give up if the derivative is zero Vmin = 0; Vmax = 0; @@ -454,12 +462,13 @@ protected: Scalar Tr = T / Component::criticalTemperature(); Scalar tau = 1 - Tr; Scalar omega = Component::acentricFactor(); - - Scalar f0 = (tau*(-5.97616 + std::sqrt(tau)*(1.29874 - tau*0.60394)) - 1.06841*std::pow(tau, 5))/Tr; - Scalar f1 = (tau*(-5.03365 + std::sqrt(tau)*(1.11505 - tau*5.41217)) - 7.46628*std::pow(tau, 5))/Tr; - Scalar f2 = (tau*(-0.64771 + std::sqrt(tau)*(2.41539 - tau*4.26979)) + 3.25259*std::pow(tau, 5))/Tr; - - return Component::criticalPressure()*std::exp(f0 + omega * (f1 + omega*f2)); + using std::sqrt; + using std::pow; + Scalar f0 = (tau*(-5.97616 + sqrt(tau)*(1.29874 - tau*0.60394)) - 1.06841*pow(tau, 5))/Tr; + Scalar f1 = (tau*(-5.03365 + sqrt(tau)*(1.11505 - tau*5.41217)) - 7.46628*pow(tau, 5))/Tr; + Scalar f2 = (tau*(-0.64771 + sqrt(tau)*(2.41539 - tau*4.26979)) + 3.25259*pow(tau, 5))/Tr; + using std::exp; + return Component::criticalPressure()*exp(f0 + omega * (f1 + omega*f2)); } /*! diff --git a/dumux/material/eos/pengrobinsonmixture.hh b/dumux/material/eos/pengrobinsonmixture.hh index 51170591bcfb5b3c6f12e1123a6c39b38a14255b..73c2c5fd35501faf615cb6b156b73e832198023e 100644 --- a/dumux/material/eos/pengrobinsonmixture.hh +++ b/dumux/material/eos/pengrobinsonmixture.hh @@ -116,25 +116,31 @@ public: Scalar sumMoleFractions = 0.0; for (int compJIdx = 0; compJIdx < numComponents; ++compJIdx) sumMoleFractions += fs.moleFraction(phaseIdx, compJIdx); - Scalar deltai = 2*std::sqrt(params.aPure(phaseIdx, compIdx))/params.a(phaseIdx); + + using std::sqrt; + Scalar deltai = 2*sqrt(params.aPure(phaseIdx, compIdx))/params.a(phaseIdx); Scalar tmp = 0; for (int compJIdx = 0; compJIdx < numComponents; ++compJIdx) { tmp += fs.moleFraction(phaseIdx, compJIdx) / sumMoleFractions - * std::sqrt(params.aPure(phaseIdx, compJIdx)) + * sqrt(params.aPure(phaseIdx, compJIdx)) * (1.0 - StaticParameters::interactionCoefficient(compIdx, compJIdx)); } deltai *= tmp; Scalar base = - (2*Z + Bstar*(u + std::sqrt(u*u - 4*w))) / - (2*Z + Bstar*(u - std::sqrt(u*u - 4*w))); - Scalar expo = Astar/(Bstar*std::sqrt(u*u - 4*w))*(bi_b - deltai); - + (2*Z + Bstar*(u + sqrt(u*u - 4*w))) / + (2*Z + Bstar*(u - sqrt(u*u - 4*w))); + Scalar expo = Astar/(Bstar*sqrt(u*u - 4*w))*(bi_b - deltai); + + using std::exp; + using std::max; + using std::min; + using std::pow; Scalar fugCoeff = - std::exp(bi_b*(Z - 1))/std::max(1e-9, Z - Bstar) * - std::pow(base, expo); + exp(bi_b*(Z - 1))/max(1e-9, Z - Bstar) * + pow(base, expo); //////// // limit the fugacity coefficient to a reasonable range: @@ -142,14 +148,16 @@ public: // on one side, we want the mole fraction to be at // least 10^-3 if the fugacity is at the current pressure // - fugCoeff = std::min(1e10, fugCoeff); + + fugCoeff = min(1e10, fugCoeff); // // on the other hand, if the mole fraction of the component is 100%, we want the // fugacity to be at least 10^-3 Pa // - fugCoeff = std::max(1e-10, fugCoeff); + fugCoeff = max(1e-10, fugCoeff); /////////// - if (!std::isfinite(fugCoeff)) { + using std::isfinite; + if (!isfinite(fugCoeff)) { std::cout << "Non finite phi: " << fugCoeff << "\n"; } diff --git a/dumux/material/eos/pengrobinsonparamsmixture.hh b/dumux/material/eos/pengrobinsonparamsmixture.hh index db585546a2f7193a6e487146b979a01ae3d6a384..618eb13452537764fd15ce80dcea41ef6fad8898 100644 --- a/dumux/material/eos/pengrobinsonparamsmixture.hh +++ b/dumux/material/eos/pengrobinsonparamsmixture.hh @@ -113,13 +113,15 @@ public: Valgrind::CheckDefined(f_omega); - Scalar tmp = 1 + f_omega*(1 - std::sqrt(Tr)); + using std::sqrt; + Scalar tmp = 1 + f_omega*(1 - sqrt(Tr)); tmp = tmp*tmp; Scalar a = 0.4572355*RTc*RTc/pc * tmp; Scalar b = 0.0777961 * RTc / pc; - assert(std::isfinite(a)); - assert(std::isfinite(b)); + using std::isfinite; + assert(isfinite(a)); + assert(isfinite(b)); this->pureParams_[i].setA(a); this->pureParams_[i].setB(b); @@ -143,7 +145,8 @@ public: Scalar sumx = 0.0; for (int compIdx = 0; compIdx < numComponents; ++compIdx) sumx += fs.moleFraction(phaseIdx, compIdx); - sumx = std::max(1e-10, sumx); + using std::max; + sumx = max(1e-10, sumx); // Calculate the Peng-Robinson parameters of the mixture // @@ -154,7 +157,7 @@ public: for (int compIIdx = 0; compIIdx < numComponents; ++compIIdx) { Scalar xi = fs.moleFraction(phaseIdx, compIIdx) / sumx; Valgrind::CheckDefined(xi); - + using::std::isfinite; for (int compJIdx = 0; compJIdx < numComponents; ++compJIdx) { Scalar xj = fs.moleFraction(phaseIdx, compJIdx) / sumx; Valgrind::CheckDefined(xj); @@ -162,12 +165,12 @@ public: // mixing rule from Reid, page 82 a += xi * xj * aCache_[compIIdx][compJIdx]; - assert(std::isfinite(a)); + assert(isfinite(a)); } // mixing rule from Reid, page 82 b += xi * this->pureParams_[compIIdx].b(); - assert(std::isfinite(b)); + assert(isfinite(b)); } this->setA(a); @@ -232,9 +235,9 @@ private: for (int compJIdx = 0; compJIdx < numComponents; ++ compJIdx) { // interaction coefficient as given in SPE5 Scalar Psi = FluidSystem::interactionCoefficient(compIIdx, compJIdx); - + using std::sqrt; aCache_[compIIdx][compJIdx] = - std::sqrt(this->pureParams_[compIIdx].a() + sqrt(this->pureParams_[compIIdx].a() * this->pureParams_[compJIdx].a()) * (1 - Psi); } diff --git a/dumux/material/fluidmatrixinteractions/2p/brookscorey.hh b/dumux/material/fluidmatrixinteractions/2p/brookscorey.hh index e9c1b0a4e432a2e782d93e5f1ab46a250bf852d8..0654f08b0b6e377665b6fbd00abf3196e89d8eb2 100644 --- a/dumux/material/fluidmatrixinteractions/2p/brookscorey.hh +++ b/dumux/material/fluidmatrixinteractions/2p/brookscorey.hh @@ -29,6 +29,7 @@ #include "brookscoreyparams.hh" #include +#include namespace Dumux { @@ -66,10 +67,17 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container is constructed accordingly. Afterwards the values are set there, too. * \return Capillary pressure calculated by Brooks & Corey constitutive relation. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar pc(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 return params.pe()*pow(swe, -1.0/params.lambda()); } @@ -86,13 +94,18 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. * \return Effective wetting phase saturation calculated as inverse of BrooksCorey constitutive relation. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar sw(const Params ¶ms, Scalar pc) { - assert(pc >= 0); + using std::pow; + using std::max; - Scalar tmp = pow(pc/params.pe(), -params.lambda()); - return std::min(std::max(tmp, Scalar(0.0)), Scalar(1.0)); + pc = max(pc, 0.0); // the equation below is undefined for negative pcs + + return pow(pc/params.pe(), -params.lambda()); } /*! @@ -110,10 +123,17 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. * \return Partial derivative of \f$\mathrm{[p_c]}\f$ w.r.t. effective saturation according to Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dpc_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 return - params.pe()/params.lambda() * pow(swe, -1/params.lambda() - 1); } @@ -127,10 +147,16 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. * \return Partial derivative of effective saturation w.r.t. \f$\mathrm{[p_c]}\f$ according to Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dswe_dpc(const Params ¶ms, Scalar pc) { - assert(pc >= 0); + using std::pow; + using std::max; + + pc = max(pc, 0.0); // the equation below is undefined for negative pcs return -params.lambda()/params.pe() * pow(pc/params.pe(), - params.lambda() - 1); } @@ -145,10 +171,17 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, * and then the params container is constructed accordingly. Afterwards the values are set there, too. * \return Relative permeability of the wetting phase calculated as implied by Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar krw(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 return pow(swe, 2.0/params.lambda() + 3); } @@ -164,10 +197,17 @@ public: * and then the params container is constructed accordingly. Afterwards the values are set there, too. * \return Derivative of the relative permeability of the wetting phase w.r.t. effective wetting phase * saturation calculated as implied by Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dkrw_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 return (2.0/params.lambda() + 3)*pow(swe, 2.0/params.lambda() + 2); } @@ -182,14 +222,21 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. * \return Relative permeability of the non-wetting phase calculated as implied by Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar krn(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 - Scalar exponent = 2.0/params.lambda() + 1; - Scalar tmp = 1. - swe; - return tmp*tmp*(1. - pow(swe, exponent)); + const Scalar exponent = 2.0/params.lambda() + 1; + const Scalar tmp = 1.0 - swe; + return tmp*tmp*(1.0 - pow(swe, exponent)); } /*! @@ -204,22 +251,26 @@ public: * and then the params container is constructed accordingly. Afterwards the values are set there, too. * \return Derivative of the relative permeability of the non-wetting phase w.r.t. effective wetting phase * saturation calculated as implied by Brooks & Corey. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dkrn_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); - - return - 2.0*(swe - 1)*( - 1 + - pow(swe, 2.0/params.lambda())*( - 1.0/params.lambda() + 1.0/2 - - swe*(1.0/params.lambda() + 1.0/2) - ) - ); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + return 2.0*(swe - 1)*(1 + pow(swe, 2.0/params.lambda())*(1.0/params.lambda() + 1.0/2 + - swe*(1.0/params.lambda() + 1.0/2) + ) + ); } }; -} + +} // end namespace Dumux #endif // BROOKS_COREY_HH diff --git a/dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh b/dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh index 19091e404126e0bed644117d014e1ea0bd7e9776..93469ba29fcd26d3749a1b477e115848f9a4e517 100644 --- a/dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh +++ b/dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh @@ -172,7 +172,7 @@ public: */ static Scalar dkrw_dsw(const Params ¶ms, Scalar sw) { - return EffLaw::dkrw_dswe(params, swToSwe(params, sw)); + return EffLaw::dkrw_dswe(params, swToSwe(params, sw))*dswe_dsw_(params); } /*! @@ -201,7 +201,7 @@ public: */ static Scalar dkrn_dsw(const Params ¶ms, Scalar sw) { - return EffLaw::dkrn_dswe(params, swToSwe(params, sw)); + return EffLaw::dkrn_dswe(params, swToSwe(params, sw))*dswe_dsw_(params); } /*! diff --git a/dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh b/dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh index 8c28cf4268ebabc4bc1752d73dbe7ad9905a1b01..630e089c638f6b2f07bf52998e48656b3d4c60e1 100644 --- a/dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh +++ b/dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh @@ -135,7 +135,9 @@ public: */ static Scalar krw(const Params ¶ms, Scalar swe) { - return std::max(std::min(swe,1.0),0.0); + using std::max; + using std::min; + return max(min(swe,1.0),0.0); } /*! @@ -150,7 +152,9 @@ public: static Scalar krn(const Params ¶ms, Scalar swe) { Scalar sne = 1 - swe; - return std::max(std::min(sne,1.0),0.0); + using std::max; + using std::min; + return max(min(sne,1.0),0.0); } }; } diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh index 3434a8f68a4379b7103dee42db2e8797ee4088f0..ed1e45c36f0e2c81a222bd797eb5323dd8594ce2 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh @@ -30,7 +30,9 @@ namespace Dumux { - +/*! + * \brief Contains the phase indices + */ struct JohansenIndices { static const int wPhaseIdx = 0; @@ -124,12 +126,15 @@ public: const Scalar porosity, const Scalar rhoSolid) { - const Scalar satW = std::max(0.0, Sw); + using std::max; + const Scalar satW = max(0.0, Sw); const Scalar kappa = 15.6; // fitted to medium quartz sand const Scalar rhoBulk = rhoSolid*porosity; // lambdaSolid^(1-porosity) * lambdaW^porosity = - const Scalar lSat = lambdaSolid * std::pow(lambdaW / lambdaSolid, porosity); + + using std::pow; + const Scalar lSat = lambdaSolid * pow(lambdaW / lambdaSolid, porosity); const Scalar lDry = (0.135*rhoBulk + 64.7)/(rhoSolid - 0.947*rhoBulk); const Scalar Ke = (kappa*satW)/(1+(kappa-1)*satW);// Kersten number, equation 13 diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh index 660c44b96f1317bb6b60098014affd68e050a59e..bcea89c8944b421c0740128fe097e9c239a6a72c 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh @@ -92,7 +92,8 @@ public: assert(numEnergyEquations != 3) ; // Franz Lindner / Shi & Wang 2011 - const Scalar satW = std::max(0.0, sw); + using std::max; + const Scalar satW = max(0.0, sw); const Scalar kfeff = porosity *((1.-satW)*lambdaN + satW*lambdaW) ; // arithmetic diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh index 9bebe3b2596a0455116c86d606370bca01f9732b..99ff4a0205cec0d5d128e5ba537c1c1936a7e98a 100644 --- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh +++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh @@ -25,10 +25,13 @@ #define THERMALCONDUCTIVITY_SOMERTON_HH #include +#include namespace Dumux { - +/*! + * \brief Indices for the wetting and the non-wetting Phase + */ struct SomertonIndices { static constexpr int wPhaseIdx = 0; @@ -118,12 +121,15 @@ public: const Scalar porosity, const Scalar rhoSolid = 0.0 /*unused*/) { - const Scalar satW = std::max(0.0, sw); + using std::max; + using std::pow; + using std::sqrt; + const Scalar satW = max(0.0, sw); // geometric mean, using ls^(1-p)*l^p = ls*(l/ls)^p - const Scalar lSat = lambdaSolid * std::pow(lambdaW / lambdaSolid, porosity); - const Scalar lDry = lambdaSolid * std::pow(lambdaN / lambdaSolid, porosity); + const Scalar lSat = lambdaSolid * pow(lambdaW / lambdaSolid, porosity); + const Scalar lDry = lambdaSolid * pow(lambdaN / lambdaSolid, porosity); - return lDry + std::sqrt(satW) * (lSat - lDry); + return lDry + sqrt(satW) * (lSat - lDry); } }; } diff --git a/dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh b/dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh index 388e9aca0bce7225d7113dadb3cd730a28c67004..75f1c768db023c923efd6dcf088475a34c2aa224 100644 --- a/dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh +++ b/dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh @@ -64,11 +64,19 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. + * \note Instead of undefined behaviour if swe is not in the valid range, we return a valid number, + * by clamping the input. Note that for pc(swe = 0.0) = inf, have a look at RegularizedVanGenuchten if this is a problem. */ static Scalar pc(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); - return pow(pow(swe, -1.0/params.vgm()) - 1, 1.0/params.vgn())/params.vgAlpha(); + using std::pow; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + const Scalar pc = pow(pow(swe, -1.0/params.vgm()) - 1, 1.0/params.vgn())/params.vgAlpha(); + return pc; } /*! @@ -84,12 +92,18 @@ public: * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. * \return The effective saturation of the wetting phase \f$\mathrm{\overline{S}_w}\f$ + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * i.e. sw(pc < 0.0) = 0.0, by clamping the input to the physical bounds. */ static Scalar sw(const Params ¶ms, Scalar pc) { - assert(pc >= 0); + using std::pow; + using std::max; + + pc = max(pc, 0.0); // the equation below is undefined for negative pcs - return pow(pow(params.vgAlpha()*pc, params.vgn()) + 1, -params.vgm()); + const Scalar sw = pow(pow(params.vgAlpha()*pc, params.vgn()) + 1, -params.vgm()); + return sw; } /*! @@ -107,14 +121,21 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. - */ + * + * \note Instead of undefined behaviour if swe is not in the valid range, we return a valid number, + * by clamping the input. + */ static Scalar dpc_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; - Scalar powSwe = pow(swe, -1/params.vgm()); + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + const Scalar powSwe = pow(swe, -1/params.vgm()); return - 1.0/params.vgAlpha() * pow(powSwe - 1, 1.0/params.vgn() - 1)/params.vgn() - * powSwe/swe/params.vgm(); + * powSwe/swe/params.vgm(); } /*! @@ -125,14 +146,19 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dswe_dpc(const Params ¶ms, Scalar pc) { - assert(pc >= 0); + using std::pow; + using std::max; + + pc = max(pc, 0.0); // the equation below is undefined for negative pcs - Scalar powAlphaPc = pow(params.vgAlpha()*pc, params.vgn()); - return -pow(powAlphaPc + 1, -params.vgm()-1)* - params.vgm()*powAlphaPc/pc*params.vgn(); + const Scalar powAlphaPc = pow(params.vgAlpha()*pc, params.vgn()); + return -pow(powAlphaPc + 1, -params.vgm()-1)*params.vgm()*powAlphaPc/pc*params.vgn(); } /*! @@ -143,12 +169,21 @@ public: * \param swe The mobile saturation of the wetting phase. * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container - * is constructed accordingly. Afterwards the values are set there, too. */ + * is constructed accordingly. Afterwards the values are set there, too. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. + */ static Scalar krw(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::sqrt; + using std::min; + using std::max; + + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 - Scalar r = 1.0 - pow(1.0 - pow(swe, 1.0/params.vgm()), params.vgm()); + const Scalar r = 1.0 - pow(1.0 - pow(swe, 1.0/params.vgm()), params.vgm()); return sqrt(swe)*r*r; } @@ -161,14 +196,22 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dkrw_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::sqrt; + using std::min; + using std::max; - const Scalar x = 1.0 - std::pow(swe, 1.0/params.vgm()); - const Scalar xToM = std::pow(x, params.vgm()); - return (1.0 - xToM)/std::sqrt(swe) * ( (1.0 - xToM)/2 + 2*xToM*(1.0-x)/x ); + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + const Scalar x = 1.0 - pow(swe, 1.0/params.vgm()); + const Scalar xToM = pow(x, params.vgm()); + return (1.0 - xToM)/sqrt(swe) * ( (1.0 - xToM)/2 + 2*xToM*(1.0-x)/x ); } /*! @@ -180,14 +223,19 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar krn(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; - return - pow(1 - swe, 1.0/3) * - pow(1 - pow(swe, 1.0/params.vgm()), 2*params.vgm()); + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + return pow(1 - swe, 1.0/3) * pow(1 - pow(swe, 1.0/params.vgm()), 2*params.vgm()); } /*! @@ -200,19 +248,24 @@ public: * \param params A container object that is populated with the appropriate coefficients for the respective law. * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too. + * + * \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number, + * by clamping the input. */ static Scalar dkrn_dswe(const Params ¶ms, Scalar swe) { - assert(0 <= swe && swe <= 1); + using std::pow; + using std::min; + using std::max; - const Scalar x = std::pow(swe, 1.0/params.vgm()); - return - -std::pow(1.0 - x, 2*params.vgm()) - *std::pow(1.0 - swe, -2.0/3) - *(1.0/3 + 2*x/swe); + swe = min(max(swe, 0.0), 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0 + + const Scalar x = pow(swe, 1.0/params.vgm()); + return -pow(1.0 - x, 2*params.vgm()) * pow(1.0 - swe, -2.0/3) * (1.0/3 + 2*x/swe); } }; -} + +} // end namespace Dumux #endif diff --git a/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpfct.hh b/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpfct.hh index 81158e1fe5a2f11f43752e37de79c5afb1764358..31772f480bb6f708cc3844f6a8395619dc2ea307 100644 --- a/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpfct.hh +++ b/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpfct.hh @@ -30,7 +30,7 @@ #include -#include +#include #include namespace Dumux @@ -65,7 +65,8 @@ public: const Scalar a2 = params.a2(); const Scalar a3 = params.a3(); const Scalar Swr = params.Swr(); - const Scalar aAlphaBeta = a1 * (Swr-Sw) * (1-Sw) + a2 * (Swr-Sw) * (1-Sw) * std::exp( a3 * pc) ; + using std::exp; + const Scalar aAlphaBeta = a1 * (Swr-Sw) * (1-Sw) + a2 * (Swr-Sw) * (1-Sw) * exp( a3 * pc) ; return aAlphaBeta; } @@ -80,7 +81,8 @@ public: const Scalar a2 = params.a2(); const Scalar a3 = params.a3(); const Scalar Swr = params.Swr(); - const Scalar value = a2 * a3 * (Swr-Sw) * (1-Sw) * std::exp(a3*pc); + using std::exp; + const Scalar value = a2 * a3 * (Swr-Sw) * (1-Sw) * exp(a3*pc); return value; } @@ -97,7 +99,8 @@ public: Scalar a2 = params.a2(); Scalar a3 = params.a3(); Scalar Swr = params.Swr(); - value = - a1 *( 1+Swr-2*Sw ) - a2 * std::exp(a3*pc) * ( 1+Swr-2*Sw ); + using std::exp; + value = - a1 *( 1+Swr-2*Sw ) - a2 * exp(a3*pc) * ( 1+Swr-2*Sw ); return value; } diff --git a/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpswpcto3.hh b/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpswpcto3.hh index 2a15ee31efe1d1541a0ff25b2a7b8a54771bbcc2..a515ee0961c573ba2924fd4db8edb5ef4cca193e 100644 --- a/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpswpcto3.hh +++ b/dumux/material/fluidmatrixinteractions/2pia/awnsurfaceexpswpcto3.hh @@ -30,7 +30,7 @@ #include -#include +#include #include namespace Dumux @@ -66,7 +66,8 @@ public: const Scalar a2 = params.a2(); const Scalar a3 = params.a3(); - const Scalar aAlphaBeta = a1 * std::exp( a2 * Sw) + a3 * pc * pc * pc ; + using std::exp; + const Scalar aAlphaBeta = a1 * exp( a2 * Sw) + a3 * pc * pc * pc ; return aAlphaBeta; } diff --git a/dumux/material/fluidmatrixinteractions/2pia/awnsurfacepolynomial2ndorder.hh b/dumux/material/fluidmatrixinteractions/2pia/awnsurfacepolynomial2ndorder.hh index bb5ac86a1b94cc3ceb19409b1f2a1825ba657298..d98959920ed0c24279c3506cc4237fdf9e424956 100644 --- a/dumux/material/fluidmatrixinteractions/2pia/awnsurfacepolynomial2ndorder.hh +++ b/dumux/material/fluidmatrixinteractions/2pia/awnsurfacepolynomial2ndorder.hh @@ -31,7 +31,7 @@ #include -#include +#include #include namespace Dumux @@ -68,7 +68,9 @@ public: const Scalar a11 = params.a11(); const Scalar a01 = params.a01(); const Scalar a02 = params.a02(); - const Scalar aAlphaBeta = a00 + a10 * Sw + a20 * std::pow(Sw,2) + a11*Sw*pc + a01*pc + a02*std::pow(pc,2); + + using std::pow; + const Scalar aAlphaBeta = a00 + a10 * Sw + a20 * pow(Sw,2) + a11*Sw*pc + a01*pc + a02*pow(pc,2); return aAlphaBeta; } diff --git a/dumux/material/fluidmatrixinteractions/3p/parkervangen3p.hh b/dumux/material/fluidmatrixinteractions/3p/parkervangen3p.hh index b74926f3f1d3316e651a5107c579ae10016b1351..62b3b04a240af50ccc84d8f8cae81f886664dd59 100644 --- a/dumux/material/fluidmatrixinteractions/3p/parkervangen3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/parkervangen3p.hh @@ -148,6 +148,7 @@ public: */ static Scalar dpcgw_dswe(const Params ¶ms, const Scalar seRegu) { + using std::pow; const Scalar powSeRegu = pow(seRegu, -1/params.vgm()); return - 1.0/params.vgAlpha() * pow(powSeRegu - 1, 1.0/params.vgn() - 1)/params.vgn() * powSeRegu/seRegu/params.vgm()/params.betaGw(); @@ -161,6 +162,7 @@ public: */ static Scalar dpcnw_dswe(const Params ¶ms, const Scalar seRegu) { + using std::pow; const Scalar powSeRegu = pow(seRegu, -1/params.vgm()); return - 1.0/params.vgAlpha() * pow(powSeRegu - 1, 1.0/params.vgn() - 1)/params.vgn() * powSeRegu/seRegu/params.vgm()/params.betaNw(); @@ -174,6 +176,7 @@ public: */ static Scalar dpcgn_dste(const Params ¶ms, const Scalar seRegu) { + using std::pow; const Scalar powSeRegu = pow(seRegu, -1/params.vgm()); return - 1.0/params.vgAlpha() * pow(powSeRegu - 1, 1.0/params.vgn() - 1)/params.vgn() * powSeRegu/seRegu/params.vgm()/params.betaGn(); @@ -204,8 +207,10 @@ public: */ static Scalar krw(const Params ¶ms, const Scalar swe) { - const Scalar r = 1.0 - std::pow(1 - std::pow(swe, 1/params.vgm()), params.vgm()); - return std::sqrt(swe)*r*r; + using std::pow; + using std::sqrt; + const Scalar r = 1.0 - pow(1 - pow(swe, 1/params.vgm()), params.vgm()); + return sqrt(swe)*r*r; } /*! @@ -228,18 +233,22 @@ public: static Scalar krn(const Params ¶ms, const Scalar swe, const Scalar sn, const Scalar ste) { Scalar krn; - krn = std::pow(1 - std::pow(swe, 1/params.vgm()), params.vgm()); - krn -= std::pow(1 - std::pow(ste, 1/params.vgm()), params.vgm()); + using std::pow; + krn = pow(1 - pow(swe, 1/params.vgm()), params.vgm()); + krn -= pow(1 - pow(ste, 1/params.vgm()), params.vgm()); krn *= krn; + using std::max; + using std::min; + using std::sqrt; if (params.krRegardsSnr()) { // regard Snr in the permeability of the n-phase, see Helmig1997 - Scalar resIncluded = std::max(std::min((sn - params.snr()/ (1-params.swr())), 1.0), 0.0); - krn *= std::sqrt(resIncluded ); + Scalar resIncluded = max(min((sn - params.snr()/ (1-params.swr())), 1.0), 0.0); + krn *= sqrt(resIncluded ); } else - krn *= std::sqrt(sn / (1 - params.swr())); // Hint: (ste - swe) = sn / (1-Srw) + krn *= sqrt(sn / (1 - params.swr())); // Hint: (ste - swe) = sn / (1-Srw) return krn; } @@ -259,7 +268,9 @@ public: static Scalar krg(const Params ¶ms, const Scalar ste) { assert(0 <= ste && ste <= 1); - return std::cbrt(1 - ste) * std::pow(1 - std::pow(ste, 1/params.vgm()), 2*params.vgm()); + using std::cbrt; + using std::pow; + return cbrt(1 - ste) * pow(1 - pow(ste, 1/params.vgm()), 2*params.vgm()); } /*! @@ -277,10 +288,11 @@ public: { assert(0 < ste && ste <= 1); - const Scalar x = std::pow(ste, 1.0/params.vgm()); + using std::pow; + const Scalar x = pow(ste, 1.0/params.vgm()); return - -std::pow(1.0 - x, 2*params.vgm()) - *std::pow(1.0 - ste, -2.0/3) + -pow(1.0 - x, 2*params.vgm()) + *pow(1.0 - ste, -2.0/3) *(1.0/3 + 2*x/ste); } @@ -326,7 +338,8 @@ private: */ const static Scalar pc_(const Params ¶ms, const Scalar se) { - return std::pow(std::pow(se, -1/params.vgm()) - 1, 1/params.vgn())/params.vgAlpha(); + using std::pow; + return pow(pow(se, -1/params.vgm()) - 1, 1/params.vgn())/params.vgAlpha(); } }; diff --git a/dumux/material/fluidmatrixinteractions/3p/parkervangen3pparams.hh b/dumux/material/fluidmatrixinteractions/3p/parkervangen3pparams.hh index 5359525dc69d6b9f6db008fc3529a174a0c9be44..40d02a4fa1fa72b32c76e9e6e7446c204f993136 100644 --- a/dumux/material/fluidmatrixinteractions/3p/parkervangen3pparams.hh +++ b/dumux/material/fluidmatrixinteractions/3p/parkervangen3pparams.hh @@ -29,6 +29,7 @@ #define PARKERVANGEN_PARAMS_3P_HH #include +#include namespace Dumux { diff --git a/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh b/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh index 4dd787b017ed367320b31a421a009e28378dcbdd..d1ccf338296c7a9cdca175b9ed0904df00593ece 100644 --- a/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh @@ -332,8 +332,10 @@ public: */ static Scalar krn(const Params ¶ms, Scalar swe, Scalar sn, Scalar ste) { - swe = std::max(std::min(swe, 1.0), 0.0); - ste = std::max(std::min(ste, 1.0), 0.0); + using std::max; + using std::min; + swe = max(min(swe, 1.0), 0.0); + ste = max(min(ste, 1.0), 0.0); if(ste - swe <= 0.0) return 0.0; @@ -381,8 +383,9 @@ public: //get the absolute gas phase saturation const Scalar st = ste*(1 - params.swr()) + params.swr(); const Scalar sg = 1.0 - st; - const Scalar scalFact = (sg > 0.1) ? 1.0 : std::max(0.0, - (sg - params.sgr())/(0.1 - params.sgr())); + using std::max; + const Scalar scalFact = (sg > 0.1) ? 1.0 : max(0.0, + (sg - params.sgr())/(0.1 - params.sgr())); //or use actual material law return scalFact * ParkerVanGen3P::krg(params, ste); diff --git a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh index f95a666e97ab4f7cda9f998702f5d63e2c83fde3..651032a86e8e24fa4e013570ec11db0b20ac5a4d 100644 --- a/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh @@ -25,10 +25,13 @@ #define THERMALCONDUCTIVITY_SOMERTON_3P_HH #include +#include namespace Dumux { - +/*! + * \brief Indices for three permanent phases + */ struct SimpleThreePIndices { static const int wPhaseIdx = 0; @@ -127,17 +130,20 @@ public: const Scalar lambdaSolid, const Scalar porosity) { - const Scalar satW = std::max(0.0, sw); - const Scalar satN = std::max(0.0, sn); + using std::max; + using std::pow; + using std::sqrt; + const Scalar satW = max(0.0, sw); + const Scalar satN = max(0.0, sn); -// const Scalar lSw = 1.8; //std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaW, porosity); -// const Scalar lSn = 0.65; //std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaN, porosity); -// const Scalar lSg = 0.35; //std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaG, porosity); +// const Scalar lSw = 1.8; //pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaW, porosity); +// const Scalar lSn = 0.65; //pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity); +// const Scalar lSg = 0.35; //pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity); // porosity weighted geometric mean - Scalar lSw = std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaW, porosity); - Scalar lSn = std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaN, porosity); - Scalar lSg = std::pow(lambdaSolid, (1.0 - porosity)) * std::pow(lambdaG, porosity); - Scalar lambdaEff = lSg + std::sqrt(satW) * (lSw - lSg) + std::sqrt(satN) * (lSn -lSg); + Scalar lSw = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaW, porosity); + Scalar lSn = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity); + Scalar lSg = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity); + Scalar lambdaEff = lSg + sqrt(satW) * (lSw - lSg) + sqrt(satN) * (lSn -lSg); return lambdaEff; diff --git a/dumux/material/fluidmatrixinteractions/diffusivityconstant.hh b/dumux/material/fluidmatrixinteractions/diffusivityconstant.hh index c3f58a4d9f1249310d0749805ecd07e14ddf69e1..95cf8072b4484e12d4221c4b8676a716f4bc2c68 100644 --- a/dumux/material/fluidmatrixinteractions/diffusivityconstant.hh +++ b/dumux/material/fluidmatrixinteractions/diffusivityconstant.hh @@ -29,6 +29,12 @@ namespace Dumux { + +namespace Properties +{ +NEW_PROP_TAG(TauTortuosity); +} + /*! * \ingroup fluidmatrixinteractionslaws * diff --git a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh index 92204bbad0e0b48c27c111c1504cfb952901e928..00e818d59cbe9cdfb1f256efa86482237f64ffd7 100644 --- a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh +++ b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh @@ -68,6 +68,7 @@ public: // we calculate the more efficient // D_eff,pm = phi * Sw^3 * cubicroot(phi * Sw) * D + using std::cbrt; return porosity * (saturation * saturation * saturation) * cbrt(porosity * saturation) * diffCoeff; } diff --git a/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh b/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh index a71b95f1c76bf690ac2d5ebd6dc39986368d46f3..db7cb5b273c36690409d554258ffc189e92d72cf 100644 --- a/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh +++ b/dumux/material/fluidmatrixinteractions/mp/mplinearmaterial.hh @@ -87,8 +87,10 @@ public: const Params ¶ms, const FluidState &state) { + using std::max; + using std::min; for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - values[phaseIdx] = std::max(std::min(state.saturation(phaseIdx),1.0),0.0); + values[phaseIdx] = max(min(state.saturation(phaseIdx),1.0),0.0); } }; } diff --git a/dumux/material/fluidmatrixinteractions/permeabilityrutqvisttsang.hh b/dumux/material/fluidmatrixinteractions/permeabilityrutqvisttsang.hh index 29086bd30e72a96c571b2ef367350f9ccd1be666..c551822496676994eb4d43a6e9f092539a606d25 100644 --- a/dumux/material/fluidmatrixinteractions/permeabilityrutqvisttsang.hh +++ b/dumux/material/fluidmatrixinteractions/permeabilityrutqvisttsang.hh @@ -25,6 +25,7 @@ #define PERMEABILITYRUTQVISTSTANG_HH #include +#include namespace Dumux { @@ -82,6 +83,7 @@ public: auto Keff = spatialParams.intrinsicPermeability(element, fvGeometry, scvIdx); + using std::exp; Keff *= exp(exponent); return Keff; diff --git a/dumux/material/fluidstates/2p2c.hh b/dumux/material/fluidstates/2p2c.hh index f1aef35cc83d7a7211c71c61d46abc6583f4dc1f..3c1c10ead58b122ab378a956be944576de59bd0b 100644 --- a/dumux/material/fluidstates/2p2c.hh +++ b/dumux/material/fluidstates/2p2c.hh @@ -150,7 +150,8 @@ public: */ Scalar phaseMassFraction(int phaseIdx) { - if (std::isnan(nu_[phaseIdx])) //in contrast to the standard update() method, satflash() does not calculate nu. + using std::isnan; + if (isnan(nu_[phaseIdx])) //in contrast to the standard update() method, satflash() does not calculate nu. { nu_[wPhaseIdx] = sw_ * density_[wPhaseIdx] / (sw_ * density_[wPhaseIdx] + (1. - sw_) * density_[nPhaseIdx]); nu_[nPhaseIdx] = 1. - nu_[wPhaseIdx]; diff --git a/dumux/material/fluidstates/nonequilibrium.hh b/dumux/material/fluidstates/nonequilibrium.hh index c5ff0033ea46c06c24e625b74c98013a3866d958..330206ae02e4e430006e0b26063a09a7ceb70d38 100644 --- a/dumux/material/fluidstates/nonequilibrium.hh +++ b/dumux/material/fluidstates/nonequilibrium.hh @@ -85,11 +85,13 @@ public: */ Scalar massFraction(int phaseIdx, int compIdx) const { + using std::abs; + using std::max; return - std::abs(sumMoleFractions_[phaseIdx]) + abs(sumMoleFractions_[phaseIdx]) * moleFraction_[phaseIdx][compIdx] * FluidSystem::molarMass(compIdx) - / std::max(1e-40, std::abs(averageMolarMass_[phaseIdx])); + / max(1e-40, abs(averageMolarMass_[phaseIdx])); } /*! @@ -206,7 +208,8 @@ public: Valgrind::SetDefined(averageMolarMass_[phaseIdx]); Valgrind::SetDefined(moleFraction_[phaseIdx][compIdx]); - if (std::isfinite(averageMolarMass_[phaseIdx])) { + using std::isfinite; + if (isfinite(averageMolarMass_[phaseIdx])) { Scalar delta = value - moleFraction_[phaseIdx][compIdx]; moleFraction_[phaseIdx][compIdx] = value; diff --git a/dumux/material/fluidsystems/1p.hh b/dumux/material/fluidsystems/1p.hh index 7679e52b13e54ecd832ac9ecd07b982c6b256f98..9131015e2e5ea8a282d1453358f97fb49667aaac 100644 --- a/dumux/material/fluidsystems/1p.hh +++ b/dumux/material/fluidsystems/1p.hh @@ -75,7 +75,7 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -159,7 +159,7 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { assert(0 <= compIdx && compIdx < numComponents); @@ -285,7 +285,8 @@ public: // the effort, since the fugacity coefficient of the other // component is infinite anyway... return 1.0; - return std::numeric_limits::infinity(); + using std::numeric_limits; + return numeric_limits::infinity(); } using Base::diffusionCoefficient; diff --git a/dumux/material/fluidsystems/2pimmiscible.hh b/dumux/material/fluidsystems/2pimmiscible.hh index efdd1bdb80d48cfb4128447178aff78efd74fd3b..bd7751f1d4aa81684db91e2472bf4a12d38f0c0b 100644 --- a/dumux/material/fluidsystems/2pimmiscible.hh +++ b/dumux/material/fluidsystems/2pimmiscible.hh @@ -82,13 +82,13 @@ public: * \brief Return the human readable name of a fluid phase * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - static const char *name[] = { - "w", - "n" + static std::string name[] = { + std::string("w"), + std::string("n") }; return name[phaseIdx]; } @@ -179,7 +179,7 @@ public: * * \param compIdx index of the component */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { assert(0 <= compIdx && compIdx < numComponents); @@ -444,7 +444,7 @@ public: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(WettingPhase); diff --git a/dumux/material/fluidsystems/2pliquidvapor.hh b/dumux/material/fluidsystems/2pliquidvapor.hh index 9fa41e1a75c856d959854df78dc16dd09c4dc34f..869110fd324c1097c4592883cb40290e3c65c9f5 100644 --- a/dumux/material/fluidsystems/2pliquidvapor.hh +++ b/dumux/material/fluidsystems/2pliquidvapor.hh @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -81,11 +82,11 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "liquid", - "vapor", + static std::string name[] = { + std::string("liquid"), + std::string("vapor"), }; assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -110,7 +111,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are indepent on the fluid composition. This assumtion is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -120,7 +121,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -177,9 +178,9 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { + static std::string name[] = { Component::name() }; @@ -555,7 +556,7 @@ public: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Components); diff --git a/dumux/material/fluidsystems/base.hh b/dumux/material/fluidsystems/base.hh index ac2f479a3004b1f765d4c3023abd0e0635c5fa5b..d7df3931919eef749c31a03c4c9c95d8ea993ddf 100644 --- a/dumux/material/fluidsystems/base.hh +++ b/dumux/material/fluidsystems/base.hh @@ -20,6 +20,7 @@ * \file * * \brief @copybrief Dumux::FluidSystems::BaseFluidSystem + * */ #ifndef DUMUX_BASE_FLUID_SYSTEM_HH #define DUMUX_BASE_FLUID_SYSTEM_HH @@ -28,6 +29,8 @@ namespace Dumux { +namespace FluidSystems +{ /*! * \ingroup Fluidsystems * \brief Fluid system base class. @@ -36,10 +39,6 @@ namespace Dumux * liquid phase. This contribution is probably not big, but somebody * has to find out its influence. */ - -namespace FluidSystems -{ - template class BaseFluidSystem { diff --git a/dumux/material/fluidsystems/brineair.hh b/dumux/material/fluidsystems/brineair.hh index b51739d0729686d4faaa8cbca90e36fad7f68770..2e80056cdc0b58974232821f383812f0fe5596aa 100644 --- a/dumux/material/fluidsystems/brineair.hh +++ b/dumux/material/fluidsystems/brineair.hh @@ -127,7 +127,7 @@ public: * * \param phaseIdx index of the phase */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "liquid"; @@ -156,7 +156,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -166,7 +166,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! @@ -223,7 +223,7 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { @@ -519,7 +519,10 @@ public: assert(phaseIdx == gPhaseIdx); if (compIIdx != AirIdx) - std::swap(compIIdx, compJIdx); + { + using std::swap; + swap(compIIdx, compJIdx); + } Scalar result = 0.0; if(compJIdx == H2OIdx) diff --git a/dumux/material/fluidsystems/brineco2.hh b/dumux/material/fluidsystems/brineco2.hh index b0c5a39a9d055bd8e0973b7215f2494b025bba05..0c46a431dddb2b52853859df44440009f6d0a327 100644 --- a/dumux/material/fluidsystems/brineco2.hh +++ b/dumux/material/fluidsystems/brineco2.hh @@ -95,11 +95,11 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "l", - "g" + static std::string name[] = { + std::string("l"), + std::string("g") }; assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -125,7 +125,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -160,9 +160,9 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { + static std::string name[] = { Brine::name(), CO2::name(), }; @@ -240,8 +240,10 @@ public: // use normalized composition for to calculate the density // (the relations don't seem to take non-normalized // compositions too well...) - Scalar xlBrine = std::min(1.0, std::max(0.0, fluidState.moleFraction(wPhaseIdx, BrineIdx))); - Scalar xlCO2 = std::min(1.0, std::max(0.0, fluidState.moleFraction(wPhaseIdx, CO2Idx))); + using std::min; + using std::max; + Scalar xlBrine = min(1.0, max(0.0, fluidState.moleFraction(wPhaseIdx, BrineIdx))); + Scalar xlCO2 = min(1.0, max(0.0, fluidState.moleFraction(wPhaseIdx, CO2Idx))); Scalar sumx = xlBrine + xlCO2; xlBrine /= sumx; xlCO2 /= sumx; @@ -260,8 +262,10 @@ public: // use normalized composition for to calculate the density // (the relations don't seem to take non-normalized // compositions too well...) - Scalar xgBrine = std::min(1.0, std::max(0.0, fluidState.moleFraction(nPhaseIdx, BrineIdx))); - Scalar xgCO2 = std::min(1.0, std::max(0.0, fluidState.moleFraction(nPhaseIdx, CO2Idx))); + using std::min; + using std::max; + Scalar xgBrine = min(1.0, max(0.0, fluidState.moleFraction(nPhaseIdx, BrineIdx))); + Scalar xgCO2 = min(1.0, max(0.0, fluidState.moleFraction(nPhaseIdx, CO2Idx))); Scalar sumx = xgBrine + xgCO2; xgBrine /= sumx; xgCO2 /= sumx; @@ -363,8 +367,10 @@ public: xgH2O); // normalize the phase compositions - xlCO2 = std::max(0.0, std::min(1.0, xlCO2)); - xgH2O = std::max(0.0, std::min(1.0, xgH2O)); + using std::min; + using std::max; + xlCO2 = max(0.0, min(1.0, xlCO2)); + xgH2O = max(0.0, min(1.0, xgH2O)); xlH2O = 1.0 - xlCO2; xgCO2 = 1.0 - xgH2O; @@ -460,7 +466,7 @@ public: using Base::binaryDiffusionCoefficient; /*! * \brief Given the phase compositions, return the binary - * diffusion coefficent \f$\mathrm{[m^2/s]}\f$ of two components in a phase. + * diffusion coefficient \f$\mathrm{[m^2/s]}\f$ of two components in a phase. * \param fluidState An arbitrary fluid state * \param phaseIdx The index of the fluid phase to consider * \param compIIdx Index of the component i @@ -477,7 +483,10 @@ public: assert(0 <= compJIdx && compJIdx < numComponents); if (compIIdx > compJIdx) - std::swap(compIIdx, compJIdx); + { + using std::swap; + swap(compIIdx, compJIdx); + } Scalar temperature = fluidState.temperature(phaseIdx); Scalar pressure = fluidState.pressure(phaseIdx); @@ -686,7 +695,7 @@ private: #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); diff --git a/dumux/material/fluidsystems/gasphase.hh b/dumux/material/fluidsystems/gasphase.hh index c8f979f7aa654d0592f36f03d17d09036c46675e..bfbe8fcf06541ec7c131bf295c556db53a5544f1 100644 --- a/dumux/material/fluidsystems/gasphase.hh +++ b/dumux/material/fluidsystems/gasphase.hh @@ -69,7 +69,7 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx = 0) + static std::string phaseName(int phaseIdx = 0) { return Component::name(); } /*! @@ -77,13 +77,13 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx = 0) + static std::string componentName(int compIdx = 0) { return Component::name(); } /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { return Component::name(); } /*! diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh index 5325a680ba9e88b9f582ffee8d9ea16f4738d180..7b3066d221fb939ec245e67310264d33b919d810 100644 --- a/dumux/material/fluidsystems/h2oair.hh +++ b/dumux/material/fluidsystems/h2oair.hh @@ -119,7 +119,7 @@ public: * * \param phaseIdx index of the phase */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "liquid"; @@ -157,7 +157,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -167,7 +167,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -223,7 +223,7 @@ public: * * \param compIdx index of the component */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { @@ -298,6 +298,31 @@ public: DUNE_THROW(Dune::NotImplemented, "Invalid component index " << compIdx); } + /*! + * \brief Vapor pressure including the Kelvin equation in \f$\mathrm{[Pa]}\f$ + * + * Calculate the decreased vapor pressure due to capillarity + * + * \param fluidState An abitrary fluid state + * \param phaseIdx The index of the fluid phase to consider + * \param compIdx The index of the component to consider + */ + template + static Scalar kelvinVaporPressure(const FluidState &fluidState, + const int phaseIdx, + const int compIdx) + { + assert(compIdx == wCompIdx && phaseIdx == wPhaseIdx); + + using std::exp; + return fugacityCoefficient(fluidState, phaseIdx, compIdx) + * fluidState.pressure(phaseIdx) + * exp(-(fluidState.pressure(nPhaseIdx)-fluidState.pressure(wPhaseIdx)) + / density(fluidState, phaseIdx) + / (Dumux::Constants::R / molarMass(compIdx)) + / fluidState.temperature()); + } + /*! * \brief Molar volume of a component at the critical point \f$\mathrm{[m^3/mol]}\f$. * @@ -423,12 +448,13 @@ public: } else if (phaseIdx == nPhaseIdx) { + using std::max; if (!useComplexRelations) // for the gas phase assume an ideal gas return IdealGas::molarDensity(T, p) * fluidState.averageMolarMass(nPhaseIdx) - / std::max(1e-5, sumMoleFrac); + / max(1e-5, sumMoleFrac); return H2O::gasDensity(T, fluidState.partialPressure(nPhaseIdx, H2OIdx)) + @@ -445,7 +471,7 @@ public: * Compositional effects in the gas phase are accounted by the Wilke method. * See Reid et al. (1987) \cite reid1987
* 4th edition, McGraw-Hill, 1987, 407-410 - * 5th edition, McGraw-Hill, 20001, p. 9.21/22 + * 5th edition, McGraw-Hill, 2001, p. 9.21/22 * \note Compositional effects for a liquid mixture have to be implemented. * * \param fluidState An arbitrary fluid state @@ -489,6 +515,7 @@ public: for (int i = 0; i < numComponents; ++i) { Scalar divisor = 0; + using std::sqrt; for (int j = 0; j < numComponents; ++j) { // 1 + (mu[i]/mu[j]^1/2 * (M[i]/M[j])^1/4) @@ -545,6 +572,19 @@ public: return 1.0; } + /*! + * \brief Returns the relative humidity of the gas phase. + * + * The relative humidity is the ratio of the partial pressure of water vapor + * to the equilibrium vapor pressure of water at a given temperature. + */ + template + static Scalar relativeHumidity(const FluidState &fluidState) + { + return fluidState.partialPressure(nPhaseIdx, wCompIdx) + / H2O::vaporPressure(fluidState.temperature(nPhaseIdx)); + } + using Base::diffusionCoefficient; template static Scalar diffusionCoefficient(const FluidState &fluidState, @@ -572,7 +612,10 @@ public: int compJIdx) { if (compIIdx > compJIdx) - std::swap(compIIdx, compJIdx); + { + using std::swap; + swap(compIIdx, compJIdx); + } #ifndef NDEBUG if (compIIdx == compJIdx || @@ -629,12 +672,12 @@ public: * \param phaseIdx The index of the fluid phase to consider * * See: - * Class Class 2000 + * Class 2001: * Theorie und numerische Modellierung nichtisothermer Mehrphasenprozesse in NAPL-kontaminierten porösen Medien * Chapter 2.1.13 Innere Energie, Wäremekapazität, Enthalpie \cite A3:class:2001
* * Formula (2.42): - * the specifiv enthalpy of a gasphase result from the sum of (enthalpies*mass fraction) of the components + * the specific enthalpy of a gasphase result from the sum of (enthalpies*mass fraction) of the components * * \todo This system neglects the contribution of gas-molecules in the liquid phase. * This contribution is probably not big. Somebody would have to find out the enthalpy of solution for this system. ... @@ -769,7 +812,7 @@ public: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Components); diff --git a/dumux/material/fluidsystems/h2oairmesitylene.hh b/dumux/material/fluidsystems/h2oairmesitylene.hh index 3f0e014c9a011a40b4398049430c2aff9d522229..a0eb42bb7a85750ace4b373c7c27613b39a821e6 100644 --- a/dumux/material/fluidsystems/h2oairmesitylene.hh +++ b/dumux/material/fluidsystems/h2oairmesitylene.hh @@ -145,7 +145,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -155,7 +155,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -187,7 +187,7 @@ public: /*! * \brief Return the human readable name of a phase (used in indices) */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "w"; @@ -200,7 +200,7 @@ public: /*! * \brief Return the human readable name of a component (used in indices) */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { case H2OIdx: return H2O::name(); @@ -313,7 +313,7 @@ public: Scalar muResult; const Scalar mu[numComponents] = { H2O::gasViscosity(fluidState.temperature(phaseIdx), H2O::vaporPressure(fluidState.temperature(phaseIdx))), - Air::simpleGasViscosity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx)), + Air::gasViscosity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx)), NAPL::gasViscosity(fluidState.temperature(phaseIdx), NAPL::vaporPressure(fluidState.temperature(phaseIdx))) }; // molar masses @@ -336,8 +336,10 @@ public: Scalar phiCAW = 0.3; // simplification for this particular system /* actually like this - * Scalar phiCAW = std::pow(1.+std::sqrt(mu[NAPLIdx]/muAW)*std::pow(MAW/M[NAPLIdx],0.25),2) - * / std::sqrt(8.*(1.+M[NAPLIdx]/MAW)); + * using std::sqrt; + * using std::pow; + * Scalar phiCAW = pow(1.+sqrt(mu[NAPLIdx]/muAW)*pow(MAW/M[NAPLIdx],0.25),2) + * / sqrt(8.*(1.+M[NAPLIdx]/MAW)); */ Scalar phiAWC = phiCAW * muAW*M[NAPLIdx]/(mu[NAPLIdx]*MAW); @@ -351,7 +353,7 @@ public: using Base::diffusionCoefficient; /*! * \brief Given all mole fractions, return the diffusion - * coefficent in \f$\mathrm{[m^2/s]}\f$ of a component in a phase. + * coefficient in \f$\mathrm{[m^2/s]}\f$ of a component in a phase. * \param fluidState The fluid state * \param phaseIdx The index of the phase * \param compIdx The index of the component @@ -456,7 +458,7 @@ public: // for the NAPL phase, we assume currently that nothing is // dissolved. this means that the affinity of the NAPL // component to the NAPL phase is much higher than for the - // other components, i.e. the fugacity cofficient is much + // other components, i.e. the fugacity coefficient is much // smaller. if (phaseIdx == nPhaseIdx) { Scalar phiNapl = NAPL::vaporPressure(T)/p; @@ -474,6 +476,14 @@ public: return 1.0; } + template + static Scalar kelvinVaporPressure(const FluidState &fluidState, + const int phaseIdx, + const int compIdx) + { + DUNE_THROW(Dune::NotImplemented, "FluidSystems::H2OAirMesitylene::kelvinVaporPressure()"); + } + using Base::enthalpy; /*! * \brief Given all mole fractions in a phase, return the specific @@ -579,7 +589,7 @@ private: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Components); diff --git a/dumux/material/fluidsystems/h2oairxylene.hh b/dumux/material/fluidsystems/h2oairxylene.hh index 99c97e49ca24fdd45b2df20fe452f122c443991c..b65f5440aac3552f74f9fe66f60059250664d508 100644 --- a/dumux/material/fluidsystems/h2oairxylene.hh +++ b/dumux/material/fluidsystems/h2oairxylene.hh @@ -141,7 +141,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -151,7 +151,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -184,7 +184,7 @@ public: * \brief Return the human readable name of a phase (used in indices) * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "w"; @@ -198,7 +198,7 @@ public: * \brief Return the human readable name of a component (used in indices) * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { case H2OIdx: return H2O::name(); @@ -312,7 +312,7 @@ public: Scalar muResult; const Scalar mu[numComponents] = { H2O::gasViscosity(fluidState.temperature(phaseIdx), H2O::vaporPressure(fluidState.temperature(phaseIdx))), - Air::simpleGasViscosity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx)), + Air::gasViscosity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx)), NAPL::gasViscosity(fluidState.temperature(phaseIdx), NAPL::vaporPressure(fluidState.temperature(phaseIdx))) }; // molar masses @@ -335,8 +335,10 @@ public: Scalar phiCAW = 0.3; // simplification for this particular system /* actually like this - * Scalar phiCAW = std::pow(1.+std::sqrt(mu[NAPLIdx]/muAW)*std::pow(MAW/M[NAPLIdx],0.25),2) - * / std::sqrt(8.*(1.+M[NAPLIdx]/MAW)); + * using std::sqrt; + * using std::pow; + * Scalar phiCAW = pow(1.+sqrt(mu[NAPLIdx]/muAW)*pow(MAW/M[NAPLIdx],0.25),2) + * / sqrt(8.*(1.+M[NAPLIdx]/MAW)); */ Scalar phiAWC = phiCAW * muAW*M[NAPLIdx]/(mu[NAPLIdx]*MAW); @@ -350,7 +352,7 @@ public: using Base::diffusionCoefficient; /*! * \brief Given all mole fractions, return the diffusion - * coefficent \f$\mathrm{[m^2/s]}\f$ of a component in a phase. + * coefficient \f$\mathrm{[m^2/s]}\f$ of a component in a phase. * \param fluidState The fluid state * \param phaseIdx The index of the phase to consider * \param compIdx The index of the component to consider @@ -455,7 +457,7 @@ public: // for the NAPL phase, we assume currently that nothing is // dissolved. this means that the affinity of the NAPL // component to the NAPL phase is much higher than for the - // other components, i.e. the fugacity cofficient is much + // other components, i.e. the fugacity coefficient is much // smaller. if (phaseIdx == nPhaseIdx) { Scalar phiNapl = NAPL::vaporPressure(T)/p; @@ -473,6 +475,14 @@ public: return 1.0; } + template + static Scalar kelvinVaporPressure(const FluidState &fluidState, + const int phaseIdx, + const int compIdx) + { + DUNE_THROW(Dune::NotImplemented, "FluidSystems::H2OAirXylene::kelvinVaporPressure()"); + } + using Base::enthalpy; /*! * \brief Given all mole fractions in a phase, return the specific @@ -578,7 +588,7 @@ private: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Components); diff --git a/dumux/material/fluidsystems/h2oheavyoilfluidsystem.hh b/dumux/material/fluidsystems/h2oheavyoilfluidsystem.hh index 9a53594d4bf2ddcb1597211281f84c99d03bc303..e08409edfdb5b2e5912bd6c94fe9b064af0c7946 100644 --- a/dumux/material/fluidsystems/h2oheavyoilfluidsystem.hh +++ b/dumux/material/fluidsystems/h2oheavyoilfluidsystem.hh @@ -137,7 +137,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are indepent on the fluid composition. This assumtion is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -147,7 +147,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -179,7 +179,7 @@ public: /*! * \brief Return the human readable name of a phase (used in indices) */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "w"; @@ -192,7 +192,7 @@ public: /*! * \brief Return the human readable name of a component (used in indices) */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { case H2OIdx: return H2O::name(); @@ -421,7 +421,21 @@ public: static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx) { - DUNE_THROW(Dune::NotImplemented, "FluidSystems::H2ONAPL::thermalConductivity()"); + const Scalar temperature = fluidState.temperature(phaseIdx) ; + const Scalar pressure = fluidState.pressure(phaseIdx); + if (phaseIdx == wPhaseIdx) + { + return H2O::liquidThermalConductivity(temperature, pressure); + } + else if (phaseIdx == nPhaseIdx) + { + return HeavyOil::liquidThermalConductivity(temperature, pressure); + } + else if (phaseIdx == gPhaseIdx) + { + return H2O::gasThermalConductivity(temperature, pressure); + } + DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); } private: @@ -430,7 +444,7 @@ private: } // end namespace FluidSystems #ifdef DUMUX_PROPERTIES_HH -// forward defintions of the property tags +// forward definitions of the property tags namespace Properties { NEW_PROP_TAG(Scalar); NEW_PROP_TAG(Components); diff --git a/dumux/material/fluidsystems/h2on2.hh b/dumux/material/fluidsystems/h2on2.hh index 5295698abd88bb41b20879cb1e8187d5cbddb253..25988091ddda3578860e74e869daad9253a22b57 100644 --- a/dumux/material/fluidsystems/h2on2.hh +++ b/dumux/material/fluidsystems/h2on2.hh @@ -96,14 +96,14 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "w", - "n" + assert(0 <= phaseIdx && phaseIdx < numPhases); + static const std::string name[] = { + std::string("w"), + std::string("n") }; - assert(0 <= phaseIdx && phaseIdx < numPhases); return name[phaseIdx]; } @@ -125,7 +125,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -135,7 +135,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -199,15 +199,15 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { - H2O::name(), - N2::name() - }; + switch (compIdx) + { + case H2OIdx: return H2O::name(); + case N2Idx: return N2::name(); + } - assert(0 <= compIdx && compIdx < numComponents); - return name[compIdx]; + DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx); } /*! @@ -258,6 +258,31 @@ public: return pcrit[compIdx]; } + /*! + * \brief Vapor pressure including the Kelvin equation in \f$\mathrm{[Pa]}\f$ + * + * Calculate the decreased vapor pressure due to capillarity + * + * \param fluidState An abitrary fluid state + * \param phaseIdx The index of the fluid phase to consider + * \param compIdx The index of the component to consider + */ + template + static Scalar kelvinVaporPressure(const FluidState &fluidState, + const int phaseIdx, + const int compIdx) + { + assert(compIdx == wCompIdx && phaseIdx == wPhaseIdx); + + using std::exp; + return fugacityCoefficient(fluidState, phaseIdx, compIdx) + * fluidState.pressure(phaseIdx) + * exp(-(fluidState.pressure(nPhaseIdx)-fluidState.pressure(wPhaseIdx)) + / density(fluidState, phaseIdx) + / (Dumux::Constants::R / molarMass(compIdx)) + / fluidState.temperature()); + } + /*! * \brief Molar volume of a component at the critical point \f$\mathrm{[m^3/mol]}\f$. * @@ -383,17 +408,18 @@ public: } // gas phase + using std::max; if (!useComplexRelations) // for the gas phase assume an ideal gas return IdealGas::molarDensity(T, p) * fluidState.averageMolarMass(nPhaseIdx) - / std::max(1e-5, sumMoleFrac); + / max(1e-5, sumMoleFrac); // assume ideal mixture: steam and nitrogen don't "see" each other Scalar rho_gH2O = H2O::gasDensity(T, p*fluidState.moleFraction(nPhaseIdx, H2OIdx)); Scalar rho_gN2 = N2::gasDensity(T, p*fluidState.moleFraction(nPhaseIdx, N2Idx)); - return (rho_gH2O + rho_gN2) / std::max(1e-5, sumMoleFrac); + return (rho_gH2O + rho_gN2) / max(1e-5, sumMoleFrac); } using Base::viscosity; @@ -440,12 +466,15 @@ public: }; Scalar sumx = 0.0; + using std::max; for (int compIdx = 0; compIdx < numComponents; ++compIdx) sumx += fluidState.moleFraction(phaseIdx, compIdx); - sumx = std::max(1e-10, sumx); + sumx = max(1e-10, sumx); for (int i = 0; i < numComponents; ++i) { Scalar divisor = 0; +// using std::sqrt; +// using std::pow; for (int j = 0; j < numComponents; ++j) { Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * pow(molarMass(j)/molarMass(i), 1/4.0); phiIJ *= phiIJ; @@ -563,7 +592,10 @@ public: Valgrind::SetUndefined(undefined); if (compIIdx > compJIdx) - std::swap(compIIdx, compJIdx); + { + using std::swap; + swap(compIIdx, compJIdx); + } #ifndef NDEBUG if (compIIdx == compJIdx || diff --git a/dumux/material/fluidsystems/h2on2kinetic.hh b/dumux/material/fluidsystems/h2on2kinetic.hh index 3b09cf1075cc1c5bd8318e66271b08824818c3d9..3559b675e66f8c416ad0839a7939e6a3706bfd28 100644 --- a/dumux/material/fluidsystems/h2on2kinetic.hh +++ b/dumux/material/fluidsystems/h2on2kinetic.hh @@ -61,7 +61,7 @@ public: //! Index of the solid phase static constexpr int sPhaseIdx = 2; - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { if (phaseIdx == sPhaseIdx) return "s"; @@ -140,12 +140,12 @@ public: const unsigned int nCompIdx = ParentType::nCompIdx; const unsigned int wCompIdx = ParentType::wCompIdx; - assert(0 <= referencePhaseIdx and referencePhaseIdx < ParentType::numPhases); - assert(0 <= calcCompIdx and calcCompIdx < ParentType::numComponents); + assert(0 <= referencePhaseIdx && referencePhaseIdx < ParentType::numPhases); + assert(0 <= calcCompIdx && calcCompIdx < ParentType::numComponents); const unsigned int numPhases = ParentType::numPhases; const unsigned int numComponents= ParentType::numComponents; - static_assert(( (numComponents==numPhases) and (numPhases==2) ), + static_assert(( (numComponents==numPhases) && (numPhases==2) ), "This function requires that the number of fluid phases is equal " "to the number of components"); @@ -269,7 +269,7 @@ public: const unsigned int numPhases = ParentType::numPhases; const unsigned int numComponents= ParentType::numComponents; - static_assert(( (numComponents==numPhases) and (numPhases==2) ), + static_assert(((numComponents == numPhases) && (numPhases== 2)), "This function requires that the number fluid phases is equal " "to the number of components"); diff --git a/dumux/material/fluidsystems/h2on2o2.hh b/dumux/material/fluidsystems/h2on2o2.hh index 31f0be8763b388585e24b98b796a46fc49731c2e..24f4bb2c694b3704429e3257ddb7c461874259a3 100644 --- a/dumux/material/fluidsystems/h2on2o2.hh +++ b/dumux/material/fluidsystems/h2on2o2.hh @@ -108,11 +108,11 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "l", - "g" + static const std::string name[] = { + std::string("l"), + std::string("g") }; assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -137,7 +137,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -147,7 +147,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -212,16 +212,16 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { - H2O::name(), - N2::name(), - O2::name() - }; + switch (compIdx) + { + case H2OIdx: return H2O::name(); + case N2Idx: return N2::name(); + case O2Idx: return O2::name(); + } - assert(0 <= compIdx && compIdx < numComponents); - return name[compIdx]; + DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx); } /*! @@ -328,6 +328,7 @@ public: Scalar vaporPressure = H2O::vaporPressure(T); Scalar exponent = molarMass(compIdx)/(density(fluidState, phaseIdx) * Constants::R * T); exponent *= (2 * surfaceTension(fluidState) / radius); + using std::exp; Scalar kelvinVaporPressure = vaporPressure * exp(exponent); return kelvinVaporPressure; @@ -349,7 +350,8 @@ public: const Scalar mu = 1.256; const Scalar b = -0.625; //Equation to calculate surface Tension of Water According to IAPWS Release on Surface Tension from September 1994 - const Scalar surfaceTension = B*std::pow((1.-(T/T_c)),mu)*(1.+b*(1.-(T/T_c))); + using std::pow; + const Scalar surfaceTension = B*pow((1.-(T/T_c)),mu)*(1.+b*(1.-(T/T_c))); return surfaceTension; //surface Tension [N/m] } /**************************************** @@ -452,19 +454,20 @@ public: } // gas phase + using std::max; if (!useComplexRelations) // for the gas phase assume an ideal gas return IdealGas::molarDensity(T, p) * fluidState.averageMolarMass(nPhaseIdx) - / std::max(1e-5, sumMoleFrac); + / max(1e-5, sumMoleFrac); // assume ideal mixture: steam, nitrogen and oxygen don't "see" each // other Scalar rho_gH2O = H2O::gasDensity(T, p*fluidState.moleFraction(nPhaseIdx, H2OIdx)); Scalar rho_gN2 = N2::gasDensity(T, p*fluidState.moleFraction(nPhaseIdx, N2Idx)); Scalar rho_gO2 = O2::gasDensity(T, p*fluidState.moleFraction(nPhaseIdx, O2Idx)); - return (rho_gH2O + rho_gN2 + rho_gO2 ) / std::max(1e-5, sumMoleFrac); + return (rho_gH2O + rho_gN2 + rho_gO2 ) / max(1e-5, sumMoleFrac); } using Base::viscosity; @@ -512,12 +515,15 @@ public: }; Scalar sumx = 0.0; + using std::max; for (int compIdx = 0; compIdx < numComponents; ++compIdx) sumx += fluidState.moleFraction(phaseIdx, compIdx); - sumx = std::max(1e-10, sumx); + sumx = max(1e-10, sumx); for (int i = 0; i < numComponents; ++i) { Scalar divisor = 0; + using std::pow; + using std::sqrt; for (int j = 0; j < numComponents; ++j) { Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * pow(molarMass(j)/molarMass(i), 1/4.0); phiIJ *= phiIJ; @@ -626,7 +632,10 @@ public: { if (compIIdx > compJIdx) - std::swap(compIIdx, compJIdx); + { + using std::swap; + swap(compIIdx, compJIdx); + } #ifndef NDEBUG if (compIIdx == compJIdx || diff --git a/dumux/material/fluidsystems/liquidphase.hh b/dumux/material/fluidsystems/liquidphase.hh index b073cec32fa37502442d60640afdabae05ed66f0..c774bed530ae287e7b05bb50e94b3b210e7496e4 100644 --- a/dumux/material/fluidsystems/liquidphase.hh +++ b/dumux/material/fluidsystems/liquidphase.hh @@ -68,7 +68,7 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx = 0) + static std::string phaseName(int phaseIdx = 0) { return Component::name(); } /*! @@ -76,13 +76,13 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx = 0) + static std::string componentName(int compIdx = 0) { return Component::name(); } /*! * \brief A human readable name for the component. */ - static const char *name() + static std::string name() { return Component::name(); } /*! diff --git a/dumux/material/fluidsystems/purewatersimple.hh b/dumux/material/fluidsystems/purewatersimple.hh index 09366f67244f7b42a2fee1a2c0b1246f9908bcc6..338bce8fd5104d2fddba639d3628413dcb60c0b2 100644 --- a/dumux/material/fluidsystems/purewatersimple.hh +++ b/dumux/material/fluidsystems/purewatersimple.hh @@ -96,12 +96,12 @@ public: * * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "w", - "n", - "s" + static std::string name[] = { + std::string("w"), + std::string("n"), + std::string("s") }; assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -126,7 +126,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -136,7 +136,7 @@ public: static bool isIdealMixture(int phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - // we assume Henry's and Rault's laws for the water phase and + // we assume Henry's and Raoult's laws for the water phase and // and no interaction between gas molecules of different // components, so all phases are ideal mixtures! return true; @@ -198,9 +198,9 @@ public: * * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { + static std::string name[] = { H2O::name(), N2::name() }; diff --git a/dumux/material/fluidsystems/spe5.hh b/dumux/material/fluidsystems/spe5.hh index e793ea5acf8c7d48dc613ddc0e290e73ac7071c1..a8a679f0eb591f37db132a71190246044539bb37 100644 --- a/dumux/material/fluidsystems/spe5.hh +++ b/dumux/material/fluidsystems/spe5.hh @@ -84,12 +84,12 @@ public: * \brief Return the human readable name of a fluid phase * \param phaseIdx The index of the fluid phase to consider */ - static const char *phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { - static const char *name[] = { - "g", - "w", - "o", + static std::string name[] = { + std::string("g"), + std::string("w"), + std::string("o"), }; assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -125,7 +125,7 @@ public: * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase * are independent on the fluid composition. This assumption is true - * if Henry's law and Rault's law apply. If you are unsure what + * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times * in some cases. @@ -133,7 +133,7 @@ public: */ static bool isIdealMixture(int phaseIdx) { - // always use the reference oil for the fugacity coefficents, + // always use the reference oil for the fugacity coefficients, // so they cannot be dependent on composition and they the // phases thus always an ideal mixture return phaseIdx == wPhaseIdx; @@ -170,16 +170,16 @@ public: * \brief Return the human readable name of a component * \param compIdx The index of the component to consider */ - static const char *componentName(int compIdx) + static std::string componentName(int compIdx) { - static const char *name[] = { + static std::string name[] = { H2O::name(), - "C1", - "C3", - "C6", - "C10", - "C15", - "C20" + std::string("C1"), + std::string("C3"), + std::string("C6"), + std::string("C10"), + std::string("C15"), + std::string("C20") }; assert(0 <= compIdx && compIdx < numComponents); @@ -296,8 +296,10 @@ public: */ static Scalar interactionCoefficient(int comp1Idx, int comp2Idx) { - int i = std::min(comp1Idx, comp2Idx); - int j = std::max(comp1Idx, comp2Idx); + using std::min; + using std::max; + int i = min(comp1Idx, comp2Idx); + int j = max(comp1Idx, comp2Idx); if (i == C1Idx && (j == C15Idx || j == C20Idx)) return 0.05; else if (i == C3Idx && (j == C15Idx || j == C20Idx)) @@ -328,35 +330,37 @@ public: Scalar minB = 1e100, maxB = -1e100; prParams.updatePure(minT, minP); + using std::min; + using std::max; for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - minA = std::min(prParams.pureParams(compIdx).a(), minA); - maxA = std::max(prParams.pureParams(compIdx).a(), maxA); - minB = std::min(prParams.pureParams(compIdx).b(), minB); - maxB = std::max(prParams.pureParams(compIdx).b(), maxB); + minA = min(prParams.pureParams(compIdx).a(), minA); + maxA = max(prParams.pureParams(compIdx).a(), maxA); + minB = min(prParams.pureParams(compIdx).b(), minB); + maxB = max(prParams.pureParams(compIdx).b(), maxB); } prParams.updatePure(maxT, minP); for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - minA = std::min(prParams.pureParams(compIdx).a(), minA); - maxA = std::max(prParams.pureParams(compIdx).a(), maxA); - minB = std::min(prParams.pureParams(compIdx).b(), minB); - maxB = std::max(prParams.pureParams(compIdx).b(), maxB); + minA = min(prParams.pureParams(compIdx).a(), minA); + maxA = max(prParams.pureParams(compIdx).a(), maxA); + minB = min(prParams.pureParams(compIdx).b(), minB); + maxB = max(prParams.pureParams(compIdx).b(), maxB); } prParams.updatePure(minT, maxP); for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - minA = std::min(prParams.pureParams(compIdx).a(), minA); - maxA = std::max(prParams.pureParams(compIdx).a(), maxA); - minB = std::min(prParams.pureParams(compIdx).b(), minB); - maxB = std::max(prParams.pureParams(compIdx).b(), maxB); + minA = min(prParams.pureParams(compIdx).a(), minA); + maxA = max(prParams.pureParams(compIdx).a(), maxA); + minB = min(prParams.pureParams(compIdx).b(), minB); + maxB = max(prParams.pureParams(compIdx).b(), maxB); } prParams.updatePure(maxT, maxP); for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - minA = std::min(prParams.pureParams(compIdx).a(), minA); - maxA = std::max(prParams.pureParams(compIdx).a(), maxA); - minB = std::min(prParams.pureParams(compIdx).b(), minB); - maxB = std::max(prParams.pureParams(compIdx).b(), maxB); + minA = min(prParams.pureParams(compIdx).a(), minA); + maxA = max(prParams.pureParams(compIdx).a(), maxA); + minB = min(prParams.pureParams(compIdx).b(), minB); + maxB = max(prParams.pureParams(compIdx).b(), maxB); } PengRobinson::init(/*aMin=*/minA, /*aMax=*/maxA, /*na=*/100, diff --git a/dumux/material/spatialparams/gstatrandomfield.hh b/dumux/material/spatialparams/gstatrandomfield.hh index d21ba0c5bda5da8e311920b6176b50592955fa2d..c7dbe5e552a26776e65d54f4752e5235b58c2f7b 100644 --- a/dumux/material/spatialparams/gstatrandomfield.hh +++ b/dumux/material/spatialparams/gstatrandomfield.hh @@ -154,8 +154,9 @@ public: gstatOutput.close(); // post processing + using std::pow; if (fieldType_ == FieldType::log10) - std::for_each(data_.begin(), data_.end(), [](Scalar& s){ s = std::pow(10.0, s); }); + std::for_each(data_.begin(), data_.end(), [](Scalar& s){ s = pow(10.0, s); }); } //! \brief Return an entry of the data vector @@ -175,7 +176,8 @@ public: if (fieldType_ == FieldType::log10) { logPerm = data_; - std::for_each(logPerm.begin(), logPerm.end(), [](Scalar& s){ s = std::log10(s); }); + using std::log10; + std::for_each(logPerm.begin(), logPerm.end(), [](Scalar& s){ s = log10(s); }); vtkwriter.addCellData(logPerm, "log10 of " + dataName); } vtkwriter.write(vtkName, Dune::VTK::OutputType::ascii); diff --git a/dumux/multidomain/2cnistokes2p2cni/localoperator.hh b/dumux/multidomain/2cnistokes2p2cni/localoperator.hh index 8db004ebf0da080ce377b01a3f257a5cb7f77e6c..485d7da70700da7e9907bd949234e85711041de1 100644 --- a/dumux/multidomain/2cnistokes2p2cni/localoperator.hh +++ b/dumux/multidomain/2cnistokes2p2cni/localoperator.hh @@ -41,15 +41,23 @@ namespace Dumux { * The total mass balance equation: * \f[ * \left[ - * \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} \right) \cdot \boldsymbol{n} + * \left( + * \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{g,ff,t,diff} + * \right) \cdot \boldsymbol{n} * \right]^\textrm{ff} * = -\left[ - * \left( \varrho_\textrm{g} \boldsymbol{v}_\textrm{g} - * + \varrho_\textrm{l} \boldsymbol{v}_\textrm{l} \right) \cdot \boldsymbol{n} + * \left( + * \varrho_\textrm{g} \boldsymbol{v}_\textrm{g} + * + \varrho_\textrm{l} \boldsymbol{v}_\textrm{l} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{g,pm,diff} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{l,pm,diff} +* \right) \cdot \boldsymbol{n} * \right]^\textrm{pm} * \f] * in which \f$n\f$ represents a vector normal to the interface pointing outside of - * the specified subdomain. + * the specified subdomain. The diffusive fluxes \f$ j_\textrm{diff} \f$ are the diffusive fluxes as + * they are implemented in the individual subdomain models. * * The momentum balance (tangential), which corresponds to the Beavers-Jospeh Saffman condition: * \f[ diff --git a/dumux/multidomain/2cstokes2p2c/localoperator.hh b/dumux/multidomain/2cstokes2p2c/localoperator.hh index 32c54e2e7a7c64c9126f2cf95d724f77f9fc49e3..c6ac77710c50c96bcbfc438db22050ff1df4967f 100644 --- a/dumux/multidomain/2cstokes2p2c/localoperator.hh +++ b/dumux/multidomain/2cstokes2p2c/localoperator.hh @@ -53,15 +53,23 @@ namespace Dumux { * The total mass balance equation: * \f[ * \left[ - * \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} \right) \cdot \boldsymbol{n} + * \left( + * \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{g,ff,t,diff} + * \right) \cdot \boldsymbol{n} * \right]^\textrm{ff} * = -\left[ - * \left( \varrho_\textrm{g} \boldsymbol{v}_\textrm{g} - * + \varrho_\textrm{l} \boldsymbol{v}_\textrm{l} \right) \cdot \boldsymbol{n} + * \left( + * \varrho_\textrm{g} \boldsymbol{v}_\textrm{g} + * + \varrho_\textrm{l} \boldsymbol{v}_\textrm{l} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{g,pm,diff} + * - \sum_\kappa {\boldsymbol{j}}^\kappa_\textrm{l,pm,diff} +* \right) \cdot \boldsymbol{n} * \right]^\textrm{pm} * \f] * in which \f$n\f$ represents a vector normal to the interface pointing outside of - * the specified subdomain. + * the specified subdomain. The diffusive fluxes \f$ j_\textrm{diff} \f$ are the diffusive fluxes as + * they are implemented in the individual subdomain models. * * The momentum balance (tangential), which corresponds to the Beavers-Jospeh Saffman condition: * \f[ @@ -113,8 +121,6 @@ namespace Dumux { * \right]^\textrm{pm} * = 0 * \f] - * in which the diffusive fluxes \f$ j_\textrm{diff} \f$ are the diffusive fluxes as - * they are implemented in the individual subdomain models. * * The component mass balance equation (continuity of mass/ mole fractions): * \f[ @@ -175,7 +181,8 @@ public: }; // Stokes - enum { numEq1 = GET_PROP_VALUE(Stokes2cTypeTag, NumEq) }; + enum { numEq1 = GET_PROP_VALUE(Stokes2cTypeTag, NumEq), + useMoles1 = GET_PROP_VALUE(Stokes2cTypeTag, UseMoles) }; enum { numComponents1 = Stokes2cIndices::numComponents }; enum { // equation indices momentumXIdx1 = Stokes2cIndices::momentumXIdx, //!< Index of the x-component of the momentum balance @@ -191,7 +198,8 @@ public: }; // Darcy - enum { numEq2 = GET_PROP_VALUE(TwoPTwoCTypeTag, NumEq) }; + enum { numEq2 = GET_PROP_VALUE(TwoPTwoCTypeTag, NumEq), + useMoles2 = GET_PROP_VALUE(TwoPTwoCTypeTag, UseMoles) }; enum { numPhases2 = GET_PROP_VALUE(TwoPTwoCTypeTag, NumPhases) }; enum { // equation indices contiWEqIdx2 = TwoPTwoCIndices::contiWEqIdx, //!< Index of the continuity equation for water component @@ -429,10 +437,20 @@ public: const GlobalPosition& globalPos2 = cParams.fvGeometry2.subContVol[vertInElem2].global; const GlobalPosition& bfNormal1 = boundaryVars1.face().normal; - const Scalar normalMassFlux1 = boundaryVars1.normalVelocity() - * cParams.elemVolVarsCur1[vertInElem1].density(); - - if (std::abs(bfNormal1[1]) < 1e-10) + const Scalar density1 = useMoles1 ? cParams.elemVolVarsCur1[vertInElem1].molarDensity() + : cParams.elemVolVarsCur1[vertInElem1].density(); + const Scalar massMoleFrac1 = useMoles1 ? cParams.elemVolVarsCur1[vertInElem1].moleFraction(transportCompIdx1) + : cParams.elemVolVarsCur1[vertInElem1].massFraction(transportCompIdx1); + + const Scalar normalPhaseFlux1 = boundaryVars1.normalVelocity() * density1; + const Scalar diffusiveMoleFlux1 = bfNormal1 + * boundaryVars1.moleFractionGrad(transportCompIdx1) + * (boundaryVars1.diffusionCoeff(transportCompIdx1) + + boundaryVars1.eddyDiffusivity()) + * boundaryVars1.molarDensity(); + + using std::abs; + if (abs(bfNormal1[1]) < 1e-10) { DUNE_THROW(Dune::NotImplemented, "The coupling conditions are not implemented for vertical interfaces."); } @@ -445,13 +463,16 @@ public: } if (cParams.boundaryTypes2.isCouplingNeumann(massBalanceIdx2)) { - static_assert(!GET_PROP_VALUE(TwoPTwoCTypeTag, UseMoles), - "This coupling condition is only implemented for mass fraction formulation."); - if (globalProblem_.sdProblem1().isCornerPoint(globalPos1)) { + Scalar diffusiveFlux = diffusiveMoleFlux1 * FluidSystem::molarMass(transportCompIdx1) + - diffusiveMoleFlux1 * FluidSystem::molarMass(phaseCompIdx1); + if (useMoles1) + { + diffusiveFlux = 0.0; + } couplingRes2.accumulate(lfsu2.child(massBalanceIdx2), vertInElem2, - -normalMassFlux1); + - normalPhaseFlux1 + diffusiveFlux); } else { @@ -477,7 +498,8 @@ public: SpatialParams spatialParams = globalProblem_.sdProblem2().spatialParams(); Scalar beaversJosephCoeff = spatialParams.beaversJosephCoeffAtPos(globalPos1); assert(beaversJosephCoeff > 0); - beaversJosephCoeff /= std::sqrt(spatialParams.intrinsicPermeability(sdElement2, cParams.fvGeometry2, vertInElem2)); + using std::sqrt; + beaversJosephCoeff /= sqrt(spatialParams.intrinsicPermeability(sdElement2, cParams.fvGeometry2, vertInElem2)); // Neumann-like conditions if (cParams.boundaryTypes1.isCouplingNeumann(momentumXIdx1)) @@ -535,19 +557,19 @@ public: Scalar sumNormalPhaseFluxes = 0.0; for (int phaseIdx=0; phaseIdx(1.0, std::abs(uLastIter.base()[i][j] + uNewI.base()[i][j])/2); + Scalar vertexError = abs(deltaU.base()[i][j]); + vertexError /= max(1.0, abs(uLastIter.base()[i][j] + uNewI.base()[i][j])/2); - this->shift_ = std::max(this->shift_, vertexError); + this->shift_ = max(this->shift_, vertexError); } } } diff --git a/dumux/multidomain/problem.hh b/dumux/multidomain/problem.hh index 4f0879ae1576dc0b9c0dc4f3b64c0e4bcbb938de..1aff9346c781b3c129746bf1d33efd321389b4c6 100644 --- a/dumux/multidomain/problem.hh +++ b/dumux/multidomain/problem.hh @@ -265,11 +265,11 @@ public: // \} //! \copydoc ImplicitProblem::name() - const char *name() const - { return simname_.c_str(); } + const std::string& name() const + { return simname_; } //! \copydoc ImplicitProblem::setName() - static void setName(const char *newName) + static void setName(std::string newName) { simname_ = newName; } //! \copydoc ImplicitProblem::timeManager() diff --git a/dumux/nonlinear/newtoncontroller.hh b/dumux/nonlinear/newtoncontroller.hh index 6f43f1b0fd2e456615b91efcbb107172158930d7..bd5edb56f8b52d160312a6a0b9b1fcd6727ca07d 100644 --- a/dumux/nonlinear/newtoncontroller.hh +++ b/dumux/nonlinear/newtoncontroller.hh @@ -86,12 +86,18 @@ NEW_PROP_TAG(ImplicitEnableJacobianRecycling); */ NEW_PROP_TAG(NewtonUseLineSearch); +//! indicate whether the absolute residual should be used in the residual criterion +NEW_PROP_TAG(NewtonEnableAbsoluteResidualCriterion); + //! indicate whether the shift criterion should be used NEW_PROP_TAG(NewtonEnableShiftCriterion); //! the value for the maximum relative shift below which convergence is declared NEW_PROP_TAG(NewtonMaxRelativeShift); +//! the value for the maximum absolute residual below which convergence is declared +NEW_PROP_TAG(NewtonMaxAbsoluteResidual); + //! indicate whether the residual criterion should be used NEW_PROP_TAG(NewtonEnableResidualCriterion); @@ -121,10 +127,12 @@ NEW_PROP_TAG(JacobianAssembler); SET_TYPE_PROP(NewtonMethod, NewtonController, NewtonController); SET_BOOL_PROP(NewtonMethod, NewtonWriteConvergence, false); SET_BOOL_PROP(NewtonMethod, NewtonUseLineSearch, false); +SET_BOOL_PROP(NewtonMethod, NewtonEnableAbsoluteResidualCriterion, false); SET_BOOL_PROP(NewtonMethod, NewtonEnableShiftCriterion, true); SET_BOOL_PROP(NewtonMethod, NewtonEnableResidualCriterion, false); SET_BOOL_PROP(NewtonMethod, NewtonSatisfyResidualAndShiftCriterion, false); SET_SCALAR_PROP(NewtonMethod, NewtonMaxRelativeShift, 1e-8); +SET_SCALAR_PROP(NewtonMethod, NewtonMaxAbsoluteResidual, 1e-5); SET_SCALAR_PROP(NewtonMethod, NewtonResidualReduction, 1e-5); SET_INT_PROP(NewtonMethod, NewtonTargetSteps, 10); SET_INT_PROP(NewtonMethod, NewtonMaxSteps, 18); @@ -174,8 +182,10 @@ public: enableJacobianRecycling_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Implicit, EnableJacobianRecycling); useLineSearch_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, UseLineSearch); + enableAbsoluteResidualCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableAbsoluteResidualCriterion); enableShiftCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableShiftCriterion); - enableResidualCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableResidualCriterion); + enableResidualCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableResidualCriterion) + || enableAbsoluteResidualCriterion_; satisfyResidualAndShiftCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, SatisfyResidualAndShiftCriterion); if (!enableShiftCriterion_ && !enableResidualCriterion_) { @@ -185,6 +195,7 @@ public: } setMaxRelativeShift(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, MaxRelativeShift)); + setMaxAbsoluteResidual(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, MaxAbsoluteResidual)); setResidualReduction(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, ResidualReduction)); setTargetSteps(GET_PARAM_FROM_GROUP(TypeTag, int, Newton, TargetSteps)); setMaxSteps(GET_PARAM_FROM_GROUP(TypeTag, int, Newton, MaxSteps)); @@ -203,6 +214,15 @@ public: void setMaxRelativeShift(Scalar tolerance) { shiftTolerance_ = tolerance; } + /*! + * \brief Set the maximum acceptable absolute residual for declaring convergence. + * + * \param tolerance The maximum absolute residual at which + * the scheme is considered finished + */ + void setMaxAbsoluteResidual(Scalar tolerance) + { residualTolerance_ = tolerance; } + /*! * \brief Set the maximum acceptable residual norm reduction. * @@ -271,17 +291,25 @@ public: } else if (!enableShiftCriterion_ && enableResidualCriterion_) { - return reduction_ <= reductionTolerance_; + if(enableAbsoluteResidualCriterion_) + return residual_ <= residualTolerance_; + else + return reduction_ <= reductionTolerance_; } else if (satisfyResidualAndShiftCriterion_) { - return shift_ <= shiftTolerance_ - && reduction_ <= reductionTolerance_; + if(enableAbsoluteResidualCriterion_) + return shift_ <= shiftTolerance_ + && residual_ <= residualTolerance_; + else + return shift_ <= shiftTolerance_ + && reduction_ <= reductionTolerance_; } else { return shift_ <= shiftTolerance_ - || reduction_ <= reductionTolerance_; + || reduction_ <= reductionTolerance_ + || residual_ <= residualTolerance_; } return false; @@ -344,7 +372,8 @@ public: Scalar shiftAtDof = model_().relativeShiftAtDof(uLastIter[i], uNewI); - shift_ = std::max(shift_, shiftAtDof); + using std::max; + shift_ = max(shift_, shiftAtDof); } if (gridView_().comm().size() > 1) @@ -372,7 +401,8 @@ public: if (gridView_().comm().size() > 1) norm2 = gridView_().comm().sum(norm2); - initialResidual_ = std::sqrt(norm2); + using std::sqrt; + initialResidual_ = sqrt(norm2); } int converged = linearSolver_.solve(A, x, b); @@ -441,10 +471,12 @@ public: newtonUpdateShift(uLastIter, deltaU); // compute the vertex and element colors for partial reassembly + using std::max; + using std::min; if (enablePartialReassemble_) { const Scalar minReasmTol = 1e-2*shiftTolerance_; const Scalar maxReasmTol = 1e1*shiftTolerance_; - Scalar reassembleTol = std::max(minReasmTol, std::min(maxReasmTol, this->shift_/1e4)); + Scalar reassembleTol = max(minReasmTol, min(maxReasmTol, this->shift_/1e4)); //Scalar reassembleTol = minReasmTol; this->model_().jacobianAssembler().updateDiscrepancy(uLastIter, deltaU); @@ -466,7 +498,8 @@ public: if (enableResidualCriterion_) { SolutionVector tmp(uLastIter); - reduction_ = this->method().model().globalResidual(tmp, uCurrentIter); + residual_ = this->method().model().globalResidual(tmp, uCurrentIter); + reduction_ = residual_; reduction_ /= initialResidual_; } } @@ -489,7 +522,9 @@ public: std::cout << "\rNewton iteration " << numSteps_ << " done"; if (enableShiftCriterion_) std::cout << ", maximum relative shift = " << shift_; - if (enableResidualCriterion_) + if (enableResidualCriterion_ && enableAbsoluteResidualCriterion_) + std::cout << ", residual = " << residual_; + else if (enableResidualCriterion_) std::cout << ", residual reduction = " << reduction_; std::cout << endIterMsg().str() << "\n"; } @@ -667,7 +702,8 @@ protected: uCurrentIter += uLastIter; // calculate the residual of the current solution - reduction_ = this->method().model().globalResidual(tmp, uCurrentIter); + residual_ = this->method().model().globalResidual(tmp, uCurrentIter); + reduction_ = residual_; reduction_ /= initialResidual_; if (reduction_ < lastReduction_ || lambda <= 0.125) { @@ -694,9 +730,11 @@ protected: // residual criterion variables Scalar reduction_; + Scalar residual_; Scalar lastReduction_; Scalar initialResidual_; Scalar reductionTolerance_; + Scalar residualTolerance_; // optimal number of iterations we want to achieve int targetSteps_; @@ -711,6 +749,7 @@ protected: bool enablePartialReassemble_; bool enableJacobianRecycling_; bool useLineSearch_; + bool enableAbsoluteResidualCriterion_; bool enableShiftCriterion_; bool enableResidualCriterion_; bool satisfyResidualAndShiftCriterion_; diff --git a/dumux/parallel/vertexhandles.hh b/dumux/parallel/vertexhandles.hh index 219d7a8570d538bbc0dc29bfbad9794fbf4ab755..30abd112145229387b4c910802df32f84a54e839 100644 --- a/dumux/parallel/vertexhandles.hh +++ b/dumux/parallel/vertexhandles.hh @@ -138,7 +138,8 @@ public: FieldType tmp; buff.read(tmp); - container_[vIdx] = std::max(container_[vIdx], tmp); + using std::max; + container_[vIdx] = max(container_[vIdx], tmp); } private: @@ -196,7 +197,8 @@ public: int vIdx = mapper_.index(e); FieldType tmp; buff.read(tmp); - container_[vIdx] = std::min(container_[vIdx], tmp); + using std::min; + container_[vIdx] = min(container_[vIdx], tmp); } private: diff --git a/dumux/porousmediumflow/1p2c/implicit/fluxvariables.hh b/dumux/porousmediumflow/1p2c/implicit/fluxvariables.hh index 1ee1cef6aeab9f40f2d861046002e7d994813051..1cef944861243d34c3ba69415f667096f10f73e5 100644 --- a/dumux/porousmediumflow/1p2c/implicit/fluxvariables.hh +++ b/dumux/porousmediumflow/1p2c/implicit/fluxvariables.hh @@ -416,8 +416,8 @@ protected: if (KmvpNormal_ < 0) { - std::swap(upstreamIdx_, - downstreamIdx_); + using std::swap; + swap(upstreamIdx_, downstreamIdx_); } volumeFlux_ = KmvpNormal_; @@ -508,7 +508,7 @@ protected: GlobalPosition potentialGrad_; //! mole-fraction gradient GlobalPosition moleFractionGrad_; - //! the effective diffusion coefficent in the porous medium + //! the effective diffusion coefficient in the porous medium Scalar porousDiffCoeff_; //! the dispersion tensor in the porous medium diff --git a/dumux/porousmediumflow/1p2c/implicit/localresidual.hh b/dumux/porousmediumflow/1p2c/implicit/localresidual.hh index e6f70adc09bf2cffd2b6235cb0a19ed8941031c0..dde3c9d06bf27eb8393e76f28691d586f782ccb5 100644 --- a/dumux/porousmediumflow/1p2c/implicit/localresidual.hh +++ b/dumux/porousmediumflow/1p2c/implicit/localresidual.hh @@ -218,35 +218,22 @@ public: */ void computeDiffusiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const { - Scalar tmp(0); + // diffusive flux of the transported component + Scalar tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); + tmp *= fluxVars.porousDiffCoeff() * fluxVars.molarDensity(); - // diffusive flux of second component - if(useMoles) // mole-fraction formulation - { - // diffusive flux of the second component - molefraction - tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); - tmp *= fluxVars.porousDiffCoeff() * fluxVars.molarDensity(); - - // dispersive flux of second component - molefraction - GlobalPosition normalDisp; - fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); - tmp -= fluxVars.molarDensity()* - (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); + // dispersive flux of transported component + GlobalPosition normalDisp; + fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); + tmp -= fluxVars.molarDensity()* + (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); + if(useMoles) + { flux[transportEqIdx] += tmp; } - else // mass-fraction formulation + else { - // diffusive flux of the second component - massfraction - tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); - tmp *= fluxVars.porousDiffCoeff() * fluxVars.molarDensity(); - - // dispersive flux of second component - massfraction - GlobalPosition normalDisp; - fluxVars.dispersionTensor().mv(fluxVars.face().normal, normalDisp); - tmp -= fluxVars.molarDensity()* - (normalDisp * fluxVars.moleFractionGrad(transportCompIdx)); - // convert it to a mass flux and add it flux[transportEqIdx] += tmp * FluidSystem::molarMass(transportCompIdx); } diff --git a/dumux/porousmediumflow/1p2c/implicit/model.hh b/dumux/porousmediumflow/1p2c/implicit/model.hh index c772fbae84781bfaec8406010187016b0c719d4c..f25b7d38ab10b3fb3a92a070f08aaa38333ce437 100644 --- a/dumux/porousmediumflow/1p2c/implicit/model.hh +++ b/dumux/porousmediumflow/1p2c/implicit/model.hh @@ -48,8 +48,10 @@ namespace Dumux * Gravity can be enabled or disabled via the property system. * By inserting this into the continuity equation, one gets \f[ - \phi\frac{\partial \varrho}{\partial t} - \text{div} \left\{ + \phi\frac{\partial \varrho}{\partial t} + - \text{div} \left\{ \varrho \frac{\textbf K}{\mu} \left(\textbf{grad}\, p - \varrho {\textbf g} \right) + + \sum_\kappa \varrho D^\kappa_\text{pm} \frac{M^\kappa}{M_\alpha} \textbf{grad} x^\kappa \right\} = q \;, \f] * @@ -168,17 +170,12 @@ public: { writer.attachDofData(*velocity, "velocity", isBox, dim); } - char nameMoleFraction0[42], nameMoleFraction1[42]; - snprintf(nameMoleFraction0, 42, "x_%s", FluidSystem::componentName(0)); - snprintf(nameMoleFraction1, 42, "x_%s", FluidSystem::componentName(1)); - writer.attachDofData(moleFraction0, nameMoleFraction0, isBox); - writer.attachDofData(moleFraction1, nameMoleFraction1, isBox); - - char nameMassFraction0[42], nameMassFraction1[42]; - snprintf(nameMassFraction0, 42, "X_%s", FluidSystem::componentName(0)); - snprintf(nameMassFraction1, 42, "X_%s", FluidSystem::componentName(1)); - writer.attachDofData(massFraction0, nameMassFraction0, isBox); - writer.attachDofData(massFraction1, nameMassFraction1, isBox); + + writer.attachDofData(moleFraction0, "x_" + FluidSystem::componentName(0), isBox); + writer.attachDofData(moleFraction1, "x_" + FluidSystem::componentName(1), isBox); + writer.attachDofData(massFraction0, "X_" + FluidSystem::componentName(0), isBox); + writer.attachDofData(massFraction1, "X_" + FluidSystem::componentName(1), isBox); + writer.attachDofData(rho, "rho", isBox); writer.attachDofData(mu, "mu", isBox); writer.attachCellData(rank, "process rank"); diff --git a/dumux/porousmediumflow/2p/implicit/adaptionhelper.hh b/dumux/porousmediumflow/2p/implicit/adaptionhelper.hh index c69cba7691bfb236c3d741c8db22ec943a543209..40663e15edfb8e2e54e63162d693e98599a0811c 100644 --- a/dumux/porousmediumflow/2p/implicit/adaptionhelper.hh +++ b/dumux/porousmediumflow/2p/implicit/adaptionhelper.hh @@ -16,10 +16,17 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *****************************************************************************/ +/*! + * \file + * + * \brief Base class holding the variables for implicit models. + */ + #ifndef DUMUX_TWOP_ADAPTIONHELPER_HH #define DUMUX_TWOP_ADAPTIONHELPER_HH #include +#include "properties.hh" namespace Dumux { @@ -90,9 +97,9 @@ private: PersistentContainer adaptionMap_; public: - //! Constructs an adaption helper object - /** - * @param gridView a DUNE gridview object + /*! \brief Constructs an adaption helper object + * + * @param problem The current problem */ TwoPAdaptionHelper(Problem& problem) : ParentType(problem), adaptionMap_(problem.grid(), 0) { @@ -101,7 +108,7 @@ public: } /*! - * Store primary variables + * \brief Store primary variables * * To reconstruct the solution in father elements, problem properties might * need to be accessed. @@ -190,7 +197,7 @@ public: } /*! - * Reconstruct missing primary variables (where elements are created/deleted) + * \brief Reconstruct missing primary variables (where elements are created/deleted) * * To reconstruct the solution in father elements, problem properties might * need to be accessed. @@ -288,9 +295,9 @@ public: if (element.hasFather()) { auto eFather = element.father(); - while(eFather.isNew() && eFather.level() > 0) eFather = eFather.father(); - FVElementGeometry fvGeometryFather; - fvGeometryFather.update(problem.gridView(), eFather); + while(eFather.isNew() && eFather.level() > 0) + eFather = eFather.father(); + Scalar massFather = 0.0; if(!isBox) @@ -445,8 +452,9 @@ public: //#endif } - //! Stores sons entries into father element for averaging - /** + /*! + * \brief Stores sons entries into father element for averaging + * * Sum up the adaptedValues (sons values) into father element. We store from leaf * upwards, so sons are stored first, then cells on the next leaf (=fathers) * can be averaged. @@ -471,14 +479,16 @@ public: adaptedValuesFather.associatedMass += adaptedValues.associatedMass; } } - //! Set adapted values in CellData - /** + /*! + * \brief Set adapted values in CellData + * * This methods stores reconstructed values into the cellData object, by * this setting a newly mapped solution to the storage container of the * sequential models. * * \param adaptedValues Container for model-specific values to be adapted * \param u The variables to be stored + * \param scvIdx The SCV (sub-control-volume) index */ static void setAdaptionValues(AdaptedValues& adaptedValues, PrimaryVariables& u, int scvIdx) { diff --git a/dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh b/dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh index 70faf4e2dee7bf85d23c96688e5ecadcd31b318a..0c00d2b6e489df4c092091a964c1acd82026f0d8 100644 --- a/dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh +++ b/dumux/porousmediumflow/2p/implicit/gridadaptindicator.hh @@ -118,8 +118,10 @@ public: } } - globalMin = std::min(satI, globalMin); - globalMax = std::max(satI, globalMax); + using std::min; + using std::max; + globalMin = min(satI, globalMin); + globalMax = max(satI, globalMax); // calculate refinement indicator in all cells for (const auto& intersection : intersections(problem_.gridView(), element)) @@ -159,9 +161,11 @@ public: - Scalar localdelta = std::abs(satI - satJ); - indicatorVector_[globalIdxI][0] = std::max(indicatorVector_[globalIdxI][0], localdelta); - indicatorVector_[globalIdxJ][0] = std::max(indicatorVector_[globalIdxJ][0], localdelta); + using std::abs; + Scalar localdelta = abs(satI - satJ); + using std::max; + indicatorVector_[globalIdxI][0] = max(indicatorVector_[globalIdxI][0], localdelta); + indicatorVector_[globalIdxJ][0] = max(indicatorVector_[globalIdxJ][0], localdelta); } } } @@ -180,6 +184,7 @@ public: // Dune::InteriorBorder_All_Interface, // Dune::ForwardCommunication); // +// using std::max; // refineBound_ = problem_.gridView().comm().max(refineBound_); // coarsenBound_ = problem_.gridView().comm().max(coarsenBound_); // diff --git a/dumux/porousmediumflow/2p/implicit/model.hh b/dumux/porousmediumflow/2p/implicit/model.hh index 5ea13e75476ec0f22cba24a769cf7ff2e334f09d..a24b30ddaf4d77beb730cad6f01c469052cf21d5 100644 --- a/dumux/porousmediumflow/2p/implicit/model.hh +++ b/dumux/porousmediumflow/2p/implicit/model.hh @@ -65,7 +65,7 @@ namespace Dumux * choosing either \f$p_w\f$ and \f$S_n\f$ or \f$p_n\f$ and \f$S_w\f$ * as primary variables. The formulation which ought to be used can be * specified by setting the Formulation property to either - * TwoPCommonIndices::pWsN or TwoPCommonIndices::pNsW. By + * TwoPFormulation::pwsn or TwoPFormulation::pnsw. By * default, the model uses \f$p_w\f$ and \f$S_n\f$. */ template diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressure.hh index f82a284ae079062f6e7de80ac8c60208173cdd46..2720ff510c3b3a33e0f0a1357ec0d2107fcc13c8 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/pressure.hh @@ -266,11 +266,13 @@ public: } if (sat > 1.0) { - maxError_ = std::max(maxError_, (sat - 1.0) / timeStep_); + using std::max; + maxError_ = max(maxError_, (sat - 1.0) / timeStep_); } if (sat < 0.0) { - maxError_ = std::max(maxError_, (-sat) / timeStep_); + using std::max; + maxError_ = max(maxError_, (-sat) / timeStep_); } } } @@ -677,7 +679,8 @@ void FVPressure2P::getStorage(EntryType& entry, const Element& element if (sat < 0.0) {error = sat;} error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs*timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) { diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocityadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocityadaptive.hh index f3407c4bfd6c27af1a7fd14c583a048c4c6a93b9..6935572a3fcb5ffd698aa6e9458bd168ce2021f9 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocityadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocityadaptive.hh @@ -586,7 +586,8 @@ void FVVelocity2PAdaptive::calculateVelocity(const Intersection& inters cellData.fluxData().setVelocity(nPhaseIdx, isIndexI, velocityNw); cellData.fluxData().setVelocityMarker(isIndexI); - Scalar weightingFactor = std::pow(0.5, (dim - 1)*(elementI.level() - elementJ.level())); + using std::pow; + Scalar weightingFactor = pow(0.5, (dim - 1)*(elementI.level() - elementJ.level())); velocityW *= weightingFactor; velocityNw *= weightingFactor; diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh index 9c470abe7451b6219336f6d087a9cc7095f15a02..768490a1a19c51e5d92183c8f50296517f53cf6d 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh @@ -368,7 +368,8 @@ private: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) @@ -495,6 +496,7 @@ void MimeticTwoPLocalStiffness::assembleElementMatrices(const Element& // Brezzi/Lipnikov/Simonicini M3AS 2005 // (1) orthonormalize columns of the matrix R Scalar norm = R[0][0] * R[0][0]; + using std::sqrt; for (unsigned int i = 1; i < numFaces; i++) norm += R[i][0] * R[i][0]; norm = sqrt(norm); @@ -525,6 +527,7 @@ void MimeticTwoPLocalStiffness::assembleElementMatrices(const Element& norm = R[0][2] * R[0][2]; for (unsigned int i = 1; i < numFaces; i++) norm += R[i][2] * R[i][2]; + using std::sqrt; norm = sqrt(norm); for (unsigned int i = 0; i < numFaces; i++) R[i][2] /= norm; diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh index 1b8fbded15c575bcd580e6424f5190aa81dad578..f913e2c6d42b453be91048380c5c423dbd5a24d9 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh @@ -391,7 +391,8 @@ private: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) @@ -522,6 +523,7 @@ void MimeticTwoPLocalStiffnessAdaptive::assembleElementMatrices(const E // Brezzi/Lipnikov/Simonicini M3AS 2005 // (1) orthonormalize columns of the matrix R (Gram-Schmidt orthonormalization) Scalar norm = R[0][0] * R[0][0]; + using std::sqrt; for (int i = 1; i < numFaces; i++) norm += R[i][0] * R[i][0]; norm = sqrt(norm); @@ -552,6 +554,7 @@ void MimeticTwoPLocalStiffnessAdaptive::assembleElementMatrices(const E norm = R[0][2] * R[0][2]; for (int i = 1; i < numFaces; i++) norm += R[i][2] * R[i][2]; + using std::sqrt; norm = sqrt(norm); for (int i = 0; i < numFaces; i++) R[i][2] /= norm; diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh index 0ce383f91b7990e5b15a6ec5fec823ce98da4d43..25f23429daab3c0321fe703d667c5285af673914 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh @@ -132,6 +132,7 @@ template class MimeticPressure2P for (int i = 0; i < size; i++) { Scalar sat = 0; + using std::max; switch (saturationType) { case sw: @@ -143,11 +144,11 @@ template class MimeticPressure2P } if (sat > 1.0) { - maxError = std::max(maxError, (sat - 1.0) / timeStep); + maxError = max(maxError, (sat - 1.0) / timeStep); } if (sat < 0.0) { - maxError = std::max(maxError, (-sat) / timeStep); + maxError = max(maxError, (-sat) / timeStep); } } diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh index 7c0e3b8e305036e4de217d080bcd6eef972bd877..b79b1c712cb4af4ca09fbd8fcea6faed24b7d170 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh @@ -132,6 +132,7 @@ template class MimeticPressure2PAdaptive for (int i = 0; i < size; i++) { Scalar sat = 0; + using std::max; switch (saturationType) { case Sw: @@ -143,11 +144,11 @@ template class MimeticPressure2PAdaptive } if (sat > 1.0) { - maxError = std::max(maxError, (sat - 1.0) / timeStep); + maxError = max(maxError, (sat - 1.0) / timeStep); } if (sat < 0.0) { - maxError = std::max(maxError, (-sat) / timeStep); + maxError = max(maxError, (-sat) / timeStep); } } diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh index 837e142b4b32a5b0df1aff7d905d594a50d58eaf..da288fb8f74b1b0278d1f6717af5abc67debf68f 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh @@ -297,6 +297,7 @@ public: for (int i = 0; i < size; i++) { Scalar sat = 0; + using std::max; switch (saturationType_) { case sw: @@ -308,11 +309,11 @@ public: } if (sat > 1.0) { - maxError_ = std::max(maxError_, (sat - 1.0) / timeStep_); + maxError_ = max(maxError_, (sat - 1.0) / timeStep_); } if (sat < 0.0) { - maxError_ = std::max(maxError_, (-sat) / timeStep_); + maxError_ = max(maxError_, (-sat) / timeStep_); } } @@ -509,7 +510,8 @@ private: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh index 92ca45d8c92605d4cab9b5dc3238690638fa5644..ba214bdd9707afeaba055ed1fe4f77fe21b95778 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh @@ -306,6 +306,7 @@ public: for (int i = 0; i < gridSize; i++) { Scalar sat = 0; + using std::max; switch (saturationType_) { case sw: @@ -317,11 +318,11 @@ public: } if (sat > 1.0) { - maxError_ = std::max(maxError_, (sat - 1.0) / timeStep_); + maxError_ = max(maxError_, (sat - 1.0) / timeStep_); } if (sat < 0.0) { - maxError_ = std::max(maxError_, (-sat) / timeStep_); + maxError_ = max(maxError_, (-sat) / timeStep_); } } @@ -532,7 +533,8 @@ private: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) @@ -636,7 +638,8 @@ void FvMpfaL2dPressure2pAdaptive::initializeMatrix() } // end of intersection loop - rowSize = std::min(rowSize, 13); //in 2-D + using std::min; + rowSize = min(rowSize, 13); //in 2-D // set number of indices in row eIdxGlobalI to rowSize this->A_.setrowsize(eIdxGlobalI, rowSize); diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dtransmissibilitycalculator.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dtransmissibilitycalculator.hh index e2443ccd6edf465dd666bf2c49fa4c8eb211d183..1e5869bb215dccb078b6ffa35cf9a2a9e649356d 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dtransmissibilitycalculator.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dtransmissibilitycalculator.hh @@ -353,8 +353,9 @@ int FvMpfaL2dTransmissibilityCalculator::calculateTransmissibility( Dune::FieldMatrix TL1(D); //selection criterion - Scalar sR = std::abs(TR1[1][2] - TR1[1][0]); - Scalar sL = std::abs(TL1[1][0] - TL1[1][2]); + using std::abs; + Scalar sR = abs(TR1[1][2] - TR1[1][0]); + Scalar sL = abs(TL1[1][0] - TL1[1][2]); // 3.decide which triangle (which transmissibility coefficients) to use if (sR <= sL) diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh index 53f31518fa2920572b5613ea779656314d9b1ab3..a182ebc847b4b65fbda9216b409dec1ef6f94e3e 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh @@ -279,6 +279,7 @@ public: { CellData& cellData = problem_.variables().cellData(i); Scalar sat = 0; + using std::max; switch (saturationType_) { case sw: @@ -290,11 +291,11 @@ public: } if (sat > 1.0) { - maxError_ = std::max(maxError_, (sat - 1.0) / timeStep_); + maxError_ = max(maxError_, (sat - 1.0) / timeStep_); } if (sat < 0.0) { - maxError_ = std::max(maxError_, (-sat) / timeStep_); + maxError_ = max(maxError_, (-sat) / timeStep_); } switch (pressureType_) @@ -356,7 +357,8 @@ public: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dtransmissibilitycalculator.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dtransmissibilitycalculator.hh index ca1f97f6fe07a537962ce016aab8f6ba96d2360b..43c2d80ee0ae9d4b3caedabf0142d9db261a7267 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dtransmissibilitycalculator.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dtransmissibilitycalculator.hh @@ -72,47 +72,43 @@ class FvMpfaL3dTransmissibilityCalculator public: - typedef Dune::FieldMatrix TransmissibilityType;//!< Type of the transmissibility matrix + typedef Dune::FieldMatrix TransmissibilityType;//!< Type of the transmissibility matrix int chooseTransmissibility(TransmissibilityType& transmissibilityOne, TransmissibilityType& transmissibilityTwo, int lTypeOne, int lTypeTwo); - int transmissibility(Dune::FieldMatrix& transmissibility, + int transmissibility(TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx3, int idx4, int idx5, int idx6); - int transmissibility(Dune::FieldMatrix& transmissibility, + int transmissibility(TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx3, int idx4, int idx5, int idx6, Dune::FieldVector &useCases); - - int transmissibilityTPFA(Dune::FieldMatrix& transmissibility, + int transmissibilityTPFA( TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2); - int transmissibilityCaseOne( - Dune::FieldMatrix& transmissibility, + int transmissibilityCaseOne(TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx3, int idx5); - int transmissibilityCaseTwo( - Dune::FieldMatrix& transmissibility, + int transmissibilityCaseTwo(TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx4, int idx6); - int transmissibilityCaseThree( - Dune::FieldMatrix& transmissibility, + + int transmissibilityCaseThree( TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx4, int idx5); - int transmissibilityCaseFour( - Dune::FieldMatrix& transmissibility, + int transmissibilityCaseFour( TransmissibilityType& transmissibility, InteractionVolume& interactionVolume, std::vector& lambda, int idx1, int idx2, int idx3, int idx6); @@ -186,8 +182,9 @@ int FvMpfaL3dTransmissibilityCalculator::chooseTransmissibility(Transmi { if (transCriterion_ == sDiff) { - Scalar sOne = std::abs(transmissibilityOne[0][0] - transmissibilityOne[0][1]); - Scalar sTwo = std::abs(transmissibilityTwo[0][0] - transmissibilityTwo[0][1]); + using std::abs; + Scalar sOne = abs(transmissibilityOne[0][0] - transmissibilityOne[0][1]); + Scalar sTwo = abs(transmissibilityTwo[0][0] - transmissibilityTwo[0][1]); //Decide whether to take case1 or case2 if (sOne < sTwo - transChoiceThreshold_) @@ -204,26 +201,27 @@ int FvMpfaL3dTransmissibilityCalculator::chooseTransmissibility(Transmi Scalar tSumOne = 0; Scalar tSumTwo = 0; + using std::abs; if (lTypeOne == 1) - tSumOne = std::abs(transmissibilityOne[0][0] + transmissibilityOne[0][2] + transmissibilityOne[0][3]); + tSumOne = abs(transmissibilityOne[0][0] + transmissibilityOne[0][2] + transmissibilityOne[0][3]); else if (lTypeOne == 2) - tSumOne = std::abs(transmissibilityOne[0][1] + transmissibilityOne[0][2] + transmissibilityOne[0][3]); + tSumOne = abs(transmissibilityOne[0][1] + transmissibilityOne[0][2] + transmissibilityOne[0][3]); else if (lTypeOne == 3) - tSumOne = std::abs(transmissibilityOne[0][0] + transmissibilityOne[0][3]); + tSumOne = abs(transmissibilityOne[0][0] + transmissibilityOne[0][3]); else if (lTypeOne == 4) - tSumOne = std::abs(transmissibilityOne[0][0] + transmissibilityOne[0][2]); + tSumOne = abs(transmissibilityOne[0][0] + transmissibilityOne[0][2]); else DUNE_THROW(Dune::NotImplemented,"Transmissibility type not implemented"); if (lTypeTwo == 1) - tSumTwo = std::abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][2] + transmissibilityTwo[0][3]); + tSumTwo = abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][2] + transmissibilityTwo[0][3]); else if (lTypeTwo == 2) - tSumTwo = std::abs(transmissibilityTwo[0][1] + transmissibilityTwo[0][2] + transmissibilityTwo[0][3]); + tSumTwo = abs(transmissibilityTwo[0][1] + transmissibilityTwo[0][2] + transmissibilityTwo[0][3]); else if (lTypeTwo == 3) - tSumTwo = std::abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][3]); + tSumTwo = abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][3]); else if (lTypeTwo == 4) - tSumTwo = std::abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][2]); + tSumTwo = abs(transmissibilityTwo[0][0] + transmissibilityTwo[0][2]); else DUNE_THROW(Dune::NotImplemented,"Transmissibility type not implemented"); @@ -957,7 +955,8 @@ int FvMpfaL3dTransmissibilityCalculator::transmissibilityCaseOne( transmissibility = D; - if (std::isnan(transmissibility.frobenius_norm())) + using std::isnan; + if (isnan(transmissibility.frobenius_norm())) { std::cout<<"idx: "<::transmissibilityCaseTwo( transmissibility = D; - if (std::isnan(transmissibility.frobenius_norm())) + using std::isnan; + if (isnan(transmissibility.frobenius_norm())) { std::cout<<"idx: "< 1.0) { - maxError_ = std::max(maxError_, (sat - 1.0) / timeStep_); + maxError_ = max(maxError_, (sat - 1.0) / timeStep_); } if (sat < 0.0) { - maxError_ = std::max(maxError_, (-sat) / timeStep_); + maxError_ = max(maxError_, (-sat) / timeStep_); } } @@ -461,7 +462,8 @@ private: } error /= timeStep_; - Scalar errorAbs = std::abs(error); + using std::abs; + Scalar errorAbs = abs(error); if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_) && (!problem_.timeManager().willBeFinished())) @@ -808,7 +810,8 @@ void FvMpfaO2dPressure2p::storeInteractionVolumeInfo() // compute dF1, the area of quadrilateral made by normal vectors 'nu' DimVector Rnu12(0); R.umv(nu12, Rnu12); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu14 * Rnu12), 0); + using std::abs; + interactionVolumes_[globalVertIdx1234].setDF(abs(nu14 * Rnu12), 0); // handle interior face if (intersection12.neighbor()) @@ -943,15 +946,15 @@ void FvMpfaO2dPressure2p::storeInteractionVolumeInfo() // compute dF2, dF3, dF4 i.e., the area of quadrilateral made by normal vectors 'nu' DimVector Rnu21(0); R.umv(nu21, Rnu21); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu23 * Rnu21), 1); + interactionVolumes_[globalVertIdx1234].setDF(abs(nu23 * Rnu21), 1); DimVector Rnu34(0); R.umv(nu34, Rnu34); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu32 * Rnu34), 2); + interactionVolumes_[globalVertIdx1234].setDF(abs(nu32 * Rnu34), 2); DimVector Rnu43(0); R.umv(nu43, Rnu43); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu41 * Rnu43), 3); + interactionVolumes_[globalVertIdx1234].setDF(abs(nu41 * Rnu43), 3); finished = true; @@ -1059,7 +1062,7 @@ void FvMpfaO2dPressure2p::storeInteractionVolumeInfo() // compute dF2 i.e., the area of quadrilateral made by normal vectors 'nu' DimVector Rnu21(0); R.umv(nu21, Rnu21); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu23 * Rnu21), 1); + interactionVolumes_[globalVertIdx1234].setDF(abs(nu23 * Rnu21), 1); finished = true; @@ -1209,7 +1212,7 @@ void FvMpfaO2dPressure2p::storeInteractionVolumeInfo() // compute dF1, dF3 i.e., the area of quadrilateral made by normal vectors 'nu' DimVector Rnu43(0); R.umv(nu43, Rnu43); - interactionVolumes_[globalVertIdx1234].setDF(fabs(nu41 * Rnu43), 3); + interactionVolumes_[globalVertIdx1234].setDF(abs(nu41 * Rnu43), 3); finished = true; @@ -1550,7 +1553,8 @@ void FvMpfaO2dPressure2p::assemble() pcFluxReal[2] *= fracFlow34; pcFluxReal[3] *= fracFlow14; -// if (std::isnan(pcFluxReal.two_norm())) +// using std::isnan; +// if (isnan(pcFluxReal.two_norm())) // std::cout<<"pcFlux = "< 1e-10) + using std::abs; + if (abs(source[i]) > 1e-10) { indicatorVector_[globalIdxI] = 10; break; @@ -118,8 +119,10 @@ public: break; } - globalMin = std::min(satI, globalMin); - globalMax = std::max(satI, globalMax); + using std::min; + globalMin = min(satI, globalMin); + using std::max; + globalMax = max(satI, globalMax); // calculate refinement indicator in all cells for (const auto& intersection : intersections(problem_.gridView(), element)) @@ -145,7 +148,8 @@ public: bool fluxBound = false; for (int j = 0; j < 2; j++) { - if (std::abs(flux[j]) > 1e-10) + using std::abs; + if (abs(flux[j]) > 1e-10) { if (refineAtFluxBC_) { @@ -189,11 +193,13 @@ public: break; } - Scalar localdelta = std::abs(satI - satJ); - indicatorVector_[globalIdxI][0] = std::max(indicatorVector_[globalIdxI][0], localdelta); - indicatorVector_[globalIdxJ][0] = std::max(indicatorVector_[globalIdxJ][0], localdelta); + using std::abs; + Scalar localdelta = abs(satI - satJ); + using std::max; + indicatorVector_[globalIdxI][0] = max(indicatorVector_[globalIdxI][0], localdelta); + indicatorVector_[globalIdxJ][0] = max(indicatorVector_[globalIdxJ][0], localdelta); - maxLocalDelta = std::max(maxLocalDelta, localdelta); + maxLocalDelta = max(maxLocalDelta, localdelta); } } } diff --git a/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh b/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh index 0adca7a758ee16e6aa545d506135998ceb91131f..3ad50c590ffa1240eb9d88917439db246e773b05 100644 --- a/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh +++ b/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh @@ -178,7 +178,8 @@ public: problem_.sourceAtPos(source, element.geometry().center()); for (int i = 0; i < 2; i++) { - if (std::abs(source[i]) > 1e-10) + using std::abs; + if (abs(source[i]) > 1e-10) { indicatorVector_[globalIdxI] = refineBound_ + 1.0; isSpecialCell = true; @@ -243,7 +244,8 @@ public: * cellDataI.fluxData().velocityTotal(idxInInside)) * intersection.geometry().volume(); //Scalar velNorm = cellDataI.fluxData().velocityTotal(idxInInside).two_norm(); - //indicatorVectorFlux_[globalIdxI] = std::max(velNorm, indicatorVectorFlux_[globalIdxI]); + //using std::max; + //indicatorVectorFlux_[globalIdxI] = max(velNorm, indicatorVectorFlux_[globalIdxI]); } // exit, if it is not a neighbor @@ -262,7 +264,8 @@ public: bool fluxBound = false; for (int j = 0; j < 2; j++) { - if (std::abs(flux[j]) > 1e-10) + using std::abs; + if (abs(flux[j]) > 1e-10) { if (refineAtFluxBC_) { @@ -295,8 +298,10 @@ public: problem_.dirichlet(sat, intersection); satJ = sat[eqIdxSat]; } - Scalar localdelta = std::abs(satI - satJ); - indicatorVectorSat_[globalIdxI] = std::max(indicatorVectorSat_[globalIdxI], localdelta); + using std::abs; + Scalar localdelta = abs(satI - satJ); + using std::max; + indicatorVectorSat_[globalIdxI] = max(indicatorVectorSat_[globalIdxI], localdelta); } } else @@ -317,8 +322,10 @@ public: break; } - Scalar localdelta = std::abs(satI - satJ); - indicatorVectorSat_[globalIdxI] = std::max(indicatorVectorSat_[globalIdxI], localdelta); + using std::abs; + Scalar localdelta = abs(satI - satJ); + using std::max; + indicatorVectorSat_[globalIdxI] = max(indicatorVectorSat_[globalIdxI], localdelta); } } } @@ -365,7 +372,8 @@ public: elementVelocity /= geometry.integrationElement(localPos); Scalar velNorm = elementVelocity.two_norm(); - indicatorVectorFlux_[globalIdxI] = std::max(velNorm, indicatorVectorFlux_[globalIdxI]); + using std::max; + indicatorVectorFlux_[globalIdxI] = max(velNorm, indicatorVectorFlux_[globalIdxI]); } @@ -414,7 +422,8 @@ public: if (usePercentileSat_) { - Scalar lowerBound = std::max(0.0,coarsenPercentileSat_ * totalVolumeSat); + using std::max; + Scalar lowerBound = max(0.0,coarsenPercentileSat_ * totalVolumeSat); Scalar accumulatedVolume = 0; while (accumulatedVolume <= lowerBound && it != satRange.end()) @@ -450,7 +459,8 @@ public: if (usePercentileFlux_) { - Scalar lowerBound = std::max(0.0,coarsenPercentileFlux_ * totalVolume); + using std::max; + Scalar lowerBound = max(0.0,coarsenPercentileFlux_ * totalVolume); Scalar accumulatedVolume = 0; while (accumulatedVolume <= lowerBound && it != fluxRange.end()) { @@ -471,7 +481,8 @@ public: { typename RangeSet::reverse_iterator rIt = satRange.rbegin(); - Scalar upperBound = std::max(0.0, refinePercentileSat_ * totalVolumeSat); + using std::max; + Scalar upperBound = max(0.0, refinePercentileSat_ * totalVolumeSat); Scalar accumulatedVolume = 0; while (accumulatedVolume <= upperBound && (*rIt).indicator > 1e-6 && rIt != satRange.rend()) @@ -495,7 +506,8 @@ public: if (usePercentileFlux_) { - Scalar upperBound = std::min(totalVolume, refinePercentileFlux_ * totalVolume); + using std::min; + Scalar upperBound = min(totalVolume, refinePercentileFlux_ * totalVolume); Scalar accumulatedVolume = 0; while (accumulatedVolume <= upperBound && rIt != fluxRange.rend()) { diff --git a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxcoats.hh b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxcoats.hh index c3cc2ae77d59c2037f04f844d6ae3b2d4393bc0a..625e6f0ef96d1139425e259c982ddb0986e748d4 100644 --- a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxcoats.hh +++ b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxcoats.hh @@ -130,10 +130,13 @@ public: if (rejectForTimeStepping_) return 0.99 / cflFluxDefault; - if (std::isnan(cflFluxFunctionCoatsOut_) || std::isinf(cflFluxFunctionCoatsOut_)){cflFluxFunctionCoatsOut_ = 0.0;} - if (std::isnan(cflFluxFunctionCoatsIn_) || std::isinf(cflFluxFunctionCoatsIn_)){cflFluxFunctionCoatsIn_ = 0.0;} + using std::isnan; + using std::isinf; + if (isnan(cflFluxFunctionCoatsOut_) || isinf(cflFluxFunctionCoatsOut_)){cflFluxFunctionCoatsOut_ = 0.0;} + if (isnan(cflFluxFunctionCoatsIn_) || isinf(cflFluxFunctionCoatsIn_)){cflFluxFunctionCoatsIn_ = 0.0;} - Scalar cflFluxFunctionCoats = std::max(cflFluxFunctionCoatsIn_, cflFluxFunctionCoatsOut_); + using std::max; + Scalar cflFluxFunctionCoats = max(cflFluxFunctionCoatsIn_, cflFluxFunctionCoatsOut_); if (cflFluxFunctionCoats <= 0) { @@ -155,7 +158,8 @@ public: */ Scalar getDt(const Element& element) { - Scalar porosity = std::max(problem_.spatialParams().porosity(element), porosityThreshold_); + using std::max; + Scalar porosity = max(problem_.spatialParams().porosity(element), porosityThreshold_); return (getCflFluxFunction(element) * porosity * element.geometry().volume()); } @@ -188,7 +192,11 @@ public: private: Scalar getCflFluxFunctionDefault() { - if (std::isnan(fluxIn_) || std::isinf(fluxIn_)) + using std::isnan; + using std::isinf; + using std::max; + + if (isnan(fluxIn_) || isinf(fluxIn_)) { fluxIn_ = 1e-100; } @@ -200,7 +208,7 @@ private: if (velocityType_ == vt) { - if (std::isnan(fluxOut_) || std::isinf(fluxOut_)) + if (isnan(fluxOut_) || isinf(fluxOut_)) { fluxOut_ = 1e-100; } @@ -209,21 +217,21 @@ private: } else { - if (std::isnan(fluxWettingOut_) || std::isinf(fluxWettingOut_)) + if (isnan(fluxWettingOut_) || isinf(fluxWettingOut_)) { fluxWettingOut_ = 1e-100; } - if (std::isnan(fluxNonwettingOut_) || std::isinf(fluxNonwettingOut_)) + if (isnan(fluxNonwettingOut_) || isinf(fluxNonwettingOut_)) { fluxNonwettingOut_ = 1e-100; } - cFLFluxOut = std::max(fluxWettingOut_, fluxNonwettingOut_); + cFLFluxOut = max(fluxWettingOut_, fluxNonwettingOut_); } //determine timestep - Scalar cFLFluxFunction = std::max(cFLFluxIn, cFLFluxOut); + Scalar cFLFluxFunction = max(cFLFluxIn, cFLFluxOut); return cFLFluxFunction; } @@ -386,7 +394,8 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, GlobalPosition distVec = globalPosNeighbor - globalPos; // compute distance between cell centers - Scalar dist = std::abs(distVec * unitOuterNormal); + using std::abs; + Scalar dist = abs(distVec * unitOuterNormal); Scalar satJ = cellDataJ.saturation(wPhaseIdx); Scalar lambdaWJ = cellDataI.mobility(wPhaseIdx); @@ -413,13 +422,14 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar transmissibility = meanPermeability * intersection.geometry().volume() / dist; Scalar satUpw = 0; + using std::max; if (upwindWI) { - satUpw = std::max(satI, 0.0); + satUpw = max(satI, 0.0); } else { - satUpw = std::max(satJ, 0.0); + satUpw = max(satJ, 0.0); } Scalar ds = epsDerivative_; @@ -432,17 +442,17 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, ds += epsDerivative_; } - Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), std::abs(satPlus)) / viscosityW; - dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), std::abs(satMinus)) / viscosityW; + Scalar dLambdaWDs = MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), abs(satPlus)) / viscosityW; + dLambdaWDs -= MaterialLaw::krw(problem_.spatialParams().materialLawParams(neighbor), abs(satMinus)) / viscosityW; dLambdaWDs /= (ds); if (upwindNwI) { - satUpw = std::max(1 - satI, 0.0); + satUpw = max(1 - satI, 0.0); } else { - satUpw = std::max(1 - satJ, 0.0); + satUpw = max(1 - satJ, 0.0); } ds = epsDerivative_; @@ -463,10 +473,10 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar lambdaNwCap = 0.5 * (lambdaNwI + lambdaNwJ); Scalar potentialDiff = cellDataI.potential(wPhaseIdx) - cellDataJ.potential(wPhaseIdx); - Scalar cflFlux = transmissibility * lambdaNw * dLambdaWDs * std::abs(potentialDiff) / lambdaT; + Scalar cflFlux = transmissibility * lambdaNw * dLambdaWDs * abs(potentialDiff) / lambdaT; potentialDiff = cellDataI.potential(nPhaseIdx) - cellDataJ.potential(nPhaseIdx); - cflFlux -= transmissibility * lambdaW * dLambdaNwDs * std::abs(potentialDiff) / lambdaT; + cflFlux -= transmissibility * lambdaW * dLambdaNwDs * abs(potentialDiff) / lambdaT; cflFlux -= transmissibility * lambdaWCap * lambdaNwCap * (dpc_dsI + dpc_dsJ) / lambdaT; @@ -606,21 +616,23 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, bcValues[wPhaseIdx] *= faceArea; bcValues[nPhaseIdx] *= faceArea; + using std::abs; + if (bcValues[wPhaseIdx] > 0) { - cflFluxFunctionCoatsOut_ += std::abs(bcValues[wPhaseIdx]); + cflFluxFunctionCoatsOut_ += abs(bcValues[wPhaseIdx]); } else { - cflFluxFunctionCoatsIn_ += std::abs(bcValues[wPhaseIdx]); + cflFluxFunctionCoatsIn_ += abs(bcValues[wPhaseIdx]); } if (bcValues[nPhaseIdx] > 0) { - cflFluxFunctionCoatsOut_ += std::abs(bcValues[nPhaseIdx]); + cflFluxFunctionCoatsOut_ += abs(bcValues[nPhaseIdx]); } else { - cflFluxFunctionCoatsIn_ += std::abs(bcValues[nPhaseIdx]); + cflFluxFunctionCoatsIn_ += abs(bcValues[nPhaseIdx]); } return; @@ -652,13 +664,14 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, lambdaNwBound = MaterialLaw::krn(problem_.spatialParams().materialLawParams(element), satWBound) / viscosityNwBound; Scalar satUpw = 0; + using std::max; if (cellDataI.fluxData().isUpwindCell(wPhaseIdx, indexInInside)) { - satUpw = std::max(satI, 0.0); + satUpw = max(satI, 0.0); } else { - satUpw = std::max(satWBound, 0.0); + satUpw = max(satWBound, 0.0); } Scalar ds = epsDerivative_; @@ -677,11 +690,11 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, if (cellDataI.fluxData().isUpwindCell(nPhaseIdx, indexInInside)) { - satUpw = std::max(1 - satI, 0.0); + satUpw = max(1 - satI, 0.0); } else { - satUpw = std::max(1 - satWBound, 0.0); + satUpw = max(1 - satWBound, 0.0); } ds = epsDerivative_; @@ -702,12 +715,13 @@ void EvalCflFluxCoats::addCoatsFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar lambdaNwCap = 0.5 * (lambdaNwI + lambdaNwBound); Scalar potDiff = cellDataI.potential(wPhaseIdx) - potWBound; - Scalar cflFlux = transmissibility * lambdaNw * dLambdaWDs * std::abs(potDiff) / lambdaT; + using std::abs; + Scalar cflFlux = transmissibility * lambdaNw * dLambdaWDs * abs(potDiff) / lambdaT; cflFlux -= transmissibility * lambdaWCap * lambdaNwCap * (dpc_dsI + dpc_dsBound) / lambdaT; potDiff = cellDataI.potential(nPhaseIdx) - potNwBound; - cflFlux -= transmissibility * lambdaW * dLambdaNwDs * std::abs(potDiff) / lambdaT; + cflFlux -= transmissibility * lambdaW * dLambdaNwDs * abs(potDiff) / lambdaT; if ((cellDataI.fluxData().isUpwindCell(wPhaseIdx, indexInInside) && lambdaW > threshold_) || (cellDataI.fluxData().isUpwindCell(nPhaseIdx, indexInInside) && lambdaW < threshold_)) diff --git a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxdefault.hh b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxdefault.hh index de71ee253dda811e0b7516a1822315664c0396dd..d32f9f858d35aa1cb6745f13ebca28b7b7bcfe0b 100644 --- a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxdefault.hh +++ b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/evalcflfluxdefault.hh @@ -93,7 +93,8 @@ public: */ Scalar getDt(const Element& element) { - Scalar porosity = std::max(problem_.spatialParams().porosity(element), porosityThreshold_); + using std::max; + Scalar porosity = max(problem_.spatialParams().porosity(element), porosityThreshold_); return (getCflFluxFunction(element) * porosity * element.geometry().volume()); } @@ -122,9 +123,10 @@ private: void addFlux(Scalar& lambdaW, Scalar& lambdaNw, Scalar& viscosityW, Scalar& viscosityNw, Scalar flux, int phaseIdx = -1) { + using std::abs; Scalar krSum = lambdaW * viscosityW + lambdaNw * viscosityNw; - Scalar viscosityRatio = 1 - fabs(0.5 - viscosityNw / (viscosityW + viscosityNw)); - //1 - fabs(viscosityWI-viscosityNwI)/(viscosityWI+viscosityNwI); + Scalar viscosityRatio = 1 - abs(0.5 - viscosityNw / (viscosityW + viscosityNw)); + //1 - abs(viscosityWI-viscosityNwI)/(viscosityWI+viscosityNwI); switch (phaseIdx) { @@ -175,7 +177,9 @@ private: Scalar getCFLFluxIn(int phaseIdx = 0) { - if (std::isnan(fluxIn_) || std::isinf(fluxIn_)) + using std::isnan; + using std::isinf; + if (isnan(fluxIn_) || isinf(fluxIn_)) { fluxIn_ = 1e-100; } @@ -185,16 +189,18 @@ private: Scalar getCFLFluxOut(int phaseIdx = 0) { - if (std::isnan(fluxWettingOut_) || std::isinf(fluxWettingOut_)) + using std::isnan; + using std::isinf; + if (isnan(fluxWettingOut_) || isinf(fluxWettingOut_)) { fluxWettingOut_ = 1e-100; } - if (std::isnan(fluxNonwettingOut_) || std::isinf(fluxNonwettingOut_)) + if (isnan(fluxNonwettingOut_) || isinf(fluxNonwettingOut_)) { fluxNonwettingOut_ = 1e-100; } - if (std::isnan(fluxOut_) || std::isinf(fluxOut_)) + if (isnan(fluxOut_) || isinf(fluxOut_)) { fluxOut_ = 1e-100; } @@ -229,9 +235,10 @@ typename EvalCflFluxDefault::Scalar EvalCflFluxDefault::getCfl Scalar volumeCorrectionFactorOutW = 0; Scalar volumeCorrectionFactorOutNw = 0; - Scalar satW = problem_.variables().cellData(problem_.variables().index(element)).saturation(wPhaseIdx); - volumeCorrectionFactorOutW = std::max((satW - residualSatW), 1e-2); - volumeCorrectionFactorOutNw = std::max((1 - satW - residualSatNw), 1e-2); + Scalar satW = problem_.variables().cellData(problem_.variables().index(element)).saturation(wPhaseIdx); + using std::max; + volumeCorrectionFactorOutW = max((satW - residualSatW), 1e-2); + volumeCorrectionFactorOutNw = max((1 - satW - residualSatNw), 1e-2); //make sure correction is in the right range. If not: force dt to be not min-dt! if (volumeCorrectionFactorOutW <= 0) @@ -247,18 +254,19 @@ typename EvalCflFluxDefault::Scalar EvalCflFluxDefault::getCfl Scalar cFLFluxIn = volumeCorrectionFactor / getCFLFluxIn(); Scalar cFLFluxOut = 0; + using std::min; if (velocityType_ == vt) { cFLFluxOut = volumeCorrectionFactor / getCFLFluxOut(-1); } else { - cFLFluxOut = std::min(volumeCorrectionFactorOutW / getCFLFluxOut(wPhaseIdx), + cFLFluxOut = min(volumeCorrectionFactorOutW / getCFLFluxOut(wPhaseIdx), volumeCorrectionFactorOutNw / getCFLFluxOut(nPhaseIdx)); } //determine timestep - Scalar cFLFluxFunction = std::min(cFLFluxIn, cFLFluxOut); + Scalar cFLFluxFunction = min(cFLFluxIn, cFLFluxOut); return cFLFluxFunction; } diff --git a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/saturation.hh b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/saturation.hh index 75adb9acb36af0763ab992477e770263e9e28574..5a9453d02427f5502e9138e6509306dabe8f88ef 100644 --- a/dumux/porousmediumflow/2p/sequential/transport/cellcentered/saturation.hh +++ b/dumux/porousmediumflow/2p/sequential/transport/cellcentered/saturation.hh @@ -542,7 +542,8 @@ void FVSaturation2P::getFlux(Scalar& update, const Intersection& inters // cell volume, assume linear map here Scalar volume = elementI.geometry().volume(); - Scalar porosity = std::max(problem_.spatialParams().porosity(elementI), porosityThreshold_); + using std::max; + Scalar porosity = max(problem_.spatialParams().porosity(elementI), porosityThreshold_); if (compressibility_) { @@ -732,7 +733,8 @@ void FVSaturation2P::getFluxOnBoundary(Scalar& update, const Intersecti // cell volume, assume linear map here Scalar volume = elementI.geometry().volume(); - Scalar porosity = std::max(problem_.spatialParams().porosity(elementI), porosityThreshold_); + using std::max; + Scalar porosity = max(problem_.spatialParams().porosity(elementI), porosityThreshold_); if (compressibility_) { @@ -1034,7 +1036,8 @@ void FVSaturation2P::getSource(Scalar& update, const Element& element, // cell volume, assume linear map here Scalar volume = element.geometry().volume(); - Scalar porosity = std::max(problem_.spatialParams().porosity(element), porosityThreshold_); + using std::max; + Scalar porosity = max(problem_.spatialParams().porosity(element), porosityThreshold_); if (compressibility_) { diff --git a/dumux/porousmediumflow/2p/sequential/transport/problem.hh b/dumux/porousmediumflow/2p/sequential/transport/problem.hh index 2c5be220c6162c8393a5ecd37e534d485c9b1374..7e53bf5a88f6b7675c6727b71b23e84fec182a20 100644 --- a/dumux/porousmediumflow/2p/sequential/transport/problem.hh +++ b/dumux/porousmediumflow/2p/sequential/transport/problem.hh @@ -220,7 +220,8 @@ public: this->model().update(t, dt, updateVector); //make sure t_old + dt is not larger than tend - dt = std::min(dt*cFLFactor_, this->timeManager().episodeMaxTimeStepSize()); + using std::min; + dt = min(dt*cFLFactor_, this->timeManager().episodeMaxTimeStepSize()); this->timeManager().setTimeStepSize(dt); // explicit Euler: Sat <- Sat + dt*N(Sat) diff --git a/dumux/porousmediumflow/2p1c/implicit/model.hh b/dumux/porousmediumflow/2p1c/implicit/model.hh index 0ec78078c25bc6ad6d20375d57715ea7fcff2146..54eed461568d3e8de952ce84f8363a794ae26248 100644 --- a/dumux/porousmediumflow/2p1c/implicit/model.hh +++ b/dumux/porousmediumflow/2p1c/implicit/model.hh @@ -127,38 +127,25 @@ public: setSwitched_(false); - if (isBox) - { - for(const auto& vertex: vertices(this->gridView_())) - { - int globalIdx = this->dofMapper().index(vertex); - const GlobalPosition &globalPos = vertex.geometry().corner(0); - - // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(vertex, globalIdx, - globalPos); - staticDat_[globalIdx].wasSwitched = false; + FVElementGeometry fvGeometry; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; - } - } - else + for (const auto& element : elements(this->gridView_())) { - for (const auto& element : elements(this->gridView_())) + // deal with the current element + fvGeometry.update(this->gridView_(), element); + + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int globalIdx = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(*this->gridView_().template begin (), - globalIdx, globalPos); - staticDat_[globalIdx].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } diff --git a/dumux/porousmediumflow/2p2c/implicit/indices.hh b/dumux/porousmediumflow/2p2c/implicit/indices.hh index a3518b278f61657d7b40b595e81bac303f8b01f8..ef95192a2be6ca08c298838dec15a25e073ff0ed 100644 --- a/dumux/porousmediumflow/2p2c/implicit/indices.hh +++ b/dumux/porousmediumflow/2p2c/implicit/indices.hh @@ -38,8 +38,10 @@ namespace Dumux */ struct TwoPTwoCFormulation { - static const int pwsn = 0; //!< pw and sn as primary variables - static const int pnsw = 1; //!< pn and sw as primary variables + enum { + pnsw, + pwsn + }; }; /*! @@ -47,12 +49,9 @@ struct TwoPTwoCFormulation * \ingroup ImplicitIndices * \brief The indices for the isothermal two-phase two-component model. * - * \tparam formulation The formulation, either pwsn or pnsw. * \tparam PVOffset The first index in a primary variable vector. */ -template +template class TwoPTwoCIndices { typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; @@ -67,55 +66,8 @@ public: static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase // present phases (-> 'pseudo' primary variable) - static const int wPhaseOnly = 1; //!< Only the wetting phase is present - static const int nPhaseOnly = 0; //!< Only the non-wetting phase is present - static const int bothPhases = 2; //!< Both phases are present - - // Primary variable indices - //! Index for wetting/non-wetting phase pressure (depending on the formulation) in a solution vector - static const int pressureIdx = PVOffset + 0; - //! Index of either the saturation or the mass fraction of the non-wetting/wetting phase - static const int switchIdx = PVOffset + 1; - - //! Index for wetting phase pressure in a solution vector - static const int pwIdx = pressureIdx; - //! Index of either the saturation of the non-wetting phase or the mass fraction secondary component in the only phase - static const int snOrXIdx = switchIdx; - - // equation indices - //! Index of the mass conservation equation for the first component - static const int conti0EqIdx = PVOffset; - //! Index of the mass conservation equation for the primary component of the wetting phase - static const int contiWEqIdx = conti0EqIdx + wCompIdx; - //! Index of the mass conservation equation for the primary component of the non-wetting phase - static const int contiNEqIdx = conti0EqIdx + nCompIdx; -}; - -/*! - * \ingroup TwoPTwoCModel - * \ingroup ImplicitIndices - * \brief The indices for the isothermal two-phase two-component model in the pn-sw - * formulation. - * - * \tparam PVOffset The first index in a primary variable vector. - */ -template -class TwoPTwoCIndices -{ - typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - -public: - // Phase indices - static const int wPhaseIdx = FluidSystem::wPhaseIdx; //!< Index of the wetting phase - static const int nPhaseIdx = FluidSystem::nPhaseIdx; //!< Index of the non-wetting phase - - // Component indices - static const int wCompIdx = FluidSystem::wCompIdx; //!< Index of the primary component of the wetting phase - static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase - - // present phases (-> 'pseudo' primary variable) - static const int wPhaseOnly = 1; //!< Only the wetting phase is present - static const int nPhaseOnly = 2; //!< Only the non-wetting phase is present + static const int wPhaseOnly = 1; //!< Only the non-wetting phase is present + static const int nPhaseOnly = 2; //!< Only the wetting phase is present static const int bothPhases = 3; //!< Both phases are present // Primary variable indices @@ -124,12 +76,7 @@ public: //! Index of either the saturation or the mass fraction of the non-wetting/wetting phase static const int switchIdx = PVOffset + 1; - //! Index for non-wetting phase pressure in a solution vector - static const int pnIdx = pressureIdx; - //! Index of either the saturation of the liquid phase or the mass fraction of the secondary component in the only phase - static const int swOrXIdx = switchIdx; - - // Equation indices + // equation indices //! Index of the mass conservation equation for the first component static const int conti0EqIdx = PVOffset; //! Index of the mass conservation equation for the primary component of the wetting phase @@ -138,8 +85,6 @@ public: static const int contiNEqIdx = conti0EqIdx + nCompIdx; }; -// \} - } #endif diff --git a/dumux/porousmediumflow/2p2c/implicit/localresidual.hh b/dumux/porousmediumflow/2p2c/implicit/localresidual.hh index 128feb7e643798d8159cbfecefeebd06d2d60cfd..aa0f5863e591143929778220de111db27bb525ed 100644 --- a/dumux/porousmediumflow/2p2c/implicit/localresidual.hh +++ b/dumux/porousmediumflow/2p2c/implicit/localresidual.hh @@ -362,10 +362,9 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) if(useMoles) // mole-fraction formulation { // add diffusive flux of gas component in liquid phase - Scalar tmp = - (fluxVars.moleFractionGrad(wPhaseIdx)*fluxVars.face().normal); - tmp *= - fluxVars.porousDiffCoeff(wPhaseIdx) * - fluxVars.molarDensity(wPhaseIdx); + Scalar tmp = -(fluxVars.moleFractionGrad(wPhaseIdx)*fluxVars.face().normal) + * fluxVars.porousDiffCoeff(wPhaseIdx) + * fluxVars.molarDensity(wPhaseIdx); // add the diffusive fluxes only to the component mass balance if (replaceCompEqIdx != contiNEqIdx) flux[contiNEqIdx] += tmp; @@ -373,10 +372,9 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) flux[contiWEqIdx] -= tmp; // add diffusive flux of liquid component in non-wetting phase - tmp = -(fluxVars.moleFractionGrad(nPhaseIdx)*fluxVars.face().normal); - tmp *= - fluxVars.porousDiffCoeff(nPhaseIdx) * - fluxVars.molarDensity(nPhaseIdx); + tmp = -(fluxVars.moleFractionGrad(nPhaseIdx)*fluxVars.face().normal) + * fluxVars.porousDiffCoeff(nPhaseIdx) + * fluxVars.molarDensity(nPhaseIdx); // add the diffusive fluxes only to the component mass balance if (replaceCompEqIdx != contiWEqIdx) flux[contiWEqIdx] += tmp; @@ -385,27 +383,43 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) } else // mass-fraction formulation { - // add diffusive flux of gas component in liquid phase - Scalar tmp = - (fluxVars.moleFractionGrad(wPhaseIdx)*fluxVars.face().normal); - tmp *= - fluxVars.porousDiffCoeff(wPhaseIdx) * - fluxVars.molarDensity(wPhaseIdx); - // add the diffusive fluxes only to the component mass balance - if (replaceCompEqIdx != contiNEqIdx) - flux[contiNEqIdx] += tmp * FluidSystem::molarMass(nCompIdx); + // add diffusive flux of gas component in wetting phase + Scalar tmp = -(fluxVars.moleFractionGrad(wPhaseIdx)*fluxVars.face().normal) + * fluxVars.porousDiffCoeff(wPhaseIdx) + * fluxVars.molarDensity(wPhaseIdx); + // add the diffusive fluxes to the component mass balance and total mass balance + if (replaceCompEqIdx < numComponents) + { + flux[replaceCompEqIdx] += tmp * FluidSystem::molarMass(nCompIdx); + flux[replaceCompEqIdx] -= tmp * FluidSystem::molarMass(wCompIdx); + } if (replaceCompEqIdx != contiWEqIdx) + { flux[contiWEqIdx] -= tmp * FluidSystem::molarMass(wCompIdx); + } + if (replaceCompEqIdx != contiNEqIdx) + { + flux[contiNEqIdx] += tmp * FluidSystem::molarMass(nCompIdx); + } - // add diffusive flux of liquid component in non-wetting phase - tmp = -(fluxVars.moleFractionGrad(nPhaseIdx)*fluxVars.face().normal); - tmp *= - fluxVars.porousDiffCoeff(nPhaseIdx) * - fluxVars.molarDensity(nPhaseIdx); - // add the diffusive fluxes only to the component mass balance + // add diffusive fluxes of liquid component in non-wetting phase + tmp = -(fluxVars.moleFractionGrad(nPhaseIdx)*fluxVars.face().normal) + * fluxVars.porousDiffCoeff(nPhaseIdx) + * fluxVars.molarDensity(nPhaseIdx); + // add the diffusive fluxes to the component mass balance and total mass balance + if (replaceCompEqIdx < numComponents) + { + flux[replaceCompEqIdx] += tmp * FluidSystem::molarMass(wCompIdx); + flux[replaceCompEqIdx] -= tmp * FluidSystem::molarMass(nCompIdx); + } if (replaceCompEqIdx != contiWEqIdx) + { flux[contiWEqIdx] += tmp * FluidSystem::molarMass(wCompIdx); + } if (replaceCompEqIdx != contiNEqIdx) + { flux[contiNEqIdx] -= tmp * FluidSystem::molarMass(nCompIdx); + } } } diff --git a/dumux/porousmediumflow/2p2c/implicit/model.hh b/dumux/porousmediumflow/2p2c/implicit/model.hh index 3a1701f3e0376ec89bef52aeb384694cda981de2..7a60f7244270ceae9773a28b1289a6f3f04cf641 100644 --- a/dumux/porousmediumflow/2p2c/implicit/model.hh +++ b/dumux/porousmediumflow/2p2c/implicit/model.hh @@ -71,7 +71,7 @@ namespace Dumux * The used primary variables are, like in the two-phase model, either \f$p_w\f$ and \f$S_n\f$ * or \f$p_n\f$ and \f$S_w\f$. The formulation which ought to be used can be * specified by setting the Formulation property to either - * TwoPTwoCIndices::pWsN or TwoPTwoCIndices::pNsW. By + * TwoPTwoCFormulation::pwsn or TwoPTwoCFormulation::pnsw. By * default, the model uses \f$p_w\f$ and \f$S_n\f$. * Moreover, the second primary variable depends on the phase state, since a * primary variable switch is included. The phase state is stored for all nodes @@ -145,48 +145,33 @@ public: */ void init(Problem &problem) { - ParentType::init(problem); + static_assert(numComponents < 3, "This model is restricted to 2 components! You may use the 2pnc model instead."); - unsigned numDofs = this->numDofs(); + ParentType::init(problem); - staticDat_.resize(numDofs); + staticDat_.resize(this->numDofs()); setSwitched_(false); - // check, if velocity output can be used (works only for cubes so far) + FVElementGeometry fvGeometry; + for (const auto& element : elements(this->gridView_())) { - if (!isBox) // i.e. cell-centered discretization - { - int eIdxGlobal = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); - - // initialize phase presence - staticDat_[eIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(*(this->gridView_().template begin()), - eIdxGlobal, globalPos); - staticDat_[eIdxGlobal].wasSwitched = false; - - staticDat_[eIdxGlobal].oldPhasePresence - = staticDat_[eIdxGlobal].phasePresence; - } - } + // deal with the current element + fvGeometry.update(this->gridView_(), element); - if (isBox) // i.e. vertex-centered discretization - { - for (const auto& vertex : vertices(this->gridView_())) + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int vIdxGlobal = this->dofMapper().index(vertex); - const GlobalPosition &globalPos = vertex.geometry().corner(0); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[vIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(vertex, vIdxGlobal, - globalPos); - staticDat_[vIdxGlobal].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[vIdxGlobal].oldPhasePresence - = staticDat_[vIdxGlobal].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } @@ -615,7 +600,7 @@ public: if (xww + xwn > xwMax) { // wetting phase appears - std::cout << "wetting phase appears at vertex " << dofIdxGlobal + std::cout << "Wetting phase appears at vertex " << dofIdxGlobal << ", coordinates: " << globalPos << ", xww + xwn: " << xww + xwn << std::endl; newPhasePresence = bothPhases; @@ -643,7 +628,7 @@ public: if (xnw + xnn > xgMax) { // nonwetting phase appears - std::cout << "nonwetting phase appears at vertex " << dofIdxGlobal + std::cout << "Nonwetting phase appears at vertex " << dofIdxGlobal << ", coordinates: " << globalPos << ", xnw + xnn: " << xnw + xnn << std::endl; newPhasePresence = bothPhases; diff --git a/dumux/porousmediumflow/2p2c/implicit/properties.hh b/dumux/porousmediumflow/2p2c/implicit/properties.hh index aa494f5df69d08fc616179888ae60665c5589f39..ddca6ae7db9409b1edac6448c313c28a317011f7 100644 --- a/dumux/porousmediumflow/2p2c/implicit/properties.hh +++ b/dumux/porousmediumflow/2p2c/implicit/properties.hh @@ -71,6 +71,7 @@ NEW_PROP_TAG(EffectiveDiffusivityModel); //!< The employed model for the computa NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem NEW_PROP_TAG(UseMoles); //!< Defines whether mole (true) or mass (false) fractions are used NEW_PROP_TAG(UseConstraintSolver); //!< Determines whether the constraint solver should be used +NEW_PROP_TAG(UseKelvinEquation); //!< Determines whether the Kelvin equation is used NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the upwind weight for the mass conservation equations NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility in the velocity calculation diff --git a/dumux/porousmediumflow/2p2c/implicit/propertydefaults.hh b/dumux/porousmediumflow/2p2c/implicit/propertydefaults.hh index 23653d9a0c0a6436dede94627edb1c2711250906..4158ef3dbdf9d336a63569ee295d871804236fb3 100644 --- a/dumux/porousmediumflow/2p2c/implicit/propertydefaults.hh +++ b/dumux/porousmediumflow/2p2c/implicit/propertydefaults.hh @@ -147,23 +147,14 @@ SET_SCALAR_PROP(TwoPTwoC, ImplicitMassUpwindWeight, 1.0); SET_SCALAR_PROP(TwoPTwoC, ImplicitMobilityUpwindWeight, 1.0); //! Set the indices required by the isothermal 2p2c -SET_PROP(TwoPTwoC, Indices) -{ private: - enum { Formulation = GET_PROP_VALUE(TypeTag, Formulation) }; - public: - typedef TwoPTwoCIndices type; -}; +SET_TYPE_PROP(TwoPTwoC, Indices, TwoPTwoCIndices ); //! Use the ImplicitSpatialParams by default SET_TYPE_PROP(TwoPTwoC, SpatialParams, ImplicitSpatialParams); //! Use the model after Millington (1961) for the effective diffusivity -SET_PROP(TwoPTwoC, EffectiveDiffusivityModel) -{ private : - typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - public: - typedef DiffusivityMillingtonQuirk type; -}; +SET_TYPE_PROP(TwoPTwoC, EffectiveDiffusivityModel, + DiffusivityMillingtonQuirk); //! Disable velocity output by default SET_BOOL_PROP(TwoPTwoC, VtkAddVelocity, false); @@ -177,6 +168,9 @@ SET_BOOL_PROP(TwoPTwoC, UseMoles, true); //! Determines whether the constraint solver is used SET_BOOL_PROP(TwoPTwoC, UseConstraintSolver, true); +//! Determines whether the Kelvin equation is used to adapt the saturation vapor pressure +SET_BOOL_PROP(TwoPTwoC, UseKelvinEquation, false); + //! Set default value for the Forchheimer coefficient // Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90. // Actually the Forchheimer coefficient is also a function of the dimensions of the @@ -222,13 +216,7 @@ SET_TYPE_PROP(TwoPTwoCNI, IsothermalVolumeVariables, TwoPTwoCVolumeVariables); //set isothermal Indices -SET_PROP(TwoPTwoCNI, IsothermalIndices) -{ -private: - enum { Formulation = GET_PROP_VALUE(TypeTag, Formulation) }; -public: - typedef TwoPTwoCIndices type; -}; +SET_TYPE_PROP(TwoPTwoCNI, IsothermalIndices, TwoPTwoCIndices); //set isothermal NumEq SET_INT_PROP(TwoPTwoCNI, IsothermalNumEq, 2); diff --git a/dumux/porousmediumflow/2p2c/implicit/volumevariables.hh b/dumux/porousmediumflow/2p2c/implicit/volumevariables.hh index 1a0756ea3b344b43a0d48579bfd34306be72010a..6df37beb34f816ede77b74174c62f0bd626831d8 100644 --- a/dumux/porousmediumflow/2p2c/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/2p2c/implicit/volumevariables.hh @@ -83,6 +83,9 @@ class TwoPTwoCVolumeVariables : public ImplicitVolumeVariables switchIdx = Indices::switchIdx, pressureIdx = Indices::pressureIdx }; + static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); + static const bool useConstraintSolver = GET_PROP_VALUE(TypeTag, UseConstraintSolver); + static const bool useKelvinEquation = GET_PROP_VALUE(TypeTag, UseKelvinEquation); typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::template Codim<0>::Entity Element; @@ -90,9 +93,7 @@ class TwoPTwoCVolumeVariables : public ImplicitVolumeVariables typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; - typedef Dumux::MiscibleMultiPhaseComposition MiscibleMultiPhaseComposition; - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - static const bool useConstraintSolver = GET_PROP_VALUE(TypeTag, UseConstraintSolver); + typedef Dumux::MiscibleMultiPhaseComposition MiscibleMultiPhaseComposition; static_assert(useMoles || (!useMoles && useConstraintSolver), "if UseMoles is set false, UseConstraintSolver has to be set to true"); typedef Dumux::ComputeFromReferencePhase ComputeFromReferencePhase; @@ -275,6 +276,9 @@ public: wPhaseIdx, wCompIdx) * pw; + if (useKelvinEquation) + partPressH2O = FluidSystem::kelvinVaporPressure(fluidState, wPhaseIdx, wCompIdx); + // get the partial pressure of the main component of the the nonwetting (gas) phase ("Air") Scalar partPressAir = pn - partPressH2O; diff --git a/dumux/porousmediumflow/2p2c/sequential/celldataadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/celldataadaptive.hh index 1108764718e49c1d4cf3b14d7e6330832f1da20c..35f14a17d51c5398bc31b0076dfdf8e3c91e532d 100644 --- a/dumux/porousmediumflow/2p2c/sequential/celldataadaptive.hh +++ b/dumux/porousmediumflow/2p2c/sequential/celldataadaptive.hh @@ -167,7 +167,8 @@ public: adaptedValuesFather.pressure_[wPhaseIdx] += adaptedValues.pressure_[wPhaseIdx] / adaptedValues.count; adaptedValuesFather.pressure_[nPhaseIdx] += adaptedValues.pressure_[nPhaseIdx] / adaptedValues.count; // apply maximum complexity for new cell - adaptedValuesFather.subdomain = std::max(adaptedValuesFather.subdomain, adaptedValues.subdomain); + using std::max; + adaptedValuesFather.subdomain = max(adaptedValuesFather.subdomain, adaptedValues.subdomain); } //! Set adapted values in CellData /** diff --git a/dumux/porousmediumflow/2p2c/sequential/fv2dpressureadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/fv2dpressureadaptive.hh index 6687303926e623904b0ea7dd4994742ccf0d57eb..e9b69cf441081c31779dc15b07c31120ca9f531f 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fv2dpressureadaptive.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fv2dpressureadaptive.hh @@ -1016,7 +1016,7 @@ int FV2dPressure2P2CAdaptive::computeTransmissibilities(const Intersect A.invert(); D += B.leftmultiply(C.rightmultiply(A)); T = D[1]; - if(!enableSecondHalfEdge )//or fabs(intersection.centerUnitOuterNormal()[0])<0.5) // [0]<0.5 => switch off vertical 2hes + if(!enableSecondHalfEdge )//or abs(intersection.centerUnitOuterNormal()[0])<0.5) // [0]<0.5 => switch off vertical 2hes { T *= 2; // set your map entry diff --git a/dumux/porousmediumflow/2p2c/sequential/fv2dtransportadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/fv2dtransportadaptive.hh index 977fbd80869a25a0852a1fef08eada9e3dcd252f..3c6d4721f38ffa0b390a1398e4800bed3086174a 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fv2dtransportadaptive.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fv2dtransportadaptive.hh @@ -276,7 +276,8 @@ void FV2dTransport2P2CAdaptive::update(const Scalar t, Scalar& dt, Tran updateVec[nCompIdx][globalIdxI] += q[contiNEqIdx]; // account for porosity - sumfactorin = std::max(sumfactorin,sumfactorout) + using std::max; + sumfactorin = max(sumfactorin,sumfactorout) / problem().spatialParams().porosity(element); //calculate time step @@ -364,10 +365,11 @@ void FV2dTransport2P2CAdaptive::getMpfaFlux(Dune::FieldVector::getMpfaFlux(Dune::FieldVector::getMpfaFlux(Dune::FieldVector1) { - if(enableMPFA && maxInteractionVolumes>1) - { - if(!interactionVolumesContainer_) - interactionVolumesContainer_ = - new InteractionVolumeContainer(problem()); + if(!interactionVolumesContainer_) + interactionVolumesContainer_ = + new InteractionVolumeContainer(problem()); - interactionVolumesContainer_->update(); - } + interactionVolumesContainer_->update(); } asImp_().initializeMatrix(); ParentType::update(); @@ -455,10 +453,13 @@ void FV3dPressure2P2CAdaptive::initializeMatrixRowSize() // check if relation not already added IntPair intPair(eIdxGlobalI,additionalIdx2); if(eIdxGlobalI > additionalIdx2) - std::swap(intPair.first, intPair.second); + { + using std::swap; + swap(intPair.first, intPair.second); + } range = addionalRelations.equal_range(intPair.first); for (rangeIt=range.first; range.first!=range.second - and rangeIt!=range.second; ++rangeIt) + && rangeIt!=range.second; ++rangeIt) if((*rangeIt).second == intPair.second) addIndex = false; if(addIndex) @@ -478,10 +479,13 @@ void FV3dPressure2P2CAdaptive::initializeMatrixRowSize() // check if relation not already added IntPair intPair(eIdxGlobalI,additionalIdx3); if(eIdxGlobalI > additionalIdx3) - std::swap(intPair.first, intPair.second); + { + using std::swap; + swap(intPair.first, intPair.second); + } range = addionalRelations.equal_range(intPair.first); for (rangeIt=range.first; range.first!=range.second - and rangeIt!=range.second; ++rangeIt) + && rangeIt!=range.second; ++rangeIt) if((*rangeIt).second == intPair.second) addIndex = false; if(addIndex) @@ -516,10 +520,13 @@ void FV3dPressure2P2CAdaptive::initializeMatrixRowSize() // check if relation not already added IntPair intPair(eIdxGlobalJ,additionalIdx2); if(eIdxGlobalJ > additionalIdx2) - std::swap(intPair.first, intPair.second); + { + using std::swap; + swap(intPair.first, intPair.second); + } range = addionalRelations.equal_range(intPair.first); for (rangeIt=range.first; range.first!=range.second - and rangeIt!=range.second; ++rangeIt) + && rangeIt!=range.second; ++rangeIt) if((*rangeIt).second == intPair.second) addIndex = false; if(addIndex) @@ -539,10 +546,13 @@ void FV3dPressure2P2CAdaptive::initializeMatrixRowSize() // check if relation not already added IntPair intPair(eIdxGlobalJ,additionalIdx3); if(eIdxGlobalJ > additionalIdx3) - std::swap(intPair.first, intPair.second); + { + using std::swap; + swap(intPair.first, intPair.second); + } range = addionalRelations.equal_range(intPair.first); for (rangeIt=range.first; range.first!=range.second - and rangeIt!=range.second; ++rangeIt) + && rangeIt!=range.second; ++rangeIt) if((*rangeIt).second == intPair.second) addIndex = false; if(addIndex) @@ -694,20 +704,27 @@ void FV3dPressure2P2CAdaptive::assemble(bool first) if(!haveSameLevel && enableMPFA) { if (cellDataI.subdomain() != 2 - or problem().variables().cellData(eIdxGlobalJ).subdomain() != 2) // cell in the 1p domain + || problem().variables().cellData(eIdxGlobalJ).subdomain() != 2) // cell in the 1p domain + { asImp_().get1pMpfaFlux(isIt, cellDataI); + } else + { asImp_().getMpfaFlux(isIt, cellDataI); + } } else { CellData cellDataJ = problem().variables().cellData(eIdxGlobalJ); if (cellDataI.subdomain() != 2 - or problem().variables().cellData(eIdxGlobalJ).subdomain() != 2) // cell in the 1p domain + || problem().variables().cellData(eIdxGlobalJ).subdomain() != 2) // cell in the 1p domain + { asImp_().get1pFlux(entries, intersection, cellDataI); + } else + { asImp_().getFlux(entries, intersection, cellDataI, first); - + } //set right hand side this->f_[eIdxGlobalI] -= entries[rhs]; @@ -1141,7 +1158,8 @@ void FV3dPressure2P2CAdaptive::get1pMpfaFlux(const IntersectionIterator // due to "safety cell" around subdomain, both cells I and J // have single-phase conditions, although one is in 2p domain. - int phaseIdx = std::min(cellDataI.subdomain(), cellDataJ.subdomain()); + using std::min; + int phaseIdx = min(cellDataI.subdomain(), cellDataJ.subdomain()); // get average density for gravity flux Scalar rhoMean = 0.5 * (cellDataI.density(phaseIdx) + cellDataJ.density(phaseIdx)); @@ -1292,8 +1310,8 @@ void FV3dPressure2P2CAdaptive::updateMaterialLaws(bool fromPostTimestep problem().pressureModel().updateMaterialLawsInElement(element, fromPostTimestep); else problem().pressureModel().update1pMaterialLawsInElement(element, cellData, fromPostTimestep); - - maxError = std::max(maxError, fabs(cellData.volumeError())); + using std::max; + maxError = max(maxError, fabs(cellData.volumeError())); } this->maxError_ = maxError/problem().timeManager().timeStepSize(); } @@ -2205,9 +2223,11 @@ int FV3dPressure2P2CAdaptive::transmissibilityAdapter_(const Intersecti case 8: { if(hangingNodeType == InteractionVolume::noHangingNode - or hangingNodeType == InteractionVolume::sixSmallCells) + || hangingNodeType == InteractionVolume::sixSmallCells) + { caseL = mpfal3DTransmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 4, 0, 6, 2, 5, 1); + } else if (hangingNodeType == InteractionVolume::twoSmallCells || hangingNodeType == InteractionVolume::fourSmallCellsFace) { @@ -2270,9 +2290,11 @@ int FV3dPressure2P2CAdaptive::transmissibilityAdapter_(const Intersecti case 9: { if(hangingNodeType == InteractionVolume::noHangingNode - or hangingNodeType == InteractionVolume::sixSmallCells) - caseL = mpfal3DTransmissibilityCalculator_.transmissibility(T, interactionVolume, + || hangingNodeType == InteractionVolume::sixSmallCells) + { + caseL = mpfal3DTransmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 1, 5, 3, 7, 0, 4); + } else if (hangingNodeType == InteractionVolume::twoSmallCells || hangingNodeType == InteractionVolume::fourSmallCellsFace) { caseL = mpfal3DTransmissibilityCalculator_.transmissibilityCaseOne(T, interactionVolume, @@ -2486,7 +2508,8 @@ int FV3dPressure2P2CAdaptive::transmissibilityAdapter_(const Intersecti // a) reverse direction additionalT *= -1; // b) swap cell I and J - std::swap(additionalT[0], additionalT[1]); + using std::swap; + swap(additionalT[0], additionalT[1]); } return caseL; diff --git a/dumux/porousmediumflow/2p2c/sequential/fv3dtransportadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/fv3dtransportadaptive.hh index 07e80e4c90159e60da11d2a7380ed9e0d30806d9..9cfb6cf4c602efcd23f39d9d0fcbe9b1650e3138 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fv3dtransportadaptive.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fv3dtransportadaptive.hh @@ -273,7 +273,8 @@ void FV3dTransport2P2CAdaptive::update(const Scalar t, Scalar& dt, updateVec[nCompIdx][globalIdxI] += q[contiNEqIdx]; // account for porosity - sumfactorin = std::max(sumfactorin,sumfactorout) + using std::max; + sumfactorin = max(sumfactorin,sumfactorout) / problem().spatialParams().porosity(element); //calculate time step @@ -361,10 +362,11 @@ void FV3dTransport2P2CAdaptive::getMpfaFlux(Dune::FieldVector::getMpfaFlux(Dune::FieldVector::getMpfaFlux(Dune::FieldVector::getMpfaCase for(int passionfruit = 0; passionfruit <=1; passionfruit++) // loop at most twice { - if(mapI== 0 or mapJ == 0) + if(mapI== 0 || mapJ == 0) { if(mapI== 2) return 3; @@ -329,7 +329,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase } } // no "else if" because there is also 4 - 0 treated under I or J == 4 - if(mapI== 1 or mapJ == 1) + if(mapI== 1 || mapJ == 1) { if (mapI== 3){ properFluxDirection = false; @@ -344,7 +344,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ == 5) return 9; } - else if(mapI== 2 or mapJ == 2) + else if(mapI== 2 || mapJ == 2) { if(mapI == 6){ properFluxDirection = false; @@ -353,7 +353,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ ==6) return 11; } - else if(mapI== 3 or mapJ == 3) + else if(mapI== 3 || mapJ == 3) { if (mapJ== 7){ properFluxDirection = false; @@ -362,7 +362,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapI== 7) return 10; } - else if(mapI== 4 or mapJ == 4) + else if(mapI== 4 || mapJ == 4) { // this has to be subVolFaceIdx 8 because 7 would mean // a case that should be modelled by tpfa @@ -379,7 +379,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ == 6) return 7; } - else if(mapI== 5 or mapJ == 5) + else if(mapI== 5 || mapJ == 5) { if (mapJ== 7){ properFluxDirection = false; @@ -388,7 +388,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapI== 7) return 5; } - else if(mapI== 6 or mapJ == 6) + else if(mapI== 6 || mapJ == 6) { if (mapI== 7){ properFluxDirection = false; @@ -452,7 +452,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase for(int passionfruit = 0; passionfruit <=1; passionfruit++) // loop at most twice { - if(mapI== 0 or mapJ == 0) + if(mapI== 0 || mapJ == 0) { if (mapJ== 2){ properFluxDirection = false; @@ -472,7 +472,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase return 0; } - else if(mapI== 1 or mapJ == 1) + else if(mapI== 1 || mapJ == 1) { if (mapI== 3){ properFluxDirection = false; @@ -487,7 +487,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ == 5) return 9; } - else if(mapI== 2 or mapJ == 2) + else if(mapI== 2 || mapJ == 2) { if (mapJ== 3){ properFluxDirection = false; @@ -502,7 +502,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ ==6) return 11; } - else if(mapI== 3 or mapJ == 3) + else if(mapI== 3 || mapJ == 3) { if (mapJ== 7){ properFluxDirection = false; @@ -511,7 +511,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapI== 7) return 10; } - else if(mapI== 4 or mapJ == 4) + else if(mapI== 4 || mapJ == 4) { if (mapJ== 5){ properFluxDirection = false; @@ -526,7 +526,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapJ == 6) return 7; } - else if(mapI== 5 or mapJ == 5) + else if(mapI== 5 || mapJ == 5) { if (mapJ== 7){ properFluxDirection = false; @@ -535,7 +535,7 @@ inline int FvMpfaL3d2P2CInteractionVolumeContainerAdaptive::getMpfaCase else if(mapI== 7) return 5; } - else if(mapI== 6 or mapJ == 6) + else if(mapI== 6 || mapJ == 6) { if (mapI== 7){ properFluxDirection = false; diff --git a/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh b/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh index 201edfd2d6cdca328c3d3e1e1092fb77e2dd7b7a..281105be6b072f4cb697e691df03491cf17b8d11 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvpressure.hh @@ -277,7 +277,9 @@ void FVPressure2P2C::getStorage(Dune::FieldVector& storageEn // the pressure Index used as a Primary Variable storageEntry[rhs] -= cellDataI.pressure(pressureType) * compress_term * volume; - if (std::isnan(compress_term) || std::isinf(compress_term)) + using std::isnan; + using std::isinf; + if (isnan(compress_term) || isinf(compress_term)) DUNE_THROW(Dune::MathError, "Compressibility term leads to NAN matrix entry at index " << eIdxGlobalI); if(!GET_PROP_VALUE(TypeTag, EnableCompressibility)) @@ -286,7 +288,7 @@ void FVPressure2P2C::getStorage(Dune::FieldVector& storageEn // Abort error damping if there will be a possibly tiny timestep compared with last one // This might be the case if the episode or simulation comes to an end. - if( problem().timeManager().episodeWillBeOver() + if( problem().timeManager().episodeWillBeFinished() || problem().timeManager().willBeFinished()) { problem().variables().cellData(eIdxGlobalI).errorCorrection() = 0.; @@ -1030,7 +1032,8 @@ void FVPressure2P2C::updateMaterialLawsInElement(const Element& element { cellData.volumeError()=(vol - problem().spatialParams().porosity(elementI)); - if (std::isnan(cellData.volumeError())) + using std::isnan; + if (isnan(cellData.volumeError())) { DUNE_THROW(Dune::MathError, "Sequential2p2c::postProcessUpdate:\n" << "volErr[" << eIdxGlobal << "] isnan: vol = " << vol diff --git a/dumux/porousmediumflow/2p2c/sequential/fvpressurecompositional.hh b/dumux/porousmediumflow/2p2c/sequential/fvpressurecompositional.hh index 8bf70f9bdf07a2d912a6e15a74da31dde916e899..bbbf2e3a5d292952dbf9717847829541d93c5fa6 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvpressurecompositional.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvpressurecompositional.hh @@ -455,7 +455,8 @@ void FVPressureCompositional::initialize(bool solveTwice) Dune::dinfo << "secant guess"<< std::endl; Scalar dt_estimate = 0.; problem_.transportModel().update(0., dt_estimate, updateEstimate_, false); - dt_estimate = std::min ( problem_.timeManager().timeStepSize(), dt_estimate); + using std::min; + dt_estimate = min ( problem_.timeManager().timeStepSize(), dt_estimate); //make sure the right time-step is used by all processes in the parallel case if (problem_.gridView().comm().size() > 1) dt_estimate = problem_.gridView().comm().min(dt_estimate); @@ -640,7 +641,8 @@ void FVPressureCompositional::initialMaterialLaws(bool compositional) fluidState.saturation(wPhaseIdx)); // TODO: get right criterion, do output for evaluation //converge criterion - if (std::abs(oldPc - pc) < 10.0) + using std::abs; + if (abs(oldPc - pc) < 10.0) iter = maxiter; pc = MaterialLaw::pc(problem_.spatialParams().materialLawParams(element), @@ -715,7 +717,8 @@ void FVPressureCompositional::updateMaterialLaws(bool postTimeStep) asImp_().updateMaterialLawsInElement(element, postTimeStep); - maxError = std::max(maxError, fabs(cellData.volumeError())); + using std::max; + maxError = max(maxError, fabs(cellData.volumeError())); } if (problem_.gridView().comm().size() > 1) maxError_ = problem_.gridView().comm().max(maxError_); @@ -853,7 +856,9 @@ void FVPressureCompositional::volumeDerivatives(const GlobalPosition& g mass[compIdx] -= massIncrement[compIdx]; //check routines if derivatives are meaningful - if (std::isnan(cellData.dv(compIdx)) || std::isinf(cellData.dv(compIdx)) ) + using std::isnan; + using std::isinf; + if (isnan(cellData.dv(compIdx)) || isinf(cellData.dv(compIdx)) ) { DUNE_THROW(Dune::MathError, "NAN/inf of dV_dm. If that happens in first timestep, try smaller firstDt!"); } diff --git a/dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh b/dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh index 30f237550b14f49b1c80a416521ccb986d1ef75a..60ec416fce2fa7aad833124d4da3ecc78b1895b8 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvpressuremultiphysics.hh @@ -444,7 +444,9 @@ void FVPressure2P2CMultiPhysics::get1pStorage(Dune::FieldVector::get1pStorage(Dune::FieldVector::get1pFlux(Dune::FieldVector // due to "safety cell" around subdomain, both cells I and J // have single-phase conditions, although one is in 2p domain. - int phaseIdx = std::min(cellDataI.subdomain(), cellDataJ.subdomain()); + using std::min; + int phaseIdx = min(cellDataI.subdomain(), cellDataJ.subdomain()); Scalar rhoMean = 0.5 * (cellDataI.density(phaseIdx) + cellDataJ.density(phaseIdx)); @@ -870,13 +873,14 @@ void FVPressure2P2CMultiPhysics::updateMaterialLaws(bool postTimeStep) // b) will be simple and was complex: complex FS available, so next TS // will use comlex FS, next updateMaterialLaw will transform to simple - maxError = std::max(maxError, fabs(cellData.volumeError())); + using std::max; + maxError = max(maxError, fabs(cellData.volumeError())); }// end grid traversal this->maxError_ = maxError/problem().timeManager().timeStepSize(); timer_.stop(); - if(problem().timeManager().willBeFinished() or problem().timeManager().episodeWillBeOver()) + if(problem().timeManager().willBeFinished() or problem().timeManager().episodeWillBeFinished()) Dune::dinfo << "Subdomain routines took " << timer_.elapsed() << " seconds" << std::endl; return; diff --git a/dumux/porousmediumflow/2p2c/sequential/fvtransport.hh b/dumux/porousmediumflow/2p2c/sequential/fvtransport.hh index 0f602cc5166fde0c7ee9a15ca1e8d892d5b04c2f..4136eb1244dfb8c743026443537d41d28934c241 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvtransport.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvtransport.hh @@ -116,6 +116,9 @@ public: typedef Dune::FieldVector TimeStepFluxType; protected: + /** + * \brief Data for local timestepping + */ struct LocalTimesteppingData { Dune::FieldVector faceFluxes; @@ -279,7 +282,8 @@ public: minimalBoundaryPermeability = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.MinBoundaryPermeability); Scalar cFLFactor = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Impet, CFLFactor); - subCFLFactor_ = std::min(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Impet, SubCFLFactor), cFLFactor); + using std::min; + subCFLFactor_ = min(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Impet, SubCFLFactor), cFLFactor); verbosity_ = GET_PARAM_FROM_GROUP(TypeTag, int, TimeManager, SubTimestepVerbosity); localTimeStepping_ = subCFLFactor_/cFLFactor < 1.0 - dtThreshold_; @@ -447,7 +451,8 @@ void FVTransport2P2C::update(const Scalar t, Scalar& dt, updateVec[nCompIdx][eIdxGlobalI] += q[contiNEqIdx]; // account for porosity in fluxes for time-step - sumfactorin = std::max(sumfactorin,sumfactorout) + using std::max; + sumfactorin = max(sumfactorin,sumfactorout) / problem().spatialParams().porosity(element); //calculate time step @@ -588,10 +593,11 @@ void FVTransport2P2C::getFlux(ComponentVector& fluxEntries, DimMatrix K_I(problem().spatialParams().intrinsicPermeability(elementI)); PhaseVector SmobI(0.); - SmobI[wPhaseIdx] = std::max((cellDataI.saturation(wPhaseIdx) + using std::max; + SmobI[wPhaseIdx] = max((cellDataI.saturation(wPhaseIdx) - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); - SmobI[nPhaseIdx] = std::max((cellDataI.saturation(nPhaseIdx) + SmobI[nPhaseIdx] = max((cellDataI.saturation(nPhaseIdx) - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); @@ -685,7 +691,7 @@ void FVTransport2P2C::getFlux(ComponentVector& fluxEntries, else contiEqIdx = contiNEqIdx; - if(!impet_ or restrictFluxInTransport_==0) // perform a strict uwpind scheme + if(!impet_ || restrictFluxInTransport_==0) // perform a strict uwpind scheme { if (potential[phaseIdx] > 0.) { @@ -720,10 +726,10 @@ void FVTransport2P2C::getFlux(ComponentVector& fluxEntries, { //check if harmonic weighting is necessary if (potential[phaseIdx] > 0. && (Dune::FloatCmp::ne(cellDataJ.mobility(phaseIdx), 0.0, 1.0e-30) // check if outflow induce neglected (i.e. mob=0) phase flux - or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) + || (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) lambda[phaseIdx] = cellDataI.mobility(phaseIdx); else if (potential[phaseIdx] < 0. && (Dune::FloatCmp::ne(cellDataI.mobility(phaseIdx), 0.0, 1.0e-30) // check if inflow induce neglected phase flux - or (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) + || (cellDataI.wasRefined() && cellDataJ.wasRefined() && elementI.father() == neighbor.father()))) lambda[phaseIdx] = cellDataJ.mobility(phaseIdx); else doUpwinding[phaseIdx] = false; @@ -750,11 +756,12 @@ void FVTransport2P2C::getFlux(ComponentVector& fluxEntries, cellDataJ.massFraction(phaseIdx, nCompIdx) * cellDataJ.mobility(phaseIdx) * cellDataJ.density(phaseIdx)); // c) timestep control // for timestep control : influx - timestepFlux[0] += std::max(0., + using std::max; + timestepFlux[0] += max(0., - potential[phaseIdx] * faceArea / volume * harmonicMean(cellDataI.mobility(phaseIdx),cellDataJ.mobility(phaseIdx))); // outflux - timestepFlux[1] += std::max(0., + timestepFlux[1] += max(0., potential[phaseIdx] * faceArea / volume * harmonicMean(cellDataI.mobility(phaseIdx),cellDataJ.mobility(phaseIdx))/SmobI[phaseIdx]); @@ -778,18 +785,21 @@ void FVTransport2P2C::getFlux(ComponentVector& fluxEntries, } // calculate and standardized velocity - double velocityJIw = std::max((-lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); - double velocityIJw = std::max(( lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); - double velocityJIn = std::max((-lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); - double velocityIJn = std::max(( lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); + using std::max; + double velocityJIw = max((-lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); + double velocityIJw = max(( lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); + double velocityJIn = max((-lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); + double velocityIJn = max(( lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); // for timestep control : influx timestepFlux[0] += velocityJIw + velocityJIn; double foutw = velocityIJw/SmobI[wPhaseIdx]; double foutn = velocityIJn/SmobI[nPhaseIdx]; - if (std::isnan(foutw) || std::isinf(foutw) || foutw < 0) foutw = 0; - if (std::isnan(foutn) || std::isinf(foutn) || foutn < 0) foutn = 0; + using std::isnan; + using std::isinf; + if (isnan(foutw) || isinf(foutw) || foutw < 0) foutw = 0; + if (isnan(foutn) || isinf(foutn) || foutn < 0) foutn = 0; timestepFlux[1] += foutw + foutn; fluxEntries[wCompIdx] += @@ -867,6 +877,7 @@ void FVTransport2P2C::getFluxOnBoundary(ComponentVector& fluxEntries, const Intersection& intersection, const CellData& cellDataI) { + using std::max; // cell information auto elementI = intersection.inside(); int eIdxGlobalI = problem().variables().index(elementI); @@ -889,10 +900,10 @@ void FVTransport2P2C::getFluxOnBoundary(ComponentVector& fluxEntries, K_I[axis][axis] = minimalBoundaryPermeability; } - Scalar SwmobI = std::max((cellDataI.saturation(wPhaseIdx) + Scalar SwmobI = max((cellDataI.saturation(wPhaseIdx) - problem().spatialParams().materialLawParams(elementI).swr()) , 1e-2); - Scalar SnmobI = std::max((cellDataI.saturation(nPhaseIdx) + Scalar SnmobI = max((cellDataI.saturation(nPhaseIdx) - problem().spatialParams().materialLawParams(elementI).snr()) , 1e-2); @@ -1006,18 +1017,21 @@ void FVTransport2P2C::getFluxOnBoundary(ComponentVector& fluxEntries, / viscosityNWBound; } // calculate and standardized velocity - double velocityJIw = std::max((-lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); - double velocityIJw = std::max(( lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); - double velocityJIn = std::max((-lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); - double velocityIJn = std::max(( lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); + + double velocityJIw = max((-lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); + double velocityIJw = max(( lambda[wPhaseIdx] * potential[wPhaseIdx]) * faceArea / volume, 0.0); + double velocityJIn = max((-lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); + double velocityIJn = max(( lambda[nPhaseIdx] * potential[nPhaseIdx]) * faceArea / volume, 0.0); // for timestep control timestepFlux[0] = velocityJIw + velocityJIn; double foutw = velocityIJw/SwmobI; double foutn = velocityIJn/SnmobI; - if (std::isnan(foutw) || std::isinf(foutw) || foutw < 0) foutw = 0; - if (std::isnan(foutn) || std::isinf(foutn) || foutn < 0) foutn = 0; + using std::isnan; + using std::isinf; + if (isnan(foutw) || isinf(foutw) || foutw < 0) foutw = 0; + if (isnan(foutn) || isinf(foutn) || foutn < 0) foutn = 0; timestepFlux[1] = foutw + foutn; fluxEntries[wCompIdx] = @@ -1168,7 +1182,8 @@ void FVTransport2P2C::evalBoundary(GlobalPosition globalPosFace, BCfluidState.saturation(wPhaseIdx)); // TODO: get right criterion, do output for evaluation //converge criterion - if (std::abs(oldPc - pcBound) < 10.0) + using std::abs; + if (abs(oldPc - pcBound) < 10.0) iter = maxiter; } } @@ -1205,7 +1220,7 @@ void FVTransport2P2C::updatedTargetDt_(Scalar &dt) for (const auto& intersection : intersections(problem_.gridView(), element)) { int indexInInside = intersection.indexInInside(); - + using std::min; if (intersection.neighbor()) { auto neighbor = intersection.outside(); @@ -1214,6 +1229,7 @@ void FVTransport2P2C::updatedTargetDt_(Scalar &dt) int levelI = element.level(); int levelJ = neighbor.level(); + if (eIdxGlobalI < eIdxGlobalJ && levelI <= levelJ) { LocalTimesteppingData& localDataJ = timeStepData_[eIdxGlobalJ]; @@ -1223,14 +1239,14 @@ void FVTransport2P2C::updatedTargetDt_(Scalar &dt) if (localDataI.faceTargetDt[indexInInside] < accumulatedDt_ + dtThreshold_ || localDataJ.faceTargetDt[indexInOutside] < accumulatedDt_ + dtThreshold_) { - Scalar timeStep = std::min(localDataI.dt, localDataJ.dt); + Scalar timeStep = min(localDataI.dt, localDataJ.dt); if (levelI < levelJ) { typename FaceDt::iterator it = faceDt.find(indexInInside); if (it != faceDt.end()) { - it->second = std::min(it->second, timeStep); + it->second = min(it->second, timeStep); } else { @@ -1243,7 +1259,7 @@ void FVTransport2P2C::updatedTargetDt_(Scalar &dt) localDataJ.faceTargetDt[indexInOutside] += subCFLFactor_ * timeStep; } - dt = std::min(dt, timeStep); + dt = min(dt, timeStep); } } } @@ -1252,7 +1268,7 @@ void FVTransport2P2C::updatedTargetDt_(Scalar &dt) if (localDataI.faceTargetDt[indexInInside] < accumulatedDt_ + dtThreshold_) { localDataI.faceTargetDt[indexInInside] += subCFLFactor_ * localDataI.dt; - dt = std::min(dt, subCFLFactor_ * localDataI.dt); + dt = min(dt, subCFLFactor_ * localDataI.dt); } } } @@ -1320,9 +1336,10 @@ void FVTransport2P2C::innerUpdate(TransportSolutionType& updateVec) if (accumulatedDt_ < realDt) { + using std::min; while(true) { - Scalar dtCorrection = std::min(0.0, realDt - accumulatedDt_); + Scalar dtCorrection = min(0.0, realDt - accumulatedDt_); subDt += dtCorrection; if (verbosity_ > 0) diff --git a/dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh b/dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh index 5a4c15dab60124d0a5626e3cb26e0e77253ccaae..fe58afecb27d5a6f760dae9b05c683b6316baa4b 100644 --- a/dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh +++ b/dumux/porousmediumflow/2p2c/sequential/fvtransportmultiphysics.hh @@ -148,7 +148,7 @@ void FVTransport2P2CMultiPhysics::update(const Scalar t, Scalar& dt, Tr int globalIdxI = problem().variables().index(element); CellData& cellDataI = problem().variables().cellData(globalIdxI); - if(impet or cellDataI.subdomain()==2) // estimate only necessary in subdomain + if (impet || cellDataI.subdomain() == 2) // estimate only necessary in subdomain { // some variables for time step calculation double sumfactorin = 0; @@ -206,7 +206,8 @@ void FVTransport2P2CMultiPhysics::update(const Scalar t, Scalar& dt, Tr updateVec[nCompIdx][globalIdxI] += q[Indices::contiNEqIdx]; // account for porosity in fluxes for time-step - sumfactorin = std::max(sumfactorin,sumfactorout) + using std::max; + sumfactorin = max(sumfactorin,sumfactorout) / problem().spatialParams().porosity(element); //calculate time step diff --git a/dumux/porousmediumflow/2p2c/sequential/variableclassadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/variableclassadaptive.hh index f1ac90d370971131a83306ec7dbbc4741ee4a904..22e498d3da44117d970dbe5c8e9ea1366ae20368 100644 --- a/dumux/porousmediumflow/2p2c/sequential/variableclassadaptive.hh +++ b/dumux/porousmediumflow/2p2c/sequential/variableclassadaptive.hh @@ -312,8 +312,9 @@ public: irregularInterfaceMap_[intersectionID].globalPos3_[offset+1] = globalPos4; irregularInterfaceMap_[intersectionID].globalIdx3_[offset+1] = globalIdx4; + using std::max; irregularInterfaceMap_[intersectionID].interactionRegionsStored - = std::max(irregularInterfaceMap_[intersectionID].interactionRegionsStored, subFaceIdx+1); + = max(irregularInterfaceMap_[intersectionID].interactionRegionsStored, subFaceIdx+1); } //! Weigths the transmissivity coefficient by the flux area (3D) diff --git a/dumux/porousmediumflow/2pdfm/implicit/fluxvariables.hh b/dumux/porousmediumflow/2pdfm/implicit/fluxvariables.hh index 2a32b463e0613662254d71654f9949b2b7012a6c..f4ca8330ec72d349d733bb82694ca2fe00d39792 100644 --- a/dumux/porousmediumflow/2pdfm/implicit/fluxvariables.hh +++ b/dumux/porousmediumflow/2pdfm/implicit/fluxvariables.hh @@ -149,8 +149,8 @@ public: if (vDarcyFracture_[phaseIdx] < 0) { - std::swap(upstreamFractureIdx[phaseIdx], - downstreamFractureIdx[phaseIdx]); + using std::swap; + swap(upstreamFractureIdx[phaseIdx], downstreamFractureIdx[phaseIdx]); } } } @@ -226,8 +226,10 @@ private: Scalar SJ = elemVolVars[this->face().j].saturation(phaseIdx); Scalar rhoI = elemVolVars[this->face().i].density(phaseIdx); Scalar rhoJ = elemVolVars[this->face().j].density(phaseIdx); - Scalar fI = std::max(0.0, std::min(SI/1e-5, 0.5)); - Scalar fJ = std::max(0.0, std::min(SJ/1e-5, 0.5)); + using std::max; + using std::min; + Scalar fI = max(0.0, min(SI/1e-5, 0.5)); + Scalar fJ = max(0.0, min(SJ/1e-5, 0.5)); if (Dune::FloatCmp::eq(fI + fJ, 0.0, 1.0e-30)) // doesn't matter because no wetting phase is present in // both cells! diff --git a/dumux/porousmediumflow/2pdfm/implicit/model.hh b/dumux/porousmediumflow/2pdfm/implicit/model.hh index d9117b879a1cc8c3c6935a25fa35703bfad1b88c..5c2e1cc0ed9d6f167755c066a90db4658f0e0001 100644 --- a/dumux/porousmediumflow/2pdfm/implicit/model.hh +++ b/dumux/porousmediumflow/2pdfm/implicit/model.hh @@ -64,7 +64,7 @@ namespace Dumux * choosing either \f$p_w\f$ and \f$S_n\f$ or \f$p_n\f$ and \f$S_w\f$ * as primary variables. The formulation which ought to be used can be * specified by setting the Formulation property to either - * TwoPCommonIndices::pWsN or TwoPCommonIndices::pNsW. By + * TwoPFormulation::pwsn or TwoPFormulation::pnsw. By * default, the model uses \f$p_w\f$ and \f$S_n\f$. */ template diff --git a/dumux/porousmediumflow/2pminc/implicit/fluxvariables.hh b/dumux/porousmediumflow/2pminc/implicit/fluxvariables.hh index 5d8bf5dc742af17b0a5acb8b6fa58787f6331ddf..54b6d094491e3017b591c2d1da765eae5bf2cab6 100644 --- a/dumux/porousmediumflow/2pminc/implicit/fluxvariables.hh +++ b/dumux/porousmediumflow/2pminc/implicit/fluxvariables.hh @@ -213,8 +213,10 @@ protected: Scalar sj = elemVolVars[face().j].saturation(phaseIdx, fractureIdx); Scalar rhoi = elemVolVars[face().i].density(phaseIdx, fractureIdx); Scalar rhoj = elemVolVars[face().j].density(phaseIdx, fractureIdx); - Scalar fi = std::max(0.0, std::min(si/1e-5, 0.5)); - Scalar fj = std::max(0.0, std::min(sj/1e-5, 0.5)); + using std::max; + using std::min; + Scalar fi = max(0.0, min(si/1e-5, 0.5)); + Scalar fj = max(0.0, min(sj/1e-5, 0.5)); if (fi + fj == 0) // doesn't matter because no wetting phase is present in // both cells! diff --git a/dumux/porousmediumflow/2pminc/implicit/model.hh b/dumux/porousmediumflow/2pminc/implicit/model.hh index 0df183ad7acfd1c61c1b9493b27201c9fee03d35..fc9e30d29d02acb3d853e7d5e940f83729ed4424 100644 --- a/dumux/porousmediumflow/2pminc/implicit/model.hh +++ b/dumux/porousmediumflow/2pminc/implicit/model.hh @@ -39,6 +39,7 @@ namespace Dumux /*! * \ingroup TwoPMincModel + * \brief Adaption of the fully implicit scheme to the two-phase flow model. */ template class TwoPMincModel : public TwoPModel @@ -338,22 +339,23 @@ public: * the ones which have the double bigger than the edge * the ones which are bigger than the previous edge */ - if (( (std::min(cellSize_[0],cellSize_[1])- 2* x1) < 0.0 + using std::min; + if (( (min(cellSize_[0],cellSize_[1])- 2* x1) < 0.0 || (x1 < 0.0) || (x1_test[nC](cellSize_[0],cellSize_[1])- 2* x2) > 0.0 + && ((min(cellSize_[0],cellSize_[1])- 2* x2) > 0.0 && x2 > 0.0 && (x2_test[nC]>x2_test[nC-1]) )) { distNestedContinua_[nC] = x2; } - else if (( (std::min(cellSize_[0],cellSize_[1])- 2* x2) < 0 + else if (( (min(cellSize_[0],cellSize_[1])- 2* x2) < 0 || (x2 < 0) || (x2_test[nC](cellSize_[0],cellSize_[1])- 2* x1) > 0 + && ((min(cellSize_[0],cellSize_[1])- 2* x1) > 0 && (x1 > 0) && (x1_test[nC]>x1_test[nC-1]) )) @@ -362,7 +364,7 @@ public: } else { - distNestedContinua_[nC] = std::min(x1, x2); + distNestedContinua_[nC] = min(x1, x2); DUNE_THROW(Dune::InvalidStateException, "Check the solution of the nested continua geometric parameters"); } diff --git a/dumux/porousmediumflow/2pnc/implicit/fluxvariables.hh b/dumux/porousmediumflow/2pnc/implicit/fluxvariables.hh index 9c2dedaffdb1782450fd26109d9c77417fa3fab9..de28c44205daf2bac9601127b7b2229fc7a3a1f6 100644 --- a/dumux/porousmediumflow/2pnc/implicit/fluxvariables.hh +++ b/dumux/porousmediumflow/2pnc/implicit/fluxvariables.hh @@ -53,6 +53,7 @@ class TwoPNCFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariables) typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables; + typedef typename GET_PROP_TYPE(TypeTag, EffectiveDiffusivityModel) EffectiveDiffusivityModel; typedef typename GridView::ctype CoordScalar; typedef typename GridView::template Codim<0>::Entity Element; @@ -167,6 +168,10 @@ protected: const VolumeVariables &volVarsI = elemVolVars[this->face().i]; const VolumeVariables &volVarsJ = elemVolVars[this->face().j]; + // the effective diffusion coefficients at vertex i and j + Scalar diffCoeffI; + Scalar diffCoeffJ; + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { /* If there is no phase saturation on either side of the face @@ -178,30 +183,25 @@ protected: porousDiffCoeff_[phaseIdx][compIdx] = 0.0; } } - else { - // calculate tortuosity at the nodes i and j needed - // for porous media diffusion coefficient - Scalar tauI = 1.0/(volVarsI.porosity() * volVarsI.porosity()) * - std::pow(volVarsI.porosity() * volVarsI.saturation(phaseIdx), 7.0/3); - - Scalar tauJ = 1.0/(volVarsJ.porosity() * volVarsJ.porosity()) * - std::pow(volVarsJ.porosity() * volVarsJ.saturation(phaseIdx), 7.0/3); - // Diffusion coefficient in the porous medium - - // -> harmonic mean for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - if(phaseIdx==compIdx) + if (phaseIdx == compIdx) { porousDiffCoeff_[phaseIdx][compIdx] = 0.0; } else { - auto porousDiffI = volVarsI.porosity() * volVarsI.saturation(phaseIdx) * tauI * volVarsI.diffCoeff(phaseIdx, compIdx); - auto porousDiffJ = volVarsJ.porosity() * volVarsJ.saturation(phaseIdx) * tauJ * volVarsJ.diffCoeff(phaseIdx, compIdx); - porousDiffCoeff_[phaseIdx][compIdx] = harmonicMean(porousDiffI, porousDiffJ); + diffCoeffI = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsI.porosity(), + volVarsI.saturation(phaseIdx), + volVarsI.diffCoeff(phaseIdx, compIdx)); + + diffCoeffJ = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsJ.porosity(), + volVarsJ.saturation(phaseIdx), + volVarsJ.diffCoeff(phaseIdx, compIdx)); + + porousDiffCoeff_[phaseIdx][compIdx] = harmonicMean(diffCoeffI, diffCoeffJ); } } } diff --git a/dumux/porousmediumflow/2pnc/implicit/indices.hh b/dumux/porousmediumflow/2pnc/implicit/indices.hh index a527345942f967970d1dba03c2da09a8a36b8160..d46e2e14520082acc6e14520f9888eed2cd4f28b 100644 --- a/dumux/porousmediumflow/2pnc/implicit/indices.hh +++ b/dumux/porousmediumflow/2pnc/implicit/indices.hh @@ -31,16 +31,13 @@ namespace Dumux * \ingroup TwoPNCModel * \ingroup ImplicitIndices * \brief Enumerates the formulations which the two-phase n-component model accepts. - * */ -struct TwoPNCFormulation//TODO: This might need to be change similar to 2p2c indices +struct TwoPNCFormulation { enum { - plSg, - pgSl, - pnSw = pgSl, - pwSn = plSg - }; + pnsw, + pwsn + }; }; /*! @@ -59,6 +56,11 @@ public: // Phase indices static const int wPhaseIdx = FluidSystem::wPhaseIdx; //!< Index of the wetting phase static const int nPhaseIdx = FluidSystem::nPhaseIdx; //!< Index of the non-wetting phase + + // Component indices + static const int wCompIdx = FluidSystem::wCompIdx; //!< Index of the primary component of the wetting phase + static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase + // present phases (-> 'pseudo' primary variable) static const int wPhaseOnly = 1; //!< Only the non-wetting phase is present static const int nPhaseOnly = 2; //!< Only the wetting phase is present @@ -67,6 +69,7 @@ public: // Primary variable indices static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector static const int switchIdx = PVOffset + 1; //!< Index of the either the saturation or the mass fraction of the non-wetting/wetting phase + // equation indices static const int conti0EqIdx = PVOffset + 0; //!< Reference index for mass conservation equations. static const int contiWEqIdx = conti0EqIdx + FluidSystem::wCompIdx; //!< Index of the mass conservation equation for the wetting phase major component diff --git a/dumux/porousmediumflow/2pnc/implicit/localresidual.hh b/dumux/porousmediumflow/2pnc/implicit/localresidual.hh index 77979557effaaf8a079e85ae9e5922675a0c42aa..61733454c3c4a785a2d5538f69c73fd321b224be 100644 --- a/dumux/porousmediumflow/2pnc/implicit/localresidual.hh +++ b/dumux/porousmediumflow/2pnc/implicit/localresidual.hh @@ -90,8 +90,8 @@ protected: nPhaseOnly = Indices::nPhaseOnly, bothPhases = Indices::bothPhases, - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, formulation = GET_PROP_VALUE(TypeTag, Formulation) }; diff --git a/dumux/porousmediumflow/2pnc/implicit/model.hh b/dumux/porousmediumflow/2pnc/implicit/model.hh index 2d05d5dfa1af84cc7ee9ee17cc6283d3bbcc8eb4..0c3de89aced08889eac4ee2f1f33ef656070fe84 100644 --- a/dumux/porousmediumflow/2pnc/implicit/model.hh +++ b/dumux/porousmediumflow/2pnc/implicit/model.hh @@ -79,7 +79,7 @@ namespace Dumux * The used primary variables are, like in the two-phase model, either \f$p_w\f$ and \f$S_n\f$ * or \f$p_n\f$ and \f$S_w\f$. The formulation which ought to be used can be * specified by setting the Formulation property to either - * TwoPTwoCIndices::pWsN or TwoPTwoCIndices::pNsW. By + * TwoPTwoCIndices::pwsn or TwoPTwoCIndices::pnsw. By * default, the model uses \f$p_w\f$ and \f$S_n\f$. * * Moreover, the second primary variable depends on the phase state, since a @@ -141,8 +141,8 @@ class TwoPNCModel: public GET_PROP_TYPE(TypeTag, BaseModel) bothPhases = Indices::bothPhases }; enum { - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, formulation = GET_PROP_VALUE(TypeTag, Formulation) }; @@ -275,16 +275,17 @@ public: // get the number of degrees of freedom auto numDofs = this->numDofs(); - ScalarField *Sg = writer.allocateManagedBuffer (numDofs); - ScalarField *Sl = writer.allocateManagedBuffer (numDofs); - ScalarField *pg = writer.allocateManagedBuffer (numDofs); - ScalarField *pl = writer.allocateManagedBuffer (numDofs); + ScalarField *sn = writer.allocateManagedBuffer (numDofs); + ScalarField *sw = writer.allocateManagedBuffer (numDofs); + ScalarField *pn = writer.allocateManagedBuffer (numDofs); + ScalarField *pw = writer.allocateManagedBuffer (numDofs); ScalarField *pc = writer.allocateManagedBuffer (numDofs); - ScalarField *rhoL = writer.allocateManagedBuffer (numDofs); - ScalarField *rhoG = writer.allocateManagedBuffer (numDofs); - ScalarField *mobL = writer.allocateManagedBuffer (numDofs); - ScalarField *mobG = writer.allocateManagedBuffer (numDofs); + ScalarField *rhoW = writer.allocateManagedBuffer (numDofs); + ScalarField *rhoN = writer.allocateManagedBuffer (numDofs); + ScalarField *mobW = writer.allocateManagedBuffer (numDofs); + ScalarField *mobN = writer.allocateManagedBuffer (numDofs); ScalarField *temperature = writer.allocateManagedBuffer (numDofs); + ScalarField *phasePresence = writer.allocateManagedBuffer (numDofs); ScalarField *poro = writer.allocateManagedBuffer (numDofs); VectorField *velocityN = writer.template allocateManagedBuffer(numDofs); VectorField *velocityW = writer.template allocateManagedBuffer(numDofs); @@ -301,17 +302,17 @@ public: } ScalarField *moleFraction[numPhases][numComponents]; - for (int i = 0; i < numPhases; ++i) - for (int j = 0; j < numComponents; ++j) - moleFraction[i][j] = writer.allocateManagedBuffer(numDofs); + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + moleFraction[phaseIdx][compIdx] = writer.allocateManagedBuffer(numDofs); ScalarField *molarity[numComponents]; - for (int j = 0; j < numComponents ; ++j) - molarity[j] = writer.allocateManagedBuffer(numDofs); + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + molarity[compIdx] = writer.allocateManagedBuffer(numDofs); - ScalarField *Perm[dim]; + ScalarField *perm[dim]; for (int j = 0; j < dim; ++j) //Permeability only in main directions xx and yy - Perm[j] = writer.allocateManagedBuffer(numDofs); + perm[j] = writer.allocateManagedBuffer(numDofs); auto numElements = this->gridView_().size(0); ScalarField *rank = writer.allocateManagedBuffer (numElements); @@ -334,17 +335,18 @@ public: auto dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); GlobalPosition globalPos = fvGeometry.subContVol[scvIdx].global; - (*Sg)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(nPhaseIdx); - (*Sl)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(wPhaseIdx); - (*pg)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx); - (*pl)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx); + (*sn)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(nPhaseIdx); + (*sw)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(wPhaseIdx); + (*pn)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx); + (*pw)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx); (*pc)[dofIdxGlobal] = elemVolVars[scvIdx].capillaryPressure(); - (*rhoL)[dofIdxGlobal] = elemVolVars[scvIdx].density(wPhaseIdx); - (*rhoG)[dofIdxGlobal] = elemVolVars[scvIdx].density(nPhaseIdx); - (*mobL)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(wPhaseIdx); - (*mobG)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(nPhaseIdx); + (*rhoW)[dofIdxGlobal] = elemVolVars[scvIdx].density(wPhaseIdx); + (*rhoN)[dofIdxGlobal] = elemVolVars[scvIdx].density(nPhaseIdx); + (*mobW)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(wPhaseIdx); + (*mobN)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(nPhaseIdx); (*poro)[dofIdxGlobal] = elemVolVars[scvIdx].porosity(); (*temperature)[dofIdxGlobal] = elemVolVars[scvIdx].temperature(); + (*phasePresence)[dofIdxGlobal] = staticDat_[dofIdxGlobal].phasePresence; for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx) @@ -356,7 +358,7 @@ public: Tensor K = perm_(this->problem_().spatialParams().intrinsicPermeability(element, fvGeometry, scvIdx)); for (int j = 0; j= 2) - writer.attachDofData(*Perm[1], "Kyy", isBox); + writer.attachDofData(*perm[1], "Kyy", isBox); if (dim == 3) - writer.attachDofData(*Perm[2], "Kzz", isBox); + writer.attachDofData(*perm[2], "Kzz", isBox); - for (int i = 0; i < numPhases; ++i) + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - for (int j = 0; j < numComponents; ++j) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) { std::ostringstream oss; - oss << "x" - << FluidSystem::componentName(j) - << FluidSystem::phaseName(i); - writer.attachDofData(*moleFraction[i][j], oss.str(), isBox); + oss << "x_" << FluidSystem::phaseName(phaseIdx) << "^" << FluidSystem::componentName(compIdx); + writer.attachDofData(*moleFraction[phaseIdx][compIdx], oss.str(), isBox); } } - for (int j = 0; j < numComponents; ++j) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) { std::ostringstream oss; - oss << "m^w_" - << FluidSystem::componentName(j); - writer.attachDofData(*molarity[j], oss.str().c_str(), isBox); + oss << "m_" << FluidSystem::phaseName(wPhaseIdx) << "^" << FluidSystem::componentName(compIdx); + writer.attachDofData(*molarity[compIdx], oss.str(), isBox); } if (velocityOutput.enableOutput()) // check if velocity output is demanded @@ -583,102 +583,99 @@ protected: if (staticDat_[dofIdxGlobal].wasSwitched) Smin = -0.01; - //if saturation of liquid phase is smaller 0 switch + //if saturation of wetting phase is smaller 0 switch if (volVars.saturation(wPhaseIdx) <= Smin) { wouldSwitch = true; - //liquid phase has to disappear - std::cout << "Liquid Phase disappears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", Sl: " + //wetting phase has to disappear + std::cout << "Wetting Phase disappears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", Sw: " << volVars.saturation(wPhaseIdx) << std::endl; newPhasePresence = nPhaseOnly; - //switch not depending on formulation - //switch "Sl" to "xgH20" + //switch saturation to xnH20 (not depending on formulation) globalSol[dofIdxGlobal][switchIdx] = volVars.moleFraction(nPhaseIdx, wCompIdx /*H2O*/); - //switch all secondary components to mole fraction in gas phase + //switch all secondary components to mole fraction in nonwetting phase for (int compIdx=numMajorComponents; compIdx xlmax) + if (sumxw > xwmax) wouldSwitch = true; if (staticDat_[dofIdxGlobal].wasSwitched) - xlmax *=1.02; - //liquid phase appears if sum is larger than one - if (sumxl/*sum of mole fractions*/ > xlmax/*1*/) + xwmax *=1.02; + //wetting phase appears if sum is larger than one + if (sumxw/*sum of mole fractions*/ > xwmax/*1*/) { - std::cout << "Liquid Phase appears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", sumxl: " - << sumxl << std::endl; + std::cout << "Wetting Phase appears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", sumxw: " + << sumxw << std::endl; newPhasePresence = bothPhases; - //saturation of the liquid phase set to 0.0001 (if formulation pgSl and vice versa) - if (formulation == pgSl) + //saturation of the wetting phase set to 0.0001 + if (formulation == pnsw) globalSol[dofIdxGlobal][switchIdx] = 0.0001; - else if (formulation == plSg) + else if (formulation == pwsn) globalSol[dofIdxGlobal][switchIdx] = 0.9999; - //switch all secondary components back to liquid mole fraction + //switch all secondary components back to wetting mole fraction for (int compIdx=numMajorComponents; compIdx xgmax) + if (sumxn > xnmax) wouldSwitch = true; if (staticDat_[dofIdxGlobal].wasSwitched) - xgmax *=1.02; - //liquid phase appears if sum is larger than one - if (sumxg > xgmax) + xnmax *=1.02; + //nonwetting phase appears if sum is larger than one + if (sumxn > xnmax) { - std::cout << "Gas Phase appears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", sumxg: " - << sumxg << std::endl; + std::cout << "Nonwetting Phase appears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", sumxn: " + << sumxn << std::endl; newPhasePresence = bothPhases; - //saturation of the liquid phase set to 0.9999 (if formulation pgSl and vice versa) - if (formulation == pgSl) + //saturation of the wetting phase set to 0.9999 + if (formulation == pnsw) globalSol[dofIdxGlobal][switchIdx] = 0.9999; - else if (formulation == plSg) + else if (formulation == pwsn) globalSol[dofIdxGlobal][switchIdx] = 0.0001; - } } - staticDat_[dofIdxGlobal].phasePresence = newPhasePresence; staticDat_[dofIdxGlobal].wasSwitched = wouldSwitch; return phasePresence != newPhasePresence; diff --git a/dumux/porousmediumflow/2pnc/implicit/properties.hh b/dumux/porousmediumflow/2pnc/implicit/properties.hh index 44e495060a32628912873862ba21e61bf810e442..3eda66717f00684db541a160fb0c58196865be1d 100644 --- a/dumux/porousmediumflow/2pnc/implicit/properties.hh +++ b/dumux/porousmediumflow/2pnc/implicit/properties.hh @@ -59,6 +59,7 @@ NEW_TYPE_TAG(CCTwoPNCNI, INHERITS_FROM(CCModel, TwoPNCNI)); NEW_PROP_TAG(NumPhases); //!< Number of fluid phases in the system NEW_PROP_TAG(NumComponents); //!< Number of fluid components in the system NEW_PROP_TAG(NumMajorComponents); //!< Number of major fluid components which are considered in the calculation of the phase density +NEW_PROP_TAG(SetMoleFractionsForWettingPhase); //!< Set the mole fraction in the wetting or non-wetting phase NEW_PROP_TAG(TwoPNCIndices); //!< Enumerations for the 2pncMin models NEW_PROP_TAG(Formulation); //!< The formulation of the model NEW_PROP_TAG(SpatialParams); //!< The type of the spatial parameters @@ -69,6 +70,7 @@ NEW_PROP_TAG(Chemistry); //!< The chemistry class with which solves equlibrium r NEW_PROP_TAG(MaterialLaw); //!< The material law which ought to be used (extracted from the spatial parameters) NEW_PROP_TAG(MaterialLawParams); //!< The parameters of the material law (extracted from the spatial parameters) +NEW_PROP_TAG(EffectiveDiffusivityModel); //!< The employed model for the computation of the effective diffusivity NEW_PROP_TAG(ReplaceCompEqIdx); //!< The index of the total mass balance equation, if one component balance is replaced (ReplaceCompEqIdx < NumComponents) NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output diff --git a/dumux/porousmediumflow/2pnc/implicit/propertydefaults.hh b/dumux/porousmediumflow/2pnc/implicit/propertydefaults.hh index 1006e7c0c1e7b4f5516890b01df0196048fa3983..779d4bbc87b164e357a9ed5bde6d9ee8f21633e2 100644 --- a/dumux/porousmediumflow/2pnc/implicit/propertydefaults.hh +++ b/dumux/porousmediumflow/2pnc/implicit/propertydefaults.hh @@ -36,6 +36,7 @@ #include "newtoncontroller.hh" #include +#include #include #include #include @@ -63,6 +64,7 @@ public: static const int value = FluidSystem::numComponents; }; + //! Set as default that no component mass balance is replaced by the total mass balance SET_PROP(TwoPNC, ReplaceCompEqIdx) { @@ -72,7 +74,8 @@ private: public: static const int value = FluidSystem::numComponents; }; -//! The major components belonging to the existing phases are mentioned here e.g., 2 for water and air being the major component in the liquid and gas phases in a 2 phase system + +//! The major components belonging to the existing phases, e.g. 2 for water and air being the major components in a liquid-gas-phase system SET_PROP(TwoPNC, NumMajorComponents) { private: @@ -81,9 +84,12 @@ private: public: static const int value = FluidSystem::numPhases; static_assert(value == 2, - "The model is restricted to two-phases, thus number of major components must also be two."); + "The model is restricted to two phases, thus number of major components must also be two."); }; +//! Set the primary variables mole fractions for the wetting or non-wetting phase +SET_BOOL_PROP(TwoPNC, SetMoleFractionsForWettingPhase, true); + /*! * \brief Set the property for the number of fluid phases. * @@ -100,6 +106,7 @@ public: static_assert(value == 2, "Only fluid systems with 2 fluid phases are supported by the 2p-nc model!"); }; + /*! * \brief Set the property for the number of equations: For each existing component one equation has to be solved. */ @@ -126,8 +133,8 @@ SET_PROP(TwoPNC, FluidState){ typedef CompositionalFluidState type; }; -//! Set the default formulation to pl-Sg: This can be over written in the problem. -SET_INT_PROP(TwoPNC, Formulation, TwoPNCFormulation::plSg); +//! Set the default formulation to pw-Sn: This can be over written in the problem. +SET_INT_PROP(TwoPNC, Formulation, TwoPNCFormulation::pwsn); //! Set the property for the material parameters by extracting it from the material law. SET_PROP(TwoPNC, MaterialLawParams) @@ -169,6 +176,10 @@ SET_TYPE_PROP(TwoPNC, Indices, TwoPNCIndices ); //! Use the ImplicitSpatialParams by default SET_TYPE_PROP(TwoPNC, SpatialParams, ImplicitSpatialParams); +//! Use the model after Millington (1961) for the effective diffusivity +SET_TYPE_PROP(TwoPNC, EffectiveDiffusivityModel, + DiffusivityMillingtonQuirk); + //! Enable gravity by default SET_BOOL_PROP(TwoPNC, ProblemEnableGravity, true); diff --git a/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh b/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh index 723123a8d424ec76bc37dbf9e4b0b6cf8980fe96..3bd701493c39e14f6c2160e5311b93263ff81809 100644 --- a/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh @@ -34,7 +34,7 @@ #include "properties.hh" #include "indices.hh" -#include +#include #include namespace Dumux @@ -73,8 +73,8 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables // formulations formulation = GET_PROP_VALUE(TypeTag, Formulation), - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, // phase indices wPhaseIdx = FluidSystem::wPhaseIdx, @@ -98,7 +98,7 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables typedef typename GridView::template Codim<0>::Entity Element; typedef typename Grid::ctype CoordScalar; typedef Dumux::Miscible2pNCComposition Miscible2pNCComposition; - typedef Dumux::ComputeFromReferencePhase2pNC ComputeFromReferencePhase2pNC; + typedef Dumux::ComputeFromReferencePhase ComputeFromReferencePhase; enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; enum { dofCodim = isBox ? dim : 0 }; @@ -142,7 +142,7 @@ public: Scalar kr; if (phaseIdx == wPhaseIdx) kr = MaterialLaw::krw(materialParams, saturation(wPhaseIdx)); - else // ATTENTION: krn requires the liquid saturation // as parameter! + else // ATTENTION: krn requires the wetting-phase saturation as parameter! kr = MaterialLaw::krn(materialParams, saturation(wPhaseIdx)); mobility_[phaseIdx] = kr / fluidState_.viscosity(phaseIdx); @@ -150,7 +150,7 @@ public: int compIIdx = phaseIdx; for (unsigned int compJIdx = 0; compJIdx < numComponents; ++compJIdx) { - // binary diffusion coefficents + // binary diffusion coefficients diffCoeff_[phaseIdx][compJIdx] = 0.0; if(compIIdx!= compJIdx) { @@ -200,20 +200,25 @@ public: // set the saturations ///////////// - Scalar Sg; + Scalar Sg; if (phasePresence == nPhaseOnly) Sg = 1.0; - else if (phasePresence == wPhaseOnly) { + else if (phasePresence == wPhaseOnly) + { Sg = 0.0; } - else if (phasePresence == bothPhases) { - if (formulation == plSg) + else if (phasePresence == bothPhases) + { + if (formulation == pwsn) Sg = priVars[switchIdx]; - else if (formulation == pgSl) + else if (formulation == pnsw) Sg = 1.0 - priVars[switchIdx]; else DUNE_THROW(Dune::InvalidStateException, "Formulation: " << formulation << " is invalid."); } - else DUNE_THROW(Dune::InvalidStateException, "phasePresence: " << phasePresence << " is invalid."); + else + { + DUNE_THROW(Dune::InvalidStateException, "phasePresence: " << phasePresence << " is invalid."); + } fluidState.setSaturation(nPhaseIdx, Sg); fluidState.setSaturation(wPhaseIdx, 1.0 - Sg); @@ -223,17 +228,17 @@ public: // calculate capillary pressure const MaterialLawParams &materialParams - = problem.spatialParams().materialLawParams(element, fvGeometry, scvIdx); + = problem.spatialParams().materialLawParams(element, fvGeometry, scvIdx); Scalar pc = MaterialLaw::pc(materialParams, 1 - Sg); // extract the pressures - if (formulation == plSg) { + if (formulation == pwsn) { fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]); if (priVars[pressureIdx] + pc < 0.0) DUNE_THROW(NumericalProblem,"Capillary pressure is too low"); fluidState.setPressure(nPhaseIdx, priVars[pressureIdx] + pc); } - else if (formulation == pgSl) { + else if (formulation == pnsw) { fluidState.setPressure(nPhaseIdx, priVars[pressureIdx]); // Here we check for (p_g - pc) in order to ensure that (p_l > 0) if (priVars[pressureIdx] - pc < 0.0) @@ -249,66 +254,74 @@ public: // calculate the phase compositions ///////////// - typename FluidSystem::ParameterCache paramCache; - + typename FluidSystem::ParameterCache paramCache; // now comes the tricky part: calculate phase composition - if (phasePresence == bothPhases) { + if (phasePresence == bothPhases) + { // both phases are present, phase composition results from - // the gas <-> liquid equilibrium. This is + // the nonwetting <-> wetting equilibrium. This is // the job of the "MiscibleMultiPhaseComposition" // constraint solver // set the known mole fractions in the fluidState so that they // can be used by the Miscible2pNCComposition constraint solver + unsigned int knownPhaseIdx = nPhaseIdx; + if (GET_PROP_VALUE(TypeTag, SetMoleFractionsForWettingPhase)) + { + knownPhaseIdx = wPhaseIdx; + } + for (int compIdx=numMajorComponents; compIdx moleFrac; - moleFrac[wCompIdx] = priVars[switchIdx]; - for (int compIdx=numMajorComponents; compIdx moleFrac; for (int compIdx=numMajorComponents; compIdxfluidState_.molarity(phaseIdx, compIdx);} /*! @@ -464,9 +460,7 @@ public: * \param compIdx the index of the component */ Scalar massFraction(int phaseIdx, int compIdx) const - { - return this->fluidState_.massFraction(phaseIdx, compIdx); - } + { return this->fluidState_.massFraction(phaseIdx, compIdx); } /*! * \brief Returns the mole fraction of a component in the phase @@ -475,12 +469,9 @@ public: * \param compIdx the index of the component */ Scalar moleFraction(int phaseIdx, int compIdx) const - { - return this->fluidState_.moleFraction(phaseIdx, compIdx); - } + { return this->fluidState_.moleFraction(phaseIdx, compIdx); } protected: - static Scalar temperature_(const PrimaryVariables &priVars, const Problem& problem, const Element &element, @@ -499,8 +490,8 @@ protected: } /*! - * \brief Called by update() to compute the energy related quantities - */ + * \brief Called by update() to compute the energy related quantities + */ void updateEnergy_(const PrimaryVariables &priVars, const Problem &problem, const Element &element, @@ -509,8 +500,8 @@ protected: bool isOldSol) { }; - Scalar porosity_; //!< Effective porosity within the control volume - Scalar mobility_[numPhases]; //!< Effective mobility within the control volume + Scalar porosity_; //!< Effective porosity within the control volume + Scalar mobility_[numPhases]; //!< Effective mobility within the control volume Scalar density_; FluidState fluidState_; Scalar theta_; @@ -524,7 +515,6 @@ private: const Implementation &asImp_() const { return *static_cast(this); } - }; } // end namespace diff --git a/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh b/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh index 1f53e0eabf48d1b83bb47cb7032824f53ec277c6..f8b3c1b79314b98ea866cf80f97737c55b79f7b1 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh @@ -80,8 +80,8 @@ protected: nPhaseOnly = Indices::nPhaseOnly, bothPhases = Indices::bothPhases, - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, formulation = GET_PROP_VALUE(TypeTag, Formulation) }; diff --git a/dumux/porousmediumflow/2pncmin/implicit/model.hh b/dumux/porousmediumflow/2pncmin/implicit/model.hh index 55758e6d4ac41508d2ffe2ed3aba2faf9b06e54c..a4d52f87911ff3e842708fd7141a734937c82674 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/model.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/model.hh @@ -149,8 +149,8 @@ class TwoPNCMinModel: public TwoPNCModel nPhaseOnly = Indices::nPhaseOnly, bothPhases = Indices::bothPhases, - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, formulation = GET_PROP_VALUE(TypeTag, Formulation) }; @@ -186,32 +186,37 @@ public: auto numDofs = this->numDofs(); // create the required scalar fields - ScalarField *Sg = writer.allocateManagedBuffer(numDofs); - ScalarField *Sl = writer.allocateManagedBuffer(numDofs); - ScalarField *pg = writer.allocateManagedBuffer (numDofs); - ScalarField *pl = writer.allocateManagedBuffer (numDofs); + ScalarField *sn = writer.allocateManagedBuffer(numDofs); + ScalarField *sw = writer.allocateManagedBuffer(numDofs); + ScalarField *pn = writer.allocateManagedBuffer (numDofs); + ScalarField *pw = writer.allocateManagedBuffer (numDofs); ScalarField *pc = writer.allocateManagedBuffer (numDofs); - ScalarField *rhoL = writer.allocateManagedBuffer (numDofs); - ScalarField *rhoG = writer.allocateManagedBuffer (numDofs); - ScalarField *mobL = writer.allocateManagedBuffer (numDofs); - ScalarField *mobG = writer.allocateManagedBuffer (numDofs); + ScalarField *rhoW = writer.allocateManagedBuffer (numDofs); + ScalarField *rhoN = writer.allocateManagedBuffer (numDofs); + ScalarField *mobW = writer.allocateManagedBuffer (numDofs); + ScalarField *mobN = writer.allocateManagedBuffer (numDofs); ScalarField *phasePresence = writer.allocateManagedBuffer (numDofs); ScalarField *temperature = writer.allocateManagedBuffer (numDofs); ScalarField *poro = writer.allocateManagedBuffer (numDofs); ScalarField *permeabilityFactor = writer.allocateManagedBuffer (numDofs); ScalarField *precipitateVolumeFraction[numSPhases]; - for (int i = 0; i < numSPhases; ++i) - precipitateVolumeFraction[i] = writer.allocateManagedBuffer(numDofs); + for (int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx) + precipitateVolumeFraction[sPhaseIdx] = writer.allocateManagedBuffer(numDofs); ScalarField *massFraction[numPhases][numComponents]; - for (int i = 0; i < numPhases; ++i) - for (int j = 0; j < numComponents; ++j) - massFraction[i][j] = writer.allocateManagedBuffer(numDofs); + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + massFraction[phaseIdx][compIdx] = writer.allocateManagedBuffer(numDofs); + + ScalarField *moleFraction[numPhases][numComponents]; + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + moleFraction[phaseIdx][compIdx] = writer.allocateManagedBuffer(numDofs); ScalarField *molarity[numComponents]; - for (int j = 0; j < numComponents ; ++j) - molarity[j] = writer.allocateManagedBuffer(numDofs); + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + molarity[compIdx] = writer.allocateManagedBuffer(numDofs); ScalarField *Perm[dim]; for (int j = 0; j < dim; ++j) //Permeability only in main directions xx and yy @@ -251,15 +256,15 @@ public: { auto dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); - (*Sg)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(nPhaseIdx); - (*Sl)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(wPhaseIdx); - (*pg)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx); - (*pl)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx); + (*sn)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(nPhaseIdx); + (*sw)[dofIdxGlobal] = elemVolVars[scvIdx].saturation(wPhaseIdx); + (*pn)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx); + (*pw)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx); (*pc)[dofIdxGlobal] = elemVolVars[scvIdx].capillaryPressure(); - (*rhoL)[dofIdxGlobal] = elemVolVars[scvIdx].density(wPhaseIdx); - (*rhoG)[dofIdxGlobal] = elemVolVars[scvIdx].density(nPhaseIdx); - (*mobL)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(wPhaseIdx); - (*mobG)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(nPhaseIdx); + (*rhoW)[dofIdxGlobal] = elemVolVars[scvIdx].density(wPhaseIdx); + (*rhoN)[dofIdxGlobal] = elemVolVars[scvIdx].density(nPhaseIdx); + (*mobW)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(wPhaseIdx); + (*mobN)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(nPhaseIdx); (*poro)[dofIdxGlobal] = elemVolVars[scvIdx].porosity(); for (int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx) @@ -273,12 +278,16 @@ public: for (int compIdx = 0; compIdx < numComponents; ++compIdx) (*massFraction[phaseIdx][compIdx])[dofIdxGlobal]= elemVolVars[scvIdx].massFraction(phaseIdx,compIdx); + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + (*moleFraction[phaseIdx][compIdx])[dofIdxGlobal]= elemVolVars[scvIdx].moleFraction(phaseIdx,compIdx); + for (int compIdx = 0; compIdx < numComponents; ++compIdx) (*molarity[compIdx])[dofIdxGlobal] = (elemVolVars[scvIdx].molarity(wPhaseIdx, compIdx)); Tensor K = this->perm_(this->problem_().spatialParams().intrinsicPermeability(element, fvGeometry, scvIdx)); - for (int j = 0; jstaticDat_[dofIdxGlobal].wasSwitched) Smin = -0.01; - //if saturation of liquid phase is smaller 0 switch + //if saturation of wetting phase is smaller 0 switch if (volVars.saturation(wPhaseIdx) <= Smin) { wouldSwitch = true; - //liquid phase has to disappear - std::cout << "Liquid Phase disappears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", Sl: " + //wetting phase has to disappear + std::cout << "Wetting Phase disappears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", Sw: " << volVars.saturation(wPhaseIdx) << std::endl; newPhasePresence = nPhaseOnly; - //switch not depending on formulation - //switch "Sl" to "xgH20" + //switch saturation to xnH20 (not depending on formulation) globalSol[dofIdxGlobal][switchIdx] = volVars.moleFraction(nPhaseIdx, wCompIdx /*H2O*/); - //Here unlike 2pnc model we do not switch all components to to mole fraction in gas phase + //Here unlike 2pnc model we do not switch all components to to mole fraction in nonwetting phase } - //if saturation of gas phase is smaller than 0 switch + //if saturation of nonwetting phase is smaller than 0 switch else if (volVars.saturation(nPhaseIdx) <= Smin) { wouldSwitch = true; - //gas phase has to disappear - std::cout << "Gas Phase disappears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", Sg: " + //nonwetting phase has to disappear + std::cout << "Nonwetting Phase disappears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", Sn: " << volVars.saturation(nPhaseIdx) << std::endl; newPhasePresence = wPhaseOnly; - //switch "Sl" to "xlN2" + //switch saturation to xwN2 (not depending on formulation) globalSol[dofIdxGlobal][switchIdx] = volVars.moleFraction(wPhaseIdx, nCompIdx /*N2*/); } } else if (phasePresence == nPhaseOnly) { - Scalar sumxl = 0; - //Calculate sum of mole fractions (water and air) in the hypothetical liquid phase + Scalar sumxw = 0; + //Calculate sum of mole fractions in the hypothetical wetting phase for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxl += volVars.moleFraction(wPhaseIdx, compIdx); + sumxw += volVars.moleFraction(wPhaseIdx, compIdx); } - Scalar xlmax = 1.0; - if (sumxl > xlmax) + Scalar xwmax = 1.0; + if (sumxw > xwmax) wouldSwitch = true; if (this->staticDat_[dofIdxGlobal].wasSwitched) - xlmax *=1.02; + xwmax *=1.02; //if the sum of the mole fractions would be larger than //1, wetting phase appears - if (sumxl/*sum of mole fractions*/ > xlmax/*1*/) + if (sumxw/*sum of mole fractions*/ > xwmax/*1*/) { - // liquid phase appears - std::cout << "Liquid Phase appears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", sumxl: " - << sumxl << std::endl; + // wetting phase appears + std::cout << "Wetting Phase appears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", sumxw: " + << sumxw << std::endl; newPhasePresence = bothPhases; - if (formulation == pgSl) + if (formulation == pnsw) globalSol[dofIdxGlobal][switchIdx] = 0.0; - else if (formulation == plSg) + else if (formulation == pwsn) globalSol[dofIdxGlobal][switchIdx] = 1.0; - //Here unlike 2pnc model we do not switch all components to to mole fraction in gas phase + //Here unlike 2pnc model we do not switch all components to to mole fraction in nonwetting phase } } else if (phasePresence == wPhaseOnly) { - Scalar xgmax = 1; - Scalar sumxg = 0; - //Calculate sum of mole fractions in the hypothetical gas phase + Scalar xnmax = 1; + Scalar sumxn = 0; + //Calculate sum of mole fractions in the hypothetical nonwetting phase for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxg += volVars.moleFraction(nPhaseIdx, compIdx); + sumxn += volVars.moleFraction(nPhaseIdx, compIdx); } - if (sumxg > xgmax) + if (sumxn > xnmax) wouldSwitch = true; if (this->staticDat_[dofIdxGlobal].wasSwitched) - xgmax *=1.02; - //liquid phase appears if sum is larger than one - if (sumxg > xgmax) + xnmax *=1.02; + //nonwetting phase appears if sum is larger than one + if (sumxn > xnmax) { - std::cout << "Gas Phase appears at vertex " << dofIdxGlobal - << ", coordinated: " << globalPos << ", sumxg: " - << sumxg << std::endl; + std::cout << "Nonwetting Phase appears at vertex " << dofIdxGlobal + << ", coordinated: " << globalPos << ", sumxn: " + << sumxn << std::endl; newPhasePresence = bothPhases; - //saturation of the liquid phase set to 0.9999 (if formulation pgSl and vice versa) - if (formulation == pgSl) + //saturation of the wetting phase set to 0.9999 (if formulation pnsw and vice versa) + if (formulation == pnsw) globalSol[dofIdxGlobal][switchIdx] = 0.999; - else if (formulation == plSg) + else if (formulation == pwsn) globalSol[dofIdxGlobal][switchIdx] = 0.001; } diff --git a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh b/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh index e775435e054bbf4d34b6b088d151d734cde7a686..ddc8f86a28efa08d87b5a8b539855028d4a645f9 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -76,8 +76,8 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables // formulations formulation = GET_PROP_VALUE(TypeTag, Formulation), - plSg = TwoPNCFormulation::plSg, - pgSl = TwoPNCFormulation::pgSl, + pwsn = TwoPNCFormulation::pwsn, + pnsw = TwoPNCFormulation::pnsw, // phase indices wPhaseIdx = FluidSystem::wPhaseIdx, @@ -103,7 +103,7 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables typedef Dune::FieldVector GlobalPosition; typedef typename Grid::ctype CoordScalar; typedef Dumux::Miscible2pNCComposition Miscible2pNCComposition; - typedef Dumux::ComputeFromReferencePhase2pNCMin ComputeFromReferencePhase2pNCMin; + typedef Dumux::ComputeFromReferencePhase ComputeFromReferencePhase; enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; enum { dofCodim = isBox ? dim : 0 }; @@ -153,7 +153,8 @@ public: // this->porosity_ = initialPorosity_ - sumPrecipitates_; - this->porosity_ = std::max(minimumPorosity_, std::max(0.0, initialPorosity_ - sumPrecipitates_)); + using std::max; + this->porosity_ = max(minimumPorosity_, max(0.0, initialPorosity_ - sumPrecipitates_)); salinity_= 0.0; moleFractionSalinity_ = 0.0; @@ -170,31 +171,32 @@ public: // so that one can select the relation form the input file. // kozeny-Carman relation - permeabilityFactor_ = std::pow(((1-initialPorosity_)/(1-this->porosity_)), 2) - * std::pow((this->porosity_/initialPorosity_), 3); + using std::pow; + permeabilityFactor_ = pow(((1-initialPorosity_)/(1-this->porosity_)), 2) + * pow((this->porosity_/initialPorosity_), 3); // Verma-Pruess relation - // permeabilityFactor_ = 100 * std::pow(((this->porosity_/initialPorosity_)-0.9),2); + // permeabilityFactor_ = 100 * pow(((this->porosity_/initialPorosity_)-0.9),2); // Modified Fair-Hatch relation with final porosity set to 0.2 and E1=1 - // permeabilityFactor_ = std::pow((this->porosity_/initialPorosity_),3) - // * std::pow((std::pow((1 - initialPorosity_),2/3))+(std::pow((0.2 - initialPorosity_),2/3)),2) - // / std::pow((std::pow((1 -this->porosity_),2/3))+(std::pow((0.2 -this->porosity_),2/3)),2); + // permeabilityFactor_ = pow((this->porosity_/initialPorosity_),3) + // * pow((pow((1 - initialPorosity_),2/3))+(pow((0.2 - initialPorosity_),2/3)),2) + // / pow((pow((1 -this->porosity_),2/3))+(((0.2 -this->porosity_),2/3)),2); //Timur relation with residual water saturation set to 0.001 - // permeabilityFactor_ = 0.136 * (std::pow(this->porosity_,4.4)) / (2000 * (std::pow(0.001,2))); + // permeabilityFactor_ = 0.136 * (pow(this->porosity_,4.4)) / (2000 * (pow(0.001,2))); //Timur relation1 with residual water saturation set to 0.001 - // permeabilityFactor_ = 0.136 * (std::pow(this->porosity_,4.4)) / (200000 * (std::pow(0.001,2))); + // permeabilityFactor_ = 0.136 * (pow(this->porosity_,4.4)) / (200000 * (pow(0.001,2))); // Bern. relation - // permeabilityFactor_ = std::pow((this->porosity_/initialPorosity_),8); + // permeabilityFactor_ = pow((this->porosity_/initialPorosity_),8); //Tixier relation with residual water saturation set to 0.001 - // permeabilityFactor_ = (std::pow((250 * (std::pow(this->porosity_,3)) / 0.001),2)) / initialPermeability_; + // permeabilityFactor_ = (pow((250 * (pow(this->porosity_,3)) / 0.001),2)) / initialPermeability_; //Coates relation with residual water saturation set to 0.001 - // permeabilityFactor_ = (std::pow((100 * (std::pow(this->porosity_,2)) * (1-0.001) / 0.001,2))) / initialPermeability_ ; + // permeabilityFactor_ = (pow((100 * (pow(this->porosity_,2)) * (1-0.001) / 0.001,2))) / initialPermeability_ ; // energy related quantities not contained in the fluid state //asImp_().updateEnergy_(priVars, problem,element, fvGeometry, scvIdx, isOldSol); @@ -234,9 +236,9 @@ public: } else if (phasePresence == bothPhases) { - if (formulation == plSg) + if (formulation == pwsn) Sg = priVars[switchIdx]; - else if (formulation == pgSl) + else if (formulation == pnsw) Sg = 1.0 - priVars[switchIdx]; else DUNE_THROW(Dune::InvalidStateException, "Formulation: " << formulation << " is invalid."); @@ -255,11 +257,11 @@ public: Scalar pc = MaterialLaw::pc(materialParams, 1 - Sg); // extract the pressures - if (formulation == plSg) { + if (formulation == pwsn) { fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]); fluidState.setPressure(nPhaseIdx, priVars[pressureIdx] + pc); } - else if (formulation == pgSl) { + else if (formulation == pnsw) { fluidState.setPressure(nPhaseIdx, priVars[pressureIdx]); fluidState.setPressure(wPhaseIdx, priVars[pressureIdx] - pc); } @@ -275,7 +277,7 @@ public: if (phasePresence == bothPhases) { // both phases are present, phase composition results from - // the gas <-> liquid equilibrium. This is + // the nonwetting <-> wetting equilibrium. This is // the job of the "MiscibleMultiPhaseComposition" // constraint solver @@ -314,13 +316,13 @@ public: /(fugCoeffG[compIdx]*fluidState.pressure(nPhaseIdx)); moleFrac[wCompIdx] = priVars[switchIdx]; - Scalar sumMoleFracNotGas = 0; + Scalar sumMoleFracOtherComponents = 0; for (int compIdx=numMajorComponents; compIdx moleFrac; for (int compIdx=numMajorComponents; compIdxfluidState_.density(phaseIdx); - else if (phaseIdx >= numPhases) - return FluidSystem::precipitateDensity(phaseIdx); else - DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); + return FluidSystem::precipitateDensity(phaseIdx); } /*! * \brief Returns the mass density of a given phase within the @@ -453,10 +453,8 @@ public: { if (phaseIdx < numPhases) return this->fluidState_.molarDensity(phaseIdx); - else if (phaseIdx >= numPhases) - return FluidSystem::precipitateMolarDensity(phaseIdx); else - DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); + return FluidSystem::precipitateMolarDensity(phaseIdx); } /*! diff --git a/dumux/porousmediumflow/3p3c/implicit/fluxvariables.hh b/dumux/porousmediumflow/3p3c/implicit/fluxvariables.hh index 96cc560572590c1b10cd195c35628105a087f972..f97800fb261dc87530b2d983a7c9d03d1b4b5680 100644 --- a/dumux/porousmediumflow/3p3c/implicit/fluxvariables.hh +++ b/dumux/porousmediumflow/3p3c/implicit/fluxvariables.hh @@ -222,16 +222,13 @@ private: const VolumeVariables &volVarsI = elemVolVars[this->face().i]; const VolumeVariables &volVarsJ = elemVolVars[this->face().j]; - Dune::FieldMatrix diffusionCoefficientMatrix_i = volVarsI.diffusionCoefficient(); - Dune::FieldMatrix diffusionCoefficientMatrix_j = volVarsJ.diffusionCoefficient(); - // the effective diffusion coefficients at vertex i and j Scalar diffCoeffI; Scalar diffCoeffJ; for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - // make sure to calculate only diffusion coefficents + // make sure to calculate only diffusion coefficients // for phases which exist in both finite volumes /* \todo take care: This should be discussed once again * as long as a meaningful value can be found for the required mole fraction @@ -248,10 +245,10 @@ private: // Diffusion coefficient in the porous medium diffCoeffI = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsI.porosity(), volVarsI.saturation(phaseIdx), - diffusionCoefficientMatrix_i[phaseIdx][wCompIdx]); + volVarsI.diffCoeff(phaseIdx, wCompIdx)); diffCoeffJ = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsJ.porosity(), volVarsJ.saturation(phaseIdx), - diffusionCoefficientMatrix_j[phaseIdx][wCompIdx]); + volVarsJ.diffCoeff(phaseIdx, wCompIdx)); // -> harmonic mean porousDiffCoeff_[phaseIdx][wCompIdx] = harmonicMean(diffCoeffI, diffCoeffJ); @@ -259,10 +256,10 @@ private: // Diffusion coefficient in the porous medium diffCoeffI = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsI.porosity(), volVarsI.saturation(phaseIdx), - diffusionCoefficientMatrix_i[phaseIdx][nCompIdx]); + volVarsI.diffCoeff(phaseIdx, nCompIdx)); diffCoeffJ = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsJ.porosity(), volVarsJ.saturation(phaseIdx), - diffusionCoefficientMatrix_j[phaseIdx][nCompIdx]); + volVarsJ.diffCoeff(phaseIdx, nCompIdx)); // -> harmonic mean porousDiffCoeff_[phaseIdx][nCompIdx] = harmonicMean(diffCoeffI, diffCoeffJ); @@ -270,10 +267,10 @@ private: // Diffusion coefficient in the porous medium diffCoeffI = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsI.porosity(), volVarsI.saturation(phaseIdx), - diffusionCoefficientMatrix_i[phaseIdx][gCompIdx]); + volVarsI.diffCoeff(phaseIdx, gCompIdx)); diffCoeffJ = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsJ.porosity(), volVarsJ.saturation(phaseIdx), - diffusionCoefficientMatrix_j[phaseIdx][gCompIdx]); + volVarsJ.diffCoeff(phaseIdx, gCompIdx)); // -> harmonic mean porousDiffCoeff_[phaseIdx][gCompIdx] = harmonicMean(diffCoeffI, diffCoeffJ); @@ -282,14 +279,13 @@ private: public: /*! - * \brief The diffusivity matrix + * \brief The binary diffusion coefficient for each fluid phase. * - * \tparam Scalar Field type - * \tparam numPhases The number of phases of the problem - * \tparam numComponents The number of components of the problem + * \param phaseIdx The phase index + * \param compIdx The component index */ - Dune::FieldMatrix porousDiffCoeff() const - { return porousDiffCoeff_; }; + Scalar porousDiffCoeff(int phaseIdx, int compIdx) const + { return porousDiffCoeff_[phaseIdx][compIdx];} /*! * \brief Return density \f$\mathrm{[kg/m^3]}\f$ of a phase. diff --git a/dumux/porousmediumflow/3p3c/implicit/localresidual.hh b/dumux/porousmediumflow/3p3c/implicit/localresidual.hh index 4fd38e47b6a16b775effc6dd2902b8229fbcc176..2eadf111f1948ee82367af42085a4255bbf05108 100644 --- a/dumux/porousmediumflow/3p3c/implicit/localresidual.hh +++ b/dumux/porousmediumflow/3p3c/implicit/localresidual.hh @@ -187,31 +187,31 @@ public: { // TODO: reference!? Dune::FieldMatrix averagedPorousDiffCoeffMatrix = fluxVars.porousDiffCoeff(); // add diffusive flux of gas component in liquid phase - Scalar tmp = - fluxVars.porousDiffCoeff()[wPhaseIdx][gCompIdx] * fluxVars.molarDensity(wPhaseIdx); + Scalar tmp = - fluxVars.porousDiffCoeff(wPhaseIdx, gCompIdx) * fluxVars.molarDensity(wPhaseIdx); tmp *= (fluxVars.moleFractionCompGGrad(wPhaseIdx) * fluxVars.face().normal); Scalar jGW = tmp; - tmp = - fluxVars.porousDiffCoeff()[wPhaseIdx][nCompIdx] * fluxVars.molarDensity(wPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(wPhaseIdx, nCompIdx) * fluxVars.molarDensity(wPhaseIdx); tmp *= (fluxVars.moleFractionCompNGrad(wPhaseIdx) * fluxVars.face().normal); Scalar jNW = tmp; Scalar jWW = -(jGW+jNW); - tmp = - fluxVars.porousDiffCoeff()[gPhaseIdx][wCompIdx] * fluxVars.molarDensity(gPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(gPhaseIdx, wCompIdx) * fluxVars.molarDensity(gPhaseIdx); tmp *= (fluxVars.moleFractionCompWGrad(gPhaseIdx) * fluxVars.face().normal); Scalar jWG = tmp; - tmp = - fluxVars.porousDiffCoeff()[gPhaseIdx][nCompIdx] * fluxVars.molarDensity(gPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(gPhaseIdx, nCompIdx) * fluxVars.molarDensity(gPhaseIdx); tmp *= (fluxVars.moleFractionCompNGrad(gPhaseIdx) * fluxVars.face().normal); Scalar jNG = tmp; Scalar jGG = -(jWG+jNG); - tmp = - fluxVars.porousDiffCoeff()[nPhaseIdx][wCompIdx] * fluxVars.molarDensity(nPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(nPhaseIdx, wCompIdx) * fluxVars.molarDensity(nPhaseIdx); tmp *= (fluxVars.moleFractionCompWGrad(nPhaseIdx) * fluxVars.face().normal); Scalar jWN = tmp; - tmp = - fluxVars.porousDiffCoeff()[nPhaseIdx][gCompIdx] * fluxVars.molarDensity(nPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(nPhaseIdx, gCompIdx) * fluxVars.molarDensity(nPhaseIdx); tmp *= (fluxVars.moleFractionCompGGrad(nPhaseIdx) * fluxVars.face().normal); Scalar jGN = tmp; diff --git a/dumux/porousmediumflow/3p3c/implicit/model.hh b/dumux/porousmediumflow/3p3c/implicit/model.hh index daa976dcc510fc7b91385fafe18b67c6c0cbe286..070f224ce079d205acb04eea484aeac55d0017c7 100644 --- a/dumux/porousmediumflow/3p3c/implicit/model.hh +++ b/dumux/porousmediumflow/3p3c/implicit/model.hh @@ -153,39 +153,25 @@ public: setSwitched_(false); - if (isBox) - { - for (const auto& vertex : vertices(this->gridView_())) - { - int vIdxGlobal = this->dofMapper().index(vertex); - - const GlobalPosition &globalPos = vertex.geometry().corner(0); + FVElementGeometry fvGeometry; - // initialize phase presence - staticDat_[vIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(vertex, vIdxGlobal, - globalPos); - staticDat_[vIdxGlobal].wasSwitched = false; - - staticDat_[vIdxGlobal].oldPhasePresence - = staticDat_[vIdxGlobal].phasePresence; - } - } - else + for (const auto& element : elements(this->gridView_())) { - for (const auto& element : elements(this->gridView_())) + // deal with the current element + fvGeometry.update(this->gridView_(), element); + + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int eIdxGlobal = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[eIdxGlobal].phasePresence - = this->problem_().initialPhasePresence(*this->gridView_().template begin (), - eIdxGlobal, globalPos); - staticDat_[eIdxGlobal].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[eIdxGlobal].oldPhasePresence - = staticDat_[eIdxGlobal].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } diff --git a/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh b/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh index 388ea943c232bd08e47612b51b62f9fc362ee6ef..ad3ce98856c009c91254b8b90d680e55dacd007a 100644 --- a/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh @@ -542,37 +542,37 @@ public: * for the porous media happens at another place! */ - // diffusivity coefficents - diffusionCoefficient_[gPhaseIdx][wCompIdx] = + // diffusivity coefficients + diffCoeff_[gPhaseIdx][wCompIdx] = FluidSystem::diffusionCoefficient(fluidState_, paramCache, gPhaseIdx, wCompIdx); - diffusionCoefficient_[gPhaseIdx][nCompIdx] = + diffCoeff_[gPhaseIdx][nCompIdx] = FluidSystem::diffusionCoefficient(fluidState_, paramCache, gPhaseIdx, nCompIdx); - diffusionCoefficient_[gPhaseIdx][gCompIdx] = 0.0; // dummy, should not be used ! + diffCoeff_[gPhaseIdx][gCompIdx] = 0.0; // dummy, should not be used ! - diffusionCoefficient_[wPhaseIdx][gCompIdx] = + diffCoeff_[wPhaseIdx][gCompIdx] = FluidSystem::diffusionCoefficient(fluidState_, paramCache, wPhaseIdx, gCompIdx); - diffusionCoefficient_[wPhaseIdx][nCompIdx] = + diffCoeff_[wPhaseIdx][nCompIdx] = FluidSystem::diffusionCoefficient(fluidState_, paramCache, wPhaseIdx, nCompIdx); - diffusionCoefficient_[wPhaseIdx][wCompIdx] = 0.0; // dummy, should not be used ! + diffCoeff_[wPhaseIdx][wCompIdx] = 0.0; // dummy, should not be used ! /* no diffusion in NAPL phase considered at the moment */ - diffusionCoefficient_[nPhaseIdx][nCompIdx] = 0.0; - diffusionCoefficient_[nPhaseIdx][wCompIdx] = 0.0; - diffusionCoefficient_[nPhaseIdx][gCompIdx] = 0.0; + diffCoeff_[nPhaseIdx][nCompIdx] = 0.0; + diffCoeff_[nPhaseIdx][wCompIdx] = 0.0; + diffCoeff_[nPhaseIdx][gCompIdx] = 0.0; - Valgrind::CheckDefined(diffusionCoefficient_); + Valgrind::CheckDefined(diffCoeff_); // porosity porosity_ = problem.spatialParams().porosity(element, @@ -686,10 +686,10 @@ public: { return porosity_; } /*! - * \brief Returns the diffusivity coefficient matrix. + * \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$. */ - Dune::FieldMatrix diffusionCoefficient() const - { return diffusionCoefficient_; } + Scalar diffCoeff(int phaseIdx, int compIdx) const + { return diffCoeff_[phaseIdx][compIdx]; } /*! * \brief Returns the adsorption information. @@ -738,7 +738,7 @@ protected: Scalar bulkDensTimesAdsorpCoeff_; //!< the basis for calculating adsorbed NAPL /* We need a tensor here !! */ //!< Binary diffusion coefficients of the 3 components in the phases - Dune::FieldMatrix diffusionCoefficient_; + Dune::FieldMatrix diffCoeff_; FluidState fluidState_; private: diff --git a/dumux/porousmediumflow/3pwateroil/fluxvariables.hh b/dumux/porousmediumflow/3pwateroil/fluxvariables.hh index f63df3bbafad2f16d663bf3ecc7147ca36a4fbd8..75707dadf004c77a74bd6f7f1962cb11210d2763 100644 --- a/dumux/porousmediumflow/3pwateroil/fluxvariables.hh +++ b/dumux/porousmediumflow/3pwateroil/fluxvariables.hh @@ -53,6 +53,7 @@ class ThreePWaterOilFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariab typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables; + typedef typename GET_PROP_TYPE(TypeTag, EffectiveDiffusivityModel) EffectiveDiffusivityModel; typedef typename GridView::template Codim<0>::Entity Element; typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables; @@ -102,18 +103,6 @@ public: { BaseFluxVariables::update(problem, element, fvGeometry, fIdx, elemVolVars, onBoundary); calculatePorousDiffCoeff_(problem, element, elemVolVars); - - // The spatial parameters calculates the actual heat flux vector - DimVector temperatureGrad(0); - DimVector tmp(0.0); - problem.spatialParams().matrixHeatFlux(tmp, *this, - elemVolVars, - temperatureGrad, - element, - fvGeometry, - fIdx); - // project the heat flux vector on the face's normal vector - normalMatrixHeatFlux_ = tmp*this->face().normal; } private: @@ -219,12 +208,14 @@ private: const VolumeVariables &volVarsI = elemVolVars[this->face().i]; const VolumeVariables &volVarsJ = elemVolVars[this->face().j]; - Dune::FieldVector diffusionCoefficientVector_i = volVarsI.diffusionCoefficient(); - Dune::FieldVector diffusionCoefficientVector_j = volVarsJ.diffusionCoefficient(); + // the effective diffusion coefficients at vertex i and j + Scalar diffCoeffI; + Scalar diffCoeffJ; + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - // make sure to calculate only diffusion coefficents + // make sure to calculate only diffusion coefficients // for phases which exist in both finite volumes /* \todo take care: This should be discussed once again * as long as a meaningful value can be found for the required mole fraction @@ -233,33 +224,31 @@ private: volVarsJ.saturation(phaseIdx) <= 0) { porousDiffCoeff_[phaseIdx] = 0.0; - continue; } + else + { - // calculate tortuosity at the nodes i and j needed - // for porous media diffusion coefficient - - Scalar tauI = - 1.0/(volVarsI.porosity() * volVarsI.porosity()) * - pow(volVarsI.porosity() * volVarsI.saturation(phaseIdx), 7.0/3); - Scalar tauJ = - 1.0/(volVarsJ.porosity() * volVarsJ.porosity()) * - pow(volVarsJ.porosity() * volVarsJ.saturation(phaseIdx), 7.0/3); - // Diffusion coefficient in the porous medium + diffCoeffI = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsI.porosity(), + volVarsI.saturation(phaseIdx), + volVarsI.diffCoeff(phaseIdx)); - // -> harmonic mean - porousDiffCoeff_[phaseIdx] = harmonicMean(volVarsI.porosity() * volVarsI.saturation(phaseIdx) * tauI * diffusionCoefficientVector_i[phaseIdx], - volVarsJ.porosity() * volVarsJ.saturation(phaseIdx) * tauJ * diffusionCoefficientVector_j[phaseIdx]); + diffCoeffJ = EffectiveDiffusivityModel::effectiveDiffusivity(volVarsJ.porosity(), + volVarsJ.saturation(phaseIdx), + volVarsJ.diffCoeff(phaseIdx)); + porousDiffCoeff_[phaseIdx] = harmonicMean(diffCoeffI, diffCoeffJ); + } } } public: /*! - * \brief The diffusivity vector + * \brief The binary diffusion coefficient for each fluid phase. + * + * \param phaseIdx The phase index */ - Dune::FieldVector porousDiffCoeff() const - { return porousDiffCoeff_; }; + Scalar porousDiffCoeff(int phaseIdx) const + { return porousDiffCoeff_[phaseIdx];} /*! * \brief Return density \f$\mathrm{[kg/m^3]}\f$ of a phase. @@ -285,15 +274,6 @@ public: const DimVector &moleFractionCompNGrad(int phaseIdx) const { return moleFractionCompNGrad_[phaseIdx]; }; - /*! - * \brief The total heat flux \f$\mathrm{[J/s]}\f$ due to heat conduction - * of the rock matrix over the sub-control volume's face in - * direction of the face normal. - */ - Scalar normalMatrixHeatFlux() const - { return normalMatrixHeatFlux_; } - - protected: // gradients DimVector massFractionCompWGrad_[numPhases]; @@ -307,7 +287,6 @@ protected: // the diffusivity matrix for the porous medium Dune::FieldVector porousDiffCoeff_; - Scalar normalMatrixHeatFlux_; }; } // end namespace diff --git a/dumux/porousmediumflow/3pwateroil/indices.hh b/dumux/porousmediumflow/3pwateroil/indices.hh index cba433d9c67e9bb6d5795bb0f913d2ec58b25383..f72f14a577971340ae6b3cbc367efc76c0380757 100644 --- a/dumux/porousmediumflow/3pwateroil/indices.hh +++ b/dumux/porousmediumflow/3pwateroil/indices.hh @@ -52,6 +52,7 @@ public: // and room temperature 20°C: static const int wCompIdx = FluidSystem::wCompIdx; static const int nCompIdx = FluidSystem::nCompIdx; + static const int gCompIdx = -1; //!< dummy index for compatibility with 3p3c // present phases (-> 'pseudo' primary variable) static const int threePhases = 1; //!< All three phases are present @@ -69,7 +70,7 @@ public: // equation indices static const int conti0EqIdx = PVOffset + wCompIdx; //!< Index of the mass conservation equation for the water component static const int conti1EqIdx = conti0EqIdx + nCompIdx; //!< Index of the mass conservation equation for the contaminant component - static const int energyEqIdx = PVOffset + 2; //! The index for energy in equation vectors. + static const int conti2EqIdx = -1; //!< dummy index for compatibility with 3p3c static const int contiWEqIdx = conti0EqIdx + wCompIdx; //!< index of the mass conservation equation for the water component static const int contiNEqIdx = conti0EqIdx + nCompIdx; //!< index of the mass conservation equation for the contaminant component diff --git a/dumux/porousmediumflow/3pwateroil/localresidual.hh b/dumux/porousmediumflow/3pwateroil/localresidual.hh index 6b30a986aebb38f220475e8e863b96cf635840f7..6e82d03fd7958c3c93a68666673b0c90b8665d58 100644 --- a/dumux/porousmediumflow/3pwateroil/localresidual.hh +++ b/dumux/porousmediumflow/3pwateroil/localresidual.hh @@ -26,6 +26,7 @@ #define DUMUX_3P2CNI_LOCAL_RESIDUAL_HH #include "properties.hh" +#include namespace Dumux { @@ -38,7 +39,7 @@ namespace Dumux * This class is used to fill the gaps in BoxLocalResidual for the 3P2C flow. */ template -class ThreePWaterOilLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) +class ThreePWaterOilLocalResidual: public ThreePThreeCLocalResidual { protected: typedef typename GET_PROP_TYPE(TypeTag, LocalResidual) Implementation; @@ -57,7 +58,6 @@ protected: conti0EqIdx = Indices::conti0EqIdx,//!< Index of the mass conservation equation for the water component conti1EqIdx = Indices::conti1EqIdx,//!< Index of the mass conservation equation for the contaminant component - energyEqIdx = Indices::energyEqIdx, wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx, @@ -74,8 +74,8 @@ protected: typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GridView::template Codim<0>::Entity Element; - //! property that defines whether mole or mass fractions are used - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); + static const bool useMassOutput = GET_PROP_VALUE(TypeTag, UseMassOutput); + public: /*! @@ -105,154 +105,6 @@ public: evalPhaseStorage_(phaseIdx); } - /*! - * \brief Evaluate the amount all conservation quantities - * (e.g. phase mass) within a sub-control volume. - * - * The result should be averaged over the volume (e.g. phase mass - * inside a sub control volume divided by the volume) - * - * \param storage The mass of the component within the sub-control volume - * \param scvIdx The SCV (sub-control-volume) index - * \param usePrevSol Evaluate function with solution of current or previous time step - */ - void computeStorage(PrimaryVariables &storage, const int scvIdx, bool usePrevSol) const - { - // if flag usePrevSol is set, the solution from the previous - // time step is used, otherwise the current solution is - // used. The secondary variables are used accordingly. This - // is required to compute the derivative of the storage term - // using the implicit euler method. - const ElementVolumeVariables &elemVolVars = - usePrevSol - ? this->prevVolVars_() - : this->curVolVars_(); - const VolumeVariables &volVars = elemVolVars[scvIdx]; - - // compute storage term of all components within all phases - storage = 0; - for (int compIdx = 0; compIdx < numComponents; ++compIdx) - { - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - { - storage[conti0EqIdx + compIdx] += - volVars.porosity() - * volVars.saturation(phaseIdx) - * volVars.molarDensity(phaseIdx) - * volVars.fluidState().moleFraction(phaseIdx, compIdx); - } - } - - // if flag usePrevSol is set, the solution from the previous - // time step is used, otherwise the current solution is - // used. The secondary variables are used accordingly. This - // is required to compute the derivative of the storage term - // using the implicit euler method. - - // compute the energy storage - storage[energyEqIdx] = volVars.porosity() - *( - volVars.density(wPhaseIdx) - *volVars.internalEnergy(wPhaseIdx) - *volVars.saturation(wPhaseIdx) - + - volVars.density(nPhaseIdx) - *volVars.internalEnergy(nPhaseIdx) - *volVars.saturation(nPhaseIdx) - + - volVars.density(gPhaseIdx) - *volVars.internalEnergy(gPhaseIdx) - *volVars.saturation(gPhaseIdx) - ) - + volVars.temperature()*volVars.heatCapacity(); - } - - /*! - * \brief Evaluates the total flux of all conservation quantities - * over a face of a sub-control volume. - * - * \param flux The flux over the SCV (sub-control-volume) face for each component - * \param fIdx The index of the SCV face - * \param onBoundary A boolean variable to specify whether the flux variables - * are calculated for interior SCV faces or boundary faces, default=false - */ - void computeFlux(PrimaryVariables &flux, const int fIdx, const bool onBoundary=false) const - { - FluxVariables fluxVars; - fluxVars.update(this->problem_(), - this->element_(), - this->fvGeometry_(), - fIdx, - this->curVolVars_(), - onBoundary); - - flux = 0; - asImp_()->computeAdvectiveFlux(flux, fluxVars); - asImp_()->computeDiffusiveFlux(flux, fluxVars); - } - - /*! - * \brief Evaluates the advective mass flux of all components over - * a face of a subcontrol volume. - * - * \param flux The advective flux over the sub-control-volume face for each component - * \param fluxVars The flux variables at the current SCV - */ - - void computeAdvectiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const - { - Scalar massUpwindWeight = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MassUpwindWeight); - - //////// - // advective fluxes of all components in all phases - //////// - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - { - // data attached to upstream and the downstream vertices - // of the current phase - const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx(phaseIdx)); - const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx(phaseIdx)); - - for (int compIdx = 0; compIdx < numComponents; ++compIdx) - { - // add advective flux of current component in current - // phase - // if alpha > 0 und alpha < 1 then both upstream and downstream - // nodes need their contribution - // if alpha == 1 (which is mostly the case) then, the downstream - // node is not evaluated - int eqIdx = conti0EqIdx + compIdx; - flux[eqIdx] += fluxVars.volumeFlux(phaseIdx) - * (massUpwindWeight - * up.fluidState().molarDensity(phaseIdx) - * up.fluidState().moleFraction(phaseIdx, compIdx) - + - (1.0 - massUpwindWeight) - * dn.fluidState().molarDensity(phaseIdx) - * dn.fluidState().moleFraction(phaseIdx, compIdx)); - } - } - - // advective heat flux in all phases - flux[energyEqIdx] = 0; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - // vertex data of the upstream and the downstream vertices - const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx(phaseIdx)); - const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx(phaseIdx)); - - flux[energyEqIdx] += - fluxVars.volumeFlux(phaseIdx) * ( - massUpwindWeight * // upstream vertex - ( up.density(phaseIdx) * - up.enthalpy(phaseIdx)) - + - (1-massUpwindWeight) * // downstream vertex - ( dn.density(phaseIdx) * - dn.enthalpy(phaseIdx)) ); - } - - } - /*! * \brief Adds the diffusive mass flux of all components over * a face of a subcontrol volume. @@ -266,19 +118,19 @@ public: // TODO: reference!? Dune::FieldMatrix averagedPorousDiffCoeffMatrix = fluxVars.porousDiffCoeff(); // add diffusive flux of gas component in liquid phase Scalar tmp; - tmp = - fluxVars.porousDiffCoeff()[wPhaseIdx] * fluxVars.molarDensity(wPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(wPhaseIdx) * fluxVars.molarDensity(wPhaseIdx); tmp *= (fluxVars.moleFractionCompNGrad(wPhaseIdx) * fluxVars.face().normal); Scalar jNW = tmp; Scalar jWW = -jNW; - tmp = - fluxVars.porousDiffCoeff()[gPhaseIdx] * fluxVars.molarDensity(gPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(gPhaseIdx) * fluxVars.molarDensity(gPhaseIdx); tmp *= (fluxVars.moleFractionCompWGrad(gPhaseIdx) * fluxVars.face().normal); Scalar jWG = tmp; Scalar jNG = -jWG; - tmp = - fluxVars.porousDiffCoeff()[nPhaseIdx] * fluxVars.molarDensity(nPhaseIdx); + tmp = - fluxVars.porousDiffCoeff(nPhaseIdx) * fluxVars.molarDensity(nPhaseIdx); tmp *= (fluxVars.moleFractionCompWGrad(nPhaseIdx) * fluxVars.face().normal); Scalar jWN = tmp; @@ -288,25 +140,10 @@ public: flux[conti1EqIdx] += jNW+jNG+jNN; } - /*! - * \brief Calculate the source term of the equation - * - * \param source The source/sink in the SCV for each component - * \param scvIdx The index of the SCV - */ - void computeSource(PrimaryVariables &source, const int scvIdx) - { - this->problem_().solDependentSource(source, - this->element_(), - this->fvGeometry_(), - scvIdx, - this->curVolVars_()); - } - protected: void evalPhaseStorage_(const int phaseIdx) { - if(!useMoles) //mass-fraction formulation + if(useMassOutput) //mass-fraction formulation { // evaluate the storage terms of a single phase for (int i=0; i < this->fvGeometry_().numScv; i++) { diff --git a/dumux/porousmediumflow/3pwateroil/model.hh b/dumux/porousmediumflow/3pwateroil/model.hh index a17c7ef2aa16a37cd98d37af1bcd9697376e942f..cdde08f83dda4eae0f2b60c9158eefb879aaa698 100644 --- a/dumux/porousmediumflow/3pwateroil/model.hh +++ b/dumux/porousmediumflow/3pwateroil/model.hh @@ -129,14 +129,9 @@ class ThreePWaterOilModel: public GET_PROP_TYPE(TypeTag, BaseModel) typedef typename GridView::template Codim::Entity Vertex; typedef typename GridView::template Codim<0>::Entity Element; - typedef typename GridView::template Codim<0>::Iterator ElementIterator; - typedef typename GridView::template Codim::Iterator VertexIterator; typedef Dune::FieldVector GlobalPosition; - static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - - enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; enum { dofCodim = isBox ? dim : 0 }; @@ -148,44 +143,33 @@ public: */ void init(Problem &problem) { + static_assert(GET_PROP_VALUE(TypeTag, UseMoles), "This model is not implemented for balancing masses."); + ParentType::init(problem); staticDat_.resize(this->numDofs()); setSwitched_(false); - if (isBox) - { - for (const auto& vertex : vertices(this->gridView_())) - { - int globalIdx = this->dofMapper().index(vertex); - const GlobalPosition &globalPos = vertex.geometry().corner(0); - - // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(vertex, globalIdx, - globalPos); - staticDat_[globalIdx].wasSwitched = false; + FVElementGeometry fvGeometry; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; - } - } - else + for (const auto& element : elements(this->gridView_())) { - for (const auto& element : elements(this->gridView_())) + // deal with the current element + fvGeometry.update(this->gridView_(), element); + + // loop over all element vertices, i.e. sub control volumes + for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) { - int globalIdx = this->dofMapper().index(element); - const GlobalPosition &globalPos = element.geometry().center(); + // get the global index of the degree of freedom + int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim); // initialize phase presence - staticDat_[globalIdx].phasePresence - = this->problem_().initialPhasePresence(*this->gridView_().template begin (), - globalIdx, globalPos); - staticDat_[globalIdx].wasSwitched = false; + staticDat_[dofIdxGlobal].phasePresence = this->problem_().initialPhasePresence(element, fvGeometry, scvIdx); + + staticDat_[dofIdxGlobal].wasSwitched = false; - staticDat_[globalIdx].oldPhasePresence - = staticDat_[globalIdx].phasePresence; + staticDat_[dofIdxGlobal].oldPhasePresence = staticDat_[dofIdxGlobal].phasePresence; } } } diff --git a/dumux/porousmediumflow/3pwateroil/properties.hh b/dumux/porousmediumflow/3pwateroil/properties.hh index 7c42af3d694e188e2b03c7625a3bc77cc5274211..4d131bc91dca38c5b3e9bb41abbaf7f422f1168d 100644 --- a/dumux/porousmediumflow/3pwateroil/properties.hh +++ b/dumux/porousmediumflow/3pwateroil/properties.hh @@ -22,13 +22,16 @@ /*! * \file * - * \brief Defines the properties required for the 3p2cni fully implicit model. + * \brief Defines the properties required for the three-phase two-component + * fully implicit model. This model requires the use of the non-isothermal + * extension found in dumux/implicit/nonisothermal */ #ifndef DUMUX_3P2CNI_PROPERTIES_HH #define DUMUX_3P2CNI_PROPERTIES_HH #include #include +#include namespace Dumux { @@ -38,11 +41,9 @@ namespace Properties ////////////////////////////////////////////////////////////////// // Type tags ////////////////////////////////////////////////////////////////// - -//! The type tags for the implicit three-phase three-component problems -NEW_TYPE_TAG(ThreePWaterOil); -NEW_TYPE_TAG(BoxThreePWaterOil, INHERITS_FROM(BoxModel, ThreePWaterOil)); -NEW_TYPE_TAG(CCThreePWaterOil, INHERITS_FROM(CCModel, ThreePWaterOil)); +NEW_TYPE_TAG(ThreePWaterOilNI, INHERITS_FROM(NonIsothermal)); +NEW_TYPE_TAG(BoxThreePWaterOilNI, INHERITS_FROM(BoxModel, ThreePWaterOilNI)); +NEW_TYPE_TAG(CCThreePWaterOilNI, INHERITS_FROM(CCModel, ThreePWaterOilNI)); ////////////////////////////////////////////////////////////////// // Property tags @@ -60,6 +61,8 @@ NEW_PROP_TAG(MaterialLawParams); //!< The parameters of the material law (extrac NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem NEW_PROP_TAG(UseMoles); //!Defines whether mole (true) or mass (false) fractions are used +NEW_PROP_TAG(UseMassOutput); //!Defines whether mole or mass are used for phaseStorage output +NEW_PROP_TAG(EffectiveDiffusivityModel); //!< The employed model for the computation of the effective diffusivity NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the upwind parameter for the mobility NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility in the velocity calculation diff --git a/dumux/porousmediumflow/3pwateroil/propertydefaults.hh b/dumux/porousmediumflow/3pwateroil/propertydefaults.hh index 8ca4decba4ef7cd50e37c44d95d09cae05b00211..bfbee686a9e8f0c1173209b3be93dddd74c95186 100644 --- a/dumux/porousmediumflow/3pwateroil/propertydefaults.hh +++ b/dumux/porousmediumflow/3pwateroil/propertydefaults.hh @@ -30,6 +30,9 @@ #include #include +#include +#include +#include #include "indices.hh" #include "model.hh" @@ -53,7 +56,7 @@ namespace Properties { * We just forward the number from the fluid system and use an static * assert to make sure it is 2. */ -SET_PROP(ThreePWaterOil, NumComponents) +SET_PROP(ThreePWaterOilNI, NumComponents) { private: typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; @@ -71,7 +74,7 @@ SET_PROP(ThreePWaterOil, NumComponents) * We just forward the number from the fluid system and use an static * assert to make sure it is 2. */ -SET_PROP(ThreePWaterOil, NumPhases) +SET_PROP(ThreePWaterOilNI, NumPhases) { private: typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; @@ -82,64 +85,94 @@ SET_PROP(ThreePWaterOil, NumPhases) "Only fluid systems with 3 phases are supported by the 3p2cni model!"); }; -SET_INT_PROP(ThreePWaterOil, NumEq, 3); //!< set the number of equations to 2 - /*! * \brief Set the property for the material parameters by extracting * it from the material law. */ -SET_TYPE_PROP(ThreePWaterOil, MaterialLawParams, typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params); - -//! The local residual function of the conservation equations -SET_TYPE_PROP(ThreePWaterOil, LocalResidual, ThreePWaterOilLocalResidual); +SET_TYPE_PROP(ThreePWaterOilNI, MaterialLawParams, typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params); //! Use the 3p2cni specific newton controller for the 3p2cni model -SET_TYPE_PROP(ThreePWaterOil, NewtonController, ThreePWaterOilNewtonController); - -//! the Model property -SET_TYPE_PROP(ThreePWaterOil, Model, ThreePWaterOilModel); - -//! the VolumeVariables property -SET_TYPE_PROP(ThreePWaterOil, VolumeVariables, ThreePWaterOilVolumeVariables); - -//! the FluxVariables property -SET_TYPE_PROP(ThreePWaterOil, FluxVariables, ThreePWaterOilFluxVariables); +SET_TYPE_PROP(ThreePWaterOilNI, NewtonController, ThreePWaterOilNewtonController); //! define the base flux variables to realize Darcy flow -SET_TYPE_PROP(ThreePWaterOil, BaseFluxVariables, ImplicitDarcyFluxVariables); +SET_TYPE_PROP(ThreePWaterOilNI, BaseFluxVariables, ImplicitDarcyFluxVariables); //! the upwind factor for the mobility. -SET_SCALAR_PROP(ThreePWaterOil, ImplicitMassUpwindWeight, 1.0); +SET_SCALAR_PROP(ThreePWaterOilNI, ImplicitMassUpwindWeight, 1.0); //! set default mobility upwind weight to 1.0, i.e. fully upwind -SET_SCALAR_PROP(ThreePWaterOil, ImplicitMobilityUpwindWeight, 1.0); +SET_SCALAR_PROP(ThreePWaterOilNI, ImplicitMobilityUpwindWeight, 1.0); //! Determines whether a constraint solver should be used explicitly -SET_BOOL_PROP(ThreePWaterOil, UseSimpleModel, true); - -//! The indices required by the isothermal 3p2cni model -SET_TYPE_PROP(ThreePWaterOil, Indices, ThreePWaterOilIndices); +SET_BOOL_PROP(ThreePWaterOilNI, UseSimpleModel, true); //! The spatial parameters to be employed. //! Use ImplicitSpatialParams by default. -SET_TYPE_PROP(ThreePWaterOil, SpatialParams, ImplicitSpatialParams); +SET_TYPE_PROP(ThreePWaterOilNI, SpatialParams, ImplicitSpatialParams); + +//! Use the model after Millington (1961) for the effective diffusivity +SET_TYPE_PROP(ThreePWaterOilNI, EffectiveDiffusivityModel, + DiffusivityMillingtonQuirk); // disable velocity output by default -SET_BOOL_PROP(ThreePWaterOil, VtkAddVelocity, false); +SET_BOOL_PROP(ThreePWaterOilNI, VtkAddVelocity, false); // enable gravity by default -SET_BOOL_PROP(ThreePWaterOil, ProblemEnableGravity, true); - -SET_BOOL_PROP(ThreePWaterOil, UseMoles, true); //!< Define that mole fractions are used in the balance equations per default +SET_BOOL_PROP(ThreePWaterOilNI, ProblemEnableGravity, true); + //!< Define that mole fractions are used in the balance equations per default +SET_BOOL_PROP(ThreePWaterOilNI, UseMoles, true); +//! Output the storage term in mass +SET_BOOL_PROP(ThreePWaterOilNI, UseMassOutput, false); //! default value for the forchheimer coefficient // Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90. // Actually the Forchheimer coefficient is also a function of the dimensions of the // porous medium. Taking it as a constant is only a first approximation // (Nield, Bejan, Convection in porous media, 2006, p. 10) -SET_SCALAR_PROP(ThreePWaterOil, SpatialParamsForchCoeff, 0.55); +SET_SCALAR_PROP(ThreePWaterOilNI, SpatialParamsForchCoeff, 0.55); + + +//! Somerton is used as default model to compute the effective thermal heat conductivity +SET_PROP(ThreePWaterOilNI, ThermalConductivityModel) +{ +private: + typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; + typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; +public: + typedef ThermalConductivitySomerton type; +}; + +//! temperature is already written by the isothermal model +SET_BOOL_PROP(ThreePWaterOilNI, NiOutputLevel, 0); + +////////////////////////////////////////////////////////////////// +// Property values for isothermal model required for the general non-isothermal model +////////////////////////////////////////////////////////////////// + +// set isothermal Model +SET_TYPE_PROP(ThreePWaterOilNI, IsothermalModel, ThreePWaterOilModel); + +// set isothermal FluxVariables +SET_TYPE_PROP(ThreePWaterOilNI, IsothermalFluxVariables, ThreePWaterOilFluxVariables); + +//set isothermal VolumeVariables +SET_TYPE_PROP(ThreePWaterOilNI, IsothermalVolumeVariables, ThreePWaterOilVolumeVariables); + +//set isothermal LocalResidual +SET_TYPE_PROP(ThreePWaterOilNI, IsothermalLocalResidual, ThreePWaterOilLocalResidual); + +//set isothermal Indices +SET_PROP(ThreePWaterOilNI, IsothermalIndices) +{ + +public: + typedef ThreePWaterOilIndices type; +}; + +//set isothermal NumEq +SET_INT_PROP(ThreePWaterOilNI, IsothermalNumEq, 2); } diff --git a/dumux/porousmediumflow/3pwateroil/volumevariables.hh b/dumux/porousmediumflow/3pwateroil/volumevariables.hh index 016924f699244f573cda1ab6d8197dbde327f498..6e997b83edd5827e9940225da3fc11c7425fdd87 100644 --- a/dumux/porousmediumflow/3pwateroil/volumevariables.hh +++ b/dumux/porousmediumflow/3pwateroil/volumevariables.hh @@ -231,7 +231,8 @@ public: Scalar defect = pg_ - FluidSystem::partialPressureGas(fluidState_, gPhaseIdx, wCompIdx) - FluidSystem::partialPressureGas(fluidState_, gPhaseIdx, nCompIdx); - while(std::abs(defect) > 0.01) // simply a small number chosen ... + using std::abs; + while(abs(defect) > 0.01) // simply a small number chosen ... { Scalar deltaT = 1.e-8 * temp; fluidState_.setTemperature(temp+deltaT); @@ -545,7 +546,8 @@ public: Scalar temp = tempOnlyWater; // initial guess int counter = 0; - while(std::abs(defect) > 0.01) // simply a small number chosen ... + using std::abs; + while(abs(defect) > 0.01) // simply a small number chosen ... { Scalar deltaT = 1.e-6; // fixed number, but T should always be in the order of a few hundred Kelvin fluidState_.setTemperature(temp+deltaT); @@ -674,7 +676,7 @@ public: * for the porous media happens at another place! */ - // diffusivity coefficents + // diffusivity coefficients diffusionCoefficient_[gPhaseIdx] = FluidSystem::diffusionCoefficient(fluidState_, gPhaseIdx); diffusionCoefficient_[wPhaseIdx] = FluidSystem::diffusionCoefficient(fluidState_, wPhaseIdx); @@ -722,6 +724,26 @@ public: Scalar saturation(const int phaseIdx) const { return fluidState_.saturation(phaseIdx); } + /*! + * \brief Returns the mass fraction of a given component in a + * given phase within the control volume in \f$[-]\f$. + * + * \param phaseIdx The phase index + * \param compIdx The component index + */ + Scalar massFraction(const int phaseIdx, const int compIdx) const + { return fluidState_.massFraction(phaseIdx, compIdx); } + + /*! + * \brief Returns the mole fraction of a given component in a + * given phase within the control volume in \f$[-]\f$. + * + * \param phaseIdx The phase index + * \param compIdx The component index + */ + Scalar moleFraction(const int phaseIdx, const int compIdx) const + { return fluidState_.moleFraction(phaseIdx, compIdx); } + /*! * \brief Returns the mass density of a given phase within the * control volume. @@ -789,10 +811,10 @@ public: { return permeability_; } /*! - * \brief Returns the diffusivity coefficient matrix + * \brief Returns the diffusivity coefficient */ - Dune::FieldVector diffusionCoefficient() const - { return diffusionCoefficient_; } + Scalar diffCoeff(int phaseIdx) const + { return diffusionCoefficient_[phaseIdx]; } /*! * \brief Returns the adsorption information @@ -800,7 +822,7 @@ public: Scalar bulkDensTimesAdsorpCoeff() const { return bulkDensTimesAdsorpCoeff_; } -/*! + /*! * \brief Returns the total internal energy of a phase in the * sub-control volume. * @@ -818,15 +840,6 @@ public: Scalar enthalpy(int phaseIdx) const { return fluidState_.enthalpy(phaseIdx); }; - /*! - * \brief Returns the total heat capacity \f$\mathrm{[J/(K*m^3]}\f$ of the rock matrix in - * the sub-control volume. - */ - Scalar heatCapacity() const - { return heatCapacity_; }; - - - protected: /*! @@ -838,19 +851,13 @@ protected: const FVElementGeometry &fvGeometry, const int scvIdx, bool isOldSol) - { - // compute and set the heat capacity of the solid phase - heatCapacity_ = problem.spatialParams().heatCapacity(element, fvGeometry, scvIdx); - Valgrind::CheckDefined(heatCapacity_); - } + { } Scalar sw_, sg_, sn_, pg_, pw_, pn_, temp_; Scalar moleFrac_[numPhases][numComponents]; Scalar massFrac_[numPhases][numComponents]; - Scalar heatCapacity_; - Scalar porosity_; //!< Effective porosity within the control volume Scalar permeability_; //!< Effective porosity within the control volume Scalar mobility_[numPhases]; //!< Effective mobility within the control volume diff --git a/dumux/porousmediumflow/co2/implicit/volumevariables.hh b/dumux/porousmediumflow/co2/implicit/volumevariables.hh index ff328761465fd08f9a372e32b9312981cc956316..543e9c83696f56832d216fa16985e91142411041 100644 --- a/dumux/porousmediumflow/co2/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/co2/implicit/volumevariables.hh @@ -312,7 +312,7 @@ public: ParentType::relativePermeability_[phaseIdx] = kr; Valgrind::CheckDefined(ParentType::relativePermeability_[phaseIdx]); - // binary diffusion coefficents + // binary diffusion coefficients ParentType::diffCoeff_[phaseIdx] = FluidSystem::binaryDiffusionCoefficient(ParentType::fluidState_, paramCache, diff --git a/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh b/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh index 69cc5aeb696b228a8ba6f7735b1cfe50d3181d9b..dc9aa2c0a3479d757f9ec8091285dedb563df1d4 100644 --- a/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh +++ b/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh @@ -182,7 +182,8 @@ protected: kin /= face().area; auto di = face().ipGlobal; di -= elementI.geometry().center(); - auto ti = std::abs(di*kin*face().area/(2*di.two_norm2())); + using std::abs; + auto ti = abs(di*kin*face().area/(2*di.two_norm2())); auto tij = 2*ti; if (!onBoundary_) @@ -196,7 +197,8 @@ protected: kjn /= face().area; auto dj = face().ipGlobal; dj -= elementJ.geometry().center(); - auto tj = std::abs(dj*kjn*face().area/(2*dj.two_norm2())); + using std::abs; + auto tj = abs(dj*kjn*face().area/(2*dj.two_norm2())); tij = harmonicMean(ti, tj); } @@ -217,8 +219,10 @@ protected: Scalar SJ = volVarsJ.fluidState().saturation(phaseIdx); Scalar rhoI = volVarsI.fluidState().density(phaseIdx); Scalar rhoJ = volVarsJ.fluidState().density(phaseIdx); - Scalar fI = std::max(0.0, std::min(SI/1e-5, 0.5)); - Scalar fJ = std::max(0.0, std::min(SJ/1e-5, 0.5)); + using std::max; + using std::min; + Scalar fI = max(0.0, min(SI/1e-5, 0.5)); + Scalar fJ = max(0.0, min(SJ/1e-5, 0.5)); if (Dune::FloatCmp::eq(fI + fJ, 0.0, 1.0e-30)) // doesn't matter because no wetting phase is present in // both cells! diff --git a/dumux/porousmediumflow/implicit/darcyfluxvariables.hh b/dumux/porousmediumflow/implicit/darcyfluxvariables.hh index 812f5c49ab017f22cc4878395e0cc23cf098ff7b..0257cf95d80354973d6abbf0f065b2811032d1c3 100644 --- a/dumux/porousmediumflow/implicit/darcyfluxvariables.hh +++ b/dumux/porousmediumflow/implicit/darcyfluxvariables.hh @@ -213,26 +213,23 @@ protected: // correct the pressure gradient by the gravitational acceleration if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) { - // ask for the gravitational acceleration at the given SCV face - GlobalPosition g(problem.gravityAtPos(face().ipGlobal)); - - // calculate the phase density at the integration point. we - // only do this if the wetting phase is present in both cells + // average the phase density at the integration point. Scalar SI = elemVolVars[face().i].fluidState().saturation(phaseIdx); Scalar SJ = elemVolVars[face().j].fluidState().saturation(phaseIdx); Scalar rhoI = elemVolVars[face().i].fluidState().density(phaseIdx); Scalar rhoJ = elemVolVars[face().j].fluidState().density(phaseIdx); - Scalar fI = std::max(0.0, std::min(SI/1e-5, 0.5)); - Scalar fJ = std::max(0.0, std::min(SJ/1e-5, 0.5)); + // reduce influence if saturation is very small + using std::max; + using std::min; + Scalar fI = max(0.0, min(SI/1e-5, 0.5)); + Scalar fJ = max(0.0, min(SJ/1e-5, 0.5)); + // check whether the phase is not present in both phase if (Dune::FloatCmp::eq(fI + fJ, 0.0, 1.0e-30)) - // doesn't matter because no wetting phase is present in - // both cells! fI = fJ = 0.5; - const Scalar density = (fI*rhoI + fJ*rhoJ)/(fI + fJ); // make gravity acceleration a force - GlobalPosition f(g); - f *= density; + GlobalPosition f(problem.gravityAtPos(face().ipGlobal)); + f *= (fI*rhoI + fJ*rhoJ)/(fI + fJ); // gravity times averaged density // calculate the final potential gradient potentialGrad_[phaseIdx] -= f; diff --git a/dumux/porousmediumflow/implicit/forchheimerfluxvariables.hh b/dumux/porousmediumflow/implicit/forchheimerfluxvariables.hh index 6ee50adac9abe279c5958fc977b5a43959ce9da3..5fa90c81a374e2e1db3a48caf18a771d50b2b791 100644 --- a/dumux/porousmediumflow/implicit/forchheimerfluxvariables.hh +++ b/dumux/porousmediumflow/implicit/forchheimerfluxvariables.hh @@ -180,8 +180,9 @@ protected: assert( isDiagonal_(K) ); DimWorldMatrix sqrtK(0.0); + using std::sqrt; for (int i = 0; i < dim; ++i) - sqrtK[i][i] = std::sqrt(K[i][i]); + sqrtK[i][i] = sqrt(K[i][i]); // loop over all phases for (int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++) @@ -392,9 +393,10 @@ protected: */ bool isDiagonal_(const DimWorldMatrix & K) const { + using std::abs; for (int i = 0; i < dim; i++) { for (int k = 0; k < dim; k++) { - if ((i != k) && (std::abs(K[i][k]) >= 1e-25)) { + if ((i != k) && (abs(K[i][k]) >= 1e-25)) { return false; } } diff --git a/dumux/porousmediumflow/implicit/problem.hh b/dumux/porousmediumflow/implicit/problem.hh index 890d508b60707fb32ca93c35f5a1b08fc1264469..9d3bea81e13fd1d7c237f93324fc54e4473a1f1e 100644 --- a/dumux/porousmediumflow/implicit/problem.hh +++ b/dumux/porousmediumflow/implicit/problem.hh @@ -58,7 +58,6 @@ class ImplicitPorousMediaProblem : public ImplicitProblem typedef typename GridView::ctype CoordScalar; typedef Dune::FieldVector GlobalPosition; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - typedef Dune::FieldVector DimVector; enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; @@ -79,7 +78,7 @@ public: spatialParams_ = std::make_shared(gridView); if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) - gravity_[dim-1] = -9.81; + gravity_[dimWorld-1] = -9.81; } /*! @@ -87,6 +86,34 @@ public: */ // \{ + /*! + * \brief Evaluate the initial phase state inside a control volume. + * + * \param element The element + * \param fvGeometry The fvGeometry + * \param scvIdx The scvIdx + */ + int initialPhasePresence(const Element &element, + const FVElementGeometry &fvGeometry, + const int scvIdx) const + { + // forward to generic interface + return asImp_().initialPhasePresenceAtPos(fvGeometry.subContVol[scvIdx].global); + } + + /*! + * \brief Evaluate the initial value for a control volume. + * + * \param globalPos The global position + */ + int initialPhasePresenceAtPos(const GlobalPosition &globalPos) const + { + DUNE_THROW(Dune::InvalidStateException, + "The problem does not provide a initialPhasePresenceAtPos() method."); + return 0; + } + + /*! * \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position. * diff --git a/dumux/porousmediumflow/mpnc/implicit/diffusion/diffusion.hh b/dumux/porousmediumflow/mpnc/implicit/diffusion/diffusion.hh index 867f9fc677aa2a99b1d642f5d68465d6d8e47d9b..7e04405c001023041753f957443040d8ddf57170 100644 --- a/dumux/porousmediumflow/mpnc/implicit/diffusion/diffusion.hh +++ b/dumux/porousmediumflow/mpnc/implicit/diffusion/diffusion.hh @@ -69,9 +69,8 @@ public: const FluxVariables &fluxVars, const Scalar molarDensity ) { - if ( not FluidSystem::isLiquid(phaseIdx) ) - gasFlux_(fluxes, fluxVars, molarDensity); - else if ( FluidSystem::isLiquid(phaseIdx) ){ + if (FluidSystem::isLiquid(phaseIdx)) + { #if MACROSCALE_DIFFUSION_ONLY_GAS return ; // in the case that only the diffusion in the gas phase is considered, // the liquidFlux should not be called @@ -79,8 +78,9 @@ public: liquidFlux_(fluxes, fluxVars, molarDensity); } else - DUNE_THROW(Dune::InvalidStateException, - "Invalid phase index: " << phaseIdx); + { + gasFlux_(fluxes, fluxVars, molarDensity); + } } protected: diff --git a/dumux/porousmediumflow/mpnc/implicit/diffusion/fluxvariables.hh b/dumux/porousmediumflow/mpnc/implicit/diffusion/fluxvariables.hh index ce4b0ea710f2718e48db68fb0aacddab786bb07c..a15c881b9c88aa69c19f8356c099184400dfb67e 100644 --- a/dumux/porousmediumflow/mpnc/implicit/diffusion/fluxvariables.hh +++ b/dumux/porousmediumflow/mpnc/implicit/diffusion/fluxvariables.hh @@ -127,7 +127,7 @@ public: // point in the porous medium for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { - // make sure to only calculate diffusion coefficents + // make sure to only calculate diffusion coefficients // for phases which exist in both finite volumes if (elemVolVars[i].saturation(phaseIdx) <= 1e-4 || elemVolVars[j].saturation(phaseIdx) <= 1e-4) @@ -218,7 +218,11 @@ protected: Scalar moleFraction_[numPhases][numComponents]; }; - +/*! + * \ingroup MPNCModel + * \ingroup ImplicitFluxVariables + * \brief Variables for the diffusive fluxes in the MpNc model + */ template class MPNCFluxVariablesDiffusion { diff --git a/dumux/porousmediumflow/mpnc/implicit/diffusion/volumevariables.hh b/dumux/porousmediumflow/mpnc/implicit/diffusion/volumevariables.hh index dc7246311850cc21596f14ec485a0985161d8c96..5e13d4085828ab93310c1bdead7945f55bf815ec 100644 --- a/dumux/porousmediumflow/mpnc/implicit/diffusion/volumevariables.hh +++ b/dumux/porousmediumflow/mpnc/implicit/diffusion/volumevariables.hh @@ -69,7 +69,7 @@ public: { Valgrind::SetUndefined(*this); - // diffusion coefficents in liquid + // diffusion coefficients in liquid diffCoeffL_[0] = 0.0; for (int compIdx = 1; compIdx < numComponents; ++compIdx) { diffCoeffL_[compIdx] = @@ -81,7 +81,7 @@ public: } Valgrind::CheckDefined(diffCoeffL_); - // diffusion coefficents in gas + // diffusion coefficients in gas for (int compIIdx = 0; compIIdx < numComponents; ++compIIdx) { diffCoeffG_[compIIdx][compIIdx] = 0; for (int compJIdx = compIIdx + 1; compJIdx < numComponents; ++compJIdx) { @@ -92,7 +92,7 @@ public: compIIdx, compJIdx); - // fill the symmetric part of the diffusion coefficent + // fill the symmetric part of the diffusion coefficient // matrix diffCoeffG_[compJIdx][compIIdx] = diffCoeffG_[compIIdx][compJIdx]; } @@ -114,8 +114,10 @@ public: // TODO: tensorial diffusion coefficients return diffCoeffG_[compIIdx][compJIdx]; - const unsigned int i = std::min(compIIdx, compJIdx); - const unsigned int j = std::max(compIIdx, compJIdx); + using std::max; + using std::min; + const unsigned int i = min(compIIdx, compJIdx); + const unsigned int j = max(compIIdx, compJIdx); if (i != 0) return 0; return diffCoeffL_[j]; @@ -142,6 +144,11 @@ protected: Scalar diffCoeffG_[numComponents][numComponents]; }; + +/*! + * \brief Variables for the disabled diffusive fluxes in the MpNc model within + * a finite volume. + */ // dummy class for the case where diffusion is disabled template class MPNCVolumeVariablesDiffusion diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/fluxvariables.hh b/dumux/porousmediumflow/mpnc/implicit/energy/fluxvariables.hh index 265bef607b35081d7e9590dfdc723afcde862665..a274c8e4e43c398bd786e4519292aebdd05a9ba4 100644 --- a/dumux/porousmediumflow/mpnc/implicit/energy/fluxvariables.hh +++ b/dumux/porousmediumflow/mpnc/implicit/energy/fluxvariables.hh @@ -34,7 +34,7 @@ namespace Dumux /*! * \ingroup MPNCModel * \ingroup ImplicitFluxVariables - * \brief Variables for the enthalpy fluxes in the MpNc model + * \brief Variables for the enthalpy fluxes in the MpNc model for the isothermal case */ template class MPNCFluxVariablesEnergy @@ -81,6 +81,11 @@ public: {} }; +/*! + * \ingroup MPNCModel + * \ingroup ImplicitFluxVariables + * \brief Variables for the enthalpy fluxes in the MpNc model + */ template class MPNCFluxVariablesEnergy { diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/indices.hh b/dumux/porousmediumflow/mpnc/implicit/energy/indices.hh index fbe135b8b0a94aae8ce675638d62d2ba67eea7e7..50e8ab7f1a2be2805585147daf51821707a9a314 100644 --- a/dumux/porousmediumflow/mpnc/implicit/energy/indices.hh +++ b/dumux/porousmediumflow/mpnc/implicit/energy/indices.hh @@ -36,7 +36,7 @@ namespace Dumux template struct MPNCEnergyIndices { - static_assert(((numEnergyEquations<1) and not enableEnergy), + static_assert(((numEnergyEquations < 1) && !enableEnergy), "No kinetic energy transfer may only be enabled " "if energy is enabled in general."); diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/localresidual.hh b/dumux/porousmediumflow/mpnc/implicit/energy/localresidual.hh index dcc3cbee521b304c845de287b01ec9aa6fe3c6c7..4ade29ccc6dc175387fb346bf244147d1f2b004d 100644 --- a/dumux/porousmediumflow/mpnc/implicit/energy/localresidual.hh +++ b/dumux/porousmediumflow/mpnc/implicit/energy/localresidual.hh @@ -119,7 +119,10 @@ public: } }; - +/*! + * \brief Specialization of the energy module for the nonisothermal case. + * + */ template class MPNCLocalResidualEnergy { @@ -188,7 +191,8 @@ public: * volVars.porosity(); #ifndef NDEBUG -if (!std::isfinite(storage[energyEqIdx])) +using std::isfinite; +if (!isfinite(storage[energyEqIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite energy storage"); #endif } @@ -250,7 +254,8 @@ if (!std::isfinite(storage[energyEqIdx])) const VolumeVariables &up = elemVolVars[upIdx]; flux[energyEqIdx] += up.enthalpy(phaseIdx) * massFlux; #ifndef NDEBUG -if (!std::isfinite(flux[energyEqIdx]) ) +using std::isfinite; +if (!isfinite(flux[energyEqIdx]) ) DUNE_THROW(NumericalProblem, "Calculated non-finite energy flux"); #endif } @@ -271,7 +276,8 @@ if (!std::isfinite(flux[energyEqIdx]) ) Scalar lumpedHeatConduction = - lumpedConductivity * temperatureGradientNormal ; flux[energyEqIdx] += lumpedHeatConduction; #ifndef NDEBUG -if (!std::isfinite(flux[energyEqIdx]) ) +using std::isfinite; +if (!isfinite(flux[energyEqIdx]) ) DUNE_THROW(NumericalProblem, "Calculated non-finite energy flux"); #endif } diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/localresidualkinetic.hh b/dumux/porousmediumflow/mpnc/implicit/energy/localresidualkinetic.hh index 9ad5c9afb853389c4782c2af83c33c69e139deaa..8d97ffc54f7f9a06603a8195da09dc19db1d01a3 100644 --- a/dumux/porousmediumflow/mpnc/implicit/energy/localresidualkinetic.hh +++ b/dumux/porousmediumflow/mpnc/implicit/energy/localresidualkinetic.hh @@ -129,7 +129,8 @@ public: DUNE_THROW(Dune::NotImplemented, "wrong index"); - if (!std::isfinite(storage[energyEq0Idx+phaseIdx])) + using std::isfinite; + if (!isfinite(storage[energyEq0Idx+phaseIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite storage"); } @@ -165,7 +166,8 @@ public: fluxVars, elemVolVars, energyEqIdx); - if (!std::isfinite(flux[energyEq0Idx + energyEqIdx])) + using std::isfinite; + if (!isfinite(flux[energyEq0Idx + energyEqIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite flux in phase " << energyEqIdx); } } @@ -346,8 +348,8 @@ public: } // end switch - - if (!std::isfinite(source[energyEq0Idx + phaseIdx])) + using std::isfinite; + if (!isfinite(source[energyEq0Idx + phaseIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite source, " << "Tw="<< Tw << " Tn="<< Tn<< " Ts="<< Ts); }// end phases @@ -465,7 +467,8 @@ public: * (1.0 - volVars.porosity()) * volVars.solidHeatCapacity(); - if (!std::isfinite(storage[energyEqSolidIdx])) + using std::isfinite; + if (!isfinite(storage[energyEqSolidIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite storage"); } @@ -494,7 +497,8 @@ public: DUNE_THROW(Dune::NotImplemented, "wrong index"); - if (!std::isfinite(storage[energyEq0Idx])) + using std::isfinite; + if (!isfinite(storage[energyEq0Idx])) DUNE_THROW(NumericalProblem, "Calculated non-finite storage"); } @@ -530,7 +534,8 @@ public: elemVolVars, energyEqIdx); - if (!std::isfinite(flux[energyEq0Idx + energyEqIdx])) + using std::isfinite; + if (!isfinite(flux[energyEq0Idx + energyEqIdx])) DUNE_THROW(NumericalProblem, "Calculated non-finite flux in phase " << energyEqIdx); } } @@ -725,7 +730,8 @@ public: DUNE_THROW(Dune::NotImplemented, "wrong range"); - if (!std::isfinite(solidToFluidEnergyExchange)) + using std::isfinite; + if (!isfinite(solidToFluidEnergyExchange)) DUNE_THROW(NumericalProblem, "Calculated non-finite source, " << "TFluid="<< TFluid << " TSolid="<< TSolid ); return solidToFluidEnergyExchange ; @@ -747,19 +753,20 @@ public: const Scalar TSolid = volVars.temperature(temperatureSolidIdx); const Scalar characteristicLength = volVars.characteristicLength() ; + using std::pow; const Scalar as = 6.0 * (1.0-volVars.porosity()) / characteristicLength ; const Scalar mul = fs.viscosity(wPhaseIdx) ; const Scalar deltahv = fs.enthalpy(nPhaseIdx) - fs.enthalpy(wPhaseIdx); const Scalar deltaRho = fs.density(wPhaseIdx) - fs.density(nPhaseIdx) ; - const Scalar firstBracket = std::pow(g * deltaRho / gamma, 0.5); + const Scalar firstBracket = pow(g * deltaRho / gamma, 0.5); const Scalar cp = FluidSystem::heatCapacity(fs, wPhaseIdx) ; // This use of Tsat is only justified if the fluid is always boiling (tsat equals boiling conditions) // If a different state is to be simulated, please use the actual fluid temperature instead. const Scalar Tsat = FluidSystem::vaporTemperature(fs, nPhaseIdx ) ; const Scalar deltaT = TSolid - Tsat ; - const Scalar secondBracket = std::pow( (cp *deltaT / (0.006 * deltahv) ) , 3.0 ) ; + const Scalar secondBracket = pow( (cp *deltaT / (0.006 * deltahv) ) , 3.0 ) ; const Scalar Prl = volVars.prandtlNumber(wPhaseIdx) ; - const Scalar thirdBracket = std::pow( 1/Prl , (1.7/0.33) ); + const Scalar thirdBracket = pow( 1/Prl , (1.7/0.33) ); const Scalar QBoil = satW * as * mul * deltahv * firstBracket * secondBracket * thirdBracket ; return QBoil; } diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/volumevariables.hh b/dumux/porousmediumflow/mpnc/implicit/energy/volumevariables.hh index 03e9d5e8d33fbd5345eb9c752c869d3ef5acc5dc..f89c062fcd3b829966d6476501ebdf9357987e5b 100644 --- a/dumux/porousmediumflow/mpnc/implicit/energy/volumevariables.hh +++ b/dumux/porousmediumflow/mpnc/implicit/energy/volumevariables.hh @@ -40,7 +40,7 @@ namespace Dumux template class MPNCVolumeVariablesEnergy { - static_assert(not (numEnergyEquations and not enableEnergy), + static_assert(((numEnergyEquations < 1) && !enableEnergy), "No kinetic energy transfer may only be enabled " "if energy is enabled in general."); static_assert(numEnergyEquations < 1, diff --git a/dumux/porousmediumflow/mpnc/implicit/energy/vtkwriterkinetic.hh b/dumux/po