File indexing completed on 2025-08-05 08:18:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef __CL_VISC__
0026 #define __CL_VISC__
0027
0028 #define __CL_ENABLE_EXCEPTIONS
0029
0030
0031 #include "clideal.h"
0032 #include "bulkinfo.h"
0033
0034 namespace clvisc {
0035
0036
0037
0038 class CLVisc
0039 {
0040 private:
0041 Config cfg_;
0042
0043 CLIdeal ideal_;
0044 OpenclBackend backend_;
0045
0046
0047 double tau0_;
0048
0049
0050
0051 double tau_;
0052
0053 size_t size_;
0054 std::string compile_option_;
0055
0056
0057
0058 std::vector<cl_real> h_shear_pi_;
0059
0060 std::vector<cl_real> h_bulk_pi_;
0061
0062
0063 std::vector<cl_real4> h_net_charge_;
0064
0065 cl::Buffer d_shear_pi_[3];
0066 cl::Buffer d_bulk_pi_[3];
0067 cl::Buffer d_net_charge_[3];
0068
0069
0070 cl::Buffer d_is_shear_pi_src_;
0071 cl::Buffer d_is_bulk_pi_src_;
0072 cl::Buffer d_udx_;
0073 cl::Buffer d_udy_;
0074 cl::Buffer d_udz_;
0075 cl::Buffer d_udiff_;
0076
0077
0078 cl::Buffer d_goodcell_;
0079
0080
0081 cl::Kernel kernel_is_initialize_;
0082 cl::Kernel kernel_is_src_christoffel_;
0083 cl::Kernel kernel_is_src_alongx_;
0084 cl::Kernel kernel_is_src_alongy_;
0085 cl::Kernel kernel_is_src_alongz_;
0086 cl::Kernel kernel_is_update_pimn_;
0087 cl::Kernel kernel_is_get_udiff_;
0088
0089
0090 cl::Kernel kernel_visc_src_christoffel_;
0091 cl::Kernel kernel_visc_kt_src_alongx_;
0092 cl::Kernel kernel_visc_kt_src_alongy_;
0093 cl::Kernel kernel_visc_kt_src_alongz_;
0094 cl::Kernel kernel_visc_update_ev_;
0095
0096 void initialize_gpu_buffer_();
0097
0098 void israel_stewart_initialize_();
0099
0100
0101 void update_udiff_();
0102
0103 void half_step_israel_stewart_(int step);
0104 void half_step_visc_(int step);
0105
0106 void half_step_(int step);
0107
0108 public:
0109
0110 CLVisc(const Config & cfg, std::string device_type, int device_id);
0111
0112 BulkInfo bulkinfo_;
0113
0114 inline const Config & get_config() {return cfg_;}
0115
0116
0117 template <typename ValueType>
0118 void read_ini(const std::vector<ValueType> & ed);
0119
0120
0121 template <typename ValueType>
0122 void read_ini(const std::vector<ValueType> & ed,
0123 const std::vector<ValueType> & vx,
0124 const std::vector<ValueType> & vy,
0125 const std::vector<ValueType> & vz);
0126
0127
0128 template <typename ValueType>
0129 void read_ini(const std::vector<ValueType> & ed,
0130 const std::vector<ValueType> & vx,
0131 const std::vector<ValueType> & vy,
0132 const std::vector<ValueType> & vz,
0133 const std::vector<ValueType> & pi00,
0134 const std::vector<ValueType> & pi01,
0135 const std::vector<ValueType> & pi02,
0136 const std::vector<ValueType> & pi03,
0137 const std::vector<ValueType> & pi11,
0138 const std::vector<ValueType> & pi12,
0139 const std::vector<ValueType> & pi13,
0140 const std::vector<ValueType> & pi22,
0141 const std::vector<ValueType> & pi23,
0142 const std::vector<ValueType> & pi33);
0143
0144
0145
0146 template <typename ValueType>
0147 void read_ini(const std::vector<ValueType> & ed,
0148 const std::vector<ValueType> & vx,
0149 const std::vector<ValueType> & vy,
0150 const std::vector<ValueType> & vz,
0151 const std::vector<ValueType> & pi00,
0152 const std::vector<ValueType> & pi01,
0153 const std::vector<ValueType> & pi02,
0154 const std::vector<ValueType> & pi03,
0155 const std::vector<ValueType> & pi11,
0156 const std::vector<ValueType> & pi12,
0157 const std::vector<ValueType> & pi13,
0158 const std::vector<ValueType> & pi22,
0159 const std::vector<ValueType> & pi23,
0160 const std::vector<ValueType> & pi33,
0161 const std::vector<ValueType> & bulk_pi,
0162 const std::vector<ValueType> & net_charge_baryon_,
0163 const std::vector<ValueType> & net_charge_electric,
0164 const std::vector<ValueType> & net_charge_strange);
0165
0166
0167
0168 void one_step();
0169
0170
0171
0172 void evolve();
0173
0174
0175 ~CLVisc();
0176
0177 };
0178
0179 }
0180
0181 #endif
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198