-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.f90
2342 lines (2068 loc) · 85.6 KB
/
common.f90
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
! *****************************************************************************
! * *
! * ECHO-QGP *
! * *
! * Version: 1.5.0-alpha *
! * *
! * Copyright (C) 2015,2016,2018 The ECHO-QGP team *
! * *
! * File: common.f90 *
! * *
! * License: GPL version 2.0 (Please, read the file LICENSE.TXT) *
! * *
! * This program is free software; you can redistribute it and/or *
! * modify it under the terms of the GNU General Public License *
! * as published by the Free Software Foundation; either version 2 *
! * of the License, or (at your option) any later version. *
! * *
! * This program is distributed in the hope that it will be useful, *
! * but WITHOUT ANY WARRANTY; without even the implied warranty of *
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! * GNU General Public License for more details. *
! * *
! * You should have received a copy of the GNU General Public License *
! * along with this program; if not, write to the Free Software *
! * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
! * Boston, MA 02110-1301, USA. *
! * *
! * Authors: Luca Del Zanna (luca.delzanna@unifi.it) *
! * Gabriele Inghirami (inghirami@fias.uni-frankfurt.de) *
! * *
! * Contributors: *
! * *
! * Acknowledgments: *
! * *
! *****************************************************************************
module common
!-- Main settings to be accessed throughout the code
use holib
use parallel
use eos,only: eos_tab_name, eqstate, przero, enezero,numerically
implicit none
integer :: init_type
real(8) :: t
real(8) :: tout, thyp
real(8) :: tmin, tmax
real(8) :: t_collect_d_a
integer :: errcode
real(8), parameter :: hbar=0.197326 !actually, it is hbar*c
real(8), parameter :: sqrh=0.444214 !it is sqrt(hbar*c)=sqrt(0.197326)
real(8), parameter :: pi=acos(-1.)
real(8), parameter :: am=0.93891897 ! nucleon mass
real(8), parameter :: Qbig=0.30282212 !elementary electric charge, it is sqrt(4*Pi*alpha)
real(8) :: maxspeed !value to reset velocity if it becomes superluminal
real(8) :: B_amplify_factor !the initial magnetic field is multiplied by this factor before introducing any cuts
integer :: nv,nu,nov,nou
integer,parameter :: krh=1,kvx=2,kvy=3,kvz=4,kpr=5,kpibu=6,kpixy=7, kpixz=8,kpiyz=9,kpixx=10,kpiyy=11,kpizz=12
integer :: kbx, kby, kbz, kex, key, kez !their values will be assigned later depending on the type of run (viscid/unviscid)
integer :: krc !charge density in the comoving frame
integer :: kglm !index for the General Lagrange Multiplier, i.e. for divergence cleaning
integer :: kvold_end !index at which vold should end
integer, parameter :: dtx=1, dty=2, dtz=3, dxx=4, dxy=5, dxz=6, dyx=7, dyy=8, dyz=9, dzx=10, dzy=11, dzz=12
integer, parameter :: dtt=13, dxt=14, dyt=15, dzt=16
integer, parameter :: dtet=17, dtex=18, dtey=19, dtez=20
real(8), allocatable, dimension(:,:,:,:) :: derivatives_all
integer,parameter :: nderivatives=20
real(8) :: pitt, pitx, pity, pitz ! components of shear viscous tensor that are computed from the indipendent ones
real(8) :: pizz
character(len=2) :: obtained !it obtains another shear viscous tensor component from the others using null trace condition
integer :: coordinates !flag that select the coordinates system: 1=Minkowski, 2=Bjorken
integer, parameter :: MINKOWSKI=1, BJORKEN=2
! if .true. then we'll evolve also electric and magnetic fields
logical :: mhd, rmhd
logical :: print_rho_comov !decides whether to print or not the charge density in the comoving frame on the freezeout hypersurface
real(8) :: time_comp_rho_comov !time at which the electric charge density in the comoving frame is computed
! interval between output printing, interval between log printing, maximum timestep
real(8) :: dtout, dtlog, maxdt
! temperature at which simulations ends
real(8) :: temp_end
! restart type: 0=no restart possibilities, 1=restart possible only from last
integer :: restart_type
logical :: restarted_run=.false.
logical :: viscosity,bulkvis
real(8) :: eta_over_s
! parameters to tune the relaxation times
real(8) :: tau_pi_coeff
real(8) :: zeta_vis_coeff
real(8) :: g_cov(3),gp,gm, g_cov0, g_cov_3_old
!-- Grid points (x main direction, if parallel nx/npe points for each pe)
!
real(8),dimension(3) :: d_ini
real(8),dimension(2,3) :: xlim
!
!-- Grid extension
real(8) :: x1,x2,y1,y2,z1,z2
!-- Selection of printed variables into the output files
type out_type
integer density
integer vx
integer vy
integer vz
integer pressure
integer energy_density
integer temperature
integer entropy_density
integer bulk
integer pitt
integer pitx
integer pity
integer pitz
integer pixy
integer pixz
integer piyz
integer pixx
integer piyy
integer pizz
integer v0
integer bx
integer by
integer bz
integer ex
integer ey
integer ez
integer glm
integer rc
end type out_type
character(len=9) :: dir_out
character(len=:), allocatable :: prefix_dir
character(len=120) :: param_file_cmdline
character(len=:), allocatable :: param_file
integer :: commandline_outdir_length
integer,allocatable,dimension(:) :: recvcounts,displs
type(out_type) out_sel
integer :: output_precision
!-- Possible initialization types
integer, parameter :: GLAUBER_GEOMETRIC=0, SHOCK_TUBE_2D=1, SHEAR_VISCOUS_1D=2, GLAUBER_MONTECARLO=3, GUBSER_IDEAL=4,&
&GUBSER_VISCOUS=5, TABULATED_INIT=6, ALFVEN2D=7, BLAST3D=8, MHD1DBJ=9, SODMHD=10, LYU=11, BERHAD=12, ROTOR=13, OT=14,&
&DBG=15, EXT_CONS=16, EXT_GLISSANDO=17
!-- Numerical settings (used in evolve.f90 and work.f90)
real(8) :: cfl
logical,parameter :: ho=.false.
character(3),parameter :: solver='HLL'
!reconstruction algorithm
character(5) :: recal
character(10),parameter :: der=' DER-E6'
integer,parameter :: ngc=3
integer, parameter :: RK2=2,RK3=3,SSP=4
character(4) :: nrk_string
integer :: nrk
!-- Declarations
integer,allocatable,dimension(:) :: kv,ku
integer,allocatable,dimension(:,:,:) :: ibc
integer :: boundary_cond
real(8),allocatable,dimension(:) :: x,ddx,x0
real(8),allocatable,dimension(:) :: y,ddy,y0
real(8),allocatable,dimension(:) :: z,ddz,z0
real(8),dimension(:,:,:,:),allocatable :: v,u
real(8),dimension(:,:,:,:),allocatable :: vold, uold, vnewstep, unewstep
real(8),dimension(:,:,:,:),allocatable :: deriv
real(8), dimension(:,:,:,:),allocatable :: vall, uall, vallold, uallold, vderivatives
!DDD they will be allocated only by first processor and it will store global grid data
real(8) :: timeold !it holds the value of time before last timestep
real(8) :: timeinterval !it holds the value of time interval for time derivatives
real(8),dimension(:,:,:,:),allocatable :: w,u0,ax,ay,az,wsend,wrecv
real(8),dimension(:,:,:,:,:),allocatable :: du,du_stiff !it is used to store the intermediate steps in IMEX-SSP schemes
!parameters specific for Glauber-MonteCarlo simulations
integer :: nconf !number of nuclear configurations for generating events
integer :: events_start ! number of the event from which to start
integer :: events_stop ! number of the event at which to stop
integer :: nbcoll ! number of impact parameters per config.
real(8) :: kappa ! model parameters (taken from Eskola et al., PRC83, 034901)
real(8) :: sig_mc ! smearing parameter
real(8) :: ah !initial hardness or collision weight (0=pure participant dependence, 1=pure collision dependence)
integer :: kind_of_collision !1=AA, 2=dA, 3=pA
logical :: fixed_b !fixed impact parameter in GMC initial conditions
real :: eprot !energy of the proton beam in pA collisions
integer :: min_participants !minimum number of_participants to register the event for the AA collisions
integer :: avg_events !instead of performing event by ev. simulations, it does just 1 run with averaged in. cond. (0=off,1=on)
!id of the run
integer :: id_of_the_run
!output directory name that can be given from command line
character(len=120) :: custom_output_directory
integer :: len_of_cmd_line_out_dir
logical :: derivatives_out !flag to enable/disable the print of the derivatives into the output
logical :: flows_out !flag to enable/disable the print of the flows (directed, elliptic and eccentricity) into the output
logical :: enable_smooth_viscosity !flag to enable/disable the smoothing of viscous tensor components below a certain temper.
real(8) :: smooth_temp !temperature under which the values viscosity tensor components are reduced
logical :: run_crashed !flag enabled when something goes wrong in multiple runs (eg Glauber-MC) to skip to the next simulation
character(5) :: name_of_nucleus
character(5) :: nucleus
real(8) :: tauzero
real(8) :: deta,sigeta,yb,projmass,radius,delta,roze,rads,sigma_in,bimpact,ecenter,rhocenter
integer :: zelectrons
integer :: ienentr ! initial conditions flag: 0 (energy), 1 (entropy)
!freezout and hypersurface computation section
real(8), dimension(3) :: d_val(3)
logical :: out_freeze !.true. means that we print freeze-out hypersurfaces, .false. means not
integer :: freeze_type !0 for freezout based on temperature, 1 based on energy density
real(8) :: freeze_value !freeze out value in GeV
real(8) :: freeze_time_interval !time interval for hypersurface computation
!initialization with external files
character(len=120) :: input_edf !input file for entropy density distribution initialization
character(len=120) :: ext_cons_file !external file for initialization with conservative variables
character(len=120) :: ext_glissando_file !external file for initialization with Glissando
!transverse plane analysis section
real(8), allocatable, dimension(:) :: xcm, ycm, eccentricity, elliptic_flow, directed_flow
logical :: tp_anal !it enables the computationo of the fluid transverse flow
!parameters used for producing "tilted" initial energy density profiles
real(8) :: ueta_coeff !for initializations with u^eta!=0
logical :: tilting=.true. !initial energy density tilting as in http://arxiv.org/pdf/1501.04468v2.pdf
real(8) :: etam !eta_m to produce initial en. dens. tilting as in http://arxiv.org/pdf/1501.04468v2.pdf, disabled if <0
!parameters related to MHD simulations
real(8) :: sigma_el_cond !electrical conductivity of QGP
real(8) :: sigma_chiral_cond !chiral conductivity of QGP
real(8) :: ratio_chir_el !ratio between sigma_chiral_cond and sigma_el_cond
integer :: magfield_type !type of magnetic field (1=classical+chiral,2=classical only,3=chiral only)
character(len=120) :: input_B_field !input file for magnetic field initialization
logical :: divclean !it enables divergence cleaning
real(8) :: glm_alpha !look at: Journal of Computational Physics 229 (2010) 2117–2138
real(8) :: glm_ch, glm_ch_old=0.5 !look at: Journal of Computational Physics 229 (2010) 2117–2138
real(8), dimension(3) :: aflux !array in which to store the maximum speed along each direction
logical :: dump_initial_B !if true it will dumpen B when the energy density is below a certain treshold
real(8) :: edens_for_B_dump !value for the energy density, in GeV/fm^3, under which to dump the B field
real(8) :: B_th_press_ratio !ratio between thermal and magnetic pressure in the dumping zone
real(8) :: pw !weight of participants in computing the initial B field with GMC initial conditions
integer :: algo_solver !solver for the cons2prim subroutine in the MHD case: 1 3x3 system cernlib, 2 rootfunc, 3 3x3 Newton w bracketing,
! 4 solver assuming ideal gas eos, 5 solver assuming e=3p, 9 exact solver
!these variables are just used to be known at the system_cons2prim when dealing with IMEX-SSP schemes without passing them
real(8) :: imex_alpha_coeff, dt_int
!for debugging purposes: NOT IMPLEMENTED, the idea was to use this variables, global but different for each process
!to keep track of the cell currently evolved
!integer :: ielab, jelab, kelab
!variables and parameters for initialization:
real(8) :: b1
real(8) :: beta,weightbin_inv,weightwound_inv,weightbin,weightwound
real(8) :: amassa
integer :: nmax !number of elements for the thickness vector (named thick)
real(8) :: gamma_col, beta_col
real(8) :: thminus, thplus
logical :: search_in_cond !flag used for initialization type 1 to proceed with variable initialization
real(8),parameter :: dz1=0.001 ! dz for thickness function integration (fm)
real(8),parameter :: dr=0.001 ! dr step for thickness function calculation (fm)
!real(8),parameter :: dz1=0.01 ! dz for thickness function integration (fm)
!real(8),parameter :: dr=0.01 ! dr step for thickness function calculation (fm)
real(8),parameter :: acc=1.e-07 ! accuracy of thickness function integration
!to keep track of where the parameter has been set: 0=default(common.f90), 1=parameter file, 2=command line
integer :: init_type_option, coordinates_option, viscosity_flag_option, mhd_flag_option, bulkvis_flag_option
integer :: smooth_temp_option, nx_option, ny_option, nz_option
integer :: x1_option, x2_option, y1_option, y2_option, z1_option, z2_option, tmin_option, tmax_option, temp_end_option
integer :: dtlog_option, dtout_option, output_precision_option, maxdt_option, restart_type_option, cfl_option
integer :: nucleus_option, rads_option, sigma_in_option, bimpact_option, ienentr_option, ah_option, ecenter_option
integer :: enezero_option, rhocenter_option, deta_option, sigeta_option, eta_over_s_option, tau_pi_coeff_option
integer :: obtained_option, eqstate_option, eos_tab_name_option, numerically_option, nconf_option, nbcoll_option
integer :: events_start_option, events_stop_option, kappa_option, sig_mc_option, kind_of_collision_option
integer :: out_freeze_flag_option, freeze_type_option, freeze_time_interval_option, input_edf_option, etam_option
integer :: ueta_coeff_option, input_B_field_option, density_option, vx_option, vy_option, vz_option, pressure_option
integer :: energy_density_option, temperature_option, entropy_density_option, bulk_option, pitt_option, pitx_option
integer :: pity_option, pitz_option, pixy_option, pixz_option, piyz_option, pixx_option, piyy_option, pizz_option
integer :: v0_option, bx_option, by_option, bz_option, ex_option, ey_option, ez_option, glm_option, freeze_value_option
integer :: derivatives_flag_option, flows_flag_option, nuclei_data_file_option, custom_output_directory_option
integer :: sigma_el_cond_option, B_amplify_factor_option, divclean_flag_option, glm_alpha_option, dump_initial_B_flag_option
integer :: recal_option, edens_for_B_dump_option, B_th_press_ratio_option, pw_option, maxspeed_option, algo_solver_option
integer :: ext_cons_file_option,boundary_cond_option, fixed_b_flag_option, eprot_option, min_participants_option
integer :: sigma_chiral_cond_option, magfield_type_option, avg_events_option
integer :: rc_option, print_rho_comov_flag, print_rho_comov_flag_option
integer :: nrk_option,ext_glissando_file_option
character(len=10) :: flagstring
character(len=120) :: inputstring
character(len=120) :: nuclei_data_file
contains
! *****************************************************************************
subroutine common_alloc
!-- Allocate main arrays
integer :: i
integer :: allocate_result
allocate(kv(nv), ku(nu), STAT=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate kv or ku into common_alloc, contained into common.90"
write(*,*) "(source file common.f90)"
call exit(1)
end if
kv=(/(i,i=1,nv)/)
ku=(/(i,i=1,nu)/)
allocate(v(ix1:ix2,iy1:iy2,iz1:iz2,1:nv),u(ix1:ix2,iy1:iy2,iz1:iz2,1:nu), stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate v or u multidim. array into common_alloc, contained into common.f90"
write(*,*) "(source file common.f90)"
call exit(1)
end if
v=0.
u=0.
allocate(deriv(ix1:ix2,iy1:iy2,iz1:iz2,1:nderivatives), stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate deriv multidim. array into common_alloc, contained into common.f90"
write(*,*) "(source file common.f90)"
call exit(1)
end if
deriv=0.
if(mhd) then
kvold_end=kbz
if(rmhd) then
kvold_end=kbz
end if
else
kvold_end=kpr
end if
allocate(vold(ix1:ix2,iy1:iy2,iz1:iz2,krh:kvold_end),uold(ix1:ix2,iy1:iy2,iz1:iz2,krh:kvold_end),&
&vnewstep(ix1:ix2,iy1:iy2,iz1:iz2,krh:kvold_end),unewstep(ix1:ix2,iy1:iy2,iz1:iz2,krh:kvold_end),stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate vold, uold, vnewstep or unewstep into common_alloc"
write(*,*) "(source file common.f90)"
call exit(1)
end if
vold=0.
uold=0.
vnewstep=0.
unewstep=0.
allocate(x(1:nx),ddx(1:nx),x0(0:nx), &
y(1:ny),ddy(1:ny),y0(0:ny), &
z(1:nz),ddz(1:nz),z0(0:nz), stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate x,dd,x0,y,ddy,y0,z,ddz or z0 into common_alloc"
write(*,*) "(source file common.f90)"
call exit(1)
end if
x=0.; ddx=0.; x0=0.; y=0.; ddy=0.; y0=0.; z=0.; ddz=0.; z0=0.
allocate(ibc(nv,2,3),stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Error, I can't allocate ibc into common_alloc, contained into common.f90"
write(*,*) "(source file common.f90)"
call exit(1)
end if
if (ipe .eq. 0) then
allocate(vall(1:nx,1:ny,1:nz,1:nv), vderivatives(1:nx,1:ny,1:nz,4), stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Proc.0 - Error, I can't allocate 'vall' or/and 'vderivatives' arrays into common_alloc"
write(*,*) "(source file common.f90)"
call exit(1)
end if
vall=0.
vderivatives=0.
end if
if ((ipe .eq. 0) .and. tp_anal) then !this can be improved if each processor computes its own grid section
!and then we combine results using mpi functions
allocate(xcm(1:nz),ycm(1:nz),eccentricity(1:nz),directed_flow(1:nz),elliptic_flow(1:nz), stat=allocate_result)
if(allocate_result /=0) then
write(*,*) "Proc.0 - Error, I can't allocate arrays for transverse plane analysis into common_alloc"
write(*,*) "(source file common.f90)"
call exit(1)
end if
end if
end subroutine common_alloc
! *****************************************************************************
subroutine common_grid(x1,x2,y1,y2,z1,z2)
!-- Define uniform grids
real(8),intent(in) :: x1,x2,y1,y2,z1,z2
integer :: i
real(8) :: dx,dy,dz
dx=(x2-x1)/nx
dy=(y2-y1)/ny
dz=(z2-z1)/nz
ddx(1:nx)=0.; if (nx>1) ddx(1:nx)=1./dx
ddy(1:ny)=0.; if (ny>1) ddy(1:ny)=1./dy
ddz(1:nz)=0.; if (nz>1) ddz(1:nz)=1./dz
x=(/(x1+(i-0.5)*dx,i=1,nx)/); x0=(/(x1+i*dx,i=0,nx)/)
y=(/(y1+(i-0.5)*dy,i=1,ny)/); y0=(/(y1+i*dy,i=0,ny)/)
z=(/(z1+(i-0.5)*dz,i=1,nz)/); z0=(/(z1+i*dz,i=0,nz)/)
!
d_ini(1)=dx
d_ini(2)=dy
d_ini(3)=dz
!
xlim(1,1)=x1
xlim(2,1)=x2
xlim(1,2)=y1
xlim(2,2)=y2
xlim(1,3)=z1
xlim(2,3)=z2
!
d_val(1)=d_ini(1)
d_val(2)=d_ini(2)
if (nz>1) then
d_val(3)=d_ini(3)
else
d_val(3)=1.0
endif
end subroutine common_grid
! *****************************************************************************
subroutine common_get_all_parameters()
implicit none
integer bulkvis_flag,viscosity_flag,navierstokes_flag,derivatives_flag,flows_flag,out_freeze_flag,mhd_flag
integer dump_initial_B_flag, divclean_flag, fixed_b_flag
integer filerror, i
integer :: read_status
integer :: num_arguments !number of arguments from command line
character(len=32) :: arg
integer :: ia !just a counter
integer :: skip=0 !a flag to control the behaviour of the parameters reading
logical :: param_file_cmdline_set=.false.
if(pe0) then
014 format(17x,f8.0,9x,f7.0,13x,f8.0,28x,f8.0,46x,i3)
075 format(a10,a120)
!default values for parameters:
init_type=0
init_type_option=0
coordinates=2
coordinates_option=0
viscosity_flag=0
viscosity_flag_option=0
bulkvis_flag=0
bulkvis_flag_option=0
mhd_flag=0
mhd_flag_option=0
divclean_flag=0
divclean_flag_option=0
glm_alpha=5.
glm_alpha_option=0
dump_initial_B_flag=1
dump_initial_B_flag_option=0
edens_for_B_dump=0.05
edens_for_B_dump_option=0
B_th_press_ratio=0.01
B_th_press_ratio_option=0
algo_solver=1
algo_solver_option=0
smooth_temp=0.08
smooth_temp_option=0
nx=120
nx_option=0
ny=120
ny_option=0
nz=120
nz_option=0
x1=-12.
x1_option=0
x2=12.
x2_option=0
y1=-12.
y1_option=0
y2=12.
y2_option=0
z1=-12.
z1_option=0
z2=12.
z2_option=0
tmin=1.
tmin_option=0
tmax=11.
tmax_option=0
temp_end=0.
temp_end_option=0
dtlog=0.01
dtlog_option=0
dtout=1.
dtout_option=0
output_precision=8
output_precision_option=0
maxdt=0.002
maxdt_option=0
restart_type=0
restart_type_option=0
cfl=0.4
cfl_option=0
recal="MPE5"
recal_option=0
nrk_string="RK2"
nrk_option=0
maxspeed=0.995
maxspeed_option=0
nucleus="Au"
nucleus_option=0
rads=200.
rads_option=0
sigma_in=42.
sigma_in_option=0
bimpact=5.
bimpact_option=0
ienentr=0
ienentr_option=0
ah=0.15
ah_option=0
ecenter=40.
ecenter_option=0
enezero=0.001
enezero_option=0
rhocenter=1.
rhocenter_option=0
deta=2.0
deta_option=0
sigeta=1.
sigeta_option=0
eta_over_s=0.08
eta_over_s_option=0
tau_pi_coeff=5.
tau_pi_coeff_option=0
obtained="zz"
obtained_option=0
eqstate=1
eqstate_option=0
eos_tab_name="qcdIEOS0.dat"
eos_tab_name_option=0
numerically=0
numerically_option=0
nconf=100
nconf_option=0
nbcoll=1
nbcoll_option=0
fixed_b_flag=0
fixed_b_flag_option=0
events_start=1
events_start_option=0
events_stop=5
events_stop_option=0
kappa=19.0
kappa_option=0
sig_mc=0.8
sig_mc_option=0
eprot=200.
eprot_option=0
min_participants=18
min_participants_option=0
kind_of_collision=1
kind_of_collision_option=0
avg_events=0
avg_events_option=0
out_freeze_flag=0
out_freeze_flag_option=0
print_rho_comov_flag=0
print_rho_comov_flag_option=0
freeze_type=1
freeze_type_option=0
freeze_value=0.5
freeze_value_option=0
freeze_time_interval=0.1
freeze_time_interval_option=0
input_edf="ed.dat"
input_edf_option=0
ext_cons_file="cons.dat"
ext_cons_file_option=0
ext_glissando_file="glissando.dat"
ext_glissando_file_option=0
etam=-1
etam_option=0
ueta_coeff=0.
ueta_coeff_option=0
input_B_field="initialB.dat"
input_B_field_option=0
boundary_cond=2
boundary_cond_option=0
out_sel%density=1
density_option=0
out_sel%vx=1
vx_option=0
out_sel%vy=1
vy_option=0
out_sel%vz=1
vz_option=0
out_sel%pressure=1
pressure_option=0
out_sel%energy_density=1
energy_density_option=0
out_sel%temperature=0
temperature_option=0
out_sel%entropy_density=0
entropy_density_option=0
out_sel%bulk=0
bulk_option=0
out_sel%pitt=0
pitt_option=0
out_sel%pitx=0
pitx_option=0
out_sel%pity=0
pity_option=0
out_sel%pitz=0
pitz_option=0
out_sel%pixy=0
pixy_option=0
out_sel%pixz=0
pixz_option=0
out_sel%piyz=0
piyz_option=0
out_sel%pixx=0
pixx_option=0
out_sel%piyy=0
piyy_option=0
out_sel%pizz=0
pizz_option=0
out_sel%v0=0
v0_option=0
out_sel%bx=1
bx_option=0
out_sel%by=1
by_option=0
out_sel%bz=1
bz_option=0
out_sel%ex=1
ex_option=0
out_sel%ey=1
ey_option=0
out_sel%ez=1
ez_option=0
out_sel%glm=0
glm_option=0
out_sel%rc=0
rc_option=0
derivatives_flag=0
derivatives_flag_option=0
flows_flag=0
flows_flag_option=0
nuclei_data_file="nuclear_data.dat"
nuclei_data_file_option=0
custom_output_directory=""
custom_output_directory_option=0
sigma_el_cond=0.0058
sigma_el_cond_option=0
sigma_chiral_cond=0.0015
sigma_chiral_cond_option=0
magfield_type=1
magfield_type_option=0
B_amplify_factor=1.
B_amplify_factor_option=0
pw=0.5
pw_option=0
!now reading command line arguments
num_arguments=command_argument_count()
!we check if we should use a non standard parameter file
if (num_arguments .gt. 0) then
do ia = 1, num_arguments
if(skip .eq. 1) then
skip=0
cycle
end if
call get_command_argument(ia, arg)
if (arg .eq. "-PARAM_FILE") then
call get_command_argument(ia+1, arg)
read(arg,"(a120)") param_file_cmdline
param_file_cmdline_set=.true.
exit
end if
end do
end if
if(param_file_cmdline_set) then
allocate(character(len=len_trim(adjustl(param_file_cmdline))) :: param_file)
param_file=trim(adjustl(param_file_cmdline))
else
allocate(character(len=9) :: param_file)
param_file='param.dat'
end if
!first, we check that parameter file exists
open(unit=29,status='OLD',file=param_file, iostat=filerror, form='formatted')
if (filerror .ne. 0) then
write(*,*) "File "//param_file//" cannot be opened, so I'm forced to quit!"
close(29)
call exit(1)
end if
do
read(29,075,IOSTAT=filerror) flagstring,inputstring
if(filerror .lt. 0) then
exit
else
if((flagstring(1:1) .eq. "!") .or. (flagstring .eq. "") .or. (flagstring(1:1) .eq. "#") .or.&
& (flagstring(1:2) .eq. "//")) then
cycle
else if(flagstring .eq. "INIT_TYPE=") then
read(inputstring,"(i2)") init_type
init_type_option=1
else if(flagstring .eq. "COORD....=") then
read(inputstring,"(i1)") coordinates
coordinates_option=1
else if(flagstring .eq. "VISCOUS..=") then
read(inputstring,"(i1)") viscosity_flag
viscosity_flag_option=1
else if(flagstring .eq. "BULK.....=") then
read(inputstring,"(i1)") bulkvis_flag
bulkvis_flag_option=1
else if(flagstring .eq. "MHD......=") then
read(inputstring,"(i1)") mhd_flag
mhd_flag_option=1
else if(flagstring .eq. "DIVCLEAN.=") then
read(inputstring,"(i1)") divclean_flag
divclean_flag_option=1
else if(flagstring .eq. "GLM_PARAM=") then
read(inputstring,"(f14.0)") glm_alpha
glm_alpha_option=1
else if(flagstring .eq. "DUMP_IN_B=") then
read(inputstring,"(i1)") dump_initial_B_flag
dump_initial_B_flag_option=1
else if(flagstring .eq. "B_DUM_EN.=") then
read(inputstring,"(f14.0)") edens_for_B_dump
edens_for_B_dump_option=1
else if(flagstring .eq. "Bp_ov_Tp.=") then
read(inputstring,"(f14.0)") B_th_press_ratio
B_th_press_ratio_option=1
else if(flagstring .eq. "CUT_TEMP.=") then
read(inputstring,"(f14.0)") smooth_temp
smooth_temp_option=1
else if(flagstring .eq. "NX.......=") then
read(inputstring,"(i6)") nx
nx_option=1
else if(flagstring .eq. "NY.......=") then
read(inputstring,"(i6)") ny
ny_option=1
else if(flagstring .eq. "NZ.......=") then
read(inputstring,"(i6)") nz
nz_option=1
else if(flagstring .eq. "XMIN.....=") then
read(inputstring,"(f14.0)") x1
x1_option=1
else if(flagstring .eq. "XMAX.....=") then
read(inputstring,"(f14.0)") x2
x2_option=1
else if(flagstring .eq. "YMIN.....=") then
read(inputstring,"(f14.0)") y1
y1_option=1
else if(flagstring .eq. "YMAX.....=") then
read(inputstring,"(f14.0)") y2
y2_option=1
else if(flagstring .eq. "ZMIN.....=") then
read(inputstring,"(f14.0)") z1
z1_option=1
else if(flagstring .eq. "ZMAX.....=") then
read(inputstring,"(f14.0)") z2
z2_option=1
else if(flagstring .eq. "TSTART...=") then
read(inputstring,"(f14.0)") tmin
tmin_option=1
else if(flagstring .eq. "TSTOP....=") then
read(inputstring,"(f14.0)") tmax
tmax_option=1
else if(flagstring .eq. "TEMP_END.=") then
read(inputstring,"(f14.0)") temp_end
temp_end_option=1
else if(flagstring .eq. "DTLOG....=") then
read(inputstring,"(f14.0)") dtlog
dtlog_option=1
else if(flagstring .eq. "DTOUT....=") then
read(inputstring,"(f14.0)") dtout
dtout_option=1
else if(flagstring .eq. "OUTP_PREC=") then
read(inputstring,"(i1)") output_precision
output_precision_option=1
else if(flagstring .eq. "MAXDT....=") then
read(inputstring,"(f14.0)") maxdt
maxdt_option=1
else if(flagstring .eq. "RESTART..=") then
read(inputstring,"(i1)") restart_type
restart_type_option=1
else if(flagstring .eq. "CFL......=") then
read(inputstring,"(f14.0)") cfl
cfl_option=1
else if(flagstring .eq. "REC_ALGO.=") then
read(inputstring,"(a5)") recal
recal_option=1
else if(flagstring .eq. "INT_ALGO.=") then
read(inputstring,"(a3)") nrk_string
nrk_option=1
else if(flagstring .eq. "MAXSPEED.=") then
read(inputstring,"(f14.0)") maxspeed
maxspeed_option=1
else if(flagstring .eq. "NUCLEUS..=") then
read(inputstring,"(a5)") nucleus
nucleus_option=1
else if(flagstring .eq. "RADS.....=") then
read(inputstring,"(f14.0)") rads
rads_option=1
else if(flagstring .eq. "SIGMA_IN.=") then
read(inputstring,"(f14.0)") sigma_in
sigma_in_option=1
else if(flagstring .eq. "B........=") then
read(inputstring,"(f14.0)") bimpact
bimpact_option=1
else if(flagstring .eq. "IENENTR..=") then
read(inputstring,"(i1)") ienentr
ienentr_option=1
else if(flagstring .eq. "AH.......=") then
read(inputstring,"(f14.0)") ah
ah_option=1
else if(flagstring .eq. "ECENTER..=") then
read(inputstring,"(f14.0)") ecenter
ecenter_option=1
else if(flagstring .eq. "ENEZERO..=") then
read(inputstring,"(f14.0)") enezero