Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:30

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2018
0003  *
0004  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
0005  * 
0006  * For the list of contributors see AUTHORS.
0007  *
0008  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
0009  *
0010  * or via email to bugs.jetscape@gmail.com
0011  *
0012  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
0013  * See COPYING for details.
0014  ******************************************************************************/
0015 
0016 #include <stdio.h>
0017 #include <sys/stat.h>
0018 
0019 #include <cstring>
0020 
0021 #include "JetScapeLogger.h"
0022 #include "FreestreamMilneWrapper.h"
0023 
0024 using namespace std;
0025 
0026 // Register the module with the base class
0027 RegisterJetScapeModule<FreestreamMilneWrapper>
0028     FreestreamMilneWrapper::reg("FreestreamMilne");
0029 
0030 FreestreamMilneWrapper::FreestreamMilneWrapper() {
0031   preequilibrium_status_ = NOT_STARTED;
0032   SetId("Freestream-Milne");
0033 }
0034 
0035 FreestreamMilneWrapper::~FreestreamMilneWrapper() {
0036   if (preequilibrium_status_ != NOT_STARTED)
0037     delete fsmilne_ptr;
0038 }
0039 
0040 void FreestreamMilneWrapper::InitializePreequilibrium(
0041     PreEquilibriumParameterFile parameter_list) {
0042   JSINFO << "Initialize freestream-milne ...";
0043   VERBOSE(8);
0044 
0045   std::string input_file = GetXMLElementText(
0046       {"Preequilibrium", "FreestreamMilne", "freestream_input_file"});
0047   //is this necessary? if we just force the user to have the 'freestream_input' file in the correct directory
0048 
0049   fsmilne_ptr = new FREESTREAMMILNE();
0050   struct parameters *params = fsmilne_ptr->configure(input_file.c_str());
0051 
0052   double tau0 = GetXMLElementDouble(
0053       {"Preequilibrium", "tau0"});
0054   double taus = GetXMLElementDouble(
0055       {"Preequilibrium", "taus"});
0056 
0057   params->TAU0 = tau0;
0058   params->DTAU = taus - tau0;
0059 }
0060 
0061 void FreestreamMilneWrapper::EvolvePreequilibrium() {
0062   VERBOSE(8);
0063   JSINFO << "Initialize energy density profile in freestream-milne ...";
0064   // grab initial energy density from vector from initial state module
0065   std::vector<double> entropy_density =
0066       ini->GetEntropyDensityDistribution(); //note that this is the energy density when read by freestream-milne, not actually the entropy density!
0067   std::vector<float> entropy_density_float(entropy_density.begin(),
0068                                            entropy_density.end());
0069   fsmilne_ptr->initialize_from_vector(entropy_density_float);
0070   preequilibrium_status_ = INIT;
0071   if (preequilibrium_status_ == INIT) {
0072     JSINFO << "running freestream-milne ...";
0073     // evolve the medium via freestreaming
0074     fsmilne_ptr->run_freestream_milne();
0075     preequilibrium_status_ = DONE;
0076   }
0077   // now prepare to send the resulting hydro variables to the hydro module by coping hydro vectors to Preequilibrium base class members
0078   fsmilne_ptr->output_to_vectors(e_, P_, utau_, ux_, uy_, ueta_, pi00_, pi01_,
0079                                  pi02_, pi03_, pi11_, pi12_, pi13_, pi22_,
0080                                  pi23_, pi33_, bulk_Pi_);
0081 }