Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CausalLiquefier.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CausalLiquefier.cc
1 /*******************************************************************************
2  * Copyright (c) The JETSCAPE Collaboration, 2018
3  *
4  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
5  *
6  * For the list of contributors see AUTHORS.
7  *
8  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9  *
10  * or via email to bugs.jetscape@gmail.com
11  *
12  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13  * See COPYING for details.
14  ******************************************************************************/
15 // -----------------------------------------
16 // This is a causal liquefier with the JETSCAPE framework
17 // -----------------------------------------
18 
19 #include "CausalLiquefier.h"
20 #include "JetScapeLogger.h"
21 #include "JetScapeXML.h"
22 #include <cfloat>
23 
24 namespace Jetscape {
25 
26 
28  VERBOSE(8);
29  dtau = 0.6;
30  dx = 0.3;
31  dy = 0.3;
32  deta = 0.3;
33  tau_delay = 2.0;
34  time_relax = 0.1;
35  d_diff = 0.08;
36  width_delta = 0.1;
37  Init();// Get values of parameters from XML
38  c_diff = sqrt(d_diff/time_relax);
39  gamma_relax = 0.5/time_relax;
40  if( c_diff > 1.0 ){
41  JSWARN << "Bad Signal Velocity in CausalLiquefier";
42  }
43 // else{
44 // //for debug
45 // JSINFO << "c_diff = " << c_diff;
46 // }
47 
48 }
49 
50 CausalLiquefier::CausalLiquefier(double dtau_in, double dx_in, double dy_in, double deta_in){
51  VERBOSE(8);
52  JSINFO<<"Initialize CausalLiquefier (for Unit Test) ...";
53  dtau = dtau_in;
54  dx = dx_in;
55  dy = dy_in;
56  deta = deta_in;
57  tau_delay = 2.0;
58  time_relax = 0.1;
59  d_diff = 0.08;
60  width_delta = 0.1;
61 
62  c_diff = sqrt(d_diff/time_relax);
63  gamma_relax = 0.5/time_relax;
64 
65  JSINFO
66  << "<CausalLiquefier> Fluid Time Step and Cell Size: dtau="
67  << dtau << " fm, dx="
68  << dx << " fm, dy="
69  << dy << " fm, deta="
70  << deta;
71  JSINFO
72  << "<CausalLiquefier> Parameters: tau_delay="
73  << tau_delay << " fm, time_relax="
74  << time_relax << " fm, d_diff="
75  << d_diff << " fm, width_delta="
76  << width_delta <<" fm";
77 }
78 
80 
81  // Initialize parameter with values in XML
82  JSINFO<<"Initialize CausalLiquefier ...";
83 
84  dtau = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "dtau"});
85  dx = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "dx"});
86  dy = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "dy"});
87  deta = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "deta"});
88  tau_delay = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "tau_delay"});// in [fm]
89  time_relax = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "time_relax"});// in [fm]
90  d_diff = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "d_diff"});// in [fm]
91  width_delta = JetScapeXML::Instance()->GetElementDouble({"Liquefier", "CausalLiquefier", "width_delta"});// in [fm]
92 
93  // for debug
94 // JSINFO
95 // << "<CausalLiquefier> Fluid Time Step and Cell Size: dtau="
96 // << dtau << " fm, dx="
97 // << dx << " fm, dy="
98 // << dy << " fm, deta="
99 // << deta;
100 // JSINFO
101 // << "<CausalLiquefier> Parameters: tau_delay="
102 // << tau_delay << " fm, time_relax="
103 // << time_relax << " fm, d_diff="
104 // << d_diff << " fm, width_delta="
105 // << width_delta <<" fm";
106 
107 }
108 
109 //CausalLiquefier::~CausalLiquefier(){};
110 
111 
114  Jetscape::real eta, const Droplet drop_i,
115  std::array<Jetscape::real, 4> &jmu) const {
116 
117  jmu = {0., 0, 0, 0};//source in tau-eta coordinates
118 
119  const auto p_drop = drop_i.get_pmu();
120  auto x_drop = drop_i.get_xmu();// position of the doloplet in the Cartesian coodinates
121  double tau_drop = x_drop[0];
122  double eta_drop = x_drop[3];
123  x_drop[0] = get_t(tau_drop, eta_drop);
124  x_drop[3] = get_z(tau_drop, eta_drop);
125 
126  if( tau - 0.5*dtau <= tau_drop + tau_delay &&
127  tau + 0.5*dtau > tau_drop + tau_delay ){
128 
129  double t = get_t(tau, eta);// position in the fluid in the Cartesian coodinates
130  double z = get_z(tau, eta);
131 
132  double delta_t = t - x_drop[0];
133  double delta_r = sqrt((x-x_drop[1])*(x-x_drop[1])+(y-x_drop[2])*(y-x_drop[2])+(z-x_drop[3])*(z-x_drop[3]));
134 
135  // get solutions of the diffusion equation in the Cartesian coordinates
136  double jt = kernel_rho( delta_t, delta_r )/dtau;
137  double jz;
138  if( delta_r <= DBL_MIN ){
139  jz = 0.0;
140  }else{
141  jz = ((z-x_drop[3])/delta_r)*kernel_j( delta_t, delta_r )/dtau;
142  }
143  // get flux for the constant-tau surface
144  double jtau = get_ptau(jt, jz, eta);
145 
146  // get source in tau-eta coordinates
147  jmu[0] = jtau*get_ptau(p_drop[0], p_drop[3], eta);
148  jmu[1] = jtau*p_drop[1];
149  jmu[2] = jtau*p_drop[2];
150  jmu[3] = jtau*get_peta(p_drop[0], p_drop[3], eta);
151 
152  }
153 
154 }
155 
156 
157 //Charge density rho in causal diffusion
158 double CausalLiquefier::kernel_rho(double t, double r) const {
159  return dumping(t)*(rho_smooth(t, r)+rho_delta(t, r));
160 }
161 
162 //Radial component of current j in causal diffusion
163 double CausalLiquefier::kernel_j(double t, double r) const {
164  return dumping(t)*(j_smooth(t, r)+j_delta(t, r));
165 }
166 
167 //Dumping factor in solutions of rho and j
168 double CausalLiquefier::dumping(double t) const {
169  return exp(-gamma_relax*t)/(4.0*M_PI);
170 }
171 
172 //Smooth component of rho
173 double CausalLiquefier::rho_smooth(double t, double r) const {
174  if( r < c_diff*t ){
175  double u = sqrt( c_diff*c_diff*t*t - r*r );
176  double x = gamma_relax*u/c_diff; // unitless
177 
178  double i1 = gsl_sf_bessel_I1(x)/(c_diff*u);
179  double i2 = gsl_sf_bessel_In(2,x)*t/u/u;
180  double f = gamma_relax*gamma_relax/c_diff;
181 
182  return f * (i1+i2);
183  }else{
184  return 0.0;
185  }
186 }
187 
188 //Smooth component of j
189 double CausalLiquefier::j_smooth(double t, double r) const {
190  if( r < c_diff*t ){
191  double u = sqrt( c_diff*c_diff*t*t - r*r );
192  double x = gamma_relax*u/c_diff; // unitless
193 
194  double i2 = gsl_sf_bessel_In(2,x)*r/u/u;
195  double f = gamma_relax*gamma_relax/c_diff;
196 
197  return f * i2;
198 
199  }else{
200  return 0.0;
201  }
202 }
203 
204 //Wave front component of rho
205 double CausalLiquefier::rho_delta(double t, double r) const {
206 
207  double r_w = width_delta;
208  if( c_diff*t <= width_delta ){
209  r_w = c_diff*t;
210  }
211 
212  if( r >= c_diff*t - r_w && r < c_diff*t ){
213  double x = gamma_relax*t;
214  return (1.0 + x + x*x/2.0)/r_w/r/r;
215  }else{
216  return 0.0;
217  }
218 
219 }
220 
221 //Wave front component of j
222 double CausalLiquefier::j_delta(double t, double r) const {
223  return c_diff*rho_delta(t, r);
224 }
225 
226 //Get Cartesian time t from tau and eta
227 double CausalLiquefier::get_t(double tau, double eta)const{
228  return tau*cosh(eta);
229 }
230 
231 //Get Cartesian coordinate z from tau and eta
232 double CausalLiquefier::get_z(double tau, double eta)const{
233  return tau*sinh(eta);
234 }
235 
236 //Lorentz Transformation to get tau component of four vector
237 double CausalLiquefier::get_ptau(double p0, double p3, double eta)const{
238  return p0*cosh(eta) - p3*sinh(eta);
239 }
240 
241 //Lorentz Transformation to get eta component of four vector
242 double CausalLiquefier::get_peta(double p0, double p3, double eta)const{
243  return p3*cosh(eta) - p0*sinh(eta);
244 }
245 
246 //For debug, Change tau_delay
247 void CausalLiquefier::set_t_delay(double new_tau_delay){
248  tau_delay = new_tau_delay;
249 }
250 
251 };