Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert itmask from logical to integer*4 #227

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/clib/calc_tdust_1d_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ subroutine calc_tdust_1d_g(

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand Down Expand Up @@ -78,7 +78,7 @@ subroutine calc_tdust_1d_g(
& slope(in), tdplus(in), tdustnow(in), tdustold(in),
& pert(in),
& bi_t_mid(in), bi_t_high(in)
logical nm_itmask(in), bi_itmask(in)
MASK_TYPE nm_itmask(in), bi_itmask(in)

!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////
!=======================================================================
Expand All @@ -97,25 +97,25 @@ subroutine calc_tdust_1d_g(
! Set local iteration mask and initial guess

do i = is+1, ie+1
if ( itmask(i) ) then
if ( itmask(i) .eq. MASK_TRUE ) then
gamma_isrf(i) = isrf(i) * gamma_isrfa
endif
enddo

do i = is+1, ie+1
nm_itmask(i) = itmask(i)
bi_itmask(i) = itmask(i)
if ( nm_itmask(i) ) then
if ( nm_itmask(i) .eq. MASK_TRUE ) then

if (trad .ge. tgas(i)) then
tdustnow(i) = trad
nm_itmask(i) = .false.
bi_itmask(i) = .false.
nm_itmask(i) = MASK_FALSE
bi_itmask(i) = MASK_FALSE
c_done = c_done + 1
nm_done = nm_done + 1
else if (tgas(i) .gt. t_subl) then
! Use bisection if T_gas > grain sublimation temperature.
nm_itmask(i) = .false.
nm_itmask(i) = MASK_FALSE
nm_done = nm_done + 1
else
tdustnow(i) = max(trad,
Expand All @@ -136,7 +136,7 @@ subroutine calc_tdust_1d_g(
! Loop over slice

do i = is+1, ie+1
if ( nm_itmask(i) ) then
if ( nm_itmask(i) .eq. MASK_TRUE ) then

tdplus(i) = max(1.e-3_DKIND, ((1._DKIND + pert(i))
& * tdustnow(i)))
Expand All @@ -161,7 +161,7 @@ subroutine calc_tdust_1d_g(
& gamma_isrf, nh, nm_itmask, solplus, in, is, ie)

do i = is+1, ie+1
if ( nm_itmask(i) ) then
if ( nm_itmask(i) .eq. MASK_TRUE ) then

! Use Newton's method to solve for Tdust

Expand All @@ -177,13 +177,13 @@ subroutine calc_tdust_1d_g(

! If negative solution calculated, give up and wait for bisection step.
if (tdustnow(i) .lt. trad) then
nm_itmask(i) = .false.
nm_itmask(i) = MASK_FALSE
nm_done = nm_done + 1
! Check for convergence of solution
else if (abs(sol(i) / solplus(i)) .lt. tol) then
nm_itmask(i) = .false.
nm_itmask(i) = MASK_FALSE
c_done = c_done + 1
bi_itmask(i) = .false.
bi_itmask(i) = MASK_FALSE
nm_done = nm_done + 1
endif

Expand All @@ -208,7 +208,7 @@ subroutine calc_tdust_1d_g(
! If iteration count exceeded, try once more with bisection
if (c_done .lt. c_total) then
do i = is+1, ie+1
if ( bi_itmask(i) ) then
if ( bi_itmask(i) .eq. MASK_TRUE ) then
tdustnow(i) = trad
bi_t_high(i) = tgas(i)
endif
Expand All @@ -217,7 +217,7 @@ subroutine calc_tdust_1d_g(
do iter = 1, bi_itmax

do i = is+1, ie+1
if ( bi_itmask(i) ) then
if ( bi_itmask(i) .eq. MASK_TRUE ) then

bi_t_mid(i) = 0.5_DKIND * (tdustnow(i) + bi_t_high(i))
if (iter .eq. 1) then
Expand All @@ -234,7 +234,7 @@ subroutine calc_tdust_1d_g(
& gamma_isrf, nh, bi_itmask, sol, in, is, ie)

do i = is+1, ie+1
if ( bi_itmask(i) ) then
if ( bi_itmask(i) .eq. MASK_TRUE ) then

if (sol(i) .gt. 0._DKIND) then
tdustnow(i) = bi_t_mid(i)
Expand All @@ -244,7 +244,7 @@ subroutine calc_tdust_1d_g(

if ((abs(bi_t_high(i) - tdustnow(i)) / tdustnow(i))
& .le. bi_tol) then
bi_itmask(i) = .false.
bi_itmask(i) = MASK_FALSE
c_done = c_done + 1
endif

Expand Down Expand Up @@ -280,7 +280,7 @@ subroutine calc_tdust_1d_g(

! Copy values back to thrown slice
do i = is+1, ie+1
if ( itmask(i) ) then
if ( itmask(i) .eq. MASK_TRUE ) then

! Check for bad solutions
if (tdustnow(i) .lt. 0._DKIND) then
Expand Down Expand Up @@ -349,7 +349,7 @@ subroutine calc_kappa_gr_g(

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand All @@ -368,7 +368,7 @@ subroutine calc_kappa_gr_g(
!=======================================================================

do i = is+1, ie+1
if ( itmask(i) ) then
if ( itmask(i) .eq. MASK_TRUE ) then

! Temperature dependence from Dopcke et al. (2011).
! Normalized to Omukai (2000).
Expand Down Expand Up @@ -438,7 +438,7 @@ subroutine calc_gr_balance_g(

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand All @@ -457,7 +457,7 @@ subroutine calc_gr_balance_g(
!=======================================================================

do i = is+1, ie+1
if ( itmask(i) ) then
if ( itmask(i) .eq. MASK_TRUE ) then

sol(i) = gamma_isrf(i) + radf * kgr(i) *
& (trad4 - tdust(i)**4) +
Expand Down
6 changes: 3 additions & 3 deletions src/clib/calc_tdust_3d_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ subroutine calc_tdust_3d_g(

! Iteration mask for multi_cool

logical itmask(in)
MASK_TYPE itmask(in)

!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////
!=======================================================================
Expand Down Expand Up @@ -121,9 +121,9 @@ subroutine calc_tdust_3d_g(

do i = is+1, ie+1

! Set itmask to all true
! Set itmask to all MASK_TRUE

itmask(i) = .true.
itmask(i) = MASK_TRUE

! Compute interstellar radiation field

Expand Down
6 changes: 3 additions & 3 deletions src/clib/calc_temp1d_cloudy_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ subroutine calc_temp1d_cloudy_g(d, metal, e, rhoH,

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand Down Expand Up @@ -148,14 +148,14 @@ subroutine calc_temp1d_cloudy_g(d, metal, e, rhoH,
endif

do i=is+1, ie+1
if ( itmask(i) ) then
if (itmask(i) .eq. MASK_TRUE) then
! Calculate proper log(n_H)
log_n_h(i) = log10(rhoH(i) * dom)
endif
enddo

do i=is+1, ie+1
if ( itmask(i) ) then
if (itmask(i) .eq. MASK_TRUE) then
munew = 1._DKIND
do ti = 1, ti_max
muold = munew
Expand Down
4 changes: 2 additions & 2 deletions src/clib/calc_temp_cloudy_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ subroutine calc_temp_cloudy_g(d, e, metal, temperature,

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)
!
!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////
!=======================================================================
Expand Down Expand Up @@ -145,7 +145,7 @@ subroutine calc_temp_cloudy_g(d, e, metal, temperature,
! Initialize iteration mask to true for all cells.

do i = is+1, ie+1
itmask(i) = .true.
itmask(i) = MASK_TRUE

rhoH(i) = fh * d(i,j,k)
enddo
Expand Down
4 changes: 2 additions & 2 deletions src/clib/cool1d_cloudy_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ subroutine cool1d_cloudy_g(d, rhoH, metallicity,

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand Down Expand Up @@ -115,7 +115,7 @@ subroutine cool1d_cloudy_g(d, rhoH, metallicity,
endif

do i=is+1, ie+1
if ( itmask(i) ) then
if (itmask(i) .eq. MASK_TRUE) then

log10tem(i) = logtem(i) * inv_log10

Expand Down
4 changes: 2 additions & 2 deletions src/clib/cool1d_cloudy_old_tables_g.F
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ subroutine cool1D_cloudy_old_tables_g(d, de, rhoH, metallicity,

! Iteration mask

logical itmask(in)
MASK_TYPE itmask(in)

! Parameters

Expand Down Expand Up @@ -124,7 +124,7 @@ subroutine cool1D_cloudy_old_tables_g(d, de, rhoH, metallicity,
endif

do i=is+1, ie+1
if ( itmask(i) ) then
if ( itmask(i) .eq. MASK_TRUE) then

log10tem(i) = logtem(i) * inv_log10

Expand Down
Loading