aboutsummaryrefslogtreecommitdiffstats
path: root/dynamical_models/vt_temperature.cpp
blob: 39b474c9f891651724741bca8fc26ab5f53c69d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <core/fitter.hpp>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
using namespace opt_utilities;
class vk_temperature
  :public opt_utilities::model<double,double,std::vector<double>,std::string>
{
private:
  opt_utilities::model<double,double,std::vector<double>,std::string>* do_clone()const;
public:
  vk_temperature();
  double do_eval(const double& r,const std::vector<double>& param);
  
};


model<double,double,vector<double>,std::string>* vk_temperature::do_clone()const
{
  return new vk_temperature(*this);
}

vk_temperature::vk_temperature()
{
  this->push_param_info(param_info<std::vector<double> >("T0",2,0.1,10));
  this->push_param_info(param_info<std::vector<double> >("rcool",1e22,0.001,10));
  this->push_param_info(param_info<std::vector<double> >("acool",1));
  this->push_param_info(param_info<std::vector<double> >("Tmin",1,0.1,10));
  this->push_param_info(param_info<std::vector<double> >("rt",1e22,0.001,10));
  this->push_param_info(param_info<std::vector<double> >("a",1,-10,10));
  this->push_param_info(param_info<std::vector<double> >("c",1,-10,10));
  this->push_param_info(param_info<std::vector<double> >("b",1,-10,10));
}





double vk_temperature::do_eval(const double& r,const std::vector<double>& param)
{
  double T0=param[0];
  double rcool=param[1];
  double acool=param[2];
  double Tmin=param[3];
  double rt=param[4];
  double a=param[5];
  double c=param[6];
  double b=param[7];
  double x=pow(r/rcool,acool);
  double tcool=(x+Tmin/T0)/(x+1);
  double t=pow(r/rt,-a)/pow(1+pow(r/rt,b),c/b);
  return T0*t*tcool;
}


static vk_temperature _model;

extern "C" model<double,double,vector<double>,std::string>*
create_model_object()
{
  return &_model;
}