Skip to content

Commit

Permalink
Merge pull request #332 from xcompact3d/mathrack-patch-1
Browse files Browse the repository at this point in the history
Fix variable names in restart
  • Loading branch information
slaizet authored Jan 14, 2025
2 parents a0728af + 36068cc commit e4390ff
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/tools.f90
Original file line number Diff line number Diff line change
Expand Up @@ -287,28 +287,28 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho
!
if (iscalar==1) then
do is=1, numscalar
write(varname, *) "phi-", is
call decomp_2d_write_one(1,phi1(:,:,:,is),resfile,varname,0,io_restart,reduce_prec=.false.)
write(varname,"('phi-',I2.2)") is
call decomp_2d_write_one(1,phi1(:,:,:,is),resfile,trim(varname),0,io_restart,reduce_prec=.false.)
! previous time-steps
if ((itimescheme==2).or.(itimescheme==3)) then ! AB2 or AB3
write(varname, *) "dphi-", is, "-2"
call decomp_2d_write_one(1,dphi1(:,:,:,2,is),resfile,varname,0,io_restart,reduce_prec=.false.)
write(varname,"('dphi-',I2.2,'-2')") is
call decomp_2d_write_one(1,dphi1(:,:,:,2,is),resfile,trim(varname),0,io_restart,reduce_prec=.false.)
end if
!
if (itimescheme==3) then ! AB3
write(varname, *) "dphi-", is, "-3"
call decomp_2d_write_one(1,dphi1(:,:,:,3,is),resfile,varname,0,io_restart,reduce_prec=.false.)
write(varname,"('dphi-',I2.2,'-3')") is
call decomp_2d_write_one(1,dphi1(:,:,:,3,is),resfile,trim(varname),0,io_restart,reduce_prec=.false.)
end if
end do
endif
if (ilmn) then
do is = 1, nrhotime
write(varname, *) "rho-", is
call decomp_2d_write_one(1,rho1(:,:,:,is),resfile,varname,0,io_restart,reduce_prec=.false.)
write(varname,"('rho-',I2.2)") is
call decomp_2d_write_one(1,rho1(:,:,:,is),resfile,trim(varname),0,io_restart,reduce_prec=.false.)
enddo
do is = 1, ntime
write(varname, *) "drho-", is
call decomp_2d_write_one(1,drho1(:,:,:,is),resfile,varname,0,io_restart,reduce_prec=.false.)
write(varname,"('drho-',I2.2)") is
call decomp_2d_write_one(1,drho1(:,:,:,is),resfile,trim(varname),0,io_restart,reduce_prec=.false.)
enddo
call decomp_2d_write_one(1,mu1(:,:,:),resfile,"mu",0,io_restart,reduce_prec=.false.)
endif
Expand Down Expand Up @@ -406,17 +406,17 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho
!
if (iscalar==1) then
do is=1, numscalar
write(varname, *) "phi-", is
call decomp_2d_read_one(1,phi1(:,:,:,is),resfile,varname,io_restart,reduce_prec=.false.)
write(varname,"('phi-',I2.2)") is
call decomp_2d_read_one(1,phi1(:,:,:,is),resfile,trim(varname),io_restart,reduce_prec=.false.)
! previous time-steps
if ((itimescheme==2).or.(itimescheme==3)) then ! AB2 or AB3
write(varname, *) "dphi-", is, "-2"
call decomp_2d_read_one(1,dphi1(:,:,:,2,is),resfile,varname,io_restart,reduce_prec=.false.)
write(varname,"('dphi-',I2.2,'-2')") is
call decomp_2d_read_one(1,dphi1(:,:,:,2,is),resfile,trim(varname),io_restart,reduce_prec=.false.)
end if
!
if (itimescheme==3) then ! AB3
write(varname, *) "dphi-", is, "-3"
call decomp_2d_read_one(1,dphi1(:,:,:,3,is),resfile,varname,io_restart,reduce_prec=.false.)
write(varname,"('dphi-',I2.2,'-3')") is
call decomp_2d_read_one(1,dphi1(:,:,:,3,is),resfile,trim(varname),io_restart,reduce_prec=.false.)
end if
! ABL
if (itype==itype_abl) then
Expand All @@ -434,12 +434,12 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho
endif
if (ilmn) then
do is = 1, nrhotime
write(varname, *) "rho-", is
call decomp_2d_read_one(1,rho1(:,:,:,is),resfile,varname,io_restart,reduce_prec=.false.)
write(varname,"('rho-',I2.2)") is
call decomp_2d_read_one(1,rho1(:,:,:,is),resfile,trim(varname),io_restart,reduce_prec=.false.)
enddo
do is = 1, ntime
write(varname, *) "drho-", is
call decomp_2d_read_one(1,drho1(:,:,:,is),resfile,varname,io_restart,reduce_prec=.false.)
write(varname,"('drho-',I2.2)") is
call decomp_2d_read_one(1,drho1(:,:,:,is),resfile,trim(varname),io_restart,reduce_prec=.false.)
enddo
call decomp_2d_read_one(1,mu1,resfile,"mu",io_restart,reduce_prec=.false.)
end if
Expand Down Expand Up @@ -537,7 +537,7 @@ subroutine init_restart_adios2()
call decomp_2d_register_variable(io_restart, "pp", 3, 0, 0, mytype, phG) !! XXX: need some way to handle the different grid here...

do is = 1, numscalar
write(varname,*) "phi-", is
write(varname,"('phi-',I2.2)") is
call decomp_2d_register_variable(io_restart, trim(varname), 1, 0, 0, mytype)
end do

Expand All @@ -547,7 +547,7 @@ subroutine init_restart_adios2()
call decomp_2d_register_variable(io_restart, "duz-2", 1, 0, 0, mytype)

do is = 1, numscalar
write(varname,*) "dphi-", is, "-2"
write(varname,"('dphi-',I2.2,'-2')") is
call decomp_2d_register_variable(io_restart, trim(varname), 1, 0, 0, mytype)
end do

Expand All @@ -557,7 +557,7 @@ subroutine init_restart_adios2()
call decomp_2d_register_variable(io_restart, "duz-3", 1, 0, 0, mytype)

do is = 1, numscalar
write(varname,*) "dphi-", is, "-3"
write(varname,"('dphi-',I2.2,'-3')") is
call decomp_2d_register_variable(io_restart, trim(varname), 1, 0, 0, mytype)
end do
endif
Expand All @@ -569,12 +569,12 @@ subroutine init_restart_adios2()

if (ilmn) then
do is = 1, nrhotime
write(varname, *) "rho-", is
call decomp_2d_register_variable(io_restart, varname, 1, 0, 0, mytype)
write(varname,"('rho-',I2.2)") is
call decomp_2d_register_variable(io_restart, trim(varname), 1, 0, 0, mytype)
end do
do is = 1, ntime
write(varname, *) "drho-", is
call decomp_2d_register_variable(io_restart, varname, 1, 0, 0, mytype)
write(varname,"('drho-',I2.2)") is
call decomp_2d_register_variable(io_restart, trim(varname), 1, 0, 0, mytype)
end do
call decomp_2d_register_variable(io_restart, "mu", 1, 0, 0, mytype)
end if
Expand Down

0 comments on commit e4390ff

Please sign in to comment.