00001
00009 #ifndef BS_WELL_CONNECTION_H_
00010 #define BS_WELL_CONNECTION_H_
00011
00012 #include "fi_params.h"
00013 #include BS_FORCE_PLUGIN_IMPORT ()
00014 #include "convert_units.h"
00015 #include BS_STOP_PLUGIN_IMPORT ()
00016
00017 #include "well_type_helper.h"
00018 #include "wells_compute_connection_factors.h"
00019 #include "array_ext.h"
00020
00021 #include "well_controller.h"
00022
00023
00024 namespace blue_sky
00025 {
00026
00027 template <typename strategy_t>
00028 class well;
00029
00030 template <typename strategy_t>
00031 class calc_model;
00032
00033 namespace wells
00034 {
00035
00037
00041 enum connection_type
00042 {
00043 CONNECTION_USUAL,
00044 CONNECTION_GRP_PRIMARY,
00045 CONNECTION_GRP_SECONDARY,
00046
00047 CONNECTION_TOTAL,
00048 };
00050
00052
00056 enum connection_direction_type
00057 {
00058 direction_x,
00059 direction_y,
00060 direction_z,
00061
00062 direction_total,
00063 };
00064
00072 connection_direction_type
00073 connection_direction_cast (const std::string &str);
00075
00077
00081 enum connection_status_type
00082 {
00083 connection_open,
00084 connection_shut,
00085
00086 connection_total,
00087 };
00088
00096 connection_status_type
00097 connection_status_cast (const std::string &str);
00099
00101
00105 template <typename strategy_t>
00106 class BS_API_PLUGIN connection : public objbase
00107 {
00108 public:
00109
00110 typedef connection <strategy_t> this_t;
00111 typedef smart_ptr <this_t, true> sp_this_t;
00112
00113 typedef typename strategy_t::item_array_t item_array_t;
00114 typedef typename strategy_t::item_t item_t;
00115 typedef typename strategy_t::rhs_item_t rhs_item_t;
00116 typedef typename strategy_t::index_t index_t;
00117
00118 typedef rate_data <strategy_t> rate_data_t;
00119 typedef typename rate_data_t::rate_data_inner rate_data_inner_t;
00120
00121 typedef fi_params params_t;
00122 typedef smart_ptr <params_t> sp_params_t;
00123
00124 typedef rs_mesh_iface <strategy_t> mesh_iface_t;
00125 typedef smart_ptr <mesh_iface_t, true> sp_mesh_iface_t;
00126
00127 typedef connection <strategy_t> connection_t;
00128 typedef calc_model <strategy_t> calc_model_t;
00129 typedef well <strategy_t> well_t;
00130
00131 public:
00132
00142 void
00143 compute_factors (const physical_constants &internal_contstants,
00144 const sp_params_t ¶ms,
00145 const sp_mesh_iface_t &mesh,
00146 const item_array_t &perm,
00147 const item_array_t &ntg,
00148 bool ro_calc_flag = false);
00149
00154 void
00155 mul_perm_mult (item_t mult);
00156
00161 void
00162 set_half_length (item_t half_length);
00163
00168 void
00169 set_theta (item_t theta);
00170
00175 void
00176 set_skin (item_t skin);
00177
00182 void
00183 set_status (connection_status_type connection_status);
00184
00189 void
00190 set_factor (item_t factor);
00191
00196 void
00197 set_diameter (item_t diameter);
00198
00204 void
00205 set_Kh (item_t kh);
00206
00213 void
00214 set_direction (connection_direction_type direction);
00215
00224 void
00225 set_coord (index_t i, index_t j, index_t k, index_t n_block);
00226
00231 void
00232 set_connection_depth (const sp_mesh_iface_t &mesh);
00233
00239 index_t
00240 n_block () const;
00241
00246 item_t
00247 get_fact () const;
00248
00253 void
00254 set_bulkp (item_t bulkp);
00255
00261 void
00262 set_rate (item_t rate);
00263
00268 void
00269 set_head_term (item_t head_term);
00270
00275 void
00276 set_cur_bhp (item_t cur_bhp);
00277
00282 void
00283 set_mult (item_t mult);
00284
00290 void
00291 set_seg_number (const index_t &seg);
00292
00297 bool
00298 is_shut () const;
00299
00304 connection_status_type
00305 get_status () const
00306 {
00307 return status_;
00308 }
00309
00314 connection_direction_type
00315 get_dir () const
00316 {
00317 return dir_;
00318 }
00319
00321 item_t
00322 get_cur_bhp () const;
00323
00325 item_t
00326 get_density () const;
00327
00329 item_t
00330 get_connection_depth () const;
00331
00333 item_t
00334 get_bulkp () const;
00335
00337 index_t
00338 i_coord () const;
00339
00341 index_t
00342 j_coord () const;
00343
00345 index_t
00346 k_coord () const;
00347
00349 item_t
00350 mult () const;
00351
00353 item_t
00354 get_head_term () const;
00355
00357 index_t
00358 get_seg_number () const;
00359
00363 virtual void
00364 clear_data ();
00365
00370 virtual array_ext <item_t>
00371 get_rw_value ();
00372
00377 virtual array_ext <item_t>
00378 get_wr_value ();
00379
00384 virtual array_ext <item_t>
00385 get_rr_value ();
00386
00391 virtual array_ext <item_t>
00392 get_ps_value ();
00393
00398 virtual array_ext <rhs_item_t>
00399 get_rate_value ();
00400
00405 const rate_data_t &
00406 rate () const
00407 {
00408 return rate_;
00409 }
00410
00415 const rate_data_inner_t &
00416 rate_prod () const
00417 {
00418 return rate_.prod;
00419 }
00420
00425 const rate_data_inner_t &
00426 rate_inj () const
00427 {
00428 return rate_.inj;
00429 }
00430
00431 public:
00432 auto_value <item_t> head_term;
00433 auto_value <item_t> cur_bhp;
00434 auto_value <item_t> connection_depth;
00435 auto_value <item_t> density;
00436 auto_value <item_t> bulkp;
00437
00438 rate_data_t rate_;
00439 rate_data_t rate_rc_;
00440
00441 private:
00442
00443 template <typename strategy_t_x>
00444 friend struct wells::compute_factors::peaceman_model;
00445
00446 template <typename strategy_t_x>
00447 friend struct wells::compute_factors::baby_odeh_model;
00448
00449 auto_value <index_t, -1> i_coord_;
00450 auto_value <index_t, -1> j_coord_;
00451 auto_value <index_t, -1> k_coord_;
00452
00453 auto_value <connection_status_type, connection_open>
00454 status_;
00455
00456
00457 auto_value <item_t> diam_;
00458 auto_value <item_t> kh_;
00459 auto_value <item_t> skin_;
00460 auto_value <item_t, 1> mult_;
00461 auto_value <item_t, -1> fact_;
00462 auto_value <item_t, -1> R0_;
00463
00464 auto_value <item_t> fracture_half_length_;
00465 auto_value <item_t> fracture_angle_;
00466 auto_value <item_t> fracture_perm_;
00467
00468 auto_value <index_t, -1> n_block_;
00469
00470 auto_value <connection_direction_type, direction_x>
00471 dir_;
00472
00473 auto_value <connection_type, CONNECTION_USUAL>
00474 connection_type_;
00475
00476 protected:
00477 auto_value <index_t, 0> iseg_;
00478 public:
00480 BLUE_SKY_TYPE_DECL_T (connection <strategy_t>);
00481 };
00482
00483
00484 }
00485 }
00486
00487
00488 #endif // #ifndef BS_WELL_CONNECTION_H_