All Classes Namespaces Files Functions Variables Typedefs Enumerator Pages
FlowMainSolvent.hpp
1 /*
2  Copyright 2015 IRIS AS
3  Copyright 2015 SINTEF ICT, Applied Mathematics.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_FLOWMAINSOLVENT_HEADER_INCLUDED
22 #define OPM_FLOWMAINSOLVENT_HEADER_INCLUDED
23 
24 
25 
26 #include <opm/autodiff/FlowMain.hpp>
27 #include <opm/autodiff/SolventPropsAdFromDeck.hpp>
28 
29 
30 
31 namespace Opm
32 {
33 
34  // The FlowMainSolvent class is for a black-oil simulator with solvent.
35  template <class Grid, class Simulator>
36  class FlowMainSolvent : public FlowMainBase<FlowMainSolvent<Grid, Simulator>, Grid, Simulator>
37  {
38  protected:
39  using Base = FlowMainBase<FlowMainSolvent<Grid, Simulator>, Grid, Simulator>;
40  friend Base;
41 
42  // Set in setupGridAndProps()
43  std::unique_ptr<SolventPropsAdFromDeck> solvent_props_;
44 
45  // ------------ Methods ------------
46 
47 
48  // Print startup message if on output rank.
49  void printStartupMessage()
50  {
51  if (Base::output_cout_) {
52  const std::string version = moduleVersionName();
53  std::cout << "**********************************************************************\n";
54  std::cout << "* *\n";
55  std::cout << "* This is Flow-Solvent (version " << version << ")"
56  << std::string(18 - version.size(), ' ') << "*\n";
57  std::cout << "* *\n";
58  std::cout << "* Flow-Solvent is a simulator for fully implicit three-phase, *\n";
59  std::cout << "* four-component (black-oil + solvent) flow, and is part of OPM. *\n";
60  std::cout << "* For more information see http://opm-project.org *\n";
61  std::cout << "* *\n";
62  std::cout << "**********************************************************************\n\n";
63  }
64  }
65 
66 
67 
68 
69 
70  // Set up grid and property objects, by calling base class
71  // version and then creating solvent property object.
72  void setupGridAndProps()
73  {
74  Base::setupGridAndProps();
75 
76  const Grid& grid = Base::grid_init_->grid();
77  solvent_props_.reset(new SolventPropsAdFromDeck(*Base::deck_,
78  *Base::eclipse_state_,
79  UgGridHelpers::numCells(grid),
80  UgGridHelpers::globalCell(grid)));
81  }
82 
83 
84 
85 
86 
87  // Create simulator instance.
88  // Writes to:
89  // simulator_
90  void createSimulator()
91  {
92  // Create the simulator instance.
93  Base::simulator_.reset(new Simulator(Base::param_,
94  Base::grid_init_->grid(),
95  *Base::geoprops_,
96  *Base::fluidprops_,
97  *solvent_props_,
98  Base::rock_comp_->isActive() ? Base::rock_comp_.get() : nullptr,
99  *Base::fis_solver_,
100  Base::gravity_.data(),
101  Base::deck_->hasKeyword("DISGAS"),
102  Base::deck_->hasKeyword("VAPOIL"),
103  Base::eclipse_state_,
104  *Base::output_writer_,
105  Base::deck_,
106  Base::threshold_pressures_,
107  Base::deck_->hasKeyword("SOLVENT")));
108  }
109 
110  void setupLinearSolver()
111  {
112  // require_full_sparsity_pattern as default for solvent runs
113  if (Base::deck_->hasKeyword("SOLVENT") && !Base::param_.has("require_full_sparsity_pattern") ) {
114  Base::param_.insertParameter("require_full_sparsity_pattern","true");
115  }
116  Base::setupLinearSolver();
117  }
118 
119  };
120 
121 
122 } // namespace Opm
123 
124 
125 #endif // OPM_FLOWMAINSOLVENT_HEADER_INCLUDED
Definition: FlowMainSolvent.hpp:36
std::string moduleVersionName()
Return the version name of the module, for example &quot;2015.10&quot; (for a release branch) or &quot;2016...
Definition: moduleVersion.cpp:28
This class encapsulates the setup and running of a simulator based on an input deck.
Definition: FlowMain.hpp:122
Definition: SolventPropsAdFromDeck.hpp:37