25 use,
intrinsic :: iso_c_binding
32 real(mytype),
parameter ::
pi=3.1415926535897932_mytype
45 real(mytype),
protected,
save ::
lx 46 real(mytype),
protected,
save ::
ly 47 real(mytype),
protected,
save ::
lz 49 integer,
protected,
save ::
nx 50 integer,
protected,
save ::
ny 51 integer,
protected,
save ::
nz 67 integer,
protected,
save ::
issk 73 integer,
protected,
save ::
cds 77 integer,
protected,
save ::
dts 80 real(mytype),
protected,
save ::
dt 81 integer,
protected,
save ::
imax 85 real(mytype),
protected,
save ::
nu 86 real(mytype),
protected,
save ::
alpha 87 real(mytype),
protected,
save ::
got 88 real(mytype),
protected,
save ::
fc 89 real(mytype),
protected,
save ::
ug 90 real(mytype),
protected,
save ::
vg 94 real(mytype),
protected,
save ::
t_ref 97 real(mytype),
protected,
save ::
tbot 98 real(mytype),
protected,
save ::
ttop 114 real(mytype),
protected,
save ::
cdamp 117 real(mytype),
protected,
save ::
u_mrf 132 integer,
dimension(50),
protected,
save ::
xy2d_id 136 integer,
dimension(50),
protected,
save ::
xz2d_id 140 integer,
dimension(50),
protected,
save ::
yz2d_id 148 namelist /modeling/ &
151 namelist /constants/ &
152 nu,
alpha,
got,
fc,
ug,
vg,
dt,
imax,
u_mrf,
isscalar,
t_ref, &
169 complex(mytype),
parameter ::
iii=cmplx(0.d0,1.d0,kind=mytype)
172 real(mytype),
protected,
save ::
dx,
dy 206 complex(mytype),
protected,
save ::
wx1 207 complex(mytype),
protected,
save ::
wy1 210 real(mytype),
dimension(3),
parameter ::
rkc1=(/8.d0/15.d0,5.d0/12.d0,3.d0/4.d0/)
211 real(mytype),
dimension(3),
parameter ::
rkc2=(/0.d0,-17.d0/60.d0,-5.d0/12.d0/)
212 real(mytype),
dimension(3),
parameter ::
rkc3=(/8.d0/15.d0,2.d0/15.d0,1.d0/3.d0/)
218 real(mytype),
dimension(:),
allocatable,
protected,
save :: &
227 integer,
dimension(:,:),
allocatable,
protected,
save ::
pij 247 open(10,file=
'parameters.input')
249 read(10,nml=modeling)
250 read(10,nml=constants)
257 print *,
'nx and ny are not divisible by p_row! Quit!' 262 print *,
'ny and nz are not divisible by p_col! Quit!' 267 if (mod(
nx,2) .ne. 0 .or. mod(
ny,2) .ne. 0)
then 268 print *,
'Please use even numbers for nx and ny! Quit!' 330 call mpi_init(
ierr )
331 call mpi_comm_rank( mpi_comm_world,
myid,
ierr )
332 call mpi_comm_size( mpi_comm_world,
nprc,
ierr )
337 if (
myid .eq. 0)
then 339 print *,
'Error when running mpirun -np nprc hercules.exe' 341 print *,
'Please either run mpirun -np ',
p_row*
p_col,
' hercules.exe' 342 print *,
'or change p_row and p_col in parameters.info such that' 343 print *,
'nprc=p_row*p_col' 362 call mpi_finalize(
ierr )
437 real(mytype) :: zmin,zmax,zmean,stretch_sysm,coeff_a
438 real(mytype),
dimension(nka3) :: zz
448 zmean=0.5d0*(zmin+zmax)
450 coeff_a=(2.d0+
nz)*stretch_sysm
457 coeff_a=(1.d0+
nz)*stretch_sysm
465 tanh(2.d0*
zstretch*(k-coeff_a)/(1.d0-coeff_a))
495 if (
myid .eq. 0)
then 497 write(*,*)
'Writing Geo Info to Files.' 498 open(11,file=
'results/geo.info')
500 write(11,
'(4e14.6)') (zz(k+1)+zz(k))/2.d0,
dz(k),
l_t(k),
l_b(k)
519 real(mytype),
dimension(:,:,:),
intent(in) :: u
520 real(mytype) :: ubar_local
529 ubar_local=ubar_local+u(i,j,k)*
dz(k)
535 ubar_local=ubar_local/
lz/zsize(1)/zsize(2)
540 call mpi_allreduce(ubar_local,
ubar,1,real_type,mpi_sum,mpi_comm_world,
ierr)
554 use,
intrinsic :: iso_c_binding
559 include
'include/fftw3.f03' 561 complex(mytype),
dimension(nx) :: c_tmp1
562 complex(mytype),
dimension(ny) :: c_tmp2
565 fft_plan1 =fftw_plan_dft_1d(
nx,c_tmp1,c_tmp1,fftw_forward,fftw_measure)
567 ifft_plan1=fftw_plan_dft_1d(
nx,c_tmp1,c_tmp1,fftw_backward,fftw_measure)
570 fft_plan2 =fftw_plan_dft_1d(
ny,c_tmp2,c_tmp2,fftw_forward,fftw_measure)
572 ifft_plan2=fftw_plan_dft_1d(
ny,c_tmp2,c_tmp2,fftw_backward,fftw_measure)
584 integer,
intent(in) :: stps
604 elseif (
dp_opt .eq. 2)
then 622 real(mytype),
intent(in) :: a_in,b_in,c_in
real(mytype), save, protected ri_str
integer, save, protected is_ri_var
integer, save, protected imeanfl
integer, save, protected myid
real(mytype), save, protected rk_b
real(mytype), dimension(:), allocatable, save, protected l_b
integer, save, protected isxy2d
integer, save, protected ochannel
integer, save, protected nprc
real(mytype), save, protected ubar
integer, save, protected isnoise
integer, save, protected ny
real(mytype), save, protected dpx_coef
integer, save, protected ibackup
integer, save, protected isyz2d
integer, dimension(50), save, protected yz2d_id
real(mytype), save, protected fc
integer, save, protected issk
real(mytype), parameter pi
real(mytype), save, protected dt
integer, save, protected dts
complex(mytype), save, protected wy1
subroutine initiate_indices
integer, dimension(:,:), allocatable, save, protected pij
real(mytype), save, protected rk_a
integer, save, protected nja2
integer, save, protected jend3
real(mytype), save, protected nu
real(mytype), save, protected ttop
integer, save, protected nz
integer, save, protected intv_2d
real(mytype), save, protected ly
real(mytype), save, protected ug
integer, save, protected p_row
subroutine calculate_ubar(u)
integer, save, protected iinstfl
integer, save, protected nia3
type(c_ptr), save, protected fft_plan1
real(mytype), dimension(:), allocatable, save, protected dz
integer, save, protected myid_rowindx
integer, dimension(50), save, protected xy2d_id
real(mytype), save, protected dy2
integer, save, protected isscalar
real(mytype), save, protected cdamp
real(mytype), save, protected alpha
integer, save, protected istr3
real(mytype), save, protected vg
real(mytype), save, protected t_ref
integer, save, protected isxz2d
real(mytype), save, protected dx
integer, save, protected jstr3
integer, save, protected istmsr
real(mytype), dimension(:), allocatable, save, protected dz_b
type(c_ptr), save, protected ifft_plan1
integer, save, protected i_offset
subroutine update_ri(stps)
real(mytype), save, protected dx2
integer, save, protected nja3
type(c_ptr), save, protected ifft_plan2
integer, save, protected j_offset
real(mytype), save, protected u_mrf
complex(mytype), parameter iii
integer, save, protected p_col
integer, save, protected nka2
integer, save, protected cds
integer, save, protected isdamp
integer, save, protected restart
real(mytype), save, protected lz
real(mytype), dimension(3), parameter rkc1
real(mytype), save time_sim
subroutine get_mesh_param
integer, save, protected imax
real(mytype), save, protected lx
real(mytype), save, protected dpx_drive
integer, save, protected nzdamp
real(mytype), dimension(:), allocatable, save, protected dz_t
real(mytype), save, protected noise_mag
real(mytype), save, protected zstretch
real(mytype), save, protected dy
integer, save, protected nx
real(mytype), save, protected ri_end
subroutine update_dpx_drive
integer, save, protected nka1
integer, save, protected nia2
integer, save, protected nia1
subroutine initiate_parameters
real(mytype), save, protected got
real(mytype), save div_hist_max
real(mytype), dimension(3), parameter rkc2
type(c_ptr), save, protected fft_plan2
complex(mytype), save, protected wx1
real(mytype), save, protected rk_c
integer, save, protected iend3
real(mytype), dimension(:), allocatable, save, protected l_t
real(mytype), dimension(3), parameter rkc3
real(mytype), save, protected tbot
integer, save, protected nja1
subroutine assign_rk_coeff(a_in, b_in, c_in)
integer, dimension(50), save, protected xz2d_id
integer, save, protected dp_opt
real(mytype), save cfl_max
integer, save, protected kstr3
integer, save, protected myid_colindx
integer, save, protected nka3
integer, save, protected kend3