00001
00010 #ifndef BS_WELLS_WELL_RATE_CONTROL_H_
00011 #define BS_WELLS_WELL_RATE_CONTROL_H_
00012
00013 #include "well_rate_control_interface.h"
00014 #include "rate_control_type.h"
00015
00016 namespace blue_sky
00017 {
00018 namespace wells
00019 {
00020
00021 template <typename strategy_t>
00022 class well_rate_control_interface;
00023
00024 template <typename strategy_t>
00025 class BS_API_PLUGIN well_rate_control : public objbase
00026 {
00027 public:
00028 typedef strategy_t strategy_type;
00029 typedef well_rate_control <strategy_t> this_t;
00030
00031 typedef typename strategy_t::index_t index_t;
00032
00033 typedef calc_model <strategy_t> calc_model_t;
00034 typedef jacobian_matrix <strategy_t> jmatrix_t;
00035 typedef well <strategy_t> well_t;
00036 typedef well_controller <strategy_t> well_controller_t;
00037 typedef well_rate_control_interface <strategy_t> well_rate_control_impl_t;
00038
00039 typedef smart_ptr <calc_model_t, true> sp_calc_model_t;
00040 typedef smart_ptr <jmatrix_t, true> sp_jmatrix_t;
00041 typedef smart_ptr <well_t, true> sp_well_t;
00042 typedef smart_ptr <well_controller_t, true> sp_well_controller_t;
00043
00044 typedef smart_ptr <well_rate_control_impl_t, true> sp_well_rate_control_impl_t;
00045
00046 public:
00047
00048 bool
00049 is_bhp () const
00050 {
00051 return is_bhp_;
00052 }
00053 bool
00054 is_production () const
00055 {
00056 return is_prod_;
00057 }
00058 bool
00059 is_rate () const
00060 {
00061 return !is_bhp_;
00062 }
00063 rate_control_type
00064 get_control_type () const
00065 {
00066 return control_type_;
00067 }
00068
00069 void
00070 set_is_bhp (bool f)
00071 {
00072 is_bhp_ = f;
00073 }
00074 void
00075 set_is_prod (bool f)
00076 {
00077 is_prod_ = f;
00078 }
00079 void
00080 set_control_type (rate_control_type control_type)
00081 {
00082 control_type_ = control_type;
00083 }
00084 void
00085 set_impl (const sp_well_rate_control_impl_t &impl)
00086 {
00087 impl_ = impl;
00088 }
00089 void
00090 compute_rate (const sp_calc_model_t &calc_model, sp_jmatrix_t &jmatrix, sp_well_t &well, const sp_well_controller_t &well_controller) const
00091 {
00092 impl_->compute_rate (calc_model, jmatrix, well, well_controller);
00093 }
00094 void
00095 compute_derivs (const sp_calc_model_t &calc_model, sp_jmatrix_t &jmatrix, sp_well_t &well, const sp_well_controller_t &well_controller) const
00096 {
00097 impl_->compute_derivs (calc_model, jmatrix, well, well_controller);
00098 }
00099
00100 BLUE_SKY_TYPE_DECL_T (well_rate_control);
00101
00102 private:
00103 bool is_bhp_;
00104 bool is_prod_;
00105 auto_value <rate_control_type, null_control> control_type_;
00106 sp_well_rate_control_impl_t impl_;
00107 };
00108
00109 }
00110 }
00111
00112 #endif // #ifndef BS_WELLS_WELL_RATE_CONTROL_H_
00113