Commit Graph

82 Commits

Author SHA1 Message Date
Joakim Hove
2d8457e3a9 Added pseoudo unit system for untransformed input values. 2018-03-15 10:43:53 +01:00
Andreas Lauser
c9291f165c address review comments 2018-02-05 10:38:57 +01:00
Andreas Lauser
ce93d98b80 respect the fact that non-SI temperature may be offset from zero
also, the UnitTests test was buggy.

V2: improve the accuracy of the °F->K offset, unit test all temperature measures
2018-02-02 17:13:50 +01:00
Joakim Hove
494dda28a8 Revert "respect the fact that non-SI temperature may be offset from zero" 2018-02-01 15:08:12 +01:00
Andreas Lauser
d6f4cb016e respect the fact that non-SI temperature may be offset from zero
also, the UnitTests test was buggy.
2018-01-31 13:17:06 +01:00
Andreas Lauser
62333f08a8 units: add energy
an alternative is to add heat capacity, but this is more cumbersome
because some heat capacities are volumetric while others are mass
specific. (note that the "single division" shenengian of the unit
system's expression parser needs to be considered for most energy
related keywords.)
2017-11-25 18:08:28 +01:00
Bård Skaflestad
e821f5534b UnitSystem: Add Support for PVT-M Unit Conventions
The PVT-M unit convention is essentially the same as the Metric
collection, except that pressure values are measured in atmospheres
rather than bars.
2017-10-05 17:39:45 +02:00
Jørgen Kvalsvik
e884b0664c Redesign cmake
Tune the makefile according to new principles, which adds a few bells
and whistles and for clarity.

Synopsis:

* The dependency on opm-common is completely gone. This is reflected in
  travis and appveyor as well. No non-kitware cmake modules are used.
* Directories are flattened, quite a bit - source code is located in the
  lib/ directory if it belongs to opm-parser, and external/ if third
  party.
* The sibling build feature is implemented through cmake's
  export(PACKAGE) rather than implicitly looking through source files.
* Targets explicitly set required public and private include
  directories, compile options and definitions, which cmake will handle
  and propagate
* opm-parser-config.cmake for downstream users is now provided.
* Dependencies are set up using targets. In the future, when cmake 3.x+
  can be used, these should be either targets from newer Find modules,
  or interface libraries.
* Fewer system specific assumptions are coded in, instead we assume
  cmake or users set up system specific details.
* All module wide configuration and looking up libraries is handled in
  the root makefile - all sub directories only set up libraries and
  compile options for the module in question.
* Targets are defined and links handled transitively because cmake now
  is told about them. ${module_LIBRARIES} variables are gone.

This is largely guided by the principles outlined in
https://rix0r.nl/blog/2015/08/13/cmake-guide/

Most source files are just moved - if they have some content change then
it's nothing more than include fixes or similar in order to make them
compile.
2017-06-01 15:29:23 +02:00
Joakim Hove
f1308fa352 Instantiate unit system from Eclipse type id. 2017-01-12 13:36:42 +01:00
Joakim Hove
ef6def6511 Added getEclType() to UnitSystem 2017-01-12 13:36:38 +01:00
Atgeirr Flø Rasmussen
31dd76a39f Add some tests for the unit constants. 2016-12-05 12:49:45 +01:00
Jørgen Kvalsvik
18de2c0751 Correct unit for Field gas-oil+oil-gas ratio
The FIELD units don't use identity in their converison from SI, as the
unit is Mscf/stb rather than m3/m3.
2016-11-29 13:52:50 +01:00
Atgeirr Flø Rasmussen
d34711d600 Make constructor explicit, fix operator<<. 2016-10-25 11:39:43 +02:00
Jørgen Kvalsvik
f2e509f59f UnitSystem named constructors with automatic storage 2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
f9cb516b99 Remove DeckPtr+ParserPtr aliases
Remove the deprecated DeckPtr and ParserPtr aliases and removes
shared_ptr<Deck> and friends from all interfaces.
2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
56608e9a10 3DProperties default constructible
This also means UnitSystem must be default constructible, which now
makes the default unit system metric. GridProperties must also be
default constructible (a valid 0x0x0 grid with no properties).
2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
c893a92aa6 Make Dimension+UnitSystem no longer use shared_ptr 2016-10-19 20:38:27 +02:00
Jørgen Kvalsvik
47ca0b333d Remove unnecessary silencing of unused vars
__attribute__ is a gcc extension (supported by clang), but isn't
portable. However, this warning doesn't show up when the variables are
constexpr.
2016-10-19 20:37:43 +02:00
Andreas Lauser
a8b6047b1d fully move the units code from opm-core to opm-parser
this fixes some annoying inconsistencies (e.g., the recently
introduced 'dyne' unit was unavailable in the opm-core version) and
gets rid of some compiler abiguity errors if 'using namespace
Opm::details' was used by code inside the 'Opm' namespace.

Since opm-parser is a hard dependency of opm-core, the only measure
which must be taken by higher-level code is to include
'opm/parser/eclipse/Units/Units.hpp' instead of
'opm/parser/eclipse/Units/ConversionFactors.hpp' or
'opm/core/utility/Units.hpp'.

Note that a potentially better location for this code would be
opm-common, but this would break the Windows build of opm-parser.
2016-10-10 17:45:37 +02:00
Andreas Lauser
eb9dd487c6 add the infrastructure needed to deal with surface tension
this is required for the JFUNC keyword...
2016-10-06 17:18:10 +02:00
Joakim Hove
0d4bfdea2d Added vector overload of unit onversion methods. 2016-10-06 11:47:49 +02:00
babrodtk
4d9bd066a3 Added inverse formation volume factors 2016-09-06 14:17:46 +02:00
babrodtk
6097ebb1eb Added units required for formation volume factors 2016-09-05 16:05:47 +02:00
Jørgen Kvalsvik
0d44cd5ee1 Lab's unit for time is "HR" 2016-09-01 14:38:10 +02:00
Bård Skaflestad
7d67ddc099 UnitSystem: Add skeleton implementation of LAB conventions
This commit adds conversion factors for the ECL LAB unit
conventions--notably Atmospheres for pressures, Hours for time,
Grams for mass, and cubic centimetres for volumes.
2016-09-01 12:21:53 +02:00
Arne Morten Kvarving
4c32e602da changed: generate unit type conversion constants on compile-time
as a bonus it avoids unused variable warnings in compile units
only using parts of the conversion units.
2016-08-15 14:52:48 +02:00
Jørgen Kvalsvik
f6cffb4c07 Support for ratio-type units 2016-07-19 14:34:51 +02:00
Jørgen Kvalsvik
c4e8149717 UnitSystem string-description of a unit
Analoguous to to/from_si but for string-representation of the unit in
question.
2016-07-19 14:34:21 +02:00
Jørgen Kvalsvik
de9ecedf2d Fix warnings in COMPSEGUnits 2016-07-13 23:40:09 +02:00
Jørgen Kvalsvik
3696b750cd Remove opm-common dependency
Severs the code dependency on opm-commmon. There was no actual
functional dependency here, with the exception of some enable/disable
warning headers. To properly make opm-parser a stand-alone module the
usage of these headers have been removed and the dependency on
opm-common is gone.
2016-07-08 15:53:40 +02:00
Jørgen Kvalsvik
d6940647bd UnitSystem::measure::identity
Adds the "identity" unit which is a no-op under to_si/from_si
conversion.
2016-06-28 17:15:24 +02:00
Jørgen Kvalsvik
1c7e7e08c6 Move to_si/from_si into UnitSystem
UnitSystem already offered similar functionality, but via string-map
lookup and a very clunky interface. Offer simple to/from methods as an
addition.
2016-05-23 15:11:33 +02:00
Jørgen Kvalsvik
dfb9a629e4 Support for eclipse -> SI unit conversions 2016-05-12 11:30:51 +02:00
Jørgen Kvalsvik
822ac1bcb2 SI-to-unitsystem conversion tables. 2016-05-09 15:10:23 +02:00
Liu Ming
6e542cb083 rename ParseMode as ParseContext in Units folder. 2016-03-17 08:29:32 +08:00
Jørgen Kvalsvik
f0ae5db131 opm-parser adoption of Deck automatic ownership
Since the Deck* family of classes have changed their interfaces to no
longer use shared_ptr, a lot of code broke. This patch fixes all
problems in tests, other signatures and accesses to now use the new Deck
interfaces.
2016-02-18 13:27:24 +01:00
Jørgen Kvalsvik
4b98943665 Replaces unecessary header includes with fwd decls
Every header is self-contained and includes only what it must to
function, relying on users include what they need in source files,
adopting a pay-what-you-use model (in particular for internal
dependencies).
2016-01-26 13:23:22 +01:00
Jørgen Kvalsvik
04900a4bb6 ParserKeywords.hpp -> ParserKeywordsX.hpp
To reduce compiler stress and be more explicit w.r.t. dependencies, all
files now includes only the keywords they need, instead of the
collection of all files.
2016-01-21 09:25:58 +01:00
Joakim Hove
1bde4e48ec ParserKeywords::hasDimension() check all records. 2015-11-11 10:39:11 +01:00
Kai Bao
96bf3648df Adding unit Salinity.
For the METRIC and FIELD system.
2015-04-16 16:59:59 +02:00
Atgeirr Flø Rasmussen
d33a05db70 Remove surplus const for return-by-value.
This triggers compiler warnings at high warning levels.
2015-03-06 08:52:39 +01:00
chflo
439d0ee924 OPM-157: Added enum UnitType, using this when creating an UnitSystem instance 2015-03-05 12:40:59 +01:00
Andreas Lauser
03366fe2e4 add unit for absolute (i.e., thermodynamic) temperature
This is required for keywords which do not use "every-day" temperature
values but thermodynamic ones or keywords that use "per degree"
values. Examples of such specimen are the OILCOMPR and WATDENT
keywords.
2015-03-02 19:11:18 +01:00
Andreas Lauser
0d3659f111 introduce dimension "ReservoirVolume" and rename "*Volume" to "\1SurfaceVolume"
Also, I tried to convert all keywords that use reservoir volumes and
the associated code. Although I tried my best on that front, it might
not be enough. (in any case, I consider it very unlikely that there
are any regressions caused by this.)
2015-02-13 13:41:07 +01:00
Andreas Lauser
b8a5280428 fix the unit for transmissibility when using the metric unit system
I don't know why exactly this happend, but anyway thanks to [at] bska
for catching it...
2014-12-12 12:21:38 +01:00
Andreas Lauser
764dd03153 add a "Transmissibility" unit
this is required because Eclipse is inconsistent when specifying
transmissiblities: the only difference between transmissibilities in
metric and field units is that the pressures are in bars instead of
PSI, i.e. the numerator for metric units is still given in centi-Poise
times bbl. This makes it impossible to specify the transmissibilities
in terms of their constituting bits...
2014-12-10 16:58:37 +01:00
Andreas Lauser
ea38a25af4 remove all trailing white space
this is just the result of

```
find -iname "*.[ch]pp" | xargs sed -i "s/ *$//"
find opm/parser/share/keywords -type f |  xargs sed -i "s/ *$//"
```

so if it causes conflicts with other patches, the others should get
priority. The rationale behind this patch is that some people tell
their editor to remove white space which leads to larger than
necessary patches...
2014-12-08 16:34:28 +01:00
Andreas Lauser
b1de0bf338 unit system: add temperature
this requires the possibility of specifying an offset for the SI
conversion because Eclipse in its eternal wisdom chooses to specify
temperatures using degrees Celsius and degrees Fahrenheit instead of
using Kelvin an Rankine...
2014-12-03 16:56:25 +01:00
Joakim Hove
b660cc1b6a Merge pull request #213 from atgeirr/conversion-factors
Conversion factors
2014-05-19 12:18:34 +02:00
Atgeirr Flø Rasmussen
61d1c1a2cf Make conversion factors more readable.
The using directives will put a lot into the Field and Metric
namespaces, but it should not be problematic.
2014-05-19 12:10:11 +02:00