From 8478361c99b641f8a060578db49626e21aa6e1d3 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 12 May 2011 17:31:50 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@196 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodels/vt_temperature.hpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 vmodels/vt_temperature.hpp (limited to 'vmodels/vt_temperature.hpp') diff --git a/vmodels/vt_temperature.hpp b/vmodels/vt_temperature.hpp new file mode 100644 index 0000000..f6fb55e --- /dev/null +++ b/vmodels/vt_temperature.hpp @@ -0,0 +1,56 @@ +#ifndef VT_T +#define VT_T +#include +#include +#include +#include +#include + +using namespace std; +using namespace opt_utilities; +template +class vk_temperature + :public model,optvec,optvec,std::string> +{ +private: + vk_temperature* do_clone()const + { + return new vk_temperature(*this); + } + typedef optvec Tv; +public: + vk_temperature() + { + this->push_param_info(param_info("T0",2,0.1,10)); + this->push_param_info(param_info("rcool",1e22,0.001,10)); + this->push_param_info(param_info("acool",1)); + this->push_param_info(param_info("Tmin",1,0.1,10)); + this->push_param_info(param_info("rt",1e22,0.001,10)); + this->push_param_info(param_info("a",1,-10,10)); + this->push_param_info(param_info("c",1,-10,10)); + this->push_param_info(param_info("b",1,-10,10)); + }; + Tv do_eval(const Tv& r,const Tv& param) + { + Tv result(r.size()); + T T0=param[0]; + T rcool=param[1]; + T acool=param[2]; + T Tmin=param[3]; + T rt=param[4]; + T a=param[5]; + T c=param[6]; + T b=param[7]; + for(size_t i=0;i!=r.size();++i) + { + T x=pow(r[i]/rcool,acool); + T tcool=(x+Tmin/T0)/(x+1); + T t=pow(r[i]/rt,-a)/pow(pow(r[i]/rt,b)+T(1),c/b); + result[i]=T0*tcool*t; + } + return result; + } + +}; + +#endif -- cgit v1.2.2