00001
00009 #ifndef RESERVOIR_SIMULATOR_H
00010 #define RESERVOIR_SIMULATOR_H
00011
00012 #include "simulator_events.h"
00013 #include "data_manager.h"
00014 #include "event_manager.h"
00015 #include "jacobian.h"
00016
00017 namespace blue_sky
00018 {
00019
00020 template <typename strategy_t>
00021 class reservoir;
00022
00023 template <typename strategy_t>
00024 class calc_model;
00025
00026 template <typename strategy_t>
00027 class reservoir;
00028
00029 template <typename strategy_t>
00030 struct BS_API_PLUGIN trans_multipliers_calc;
00031
00032 template <typename strategy_t>
00033 struct main_loop_calc_base;
00034
00035 class data_storage_interface;
00036
00037 template <typename strategy_t>
00038 class keyword_manager;
00039
00045 template <class strategy_t>
00046 class BS_API_PLUGIN reservoir_simulator : public bs_node
00047 {
00048 public:
00049
00050 typedef reservoir_simulator < strategy_t > this_t;
00051 typedef smart_ptr < this_t, true > sp_this_t;
00052
00053 typedef data_manager < strategy_t > dm_t;
00054 typedef smart_ptr < dm_t, true > sp_dm_t;
00055
00056 typedef rs_mesh_iface < strategy_t > mesh_iface_t;
00057 typedef smart_ptr < mesh_iface_t, true > sp_mesh_iface_t;
00058
00059 typedef linear_solver_base < strategy_t > solver_t;
00060 typedef smart_ptr < solver_t, true> sp_solver_t;
00061
00062 typedef event_manager <strategy_t> em_t;
00063 typedef smart_ptr < em_t, true > sp_em_t;
00064 typedef typename em_t::sp_event_base_list sp_event_base_list_t;
00065
00066 typedef calc_model < strategy_t > calc_model_t;
00067 typedef smart_ptr < calc_model_t, true > sp_calc_model_t;
00068
00069 typedef reservoir <strategy_t> reservoir_t;
00070 typedef smart_ptr <reservoir_t, true> sp_reservoir_t;
00071
00072 typedef data_storage_interface facility_storage_t;
00073 typedef smart_ptr <facility_storage_t, true> sp_facility_storage_t;
00074
00075 typedef jacobian <strategy_t> jacobian_t;
00076 typedef smart_ptr <jacobian_t, true> sp_jacobian_t;
00077
00078 typedef typename strategy_t::item_t item_t;
00079 typedef typename strategy_t::index_t index_t;
00080 typedef typename strategy_t::item_array_t item_array_t;
00081 typedef typename strategy_t::index_array_t index_array_t;
00082
00084 typedef trans_multipliers_calc <strategy_t> trans_multipliers_calc_t;
00085 typedef main_loop_calc_base <strategy_t> main_loop_calc_t;
00086
00087 typedef keyword_manager <strategy_t> keyword_manager_t;
00088 typedef smart_ptr <keyword_manager_t, true > sp_keyword_manager_t;
00089
00090 typedef jacobian_matrix <strategy_t> jmatrix_t;
00091 typedef smart_ptr <jmatrix_t, true> sp_jmatrix_t;
00092
00093 public:
00098 void
00099 set_mesh (const sp_mesh_iface_t&);
00100
00104 const sp_dm_t &
00105 get_data_manager () const;
00106
00110 const sp_em_t &
00111 get_event_manager () const;
00112
00116 const sp_calc_model_t &
00117 get_calc_model () const;
00118
00122 const sp_mesh_iface_t &
00123 get_mesh () const;
00124
00128 const sp_jacobian_t &
00129 get_jacobian () const;
00130
00134 const sp_reservoir_t &
00135 get_reservoir () const;
00136
00140 void
00141 init();
00142
00148 void
00149 main_loop ();
00150
00156 main_loop_calc_t *
00157 get_main_loop ();
00158
00162 virtual ~reservoir_simulator();
00163
00169 void
00170 set_subnode_in_tree (const std::string &name, sp_obj obj)
00171 {
00172 bs_node::erase (name);
00173 bs_node::insert (obj, name, false);
00174 }
00175
00181 void
00182 simulate (const std::string &path);
00183
00189 void
00190 read_keyword_file_and_init (const std::string &path);
00191
00199 void
00200 pre_large_step (const sp_event_base_list_t &event_list);
00201
00205 std::string
00206 model_filename () const;
00207
00208 BLUE_SKY_TYPE_DECL_T(reservoir_simulator)
00209
00210
00211 typedef bs_array <std::string> signal_params_t;
00212
00214 DECLARE_EVENT_LIST (reservoir_simulator,
00215 signal_params_t,
00216 12,
00217 ((begin, (clock_t), 1)
00218 , (newton_iter_fail, (), 0)
00219 , (newton_iter_success, (), 0)
00220 , (before_fi_operator, (), 0)
00221 , (before_jacobian_setup, (), 0)
00222 , (before_jacobian_solve, (), 0)
00223 , (before_restore_solution, (), 0)
00224 , (simulation_start, (), 0)
00225 , (large_step_start, (), 0)
00226 , (small_step_start, (), 0)
00227 , (end, (clock_t), 1)
00228 , (post_read, (), 0)
00229 ));
00230
00231
00232 sp_dm_t dm;
00233 sp_em_t em;
00234 sp_calc_model_t cm;
00235 sp_mesh_iface_t mesh;
00236 sp_reservoir_t reservoir_;
00237 sp_facility_storage_t facility_storage_;
00238 sp_jacobian_t jacobian_;
00239 sp_keyword_manager_t keyword_manager_;
00240 std::string model_filename_;
00241
00242 smart_ptr <main_loop_calc_t, false> mloop;
00243 };
00244
00250 bool
00251 reservoir_simulator_register_types (const plugin_descriptor &pd);
00252 }
00253
00254 #endif // RESERVOIR_SIMULATOR_H