diff --git a/src/tools.f90 b/src/tools.f90 index 6d12c9e70..720e24e7c 100644 --- a/src/tools.f90 +++ b/src/tools.f90 @@ -210,7 +210,7 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho use param use MPI use navier, only : gradp - use mhd, only : mhd_active,mhd_equation,Bm + use mhd, only : mhd_active,mhd_equation,Bm,dBm implicit none @@ -313,9 +313,17 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho endif if (mhd_active .and. mhd_equation) then - call decomp_2d_write_one(1,Bm(:,:,:,1),resfile,'bx',0,io_restart,reduce_prec=.false.) - call decomp_2d_write_one(1,Bm(:,:,:,2),resfile,'by',0,io_restart,reduce_prec=.false.) - call decomp_2d_write_one(1,Bm(:,:,:,3),resfile,'bz',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,Bm(:,:,:,1),resfile,'bx',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,Bm(:,:,:,2),resfile,'by',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,Bm(:,:,:,3),resfile,'bz',0,io_restart,reduce_prec=.false.) + if (itimescheme==3) then + call decomp_2d_write_one(1,dBm(:,:,:,1,2),resfile,'dbx-2',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,dBm(:,:,:,2,2),resfile,'dby-2',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,dBm(:,:,:,3,2),resfile,'dbz-2',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,dBm(:,:,:,1,3),resfile,'dbx-3',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,dBm(:,:,:,2,3),resfile,'dby-3',0,io_restart,reduce_prec=.false.) + call decomp_2d_write_one(1,dBm(:,:,:,3,3),resfile,'dbz-3',0,io_restart,reduce_prec=.false.) + endif endif call decomp_2d_end_io(io_restart, resfile) @@ -432,9 +440,17 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho end if if(mhd_active .and. mhd_equation) then - call decomp_2d_read_one(1,Bm(:,:,:,1),resfile,'bx',io_restart,reduce_prec=.false.) - call decomp_2d_read_one(1,Bm(:,:,:,2),resfile,'by',io_restart,reduce_prec=.false.) - call decomp_2d_read_one(1,Bm(:,:,:,3),resfile,'bz',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,Bm(:,:,:,1),resfile,'bx',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,Bm(:,:,:,2),resfile,'by',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,Bm(:,:,:,3),resfile,'bz',io_restart,reduce_prec=.false.) + if (itimescheme==3) then + call decomp_2d_read_one(1,dBm(:,:,:,1,2),resfile,'dbx-2',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,dBm(:,:,:,2,2),resfile,'dby-2',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,dBm(:,:,:,3,2),resfile,'dbz-2',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,dBm(:,:,:,1,3),resfile,'dbx-3',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,dBm(:,:,:,2,3),resfile,'dby-3',io_restart,reduce_prec=.false.) + call decomp_2d_read_one(1,dBm(:,:,:,3,3),resfile,'dbz-3',io_restart,reduce_prec=.false.) + endif endif call decomp_2d_end_io(io_restart, resfile) @@ -557,6 +573,14 @@ subroutine init_restart_adios2() call decomp_2d_register_variable(io_restart, "bx", 1, 0, 0, mytype) call decomp_2d_register_variable(io_restart, "by", 1, 0, 0, mytype) call decomp_2d_register_variable(io_restart, "bz", 1, 0, 0, mytype) + if (itimescheme.eq.3) then + call decomp_2d_register_variable(io_restart, "dbx-2", 1, 0, 0, mytype) + call decomp_2d_register_variable(io_restart, "dby-2", 1, 0, 0, mytype) + call decomp_2d_register_variable(io_restart, "dbz-2", 1, 0, 0, mytype) + call decomp_2d_register_variable(io_restart, "dbx-3", 1, 0, 0, mytype) + call decomp_2d_register_variable(io_restart, "dby-3", 1, 0, 0, mytype) + call decomp_2d_register_variable(io_restart, "dbz-3", 1, 0, 0, mytype) + endif end if end subroutine init_restart_adios2