Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FreestreamMilneWrapper.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FreestreamMilneWrapper.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 #include <stdio.h>
17 #include <sys/stat.h>
18 
19 #include <cstring>
20 
21 #include "JetScapeLogger.h"
22 #include "FreestreamMilneWrapper.h"
23 
24 using namespace std;
25 
26 // Register the module with the base class
28  FreestreamMilneWrapper::reg("FreestreamMilne");
29 
31  preequilibrium_status_ = NOT_STARTED;
32  SetId("Freestream-Milne");
33 }
34 
36  if (preequilibrium_status_ != NOT_STARTED)
37  delete fsmilne_ptr;
38 }
39 
41  PreEquilibriumParameterFile parameter_list) {
42  JSINFO << "Initialize freestream-milne ...";
43  VERBOSE(8);
44 
45  std::string input_file = GetXMLElementText(
46  {"Preequilibrium", "FreestreamMilne", "freestream_input_file"});
47  //is this necessary? if we just force the user to have the 'freestream_input' file in the correct directory
48 
49  fsmilne_ptr = new FREESTREAMMILNE();
50  struct parameters *params = fsmilne_ptr->configure(input_file.c_str());
51 
52  double tau0 = GetXMLElementDouble(
53  {"Preequilibrium", "tau0"});
54  double taus = GetXMLElementDouble(
55  {"Preequilibrium", "taus"});
56 
57  params->TAU0 = tau0;
58  params->DTAU = taus - tau0;
59 }
60 
62  VERBOSE(8);
63  JSINFO << "Initialize energy density profile in freestream-milne ...";
64  // grab initial energy density from vector from initial state module
65  std::vector<double> entropy_density =
66  ini->GetEntropyDensityDistribution(); //note that this is the energy density when read by freestream-milne, not actually the entropy density!
67  std::vector<float> entropy_density_float(entropy_density.begin(),
68  entropy_density.end());
69  fsmilne_ptr->initialize_from_vector(entropy_density_float);
70  preequilibrium_status_ = INIT;
71  if (preequilibrium_status_ == INIT) {
72  JSINFO << "running freestream-milne ...";
73  // evolve the medium via freestreaming
74  fsmilne_ptr->run_freestream_milne();
75  preequilibrium_status_ = DONE;
76  }
77  // now prepare to send the resulting hydro variables to the hydro module by coping hydro vectors to Preequilibrium base class members
78  fsmilne_ptr->output_to_vectors(e_, P_, utau_, ux_, uy_, ueta_, pi00_, pi01_,
79  pi02_, pi03_, pi11_, pi12_, pi13_, pi22_,
80  pi23_, pi33_, bulk_Pi_);
81 }