Skip to content

Commit 1864285

Browse files
committed
working precision
1 parent 45e80d9 commit 1864285

File tree

12 files changed

+158
-158
lines changed

12 files changed

+158
-158
lines changed

src/common/m_helper.fpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,11 @@ contains
478478
recursive function unassociated_legendre(x, l) result(P)
479479
480480
integer, intent(in) :: l
481-
real(kind(0d0)), intent(in) :: x
482-
real(kind(0d0)) :: P
481+
real(wp), intent(in) :: x
482+
real(wp) :: P
483483
484484
if (l == 0) then
485-
P = 1d0
485+
P = 1_wp
486486
else if (l == 1) then
487487
P = x
488488
else
@@ -500,15 +500,15 @@ contains
500500
recursive function spherical_harmonic_func(x, phi, l, m) result(Y)
501501
502502
integer, intent(in) :: l, m
503-
real(kind(0d0)), intent(in) :: x, phi
504-
real(kind(0d0)) :: Y, prefactor, pi
503+
real(wp), intent(in) :: x, phi
504+
real(wp) :: Y, prefactor, pi
505505
506-
pi = acos(-1d0)
506+
pi = acos(-1_wp)
507507
prefactor = sqrt((2*l + 1)/(4*pi)*factorial(l - m)/factorial(l + m));
508508
if (m == 0) then
509509
Y = prefactor*associated_legendre(x, l, m);
510510
elseif (m > 0) then
511-
Y = (-1d0)**m*sqrt(2d0)*prefactor*associated_legendre(x, l, m)*cos(m*phi);
511+
Y = (-1_wp)**m*sqrt(2_wp)*prefactor*associated_legendre(x, l, m)*cos(m*phi);
512512
end if
513513
514514
end function spherical_harmonic_func
@@ -522,8 +522,8 @@ contains
522522
recursive function associated_legendre(x, l, m) result(P)
523523
524524
integer, intent(in) :: l, m
525-
real(kind(0d0)), intent(in) :: x
526-
real(kind(0d0)) :: P
525+
real(wp), intent(in) :: x
526+
real(wp) :: P
527527
528528
if (m <= 0 .and. l <= 0) then
529529
P = 1;

src/common/m_mpi_common.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ contains
221221
222222
implicit none
223223
integer, intent(in) :: counts ! Array of vector lengths for each process
224-
real(kind(0d0)), intent(in), dimension(counts) :: my_vector ! Input vector on each process
224+
real(wp), intent(in), dimension(counts) :: my_vector ! Input vector on each process
225225
integer, intent(in) :: root ! Rank of the root process
226-
real(kind(0d0)), allocatable, intent(out) :: gathered_vector(:) ! Gathered vector on the root process
226+
real(wp), allocatable, intent(out) :: gathered_vector(:) ! Gathered vector on the root process
227227
228228
integer :: i, offset, ierr
229229
integer, allocatable :: recounts(:), displs(:)

src/common/m_phase_change.fpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ contains
8585
subroutine s_infinite_relaxation_k(q_cons_vf)
8686

8787
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
88-
real(kind(0.0_wp)) :: pS, pSOV, pSSL !< equilibrium pressure for mixture, overheated vapor, and subcooled liquid
89-
real(kind(0.0_wp)) :: TS, TSOV, TSSL, TSatOV, TSatSL !< equilibrium temperature for mixture, overheated vapor, and subcooled liquid. Saturation Temperatures at overheated vapor and subcooled liquid
90-
real(kind(0.0_wp)) :: rhoe, dynE, rhos !< total internal energy, kinetic energy, and total entropy
91-
real(kind(0.0_wp)) :: rho, rM, m1, m2, MCT !< total density, total reacting mass, individual reacting masses
92-
real(kind(0.0_wp)) :: TvF !< total volume fraction
88+
real(wp) :: pS, pSOV, pSSL !< equilibrium pressure for mixture, overheated vapor, and subcooled liquid
89+
real(wp) :: TS, TSOV, TSSL, TSatOV, TSatSL !< equilibrium temperature for mixture, overheated vapor, and subcooled liquid. Saturation Temperatures at overheated vapor and subcooled liquid
90+
real(wp) :: rhoe, dynE, rhos !< total internal energy, kinetic energy, and total entropy
91+
real(wp) :: rho, rM, m1, m2, MCT !< total density, total reacting mass, individual reacting masses
92+
real(wp) :: TvF !< total volume fraction
9393

9494
!$acc declare create(pS, pSOV, pSSL, TS, TSOV, TSatOV, TSatSL, TSSL, rhoe, dynE, rhos, rho, rM, m1, m2, MCT, TvF)
9595

@@ -295,13 +295,13 @@ contains
295295

296296
! initializing variables
297297
integer, intent(in) :: j, k, l, MFL
298-
real(kind(0.0_wp)), intent(out) :: pS
299-
real(kind(0.0_wp)), dimension(num_fluids), intent(out) :: p_infpT
300-
real(kind(0.0_wp)), intent(in) :: rM
298+
real(wp), intent(out) :: pS
299+
real(wp), dimension(num_fluids), intent(out) :: p_infpT
300+
real(wp), intent(in) :: rM
301301
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
302-
real(kind(0.0_wp)), intent(in) :: rhoe
303-
real(kind(0.0_wp)), intent(out) :: TS
304-
real(kind(0.0_wp)) :: gp, gpp, hp, pO, mCP, mQ !< variables for the Newton Solver
302+
real(wp), intent(in) :: rhoe
303+
real(wp), intent(out) :: TS
304+
real(wp) :: gp, gpp, hp, pO, mCP, mQ !< variables for the Newton Solver
305305

306306
integer :: i, ns !< generic loop iterators
307307

@@ -399,17 +399,17 @@ contains
399399
#endif
400400

401401
integer, intent(in) :: j, k, l
402-
real(kind(0.0_wp)), intent(inout) :: pS
403-
real(kind(0.0_wp)), dimension(num_fluids), intent(in) :: p_infpT
404-
real(kind(0.0_wp)), intent(in) :: rhoe
402+
real(wp), intent(inout) :: pS
403+
real(wp), dimension(num_fluids), intent(in) :: p_infpT
404+
real(wp), intent(in) :: rhoe
405405
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
406-
real(kind(0.0_wp)), intent(inout) :: TS
406+
real(wp), intent(inout) :: TS
407407

408-
real(kind(0.0_wp)), dimension(num_fluids) :: p_infpTg !< stiffness for the participating fluids for pTg-equilibrium
409-
real(kind(0.0_wp)), dimension(2, 2) :: Jac, InvJac, TJac !< matrices for the Newton Solver
410-
real(kind(0.0_wp)), dimension(2) :: R2D, DeltamP !< residual and correction array
411-
real(kind(0.0_wp)) :: Om ! underrelaxation factor
412-
real(kind(0.0_wp)) :: mCP, mCPD, mCVGP, mCVGP2, mQ, mQD ! auxiliary variables for the pTg-solver
408+
real(wp), dimension(num_fluids) :: p_infpTg !< stiffness for the participating fluids for pTg-equilibrium
409+
real(wp), dimension(2, 2) :: Jac, InvJac, TJac !< matrices for the Newton Solver
410+
real(wp), dimension(2) :: R2D, DeltamP !< residual and correction array
411+
real(wp) :: Om ! underrelaxation factor
412+
real(wp) :: mCP, mCPD, mCVGP, mCVGP2, mQ, mQD ! auxiliary variables for the pTg-solver
413413

414414
!< Generic loop iterators
415415
integer :: i, ns
@@ -525,9 +525,9 @@ contains
525525
526526
!> @name variables for the correction of the reacting partial densities
527527
!> @{
528-
real(kind(0.0_wp)), intent(out) :: MCT
528+
real(wp), intent(out) :: MCT
529529
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
530-
real(kind(0.0_wp)), intent(inout) :: rM
530+
real(wp), intent(inout) :: rM
531531
integer, intent(in) :: j, k, l
532532
!> @}
533533
if (rM < 0.0_wp) then
@@ -586,15 +586,15 @@ contains
586586
!$acc routine seq
587587
#endif
588588
589-
real(kind(0.0_wp)), dimension(2, 2), intent(out) :: InvJac
589+
real(wp), dimension(2, 2), intent(out) :: InvJac
590590
integer, intent(in) :: j
591-
real(kind(0.0_wp)), dimension(2, 2), intent(out) :: Jac
591+
real(wp), dimension(2, 2), intent(out) :: Jac
592592
integer, intent(in) :: k, l
593-
real(kind(0.0_wp)), intent(in) :: mCPD, mCVGP, mCVGP2, pS
593+
real(wp), intent(in) :: mCPD, mCVGP, mCVGP2, pS
594594
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
595-
real(kind(0.0_wp)), dimension(2, 2), intent(out) :: TJac
595+
real(wp), dimension(2, 2), intent(out) :: TJac
596596
597-
real(kind(0.0_wp)) :: ml, mT, TS, dFdT, dTdm, dTdp ! mass of the reacting fluid, total reacting mass, and auxiliary variables
597+
real(wp) :: ml, mT, TS, dFdT, dTdm, dTdp ! mass of the reacting fluid, total reacting mass, and auxiliary variables
598598
599599
! mass of the reacting liquid
600600
ml = q_cons_vf(lp + contxb - 1)%sf(j, k, l)
@@ -694,12 +694,12 @@ contains
694694
#endif
695695
696696
integer, intent(in) :: j, k, l
697-
real(kind(0.0_wp)), intent(in) :: mCPD, mCVGP, mQD
697+
real(wp), intent(in) :: mCPD, mCVGP, mQD
698698
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
699-
real(kind(0.0_wp)), intent(in) :: pS, rhoe
700-
real(kind(0.0_wp)), dimension(2), intent(out) :: R2D
699+
real(wp), intent(in) :: pS, rhoe
700+
real(wp), dimension(2), intent(out) :: R2D
701701
702-
real(kind(0.0_wp)) :: ml, mT, TS !< mass of the reacting liquid, total reacting mass, equilibrium temperature
702+
real(wp) :: ml, mT, TS !< mass of the reacting liquid, total reacting mass, equilibrium temperature
703703
704704
! mass of the reacting liquid
705705
ml = q_cons_vf(lp + contxb - 1)%sf(j, k, l)
@@ -744,11 +744,11 @@ contains
744744
!$acc routine seq
745745
#endif
746746
747-
real(kind(0.0_wp)), intent(in) :: pSat
748-
real(kind(0.0_wp)), intent(out) :: TSat
749-
real(kind(0.0_wp)), intent(in) :: TSIn
747+
real(wp), intent(in) :: pSat
748+
real(wp), intent(out) :: TSat
749+
real(wp), intent(in) :: TSIn
750750
751-
real(kind(0.0_wp)) :: dFdT, FT, Om !< auxiliary variables
751+
real(wp) :: dFdT, FT, Om !< auxiliary variables
752752
753753
! Generic loop iterators
754754
integer :: ns

src/post_process/m_data_output.fpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ contains
10381038
allocate (x_d1(m*n))
10391039
allocate (y_d1(m*n))
10401040
counter = 0
1041-
maxalph_loc = 0d0
1041+
maxalph_loc = 0_wp
10421042
do k = 0, p
10431043
do j = 0, n
10441044
do i = 0, m
@@ -1060,7 +1060,7 @@ contains
10601060
cent = 0
10611061
end if
10621062
1063-
thres = 0.9d0*maxalph_glb
1063+
thres = 0.9_wp*maxalph_glb
10641064
do k = 0, n
10651065
do j = 0, m
10661066
axp = q_prim_vf(E_idx + 2)%sf(j + 1, k, cent)
@@ -1110,7 +1110,7 @@ contains
11101110
x_td(i), y_td(i), size(x_td)
11111111
else
11121112
write (211, '(F12.9,1X,F12.9,1X,F3.1)') &
1113-
x_td(i), y_td(i), 0d0
1113+
x_td(i), y_td(i), 0_wp
11141114
end if
11151115
end do
11161116
end if
@@ -1119,40 +1119,40 @@ contains
11191119
11201120
subroutine s_write_energy_data_file(q_prim_vf, q_cons_vf)
11211121
type(scalar_field), dimension(sys_size), intent(IN) :: q_prim_vf, q_cons_vf
1122-
real(kind(0d0)) :: Elk, Egk, Elp, Egint, Vb, Vl, pres_av, Et
1123-
real(kind(0d0)) :: rho, pres, dV, tmp, gamma, pi_inf, MaxMa, MaxMa_glb, maxvel, c, Ma, H
1124-
real(kind(0d0)), dimension(num_dims) :: vel
1125-
real(kind(0d0)), dimension(num_fluids) :: gammas, pi_infs, adv
1122+
real(wp) :: Elk, Egk, Elp, Egint, Vb, Vl, pres_av, Et
1123+
real(wp) :: rho, pres, dV, tmp, gamma, pi_inf, MaxMa, MaxMa_glb, maxvel, c, Ma, H
1124+
real(wp), dimension(num_dims) :: vel
1125+
real(wp), dimension(num_fluids) :: gammas, pi_infs, adv
11261126
integer :: i, j, k, l, s !looping indices
11271127
integer :: ierr, counter, root !< number of data points extracted to fit shape to SH perturbations
11281128
1129-
Egk = 0d0
1130-
Elp = 0d0
1131-
Egint = 0d0
1132-
Vb = 0d0
1133-
maxvel = 0d0
1134-
MaxMa = 0d0
1135-
Vl = 0d0
1136-
Elk = 0d0
1137-
Et = 0d0
1138-
Vb = 0d0
1139-
dV = 0d0
1140-
pres_av = 0d0
1141-
pres = 0d0
1129+
Egk = 0_wp
1130+
Elp = 0_wp
1131+
Egint = 0_wp
1132+
Vb = 0_wp
1133+
maxvel = 0_wp
1134+
MaxMa = 0_wp
1135+
Vl = 0_wp
1136+
Elk = 0_wp
1137+
Et = 0_wp
1138+
Vb = 0_wp
1139+
dV = 0_wp
1140+
pres_av = 0_wp
1141+
pres = 0_wp
11421142
do k = 0, p
11431143
do j = 0, n
11441144
do i = 0, m
1145-
pres = 0d0
1145+
pres = 0_wp
11461146
dV = dx(i)*dy(j)*dz(k)
1147-
rho = 0d0
1148-
gamma = 0d0
1149-
pi_inf = 0d0
1147+
rho = 0_wp
1148+
gamma = 0_wp
1149+
pi_inf = 0_wp
11501150
pres = q_prim_vf(E_idx)%sf(i, j, k)
11511151
Egint = Egint + q_prim_vf(E_idx + 2)%sf(i, j, k)*(fluid_pp(2)%gamma*pres)*dV
11521152
do s = 1, num_dims
11531153
vel(s) = q_prim_vf(num_fluids + s)%sf(i, j, k)
1154-
Egk = Egk + 0.5d0*q_prim_vf(E_idx + 2)%sf(i, j, k)*q_prim_vf(2)%sf(i, j, k)*vel(s)*vel(s)*dV
1155-
Elk = Elk + 0.5d0*q_prim_vf(E_idx + 1)%sf(i, j, k)*q_prim_vf(1)%sf(i, j, k)*vel(s)*vel(s)*dV
1154+
Egk = Egk + 0.5_wp*q_prim_vf(E_idx + 2)%sf(i, j, k)*q_prim_vf(2)%sf(i, j, k)*vel(s)*vel(s)*dV
1155+
Elk = Elk + 0.5_wp*q_prim_vf(E_idx + 1)%sf(i, j, k)*q_prim_vf(1)%sf(i, j, k)*vel(s)*vel(s)*dV
11561156
if (abs(vel(s)) > maxvel) then
11571157
maxvel = abs(vel(s))
11581158
end if
@@ -1164,14 +1164,14 @@ contains
11641164
rho = rho + adv(l)*q_prim_vf(l)%sf(i, j, k)
11651165
end do
11661166
1167-
H = ((gamma + 1d0)*pres + pi_inf)/rho
1167+
H = ((gamma + 1_wp)*pres + pi_inf)/rho
11681168
11691169
call s_compute_speed_of_sound(pres, rho, &
11701170
gamma, pi_inf, &
1171-
H, adv, 0d0, 0d0, c)
1171+
H, adv, 0_wp, 0_wp, c)
11721172
11731173
Ma = maxvel/c
1174-
if (Ma > MaxMa .and. adv(1) > 1.0d0 - 1.0d-10) then
1174+
if (Ma > MaxMa .and. adv(1) > 1.0_wp - 1.0d-10) then
11751175
MaxMa = Ma
11761176
end if
11771177
Vl = Vl + adv(1)*dV

src/pre_process/m_assign_variables.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ contains
507507
theta = atan2(y_cc(k), x_cc(j))
508508
phi = atan2(sqrt(x_cc(j)**2 + y_cc(k)**2), z_cc(l))
509509
!spherical coord, assuming Rmax=1
510-
xi_sph = (rcoord**3 - R0ref**3 + 1d0)**(1d0/3d0)
510+
xi_sph = (rcoord**3 - R0ref**3 + 1_wp)**(1_wp/3_wp)
511511
xi_cart(1) = xi_sph*sin(phi)*cos(theta)
512512
xi_cart(2) = xi_sph*sin(phi)*sin(theta)
513513
xi_cart(3) = xi_sph*cos(phi)
@@ -520,7 +520,7 @@ contains
520520
! assigning the reference map to the q_prim vector field
521521
do i = 1, num_dims
522522
q_prim_vf(i + xibeg - 1)%sf(j, k, l) = eta*xi_cart(i) + &
523-
(1d0 - eta)*orig_prim_vf(i + xibeg - 1)
523+
(1_wp - eta)*orig_prim_vf(i + xibeg - 1)
524524
end do
525525
526526
end if

src/pre_process/m_patches.fpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,9 @@ contains
14121412
integer, intent(INOUT), dimension(0:m, 0:n, 0:p) :: patch_id_fp
14131413
type(scalar_field), dimension(1:sys_size) :: q_prim_vf
14141414
1415-
real(kind(0d0)) :: r, x_p, eps, phi
1416-
real(kind(0d0)), dimension(2:9) :: as, Ps
1417-
real(kind(0d0)) :: radius, x_centroid, y_centroid, z_centroid, eta, smooth_coeff
1415+
real(wp) :: r, x_p, eps, phi
1416+
real(wp), dimension(2:9) :: as, Ps
1417+
real(wp) :: radius, x_centroid, y_centroid, z_centroid, eta, smooth_coeff
14181418
logical :: non_axis_sym
14191419
14201420
integer :: i, j, k !< generic loop iterators
@@ -1485,7 +1485,7 @@ contains
14851485
if (patch_icpp(patch_id)%smoothen) then
14861486
eta = tanh(smooth_coeff/min(dx, dy, dz)* &
14871487
((r - as(2)*Ps(2) - as(3)*Ps(3) - as(4)*Ps(4) - as(5)*Ps(5) - as(6)*Ps(6) - as(7)*Ps(7)) &
1488-
- radius))*(-0.5d0) + 0.5d0
1488+
- radius))*(-0.5_wp) + 0.5_wp
14891489
end if
14901490

14911491
call s_assign_patch_primitive_variables(patch_id, i, j, k, &
@@ -1502,7 +1502,7 @@ contains
15021502

15031503
if (non_axis_sym) then
15041504
phi = atan(((y_cc(j) - y_centroid) + eps)/((x_cc(i) - x_centroid) + eps))
1505-
r = dsqrt((x_cc(i) - x_centroid)**2d0 + (y_cc(j) - y_centroid)**2d0) + eps
1505+
r = dsqrt((x_cc(i) - x_centroid)**2_wp + (y_cc(j) - y_centroid)**2_wp) + eps
15061506
x_p = (eps)/r
15071507
Ps(2) = spherical_harmonic_func(x_p, phi, 2, 2)
15081508
Ps(3) = spherical_harmonic_func(x_p, phi, 3, 3)
@@ -1513,7 +1513,7 @@ contains
15131513
Ps(8) = spherical_harmonic_func(x_p, phi, 8, 8)
15141514
Ps(9) = spherical_harmonic_func(x_p, phi, 9, 9)
15151515
else
1516-
r = dsqrt((x_cc(i) - x_centroid)**2d0 + (y_cc(j) - y_centroid)**2d0) + eps
1516+
r = dsqrt((x_cc(i) - x_centroid)**2_wp + (y_cc(j) - y_centroid)**2_wp) + eps
15171517
x_p = abs(x_cc(i) - x_centroid + eps)/r
15181518
Ps(2) = unassociated_legendre(x_p, 2)
15191519
Ps(3) = unassociated_legendre(x_p, 3)

src/simulation/m_data_output.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,15 +932,15 @@ contains
932932
subroutine s_write_com_files(t_step, c_mass) ! -------------------
933933

934934
integer, intent(in) :: t_step
935-
real(kind(0d0)), dimension(num_fluids, 5), intent(in) :: c_mass
935+
real(wp), dimension(num_fluids, 5), intent(in) :: c_mass
936936
integer :: i, j !< Generic loop iterator
937-
real(kind(0d0)) :: nondim_time !< Non-dimensional time
937+
real(wp) :: nondim_time !< Non-dimensional time
938938

939939
! Non-dimensional time calculation
940940
if (t_step_old /= dflt_int) then
941-
nondim_time = real(t_step + t_step_old, kind(0d0))*dt
941+
nondim_time = real(t_step + t_step_old, wp)*dt
942942
else
943-
nondim_time = real(t_step, kind(0d0))*dt
943+
nondim_time = real(t_step, wp)*dt
944944
end if
945945

946946
if (proc_rank == 0) then

src/simulation/m_derived_variables.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ end subroutine s_derive_acceleration_component
326326
!! @param c_m Mass,x-location,y-location,z-location
327327
subroutine s_derive_center_of_mass(q_vf, c_m)
328328
type(scalar_field), dimension(sys_size), intent(IN) :: q_vf
329-
real(kind(0d0)), dimension(1:num_fluids, 1:5), intent(INOUT) :: c_m
329+
real(wp), dimension(1:num_fluids, 1:5), intent(INOUT) :: c_m
330330
integer :: i, j, k, l !< Generic loop iterators
331-
real(kind(0d0)) :: tmp, tmp_out !< Temporary variable to store quantity for mpi_allreduce
332-
real(kind(0d0)) :: dV !< Discrete cell volume
331+
real(wp) :: tmp, tmp_out !< Temporary variable to store quantity for mpi_allreduce
332+
real(wp) :: dV !< Discrete cell volume
333333

334334
do i = 1, num_fluids
335335
do j = 1, 5
336-
c_m(i, j) = 0.0d0
336+
c_m(i, j) = 0.0_wp
337337
end do
338338
end do
339339

0 commit comments

Comments
 (0)