diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2011-05-12 17:31:50 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2011-05-12 17:31:50 +0000 |
commit | 8478361c99b641f8a060578db49626e21aa6e1d3 (patch) | |
tree | f44ad46c0ce5507a25260acb61b9c303b2da3944 | |
parent | 0a3f4c7a7cbac6eb423d9a8b6e195a02d1b04ade (diff) | |
download | opt-utilities-8478361c99b641f8a060578db49626e21aa6e1d3.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@196 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r-- | vmodels/vt_temperature.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
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 <core/fitter.hpp> +#include <misc/optvec.hpp> +#include <vector> +#include <string> +#include <cmath> + +using namespace std; +using namespace opt_utilities; +template <typename T> +class vk_temperature + :public model<optvec<T>,optvec<T>,optvec<T>,std::string> +{ +private: + vk_temperature<T>* do_clone()const + { + return new vk_temperature<T>(*this); + } + typedef optvec<T> Tv; +public: + vk_temperature() + { + this->push_param_info(param_info<Tv>("T0",2,0.1,10)); + this->push_param_info(param_info<Tv>("rcool",1e22,0.001,10)); + this->push_param_info(param_info<Tv>("acool",1)); + this->push_param_info(param_info<Tv>("Tmin",1,0.1,10)); + this->push_param_info(param_info<Tv>("rt",1e22,0.001,10)); + this->push_param_info(param_info<Tv>("a",1,-10,10)); + this->push_param_info(param_info<Tv>("c",1,-10,10)); + this->push_param_info(param_info<Tv>("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 |