Commit Graph

22 Commits

Author SHA1 Message Date
Joakim Hove
5db60aba5e Set external Action::State object in the vanguard 2021-10-12 10:41:29 +02:00
Håkon Hægland
16bbc338ab Don't increase shared_ptrs use_count when forwarding.
Use std::move() to avoid increasing the use count of std::shared_ptr
when forwarding them to the vanguard object.
2021-09-23 10:56:18 +02:00
Håkon Hægland
4c5245196b Changed calling convention for shared pointers.
Expect non-reference type shared pointers arguments instead of references
to shared pointer. This will make it clear to the caller that the called
function is making a copy of the pointer for its own use and not trying
to modify the original pointer of the caller.
2021-09-22 23:49:13 +02:00
Håkon Hægland
5ad65c70ee Initialize blackoil simulator from schedule shared with Python.
Adds a new constructor to Main.hpp that takes shared pointers to Deck,
EclipseState, Schedule, and SummaryConfig. This makes it possible to
share these variables with Python without worrying about lifetime issues
of the underlying C++ objects. For example, a Python script can first
create an opm.io.schedule.Schedule object which is modified from Python.
Then, assume the same Python script creates an
opm.simulators.BlackOilSimulator which is initialized with the same
schedule object. Since the underlying C++ object is a shared pointer,
the Schedule object in Python may go out of scope (get deleted by Python)
without having the C++ schedule object being deleted. And the Python
BlackOilSimulator may continue to be used after the Python Schedule object
has been deleted since it still has a valid C++ schedule object.
2021-09-21 15:52:59 +02:00
Joakim Hove
c62a9ba198 Set external UDQState for flow blackoil 2021-07-04 08:55:07 +02:00
Arne Morten Kvarving
8c34172ef0 remove some Opm:: qualifiers inside Opm namespace 2021-05-18 10:09:45 +02:00
Tor Harald Sandve
fbccdbf68e Make a flow version that uses the polyhedreal grid
Currently the simulator creats the polyhedreal grid from an eclGrid from opm-common

TODO
 - make it possible to create the grid directly from DGF or MRST format
 - fix issue on norne.
2020-11-10 15:49:59 +01:00
Atgeirr Flø Rasmussen
65817c9068 Removed old amg/cpr code that can be replaced.
The replacement consists of using the FlexibleSolver code.
2020-10-08 15:12:41 +02:00
Markus Blatt
75104fd310 Move to more consistent ownership of ECL data in EclBaseVanguard
We resort to consistently use unique_ptrs in EclBaseVanguard for
the data read from ECL files or set externally. This means that
during the simulation EclBaseVanguard owns this data and not Main
or the ebos setup functions. This ownership transfer becomes
transparent due to std::move.

This came up when trying to fix the parallel runs of ebos and during
that removing some code duplication.
2020-08-27 09:05:09 +02:00
Arne Morten Kvarving
74fac38d85 changed: remove GET_PROP_TYPE / GET_PROP macro usage 2020-08-27 08:19:39 +02:00
Arne Morten Kvarving
82a35e53b7 changed: remove TTAG macro calls 2020-08-27 08:19:39 +02:00
Håkon Hægland
f9d47b7c68 Capture some variables in FlowMainEbos.
Make Opm::FlowMainEbos capture the variables argc, argv, outputCout, and
outputFiles. Passing the variables to the constructor and saving them as
class variables in Opm::FlowMainEbos makes the implementation of the
Python interface simpler. For example, the step_init() method does not
need to ask Opm::Main about the values of the variables when it needs to
run execute() in FlowMainEbos.

Another advantage of this refactoring could be that less variables needs
to be passed around from Opm::Main, to flow_ebos_xxx.cpp, and then again
to FlowMainEbos.
2020-08-24 00:19:19 +02:00
Arne Morten Kvarving
5fcebcf4a7 remove unused variables
and thus the associated compiler warnings
2020-05-14 11:03:03 +02:00
Håkon Hægland
946b5f5806 Refactor flow_ebos_blackoil.cpp (2)
NOTE: this pull request depends on #2555 which should be merged first.

A rewrite of the outdated PR #2543.

Refactors flow_ebos_blackoil.cpp such that we can choose not to execute
the whole simulation using the flowEbosBlackoilMain() function but
instead only initialize by calling flowEbosBlackoilMainInit(). This is
necessary to implement a Python step() method that can advance the
simulator one report step at a time.

Also adds a method initFlowEbosBlackoil() to Main.hpp that can be used
directly from the Python interface's BlackOilSimulator object to gain
access to the FlowMainEbos object before it has initialized the
simulation main loop.
2020-05-13 11:54:18 +02:00
Arne Morten Kvarving
68a9d17de1 changed: pass/store deck as a pointer
and remove asserts for null-ptr. preparatory step for only
having deck on root mpi process
2020-02-28 10:26:55 +01:00
Joakim Hove
c804e85bc7
Setup logging before the simulator is initialized (#1980)
Setup logging before the simulator is initialized
2019-08-27 22:41:48 +02:00
Atgeirr Flø Rasmussen
a33cfbf0bc Moved Flow-related classes and files to opm/simulators/flow. 2019-06-20 11:00:51 +02:00
Andreas Lauser
ca8ea76818 add mebos, a multiplexed ebos variant
`mebos` works similarly as `flow`, but in contrast to `flow`, `mebos`
only creates the deck in the common code path whilst the
'EclipseState' and the other higher-level parser objects are always
created internally by the vanguard. this approach avoids code
duplication and the worst effects of parser API creep.

to avoid having to compile non-trivial compile units multiple times,
the actual code of the variants is moved into `ebos_$VARIANT.{hh,cc}`
files and the respective compile units are each put into a small
static library whilst the main function of said libraries are invoked
by either the multiplexed or the respective specialized simulator's
`main()`. This is also somewhat similar of how `flow` works, with the
difference that `mebos` uses the blackoil variant to determine the
parameters it needs to know for parsing the deck instead of
introducing a "fake" type tag for this. The rationale is to reduce
compile time compared to the "fake type tag" approach and -- to a
lesser extend -- avoid unnecessary copy-and-pasting of code. In
particular, this means that for the vast majority of cases, only one
place needs changed in the code for all `ebos` variants if, for
example, the parser API requires further objects in the future.
2019-06-11 10:27:47 +02:00
Andreas Lauser
777fd61342 flow: account for external setup costs 2019-02-05 16:52:58 +01:00
Joakim Hove
eedbafb805 Call Ewoms::setExternalSchedule() and Ewoms::setExternalSummaryConfig() 2019-01-11 15:38:23 +01:00
Andreas Lauser
e5fb6cf83c flow: do not pass the schedule and summaryConfig objects anymore
they are now always created internally by the vanguard.
2018-11-07 12:34:54 +01:00
Andreas Lauser
d7efb362a2 make the build of flow fully parallelizable
so far, the actual specializations of the simulator were compiled into
the `libopmsimulators` library and the build of the glue code
(`flow.cpp`) thus needed to be deferred until the library was fully
built. Since the compilation of the glue code requires a full property
hierarchy for handling command line parameters, this arrangement
significantly increases the build time for systems with a sufficient
number of parallel build processes. ("sufficient" here means 8 or more
threads, i.e., a quadcore system with hyperthreading is sufficient
provided that it has enough main memory.)

the new approach is not to include these objects in
`libopmsimulators`, but to directly deal with them in the `flow`
binary. this allows all of them and the glue code to be compiled in
parallel.

compilation time on my machine before this change:

```
> touch ../opm/autodiff/BlackoilModelEbos.hpp; time make -j32 flow 2> /dev/null
Scanning dependencies of target opmsimulators
[  2%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_gasoil.cpp.o
[  2%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_oilwater.cpp.o
[  2%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_blackoil.cpp.o
[  2%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_solvent.cpp.o
[  4%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_polymer.cpp.o
[  6%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_energy.cpp.o
[  6%] Building CXX object CMakeFiles/opmsimulators.dir/opm/simulators/flow_ebos_oilwater_polymer.cpp.o
[  6%] Linking CXX static library lib/libopmsimulators.a
[ 97%] Built target opmsimulators
Scanning dependencies of target flow
[100%] Building CXX object CMakeFiles/flow.dir/examples/flow.cpp.o
[100%] Linking CXX executable bin/flow
[100%] Built target flow

real    1m45.692s
user    8m47.195s
sys     0m11.533s
```

after:

```
> touch ../opm/autodiff/BlackoilModelEbos.hpp; time make -j32 flow 2> /dev/null
[ 91%] Built target opmsimulators
Scanning dependencies of target flow
[ 93%] Building CXX object CMakeFiles/flow.dir/flow/flow.cpp.o
[ 95%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_gasoil.cpp.o
[ 97%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_oilwater_polymer.cpp.o
[100%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_polymer.cpp.o
[100%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_oilwater.cpp.o
[100%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_solvent.cpp.o
[100%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_blackoil.cpp.o
[100%] Building CXX object CMakeFiles/flow.dir/flow/flow_ebos_energy.cpp.o
[100%] Linking CXX executable bin/flow
[100%] Built target flow

real    1m21.597s
user    8m49.476s
sys     0m10.973s
```

(this corresponds to a ~20% reduction of the time spend on waiting for
the compiler.)
2018-09-26 11:49:12 +02:00