From e9899b03152f805437646ecb50ef04958cddbead Mon Sep 17 00:00:00 2001 From: ignis Date: Fri, 25 Apr 2014 15:07:41 +0900 Subject: [PATCH] Input modified for domain size and fdm --- m_parameters.f90 | 243 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 181 insertions(+), 62 deletions(-) diff --git a/m_parameters.f90 b/m_parameters.f90 index ea88ace..0aadf64 100644 --- a/m_parameters.f90 +++ b/m_parameters.f90 @@ -19,13 +19,14 @@ module m_parameters ! --- input filep arameters integer :: nx,ny,nz, nz_all ! Dimensions of the problem integer :: nxyz, nxyz_all + integer :: lx,ly,lz,spx,spy,spz !mx integer :: n_scalars ! # of scalars real*8 :: time ! time of simulation real*8 :: dx, dy, dz integer :: kmax - integer :: ITIME, ITMIN, ITMAX, IPRINT1, IPRINT2, IWRITE4 + integer :: ITIME, ITMIN, ITMAX, IPRINT1, IPRINT2, IWRITE4, fdm_sw real*8 :: TMAX, TRESCALE, TSCALAR, RE, nu, dt @@ -34,6 +35,8 @@ module m_parameters integer :: flow_type + real*8 :: t_length,delta_k + real*8 :: t_u_prime,c_f logical :: variable_dt integer :: isp_type, ir_exp, force_type @@ -100,6 +103,18 @@ module m_parameters logical :: benchmarking=.false. integer (kind=8) :: i81, i82, bm(12) +!! For model spectrum (4)-------------------------------------------201403 + real*8, allocatable :: model_e_spec(:) + real*8 :: model_A,k0 +!!---------------------------------------------------------------------- + +! FDM variables + integer :: svf,swadtv,restartnum + integer :: inx1,inx2,yrsw + real*8 :: ac,bc,c_cut,c_ref,min_wr,prof_wr,hx,hy,diff,pre + real*8 :: dt_fullsave,dt_fdmsave,t_fullsave,t_fdmsave + real*8 :: fdmcfl,startad,dummyu_,schmidt + !================================================================================ contains !================================================================================ @@ -107,6 +122,7 @@ contains subroutine m_parameters_init implicit none + integer :: mx call get_run_name @@ -120,18 +136,19 @@ contains call read_input_file ! maximum resolved wavenumber + mx = 2 * nx / lx ! Nx/2PI if (dealias.eq.0) then - kmax = nx/3 + kmax = mx/3 elseif (dealias.eq.1) then - kmax = floor(real(nx,8) / three * sqrt(two)) + kmax = floor(real(mx,8) / three * sqrt(two)) else write(out,*) "*** M_PARAMETERS_INIT: wrong dealias flag: ",dealias call flush(out) call my_exit(-1) end if + write(out,'(a30,3x,i5)')"SUB_m_parameters_init kmax =",kmax - write(out,*) "kmax = ",kmax call flush(out) end subroutine m_parameters_init @@ -177,6 +194,7 @@ contains integer :: n integer*4 :: passed, passed_all character*80 :: str_tmp + real*8 :: t_tke ! making sure the input file is there inquire(file=run_name//'.in', exist=there) @@ -200,7 +218,6 @@ contains read(in,*) read(in,*,ERR=9000) nx,ny,nz_all - read(in,*) nz = nz_all/numprocs @@ -211,71 +228,73 @@ contains passed = 0 end if write(out,'(70(''=''))') - write(out,"('NX,NY,NZ_ALL', 3i4)") nx,ny,nz_all - write(out,"('NX,NY,NZ ', 3i4)") nx,ny,nz + write(out,'(a30,3x,3i5)') 'NX,NY,NZ_ALL',nx,ny,nz_all + write(out,'(a30,3x,3i5)') 'NX,NY,NZ',nx,ny,nz call flush(out) - dx = 2.0d0 * PI / dble(nx) - dy = 2.0d0 * PI / dble(ny) - dz = 2.0d0 * PI / dble(nz_all) + read(in,*,ERR=9000) lx,ly,lz + write(out,'(a30,3x,3i5)') 'LX,LY,LZ[PI]',lx,ly,lz + + dx = PI * dble(lx) / dble(nx) + dy = PI * dble(ly) / dble(ny) + dz = PI * dble(lz) / dble(nz_all) + + call flush(out) ! ------------------------------------------------------------- + read(in,*) read(in,*,ERR=9000,END=9000) ITMIN - write(out,*) 'ITMIN = ',ITMIN + write(out,'(a30,3x,i5)') 'ITMIN =',ITMIN last_dump = ITMIN - read(in,*,ERR=9000,END=9000) ITMAX - write(out,*) 'ITMAX = ',ITMAX read(in,*,ERR=9000,END=9000) IPRINT1 - write(out,*) 'IPRINT1= ',IPRINT1 + write(out,'(a30,3x,i5)') 'IPRINT1 =',IPRINT1 read(in,*,ERR=9000,END=9000) IPRINT2 - write(out,*) 'IPRINT2= ',IPRINT2 + write(out,'(a30,3x,i10)') 'IPRINT2 =',IPRINT2 read(in,*,ERR=9000,END=9000) IWRITE4 - write(out,*) 'IWRITE4= ',IWRITE4 + write(out,'(a30,3x,i5)') 'IWRITE4 =',IWRITE4 + + read(in,*,ERR=9000,END=9000) spx,spy,spz + write(out,'(a30,3x,3i5)') 'spx,spy,spz',spx,spy,spz + + read(in,*,ERR=9000,END=9000) fdm_sw + write(out,'(a30,3x,i5)') 'WRITE_FDM= ',fdm_sw + read(in,*) write(out,"(70('-'))") call flush(out) - ! ------------------------------------------------------------ - read(in,*,ERR=9000,END=9000) TMAX - write(out,*) 'TMAX =',TMAX + write(out,'(a30,3x,e15.5)') 'TMAX =',TMAX read(in,*,ERR=8000,END=9000) TRESCALE, NRESCALE -100 write(out,*) 'TRESCALE, NRESCALE =',TRESCALE, NRESCALE +100 write(out,'(a30,3x,f10.4,i5)') 'TRESCALE, NRESCALE',TRESCALE,NRESCALE read(in,*,ERR=9000,END=9000) TSCALAR - write(out,*) 'TSCALAR =',TSCALAR + write(out,'(a30,3x,e15.5)') 'TSCALAR =',TSCALAR read(in,*) write(out,"(70('-'))") call flush(out) -! if(TSCALAR.le.TRESCALE) then -! TSCALAR = TRESCALE -! write(out,*) '*** RESET: TSCALAR = ',TSCALAR -! end if - - ! ------------------------------------------------------------ - read(in,*,ERR=9000,END=9000) flow_type - write(out,*) 'flow_type ', flow_type + write(out,'(a30,3x,i5)') 'flow_type =',flow_type read(in,*) write(out,"(70('-'))") call flush(out) ! ------------------------------------------------------------ - read(in,*,ERR=9000,END=9000) RE - write(out,*) 'RE = ',RE + read(in,*,ERR=9000,END=9000) nu + write(out,'(a30,3x,f10.5)') 'nu(kinematic vis) =',nu - nu = 1.0d0/RE + RE = 1.0d0/nu read(in,*,ERR=9000,END=9000) DT - write(out,*) 'DT = ',DT + write(out,'(a30,3x,f10.5)') 'DT =',DT if (dt.lt.0.0d0) then variable_dt = .false. dt = -dt @@ -285,18 +304,43 @@ contains read(in,*) write(out,"(70('-'))") + + ITMAX=int(TMAX/dt) + write(out,'(a30,3x,i5)') 'ITMAX =',ITMAX + call flush(out) + !ksj************************************************************* + + read(in,*,ERR=9000,END=9000) t_length + write(out,'(a30,3x,f10.5)') 'target integral length =',t_length + + read(in,*,ERR=9000,END=9000) t_u_prime + write(out,'(a30,3x,f10.5)') 'target u` =',t_u_prime + + t_tke = three/two*(t_u_prime**2.0) + + write(out,'(a30,3x,f10.5)') 'target tke =',t_tke + + read(in,*,ERR=9000,END=9000) delta_k + write(out,'(a30,3x,f10.5)') 'del_k =',delta_k + + read(in,*) + write(out,"(70('-'))") + call flush(out) + + !**************************************************************** + ! ------------------------------------------------------------ read(in,*,ERR=9000,END=9000) isp_type - write(out,*) 'isp_type= ', isp_type + write(out,'(a30,3x,i5)') 'isp_type =',isp_type read(in,*,ERR=9000,END=9000) ir_exp - write(out,*) 'ir_exp = ', ir_exp + write(out,'(a30,3x,i5)') 'ir_exp =',ir_exp read(in,*,ERR=9000,END=9000) peak_wavenum - write(out,*) 'peak_wavenum = ',peak_wavenum + write(out,'(a30,3x,f10.5)') 'peak_wavenum =',peak_wavenum read(in,*) write(out,"(70('-'))") call flush(out) @@ -304,31 +348,22 @@ contains ! ------------------------------------------------------------ read(in,*,ERR=9000,END=9000) force_type - write(out,*) 'force_type', force_type + write(out,'(a30,3x,i5)') 'force_type =',force_type read(in,*,ERR=9000,END=9000) kfmax - write(out,*) 'kfmax = ',kfmax + write(out,'(a30,3x,i5)') 'kfmax =',kfmax - read(in,*,ERR=9000,END=9000) FAMP - write(out,*) 'FAMP = ',FAMP + read(in,*,ERR=9000,END=9000) c_f + write(out,'(a30,3x,f10.5)') 'c_f =',c_f + + famp=1.d0/c_f read(in,*) write(out,"(70('-'))") call flush(out) -!!$ c------------------------------------------------------------ -!!$ -!!$ read(in,*,ERR=9000,END=9000) IRESET -!!$ write(out,*) 'IRESET= ',IRESET -!!$ -!!$ read(in,*,ERR=9000,END=9000) INEWSC -!!$ write(out,*) 'INEWSC= ',INEWSC -!!$ read(in,*) -!!$ -!!$ c------------------------------------------------------------ - read(in,*,ERR=9000,END=9000) dealias - write(out,*) 'dealias = ',dealias + write(out,'(a30,3x,i5)') 'dealias =',dealias read(in,*) write(out,"(70('-'))") call flush(out) @@ -336,16 +371,16 @@ contains ! ------------------------------------------------------------- read(in,*,ERR=9000,END=9000) det_rand - write(out,*) 'det_rand =',det_rand + write(out,'(a30,3x,i5)') 'det_rand =',det_rand read(in,*,ERR=9000,END=9000) RN1 - write(out,*) 'RN1 =',RN1 + write(out,'(a30,3x,e20.10)') 'RN1 =',RN1 read(in,*,ERR=9000,END=9000) RN2 - write(out,*) 'RN2 =',RN2 + write(out,'(a30,3x,e20.10)') 'RN2 =',RN2 read(in,*,ERR=9000,END=9000) RN3 - write(out,*) 'RN3 =',RN3 + write(out,'(a30,3x,e20.10)') 'RN3 =',RN3 read(in,*) write(out,"(70('-'))") call flush(out) @@ -360,11 +395,11 @@ contains end if ! DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG - write(out,*) 'nptot =',nptot + write(out,'(a30,3x,i5)') 'nptot =',nptot read(in,*,ERR=9000,END=9000) particles_tracking_scheme - write(out,*) 'particles_tracking_scheme', particles_tracking_scheme + write(out,'(a30,3x,i5)') 'particles tracking scheme =',particles_tracking_scheme select case (particles_tracking_scheme) case (0) @@ -389,10 +424,10 @@ contains read(in,*,ERR=9000,END=9000) starttime_particles - write(out,*) 'starttime_particles: ',starttime_particles + write(out,'(a30,3x,e20.10)') 'starttime_particles: ',starttime_particles read(in,*,ERR=9000,END=9000) particles_filter_size - write(out,*) 'particles_filter_size:',particles_filter_size + write(out,'(a30,3x,e20.10)') 'particles_filter_size:',particles_filter_size if (particles_filter_size .gt. zip .and. particles_filter_size .lt. three*dx) then write(out,*) "particles_filter_size is too small (less than 3*dx)" @@ -407,7 +442,7 @@ contains ! ------------------------------------------------------------- read(in,*,ERR=9000,END=9000) les_model - write(out,*) 'les_model =',les_model + write(out,'(a30,3x,i5)') 'les_model =',les_model read(in,*) write(out,"(70('-'))") call flush(out) @@ -422,7 +457,7 @@ contains ! ------------------------------------------------------------- read(in,*,ERR=9000,END=9000) n_scalars - write(out,*) '# of scalars:', n_scalars + write(out,'(a30,3x,i5)') '# of scalars:', n_scalars read(in,*) write(out,"(70('-'))") call flush(out) @@ -455,6 +490,90 @@ contains ! ------------------------------------------------------------- +! FDM input + + read(in,*) + read(in,*) + read(in,*) + read(in,*) + read(in,*) + + + read(in,*,ERR=9000,END=9000) svf + write(out,'(a30,3x,i5)') 'svf =',svf + + read(in,*,ERR=9000,END=9000) swadtv + write(out,'(a30,3x,i5)') 'swadtv =',swadtv + + read(in,*,ERR=9000,END=9000) restartnum + write(out,'(a30,3x,i5)') 'restartnum =',restartnum + + read(in,*) + write(out,"(70('-'))") + call flush(out) + + read(in,*,ERR=9000,END=9000) dt_fdmsave + write(out,'(a30,3x,e20.10)') 'dt_fdmsave =',dt_fdmsave + + read(in,*,ERR=9000,END=9000) dt_fullsave + write(out,'(a30,3x,e20.10)') 'dt_fullsave =',dt_fullsave + + read(in,*,ERR=9000,END=9000) schmidt + write(out,'(a30,3x,e20.10)') 'Sc# =',schmidt + + read(in,*,ERR=9000,END=9000) pre + write(out,'(a30,3x,e20.10)') 'pre =',pre + + read(in,*,ERR=9000,END=9000) ac + write(out,'(a30,3x,e20.10)') 'ac =',ac + + read(in,*,ERR=9000,END=9000) bc + write(out,'(a30,3x,e20.10)') 'bc =',bc + + read(in,*,ERR=9000,END=9000) c_cut + write(out,'(a30,3x,e20.10)') 'c_cut =',c_cut + + read(in,*,ERR=9000,END=9000) c_ref + write(out,'(a30,3x,e20.10)') 'c_ref =',c_ref + + read(in,*,ERR=9000,END=9000) min_wr + write(out,'(a30,3x,e20.10)') 'min_wr =',min_wr + + read(in,*,ERR=9000,END=9000) prof_wr + write(out,'(a30,3x,e20.10)') 'prof_wr =',prof_wr + + read(in,*,ERR=9000,END=9000) dummyu_ + write(out,'(a30,3x,e20.10)') 'dummyu_ =',dummyu_ + + read(in,*,ERR=9000,END=9000) startad + write(out,'(a30,3x,e20.10)') 'startad =',startad + + read(in,*,ERR=9000,END=9000) inx1 + write(out,'(a30,3x,i5)') 'inx1 =',inx1 + + read(in,*,ERR=9000,END=9000) inx2 + write(out,'(a30,3x,i5)') 'inx2 =',inx2 + + read(in,*,ERR=9000,END=9000) yrsw + if (inx1.gt.0) then + if (yrsw.eq.0) then + yrsw=1 + elseif (yrsw.eq.1) then + yrsw=inx1 + endif + endif + write(out,'(a30,3x,i5)') 'yrsw =',yrsw + + read(in,*,ERR=9000,END=9000) fdmcfl + write(out,'(a30,3x,e20.10)') 'FDM_CFL =',fdmcfl + + ! initialize ---------------------- + t_fdmsave=dt_fdmsave + t_fullsave=dt_fullsave + diff=nu/schmidt + hx=dx + hy=hx + ! closing the input file close(in) write(out,'(70(''=''))')