From 855615c4f0aff56d0a5493fde7b68bb26d09b7da Mon Sep 17 00:00:00 2001 From: ignis Date: Fri, 2 May 2014 11:36:25 +0900 Subject: [PATCH] fdm call is prior to velocity time marching fdm_restart and flame location calculation moved to prepare_fdm prepare_fdm is called after begin_new|restart fdm_restart_write called after restart_parallel_write --- m_fdm_calc.f90 | 350 +++++++++++++++---------------------------------- main.f90 | 39 ++++-- 2 files changed, 136 insertions(+), 253 deletions(-) diff --git a/m_fdm_calc.f90 b/m_fdm_calc.f90 index 1f44145..5c0e175 100644 --- a/m_fdm_calc.f90 +++ b/m_fdm_calc.f90 @@ -11,13 +11,13 @@ module m_fdm_calc real*8, dimension(:,:,:,:), allocatable :: y1,y2,yf real*8 :: in_yr,out_yr,refwr,minf - integer :: fullsavenum,svfx,svfy !,rest_sw + integer :: fullsavenum,svfx,svfy integer :: fdmcyc,fdmsavecount real*8 :: fdmtime,fdmdt real*8 :: sumc,oldsumc,time_int,sum_wrate - real*8 :: max_u,max_v,max_w,min_u,min_v,min_w real*8 :: visdt, convdt integer :: fdmstep + real*8 :: coe,tt1,tt2,tt3,tt4 !=========================================================================== !=========================================================================== @@ -25,12 +25,31 @@ module m_fdm_calc contains + subroutine fdm_restart_write + write(*,*) '=======================================================' + write(*,*) 'Full results are being written',fullsavenum + OPEN (fullsavenum,form='unformatted',status='unknown') + write (fullsavenum) fdmtime,nx,ny,nz_all,oldsumc,time_int + write (fullsavenum) fdmcyc,DT,dummyu_ + write (fullsavenum) dt_fdmsave,dt_fullsave + write (fullsavenum) t_fdmsave,t_fullsave + write (fullsavenum) in_yr,out_yr + write (fullsavenum) u_,v_,w_,y1 + CLOSE (fullsavenum) + write(*,*) '=======================================================' + fullsavenum=fullsavenum+1 + end subroutine fdm_restart_write + subroutine prepare_fdm implicit none integer :: i,j,ii,k - real*8 :: avgc(nx),avgr(nx) + real*8 :: fl_location,wrate,yr,c + + if (fdm_sw .eq. 0) then + return + endif allocate(u_(nx,ny,nz_all)) allocate(v_(nx,ny,nz_all)) @@ -40,10 +59,6 @@ module m_fdm_calc v_=0.0 w_=0.0 - if (fdm_sw .eq. 0) then - return - endif - ! DQ initializing fdmsavecount=1 !FDM save count sum_wrate=0. @@ -55,7 +70,6 @@ module m_fdm_calc fdmcyc=0 fdmtime=0. fullsavenum=1000 !full save file -! rest_sw=0 allocate(y1(2,nx,ny,nz_all)) allocate(y2(2,nx,ny,nz_all)) @@ -63,18 +77,7 @@ module m_fdm_calc CALL ludcmp(nx,ny,nz_all,1,0,0) -!FDM normal start================================== - -! OPEN(44,FILE='max_min_u.dat') -! write(44,*)'VARIABLES = "Time","max_u","max_v","max_w","min_u","min_v","min_w"' -! OPEN(23,FILE='St_data.dat') -! write(23,*)'VARIABLES = "Time","Mean Velocity","Sc","Flame Location"' -! OPEN(22,FILE='3D_Field.dat') -! WRITE(22,*) 'VARIABLES = "X","Y","Z","C","U","V","W"' - -! refwr=pre*1.*exp(-ac/(1.+bc*ccut)) refwr=pre*1.*exp(-ac/(1.+bc*c_ref)) ! Kwon -! minf=exp((c_ref-ccut)*prof_wr) if(svf.eq.0) then spx=1 spy=1 @@ -92,6 +95,7 @@ module m_fdm_calc endif +!FDM normal start================================== if (restartnum==0) then OPEN(305,FILE='sfield.bin',form='unformatted',status='unknown') @@ -113,39 +117,81 @@ module m_fdm_calc enddo -! WRITE(22,*) 'VARIABLES = "X","Y","Z","C","U","V","W"' -! WRITE(22,897) fdmtime,svfx,svfy,svfy -! WRITE(101,897) fdmtime,svfx,svfy,svfy -!897 format('ZONE T="TIME= ',f10.5,'" I= ',i4,' J= ',i4,' K= ',i4) +! flame location setup + sum_wrate=0.; sumc=0. + DO ii=1,nz_all + DO j=1,ny + DO i=1,nx + yr=y1(2,i,j,ii)/y1(1,i,j,ii) + c=1.-yr + IF (c.lt.0.) c=0. + wrate=pre*yr*exp(-ac/(1.+bc*c)) + ! cold boundary difficulty treatment + IF(c.le.c_ref) THEN + wrate=min_wr + IF(c.gt.c_cut) wrate=((refwr-min_wr)*exp(prof_wr*(c-c_ref))+ & + min_wr-refwr*exp(prof_wr*(c_cut-c_ref)))/(1.-exp(prof_wr*(c_cut-c_ref))) + ENDIF + sum_wrate=sum_wrate+wrate*(hx*hy*hy) + sumc=sumc+(1.-yr) + ENDDO + ENDDO + ENDDO + + sum_wrate=sum_wrate/(hy*hy*ny*nz_all) + write(*,633) sum_wrate + + fl_location=(hx*(nx-1.))*(1.-(sumc/(nx*ny*nz_all))) + sumc=sumc*(hx*hy*hy)/(hy*(ny-1.)*hy*(ny-1.)) + write(*,634) fl_location/(REAL(nx-1)*hx)*100. + +633 format (' ** Consumption Speed, Sc = ',f7.4) +634 format (' ** Flame Location = ',f7.3, ' % point of x-domain.') + +! Restart setup ================================================================ + else + write (6,*) '********************************************************' + write (6,*) ' FDM field is being initialized for restarting.' + write (6,457) restartnum + 457 format(' Restart file number : ',i6) + + OPEN (restartnum,form='unformatted',status='unknown') + read (restartnum) fdmtime,tt1,tt2,tt3,oldsumc,time_int + read (restartnum) fdmcyc,tt4,dummyu_ + read (restartnum) tt1,tt2 !dt_fdmsave,dt_fullsave + read (restartnum) t_fdmsave,t_fullsave + read (restartnum) in_yr,out_yr + read (restartnum) u_,v_,w_,y1 + CLOSE (restartnum) - avgc=0. ! - avgr=0. ! + if(fdmtime.ge.t_fdmsave) t_fdmsave=t_fdmsave+dt_fdmsave + if(fdmtime.ge.t_fullsave) t_fullsave=t_fullsave+dt_fullsave - do k=1,nz_all !k - do j=1,ny - do i=1,nx - - avgc(i)=avgc(i)+(1.-y1(2,i,j,k)/y1(1,i,j,k)) - avgr(i)=avgr(i)+y1(1,i,j,k) + write (6,456) fdmtime,fdmcyc + 456 format(' Restart time : ',f10.5,' / FDM cycle : ',i6) + write(*,*) + write(*,*) ' Save Times : FDM FULL ' + write(*,454) t_fdmsave,t_fullsave + 454 format(' ',f7.3,' ',f7.3) + write(*,*)' Save Intervals : FDM FULL','from input' + write(*,453) dt_fdmsave,dt_fullsave + 453 format(' ',f7.3,' ',f7.3) + write(*,*) -! if (mod(k,spy).eq.svf.and.mod(j,spy).eq.svf.and.mod(i,spx).eq.svf) then -! WRITE(22,'(7e30.20)')REAL(i)*hx,REAL(j)*hx,REAL(k)*hx,& -! (1.-y1(2,i,j,k)/y1(1,i,j,k)),u_(i,j,k),v_(i,j,k),w_(i,j,k) -! WRITE(101,'(7e30.20)')REAL(i)*hx,REAL(j)*hx,REAL(k)*hx,& -! (1.-y1(2,i,j,k)/y1(1,i,j,k)),u_(i,j,k),v_(i,j,k),w_(i,j,k) -! endif + if (ABS(fdmtime-TIME).le.1.0e-10) then + write(*,*) ' Spectral and FDM times are consistent.' + else + write(*,*)' !! Warning : Spectral and FDM times are different !!' + write(*,455) TIME,fdmtime + 455 format(' !! Spectral Time : ',f10.5,' / FDM Time : ',f10.5) + endif - enddo - enddo - enddo + fullsavenum=restartnum+1 - avgc=avgc/REAL(ny*nz_all) ! - avgr=avgr/REAL(ny*nz_all) ! + endif - endif - -!FDM normal start====================================== +! End of Restart setup ======================================================== return end subroutine prepare_fdm @@ -155,144 +201,31 @@ module m_fdm_calc implicit none integer :: i,j,k,ii - real*8 :: coe,tt1,tt2,tt3,tt4 - real*8 :: avgc(nx),avgr(nx),fl_location,delu,wrate,yr + real*8 :: fl_location,delu,wrate,yr real*8 :: c real*8 :: umax,umin,vmax,vmin,wmax,wmin ! J. Kwon + fdmcyc=itime ! Mean velocty setup do k=1,nz_all do i=1,nx do j=1,ny u_(i,j,k)=u_(i,j,k)+dummyu_ -! IF (i.le.inx1) THEN -! u_(i,j,k)=dummyu_ -! v_(i,j,k)=0. -! w_(i,j,k)=0. -! ELSE IF (i.le.(inx1+inx2)) THEN -! coe=sin(0.5/REAL(inx2)*REAL(i-inx1-1)*PI) -! u_(i,j,k)=dummyu_+u_(i,j,k)*coe -! v_(i,j,k)=v_(i,j,k)*coe -! w_(i,j,k)=w_(i,j,k)*coe -! ENDIF enddo enddo enddo - -! Restart setup ================================================================ - if (restartnum.ne.0) then - 458 format(a55) - write (6,*) '********************************************************' - write (6,*) ' FDM field is being initialized for restarting.' - write (6,457) restartnum - 457 format(' Restart file number : ',i6) - - OPEN (restartnum,form='unformatted',status='unknown') - read (restartnum) fdmtime,tt1,tt2,tt3,oldsumc,time_int - read (restartnum) fdmcyc,tt4,dummyu_ - read (restartnum) tt1,tt2 !dt_fdmsave,dt_fullsave - read (restartnum) t_fdmsave,t_fullsave - read (restartnum) in_yr,out_yr - fdmdt=DT - read (restartnum) u_,v_,w_,y1 - CLOSE (restartnum) - - if(fdmtime.ge.t_fdmsave) t_fdmsave=t_fdmsave+dt_fdmsave - if(fdmtime.ge.t_fullsave) t_fullsave=t_fullsave+dt_fullsave - - write (6,456) fdmtime,fdmcyc - 456 format(' Restart time : ',f10.5,' / FDM cycle : ',i6) - write(*,*) - write(*,*) ' Save Times : FDM FULL ' - write(*,454) t_fdmsave,t_fullsave - 454 format(' ',f7.3,' ',f7.3) - write(*,*)' Save Intervals : FDM FULL','from input' - write(*,453) dt_fdmsave,dt_fullsave - 453 format(' ',f7.3,' ',f7.3) - write(*,*) - - TIME=TIME-DT - if (ABS(fdmtime-TIME).le.1.0e-10) then - write(*,*) ' Spectral and FDM times are consistent.' - else - write(*,*)' !! Warning : Spectral and FDM times are different !!' - write(*,455) TIME,fdmtime - 455 format(' !! Spectral Time : ',f10.5,' / FDM Time : ',f10.5) - endif - TIME=TIME+DT - -! rest_sw=0 - - fullsavenum=restartnum+1 - restartnum=0 - avgc=0.; avgr=0. - do ii=1,nz_all - do j=1,ny - do i=1,nx - avgc(i)=avgc(i)+(1.-y1(2,i,j,ii)/y1(1,i,j,ii)) - avgr(i)=avgr(i)+y1(1,i,j,ii) - enddo - enddo - enddo - - avgc=avgc/REAL(ny*nz_all) ! - avgr=avgr/REAL(ny*nz_all) ! - - endif -! End of Restart setup ======================================================== write(*,*) write(*,*) '==========================================================' - WRITE(*,932) TIME,DT -932 format(' Spectral results at time = ',f10.5,', dT = ',f7.5) - write(*,933) dummyu_ -933 format(' ** Mean U = ',f7.4) - -! if(itime.eq.1.or.rest_sw.eq.1) then - -! flame location setup - if(itime.eq.1) then - sum_wrate=0.; sumc=0. - DO ii=1,nz_all - DO j=1,ny - DO i=1,nx - yr=y1(2,i,j,ii)/y1(1,i,j,ii) - c=1.-yr - IF (c.lt.0.) c=0. - wrate=pre*yr*exp(-ac/(1.+bc*c)) - -! IF ((1.-yr).le.ccut) THEN -! wrate=pre*yr*exp(-c_ref/(1.+bc*(1.-yr))) -! ENDIF - -! cold boundary difficulty treatment - IF(c.le.c_ref) THEN - wrate=min_wr - IF(c.gt.c_cut) wrate=((refwr-min_wr)*exp(prof_wr*(c-c_ref))+ & - min_wr-refwr*exp(prof_wr*(c_cut-c_ref)))/(1.-exp(prof_wr*(c_cut-c_ref))) - ENDIF - - sum_wrate=sum_wrate+wrate*(hx*hy*hy) - sumc=sumc+(1.-yr) - ENDDO - ENDDO - ENDDO - - sum_wrate=sum_wrate/(hy*hy*ny*nz_all) - write(*,633) sum_wrate - fl_location=(hx*(nx-1.))*(1.-(sumc/(nx*ny*nz_all))) - sumc=sumc*(hx*hy*hy)/(hy*(ny-1.)*hy*(ny-1.)) - write(*,634) fl_location/(REAL(nx-1)*hx)*100. - - endif + WRITE(*,932) TIME,DT +932 format(' Spectral results at time = ',f10.5,', dT = ',f7.5) + write(*,933) dummyu_ +933 format(' ** Mean U = ',f7.4) !---------------------------------------------------------------- ! FDM DNS BGN !---------------------------------------------------------------- -! fdm:if (itime.ne.1) then -! if (fdmcyc.eq.1) then - if (fdmcyc.eq.0) then - umax=0.; umin=0.; vmax=0.; vmin=0.; wmax=0.; wmin=0. + umax=-1.0d300;umin=1.0d300;vmax=-1.0d300;vmin=1.0d300;wmax=-1.0d300;wmin=1.0d300 do k=1,nz_all do j=1,ny do i=1,nx @@ -305,13 +238,13 @@ module m_fdm_calc enddo enddo enddo -! convdt=DT/2. -! visdt=convdt + + visdt=max(0.,0.3*fdmcfl*hx**2./nu) convdt=max(0.,fdmcfl*hx/(umax+vmax+wmax)) WRITE(101,897) fdmtime,svfx,svfy,svfy -!897 format('ZONE T="TIME= ',f10.5,'" I= ',i4,' J= ',i4,' K= ',i4) + do ii=1,nz_all !k do j=1,ny do i=1,nx @@ -323,42 +256,24 @@ module m_fdm_calc enddo enddo enddo - endif - -! DQ's fdmdt setup -! do ii=10,1,-1 -! tt1=DT/REAL(ii) -! if (tt1.le.MIN(convdt,visdt)) then -! fdmdt=tt1 -! fdmstep=ii -! endif -! enddo - -! do ii=1,fdmstep ! Time marching loop -! IF (ii.eq.fdmstep) fdmdt=TIME-fdmtime - -! fdmtime=fdmtime+fdmdt -! write(*,931) ii,fdmstep,fdmtime,fdmdt,MIN(convdt,visdt) -! call solve(nx,ny,nz_all,u_,v_,w_,y1,y2,yf) -!931 format(' FDM : ',i2,'/',i2,', time = ',f10.5,', FDM dT = ',f7.5,' < ',f7.5) -! enddo -! DQ's fdmdt setup fdmdt=min(DT,visdt,convdt) call solve(nx,ny,nz_all,u_,v_,w_,y1,y2,yf) DT=fdmdt - fdmtime=fdmtime+fdmdt + fdmtime=time+fdmdt write(*,'(a30,3x,4f12.7)')' ** DT, visdt, convdt, fdmdt =' , DT,visdt,convdt,fdmdt + ! Real time results for Sc and flame location. sum_wrate=sum_wrate/(hy*hy*REAL(ny*nz_all)) write(*,633) sum_wrate 633 format (' ** Consumption Speed, Sc = ',f7.4) + fl_location=(hx*REAL(nx-1))*(1.-(sumc/(REAL(nx*ny*nz_all)))) sumc=sumc*(hx*hy*hy)/(hy*(REAL(ny)-1.)*hy*(REAL(ny)-1.)) write(*,634) fl_location/(REAL(nx-1)*hx)*100. 634 format (' ** Flame Location = ',f7.3, ' % point of x-domain.') -! write(23,'(f10.5,10e25.15)')fdmtime,dummyu_,sum_wrate,fl_location/(REAL(nx)*hx)*100. + write(505,'(f10.5,10e25.15)')fdmtime,dummyu_,sum_wrate,fl_location/(REAL(nx)*hx)*100. ! Control the inflow mean velocity, dummyu_ @@ -372,29 +287,9 @@ module m_fdm_calc time_int=fdmtime endif -! Full save =================================================================== - if(fdmtime.ge.t_fullsave) then - write(*,*) '=======================================================' - write(*,*) 'Full results are being written',fullsavenum - OPEN (fullsavenum,form='unformatted',status='unknown') - write (fullsavenum) fdmtime,nx,ny,nz_all,oldsumc,time_int - write (fullsavenum) fdmcyc,DT,dummyu_ - write (fullsavenum) dt_fdmsave,dt_fullsave - write (fullsavenum) t_fdmsave,t_fullsave - write (fullsavenum) in_yr,out_yr - write (fullsavenum) u_,v_,w_,y1 - CLOSE (fullsavenum) - write(*,*) '=======================================================' - fullsavenum=fullsavenum+1 - t_fullsave=t_fullsave+dt_fullsave - endif - ! 3D_field.dat ================================================================ - tp_field:if(fdmtime.ge.t_fdmsave) then + tp_field:if(mod(itime,iprint1).eq.0) then write(6,*) ' ## 3D Field is being written.' -! OPEN(22,FILE='3D_Field.dat') -! WRITE(22,*) 'VARIABLES = "X","Y","Z","C","U","V","W"' -! WRITE(22,897) fdmtime,svfx,svfy,svfy WRITE(101,897) fdmtime,svfx,svfy,svfy 897 format('ZONE T="time= ',f10.5,'" I= ',i4,' J= ',i4,' K= ',i4) @@ -402,9 +297,6 @@ module m_fdm_calc do j=1,ny do i=1,nx if (mod(ii,spy).eq.svf.and.mod(j,spy).eq.svf.and.mod(i,spx).eq.svf) then -! WRITE(22,'(7e30.20)') REAL(i)*hx,REAL(j)*hx,REAL(ii)*hx, & -! (1.-y1(2,i,j,ii)/y1(1,i,j,ii)),u_(i,j,ii), & -! v_(i,j,ii),w_(i,j,ii) WRITE(101,'(7e30.20)') REAL(i)*hx,REAL(j)*hx,REAL(ii)*hx, & (1.-y1(2,i,j,ii)/y1(1,i,j,ii)),u_(i,j,ii), & v_(i,j,ii),w_(i,j,ii) @@ -418,20 +310,14 @@ module m_fdm_calc endif tp_field !================================================ - visdt=max(0.,0.3*fdmcfl*hx**2./nu) - convdt=max(0.,fdmcfl*hx/(max_u+max_v+max_w)) + write(504,'(f12.6,6e18.8)')time,umax,vmax,wmax,umin,vmin,wmin -! write(44,'(e14.4,6e18.8)') TIME,max_u,max_v,max_w,min_u,min_v,min_w - if(fdm_sw.ne.0) write(504,'(f12.6,6e18.8)')time,max_u,max_v,max_w,min_u,min_v,min_w - -! endif fdm !---------------------------------------------------------------------------- ! FDM DNS END !---------------------------------------------------------------------------- write(*,*) 'Number of whole calculation = ',fdmcyc write(*,*) '==========================================================' - fdmcyc=fdmcyc+1 write(*,*) return @@ -459,19 +345,14 @@ module m_fdm_calc DO i=1,xx ux(1,i)=r1_(1,i,j,k) ! 1:rho ux(2,i)=r1_(2,i,j,k)/r1_(1,i,j,k) ! 2:Y - ux(3,i)=ux(1,i)*uu_(i,j,k) ! 3:rho*u + ux(3,i)=ux(1,i)*uu_(i,j,k) ! 3:rho*u ux(4,i)=ux(3,i)*ux(2,i) ! 4:rho*u*Y ENDDO CALL dfnonp(xx,hx,ux(1:4,:),dux(1:4,:),4,1) -! CALL d2fnonp(xx,hx,ux(2:2,:),d2ux(:),1,1) CALL d2fnonp(xx,hx,ux(2,:),d2ux(:),1,1) DO i=1,xx -! wrate=pre*ux(2,i)*exp(-ac/(1.+bc*(1.-ux(2,i)))) !wrate -! IF ((1.-ux(2,i)).le.ccut) THEN -! wrate=pre*ux(2,i)*exp(-c_ref/(1.+bc*(1.-ux(2,i)))) !wrate -! ENDIF wrate=pre*ux(2,i)*exp(-ac/(1.+bc*(1.-ux(2,i)))) !wrate IF ((1.-ux(2,i)).le.c_ref) THEN wrate=min_wr @@ -501,7 +382,6 @@ module m_fdm_calc ENDDO CALL dfp(yy,hy,uy(1:4,:),duy(1:4,:),4,2) -! CALL d2fp(yy,hy,uy(2:2,:),d2uy(:),1,2) CALL d2fp(yy,hy,uy(2,:),d2uy(:),1,2) DO j=1,yy @@ -528,7 +408,6 @@ module m_fdm_calc ENDDO CALL dfp(zz,hy,uz(1:4,:),duz(1:4,:),4,3) -! CALL d2fp(zz,hy,uz(2:2,:),d2uz(:),1,3) CALL d2fp(zz,hy,uz(2,:),d2uz(:),1,3) DO k=1,zz @@ -632,8 +511,6 @@ module m_fdm_calc bt=b(istage)*fdmdt sumc=0. sum_wrate=0. - max_u=0.; max_v=0.; max_w=0. - min_u=0.; min_v=0.; min_w=0. DO k=1,zz DO j=1,yy DO i=1,xx @@ -649,23 +526,14 @@ module m_fdm_calc !========= yr=r1(2,i,j,k)/r1(1,i,j,k) wrate=pre*yr*exp(-ac/(1.+bc*(1.-yr))) -! IF ((1.-yr).le.ccut) THEN -! wrate=pre*yr*exp(-c_ref/(1.+bc*(1.-yr))) -! ENDIF IF((1.-yr).le.c_ref) THEN wrate=min_wr IF((1.-yr).gt.c_cut) wrate=((refwr-min_wr)*exp(prof_wr*(1.-yr-c_ref))+ & min_wr-refwr*exp(prof_wr*(c_cut-c_ref)))/(1.-exp(prof_wr*(c_cut-c_ref))) ENDIF + !get sum_wrate sum_wrate=sum_wrate+wrate*(hx*hy*hy) sumc=sumc+(1.-yr) -!get sum_wrate - max_u=MAX(max_u,uu_(i,j,k)) - max_v=MAX(max_v,vv_(i,j,k)) - max_w=MAX(max_w,ww_(i,j,k)) - min_u=MIN(min_u,uu_(i,j,k)) - min_v=MIN(min_v,vv_(i,j,k)) - min_w=MIN(min_w,ww_(i,j,k)) ENDDO ENDDO ENDDO diff --git a/main.f90 b/main.f90 index 7033025..2ead4d6 100644 --- a/main.f90 +++ b/main.f90 @@ -36,10 +36,6 @@ program x_code call m_stats_init call m_force_init - !call result_files_open - if (task.eq.'hydro' .and. myid.eq.master) then - call prepare_fdm - end if ! allocating and initializing particles if (task.eq.'parts') then @@ -68,6 +64,14 @@ program x_code ! Initializing the LES stuff if (les) call m_les_begin + !call result_files_open + if (fdm_sw.ne.0) then + if (task.eq.'hydro' .and. myid.eq.master) then + call prepare_fdm + end if + call MPI_BARRIER(MPI_COMM_TASK, mpi_err) + end if + ! checking divergence if (task.eq.'hydro') call divergence @@ -126,6 +130,14 @@ program x_code end if end if + if (fdm_sw.ne.0) then ! Reacting + call gather_4 + if (myid.eq.master) then + call fdm_exe + end if + call MPI_BARRIER(MPI_COMM_TASK, mpi_err) + endif + ! RHS for scalars call rhs_scalars @@ -176,10 +188,19 @@ program x_code TIME = TIME + DT ! write the restart file if it's the time - if (mod(itime,IPRINT2).eq.0) call restart_write_parallel + if (mod(itime,IPRINT2).eq.0) then + call restart_write_parallel + if (fdm_sw.ne.0) then ! Reacting + call gather_4 + if (myid.eq.master) then + call fdm_restart_write + end if + call MPI_BARRIER(MPI_COMM_TASK, mpi_err) + endif + endif ! change the timestep in case we're running with variable timestep - if (variable_dt) call my_dt + ! if (variable_dt) call my_dt ! CPU usage statistics if (mod(itime,iprint1).eq.0) then @@ -228,12 +249,6 @@ program x_code if (mod(itime,iprint1).eq.0) call stat_main if (fdm_sw.eq.0) then ! non-reacting if (mod(itime,iwrite4).eq.0) call io_write_4 - else ! reacting - call gather_4 - if (task.eq.'hydro' .and. myid.eq.master) then - call fdm_exe - end if - call MPI_BARRIER(MPI_COMM_TASK, mpi_err) endif end if end if stats