Commit Graph

77 Commits

Author SHA1 Message Date
Arne Morten Kvarving
f1ecc0c7cf SimpleHuDuanH2O: avoid use of sstream 2023-01-02 15:50:41 +01:00
Arne Morten Kvarving
f94bdfda44 H2O: avoid use of sstream 2023-01-02 15:50:41 +01:00
Arne Morten Kvarving
c5dd0be166 CO2: remove unnecessary <iostream> include 2023-01-02 15:50:41 +01:00
Arne Morten Kvarving
b58c682f62 CO2: encapsulate CO2Tables
this way we don't have to drag 6MB of tables into multiple compile
units. some flexibility is lost (ie the template parameter for the
table), but this is unused in the current code.

comment out some templates that do not instance as they are referring
to non-existent table members.
2022-12-15 13:52:49 +01:00
Bård Skaflestad
86b3c79ff4 Merge pull request #3260 from akva2/remove_math_include
changed: remove include of Math.hpp
2022-12-14 09:30:04 +01:00
Arne Morten Kvarving
b889f59145 changed: remove include of Math.hpp
it should be up to instance sites to make every available for
the templates to instance properly, even though we know we are
instancing over Evaluations.
2022-12-13 13:31:18 +01:00
Arne Morten Kvarving
9a77d47c35 changed: drop exceptions class from material
use the opm-common exception classes directly
2022-12-13 12:47:20 +01:00
Arne Morten Kvarving
207d280ee4 remove HAVE_OPM_COMMON conditionals 2022-12-08 14:03:15 +01:00
Arne Morten Kvarving
a67f58da14 Co2GasPvt: some modernization
- typedef -> using
- use constexpr where appropriate
2022-08-04 08:14:28 +02:00
Markus Blatt
ef6fc32216 Merge pull request #521 from akva2/component_fixes
Fixes in some component classes
2022-08-02 14:21:11 +02:00
Arne Morten Kvarving
cb9f01df4e remove unused includes of Unused.hpp 2022-08-02 10:16:25 +02:00
Arne Morten Kvarving
81abc289a5 CO2: avoid use dangling references
using a reference to a temporary is not okay
2022-08-02 09:47:14 +02:00
Arne Morten Kvarving
c7b434d918 CO2: some modernization
- use constexpr
2022-08-02 09:47:14 +02:00
Arne Morten Kvarving
37e7e6a611 Brine: avoid use dangling references
using a reference to a temporary is not okay
2022-08-02 09:47:09 +02:00
Arne Morten Kvarving
e42bb116f8 Brine: some modernization
- use constexpr
2022-08-02 09:47:09 +02:00
Arne Morten Kvarving
b626f0d713 SimpleHuDuanH2O: avoid use of dangling reference
using a reference to a temporary is not okay
2022-08-02 09:47:00 +02:00
Arne Morten Kvarving
f2eadd2ab3 SimpleHuDuanH2O: some modernization
- typedef -> using
- use constexpr
2022-08-02 09:19:50 +02:00
Trine Mykkeltvedt
6304acb292 fixed test_components for the new actentric factor and criticalVolume 2022-06-27 10:37:17 +02:00
Trine Mykkeltvedt
14a5a37249 moved and renamed fluidsystems and parametercache in chifluid 2022-06-27 10:37:16 +02:00
Trine Mykkeltvedt
afad4d23ad moved the components to opm/material/components, and made subsequent changes for checking of the components 2022-06-27 10:37:16 +02:00
Tor Harald Sandve
588604ae8f extrapolate co2, brine and h2O properties only when called from the CO2STORE module 2021-10-14 12:01:07 +02:00
Markus Blatt
868531e414 Extrapolate for values not in domain (UniformTabulated2DFunction/liquidDensity).
Extrapolate liquidDensity for unreasonable
pressure/temperature (Brine) and in UniformTabulated2DFunction.
In the current code the interpolation actually already works if the
values are outside of the tabulated region.

With this change there is now an additional function parameter
If it is true we will interpolate for every value instead of throwing
and aborting (was the case always before).
2021-09-28 16:34:42 +02:00
Arne Morten Kvarving
24dba01e99 changed: get rid of OPM_UNUSED macro usage
prefer anonymous parameters and c++17 [[maybe_unused]]
2021-08-03 09:32:02 +02:00
Arne Morten Kvarving
6689e6d08f fixed: do not use Opm:: prefix within Opm namespace part 2
have to use anchoring to root namespace in some places due
to overlapping namespace and class type names.
2021-05-05 21:58:33 +02:00
Tor Harald Sandve
f528b2c33f fix out of bound in CO2.hpp 2021-01-18 10:12:30 +01:00
Arne Morten Kvarving
75b2609336 test if apple clang likes this better 2020-12-08 15:27:50 +01:00
Tor Harald Sandve
28dd5a2b36 Merge pull request #427 from totto82/co2pvt
Add a co2brine pvt model
2020-10-02 12:26:19 +02:00
Tor Harald Sandve
15ff65ffcd Add a co2brine pvt model
The CO2BRINE model is activated by setting CO2STOR in the RUNSPEC section

The CO2 and brine pvt properties are computed based on pvt models in opm-material
- CO2 density is from Span and Wager (1996) as given in co2table.inc
- CO2 viscosity is from Fenhour et al (1998)
- Brine density and viscosity is based on H20 + correction based on Batzle and Wang (1992)
- H20 density is from Hu et al (2007)
- H20 viscosity is computed from density based on correlation given in IAPWS 97

At the current stage the oil-phase is used to model the brine. If a proper gas-water
simulator is made, the Brine PVT should be moved to the water phase.

Known limitations:
- Currently the viscosity of the Brine does not depend on the composition
- Salinity is assumed to be constant and given by SALINITY [mol/kg].
2020-10-01 16:15:39 +02:00
Joakim Hove
1315acfe51 Remove unusued #include common excpetions 2020-09-21 10:56:05 +02:00
Andreas Lauser
6cb7df3541 remove the Opm::FluidSystems namespace
this has mildly annoyed me for quite some time, and finally managed to
bring myself to changing it: The Opm::FluidSystems namespace is pretty
useless because the number of classes contained within it is quite
small and mismatch between the naming convention of the file names the
actual classes is somewhat confusing IMO. Thus, this patch changes the
naming of fluid systems from `Opm::FluidSystems::Foo` to
`Opm::FooFluidSystem`.

(also, flat hierarchies currently seem to be popular with the cool
people!?)

this patch requires some simple mop-ups for `ewoms` and `opm-simulators`.
2018-07-27 12:57:09 +02:00
Andreas Lauser
27386851a2 move some basic infrastructure from opm-common to here
all of these classes have only been used in opm-material and its
downstreams in the first place.
2018-02-07 16:44:44 +01:00
Atgeirr Flø Rasmussen
a9018ece34 Add OPM_UNUSED to unused temperature arguments. 2018-01-30 15:06:26 +01:00
Andreas Lauser
0d613a7c25 N2: make the heat capacity consistent with the enthalpy again
I missed the fact that in the enthalpy() function, the polynomial
coefficients are divided, i.e., this component defines a polynomial
for the heat capacity and integrates it for the enthalpy. (not
the other way around.)
2017-11-17 19:09:01 +01:00
Andreas Lauser
db87b77896 fix heatCapacity() and enthaply() of some components
I looked at all components: For the ones that use simple enthalpy
relations, heatCapacity() and enthalpy() should now be
consistent. (Here "simple" means "an approach that I understood without
reading literature for several hours".)
2017-11-16 16:30:24 +01:00
Andreas Lauser
2b4114907e TabulatedComponent: don't catch std::exception by value
std::exception is a polymorphic type and catching these by values
generates warnings when using the latest GCC from SVN. Besides this,
catching objects by value is bad style and was unintended from the
start.
2017-07-27 18:04:43 +02:00
Andreas Lauser
b65defe489 make all headers autonomous again
i.e., they can be included without having other files included before them.
2017-07-20 12:08:47 +02:00
Andreas Lauser
0f6540bdad DenseAD: make less fuzz about it
this patch converts to code to use the convenience functions instead
of the math toolboxes whereever possible. the main advantage is that
Opm::foo(x) will work regardless of the type of `x`, but it also
reduces visual clutter.

also, constant Evaluations are now directly created by assigning
Scalars, which removes further visual noise.

while I hope it improves the readability of the code,
functionality-wise this patch should not change anything.
2017-06-13 17:25:03 +02:00
Andreas Lauser
256fcd65d4 use log() instead of ln() to calculate the natural logarithm
it seems like ln() is non-standard and this piece of code only
compiled because that particular method is never instantiated.
2017-06-13 17:17:26 +02:00
Andreas Lauser
2e578ce6b3 Merge pull request #223 from andlaus/fix-test_components
Fix API test for components
2017-04-10 12:22:56 +02:00
Andreas Lauser
83d73f65e7 make all components compile properly with evaluations 2017-04-10 11:22:54 +02:00
Andreas Lauser
899437ac27 simple CO2: fix a snafu related to evaluations
in some places, it used primitive floating point objects when it
should have used Evaluations. This is probably not the only place
where this happens, but IMO the individual components are pretty low
priority.
2017-04-09 19:51:05 +02:00
Andreas Lauser
45da261142 move the '&' of references and the '*' of pointers to the type name
i.e., the new-style is `TypeName& var` instead of
`TypeName &var`. this patch is analogous to part of OPM/ewoms#83.
2017-01-18 17:57:54 +01:00
Andreas Lauser
39c5c94ac7 the new home of Valgrind.hpp is opm-common! 2016-12-14 09:46:21 +01:00
Andreas Lauser
93fe614558 fix some pedantic compiler warnings
this allows the test suite of eWoms to be compiled on clang++ 3.8
using the following warning flags

```
    -Weverything
    -Wno-documentation
    -Wno-documentation-unknown-command
    -Wno-c++98-compat
    -Wno-c++98-compat-pedantic
    -Wno-undef
    -Wno-padded
    -Wno-global-constructors
    -Wno-exit-time-destructors
    -Wno-weak-vtables
    -Wno-float-equal
```

without triggering warnings in opm-material or eWoms.

Note that the test-suite for opm-material does *not* yet pass without
warnings with these flags because with these flags clang likes to
complain about reducing or increasing floating point precision which
results in a formidable nightmare. I will see what I can do about
these warnings in a separate PR.

v4: properly fix the unused parameter warnings for the valgrind client
requests. thanks to [at]atgeirr for finding the issue.
2016-11-09 12:06:36 +01:00
Andreas Lauser
71da62bebe fix some signedness issues
mainly these issues stemmed from the fact that floating point values
can be negative and casting negative values to unsigned integers leads
to very large unsigned values instead of 0.
2016-04-20 15:37:09 +02:00
Andreas Lauser
05bf95d232 use Toolbox::scalarValue() instead of Toolbox::value() where appropriate
in opm-material "where appropriate" is equivalent to "everywhere" as
far as I can see.
2016-04-20 11:38:17 +02:00
Andreas Lauser
c132bcc018 H2O: fix a Scalar vs Evaluation issue
actually, this patch should not change the result at all, but the code
is probably less confusing that way...
2016-04-20 11:38:15 +02:00
Andreas Lauser
c764df8166 Brine: fix some Scalar vs Evaluation issues 2016-04-20 11:38:13 +02:00
Andreas Lauser
d55f213653 make it possible to nest function evaluation objects
IMO this is pretty cool because it allows to transparantly calculate
higher order derivatives. for example this enables to implement the
linearization stage of higher-order non-linear solvers without much
additional effort compared to just evaluating the function in
question. (essentially, such higher order non-linear solvers are based
on truncating the Taylor series not after the first term -- like for the
Newton scheme -- but later. That said, they require to solve linear
systems of equations which involve tensors of orders greater than 2,
so they are not really practical as far as I can see.)

A more practical motivation for this is to allow the constraint
solvers to be used in "nested mode", i.e., linearizing the system of
equations they need to solve using automatic differentiation, but
allowing the value objects which are passed to the constraint solvers
be function evaluations themselves. (E.g. the result of a flash
calculation can also include the derivatives with regard to the
primary variables of the flow model. Note that the individual
constraint solvers need to some patches to make this work.)
2016-04-17 11:42:33 +02:00
Andreas Lauser
da401551be clean up the licensing preable of source files
this patch removes the in-file lists in favor of a global list of in
the COPYING file. this is done because (a) maintaining a list of
authors at the beginning of each source file is a major pain in the
a**, (b) for this reason, the list of authors was not accurate in
about 85% of all cases where more than one person was involved and (c)
this list is not legally binding in any way (the copyright is at the
person who authored a given change; if these lists had any legal
relevance, one could "aquire" the copyright of the module by forking
it and replacing the lists...)
2016-03-15 00:58:09 +01:00