Skip to content

Commit

Permalink
Addressed gfortran warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
p-costa committed Feb 14, 2025
1 parent a4a8b57 commit fcb11f6
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/chkdt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ subroutine chkdt(n,dl,dzci,dzfi,visc,alpha,u,v,w,dtmax)
!$acc end data
!$acc wait(1)
call MPI_ALLREDUCE(MPI_IN_PLACE,dti,1,MPI_REAL_RP,MPI_MAX,MPI_COMM_WORLD,ierr)
if(dti == 0.) dti = 1.
if(dti < epsilon(0._rp)) dti = 1.
if(is_impdiff .and. .not.is_impdiff_1d) then
dtmax = sqrt(3.)/dti
else
Expand Down
47 changes: 24 additions & 23 deletions src/initflow.f90
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,29 @@ subroutine initflow(inivel,bcvel,ng,lo,l,dl,zc,zf,dzc,dzf,visc, &
! for the cross-stream velocity components
! (commented below)
!
!do k=1,n(3)
! zcc = (zc(k)/l(3) )*2.*pi
! zff = (zc(k)/l(3)+0.5*dzc(k)/l(3))*2.*pi
! do j=1,n(2)
! yc = (j+lo(2)-1-.5)*dl(2)/l(2)*2.*pi
! yf = (j+lo(2)-1-.0)*dl(2)/l(2)*2.*pi
! do i=1,n(1)
! xc = (i+lo(1)-1-.5)*dl(1)/l(1)*2.*pi
! xf = (i+lo(1)-1-.0)*dl(1)/l(1)*2.*pi
! !u(i,j,k) = u1d(k)
! v(i,j,k) = sin(xc)*cos(yf)*cos(zcc)*ubulk
! w(i,j,k) = -cos(xc)*sin(yc)*cos(zff)*ubulk
! p(i,j,k) = 0.!(cos(2.*xc)+cos(2.*yc))*(cos(2.*zcc)+2.)/16.
! end do
! end do
!end do
if(.false.) then
do k=1,n(3)
zcc = (zc(k)/l(3) )*2.*pi
zff = (zc(k)/l(3)+0.5*dzc(k)/l(3))*2.*pi
do j=1,n(2)
yc = (j+lo(2)-1-.5)*dl(2)/l(2)*2.*pi
yf = (j+lo(2)-1-.0)*dl(2)/l(2)*2.*pi
do i=1,n(1)
xc = (i+lo(1)-1-.5)*dl(1)/l(1)*2.*pi
xf = (i+lo(1)-1-.0)*dl(1)/l(1)*2.*pi
!u(i,j,k) = u1d(k)
v(i,j,k) = sin(xc)*cos(yf)*cos(zcc)*ubulk
w(i,j,k) = -cos(xc)*sin(yc)*cos(zff)*ubulk
p(i,j,k) = 0.!(cos(2.*xc)+cos(2.*yc))*(cos(2.*zcc)+2.)/16.
end do
end do
end do
end if
end if
end subroutine initflow
!
subroutine initscal(iniscal,bcscal,ng,lo,l,dl,zc,zf,dzc,dzf,salpha, &
is_sforced,scalf,ssource,is_wallturb,s)
subroutine initscal(iniscal,bcscal,ng,lo,l,dl,zc,dzf,salpha, &
is_sforced,scalf,s)
!
! computes initial conditions for the scalar field
!
Expand All @@ -268,16 +270,15 @@ subroutine initscal(iniscal,bcscal,ng,lo,l,dl,zc,zf,dzc,dzf,salpha, &
real(rp), intent(in ), dimension(0:1,3) :: bcscal
integer , intent(in ), dimension(3) :: ng,lo
real(rp), intent(in ), dimension(3) :: l,dl
real(rp), intent(in ), dimension(0:) :: dzc,dzf,zc,zf
real(rp), intent(in ), dimension(0:) :: zc,dzf
real(rp), intent(in ) :: salpha
logical , intent(in ) :: is_sforced
real(rp), intent(in ) :: scalf,ssource
logical , intent(in ) :: is_wallturb
real(rp), intent(in ) :: scalf
real(rp), intent(inout), dimension(0:,0:,0:) :: s
real(rp), allocatable, dimension(:) :: s1d
integer :: i,j,k
logical :: is_noise,is_mean
real(rp) :: sref,lref
real(rp) :: sref
integer, dimension(3) :: n
integer :: ii
real(rp) :: xx
Expand Down Expand Up @@ -392,7 +393,7 @@ subroutine set_mean(n,mean,grid_vol_ratio,p)
end do
call MPI_ALLREDUCE(MPI_IN_PLACE,meanold,1,MPI_REAL_RP,MPI_SUM,MPI_COMM_WORLD,ierr)
!
if(meanold /= 0.) then
if(abs(meanold) > epsilon(0._rp)) then
!$OMP PARALLEL WORKSHARE
p(:,:,:) = p(:,:,:)/meanold*mean
!$OMP END PARALLEL WORKSHARE
Expand Down
8 changes: 4 additions & 4 deletions src/initgrid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ subroutine gridpoint_cluster_two_end(alpha,z0,z)
implicit none
real(rp), intent(in) :: alpha,z0
real(rp), intent(out) :: z
if(alpha /= 0.) then
if(alpha > epsilon(0._rp)) then
z = 0.5*(1.+tanh((z0-0.5)*alpha)/tanh(alpha/2.))
!z = 0.5*(1.+erf( (z0-0.5)*alpha)/erf( alpha/2.))
else
Expand All @@ -104,7 +104,7 @@ subroutine gridpoint_cluster_one_end(alpha,z0,z)
implicit none
real(rp), intent(in) :: alpha,z0
real(rp), intent(out) :: z
if(alpha /= 0.) then
if(alpha > epsilon(0._rp)) then
z = 1.0*(1.+tanh((z0-1.0)*alpha)/tanh(alpha/1.))
!z = 1.0*(1.+erf( (z0-1.0)*alpha)/erf( alpha/1.))
else
Expand All @@ -118,7 +118,7 @@ subroutine gridpoint_cluster_one_end_r(alpha,r0,r)
implicit none
real(rp), intent(in ) :: alpha,r0
real(rp), intent(out) :: r
if(alpha /= 0._rp) then
if(alpha > epsilon(0._rp)) then
r = 1._rp-1.0_rp*(1._rp+tanh((1._rp-r0-1.0_rp)*alpha)/tanh(alpha/1._rp))
!r = 1._rp-1.0_rp*(1._rp+erf( (1._rp-r0-1.0_rp)*alpha)/erf( alpha/1._rp))
else
Expand All @@ -132,7 +132,7 @@ subroutine gridpoint_cluster_middle(alpha,z0,z)
implicit none
real(rp), intent(in) :: alpha,z0
real(rp), intent(out) :: z
if(alpha /= 0.) then
if(alpha > epsilon(0._rp)) then
if( z0 <= 0.5) then
z = 0.5*(1.-1.+tanh(2.*alpha*(z0-0.))/tanh(alpha))
!z = 0.5*(1.-1.+erf( 2.*alpha*(z0-0.))/erf( alpha))
Expand Down
5 changes: 2 additions & 3 deletions src/initsolver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subroutine initsolver(ng,n_x_fft,n_y_fft,lo_z,hi_z,dli,dzci_g,dzfi_g,cbc,bc,lamb
!
! compute and distribute coefficients for tridiagonal solver
!
call tridmatrix(cbc(:,3),ng(3),dli(3),dzci_g,dzfi_g,c_or_f(3),a_g,b_g,c_g)
call tridmatrix(cbc(:,3),ng(3),dzci_g,dzfi_g,c_or_f(3),a_g,b_g,c_g)
a(:) = a_g(lo_z(3):hi_z(3))
b(:) = b_g(lo_z(3):hi_z(3))
c(:) = c_g(lo_z(3):hi_z(3))
Expand Down Expand Up @@ -143,11 +143,10 @@ subroutine eigenvalues(n,bc,c_or_f,lambda)
end select
end subroutine eigenvalues
!
subroutine tridmatrix(bc,n,dzi,dzci,dzfi,c_or_f,a,b,c)
subroutine tridmatrix(bc,n,dzci,dzfi,c_or_f,a,b,c)
implicit none
character(len=1), intent(in), dimension(0:1) :: bc
integer , intent(in) :: n
real(rp), intent(in) :: dzi
real(rp), intent(in), dimension(0:) :: dzci,dzfi
character(len=1), intent(in) :: c_or_f ! c -> cell-centered; f-face-centered
real(rp), intent(out), dimension(n) :: a,b,c
Expand Down
13 changes: 3 additions & 10 deletions src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ program cans
#else
integer , dimension(2,2) :: arrplanu,arrplanv,arrplanw
#endif
real(rp), allocatable, dimension(:,:) :: lambdaxyu,lambdaxyv,lambdaxyw,lambdaxy
real(rp), allocatable, dimension(:,:) :: lambdaxyu,lambdaxyv,lambdaxyw
real(rp), allocatable, dimension(:) :: au,av,aw,bu,bv,bw,cu,cv,cw
real(rp) :: normfftu,normfftv,normfftw
type(rhs_bound) :: rhsbu,rhsbv,rhsbw
Expand All @@ -122,11 +122,6 @@ program cans
!
type(scalar), target, allocatable, dimension(:) :: scalars
type(scalar), pointer :: s
#if !defined(_OPENACC)
type(C_PTR), dimension(2,2) :: arrplans
#else
integer , dimension(2,2) :: arrplans
#endif
real(rp) :: meanscal
real(rp), allocatable, dimension(:) :: fs
integer :: iscal
Expand Down Expand Up @@ -350,12 +345,10 @@ program cans
if(.not.restart) then
istep = 0
time = 0.
call initflow(inivel,bcvel,ng,lo,l,dl,zc,zf,dzc,dzf,visc, &
is_forced,velf,bforce,is_wallturb,u,v,w,p)
call initflow(inivel,bcvel,ng,lo,l,dl,zc,zf,dzc,dzf,visc,is_forced,velf,bforce,is_wallturb,u,v,w,p)
do iscal=1,nscal
s => scalars(iscal)
call initscal(s%ini,s%bc,ng,lo,l,dl,zc,zf,dzc,dzf,s%alpha, &
s%is_forced,s%scalf,s%source,is_wallturb,s%val)
call initscal(s%ini,s%bc,ng,lo,l,dl,zc,dzf,s%alpha,s%is_forced,s%scalf,s%val)
end do
if(myid == 0) print*, '*** Initial condition succesfully set ***'
else
Expand Down
7 changes: 3 additions & 4 deletions src/rk.f90
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@ subroutine rk_scal(rkpar,iscal,nscal,n,dli,l,dzci,dzfi,grid_vol_ratio_f,alpha,dt
type(arr_ptr), allocatable, dimension(:), save :: dsdtrk ,dsdtrko
!
logical, save :: is_first = .true.
real(rp) :: factor1,factor2,factor12,ff
real(rp) :: factor1,factor2,factor12
real(rp), dimension(0:1,3) :: flux
integer :: i,j,k
integer :: is
real(rp) :: mean,ss
real(rp) :: mean
!
factor1 = rkpar(1)*dt
factor2 = rkpar(2)*dt
Expand Down Expand Up @@ -358,7 +357,7 @@ subroutine rk_scal(rkpar,iscal,nscal,n,dli,l,dzci,dzfi,grid_vol_ratio_f,alpha,dt
!$acc end kernels
end if
!
call scal(n(1),n(2),n(3),dli(1),dli(2),dli(3),dzci,dzfi,alpha,u,v,w,s,dsdtrk(iscal)%s, &
call scal(n(1),n(2),n(3),dli(1),dli(2),dzci,dzfi,alpha,u,v,w,s,dsdtrk(iscal)%s, &
dsdtrkd(iscal)%s)
#if !defined(_LOOP_UNSWITCHING)
!$acc parallel loop collapse(3) default(present) async(1)
Expand Down
4 changes: 2 additions & 2 deletions src/scal.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ module mod_scal
end type scalar
!
contains
subroutine scal(nx,ny,nz,dxi,dyi,dzi,dzci,dzfi,visc,u,v,w,s,dsdt,dsdtd)
subroutine scal(nx,ny,nz,dxi,dyi,dzci,dzfi,visc,u,v,w,s,dsdt,dsdtd)
use mod_param, only: is_impdiff,is_impdiff_1d
!
! computes convective and diffusive fluxes
!
implicit none
integer , intent(in) :: nx,ny,nz
real(rp), intent(in) :: dxi,dyi,dzi,visc
real(rp), intent(in) :: dxi,dyi,visc
real(rp), intent(in), dimension(0:) :: dzci,dzfi
real(rp), dimension(0:,0:,0:), intent(in) :: u,v,w,s
real(rp), dimension(:,:,:), intent(out) :: dsdt
Expand Down
4 changes: 1 addition & 3 deletions src/solver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,10 @@ subroutine gaussel_ptdma(nx,ny,n,nh,a,b,c,is_periodic,p,lambdaxy,is_update,aa_z_
real(rp), dimension(nx,ny,n) :: aa,cc
real(rp), allocatable, dimension(: ,: ,:) :: aa_y,cc_y,pp_y,aa_z,cc_z,pp_z
real(rp), allocatable, dimension(: ,: ,:) :: pp_z_2,cc_z_0
real(rp) :: z,zz(2),lxy,bb(n)
real(rp) :: z,zz(2),bb(n)
integer :: i,j,k
integer , dimension(3) :: nr_z
integer :: nx_r,ny_r,nn
integer :: istat,wsize
!
nr_z(:) = dinfo_ptdma%zsz(:)
allocate(aa_y(nx,ny,2), &
Expand Down Expand Up @@ -419,7 +418,6 @@ subroutine dgtsv_homebrewed(n,a,b,c,p)
end subroutine dgtsv_homebrewed
!
subroutine solver_gaussel_z(n,ng,hi,a,b,c,bcz,c_or_f,p)
use mod_param, only: eps
implicit none
integer , intent(in), dimension(3) :: n,ng,hi
real(rp), intent(in), dimension(:) :: a,b,c
Expand Down

0 comments on commit fcb11f6

Please sign in to comment.