diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index d425d449b..4d519ae59 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -29,4 +29,11 @@ jobs: run: pip install fortitude-lint ansi2txt - name: Lint the source code - run: fortitude check --ignore=E001,S001,S101,M011,F001,S041,T001 ./src/*/* || true + run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101 ./src/** || true + + - name: Ensure kind is specified + run: fortitude check --file-extensions=f90,fpp,fypp --select=P001 ./src/** + + - name: No double precision intrinsics + run: | + ! grep -iR 'dexp\|dlog\|dble\|dabs\|double\ precision\|real(8)\|real(4)\|dprod\|dmin\|dmax\|dfloat\|dreal\|dcos\|dsin\|dtan\|dsign\|dtanh\|dsinh\|dcosh\|\.d0\|\dd0' --exclude-dir=syscheck ./src/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec6adf5ae..4bf8920ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,7 @@ jobs: matrix: os: ['ubuntu', 'macos'] mpi: ['mpi'] + precision: [''] debug: ['debug', 'no-debug'] intel: [true, false] exclude: @@ -35,6 +36,7 @@ jobs: include: - os: ubuntu mpi: no-mpi + precision: single debug: no-debug intel: false @@ -86,7 +88,7 @@ jobs: - name: Build run: | if [ '${{ matrix.intel }}' == 'true' ]; then . /opt/intel/oneapi/setvars.sh; fi - /bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} + /bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }} - name: Test run: | @@ -140,4 +142,4 @@ jobs: if: always() with: name: logs-${{ strategy.job-index }}-${{ matrix.device }} - path: test-${{ matrix.device }}.out + path: test-${{ matrix.device }}.out \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 345e0c6a2..a5835bd24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ option(MFC_POST_PROCESS "Build post_process" OFF option(MFC_SYSCHECK "Build syscheck" OFF) option(MFC_DOCUMENTATION "Build documentation" OFF) option(MFC_ALL "Build everything" OFF) +option(MFC_SINGLE_PRECISION "Build single precision" OFF) if (MFC_ALL) set(MFC_PRE_PROCESS ON FORCE) @@ -34,6 +35,12 @@ if (MFC_ALL) set(MFC_DOCUMENTATION ON FORCE) endif() +if (MFC_SINGLE_PRECISION) + add_compile_definitions(MFC_SINGLE_PRECISION) +else() + add_compile_definitions(MFC_DOUBLE_PRECISION) +endif() + # CMake Library Imports diff --git a/README.md b/README.md index 6f89bbb73..867dfe307 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ They are organized below. Just click the drop-downs! * \>66K AMD GPUs on the first exascale computer, [OLCF Frontier](https://www.olcf.ornl.gov/frontier/) (AMD MI250X-based) * Near compute roofline behavior * RDMA (remote data memory access; GPU-GPU direct communication) via GPU-aware MPI on NVIDIA (CUDA-aware MPI) and AMD GPU systems +* Optional single-precision computation and storage
diff --git a/docs/documentation/getting-started.md b/docs/documentation/getting-started.md index 5227ec77e..3245df892 100644 --- a/docs/documentation/getting-started.md +++ b/docs/documentation/getting-started.md @@ -126,6 +126,7 @@ MFC can be built with support for various (compile-time) features: | **Debug** | `--debug` | `--no-debug` | Off | Requests the compiler build MFC in debug mode. | | **GCov** | `--gcov` | `--no-gcov` | Off | Builds MFC with coverage flags on. | | **Unified Memory** | `--unified` | `--no-unified` | Off | Builds MFC with unified CPU/GPU memory (GH-200 superchip only) | +| **Single** | `--single` | `--no-single` | Off | Builds MFC in single precision _⚠️ The `--gpu` option requires that your compiler supports OpenACC for Fortran for your target GPU architecture._ diff --git a/misc/m_silo_proxy.f90 b/misc/m_silo_proxy.f90 index 2f3ca4d8f..c2e57d542 100755 --- a/misc/m_silo_proxy.f90 +++ b/misc/m_silo_proxy.f90 @@ -189,9 +189,9 @@ function DBPUTQM(dbid, name, lname, xname, lxname, yname, lyname, & !! - integer, intent(IN) :: lyname character(LEN=*), intent(IN) :: zname integer, intent(IN) :: lzname - real(kind(0d0)), dimension(:), intent(IN) :: x - real(kind(0d0)), dimension(:), intent(IN) :: y - real(kind(0d0)), dimension(:), intent(IN) :: z + real(wp), dimension(:), intent(IN) :: x + real(wp), dimension(:), intent(IN) :: y + real(wp), dimension(:), intent(IN) :: z integer, dimension(:), intent(IN) :: dims integer, intent(IN) :: ndims integer, intent(IN) :: datatype @@ -215,8 +215,8 @@ function DBPUTCURVE(dbid, curvename, lcurvename, xvals, yvals, & !! ---- integer, intent(IN) :: dbid character(LEN=*), intent(IN) :: curvename integer, intent(IN) :: lcurvename - real(kind(0d0)), dimension(:), intent(IN) :: xvals - real(kind(0d0)), dimension(:), intent(IN) :: yvals + real(wp), dimension(:), intent(IN) :: xvals + real(wp), dimension(:), intent(IN) :: yvals integer, intent(IN) :: datatype integer, intent(IN) :: npoints integer, intent(IN) :: optlist_id @@ -264,7 +264,7 @@ function DBPUTQV1(dbid, name, lname, meshname, lmeshname, var, & !! ---- integer, intent(IN) :: lname character(LEN=*), intent(IN) :: meshname integer, intent(IN) :: lmeshname - real(kind(0d0)), dimension(:, :, :), intent(IN) :: var + real(wp), dimension(:, :, :), intent(IN) :: var integer, dimension(:), intent(IN) :: dims integer, intent(IN) :: ndims integer, intent(IN) :: mixvar diff --git a/src/common/include/macros.fpp b/src/common/include/macros.fpp index c1f447a26..cdaa48ff5 100644 --- a/src/common/include/macros.fpp +++ b/src/common/include/macros.fpp @@ -92,8 +92,8 @@ end if #:enddef -#define t_vec3 real(kind(0d0)), dimension(1:3) -#define t_mat4x4 real(kind(0d0)), dimension(1:4,1:4) +#define t_vec3 real(wp), dimension(1:3) +#define t_mat4x4 real(wp), dimension(1:4,1:4) #:def ASSERT(predicate, message = None) if (.not. (${predicate}$)) then diff --git a/src/common/m_checker_common.fpp b/src/common/m_checker_common.fpp index 3623fabba..e10bc90af 100644 --- a/src/common/m_checker_common.fpp +++ b/src/common/m_checker_common.fpp @@ -18,7 +18,7 @@ module m_checker_common implicit none - private; public :: s_check_inputs_common + private; public :: s_check_inputs_common, wp contains @@ -61,7 +61,7 @@ contains !! Called by s_check_inputs_common for simulation and post-processing subroutine s_check_inputs_time_stepping if (cfl_dt) then - @:PROHIBIT(cfl_target < 0 .or. cfl_target > 1d0) + @:PROHIBIT(cfl_target < 0 .or. cfl_target > 1._wp) @:PROHIBIT(t_stop <= 0) @:PROHIBIT(t_save <= 0) @:PROHIBIT(t_save > t_stop) @@ -144,10 +144,10 @@ contains @:PROHIBIT(relax .and. model_eqns /= 3, "phase change requires model_eqns = 3") @:PROHIBIT(relax .and. relax_model < 0, "relax_model must be in between 0 and 6") @:PROHIBIT(relax .and. relax_model > 6, "relax_model must be in between 0 and 6") - @:PROHIBIT(relax .and. palpha_eps <= 0d0, "palpha_eps must be positive") - @:PROHIBIT(relax .and. palpha_eps >= 1d0, "palpha_eps must be less than 1") - @:PROHIBIT(relax .and. ptgalpha_eps <= 0d0, "ptgalpha_eps must be positive") - @:PROHIBIT(relax .and. ptgalpha_eps >= 1d0, "ptgalpha_eps must be less than 1") + @:PROHIBIT(relax .and. palpha_eps <= 0._wp, "palpha_eps must be positive") + @:PROHIBIT(relax .and. palpha_eps >= 1._wp, "palpha_eps must be less than 1") + @:PROHIBIT(relax .and. ptgalpha_eps <= 0._wp, "ptgalpha_eps must be positive") + @:PROHIBIT(relax .and. ptgalpha_eps >= 1._wp, "ptgalpha_eps must be less than 1") @:PROHIBIT((.not. relax) .and. & ((relax_model /= dflt_int) .or. (.not. f_is_default(palpha_eps)) .or. (.not. f_is_default(ptgalpha_eps))), & "relax is not set as true, but other phase change parameters have been modified. " // & @@ -262,27 +262,27 @@ contains do i = 1, num_fluids call s_int_to_str(i, iStr) - @:PROHIBIT(.not. f_is_default(fluid_pp(i)%gamma) .and. fluid_pp(i)%gamma <= 0d0, & + @:PROHIBIT(.not. f_is_default(fluid_pp(i)%gamma) .and. fluid_pp(i)%gamma <= 0._wp, & "fluid_pp("//trim(iStr)//")%gamma must be positive") @:PROHIBIT(model_eqns == 1 .and. (.not. f_is_default(fluid_pp(i)%gamma)), & "model_eqns = 1 does not support fluid_pp("//trim(iStr)//")%gamma") - @:PROHIBIT((i <= num_fluids + bub_fac .and. fluid_pp(i)%gamma <= 0d0) .or. & + @:PROHIBIT((i <= num_fluids + bub_fac .and. fluid_pp(i)%gamma <= 0._wp) .or. & (i > num_fluids + bub_fac .and. (.not. f_is_default(fluid_pp(i)%gamma))), & "for fluid_pp("//trim(iStr)//")%gamma") - @:PROHIBIT(.not. f_is_default(fluid_pp(i)%pi_inf) .and. fluid_pp(i)%pi_inf < 0d0, & + @:PROHIBIT(.not. f_is_default(fluid_pp(i)%pi_inf) .and. fluid_pp(i)%pi_inf < 0._wp, & "fluid_pp("//trim(iStr)//")%pi_inf must be non-negative") @:PROHIBIT(model_eqns == 1 .and. (.not. f_is_default(fluid_pp(i)%pi_inf)), & "model_eqns = 1 does not support fluid_pp("//trim(iStr)//")%pi_inf") - @:PROHIBIT((i <= num_fluids + bub_fac .and. fluid_pp(i)%pi_inf < 0d0) .or. & + @:PROHIBIT((i <= num_fluids + bub_fac .and. fluid_pp(i)%pi_inf < 0._wp) .or. & (i > num_fluids + bub_fac .and. (.not. f_is_default(fluid_pp(i)%pi_inf))), & "for fluid_pp("//trim(iStr)//")%pi_inf") - @:PROHIBIT(fluid_pp(i)%cv < 0d0, & + @:PROHIBIT(fluid_pp(i)%cv < 0._wp, & "fluid_pp("//trim(iStr)//")%cv must be positive") end do end subroutine s_check_inputs_stiffened_eos @@ -293,7 +293,7 @@ contains integer :: i - @:PROHIBIT(surface_tension .and. sigma < 0d0, & + @:PROHIBIT(surface_tension .and. sigma < 0._wp, & "sigma must be greater than or equal to zero") @:PROHIBIT(surface_tension .and. sigma == dflt_real, & @@ -321,9 +321,9 @@ contains !! Called by s_check_inputs_common for all three stages subroutine s_check_inputs_moving_bc #:for X, VB2, VB3 in [('x', 'vb2', 'vb3'), ('y', 'vb3', 'vb1'), ('z', 'vb1', 'vb2')] - if (any((/bc_${X}$%vb1, bc_${X}$%vb2, bc_${X}$%vb3/) /= 0d0)) then + if (any((/bc_${X}$%vb1, bc_${X}$%vb2, bc_${X}$%vb3/) /= 0._wp)) then if (bc_${X}$%beg == -15) then - if (any((/bc_${X}$%${VB2}$, bc_${X}$%${VB3}$/) /= 0d0)) then + if (any((/bc_${X}$%${VB2}$, bc_${X}$%${VB3}$/) /= 0._wp)) then call s_mpi_abort("bc_${X}$%beg must be -15 if "// & "bc_${X}$%${VB2}$ or bc_${X}$%${VB3}$ "// & "is set. Exiting ...") @@ -336,9 +336,9 @@ contains #:endfor #:for X, VE2, VE3 in [('x', 've2', 've3'), ('y', 've3', 've1'), ('z', 've1', 've2')] - if (any((/bc_${X}$%ve1, bc_${X}$%ve2, bc_${X}$%ve3/) /= 0d0)) then + if (any((/bc_${X}$%ve1, bc_${X}$%ve2, bc_${X}$%ve3/) /= 0._wp)) then if (bc_${X}$%end == -15) then - if (any((/bc_${X}$%${VE2}$, bc_${X}$%${VE3}$/) /= 0d0)) then + if (any((/bc_${X}$%${VE2}$, bc_${X}$%${VE3}$/) /= 0._wp)) then call s_mpi_abort("bc_${X}$%end must be -15 if "// & "bc_${X}$%${VE2}$ or bc_${X}$%${VE3}$ "// & "is set. Exiting ...") diff --git a/src/common/m_constants.fpp b/src/common/m_constants.fpp index 74b144588..2705df922 100644 --- a/src/common/m_constants.fpp +++ b/src/common/m_constants.fpp @@ -4,13 +4,15 @@ module m_constants + use m_precision_select + character, parameter :: dflt_char = ' ' !< Default string value - real(kind(0d0)), parameter :: dflt_real = -1d6 !< Default real value - real(kind(0d0)), parameter :: sgm_eps = 1d-16 !< Segmentation tolerance - real(kind(0d0)), parameter :: small_alf = 1d-11 !< Small alf tolerance - real(kind(0d0)), parameter :: pi = 3.141592653589793d0 !< Pi - real(kind(0d0)), parameter :: verysmall = 1.d-12 !< Very small number + real(wp), parameter :: dflt_real = -1e6_wp !< Default real value + real(wp), parameter :: sgm_eps = 1e-16_wp !< Segmentation tolerance + real(wp), parameter :: small_alf = 1e-11_wp !< Small alf tolerance + real(wp), parameter :: pi = 3.141592653589793_wp !< Pi + real(wp), parameter :: verysmall = 1.e-12_wp !< Very small number integer, parameter :: num_stcls_min = 5 !< Minimum # of stencils integer, parameter :: path_len = 400 !< Maximum path length @@ -22,21 +24,21 @@ module m_constants integer, parameter :: num_patches_max = 10 integer, parameter :: pathlen_max = 400 integer, parameter :: nnode = 4 !< Number of QBMM nodes - real(kind(0d0)), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes - real(kind(0d0)), parameter :: acoustic_spatial_support_width = 2.5d0 !< Spatial support width of acoustic source, used in s_source_spatial - real(kind(0d0)), parameter :: dflt_vcfl_dt = 100d0 !< value of vcfl_dt when viscosity is off for computing adaptive timestep size - real(kind(0d0)), parameter :: broadband_spectral_level_constant = 20d0 !< The constant to scale the spectral level at the lower frequency bound - real(kind(0d0)), parameter :: broadband_spectral_level_growth_rate = 10d0 !< The spectral level constant to correct the magnitude at each frqeuency to ensure the source is overall broadband + real(wp), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes + real(wp), parameter :: acoustic_spatial_support_width = 2.5_wp !< Spatial support width of acoustic source, used in s_source_spatial + real(wp), parameter :: dflt_vcfl_dt = 100._wp !< value of vcfl_dt when viscosity is off for computing adaptive timestep size + real(wp), parameter :: broadband_spectral_level_constant = 20._wp !< The constant to scale the spectral level at the lower frequency bound + real(wp), parameter :: broadband_spectral_level_growth_rate = 10._wp !< The spectral level constant to correct the magnitude at each frqeuency to ensure the source is overall broadband ! IBM+STL interpolation constants integer, parameter :: Ifactor_2D = 50 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 2D models integer, parameter :: Ifactor_3D = 5 !< Multiple factor of the ratio (edge to cell width) for interpolation along edges for 3D models integer, parameter :: Ifactor_bary_3D = 20 !< Multiple factor of the ratio (triangle area to cell face area) for interpolation on triangle facets for 3D models integer, parameter :: num_ray = 20 !< Default number of rays traced per cell - real(kind(0d0)), parameter :: ray_tracing_threshold = 0.9d0 !< Threshold above which the cell is marked as the model patch - real(kind(0d0)), parameter :: threshold_vector_zero = 1d-10 !< Threshold to treat the component of a vector to be zero - real(kind(0d0)), parameter :: threshold_edge_zero = 1d-10 !< Threshold to treat two edges to be overlapped - real(kind(0d0)), parameter :: threshold_bary = 1d-1 !< Threshold to interpolate a barycentric facet - real(kind(0d0)), parameter :: initial_distance_buffer = 1d12 !< Initialized levelset distance for the shortest path pair algorithm + real(wp), parameter :: ray_tracing_threshold = 0.9_wp !< Threshold above which the cell is marked as the model patch + real(wp), parameter :: threshold_vector_zero = 1e-10 !< Threshold to treat the component of a vector to be zero + real(wp), parameter :: threshold_edge_zero = 1e-10 !< Threshold to treat two edges to be overlapped + real(wp), parameter :: threshold_bary = 1e-1 !< Threshold to interpolate a barycentric facet + real(wp), parameter :: initial_distance_buffer = 1e12_wp !< Initialized levelset distance for the shortest path pair algorithm end module m_constants diff --git a/src/common/m_delay_file_access.f90 b/src/common/m_delay_file_access.f90 index 54dd3edba..df8b368dc 100644 --- a/src/common/m_delay_file_access.f90 +++ b/src/common/m_delay_file_access.f90 @@ -1,4 +1,5 @@ module m_delay_file_access + use m_precision_select implicit none private @@ -14,7 +15,7 @@ subroutine DelayFileAccess(ProcessRank) integer, intent(in) :: ProcessRank integer :: iDelay, nFileAccessDelayIterations - real(kind(0d0)) :: Number, Dummy + real(wp) :: Number, Dummy nFileAccessDelayIterations & = (ProcessRank/N_PROCESSES_FILE_ACCESS)*FILE_ACCESS_DELAY_UNIT diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 879a73c7f..7a021bdaa 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -10,23 +10,24 @@ module m_derived_types use m_constants !< Constants + use m_precision_select use m_thermochem, only: num_species implicit none !> Derived type adding the field position (fp) as an attribute type field_position - real(kind(0d0)), allocatable, dimension(:, :, :) :: fp !< Field position + real(wp), allocatable, dimension(:, :, :) :: fp !< Field position end type field_position !> Derived type annexing a scalar field (SF) type scalar_field - real(kind(0d0)), pointer, dimension(:, :, :) :: sf => null() + real(wp), pointer, dimension(:, :, :) :: sf => null() end type scalar_field !> Derived type for bubble variables pb and mv at quadrature nodes (qbmm) type pres_field - real(kind(0d0)), pointer, dimension(:, :, :, :, :) :: sf => null() + real(wp), pointer, dimension(:, :, :, :, :) :: sf => null() end type pres_field !> Derived type annexing an integer scalar field (SF) @@ -36,12 +37,12 @@ module m_derived_types !> Derived type for levelset type levelset_field - real(kind(0d0)), pointer, dimension(:, :, :, :) :: sf => null() + real(wp), pointer, dimension(:, :, :, :) :: sf => null() end type levelset_field !> Derived type for levelset norm type levelset_norm_field - real(kind(0d0)), pointer, dimension(:, :, :, :, :) :: sf => null() + real(wp), pointer, dimension(:, :, :, :, :) :: sf => null() end type levelset_norm_field type mpi_io_var @@ -73,22 +74,24 @@ module m_derived_types type int_bounds_info integer :: beg integer :: end - real(kind(0d0)) :: vb1 - real(kind(0d0)) :: vb2 - real(kind(0d0)) :: vb3 - real(kind(0d0)) :: ve1 - real(kind(0d0)) :: ve2 - real(kind(0d0)) :: ve3 - real(kind(0d0)) :: pres_in, pres_out - real(kind(0d0)), dimension(3) :: vel_in, vel_out - real(kind(0d0)), dimension(num_fluids_max) :: alpha_rho_in, alpha_in + + real(wp) :: vb1 + real(wp) :: vb2 + real(wp) :: vb3 + real(wp) :: ve1 + real(wp) :: ve2 + real(wp) :: ve3 + real(wp) :: pres_in, pres_out + real(wp), dimension(3) :: vel_in, vel_out + real(wp), dimension(num_fluids_max) :: alpha_rho_in, alpha_in logical :: grcbc_in, grcbc_out, grcbc_vel_out + end type int_bounds_info !> Derived type adding beginning (beg) and end bounds info as attributes type bounds_info - real(kind(0d0)) :: beg - real(kind(0d0)) :: end + real(wp) :: beg + real(wp) :: end end type bounds_info !> bounds for the bubble dynamic variables @@ -121,12 +124,12 @@ module m_derived_types integer :: spc !< !! Number of samples per cell to use when discretizing the STL object. - real(kind(0d0)) :: threshold !< + real(wp) :: threshold !< !! Threshold to turn on smoothen STL patch. end type ic_model_parameters type :: t_triangle - real(kind(0d0)), dimension(1:3, 1:3) :: v ! Vertices of the triangle + real(wp), dimension(1:3, 1:3) :: v ! Vertices of the triangle t_vec3 :: n ! Normal vector end type t_triangle @@ -153,22 +156,22 @@ module m_derived_types integer :: geometry !< Type of geometry for the patch - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid !< + real(wp) :: x_centroid, y_centroid, z_centroid !< !! Location of the geometric center, i.e. the centroid, of the patch. It !! is specified through its x-, y- and z-coordinates, respectively. - real(kind(0d0)) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths. - real(kind(0d0)) :: radius !< Dimensions of the patch. radius. + real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths. + real(wp) :: radius !< Dimensions of the patch. radius. - real(kind(0d0)), dimension(3) :: radii !< + real(wp), dimension(3) :: radii !< !! Vector indicating the various radii for the elliptical and ellipsoidal !! patch geometries. It is specified through its x-, y-, and z-components !! respectively. - real(kind(0d0)) :: epsilon, beta !< + real(wp) :: epsilon, beta !< !! The spherical harmonics eccentricity parameters. - real(kind(0d0)), dimension(3) :: normal !< + real(wp), dimension(3) :: normal !< !! Normal vector indicating the orientation of the patch. It is specified !! through its x-, y- and z-components, respectively. logical, dimension(0:num_patches_max - 1) :: alter_patch !< @@ -184,39 +187,39 @@ module m_derived_types integer :: smooth_patch_id !< !! Identity (id) of the patch with which current patch is to get smoothed - real(kind(0d0)) :: smooth_coeff !< - !! Smoothing coefficient (coeff) adminstrating the size of the stencil of + real(wp) :: smooth_coeff !< + !! Smoothing coefficient (coeff) for the size of the stencil of !! cells across which boundaries of the current patch will be smeared out - real(kind(0d0)), dimension(num_fluids_max) :: alpha_rho - real(kind(0d0)) :: rho - real(kind(0d0)), dimension(3) :: vel - real(kind(0d0)) :: pres - real(kind(0d0)), dimension(num_fluids_max) :: alpha - real(kind(0d0)) :: gamma - real(kind(0d0)) :: pi_inf !< - real(kind(0d0)) :: cv !< - real(kind(0d0)) :: qv !< - real(kind(0d0)) :: qvp !< + real(wp), dimension(num_fluids_max) :: alpha_rho + real(wp) :: rho + real(wp), dimension(3) :: vel + real(wp) :: pres + real(wp), dimension(num_fluids_max) :: alpha + real(wp) :: gamma + real(wp) :: pi_inf !< + real(wp) :: cv !< + real(wp) :: qv !< + real(wp) :: qvp !< !! Primitive variables associated with the patch. In order, these include !! the partial densities, density, velocity, pressure, volume fractions, !! specific heat ratio function and the liquid stiffness function. - real(kind(0d0)), dimension(6) :: tau_e + real(wp), dimension(6) :: tau_e !! Elastic stresses added to primitive variables if hypoelasticity = True - real(kind(0d0)) :: R0 !< Bubble size - real(kind(0d0)) :: V0 !< Bubble velocity + real(wp) :: R0 !< Bubble size + real(wp) :: V0 !< Bubble velocity - real(kind(0d0)) :: p0 !< Bubble size - real(kind(0d0)) :: m0 !< Bubble velocity + real(wp) :: p0 !< Bubble size + real(wp) :: m0 !< Bubble velocity integer :: hcid !! id for hard coded initial condition - real(kind(0d0)) :: cf_val !! color function value - real(kind(0d0)) :: Y(1:num_species) + real(wp) :: cf_val !! color function value + real(wp) :: Y(1:num_species) !! STL or OBJ model input parameter character(LEN=pathlen_max) :: model_filepath !< @@ -235,7 +238,7 @@ module m_derived_types integer :: model_spc !< !! Number of samples per cell to use when discretizing the STL object. - real(kind(0d0)) :: model_threshold !< + real(wp) :: model_threshold !< !! Threshold to turn on smoothen STL patch. end type ic_patch_parameters @@ -244,15 +247,15 @@ module m_derived_types integer :: geometry !< Type of geometry for the patch - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid !< + real(wp) :: x_centroid, y_centroid, z_centroid !< !! Location of the geometric center, i.e. the centroid, of the patch. It !! is specified through its x-, y- and z-coordinates, respectively. - real(kind(0d0)) :: c, p, t, m + real(wp) :: c, p, t, m - real(kind(0d0)) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths. - real(kind(0d0)) :: radius !< Dimensions of the patch. radius. - real(kind(0d0)) :: theta + real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths. + real(wp) :: radius !< Dimensions of the patch. radius. + real(wp) :: theta logical :: slip @@ -273,34 +276,34 @@ module m_derived_types integer :: model_spc !< !! Number of samples per cell to use when discretizing the STL object. - real(kind(0d0)) :: model_threshold !< + real(wp) :: model_threshold !< !! Threshold to turn on smoothen STL patch. end type ib_patch_parameters !> Derived type annexing the physical parameters (PP) of the fluids. These !! include the specific heat ratio function and liquid stiffness function. type physical_parameters - real(kind(0d0)) :: gamma !< Sp. heat ratio - real(kind(0d0)) :: pi_inf !< Liquid stiffness - real(kind(0d0)), dimension(2) :: Re !< Reynolds number - real(kind(0d0)) :: cv !< heat capacity - real(kind(0d0)) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004)) - real(kind(0d0)) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004)) - real(kind(0d0)) :: mul0 !< Bubble viscosity - real(kind(0d0)) :: ss !< Bubble surface tension - real(kind(0d0)) :: pv !< Bubble vapour pressure - real(kind(0d0)) :: gamma_v !< Bubble constants (see Preston (2007), Ando (2010)) - real(kind(0d0)) :: M_v !< Bubble constants (see Preston (2007), Ando (2010)) - real(kind(0d0)) :: mu_v !< Bubble constants (see Preston (2007), Ando (2010)) - real(kind(0d0)) :: k_v !< Bubble constants (see Preston (2007), Ando (2010)) - real(kind(0d0)) :: G + real(wp) :: gamma !< Sp. heat ratio + real(wp) :: pi_inf !< Liquid stiffness + real(wp), dimension(2) :: Re !< Reynolds number + real(wp) :: cv !< heat capacity + real(wp) :: qv !< reference energy per unit mass for SGEOS, q (see Le Metayer (2004)) + real(wp) :: qvp !< reference entropy per unit mass for SGEOS, q' (see Le Metayer (2004)) + real(wp) :: mul0 !< Bubble viscosity + real(wp) :: ss !< Bubble surface tension + real(wp) :: pv !< Bubble vapour pressure + real(wp) :: gamma_v !< Bubble constants (see Preston (2007), Ando (2010)) + real(wp) :: M_v !< Bubble constants (see Preston (2007), Ando (2010)) + real(wp) :: mu_v !< Bubble constants (see Preston (2007), Ando (2010)) + real(wp) :: k_v !< Bubble constants (see Preston (2007), Ando (2010)) + real(wp) :: G end type physical_parameters !> Derived type annexing the flow probe location type probe_parameters - real(kind(0d0)) :: x !< First coordinate location - real(kind(0d0)) :: y !< Second coordinate location - real(kind(0d0)) :: z !< Third coordinate location + real(wp) :: x !< First coordinate location + real(wp) :: y !< Second coordinate location + real(wp) :: z !< Third coordinate location end type probe_parameters type mpi_io_airfoil_ib_var @@ -310,12 +313,12 @@ module m_derived_types !> Derived type annexing integral regions type integral_parameters - real(kind(0d0)) :: xmin !< Min. boundary first coordinate direction - real(kind(0d0)) :: xmax !< Max. boundary first coordinate direction - real(kind(0d0)) :: ymin !< Min. boundary second coordinate direction - real(kind(0d0)) :: ymax !< Max. boundary second coordinate direction - real(kind(0d0)) :: zmin !< Min. boundary third coordinate direction - real(kind(0d0)) :: zmax !< Max. boundary third coordinate direction + real(wp) :: xmin !< Min. boundary first coordinate direction + real(wp) :: xmax !< Max. boundary first coordinate direction + real(wp) :: ymin !< Min. boundary second coordinate direction + real(wp) :: ymax !< Max. boundary second coordinate direction + real(wp) :: zmin !< Min. boundary third coordinate direction + real(wp) :: zmax !< Max. boundary third coordinate direction end type integral_parameters !> Acoustic source parameters @@ -323,24 +326,24 @@ module m_derived_types integer :: pulse !< Type of pulse integer :: support !< Type of support logical :: dipole !< Whether the source is a dipole or monopole - real(kind(0d0)), dimension(3) :: loc !< Physical location of acoustic source - real(kind(0d0)) :: mag !< Acoustic pulse magnitude - real(kind(0d0)) :: length !< Length of planar source (2D/3D) - real(kind(0d0)) :: height !< Height of planar source (3D) - real(kind(0d0)) :: wavelength !< Wave length of pulse - real(kind(0d0)) :: frequency !< Frequency of pulse - real(kind(0d0)) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound - real(kind(0d0)) :: gauss_sigma_time !< sigma of Gaussian pulse - real(kind(0d0)) :: npulse !< Number of cycles of pulse - real(kind(0d0)) :: dir !< Direction of pulse - real(kind(0d0)) :: delay !< Time-delay of pulse start - real(kind(0d0)) :: foc_length ! < Focal length of transducer - real(kind(0d0)) :: aperture ! < Aperture diameter of transducer - real(kind(0d0)) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array - real(kind(0d0)) :: element_polygon_ratio !< Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array - real(kind(0d0)) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array - real(kind(0d0)) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave - real(kind(0d0)) :: bb_lowest_freq !< The lower frequency bound of broadband wave + real(wp), dimension(3) :: loc !< Physical location of acoustic source + real(wp) :: mag !< Acoustic pulse magnitude + real(wp) :: length !< Length of planar source (2D/3D) + real(wp) :: height !< Height of planar source (3D) + real(wp) :: wavelength !< Wave length of pulse + real(wp) :: frequency !< Frequency of pulse + real(wp) :: gauss_sigma_dist !< sigma of Gaussian pulse multiplied by speed of sound + real(wp) :: gauss_sigma_time !< sigma of Gaussian pulse + real(wp) :: npulse !< Number of cycles of pulse + real(wp) :: dir !< Direction of pulse + real(wp) :: delay !< Time-delay of pulse start + real(wp) :: foc_length ! < Focal length of transducer + real(wp) :: aperture ! < Aperture diameter of transducer + real(wp) :: element_spacing_angle !< Spacing between aperture elements in 2D acoustic array + real(wp) :: element_polygon_ratio !< Ratio of aperture element diameter to side length of polygon connecting their centers, in 3D acoustic array + real(wp) :: rotate_angle !< Angle of rotation of the entire circular 3D acoustic array + real(wp) :: bb_bandwidth !< Bandwidth of each frequency in broadband wave + real(wp) :: bb_lowest_freq !< The lower frequency bound of broadband wave integer :: num_elements !< Number of elements in the acoustic array integer :: element_on !< Element in the acoustic array to turn on integer :: bb_num_freq !< Number of frequencies in the broadband wave @@ -349,18 +352,18 @@ module m_derived_types !> Acoustic source source_spatial pre-calculated values type source_spatial_type integer, dimension(:, :), allocatable :: coord !< List of grid points indices with non-zero source_spatial values - real(kind(0d0)), dimension(:), allocatable :: val !< List of non-zero source_spatial values - real(kind(0d0)), dimension(:), allocatable :: angle !< List of angles with x-axis for mom source term vector - real(kind(0d0)), dimension(:, :), allocatable :: xyz_to_r_ratios !< List of [xyz]/r for mom source term vector + real(wp), dimension(:), allocatable :: val !< List of non-zero source_spatial values + real(wp), dimension(:), allocatable :: angle !< List of angles with x-axis for mom source term vector + real(wp), dimension(:, :), allocatable :: xyz_to_r_ratios !< List of [xyz]/r for mom source term vector end type source_spatial_type !> Ghost Point for Immersed Boundaries type ghost_point - real(kind(0d0)), dimension(3) :: loc !< Physical location of the ghost point - real(kind(0d0)), dimension(3) :: ip_loc !< Physical location of the image point + real(wp), dimension(3) :: loc !< Physical location of the ghost point + real(wp), dimension(3) :: ip_loc !< Physical location of the image point integer, dimension(3) :: ip_grid !< Top left grid point of IP - real(kind(0d0)), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point + real(wp), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of logical :: slip integer, dimension(3) :: DB diff --git a/src/common/m_eigen_solver.f90 b/src/common/m_eigen_solver.f90 index 8356f78fc..0f72155e0 100644 --- a/src/common/m_eigen_solver.f90 +++ b/src/common/m_eigen_solver.f90 @@ -8,6 +8,8 @@ !! modifications for compatibility. module m_eigen_solver + use m_precision_select + implicit none private; @@ -33,10 +35,10 @@ module m_eigen_solver !! @param ierr an error completion code subroutine cg(nm, nl, ar, ai, wr, wi, zr, zi, fv1, fv2, fv3, ierr) integer, intent(in) :: nm, nl - real(kind(0d0)), dimension(nm, nl), intent(inout) :: ar, ai - real(kind(0d0)), dimension(nl), intent(out) :: wr, wi - real(kind(0d0)), dimension(nm, nl), intent(out) :: zr, zi - real(kind(0d0)), dimension(nl), intent(out) :: fv1, fv2, fv3 + real(wp), dimension(nm, nl), intent(inout) :: ar, ai + real(wp), dimension(nl), intent(out) :: wr, wi + real(wp), dimension(nm, nl), intent(out) :: zr, zi + real(wp), dimension(nl), intent(out) :: fv1, fv2, fv3 integer, intent(out) :: ierr integer :: is1, is2 @@ -76,15 +78,15 @@ end subroutine cg !! factors used. subroutine cbal(nm, nl, ar, ai, low, igh, scale) integer, intent(in) :: nm, nl - real(kind(0d0)), dimension(nm, nl), intent(inout) :: ar, ai + real(wp), dimension(nm, nl), intent(inout) :: ar, ai integer, intent(out) :: low, igh - real(kind(0d0)), dimension(nl), intent(out) :: scale + real(wp), dimension(nl), intent(out) :: scale integer :: i, j, k, l, ml, jj, iexc - real(kind(0d0)) :: c, f, g, r, s, b2, radix + real(wp) :: c, f, g, r, s, b2, radix logical :: noconv - radix = 16.0d0 + radix = 16.0_wp b2 = radix*radix k = 1 @@ -124,7 +126,7 @@ subroutine cbal(nm, nl, ar, ai, low, igh, scale) do 110 i = 1, l if (i == j) go to 110 - if (ar(j, i) /= 0.0d0 .or. ai(j, i) /= 0.0d0) go to 120 + if (ar(j, i) /= 0.0_wp .or. ai(j, i) /= 0.0_wp) go to 120 110 end do ml = l @@ -141,7 +143,7 @@ subroutine cbal(nm, nl, ar, ai, low, igh, scale) do 150 i = k, l if (i == j) go to 150 - if (ar(i, j) /= 0.0d0 .or. ai(i, j) /= 0.0d0) go to 170 + if (ar(i, j) /= 0.0_wp .or. ai(i, j) /= 0.0_wp) go to 170 150 end do ml = k @@ -150,24 +152,24 @@ subroutine cbal(nm, nl, ar, ai, low, igh, scale) 170 end do ! .......... now balance the submatrix in rows k to l .......... do 180 i = k, l - scale(i) = 1.0d0 + scale(i) = 1.0_wp 180 end do ! .......... iterative loop for norm reduction .......... 190 noconv = .false. do 270 i = k, l - c = 0.0d0 - r = 0.0d0 + c = 0.0_wp + r = 0.0_wp do 200 j = k, l if (j == i) go to 200 - c = c + dabs(ar(j, i)) + dabs(ai(j, i)) - r = r + dabs(ar(i, j)) + dabs(ai(i, j)) + c = c + abs(ar(j, i)) + abs(ai(j, i)) + r = r + abs(ar(i, j)) + abs(ai(i, j)) 200 end do ! .......... guard against zero c or r due to underflow .......... - if (c == 0.0d0 .or. r == 0.0d0) go to 270 + if (c == 0.0_wp .or. r == 0.0_wp) go to 270 g = r/radix - f = 1.0d0 + f = 1.0_wp s = c + r 210 if (c >= g) go to 220 f = f*radix @@ -179,8 +181,8 @@ subroutine cbal(nm, nl, ar, ai, low, igh, scale) c = c/b2 go to 230 ! .......... now balance .......... -240 if ((c + r)/f >= 0.95d0*s) go to 270 - g = 1.0d0/f +240 if ((c + r)/f >= 0.95_wp*s) go to 270 + g = 1.0_wp/f scale(i) = scale(i)*f noconv = .true. @@ -222,11 +224,11 @@ end subroutine cbal !! @param orti further information about the transformations subroutine corth(nm, nl, low, igh, ar, ai, ortr, orti) integer, intent(in) :: nm, nl, low, igh - real(kind(0d0)), dimension(nm, nl), intent(inout) :: ar, ai - real(kind(0d0)), dimension(igh), intent(out) :: ortr, orti + real(wp), dimension(nm, nl), intent(inout) :: ar, ai + real(wp), dimension(igh), intent(out) :: ortr, orti integer :: i, j, ml, ii, jj, la, mp, kp1, mll - real(kind(0d0)) :: f, g, h, fi, fr, scale, c + real(wp) :: f, g, h, fi, fr, scale, c mll = 6 @@ -235,15 +237,15 @@ subroutine corth(nm, nl, low, igh, ar, ai, ortr, orti) if (la < kp1) go to 200 do 180 ml = kp1, la - h = 0.0d0 - ortr(ml) = 0.0d0 - orti(ml) = 0.0d0 - scale = 0.0d0 + h = 0.0_wp + ortr(ml) = 0.0_wp + orti(ml) = 0.0_wp + scale = 0.0_wp ! .......... scale column (algol tol then not needed) .......... do 90 i = ml, igh - scale = scale + dabs(ar(i, ml - 1)) + dabs(ai(i, ml - 1)) + scale = scale + abs(ar(i, ml - 1)) + abs(ai(i, ml - 1)) 90 end do - if (scale == 0d0) go to 180 + if (scale == 0._wp) go to 180 mp = ml + igh ! .......... for i=igh step -1 until ml do -- .......... do 100 ii = ml, igh @@ -253,21 +255,21 @@ subroutine corth(nm, nl, low, igh, ar, ai, ortr, orti) h = h + ortr(i)*ortr(i) + orti(i)*orti(i) 100 end do ! - g = dsqrt(h) + g = sqrt(h) call pythag(ortr(ml), orti(ml), f) - if (f == 0d0) go to 103 + if (f == 0._wp) go to 103 h = h + f*g g = g/f - ortr(ml) = (1.0d0 + g)*ortr(ml) - orti(ml) = (1.0d0 + g)*orti(ml) + ortr(ml) = (1.0_wp + g)*ortr(ml) + orti(ml) = (1.0_wp + g)*orti(ml) go to 105 103 ortr(ml) = g ar(ml, ml - 1) = scale ! .......... form (i-(u*ut)/h) * a .......... 105 do 130 j = ml, nl - fr = 0.0d0 - fi = 0.0d0 + fr = 0.0_wp + fi = 0.0_wp ! .......... for i=igh step -1 until ml do -- .......... do 110 ii = ml, igh i = mp - ii @@ -286,8 +288,8 @@ subroutine corth(nm, nl, low, igh, ar, ai, ortr, orti) 130 end do ! .......... form (i-(u*ut)/h)*a*(i-(u*ut)/h) .......... do 160 i = 1, igh - fr = 0.0d0 - fi = 0.0d0 + fr = 0.0_wp + fi = 0.0_wp ! .......... for j=igh step -1 until ml do -- .......... do 140 jj = ml, igh j = mp - jj @@ -344,25 +346,25 @@ end subroutine corth !! @param ierr an error completion code subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) integer, intent(in) :: nm, nl, low, igh - real(kind(0d0)), dimension(nm, nl), intent(inout) :: hr, hi - real(kind(0d0)), dimension(nl), intent(out) :: wr, wi - real(kind(0d0)), dimension(nm, nl), intent(out) :: zr, zi - real(kind(0d0)), dimension(igh), intent(inout) :: ortr, orti + real(wp), dimension(nm, nl), intent(inout) :: hr, hi + real(wp), dimension(nl), intent(out) :: wr, wi + real(wp), dimension(nm, nl), intent(out) :: zr, zi + real(wp), dimension(igh), intent(inout) :: ortr, orti integer, intent(out) :: ierr integer :: i, j, k, l, ml, en, ii, jj, ll, nn, ip1, itn, its, lp1, enm1, iend - real(kind(0d0)) :: si, sr, ti, tr, xi, xr, xxi, xxr, yi, yr, zzi, zzr, & - norm, tst1, tst2, c, d + real(wp) :: si, sr, ti, tr, xi, xr, xxi, xxr, yi, yr, zzi, zzr, & + norm, tst1, tst2, c, d ! ierr = 0 ! .......... initialize eigenvector matrix .......... do 101 j = 1, nl ! do 100 i = 1, nl - zr(i, j) = 0.0d0 - zi(i, j) = 0.0d0 + zr(i, j) = 0.0_wp + zi(i, j) = 0.0_wp 100 end do - zr(j, j) = 1.0d0 + zr(j, j) = 1.0_wp 101 end do ! .......... form the matrix of accumulated transformations ! from the information left by corth .......... @@ -373,8 +375,8 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ! .......... for i=igh-1 step -1 until low+1 do -- .......... 105 do 140 ii = 1, iend i = igh - ii - if (dabs(ortr(i)) == 0d0 .and. dabs(orti(i)) == 0d0) go to 140 - if (dabs(hr(i, i - 1)) == 0d0 .and. dabs(hi(i, i - 1)) == 0d0) go to 140 + if (abs(ortr(i)) == 0._wp .and. abs(orti(i)) == 0._wp) go to 140 + if (abs(hr(i, i - 1)) == 0._wp .and. abs(hi(i, i - 1)) == 0._wp) go to 140 ! .......... norm below is negative of h formed in corth .......... norm = hr(i, i - 1)*ortr(i) + hi(i, i - 1)*orti(i) ip1 = i + 1 @@ -385,8 +387,8 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) 110 end do ! do 130 j = i, igh - sr = 0.0d0 - si = 0.0d0 + sr = 0.0_wp + si = 0.0_wp ! do 115 k = i, igh sr = sr + ortr(k)*zr(k, j) + orti(k)*zi(k, j) @@ -409,12 +411,12 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ! do 170 i = l, igh ll = min0(i + 1, igh) - if (dabs(hi(i, i - 1)) == 0d0) go to 170 + if (abs(hi(i, i - 1)) == 0._wp) go to 170 call pythag(hr(i, i - 1), hi(i, i - 1), norm) yr = hr(i, i - 1)/norm yi = hi(i, i - 1)/norm hr(i, i - 1) = norm - hi(i, i - 1) = 0.0d0 + hi(i, i - 1) = 0.0_wp ! do 155 j = i, nl si = yr*hi(i, j) - yi*hr(i, j) @@ -442,8 +444,8 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) 200 end do ! en = igh - tr = 0.0d0 - ti = 0.0d0 + tr = 0.0_wp + ti = 0.0_wp itn = 30*nl ! .......... search for next eigenvalue .......... 220 if (en < low) go to 680 @@ -454,9 +456,9 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) 240 do 260 ll = low, en l = en + low - ll if (l == low) go to 300 - tst1 = dabs(hr(l - 1, l - 1)) + dabs(hi(l - 1, l - 1)) & - + dabs(hr(l, l)) + dabs(hi(l, l)) - tst2 = tst1 + dabs(hr(l, l - 1)) + tst1 = abs(hr(l - 1, l - 1)) + abs(hi(l - 1, l - 1)) & + + abs(hr(l, l)) + abs(hi(l, l)) + tst2 = tst1 + abs(hr(l, l - 1)) if (tst2 == tst1) go to 300 260 end do ! .......... form shift .......... @@ -467,11 +469,11 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) si = hi(en, en) xr = hr(enm1, en)*hr(en, enm1) xi = hi(enm1, en)*hr(en, enm1) - if (xr == 0.0d0 .and. xi == 0.0d0) go to 340 - yr = (hr(enm1, enm1) - sr)/2.0d0 - yi = (hi(enm1, enm1) - si)/2.0d0 - call csroot(yr**2 - yi**2 + xr, 2.0d0*yr*yi + xi, zzr, zzi) - if (yr*zzr + yi*zzi >= 0.0d0) go to 310 + if (xr == 0.0_wp .and. xi == 0.0_wp) go to 340 + yr = (hr(enm1, enm1) - sr)/2.0_wp + yi = (hi(enm1, enm1) - si)/2.0_wp + call csroot(yr**2 - yi**2 + xr, 2.0_wp*yr*yi + xi, zzr, zzi) + if (yr*zzr + yi*zzi >= 0.0_wp) go to 310 zzr = -zzr zzi = -zzi 310 call cdiv(xr, xi, yr + zzr, yi + zzi, xxr, xxi) @@ -479,8 +481,8 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) si = si - xxi go to 340 ! .......... form exceptional shift .......... -320 sr = dabs(hr(en, enm1)) + dabs(hr(enm1, en - 2)) - si = 0.0d0 +320 sr = abs(hr(en, enm1)) + abs(hr(enm1, en - 2)) + si = 0.0_wp ! 340 do 360 i = low, en hr(i, i) = hr(i, i) - sr @@ -496,7 +498,7 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ! do 500 i = lp1, en sr = hr(i, i - 1) - hr(i, i - 1) = 0.0d0 + hr(i, i - 1) = 0.0_wp call pythag(hr(i - 1, i - 1), hi(i - 1, i - 1), c) call pythag(c, sr, norm) xr = hr(i - 1, i - 1)/norm @@ -504,7 +506,7 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) xi = hi(i - 1, i - 1)/norm wi(i - 1) = xi hr(i - 1, i - 1) = norm - hi(i - 1, i - 1) = 0.0d0 + hi(i - 1, i - 1) = 0.0_wp hi(i, i - 1) = sr/norm ! do 490 j = i, nl @@ -521,12 +523,12 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) 500 end do ! si = hi(en, en) - if (dabs(si) == 0d0) go to 540 + if (abs(si) == 0._wp) go to 540 call pythag(hr(en, en), si, norm) sr = hr(en, en)/norm si = si/norm hr(en, en) = norm - hi(en, en) = 0.0d0 + hi(en, en) = 0.0_wp if (en == nl) go to 540 ip1 = en + 1 ! @@ -543,7 +545,7 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ! do 580 i = 1, j yr = hr(i, j - 1) - yi = 0.0d0 + yi = 0.0_wp zzr = hr(i, j) zzi = hi(i, j) if (i == j) go to 560 @@ -566,7 +568,7 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) 590 end do 600 end do ! - if (dabs(si) == 0d0) go to 240 + if (abs(si) == 0._wp) go to 240 ! do 630 i = 1, en yr = hr(i, en) @@ -592,29 +594,29 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) go to 220 ! .......... all roots found. backsubstitute to find ! vectors of upper triangular form .......... -680 norm = 0.0d0 +680 norm = 0.0_wp ! do i = 1, nl do j = i, nl - tr = dabs(hr(i, j)) + dabs(hi(i, j)) + tr = abs(hr(i, j)) + abs(hi(i, j)) if (tr > norm) norm = tr end do end do ! - if (nl == 1 .or. norm == 0d0) go to 1001 + if (nl == 1 .or. norm == 0._wp) go to 1001 ! .......... for en=nl step -1 until 2 do -- .......... do 800 nn = 2, nl en = nl + 2 - nn xr = wr(en) xi = wi(en) - hr(en, en) = 1.0d0 - hi(en, en) = 0.0d0 + hr(en, en) = 1.0_wp + hi(en, en) = 0.0_wp enm1 = en - 1 ! .......... for i=en-1 step -1 until 1 do -- .......... do 780 ii = 1, enm1 i = en - ii - zzr = 0.0d0 - zzi = 0.0d0 + zzr = 0.0_wp + zzi = 0.0_wp ip1 = i + 1 do 740 j = ip1, en @@ -624,19 +626,19 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ! yr = xr - wr(i) yi = xi - wi(i) - if (yr /= 0.0d0 .or. yi /= 0.0d0) go to 765 + if (yr /= 0.0_wp .or. yi /= 0.0_wp) go to 765 tst1 = norm yr = tst1 -760 yr = 0.01d0*yr +760 yr = 0.01_wp*yr tst2 = norm + yr if (tst2 > tst1) go to 760 765 continue call cdiv(zzr, zzi, yr, yi, hr(i, en), hi(i, en)) ! .......... overflow control .......... - tr = dabs(hr(i, en)) + dabs(hi(i, en)) - if (tr == 0.0d0) go to 780 + tr = abs(hr(i, en)) + abs(hi(i, en)) + if (tr == 0.0_wp) go to 780 tst1 = tr - tst2 = tst1 + 1.0d0/tst1 + tst2 = tst1 + 1.0_wp/tst1 if (tst2 > tst1) go to 780 do 770 j = i, en hr(j, en) = hr(j, en)/tr @@ -665,8 +667,8 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr) ml = min0(j, igh) ! do i = low, igh - zzr = 0.0d0 - zzi = 0.0d0 + zzr = 0.0_wp + zzi = 0.0_wp ! do 860 k = low, ml zzr = zzr + zr(i, k)*hr(k, j) - zi(i, k)*hi(k, j) @@ -707,12 +709,12 @@ end subroutine comqr2 !! transformed in their first ml columns subroutine cbabk2(nm, nl, low, igh, scale, ml, zr, zi) integer, intent(in) :: nm, nl, low, igh - double precision, intent(in) :: scale(nl) + real(wp), intent(in) :: scale(nl) integer, intent(in) :: ml - double precision, intent(inout) :: zr(nm, ml), zi(nm, ml) + real(wp), intent(inout) :: zr(nm, ml), zi(nm, ml) integer :: i, j, k, ii - double precision :: s + real(wp) :: s if (ml == 0) go to 200 if (igh == low) go to 120 @@ -721,7 +723,7 @@ subroutine cbabk2(nm, nl, low, igh, scale, ml, zr, zi) s = scale(i) ! .......... left hand eigenvectors are back transformed ! if the foregoing statement is replaced by -! s=1.0d0/scale(i). .......... +! s=1.0_wp/scale(i). .......... do 100 j = 1, ml zr(i, j) = zr(i, j)*s zi(i, j) = zi(i, j)*s @@ -752,66 +754,66 @@ subroutine cbabk2(nm, nl, low, igh, scale, ml, zr, zi) end subroutine cbabk2 subroutine csroot(xr, xi, yr, yi) - real(kind(0d0)), intent(in) :: xr, xi - real(kind(0d0)), intent(out) :: yr, yi + real(wp), intent(in) :: xr, xi + real(wp), intent(out) :: yr, yi ! -! (yr,yi) = complex dsqrt(xr,xi) +! (yr,yi) = complex sqrt(xr,xi) ! branch chosen so that yr .ge. 0.0 and sign(yi) .eq. sign(xi) ! - real(kind(0d0)) :: s, tr, ti, c + real(wp) :: s, tr, ti, c tr = xr ti = xi call pythag(tr, ti, c) - s = dsqrt(0.5d0*(c + dabs(tr))) - if (tr >= 0.0d0) yr = s - if (ti < 0.0d0) s = -s - if (tr <= 0.0d0) yi = s - if (tr < 0.0d0) yr = 0.5d0*(ti/yi) - if (tr > 0.0d0) yi = 0.5d0*(ti/yr) + s = sqrt(0.5_wp*(c + abs(tr))) + if (tr >= 0.0_wp) yr = s + if (ti < 0.0_wp) s = -s + if (tr <= 0.0_wp) yi = s + if (tr < 0.0_wp) yr = 0.5_wp*(ti/yi) + if (tr > 0.0_wp) yi = 0.5_wp*(ti/yr) return end subroutine csroot subroutine cdiv(ar, ai, br, bi, cr, ci) - real(kind(0d0)), intent(in) :: ar, ai, br, bi - real(kind(0d0)), intent(out) :: cr, ci - real(kind(0d0)) :: s, ars, ais, brs, bis + real(wp), intent(in) :: ar, ai, br, bi + real(wp), intent(out) :: cr, ci + real(wp) :: s, ars, ais, brs, bis ! ! complex division, (cr,ci) = (ar,ai)/(br,bi) ! ! (ar + i*ai) * (br - i*bi) /(br**2 + bi**2) ! ((ar*br + i*ai*br) + (-i*ar*bi + ai*bi)) /(br**2 + bi**2) ! (ar*br + ai*bi + i*(ai*br - ar*bi)) /(br**2 + bi**2) - ! cr = (ar*br + ai*bi) / (br**2d0 + bi**2d0) - ! ci = (ai*br - ar*bi) / (br**2d0 + bi**2d0) + ! cr = (ar*br + ai*bi) / (br**2._wp + bi**2._wp) + ! ci = (ai*br - ar*bi) / (br**2._wp + bi**2._wp) - s = dabs(br) + dabs(bi) + s = abs(br) + abs(bi) ars = ar/s ais = ai/s brs = br/s bis = bi/s - s = brs**2d0 + bis**2d0 + s = brs**2._wp + bis**2._wp cr = (ars*brs + ais*bis)/s ci = (ais*brs - ars*bis)/s return end subroutine cdiv subroutine pythag(a, b, c) - real(kind(0d0)), intent(in) :: a, b - real(kind(0d0)), intent(out) :: c + real(wp), intent(in) :: a, b + real(wp), intent(out) :: c ! -! finds dsqrt(a**2+b**2) without overflow or destructive underflow +! finds sqrt(a**2+b**2) without overflow or destructive underflow ! - real(kind(0d0)) :: p, r, s, t, u - p = dmax1(dabs(a), dabs(b)) - if (p == 0.0d0) go to 20 - r = (dmin1(dabs(a), dabs(b))/p)**2 + real(wp) :: p, r, s, t, u + p = max(abs(a), abs(b)) + if (p == 0.0_wp) go to 20 + r = (min(abs(a), abs(b))/p)**2 10 continue - t = 4.0d0 + r - if (t == 4.0d0) go to 20 + t = 4.0_wp + r + if (t == 4.0_wp) go to 20 s = r/t - u = 1.0d0 + 2.0d0*s + u = 1.0_wp + 2.0_wp*s p = u*p - r = (s/u)**2d0*r + r = (s/u)**2._wp*r go to 10 20 c = p return diff --git a/src/common/m_finite_differences.fpp b/src/common/m_finite_differences.fpp index 9eb65a121..fd0323a79 100644 --- a/src/common/m_finite_differences.fpp +++ b/src/common/m_finite_differences.fpp @@ -14,7 +14,7 @@ contains integer :: x, y, z !< Generic loop iterators - real(kind(0d0)) :: divergence + real(wp) :: divergence !$acc parallel loop collapse(3) private(divergence) do x = ix_s%beg, ix_s%end @@ -22,18 +22,18 @@ contains do z = iz_s%beg, iz_s%end if (x == ix_s%beg) then - divergence = (-3d0*fields(1)%sf(x, y, z) + 4d0*fields(1)%sf(x + 1, y, z) - fields(1)%sf(x + 2, y, z))/(x_cc(x + 2) - x_cc(x)) + divergence = (-3._wp*fields(1)%sf(x, y, z) + 4._wp*fields(1)%sf(x + 1, y, z) - fields(1)%sf(x + 2, y, z))/(x_cc(x + 2) - x_cc(x)) else if (x == ix_s%end) then - divergence = (+3d0*fields(1)%sf(x, y, z) - 4d0*fields(1)%sf(x - 1, y, z) + fields(1)%sf(x - 2, y, z))/(x_cc(x) - x_cc(x - 2)) + divergence = (+3._wp*fields(1)%sf(x, y, z) - 4._wp*fields(1)%sf(x - 1, y, z) + fields(1)%sf(x - 2, y, z))/(x_cc(x) - x_cc(x - 2)) else divergence = (fields(1)%sf(x + 1, y, z) - fields(1)%sf(x - 1, y, z))/(x_cc(x + 1) - x_cc(x - 1)) end if if (n > 0) then if (y == iy_s%beg) then - divergence = divergence + (-3d0*fields(2)%sf(x, y, z) + 4d0*fields(2)%sf(x, y + 1, z) - fields(2)%sf(x, y + 2, z))/(y_cc(y + 2) - y_cc(y)) + divergence = divergence + (-3._wp*fields(2)%sf(x, y, z) + 4._wp*fields(2)%sf(x, y + 1, z) - fields(2)%sf(x, y + 2, z))/(y_cc(y + 2) - y_cc(y)) else if (y == iy_s%end) then - divergence = divergence + (+3d0*fields(2)%sf(x, y, z) - 4d0*fields(2)%sf(x, y - 1, z) + fields(2)%sf(x, y - 2, z))/(y_cc(y) - y_cc(y - 2)) + divergence = divergence + (+3._wp*fields(2)%sf(x, y, z) - 4._wp*fields(2)%sf(x, y - 1, z) + fields(2)%sf(x, y - 2, z))/(y_cc(y) - y_cc(y - 2)) else divergence = divergence + (fields(2)%sf(x, y + 1, z) - fields(2)%sf(x, y - 1, z))/(y_cc(y + 1) - y_cc(y - 1)) end if @@ -41,9 +41,9 @@ contains if (p > 0) then if (z == iz_s%beg) then - divergence = divergence + (-3d0*fields(3)%sf(x, y, z) + 4d0*fields(3)%sf(x, y, z + 1) - fields(3)%sf(x, y, z + 2))/(z_cc(z + 2) - z_cc(z)) + divergence = divergence + (-3._wp*fields(3)%sf(x, y, z) + 4._wp*fields(3)%sf(x, y, z + 1) - fields(3)%sf(x, y, z + 2))/(z_cc(z + 2) - z_cc(z)) else if (z == iz_s%end) then - divergence = divergence + (+3d0*fields(3)%sf(x, y, z) - 4d0*fields(3)%sf(x, y, z - 1) + fields(2)%sf(x, y, z - 2))/(z_cc(z) - z_cc(z - 2)) + divergence = divergence + (+3._wp*fields(3)%sf(x, y, z) - 4._wp*fields(3)%sf(x, y, z - 1) + fields(2)%sf(x, y, z - 2))/(z_cc(z) - z_cc(z - 2)) else divergence = divergence + (fields(3)%sf(x, y, z + 1) - fields(3)%sf(x, y, z - 1))/(z_cc(z + 1) - z_cc(z - 1)) end if @@ -74,9 +74,9 @@ contains integer, intent(IN) :: q integer, intent(IN) :: buff_size, fd_number_in, fd_order_in type(int_bounds_info), optional, intent(IN) :: offset_s - real(kind(0d0)), allocatable, dimension(:, :), intent(INOUT) :: fd_coeff_s + real(wp), allocatable, dimension(:, :), intent(INOUT) :: fd_coeff_s - real(kind(0d0)), & + real(wp), & dimension(-buff_size:q + buff_size), & intent(IN) :: s_cc @@ -96,25 +96,25 @@ contains ! Computing the 1st order finite-difference coefficients if (fd_order_in == 1) then do i = lB, lE - fd_coeff_s(-1, i) = 0d0 - fd_coeff_s(0, i) = -1d0/(s_cc(i + 1) - s_cc(i)) + fd_coeff_s(-1, i) = 0._wp + fd_coeff_s(0, i) = -1._wp/(s_cc(i + 1) - s_cc(i)) fd_coeff_s(1, i) = -fd_coeff_s(0, i) end do ! Computing the 2nd order finite-difference coefficients elseif (fd_order_in == 2) then do i = lB, lE - fd_coeff_s(-1, i) = -1d0/(s_cc(i + 1) - s_cc(i - 1)) - fd_coeff_s(0, i) = 0d0 + fd_coeff_s(-1, i) = -1._wp/(s_cc(i + 1) - s_cc(i - 1)) + fd_coeff_s(0, i) = 0._wp fd_coeff_s(1, i) = -fd_coeff_s(-1, i) end do ! Computing the 4th order finite-difference coefficients else do i = lB, lE - fd_coeff_s(-2, i) = 1d0/(s_cc(i - 2) - 8d0*s_cc(i - 1) - s_cc(i + 2) + 8d0*s_cc(i + 1)) - fd_coeff_s(-1, i) = -8d0*fd_coeff_s(-2, i) - fd_coeff_s(0, i) = 0d0 + fd_coeff_s(-2, i) = 1._wp/(s_cc(i - 2) - 8._wp*s_cc(i - 1) - s_cc(i + 2) + 8._wp*s_cc(i + 1)) + fd_coeff_s(-1, i) = -8._wp*fd_coeff_s(-2, i) + fd_coeff_s(0, i) = 0._wp fd_coeff_s(1, i) = -fd_coeff_s(-1, i) fd_coeff_s(2, i) = -fd_coeff_s(-2, i) end do diff --git a/src/common/m_helper.fpp b/src/common/m_helper.fpp index dce271120..7daf79310 100644 --- a/src/common/m_helper.fpp +++ b/src/common/m_helper.fpp @@ -46,43 +46,40 @@ contains !! @param ntmp is the output number bubble density subroutine s_comp_n_from_prim(vftmp, Rtmp, ntmp, weights) !$acc routine seq - real(kind(0.d0)), intent(in) :: vftmp - real(kind(0.d0)), dimension(nb), intent(in) :: Rtmp - real(kind(0.d0)), intent(out) :: ntmp - real(kind(0.d0)), dimension(nb), intent(in) :: weights + real(wp), intent(in) :: vftmp + real(wp), dimension(nb), intent(in) :: Rtmp + real(wp), intent(out) :: ntmp + real(wp), dimension(nb), intent(in) :: weights - real(kind(0.d0)) :: R3 + real(wp) :: R3 - R3 = dot_product(weights, Rtmp**3.d0) - ntmp = (3.d0/(4.d0*pi))*vftmp/R3 + R3 = dot_product(weights, Rtmp**3._wp) + ntmp = (3._wp/(4._wp*pi))*vftmp/R3 end subroutine s_comp_n_from_prim subroutine s_comp_n_from_cons(vftmp, nRtmp, ntmp, weights) !$acc routine seq - real(kind(0.d0)), intent(in) :: vftmp - real(kind(0.d0)), dimension(nb), intent(in) :: nRtmp - real(kind(0.d0)), intent(out) :: ntmp - real(kind(0.d0)), dimension(nb), intent(in) :: weights + real(wp), intent(in) :: vftmp + real(wp), dimension(nb), intent(in) :: nRtmp + real(wp), intent(out) :: ntmp + real(wp), dimension(nb), intent(in) :: weights - real(kind(0.d0)) :: nR3 + real(wp) :: nR3 - nR3 = dot_product(weights, nRtmp**3.d0) - ntmp = DSQRT((4.d0*pi/3.d0)*nR3/vftmp) - !ntmp = (3.d0/(4.d0*pi))*0.00001 - - !print *, "nbub", ntmp + nR3 = dot_product(weights, nRtmp**3._wp) + ntmp = sqrt((4._wp*pi/3._wp)*nR3/vftmp) end subroutine s_comp_n_from_cons subroutine s_print_2D_array(A, div) - real(kind(0d0)), dimension(:, :), intent(in) :: A - real, optional, intent(in) :: div + real(wp), dimension(:, :), intent(in) :: A + real(wp), optional, intent(in) :: div integer :: i, j integer :: m, n - real :: c + real(wp) :: c m = size(A, 1) n = size(A, 2) @@ -90,7 +87,7 @@ contains if (present(div)) then c = div else - c = 1 + c = 1._wp end if print *, m, n @@ -109,13 +106,13 @@ contains subroutine s_initialize_nonpoly integer :: ir - real(kind(0.d0)) :: rhol0, pl0, uu, D_m, temp, omega_ref - real(kind(0.d0)), dimension(Nb) :: chi_vw0, cp_m0, k_m0, rho_m0, x_vw + real(wp) :: rhol0, pl0, uu, D_m, temp, omega_ref + real(wp), dimension(Nb) :: chi_vw0, cp_m0, k_m0, rho_m0, x_vw - real(kind(0.d0)), parameter :: k_poly = 1.d0 !< + real(wp), parameter :: k_poly = 1._wp !< !! polytropic index used to compute isothermal natural frequency - real(kind(0.d0)), parameter :: Ru = 8314.d0 !< + real(wp), parameter :: Ru = 8314._wp !< !! universal gas constant rhol0 = rhoref @@ -150,42 +147,42 @@ contains k_n(:) = fluid_pp(2)%k_v gamma_m = gamma_n - if (thermal == 2) gamma_m = 1.d0 + if (thermal == 2) gamma_m = 1._wp - temp = 293.15d0 - D_m = 0.242d-4 - uu = DSQRT(pl0/rhol0) + temp = 293.15_wp + D_m = 0.242e-4_wp + uu = sqrt(pl0/rhol0) - omega_ref = 3.d0*k_poly*Ca + 2.d0*(3.d0*k_poly - 1.d0)/Web + omega_ref = 3._wp*k_poly*Ca + 2._wp*(3._wp*k_poly - 1._wp)/Web !!! thermal properties !!! ! gas constants R_n = Ru/M_n R_v = Ru/M_v ! phi_vn & phi_nv (phi_nn = phi_vv = 1) - phi_vn = (1.d0 + DSQRT(mu_v/mu_n)*(M_n/M_v)**(0.25d0))**2 & - /(DSQRT(8.d0)*DSQRT(1.d0 + M_v/M_n)) - phi_nv = (1.d0 + DSQRT(mu_n/mu_v)*(M_v/M_n)**(0.25d0))**2 & - /(DSQRT(8.d0)*DSQRT(1.d0 + M_n/M_v)) + phi_vn = (1._wp + sqrt(mu_v/mu_n)*(M_n/M_v)**(0.25_wp))**2 & + /(sqrt(8._wp)*sqrt(1._wp + M_v/M_n)) + phi_nv = (1._wp + sqrt(mu_n/mu_v)*(M_v/M_n)**(0.25_wp))**2 & + /(sqrt(8._wp)*sqrt(1._wp + M_n/M_v)) ! internal bubble pressure - pb0 = pl0 + 2.d0*ss/(R0ref*R0) + pb0 = pl0 + 2._wp*ss/(R0ref*R0) ! mass fraction of vapor - chi_vw0 = 1.d0/(1.d0 + R_v/R_n*(pb0/pv - 1.d0)) + chi_vw0 = 1._wp/(1._wp + R_v/R_n*(pb0/pv - 1._wp)) ! specific heat for gas/vapor mixture - cp_m0 = chi_vw0*R_v*gamma_v/(gamma_v - 1.d0) & - + (1.d0 - chi_vw0)*R_n*gamma_n/(gamma_n - 1.d0) + cp_m0 = chi_vw0*R_v*gamma_v/(gamma_v - 1._wp) & + + (1._wp - chi_vw0)*R_n*gamma_n/(gamma_n - 1._wp) ! mole fraction of vapor x_vw = M_n*chi_vw0/(M_v + (M_n - M_v)*chi_vw0) ! thermal conductivity for gas/vapor mixture - k_m0 = x_vw*k_v/(x_vw + (1.d0 - x_vw)*phi_vn) & - + (1.d0 - x_vw)*k_n/(x_vw*phi_nv + 1.d0 - x_vw) + k_m0 = x_vw*k_v/(x_vw + (1._wp - x_vw)*phi_vn) & + + (1._wp - x_vw)*k_n/(x_vw*phi_nv + 1._wp - x_vw) ! mixture density rho_m0 = pv/(chi_vw0*R_v*temp) ! mass of gas/vapor computed using dimensional quantities - mass_n0 = 4.d0*(pb0 - pv)*pi/(3.d0*R_n*temp*rhol0)*R0**3 - mass_v0 = 4.d0*pv*pi/(3.d0*R_v*temp*rhol0)*R0**3 + mass_n0 = 4._wp*(pb0 - pv)*pi/(3._wp*R_n*temp*rhol0)*R0**3 + mass_v0 = 4._wp*pv*pi/(3._wp*R_v*temp*rhol0)*R0**3 ! Peclet numbers Pe_T = rho_m0*cp_m0*uu*R0ref/k_m0 Pe_c = uu*R0ref/D_m @@ -200,22 +197,22 @@ contains k_v = k_v/k_m0 pb0 = pb0/pl0 pv = pv/pl0 - Tw = 1.d0 - pl0 = 1.d0 + Tw = 1._wp + pl0 = 1._wp - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp !end if ! natural frequencies - omegaN = DSQRT(3.d0*k_poly*Ca + 2.d0*(3.d0*k_poly - 1.d0)/(Web*R0))/R0 + omegaN = sqrt(3._wp*k_poly*Ca + 2._wp*(3._wp*k_poly - 1._wp)/(Web*R0))/R0 do ir = 1, Nb call s_transcoeff(omegaN(ir)*R0(ir), Pe_T(ir)*R0(ir), & Re_trans_T(ir), Im_trans_T(ir)) call s_transcoeff(omegaN(ir)*R0(ir), Pe_c*R0(ir), & Re_trans_c(ir), Im_trans_c(ir)) end do - Im_trans_T = 0d0 + Im_trans_T = 0._wp end subroutine s_initialize_nonpoly @@ -226,19 +223,19 @@ contains !! @param Im_trans Imaginary part of the transport coefficients subroutine s_transcoeff(omega, peclet, Re_trans, Im_trans) - real(kind(0.d0)), intent(in) :: omega, peclet - real(kind(0.d0)), intent(out) :: Re_trans, Im_trans + real(wp), intent(in) :: omega, peclet + real(wp), intent(out) :: Re_trans, Im_trans complex :: trans, c1, c2, c3 - complex :: imag = (0., 1.) - real(kind(0.d0)) :: f_transcoeff + complex :: imag = (0._wp, 1._wp) + real(wp) :: f_transcoeff c1 = imag*omega*peclet - c2 = CSQRT(c1) - c3 = (CEXP(c2) - CEXP(-c2))/(CEXP(c2) + CEXP(-c2)) ! TANH(c2) - trans = ((c2/c3 - 1.d0)**(-1) - 3.d0/c1)**(-1) ! transfer function + c2 = csqrt(c1) + c3 = (cexp(c2) - cexp(-c2))/(cexp(c2) + cexp(-c2)) ! TANH(c2) + trans = ((c2/c3 - 1._wp)**(-1) - 3._wp/c1)**(-1) ! transfer function - Re_trans = dble(trans) + Re_trans = trans Im_trans = aimag(trans) end subroutine s_transcoeff @@ -256,48 +253,35 @@ contains subroutine s_simpson integer :: ir - real(kind(0.d0)) :: R0mn, R0mx, dphi, tmp, sd - real(kind(0.d0)), dimension(nb) :: phi - - ! nondiml. min. & max. initial radii for numerical quadrature - !sd = 0.05D0 - !R0mn = 0.75D0 - !R0mx = 1.3D0 - - !sd = 0.3D0 - !R0mn = 0.3D0 - !R0mx = 6.D0 - - !sd = 0.7D0 - !R0mn = 0.12D0 - !R0mx = 150.D0 + real(wp) :: R0mn, R0mx, dphi, tmp, sd + real(wp), dimension(nb) :: phi sd = poly_sigma - R0mn = 0.8d0*DEXP(-2.8d0*sd) - R0mx = 0.2d0*DEXP(9.5d0*sd) + 1.d0 + R0mn = 0.8_wp*exp(-2.8_wp*sd) + R0mx = 0.2_wp*exp(9.5_wp*sd) + 1._wp ! phi = ln( R0 ) & return R0 do ir = 1, nb - phi(ir) = DLOG(R0mn) & - + dble(ir - 1)*DLOG(R0mx/R0mn)/dble(nb - 1) - R0(ir) = DEXP(phi(ir)) + phi(ir) = log(R0mn) & + + (ir - 1._wp)*log(R0mx/R0mn)/(nb - 1._wp) + R0(ir) = exp(phi(ir)) end do dphi = phi(2) - phi(1) ! weights for quadrature using Simpson's rule do ir = 2, nb - 1 ! Gaussian - tmp = DEXP(-0.5d0*(phi(ir)/sd)**2)/DSQRT(2.d0*pi)/sd + tmp = exp(-0.5_wp*(phi(ir)/sd)**2)/sqrt(2._wp*pi)/sd if (mod(ir, 2) == 0) then - weight(ir) = tmp*4.d0*dphi/3.d0 + weight(ir) = tmp*4._wp*dphi/3._wp else - weight(ir) = tmp*2.d0*dphi/3.d0 + weight(ir) = tmp*2._wp*dphi/3._wp end if end do - tmp = DEXP(-0.5d0*(phi(1)/sd)**2)/DSQRT(2.d0*pi)/sd - weight(1) = tmp*dphi/3.d0 - tmp = DEXP(-0.5d0*(phi(nb)/sd)**2)/DSQRT(2.d0*pi)/sd - weight(nb) = tmp*dphi/3.d0 + tmp = exp(-0.5_wp*(phi(1)/sd)**2)/sqrt(2._wp*pi)/sd + weight(1) = tmp*dphi/3._wp + tmp = exp(-0.5_wp*(phi(nb)/sd)**2)/sqrt(2._wp*pi)/sd + weight(nb) = tmp*dphi/3._wp end subroutine s_simpson !> This procedure computes the cross product of two vectors. @@ -306,8 +290,8 @@ contains !! @return The cross product of the two vectors. function f_cross(a, b) result(c) - real(kind(0d0)), dimension(3), intent(in) :: a, b - real(kind(0d0)), dimension(3) :: c + real(wp), dimension(3), intent(in) :: a, b + real(wp), dimension(3) :: c c(1) = a(2)*b(3) - a(3)*b(2) c(2) = a(3)*b(1) - a(1)*b(3) @@ -319,8 +303,8 @@ contains !! @param rhs Right-hand side. subroutine s_swap(lhs, rhs) - real(kind(0d0)), intent(inout) :: lhs, rhs - real(kind(0d0)) :: ltemp + real(wp), intent(inout) :: lhs, rhs + real(wp) :: ltemp ltemp = lhs lhs = rhs @@ -336,34 +320,34 @@ contains t_mat4x4 :: sc, rz, rx, ry, tr, out_matrix sc = transpose(reshape([ & - p%scale(1), 0d0, 0d0, 0d0, & - 0d0, p%scale(2), 0d0, 0d0, & - 0d0, 0d0, p%scale(3), 0d0, & - 0d0, 0d0, 0d0, 1d0], shape(sc))) + p%scale(1), 0._wp, 0._wp, 0._wp, & + 0._wp, p%scale(2), 0._wp, 0._wp, & + 0._wp, 0._wp, p%scale(3), 0._wp, & + 0._wp, 0._wp, 0._wp, 1._wp], shape(sc))) rz = transpose(reshape([ & - cos(p%rotate(3)), -sin(p%rotate(3)), 0d0, 0d0, & - sin(p%rotate(3)), cos(p%rotate(3)), 0d0, 0d0, & - 0d0, 0d0, 1d0, 0d0, & - 0d0, 0d0, 0d0, 1d0], shape(rz))) + cos(p%rotate(3)), -sin(p%rotate(3)), 0._wp, 0._wp, & + sin(p%rotate(3)), cos(p%rotate(3)), 0._wp, 0._wp, & + 0._wp, 0._wp, 1._wp, 0._wp, & + 0._wp, 0._wp, 0._wp, 1._wp], shape(rz))) rx = transpose(reshape([ & - 1d0, 0d0, 0d0, 0d0, & - 0d0, cos(p%rotate(1)), -sin(p%rotate(1)), 0d0, & - 0d0, sin(p%rotate(1)), cos(p%rotate(1)), 0d0, & - 0d0, 0d0, 0d0, 1d0], shape(rx))) + 1._wp, 0._wp, 0._wp, 0._wp, & + 0._wp, cos(p%rotate(1)), -sin(p%rotate(1)), 0._wp, & + 0._wp, sin(p%rotate(1)), cos(p%rotate(1)), 0._wp, & + 0._wp, 0._wp, 0._wp, 1._wp], shape(rx))) ry = transpose(reshape([ & - cos(p%rotate(2)), 0d0, sin(p%rotate(2)), 0d0, & - 0d0, 1d0, 0d0, 0d0, & - -sin(p%rotate(2)), 0d0, cos(p%rotate(2)), 0d0, & - 0d0, 0d0, 0d0, 1d0], shape(ry))) + cos(p%rotate(2)), 0._wp, sin(p%rotate(2)), 0._wp, & + 0._wp, 1._wp, 0._wp, 0._wp, & + -sin(p%rotate(2)), 0._wp, cos(p%rotate(2)), 0._wp, & + 0._wp, 0._wp, 0._wp, 1._wp], shape(ry))) tr = transpose(reshape([ & - 1d0, 0d0, 0d0, p%translate(1), & - 0d0, 1d0, 0d0, p%translate(2), & - 0d0, 0d0, 1d0, p%translate(3), & - 0d0, 0d0, 0d0, 1d0], shape(tr))) + 1._wp, 0._wp, 0._wp, p%translate(1), & + 0._wp, 1._wp, 0._wp, p%translate(2), & + 0._wp, 0._wp, 1._wp, p%translate(3), & + 0._wp, 0._wp, 0._wp, 1._wp], shape(tr))) out_matrix = matmul(tr, matmul(ry, matmul(rx, matmul(rz, sc)))) @@ -377,9 +361,9 @@ contains t_vec3, intent(inout) :: vec t_mat4x4, intent(in) :: matrix - real(kind(0d0)), dimension(1:4) :: tmp + real(wp), dimension(1:4) :: tmp - tmp = matmul(matrix, [vec(1), vec(2), vec(3), 1d0]) + tmp = matmul(matrix, [vec(1), vec(2), vec(3), 1._wp]) vec = tmp(1:3) end subroutine s_transform_vec @@ -394,7 +378,7 @@ contains integer :: i - real(kind(0d0)), dimension(1:4) :: tmp + real(wp), dimension(1:4) :: tmp do i = 1, 3 call s_transform_vec(triangle%v(i, :), matrix) @@ -429,8 +413,8 @@ contains integer :: i, j if (size(model%trs) == 0) then - bbox%min = 0d0 - bbox%max = 0d0 + bbox%min = 0._wp + bbox%max = 0._wp return end if diff --git a/src/common/m_helper_basic.f90 b/src/common/m_helper_basic.f90 index 0611ff86f..cd1915657 100644 --- a/src/common/m_helper_basic.f90 +++ b/src/common/m_helper_basic.f90 @@ -19,47 +19,45 @@ module m_helper_basic contains - !> This procedure checks if two floating point numbers of kind(0d0) are within tolerance. + !> This procedure checks if two floating point numbers of wp are within tolerance. !! @param a First number. !! @param b Second number. - !! @param tol_input Relative error (default = 1d-6). + !! @param tol_input Relative error (default = 1e-6_wp). !! @return Result of the comparison. logical function f_approx_equal(a, b, tol_input) result(res) !$acc routine seq - ! Reference: https://floating-point-gui.de/errors/comparison/ - - real(kind(0d0)), intent(in) :: a, b - real(kind(0d0)), optional, intent(in) :: tol_input - real(kind(0d0)) :: tol + real(wp), intent(in) :: a, b + real(wp), optional, intent(in) :: tol_input + real(wp) :: tol if (present(tol_input)) then tol = tol_input else - tol = 1d-6 + tol = 1e-6_wp end if if (a == b) then res = .true. - else if (a == 0d0 .or. b == 0d0 .or. (abs(a) + abs(b) < tiny(a))) then + else if (a == 0._wp .or. b == 0._wp .or. (abs(a) + abs(b) < tiny(a))) then res = (abs(a - b) < (tol*tiny(a))) else res = (abs(a - b)/min(abs(a) + abs(b), huge(a)) < tol) end if end function f_approx_equal - !> Checks if a real(kind(0d0)) variable is of default value. + !> Checks if a real(wp) variable is of default value. !! @param var Variable to check. logical function f_is_default(var) result(res) !$acc routine seq - real(kind(0d0)), intent(in) :: var + real(wp), intent(in) :: var res = f_approx_equal(var, dflt_real) end function f_is_default - !> Checks if ALL elements of a real(kind(0d0)) array are of default value. + !> Checks if ALL elements of a real(wp) array are of default value. !! @param var_array Array to check. logical function f_all_default(var_array) result(res) - real(kind(0d0)), intent(in) :: var_array(:) + real(wp), intent(in) :: var_array(:) logical :: res_array(size(var_array)) integer :: i @@ -70,13 +68,13 @@ logical function f_all_default(var_array) result(res) res = all(res_array) end function f_all_default - !> Checks if a real(kind(0d0)) variable is an integer. + !> Checks if a real(wp) variable is an integer. !! @param var Variable to check. logical function f_is_integer(var) result(res) !$acc routine seq - real(kind(0d0)), intent(in) :: var + real(wp), intent(in) :: var - res = f_approx_equal(var, real(nint(var), kind(0d0))) + res = f_approx_equal(var, real(nint(var), wp)) end function f_is_integer end module m_helper_basic diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index 403ac4f13..8870271c5 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -128,7 +128,7 @@ contains ! Define the view for each variable do i = 1, sys_size call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_DATA%view(i), ierr) call MPI_TYPE_COMMIT(MPI_IO_DATA%view(i), ierr) end do @@ -136,7 +136,7 @@ contains if (qbmm .and. .not. polytropic) then do i = sys_size + 1, sys_size + 2*nb*4 call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_DATA%view(i), ierr) call MPI_TYPE_COMMIT(MPI_IO_DATA%view(i), ierr) end do @@ -164,9 +164,9 @@ contains #ifndef MFC_POST_PROCESS call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_levelset_DATA%view, ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_levelset_DATA%view, ierr) call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_levelsetnorm_DATA%view, ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_levelsetnorm_DATA%view, ierr) call MPI_TYPE_COMMIT(MPI_IO_levelset_DATA%view, ierr) call MPI_TYPE_COMMIT(MPI_IO_levelsetnorm_DATA%view, ierr) @@ -194,7 +194,7 @@ contains #endif call MPI_TYPE_CREATE_SUBARRAY(1, airfoil_glb, airfoil_loc, airfoil_start, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(1), ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_airfoil_IB_DATA%view(1), ierr) call MPI_TYPE_COMMIT(MPI_IO_airfoil_IB_DATA%view(1), ierr) #ifdef MFC_PRE_PROCESS @@ -204,7 +204,7 @@ contains end do #endif call MPI_TYPE_CREATE_SUBARRAY(1, airfoil_glb, airfoil_loc, airfoil_start, & - MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(2), ierr) + MPI_ORDER_FORTRAN, mpi_p, MPI_IO_airfoil_IB_DATA%view(2), ierr) call MPI_TYPE_COMMIT(MPI_IO_airfoil_IB_DATA%view(2), ierr) end if @@ -219,12 +219,12 @@ contains subroutine mpi_bcast_time_step_values(proc_time, time_avg) - real(kind(0d0)), dimension(0:num_procs - 1), intent(inout) :: proc_time - real(kind(0d0)), intent(inout) :: time_avg + real(wp), dimension(0:num_procs - 1), intent(inout) :: proc_time + real(wp), intent(inout) :: time_avg #ifdef MFC_MPI - call MPI_GATHER(time_avg, 1, MPI_DOUBLE_PRECISION, proc_time(0), 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHER(time_avg, 1, mpi_p, proc_time(0), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #endif @@ -253,15 +253,15 @@ contains ccfl_max_glb, & Rc_min_glb) - real(kind(0d0)), intent(in) :: icfl_max_loc - real(kind(0d0)), intent(in) :: vcfl_max_loc - real(kind(0d0)), intent(in) :: ccfl_max_loc - real(kind(0d0)), intent(in) :: Rc_min_loc + real(wp), intent(in) :: icfl_max_loc + real(wp), intent(in) :: vcfl_max_loc + real(wp), intent(in) :: ccfl_max_loc + real(wp), intent(in) :: Rc_min_loc - real(kind(0d0)), intent(out) :: icfl_max_glb - real(kind(0d0)), intent(out) :: vcfl_max_glb - real(kind(0d0)), intent(out) :: ccfl_max_glb - real(kind(0d0)), intent(out) :: Rc_min_glb + real(wp), intent(out) :: icfl_max_glb + real(wp), intent(out) :: vcfl_max_glb + real(wp), intent(out) :: ccfl_max_glb + real(wp), intent(out) :: Rc_min_glb #ifdef MFC_SIMULATION #ifdef MFC_MPI @@ -269,15 +269,15 @@ contains ! Reducing local extrema of ICFL, VCFL, CCFL and Rc numbers to their ! global extrema and bookkeeping the results on the rank 0 processor call MPI_REDUCE(icfl_max_loc, icfl_max_glb, 1, & - MPI_DOUBLE_PRECISION, MPI_MAX, 0, & + mpi_p, MPI_MAX, 0, & MPI_COMM_WORLD, ierr) if (viscous) then call MPI_REDUCE(vcfl_max_loc, vcfl_max_glb, 1, & - MPI_DOUBLE_PRECISION, MPI_MAX, 0, & + mpi_p, MPI_MAX, 0, & MPI_COMM_WORLD, ierr) call MPI_REDUCE(Rc_min_loc, Rc_min_glb, 1, & - MPI_DOUBLE_PRECISION, MPI_MIN, 0, & + mpi_p, MPI_MIN, 0, & MPI_COMM_WORLD, ierr) end if @@ -304,13 +304,13 @@ contains !! @param var_glb The globally reduced value subroutine s_mpi_allreduce_sum(var_loc, var_glb) - real(kind(0d0)), intent(in) :: var_loc - real(kind(0d0)), intent(out) :: var_glb + real(wp), intent(in) :: var_loc + real(wp), intent(out) :: var_glb #ifdef MFC_MPI ! Performing the reduction procedure - call MPI_ALLREDUCE(var_loc, var_glb, 1, MPI_DOUBLE_PRECISION, & + call MPI_ALLREDUCE(var_loc, var_glb, 1, mpi_p, & MPI_SUM, MPI_COMM_WORLD, ierr) #endif @@ -326,13 +326,13 @@ contains !! @param var_glb The globally reduced value subroutine s_mpi_allreduce_min(var_loc, var_glb) - real(kind(0d0)), intent(in) :: var_loc - real(kind(0d0)), intent(out) :: var_glb + real(wp), intent(in) :: var_loc + real(wp), intent(out) :: var_glb #ifdef MFC_MPI ! Performing the reduction procedure - call MPI_ALLREDUCE(var_loc, var_glb, 1, MPI_DOUBLE_PRECISION, & + call MPI_ALLREDUCE(var_loc, var_glb, 1, mpi_p, & MPI_MIN, MPI_COMM_WORLD, ierr) #endif @@ -348,13 +348,13 @@ contains !! @param var_glb The globally reduced value subroutine s_mpi_allreduce_max(var_loc, var_glb) - real(kind(0d0)), intent(in) :: var_loc - real(kind(0d0)), intent(out) :: var_glb + real(wp), intent(in) :: var_loc + real(wp), intent(out) :: var_glb #ifdef MFC_MPI ! Performing the reduction procedure - call MPI_ALLREDUCE(var_loc, var_glb, 1, MPI_DOUBLE_PRECISION, & + call MPI_ALLREDUCE(var_loc, var_glb, 1, mpi_p, & MPI_MAX, MPI_COMM_WORLD, ierr) #endif @@ -369,19 +369,19 @@ contains !! the minimum value, reduced amongst all of the local values. subroutine s_mpi_reduce_min(var_loc) - real(kind(0d0)), intent(inout) :: var_loc + real(wp), intent(inout) :: var_loc #ifdef MFC_MPI ! Temporary storage variable that holds the reduced minimum value - real(kind(0d0)) :: var_glb + real(wp) :: var_glb ! Performing reduction procedure and eventually storing its result ! into the variable that was initially inputted into the subroutine - call MPI_REDUCE(var_loc, var_glb, 1, MPI_DOUBLE_PRECISION, & + call MPI_REDUCE(var_loc, var_glb, 1, mpi_p, & MPI_MIN, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(var_glb, 1, MPI_DOUBLE_PRECISION, & + call MPI_BCAST(var_glb, 1, mpi_p, & 0, MPI_COMM_WORLD, ierr) var_loc = var_glb @@ -404,20 +404,20 @@ contains !! belongs. subroutine s_mpi_reduce_maxloc(var_loc) - real(kind(0d0)), dimension(2), intent(inout) :: var_loc + real(wp), dimension(2), intent(inout) :: var_loc #ifdef MFC_MPI - real(kind(0d0)), dimension(2) :: var_glb !< + real(wp), dimension(2) :: var_glb !< !! Temporary storage variable that holds the reduced maximum value !! and the rank of the processor with which the value is associated ! Performing reduction procedure and eventually storing its result ! into the variable that was initially inputted into the subroutine - call MPI_REDUCE(var_loc, var_glb, 1, MPI_2DOUBLE_PRECISION, & + call MPI_REDUCE(var_loc, var_glb, 1, mpi_2p, & MPI_MAXLOC, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(var_glb, 1, MPI_2DOUBLE_PRECISION, & + call MPI_BCAST(var_glb, 1, mpi_2p, & 0, MPI_COMM_WORLD, ierr) var_loc = var_glb diff --git a/src/common/m_phase_change.fpp b/src/common/m_phase_change.fpp index d523d4706..132651e68 100644 --- a/src/common/m_phase_change.fpp +++ b/src/common/m_phase_change.fpp @@ -36,17 +36,17 @@ module m_phase_change !> @name Parameters for the first order transition phase change !> @{ - integer, parameter :: max_iter = 1e8 !< max # of iterations - real(kind(0d0)), parameter :: pCr = 4.94d7 !< Critical water pressure - real(kind(0d0)), parameter :: TCr = 385.05 + 273.15 !< Critical water temperature - real(kind(0d0)), parameter :: mixM = 1.0d-8 !< threshold for 'mixture cell'. If Y < mixM, phase change does not happen + integer, parameter :: max_iter = 1e8_wp !< max # of iterations + real(wp), parameter :: pCr = 4.94e7_wp !< Critical water pressure + real(wp), parameter :: TCr = 385.05_wp + 273.15_wp !< Critical water temperature + real(wp), parameter :: mixM = 1.0e-8_wp !< threshold for 'mixture cell'. If Y < mixM, phase change does not happen integer, parameter :: lp = 1 !< index for the liquid phase of the reacting fluid integer, parameter :: vp = 2 !< index for the vapor phase of the reacting fluid !> @} !> @name Gibbs free energy phase change parameters !> @{ - real(kind(0d0)) :: A, B, C, D + real(wp) :: A, B, C, D !> @} !$acc declare create(max_iter,pCr,TCr,mixM,lp,vp,A,B,C,D) @@ -70,15 +70,15 @@ contains subroutine s_initialize_phasechange_module ! variables used in the calculation of the saturation curves for fluids 1 and 2 A = (gs_min(lp)*cvs(lp) - gs_min(vp)*cvs(vp) & - + qvps(vp) - qvps(lp))/((gs_min(vp) - 1.0d0)*cvs(vp)) + + qvps(vp) - qvps(lp))/((gs_min(vp) - 1.0_wp)*cvs(vp)) - B = (qvs(lp) - qvs(vp))/((gs_min(vp) - 1.0d0)*cvs(vp)) + B = (qvs(lp) - qvs(vp))/((gs_min(vp) - 1.0_wp)*cvs(vp)) C = (gs_min(vp)*cvs(vp) - gs_min(lp)*cvs(lp)) & - /((gs_min(vp) - 1.0d0)*cvs(vp)) + /((gs_min(vp) - 1.0_wp)*cvs(vp)) - D = ((gs_min(lp) - 1.0d0)*cvs(lp)) & - /((gs_min(vp) - 1.0d0)*cvs(vp)) + D = ((gs_min(lp) - 1.0_wp)*cvs(lp)) & + /((gs_min(vp) - 1.0_wp)*cvs(vp)) end subroutine s_initialize_phasechange_module @@ -90,15 +90,15 @@ contains subroutine s_infinite_relaxation_k(q_cons_vf) type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf - real(kind(0.0d0)) :: pS, pSOV, pSSL !< equilibrium pressure for mixture, overheated vapor, and subcooled liquid - real(kind(0.0d0)) :: TS, TSOV, TSSL, TSatOV, TSatSL !< equilibrium temperature for mixture, overheated vapor, and subcooled liquid. Saturation Temperatures at overheated vapor and subcooled liquid - real(kind(0.0d0)) :: rhoe, dynE, rhos !< total internal energy, kinetic energy, and total entropy - real(kind(0.0d0)) :: rho, rM, m1, m2, MCT !< total density, total reacting mass, individual reacting masses - real(kind(0.0d0)) :: TvF !< total volume fraction + real(kind(0.0_wp)) :: pS, pSOV, pSSL !< equilibrium pressure for mixture, overheated vapor, and subcooled liquid + 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 + real(kind(0.0_wp)) :: rhoe, dynE, rhos !< total internal energy, kinetic energy, and total entropy + real(kind(0.0_wp)) :: rho, rM, m1, m2, MCT !< total density, total reacting mass, individual reacting masses + real(kind(0.0_wp)) :: TvF !< total volume fraction !$acc declare create(pS, pSOV, pSSL, TS, TSOV, TSatOV, TSatSL, TSSL, rhoe, dynE, rhos, rho, rM, m1, m2, MCT, TvF) - real(kind(0d0)), dimension(num_fluids) :: p_infOV, p_infpT, p_infSL, sk, hk, gk, ek, rhok + real(wp), dimension(num_fluids) :: p_infOV, p_infpT, p_infSL, sk, hk, gk, ek, rhok !< Generic loop iterators integer :: i, j, k, l @@ -111,7 +111,7 @@ contains do k = 0, n do l = 0, p - rho = 0.0d0; TvF = 0.0d0 + rho = 0.0_wp; TvF = 0.0_wp !$acc loop seq do i = 1, num_fluids @@ -137,11 +137,11 @@ contains m2 = q_cons_vf(vp + contxb - 1)%sf(j, k, l) ! kinetic energy as an auxiliary variable to the calculation of the total internal energy - dynE = 0.0d0 + dynE = 0.0_wp !$acc loop seq do i = momxb, momxe - dynE = dynE + 5.0d-1*q_cons_vf(i)%sf(j, k, l)**2/rho + dynE = dynE + 5.0e-1_wp*q_cons_vf(i)%sf(j, k, l)**2/rho end do @@ -170,7 +170,7 @@ contains q_cons_vf(lp + contxb - 1)%sf(j, k, l) = mixM*rM ! tranferring the total mass to vapor - q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0d0 - mixM)*rM + q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0_wp - mixM)*rM ! calling pT-equilibrium for overheated vapor, which is MFL = 0 call s_infinite_pt_relaxation_k(j, k, l, 0, pSOV, p_infOV, rM, q_cons_vf, rhoe, TSOV) @@ -180,7 +180,7 @@ contains ! subcooled liquid case ! tranferring the total mass to liquid - q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0d0 - mixM)*rM + q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0_wp - mixM)*rM ! depleting the mass of vapor q_cons_vf(vp + contxb - 1)%sf(j, k, l) = mixM*rM @@ -204,7 +204,7 @@ contains q_cons_vf(lp + contxb - 1)%sf(j, k, l) = mixM*rM ! correcting the vapor partial density - q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0d0 - mixM)*rM + q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0_wp - mixM)*rM elseif (TSSL < TSatSL) then @@ -215,7 +215,7 @@ contains TS = TSSL ! correcting the liquid partial density - q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0d0 - mixM)*rM + q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0_wp - mixM)*rM ! correcting the vapor partial density q_cons_vf(vp + contxb - 1)%sf(j, k, l) = mixM*rM @@ -239,8 +239,8 @@ contains ! Calculations AFTER equilibrium ! entropy - sk(1:num_fluids) = cvs(1:num_fluids)*DLOG((TS**gs_min(1:num_fluids)) & - /((pS + ps_inf(1:num_fluids))**(gs_min(1:num_fluids) - 1.0d0))) + qvps(1:num_fluids) + sk(1:num_fluids) = cvs(1:num_fluids)*log((TS**gs_min(1:num_fluids)) & + /((pS + ps_inf(1:num_fluids))**(gs_min(1:num_fluids) - 1.0_wp))) + qvps(1:num_fluids) ! enthalpy hk(1:num_fluids) = gs_min(1:num_fluids)*cvs(1:num_fluids)*TS & @@ -259,7 +259,7 @@ contains *cvs(1:num_fluids)*TS + qvs(1:num_fluids) ! calculating volume fractions, internal energies, and total entropy - rhos = 0.0d0 + rhos = 0.0_wp !$acc loop seq do i = 1, num_fluids @@ -300,19 +300,18 @@ contains ! initializing variables integer, intent(in) :: j, k, l, MFL - real(kind(0.0d0)), intent(out) :: pS - real(kind(0.0d0)), dimension(num_fluids), intent(out) :: p_infpT - real(kind(0.0d0)), intent(in) :: rM + real(kind(0.0_wp)), intent(out) :: pS + real(kind(0.0_wp)), dimension(num_fluids), intent(out) :: p_infpT + real(kind(0.0_wp)), intent(in) :: rM type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf - real(kind(0.0d0)), intent(in) :: rhoe - real(kind(0.0d0)), intent(out) :: TS - - real(kind(0.0d0)) :: gp, gpp, hp, pO, mCP, mQ !< variables for the Newton Solver + real(kind(0.0_wp)), intent(in) :: rhoe + real(kind(0.0_wp)), intent(out) :: TS + real(kind(0.0_wp)) :: gp, gpp, hp, pO, mCP, mQ !< variables for the Newton Solver integer :: i, ns !< generic loop iterators ! auxiliary variables for the pT-equilibrium solver - mCP = 0.0d0; mQ = 0.0d0; p_infpT = ps_inf; + mCP = 0.0_wp; mQ = 0.0_wp; p_infpT = ps_inf; ! Performing tests before initializing the pT-equilibrium !$acc loop seq do i = 1, num_fluids @@ -326,16 +325,16 @@ contains end do ! Checking energy constraint - if ((rhoe - mQ - minval(p_infpT)) < 0.0d0) then + if ((rhoe - mQ - minval(p_infpT)) < 0.0_wp) then if ((MFL == 0) .or. (MFL == 1)) then ! Assigning zero values for mass depletion cases ! pressure - pS = 0.0d0 + pS = 0.0_wp ! temperature - TS = 0.0d0 + TS = 0.0_wp return end if @@ -344,16 +343,16 @@ contains ! calculating initial estimate for pressure in the pT-relaxation procedure. I will also use this variable to ! iterate over the Newton's solver - pO = 0.0d0 + pO = 0.0_wp ! Maybe improve this condition afterwards. As long as the initial guess is in between -min(ps_inf) ! and infinity, a solution should be able to be found. - pS = 1.0d4 + pS = 1.0e4_wp ! Newton Solver for the pT-equilibrium ns = 0 - ! change this relative error metric. 1E4 is just arbitrary - do while ((DABS(pS - pO) > palpha_eps) .and. (DABS((pS - pO)/pO) > palpha_eps/1e4) .or. (ns == 0)) + ! change this relative error metric. 1e4_wp is just arbitrary + do while ((abs(pS - pO) > palpha_eps) .and. (abs((pS - pO)/pO) > palpha_eps/1e4_wp) .or. (ns == 0)) ! increasing counter ns = ns + 1 @@ -362,23 +361,23 @@ contains pO = pS ! updating functions used in the Newton's solver - gpp = 0.0d0; gp = 0.0d0; hp = 0.0d0 + gpp = 0.0_wp; gp = 0.0_wp; hp = 0.0_wp !$acc loop seq do i = 1, num_fluids - gp = gp + (gs_min(i) - 1.0d0)*q_cons_vf(i + contxb - 1)%sf(j, k, l)*cvs(i) & + gp = gp + (gs_min(i) - 1.0_wp)*q_cons_vf(i + contxb - 1)%sf(j, k, l)*cvs(i) & *(rhoe + pS - mQ)/(mCP*(pS + p_infpT(i))) - gpp = gpp + (gs_min(i) - 1.0d0)*q_cons_vf(i + contxb - 1)%sf(j, k, l)*cvs(i) & + gpp = gpp + (gs_min(i) - 1.0_wp)*q_cons_vf(i + contxb - 1)%sf(j, k, l)*cvs(i) & *(p_infpT(i) - rhoe + mQ)/(mCP*(pS + p_infpT(i))**2) end do - hp = 1.0d0/(rhoe + pS - mQ) + 1.0d0/(pS + minval(p_infpT)) + hp = 1.0_wp/(rhoe + pS - mQ) + 1.0_wp/(pS + minval(p_infpT)) ! updating common pressure for the newton solver - pS = pO + ((1.0d0 - gp)/gpp)/(1.0d0 - (1.0d0 - gp + DABS(1.0d0 - gp)) & - /(2.0d0*gpp)*hp) + pS = pO + ((1.0_wp - gp)/gpp)/(1.0_wp - (1.0_wp - gp + abs(1.0_wp - gp)) & + /(2.0_wp*gpp)*hp) end do ! common temperature @@ -405,17 +404,17 @@ contains #endif integer, intent(in) :: j, k, l - real(kind(0.0d0)), intent(inout) :: pS - real(kind(0.0d0)), dimension(num_fluids), intent(in) :: p_infpT - real(kind(0.0d0)), intent(in) :: rhoe + real(kind(0.0_wp)), intent(inout) :: pS + real(kind(0.0_wp)), dimension(num_fluids), intent(in) :: p_infpT + real(kind(0.0_wp)), intent(in) :: rhoe type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf - real(kind(0.0d0)), intent(inout) :: TS + real(kind(0.0_wp)), intent(inout) :: TS - real(kind(0.0d0)), dimension(num_fluids) :: p_infpTg !< stiffness for the participating fluids for pTg-equilibrium - real(kind(0.0d0)), dimension(2, 2) :: Jac, InvJac, TJac !< matrices for the Newton Solver - real(kind(0.0d0)), dimension(2) :: R2D, DeltamP !< residual and correction array - real(kind(0.0d0)) :: Om ! underrelaxation factor - real(kind(0.0d0)) :: mCP, mCPD, mCVGP, mCVGP2, mQ, mQD ! auxiliary variables for the pTg-solver + real(kind(0.0_wp)), dimension(num_fluids) :: p_infpTg !< stiffness for the participating fluids for pTg-equilibrium + real(kind(0.0_wp)), dimension(2, 2) :: Jac, InvJac, TJac !< matrices for the Newton Solver + real(kind(0.0_wp)), dimension(2) :: R2D, DeltamP !< residual and correction array + real(kind(0.0_wp)) :: Om ! underrelaxation factor + real(kind(0.0_wp)) :: mCP, mCPD, mCVGP, mCVGP2, mQ, mQD ! auxiliary variables for the pTg-solver !< Generic loop iterators integer :: i, ns @@ -425,17 +424,17 @@ contains ns = 0 ! Relaxation factor - Om = 1.0d-3 + Om = 1.0e-3_wp p_infpTg = p_infpT - if (((pS < 0.0d0) .and. ((q_cons_vf(lp + contxb - 1)%sf(j, k, l) & - + q_cons_vf(vp + contxb - 1)%sf(j, k, l)) > ((rhoe & - - gs_min(lp)*ps_inf(lp)/(gs_min(lp) - 1))/qvs(lp)))) .or. & - ((pS >= 0.0d0) .and. (pS < 1.0d-1))) then + if (((pS < 0.0_wp) .and. ((q_cons_vf(lp + contxb - 1)%sf(j, k, l) & + + q_cons_vf(vp + contxb - 1)%sf(j, k, l)) > ((rhoe & + - gs_min(lp)*ps_inf(lp)/(gs_min(lp) - 1))/qvs(lp)))) .or. & + ((pS >= 0.0_wp) .and. (pS < 1.0e-1_wp))) then ! improve this initial condition - pS = 1.0d4 + pS = 1.0e4_wp end if @@ -444,17 +443,17 @@ contains ! for the residual, and how to do it adequately. ! Dummy guess to start the pTg-equilibrium problem. ! improve this initial condition - R2D(1) = 0.0d0; R2D(2) = 0.0d0 - DeltamP(1) = 0.0d0; DeltamP(2) = 0.0d0 - do while (((DSQRT(R2D(1)**2 + R2D(2)**2) > ptgalpha_eps) & - .and. ((DSQRT(R2D(1)**2 + R2D(2)**2)/rhoe) > (ptgalpha_eps/1d6))) & + R2D(1) = 0.0_wp; R2D(2) = 0.0_wp + DeltamP(1) = 0.0_wp; DeltamP(2) = 0.0_wp + do while (((sqrt(R2D(1)**2 + R2D(2)**2) > ptgalpha_eps) & + .and. ((sqrt(R2D(1)**2 + R2D(2)**2)/rhoe) > (ptgalpha_eps/1e6_wp))) & .or. (ns == 0)) ! Updating counter for the iterative procedure ns = ns + 1 ! Auxiliary variables to help in the calculation of the residue - mCP = 0.0d0; mCPD = 0.0d0; mCVGP = 0.0d0; mCVGP2 = 0.0d0; mQ = 0.0d0; mQD = 0.0d0 + mCP = 0.0_wp; mCPD = 0.0_wp; mCVGP = 0.0_wp; mCVGP2 = 0.0_wp; mQ = 0.0_wp; mQD = 0.0_wp ! Those must be updated through the iterations, as they either depend on ! the partial masses for all fluids, or on the equilibrium pressure !$acc loop seq @@ -491,7 +490,7 @@ contains call s_compute_jacobian_matrix(InvJac, j, Jac, k, l, mCPD, mCVGP, mCVGP2, pS, q_cons_vf, TJac) ! calculating correction array for Newton's method - DeltamP = -1.0d0*matmul(InvJac, R2D) + DeltamP = -1.0_wp*matmul(InvJac, R2D) ! updating two reacting 'masses'. Recall that inert 'masses' do not change during the phase change ! liquid @@ -531,19 +530,19 @@ contains !> @name variables for the correction of the reacting partial densities !> @{ - real(kind(0.0d0)), intent(out) :: MCT + real(kind(0.0_wp)), intent(out) :: MCT type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf - real(kind(0.0d0)), intent(inout) :: rM + real(kind(0.0_wp)), intent(inout) :: rM integer, intent(in) :: j, k, l !> @} - if (rM < 0.0d0) then + if (rM < 0.0_wp) then - if ((q_cons_vf(lp + contxb - 1)%sf(j, k, l) >= -1.0d0*mixM) .and. & - (q_cons_vf(vp + contxb - 1)%sf(j, k, l) >= -1.0d0*mixM)) then + if ((q_cons_vf(lp + contxb - 1)%sf(j, k, l) >= -1.0_wp*mixM) .and. & + (q_cons_vf(vp + contxb - 1)%sf(j, k, l) >= -1.0_wp*mixM)) then - q_cons_vf(lp + contxb - 1)%sf(j, k, l) = 0.0d0 + q_cons_vf(lp + contxb - 1)%sf(j, k, l) = 0.0_wp - q_cons_vf(vp + contxb - 1)%sf(j, k, l) = 0.0d0 + q_cons_vf(vp + contxb - 1)%sf(j, k, l) = 0.0_wp rM = q_cons_vf(lp + contxb - 1)%sf(j, k, l) + q_cons_vf(vp + contxb - 1)%sf(j, k, l) @@ -556,15 +555,15 @@ contains MCT = 2*mixM ! correcting the partial densities of the reacting fluids. What to do for the nonreacting ones? - if (q_cons_vf(lp + contxb - 1)%sf(j, k, l) < 0.0d0) then + if (q_cons_vf(lp + contxb - 1)%sf(j, k, l) < 0.0_wp) then q_cons_vf(lp + contxb - 1)%sf(j, k, l) = MCT*rM - q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0d0 - MCT)*rM + q_cons_vf(vp + contxb - 1)%sf(j, k, l) = (1.0_wp - MCT)*rM - elseif (q_cons_vf(vp + contxb - 1)%sf(j, k, l) < 0.0d0) then + elseif (q_cons_vf(vp + contxb - 1)%sf(j, k, l) < 0.0_wp) then - q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0d0 - MCT)*rM + q_cons_vf(lp + contxb - 1)%sf(j, k, l) = (1.0_wp - MCT)*rM q_cons_vf(vp + contxb - 1)%sf(j, k, l) = MCT*rM @@ -592,15 +591,15 @@ contains !$acc routine seq #endif - real(kind(0.0d0)), dimension(2, 2), intent(out) :: InvJac + real(kind(0.0_wp)), dimension(2, 2), intent(out) :: InvJac integer, intent(in) :: j - real(kind(0.0d0)), dimension(2, 2), intent(out) :: Jac + real(kind(0.0_wp)), dimension(2, 2), intent(out) :: Jac integer, intent(in) :: k, l - real(kind(0.0d0)), intent(in) :: mCPD, mCVGP, mCVGP2, pS + real(kind(0.0_wp)), intent(in) :: mCPD, mCVGP, mCVGP2, pS type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf - real(kind(0.0d0)), dimension(2, 2), intent(out) :: TJac + real(kind(0.0_wp)), dimension(2, 2), intent(out) :: TJac - real(kind(0.0d0)) :: ml, mT, TS, dFdT, dTdm, dTdp ! mass of the reacting fluid, total reacting mass, and auxiliary variables + real(kind(0.0_wp)) :: ml, mT, TS, dFdT, dTdm, dTdp ! mass of the reacting fluid, total reacting mass, and auxiliary variables ! mass of the reacting liquid ml = q_cons_vf(lp + contxb - 1)%sf(j, k, l) @@ -615,10 +614,10 @@ contains + mCVGP) dFdT = & - -(cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp))*DLOG(TS) & + -(cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp))*log(TS) & - (qvps(lp) - qvps(vp)) & - + cvs(lp)*(gs_min(lp) - 1)*DLOG(pS + ps_inf(lp)) & - - cvs(vp)*(gs_min(vp) - 1)*DLOG(pS + ps_inf(vp)) + + cvs(lp)*(gs_min(lp) - 1)*log(pS + ps_inf(lp)) & + - cvs(vp)*(gs_min(vp) - 1)*log(pS + ps_inf(vp)) dTdm = -(cvs(lp)*(gs_min(lp) - 1)/(pS + ps_inf(lp)) & - cvs(vp)*(gs_min(vp) - 1)/(pS + ps_inf(vp)))*TS**2 @@ -665,8 +664,8 @@ contains ! intermediate elements of J^{-1} InvJac(1, 1) = Jac(2, 2) - InvJac(1, 2) = -1.0d0*Jac(1, 2) - InvJac(2, 1) = -1.0d0*Jac(2, 1) + InvJac(1, 2) = -1.0_wp*Jac(1, 2) + InvJac(2, 1) = -1.0_wp*Jac(2, 1) InvJac(2, 2) = Jac(1, 1) ! elements of J^{T} @@ -700,12 +699,12 @@ contains #endif integer, intent(in) :: j, k, l - real(kind(0.0d0)), intent(in) :: mCPD, mCVGP, mQD + real(kind(0.0_wp)), intent(in) :: mCPD, mCVGP, mQD type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf - real(kind(0.0d0)), intent(in) :: pS, rhoe - real(kind(0.0d0)), dimension(2), intent(out) :: R2D + real(kind(0.0_wp)), intent(in) :: pS, rhoe + real(kind(0.0_wp)), dimension(2), intent(out) :: R2D - real(kind(0.0d0)) :: ml, mT, TS !< mass of the reacting liquid, total reacting mass, equilibrium temperature + real(kind(0.0_wp)) :: ml, mT, TS !< mass of the reacting liquid, total reacting mass, equilibrium temperature ! mass of the reacting liquid ml = q_cons_vf(lp + contxb - 1)%sf(j, k, l) @@ -721,9 +720,9 @@ contains ! Gibbs Free Energy Equality condition (DG) R2D(1) = TS*((cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp)) & - *(1 - DLOG(TS)) - (qvps(lp) - qvps(vp)) & - + cvs(lp)*(gs_min(lp) - 1)*DLOG(pS + ps_inf(lp)) & - - cvs(vp)*(gs_min(vp) - 1)*DLOG(pS + ps_inf(vp))) & + *(1 - log(TS)) - (qvps(lp) - qvps(vp)) & + + cvs(lp)*(gs_min(lp) - 1)*log(pS + ps_inf(lp)) & + - cvs(vp)*(gs_min(vp) - 1)*log(pS + ps_inf(vp))) & + qvs(lp) - qvs(vp) ! Constant Energy Process condition (DE) @@ -750,19 +749,19 @@ contains !$acc routine seq #endif - real(kind(0.0d0)), intent(in) :: pSat - real(kind(0.0d0)), intent(out) :: TSat - real(kind(0.0d0)), intent(in) :: TSIn + real(kind(0.0_wp)), intent(in) :: pSat + real(kind(0.0_wp)), intent(out) :: TSat + real(kind(0.0_wp)), intent(in) :: TSIn - real(kind(0.0d0)) :: dFdT, FT, Om !< auxiliary variables + real(kind(0.0_wp)) :: dFdT, FT, Om !< auxiliary variables ! Generic loop iterators integer :: ns - if ((pSat == 0.0d0) .and. (TSIn == 0.0d0)) then + if ((pSat == 0.0_wp) .and. (TSIn == 0.0_wp)) then ! assigning Saturation temperature - TSat = 0.0d0 + TSat = 0.0_wp else @@ -774,24 +773,24 @@ contains ns = 0 ! underrelaxation factor - Om = 1.0d-3 - do while ((DABS(FT) > ptgalpha_eps) .or. (ns == 0)) + Om = 1.0e-3_wp + do while ((abs(FT) > ptgalpha_eps) .or. (ns == 0)) ! increasing counter ns = ns + 1 ! calculating residual FT = TSat*((cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp)) & - *(1 - DLOG(TSat)) - (qvps(lp) - qvps(vp)) & - + cvs(lp)*(gs_min(lp) - 1)*DLOG(pSat + ps_inf(lp)) & - - cvs(vp)*(gs_min(vp) - 1)*DLOG(pSat + ps_inf(vp))) & + *(1 - log(TSat)) - (qvps(lp) - qvps(vp)) & + + cvs(lp)*(gs_min(lp) - 1)*log(pSat + ps_inf(lp)) & + - cvs(vp)*(gs_min(vp) - 1)*log(pSat + ps_inf(vp))) & + qvs(lp) - qvs(vp) ! calculating the jacobian dFdT = & - -(cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp))*DLOG(TSat) & + -(cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp))*log(TSat) & - (qvps(lp) - qvps(vp)) & - + cvs(lp)*(gs_min(lp) - 1)*DLOG(pSat + ps_inf(lp)) & - - cvs(vp)*(gs_min(vp) - 1)*DLOG(pSat + ps_inf(vp)) + + cvs(lp)*(gs_min(lp) - 1)*log(pSat + ps_inf(lp)) & + - cvs(vp)*(gs_min(vp) - 1)*log(pSat + ps_inf(vp)) ! updating saturation temperature TSat = TSat - Om*FT/dFdT diff --git a/src/common/m_precision_select.f90 b/src/common/m_precision_select.f90 new file mode 100644 index 000000000..3d3fa0383 --- /dev/null +++ b/src/common/m_precision_select.f90 @@ -0,0 +1,38 @@ +!> @file m_precision_select.f90 +!! @brief Contains module m_precision_select + +!> @brief This file contains the definition of floating point used in MFC +module m_precision_select + + ! use, intrinsic :: iso_c_binding + +#ifdef MFC_MPI + use mpi !< Message passing interface (MPI) module +#endif + + implicit none + + ! Define the available precision types + integer, parameter :: single_precision = selected_real_kind(6, 37) + integer, parameter :: double_precision = selected_real_kind(15, 307) + + integer, parameter :: sp = single_precision + integer, parameter :: dp = double_precision + + ! Set the working precision (wp) to single or double +#ifdef MFC_SINGLE_PRECISION + integer, parameter :: wp = single_precision ! Change to single_precision if needed +#else + integer, parameter :: wp = double_precision +#endif + +#ifdef MFC_MPI + ! Set mpi_p based on wp using the merge intrinsic function + integer, parameter :: mpi_p = merge(MPI_DOUBLE_PRECISION, MPI_REAL, wp == double_precision) + integer, parameter :: mpi_2p = merge(MPI_2DOUBLE_PRECISION, MPI_2REAL, wp == double_precision) +#else + integer, parameter :: mpi_p = -100 ! Default value when MPI is not used + integer, parameter :: mpi_2p = -100 +#endif + +end module m_precision_select diff --git a/src/common/m_variables_conversion.fpp b/src/common/m_variables_conversion.fpp index f6fd7e554..428caf8c3 100644 --- a/src/common/m_variables_conversion.fpp +++ b/src/common/m_variables_conversion.fpp @@ -51,22 +51,22 @@ module m_variables_conversion !! In simulation, gammas, pi_infs, and qvs are already declared in m_global_variables #ifndef MFC_SIMULATION - real(kind(0d0)), allocatable, public, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps + real(wp), allocatable, public, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps !$acc declare create(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps) #endif - real(kind(0d0)), allocatable, dimension(:) :: Gs + real(wp), allocatable, dimension(:) :: Gs integer, allocatable, dimension(:) :: bubrs - real(kind(0d0)), allocatable, dimension(:, :) :: Res + real(wp), allocatable, dimension(:, :) :: Res !$acc declare create(bubrs, Gs, Res) integer :: is1b, is2b, is3b, is1e, is2e, is3e !$acc declare create(is1b, is2b, is3b, is1e, is2e, is3e) - real(kind(0d0)), allocatable, dimension(:, :, :), public :: rho_sf !< Scalar density function - real(kind(0d0)), allocatable, dimension(:, :, :), public :: gamma_sf !< Scalar sp. heat ratio function - real(kind(0d0)), allocatable, dimension(:, :, :), public :: pi_inf_sf !< Scalar liquid stiffness function - real(kind(0d0)), allocatable, dimension(:, :, :), public :: qv_sf !< Scalar liquid energy reference function + real(wp), allocatable, dimension(:, :, :), public :: rho_sf !< Scalar density function + real(wp), allocatable, dimension(:, :, :), public :: gamma_sf !< Scalar sp. heat ratio function + real(wp), allocatable, dimension(:, :, :), public :: pi_inf_sf !< Scalar liquid stiffness function + real(wp), allocatable, dimension(:, :, :), public :: qv_sf !< Scalar liquid energy reference function contains @@ -86,10 +86,10 @@ contains type(scalar_field), dimension(sys_size), intent(in) :: q_vf integer, intent(in) :: i, j, k - real(kind(0d0)), intent(out), target :: rho, gamma, pi_inf, qv - real(kind(0d0)), optional, dimension(2), intent(out) :: Re_K - real(kind(0d0)), optional, intent(out) :: G_K - real(kind(0d0)), optional, dimension(num_fluids), intent(in) :: G + real(wp), intent(out), target :: rho, gamma, pi_inf, qv + real(wp), optional, dimension(2), intent(out) :: Re_K + real(wp), optional, intent(out) :: G_K + real(wp), optional, dimension(num_fluids), intent(in) :: G if (model_eqns == 1) then ! Gamma/pi_inf model call s_convert_mixture_to_mixture_variables(q_vf, i, j, k, & @@ -125,17 +125,17 @@ contains !$acc routine seq #endif - real(kind(0d0)), intent(in) :: energy, alf - real(kind(0d0)), intent(in) :: dyn_p - real(kind(0d0)), intent(in) :: pi_inf, gamma, rho, qv - real(kind(0d0)), intent(out) :: pres, T - real(kind(0d0)), intent(in), optional :: stress, mom, G + real(wp), intent(in) :: energy, alf + real(wp), intent(in) :: dyn_p + real(wp), intent(in) :: pi_inf, gamma, rho, qv + real(wp), intent(out) :: pres, T + real(wp), intent(in), optional :: stress, mom, G ! Chemistry - real(kind(0d0)), dimension(1:num_species), intent(in) :: rhoYks - real(kind(0d0)) :: E_e - real(kind(0d0)) :: e_Per_Kg, Pdyn_Per_Kg - real(kind(0d0)), dimension(1:num_species) :: Y_rs + real(wp), dimension(1:num_species), intent(in) :: rhoYks + real(wp) :: E_e + real(wp) :: e_Per_Kg, Pdyn_Per_Kg + real(wp), dimension(1:num_species) :: Y_rs integer :: s !< Generic loop iterator @@ -146,7 +146,7 @@ contains if ((model_eqns /= 4) .and. (bubbles .neqv. .true.)) then pres = (energy - dyn_p - pi_inf - qv)/gamma else if ((model_eqns /= 4) .and. bubbles) then - pres = ((energy - dyn_p)/(1.d0 - alf) - pi_inf - qv)/gamma + pres = ((energy - dyn_p)/(1._wp - alf) - pi_inf - qv)/gamma else pres = (pref + pi_inf)* & (energy/ & @@ -156,22 +156,22 @@ contains if (hypoelasticity .and. present(G)) then ! calculate elastic contribution to Energy - E_e = 0d0 + E_e = 0._wp do s = stress_idx%beg, stress_idx%end if (G > 0) then - E_e = E_e + ((stress/rho)**2d0)/(4d0*G) + E_e = E_e + ((stress/rho)**2._wp)/(4._wp*G) ! Additional terms in 2D and 3D if ((s == stress_idx%beg + 1) .or. & (s == stress_idx%beg + 3) .or. & (s == stress_idx%beg + 4)) then - E_e = E_e + ((stress/rho)**2d0)/(4d0*G) + E_e = E_e + ((stress/rho)**2._wp)/(4._wp*G) end if end if end do pres = ( & energy - & - 0.5d0*(mom**2.d0)/rho - & + 0.5_wp*(mom**2._wp)/rho - & pi_inf - qv - E_e & )/gamma @@ -183,7 +183,7 @@ contains e_Per_Kg = energy/rho Pdyn_Per_Kg = dyn_p/rho - call get_temperature(e_Per_Kg - Pdyn_Per_Kg, 1200d0, Y_rs, .true., T) + call get_temperature(e_Per_Kg - Pdyn_Per_Kg, 1200._wp, Y_rs, .true., T) call get_pressure(rho, T, Y_rs, pres) #:endif @@ -209,22 +209,22 @@ contains type(scalar_field), dimension(sys_size), intent(in) :: q_vf integer, intent(in) :: i, j, k - real(kind(0d0)), intent(out), target :: rho - real(kind(0d0)), intent(out), target :: gamma - real(kind(0d0)), intent(out), target :: pi_inf - real(kind(0d0)), intent(out), target :: qv + real(wp), intent(out), target :: rho + real(wp), intent(out), target :: gamma + real(wp), intent(out), target :: pi_inf + real(wp), intent(out), target :: qv - real(kind(0d0)), optional, dimension(2), intent(out) :: Re_K + real(wp), optional, dimension(2), intent(out) :: Re_K - real(kind(0d0)), optional, intent(out) :: G_K - real(kind(0d0)), optional, dimension(num_fluids), intent(in) :: G + real(wp), optional, intent(out) :: G_K + real(wp), optional, dimension(num_fluids), intent(in) :: G ! Transferring the density, the specific heat ratio function and the ! liquid stiffness function, respectively rho = q_vf(1)%sf(i, j, k) gamma = q_vf(gamma_idx)%sf(i, j, k) pi_inf = q_vf(pi_inf_idx)%sf(i, j, k) - qv = 0d0 ! keep this value nill for now. For future adjustment + qv = 0._wp ! keep this value nill for now. For future adjustment ! Post process requires rho_sf/gamma_sf/pi_inf_sf/qv_sf to also be updated #ifdef MFC_POST_PROCESS @@ -257,17 +257,17 @@ contains integer, intent(in) :: j, k, l - real(kind(0d0)), intent(out), target :: rho - real(kind(0d0)), intent(out), target :: gamma - real(kind(0d0)), intent(out), target :: pi_inf - real(kind(0d0)), intent(out), target :: qv + real(wp), intent(out), target :: rho + real(wp), intent(out), target :: gamma + real(wp), intent(out), target :: pi_inf + real(wp), intent(out), target :: qv - real(kind(0d0)), optional, dimension(2), intent(out) :: Re_K - real(kind(0d0)), optional, intent(out) :: G_K - real(kind(0d0)), optional, dimension(num_fluids), intent(in) :: G + real(wp), optional, dimension(2), intent(out) :: Re_K + real(wp), optional, intent(out) :: G_K + real(wp), optional, dimension(num_fluids), intent(in) :: G integer :: i, q - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_K, alpha_K + real(wp), dimension(num_fluids) :: alpha_rho_K, alpha_K ! Constraining the partial densities and the volume fractions within ! their physical bounds to make sure that any mixture variables that @@ -281,11 +281,11 @@ contains if (mpp_lim) then do i = 1, num_fluids - alpha_rho_K(i) = max(0d0, alpha_rho_K(i)) - alpha_K(i) = min(max(0d0, alpha_K(i)), 1d0) + alpha_rho_K(i) = max(0._wp, alpha_rho_K(i)) + alpha_K(i) = min(max(0._wp, alpha_K(i)), 1._wp) end do - alpha_K = alpha_K/max(sum(alpha_K), 1d-16) + alpha_K = alpha_K/max(sum(alpha_K), 1e-16_wp) end if @@ -298,7 +298,7 @@ contains pi_inf = fluid_pp(1)%pi_inf !qK_vf(pi_inf_idx)%sf(i,j,k) qv = fluid_pp(1)%qv else if ((model_eqns == 2) .and. bubbles) then - rho = 0d0; gamma = 0d0; pi_inf = 0d0; qv = 0d0 + rho = 0._wp; gamma = 0._wp; pi_inf = 0._wp; qv = 0._wp if (mpp_lim .and. (num_fluids > 2)) then do i = 1, num_fluids @@ -337,14 +337,14 @@ contains if (num_fluids == 1) then ! need to consider case with num_fluids >= 2 do i = 1, 2 - Re_K(i) = dflt_real; if (Re_size(i) > 0) Re_K(i) = 0d0 + Re_K(i) = dflt_real; if (Re_size(i) > 0) Re_K(i) = 0._wp do q = 1, Re_size(i) Re_K(i) = (1 - alpha_K(Re_idx(i, q)))/fluid_pp(Re_idx(i, q))%Re(i) & + Re_K(i) end do - Re_K(i) = 1d0/max(Re_K(i), sgm_eps) + Re_K(i) = 1._wp/max(Re_K(i), sgm_eps) end do end if @@ -381,17 +381,17 @@ contains integer, intent(in) :: k, l, r - real(kind(0d0)), intent(out), target :: rho - real(kind(0d0)), intent(out), target :: gamma - real(kind(0d0)), intent(out), target :: pi_inf - real(kind(0d0)), intent(out), target :: qv + real(wp), intent(out), target :: rho + real(wp), intent(out), target :: gamma + real(wp), intent(out), target :: pi_inf + real(wp), intent(out), target :: qv - real(kind(0d0)), optional, dimension(2), intent(out) :: Re_K + real(wp), optional, dimension(2), intent(out) :: Re_K !! Partial densities and volume fractions - real(kind(0d0)), optional, intent(out) :: G_K - real(kind(0d0)), optional, dimension(num_fluids), intent(in) :: G + real(wp), optional, intent(out) :: G_K + real(wp), optional, dimension(num_fluids), intent(in) :: G - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_K, alpha_K !< + real(wp), dimension(num_fluids) :: alpha_rho_K, alpha_K !< integer :: i, j !< Generic loop iterator @@ -406,18 +406,18 @@ contains if (mpp_lim) then do i = 1, num_fluids - alpha_rho_K(i) = max(0d0, alpha_rho_K(i)) - alpha_K(i) = min(max(0d0, alpha_K(i)), 1d0) + alpha_rho_K(i) = max(0._wp, alpha_rho_K(i)) + alpha_K(i) = min(max(0._wp, alpha_K(i)), 1._wp) end do - alpha_K = alpha_K/max(sum(alpha_K), 1d-16) + alpha_K = alpha_K/max(sum(alpha_K), 1e-16_wp) end if ! Calculating the density, the specific heat ratio function, the ! liquid stiffness function, and the energy reference function, ! respectively, from the species analogs - rho = 0d0; gamma = 0d0; pi_inf = 0d0; qv = 0d0 + rho = 0._wp; gamma = 0._wp; pi_inf = 0._wp; qv = 0._wp do i = 1, num_fluids rho = rho + alpha_rho_K(i) @@ -430,24 +430,24 @@ contains ! Computing the shear and bulk Reynolds numbers from species analogs do i = 1, 2 - Re_K(i) = dflt_real; if (Re_size(i) > 0) Re_K(i) = 0d0 + Re_K(i) = dflt_real; if (Re_size(i) > 0) Re_K(i) = 0._wp do j = 1, Re_size(i) Re_K(i) = alpha_K(Re_idx(i, j))/fluid_pp(Re_idx(i, j))%Re(i) & + Re_K(i) end do - Re_K(i) = 1d0/max(Re_K(i), sgm_eps) + Re_K(i) = 1._wp/max(Re_K(i), sgm_eps) end do #endif if (present(G_K)) then - G_K = 0d0 + G_K = 0._wp do i = 1, num_fluids G_K = G_K + alpha_K(i)*G(i) end do - G_K = max(0d0, G_K) + G_K = max(0._wp, G_K) end if ! Post process requires rho_sf/gamma_sf/pi_inf_sf/qv_sf to also be updated @@ -470,36 +470,36 @@ contains !$acc routine seq #endif - real(kind(0d0)), intent(out) :: rho_K, gamma_K, pi_inf_K, qv_K + real(wp), intent(out) :: rho_K, gamma_K, pi_inf_K, qv_K - real(kind(0d0)), dimension(num_fluids), intent(inout) :: alpha_rho_K, alpha_K !< - real(kind(0d0)), dimension(2), intent(out) :: Re_K + real(wp), dimension(num_fluids), intent(inout) :: alpha_rho_K, alpha_K !< + real(wp), dimension(2), intent(out) :: Re_K !! Partial densities and volume fractions - real(kind(0d0)), optional, intent(out) :: G_K - real(kind(0d0)), optional, dimension(num_fluids), intent(in) :: G + real(wp), optional, intent(out) :: G_K + real(wp), optional, dimension(num_fluids), intent(in) :: G integer, intent(in) :: k, l, r integer :: i, j !< Generic loop iterators - real(kind(0d0)) :: alpha_K_sum + real(wp) :: alpha_K_sum #ifdef MFC_SIMULATION ! Constraining the partial densities and the volume fractions within ! their physical bounds to make sure that any mixture variables that ! are derived from them result within the limits that are set by the ! fluids physical parameters that make up the mixture - rho_K = 0d0 - gamma_K = 0d0 - pi_inf_K = 0d0 - qv_K = 0d0 + rho_K = 0._wp + gamma_K = 0._wp + pi_inf_K = 0._wp + qv_K = 0._wp - alpha_K_sum = 0d0 + alpha_K_sum = 0._wp if (mpp_lim) then do i = 1, num_fluids - alpha_rho_K(i) = max(0d0, alpha_rho_K(i)) - alpha_K(i) = min(max(0d0, alpha_K(i)), 1d0) + alpha_rho_K(i) = max(0._wp, alpha_rho_K(i)) + alpha_K(i) = min(max(0._wp, alpha_K(i)), 1._wp) alpha_K_sum = alpha_K_sum + alpha_K(i) end do @@ -515,12 +515,12 @@ contains end do if (present(G_K)) then - G_K = 0d0 + G_K = 0._wp do i = 1, num_fluids !TODO: change to use Gs directly here? G_K = G_K + alpha_K(i)*G(i) end do - G_K = max(0d0, G_K) + G_K = max(0._wp, G_K) end if if (viscous) then @@ -528,14 +528,14 @@ contains do i = 1, 2 Re_K(i) = dflt_real - if (Re_size(i) > 0) Re_K(i) = 0d0 + if (Re_size(i) > 0) Re_K(i) = 0._wp do j = 1, Re_size(i) Re_K(i) = alpha_K(Re_idx(i, j))/Res(i, j) & + Re_K(i) end do - Re_K(i) = 1d0/max(Re_K(i), sgm_eps) + Re_K(i) = 1._wp/max(Re_K(i), sgm_eps) end do end if @@ -552,21 +552,21 @@ contains !$acc routine seq #endif - real(kind(0d0)), intent(inout) :: rho_K, gamma_K, pi_inf_K, qv_K + real(wp), intent(inout) :: rho_K, gamma_K, pi_inf_K, qv_K - real(kind(0d0)), dimension(num_fluids), intent(in) :: alpha_K, alpha_rho_K !< + real(wp), dimension(num_fluids), intent(in) :: alpha_K, alpha_rho_K !< !! Partial densities and volume fractions - real(kind(0d0)), dimension(2), intent(out) :: Re_K + real(wp), dimension(2), intent(out) :: Re_K integer, intent(in) :: k, l, r integer :: i, j !< Generic loop iterators #ifdef MFC_SIMULATION - rho_K = 0d0 - gamma_K = 0d0 - pi_inf_K = 0d0 - qv_K = 0d0 + rho_K = 0._wp + gamma_K = 0._wp + pi_inf_K = 0._wp + qv_K = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then do i = 1, num_fluids @@ -595,14 +595,14 @@ contains do i = 1, 2 Re_K(i) = dflt_real - if (Re_size(i) > 0) Re_K(i) = 0d0 + if (Re_size(i) > 0) Re_K(i) = 0._wp do j = 1, Re_size(i) - Re_K(i) = (1d0 - alpha_K(Re_idx(i, j)))/Res(i, j) & + Re_K(i) = (1._wp - alpha_K(Re_idx(i, j)))/Res(i, j) & + Re_K(i) end do - Re_K(i) = 1d0/max(Re_K(i), sgm_eps) + Re_K(i) = 1._wp/max(Re_K(i), sgm_eps) end do end if @@ -642,10 +642,10 @@ contains do i = 1, num_fluids gammas(i) = fluid_pp(i)%gamma - gs_min(i) = 1.0d0/gammas(i) + 1.0d0 + gs_min(i) = 1.0_wp/gammas(i) + 1.0_wp pi_infs(i) = fluid_pp(i)%pi_inf Gs(i) = fluid_pp(i)%G - ps_inf(i) = pi_infs(i)/(1.0d0 + gammas(i)) + ps_inf(i) = pi_infs(i)/(1.0_wp + gammas(i)) cvs(i) = fluid_pp(i)%cv qvs(i) = fluid_pp(i)%qv qvps(i) = fluid_pp(i)%qvp @@ -745,10 +745,11 @@ contains subroutine s_initialize_mv(qK_cons_vf, mv) type(scalar_field), dimension(sys_size), intent(in) :: qK_cons_vf - real(kind(0d0)), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: mv + + real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: mv integer :: i, j, k, l - real(kind(0d0)) :: mu, sig, nbub_sc + real(wp) :: mu, sig, nbub_sc do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end @@ -759,12 +760,12 @@ contains !$acc loop seq do i = 1, nb mu = qK_cons_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - sig = (qK_cons_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - mu**2)**0.5 + sig = (qK_cons_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - mu**2)**0.5_wp - mv(j, k, l, 1, i) = (mass_v0(i))*(mu - sig)**(3d0)/(R0(i)**(3d0)) - mv(j, k, l, 2, i) = (mass_v0(i))*(mu - sig)**(3d0)/(R0(i)**(3d0)) - mv(j, k, l, 3, i) = (mass_v0(i))*(mu + sig)**(3d0)/(R0(i)**(3d0)) - mv(j, k, l, 4, i) = (mass_v0(i))*(mu + sig)**(3d0)/(R0(i)**(3d0)) + mv(j, k, l, 1, i) = (mass_v0(i))*(mu - sig)**(3._wp)/(R0(i)**(3._wp)) + mv(j, k, l, 2, i) = (mass_v0(i))*(mu - sig)**(3._wp)/(R0(i)**(3._wp)) + mv(j, k, l, 3, i) = (mass_v0(i))*(mu + sig)**(3._wp)/(R0(i)**(3._wp)) + mv(j, k, l, 4, i) = (mass_v0(i))*(mu + sig)**(3._wp)/(R0(i)**(3._wp)) end do end do @@ -776,11 +777,12 @@ contains !Initialize pb at the quadrature nodes using isothermal relations (Preston model) subroutine s_initialize_pb(qK_cons_vf, mv, pb) type(scalar_field), dimension(sys_size), intent(in) :: qK_cons_vf - real(kind(0d0)), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(in) :: mv - real(kind(0d0)), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb + + real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(in) :: mv + real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb integer :: i, j, k, l - real(kind(0d0)) :: mu, sig, nbub_sc + real(wp) :: mu, sig, nbub_sc do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end @@ -791,13 +793,13 @@ contains !$acc loop seq do i = 1, nb mu = qK_cons_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - sig = (qK_cons_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - mu**2)**0.5 + sig = (qK_cons_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l)/nbub_sc - mu**2)**0.5_wp !PRESTON (ISOTHERMAL) - pb(j, k, l, 1, i) = (pb0(i))*(R0(i)**(3d0))*(mass_n0(i) + mv(j, k, l, 1, i))/(mu - sig)**(3d0)/(mass_n0(i) + mass_v0(i)) - pb(j, k, l, 2, i) = (pb0(i))*(R0(i)**(3d0))*(mass_n0(i) + mv(j, k, l, 2, i))/(mu - sig)**(3d0)/(mass_n0(i) + mass_v0(i)) - pb(j, k, l, 3, i) = (pb0(i))*(R0(i)**(3d0))*(mass_n0(i) + mv(j, k, l, 3, i))/(mu + sig)**(3d0)/(mass_n0(i) + mass_v0(i)) - pb(j, k, l, 4, i) = (pb0(i))*(R0(i)**(3d0))*(mass_n0(i) + mv(j, k, l, 4, i))/(mu + sig)**(3d0)/(mass_n0(i) + mass_v0(i)) + pb(j, k, l, 1, i) = (pb0(i))*(R0(i)**(3._wp))*(mass_n0(i) + mv(j, k, l, 1, i))/(mu - sig)**(3._wp)/(mass_n0(i) + mass_v0(i)) + pb(j, k, l, 2, i) = (pb0(i))*(R0(i)**(3._wp))*(mass_n0(i) + mv(j, k, l, 2, i))/(mu - sig)**(3._wp)/(mass_n0(i) + mass_v0(i)) + pb(j, k, l, 3, i) = (pb0(i))*(R0(i)**(3._wp))*(mass_n0(i) + mv(j, k, l, 3, i))/(mu + sig)**(3._wp)/(mass_n0(i) + mass_v0(i)) + pb(j, k, l, 4, i) = (pb0(i))*(R0(i)**(3._wp))*(mass_n0(i) + mv(j, k, l, 4, i))/(mu + sig)**(3._wp)/(mass_n0(i) + mass_v0(i)) end do end do end do @@ -825,31 +827,31 @@ contains allocatable, optional, dimension(:), & intent(in) :: gm_alphaK_vf - real(kind(0d0)), dimension(num_fluids) :: alpha_K, alpha_rho_K - real(kind(0d0)), dimension(2) :: Re_K - real(kind(0d0)) :: rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K + real(wp), dimension(num_fluids) :: alpha_K, alpha_rho_K + real(wp), dimension(2) :: Re_K + real(wp) :: rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K #:if MFC_CASE_OPTIMIZATION #ifndef MFC_SIMULATION - real(kind(0d0)), dimension(:), allocatable :: nRtmp + real(wp), dimension(:), allocatable :: nRtmp #else - real(kind(0d0)), dimension(nb) :: nRtmp + real(wp), dimension(nb) :: nRtmp #endif #:else - real(kind(0d0)), dimension(:), allocatable :: nRtmp + real(wp), dimension(:), allocatable :: nRtmp #:endif - real(kind(0d0)) :: rhoYks(1:num_species) + real(wp) :: rhoYks(1:num_species) - real(kind(0d0)) :: vftmp, nR3, nbub_sc, R3tmp + real(wp) :: vftmp, nR3, nbub_sc, R3tmp - real(kind(0d0)) :: G_K + real(wp) :: G_K - real(kind(0d0)) :: pres, Yksum, T + real(wp) :: pres, Yksum, T integer :: i, j, k, l, q !< Generic loop iterators - real(kind(0.d0)) :: ntmp + real(wp) :: ntmp #:if MFC_CASE_OPTIMIZATION #ifndef MFC_SIMULATION @@ -873,7 +875,7 @@ contains do l = ibounds(3)%beg, ibounds(3)%end do k = ibounds(2)%beg, ibounds(2)%end do j = ibounds(1)%beg, ibounds(1)%end - dyn_pres_K = 0d0 + dyn_pres_K = 0._wp !$acc loop seq do i = 1, num_fluids @@ -907,10 +909,10 @@ contains end if if (chemistry) then - rho_K = 0d0 + rho_K = 0._wp !$acc loop seq do i = chemxb, chemxe - rho_K = rho_K + max(0d0, qK_cons_vf(i)%sf(j, k, l)) + rho_K = rho_K + max(0._wp, qK_cons_vf(i)%sf(j, k, l)) end do !$acc loop seq @@ -920,7 +922,7 @@ contains !$acc loop seq do i = chemxb, chemxe - qK_prim_vf(i)%sf(j, k, l) = max(0d0, qK_cons_vf(i)%sf(j, k, l)/rho_K) + qK_prim_vf(i)%sf(j, k, l) = max(0._wp, qK_cons_vf(i)%sf(j, k, l)/rho_K) end do qK_prim_vf(T_idx)%sf(j, k, l) = qK_cons_vf(T_idx)%sf(j, k, l) @@ -940,7 +942,7 @@ contains if (model_eqns /= 4) then qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l) & /rho_K - dyn_pres_K = dyn_pres_K + 5d-1*qK_cons_vf(i)%sf(j, k, l) & + dyn_pres_K = dyn_pres_K + 5e-1_wp*qK_cons_vf(i)%sf(j, k, l) & *qK_prim_vf(i)%sf(j, k, l) else qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l) & @@ -1009,13 +1011,13 @@ contains ! subtracting elastic contribution for pressure calculation if (G_K > 1000) then !TODO: check if stable for >0 qK_prim_vf(E_idx)%sf(j, k, l) = qK_prim_vf(E_idx)%sf(j, k, l) - & - ((qK_prim_vf(i)%sf(j, k, l)**2d0)/(4d0*G_K))/gamma_K + ((qK_prim_vf(i)%sf(j, k, l)**2._wp)/(4._wp*G_K))/gamma_K ! extra terms in 2 and 3D if ((i == strxb + 1) .or. & (i == strxb + 3) .or. & (i == strxb + 4)) then qK_prim_vf(E_idx)%sf(j, k, l) = qK_prim_vf(E_idx)%sf(j, k, l) - & - ((qK_prim_vf(i)%sf(j, k, l)**2d0)/(4d0*G_K))/gamma_K + ((qK_prim_vf(i)%sf(j, k, l)**2._wp)/(4._wp*G_K))/gamma_K end if end if end do @@ -1059,21 +1061,21 @@ contains ! Density, specific heat ratio function, liquid stiffness function ! and dynamic pressure, as defined in the incompressible flow sense, ! respectively - real(kind(0d0)) :: rho - real(kind(0d0)) :: gamma - real(kind(0d0)) :: pi_inf - real(kind(0d0)) :: qv - real(kind(0d0)) :: dyn_pres - real(kind(0d0)) :: nbub, R3, vftmp, R3tmp - real(kind(0d0)), dimension(nb) :: Rtmp - real(kind(0d0)) :: G = 0d0 - real(kind(0d0)), dimension(2) :: Re_K + real(wp) :: rho + real(wp) :: gamma + real(wp) :: pi_inf + real(wp) :: qv + real(wp) :: dyn_pres + real(wp) :: nbub, R3, vftmp, R3tmp + real(wp), dimension(nb) :: Rtmp + real(wp) :: G = 0._wp + real(wp), dimension(2) :: Re_K integer :: i, j, k, l, q !< Generic loop iterators integer :: spec - real(kind(0d0)), dimension(num_species) :: Ys - real(kind(0d0)) :: e_mix, mix_mol_weight, T + real(wp), dimension(num_species) :: Ys + real(wp) :: e_mix, mix_mol_weight, T #ifndef MFC_SIMULATION ! Converting the primitive variables to the conservative variables @@ -1098,13 +1100,13 @@ contains ! Zeroing out the dynamic pressure since it is computed ! iteratively by cycling through the velocity equations - dyn_pres = 0d0 + dyn_pres = 0._wp ! Computing momenta and dynamic pressure from velocity do i = momxb, momxe q_cons_vf(i)%sf(j, k, l) = rho*q_prim_vf(i)%sf(j, k, l) dyn_pres = dyn_pres + q_cons_vf(i)%sf(j, k, l)* & - q_prim_vf(i)%sf(j, k, l)/2d0 + q_prim_vf(i)%sf(j, k, l)/2._wp end do if (chemistry) then @@ -1131,11 +1133,11 @@ contains else if ((model_eqns /= 4) .and. (bubbles)) then ! \tilde{E} = dyn_pres + (1-\alf)(\Gamma p_l + \Pi_inf) q_cons_vf(E_idx)%sf(j, k, l) = dyn_pres + & - (1.d0 - q_prim_vf(alf_idx)%sf(j, k, l))* & + (1._wp - q_prim_vf(alf_idx)%sf(j, k, l))* & (gamma*q_prim_vf(E_idx)%sf(j, k, l) + pi_inf) else !Tait EOS, no conserved energy variable - q_cons_vf(E_idx)%sf(j, k, l) = 0. + q_cons_vf(E_idx)%sf(j, k, l) = 0._wp end if end if @@ -1166,13 +1168,13 @@ contains end if else !Initialize R3 averaging over R0 and R directions - R3tmp = 0d0 + R3tmp = 0._wp do i = 1, nb - R3tmp = R3tmp + weight(i)*0.5d0*(Rtmp(i) + sigR)**3d0 - R3tmp = R3tmp + weight(i)*0.5d0*(Rtmp(i) - sigR)**3d0 + R3tmp = R3tmp + weight(i)*0.5_wp*(Rtmp(i) + sigR)**3._wp + R3tmp = R3tmp + weight(i)*0.5_wp*(Rtmp(i) - sigR)**3._wp end do !Initialize nb - nbub = 3d0*q_prim_vf(alf_idx)%sf(j, k, l)/(4d0*pi*R3tmp) + nbub = 3._wp*q_prim_vf(alf_idx)%sf(j, k, l)/(4._wp*pi*R3tmp) end if if (j == 0 .and. k == 0 .and. l == 0) print *, 'In convert, nbub:', nbub @@ -1188,13 +1190,13 @@ contains ! adding elastic contribution if (G > 1000) then q_cons_vf(E_idx)%sf(j, k, l) = q_cons_vf(E_idx)%sf(j, k, l) + & - (q_prim_vf(i)%sf(j, k, l)**2d0)/(4d0*G) + (q_prim_vf(i)%sf(j, k, l)**2._wp)/(4._wp*G) ! extra terms in 2 and 3D if ((i == stress_idx%beg + 1) .or. & (i == stress_idx%beg + 3) .or. & (i == stress_idx%beg + 4)) then q_cons_vf(E_idx)%sf(j, k, l) = q_cons_vf(E_idx)%sf(j, k, l) + & - (q_prim_vf(i)%sf(j, k, l)**2d0)/(4d0*G) + (q_prim_vf(i)%sf(j, k, l)**2._wp)/(4._wp*G) end if end if end do @@ -1232,27 +1234,27 @@ contains is1, is2, is3, s2b, s3b) integer, intent(in) :: s2b, s3b - real(kind(0d0)), dimension(0:, s2b:, s3b:, 1:), intent(in) :: qK_prim_vf - real(kind(0d0)), dimension(0:, s2b:, s3b:, 1:), intent(inout) :: FK_vf - real(kind(0d0)), dimension(0:, s2b:, s3b:, advxb:), intent(inout) :: FK_src_vf + real(wp), dimension(0:, s2b:, s3b:, 1:), intent(in) :: qK_prim_vf + real(wp), dimension(0:, s2b:, s3b:, 1:), intent(inout) :: FK_vf + real(wp), dimension(0:, s2b:, s3b:, advxb:), intent(inout) :: FK_src_vf type(int_bounds_info), intent(in) :: is1, is2, is3 ! Partial densities, density, velocity, pressure, energy, advection ! variables, the specific heat ratio and liquid stiffness functions, ! the shear and volume Reynolds numbers and the Weber numbers - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_K - real(kind(0d0)), dimension(num_fluids) :: alpha_K - real(kind(0d0)) :: rho_K - real(kind(0d0)), dimension(num_dims) :: vel_K - real(kind(0d0)) :: vel_K_sum - real(kind(0d0)) :: pres_K - real(kind(0d0)) :: E_K - real(kind(0d0)) :: gamma_K - real(kind(0d0)) :: pi_inf_K - real(kind(0d0)) :: qv_K - real(kind(0d0)), dimension(2) :: Re_K - real(kind(0d0)) :: G_K + real(wp), dimension(num_fluids) :: alpha_rho_K + real(wp), dimension(num_fluids) :: alpha_K + real(wp) :: rho_K + real(wp), dimension(num_dims) :: vel_K + real(wp) :: vel_K_sum + real(wp) :: pres_K + real(wp) :: E_K + real(wp) :: gamma_K + real(wp) :: pi_inf_K + real(wp) :: qv_K + real(wp), dimension(2) :: Re_K + real(wp) :: G_K integer :: i, j, k, l !< Generic loop iterators @@ -1284,10 +1286,10 @@ contains vel_K(i) = qK_prim_vf(j, k, l, contxe + i) end do - vel_K_sum = 0d0 + vel_K_sum = 0._wp !$acc loop seq do i = 1, num_dims - vel_K_sum = vel_K_sum + vel_K(i)**2d0 + vel_K_sum = vel_K_sum + vel_K(i)**2._wp end do pres_K = qK_prim_vf(j, k, l, E_idx) @@ -1305,7 +1307,7 @@ contains ! Computing the energy from the pressure E_K = gamma_K*pres_K + pi_inf_K & - + 5d-1*rho_K*vel_K_sum + qv_K + + 5e-1_wp*rho_K*vel_K_sum + qv_K ! mass flux, this should be \alpha_i \rho_i u_i !$acc loop seq @@ -1327,7 +1329,7 @@ contains if (riemann_solver == 1) then !$acc loop seq do i = advxb, advxe - FK_vf(j, k, l, i) = 0d0 + FK_vf(j, k, l, i) = 0._wp FK_src_vf(j, k, l, i) = alpha_K(i - E_idx) end do @@ -1381,57 +1383,58 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), intent(in) :: pres - real(kind(0d0)), intent(in) :: rho, gamma, pi_inf - real(kind(0d0)), intent(in) :: H - real(kind(0d0)), dimension(num_fluids), intent(in) :: adv - real(kind(0d0)), intent(in) :: vel_sum - real(kind(0d0)), intent(in) :: c_c - real(kind(0d0)), intent(out) :: c - - real(kind(0d0)) :: blkmod1, blkmod2 - real(kind(0d0)) :: Tolerance + + real(wp), intent(in) :: pres + real(wp), intent(in) :: rho, gamma, pi_inf + real(wp), intent(in) :: H + real(wp), dimension(num_fluids), intent(in) :: adv + real(wp), intent(in) :: vel_sum + real(wp), intent(in) :: c_c + real(wp), intent(out) :: c + + real(wp) :: blkmod1, blkmod2 + real(wp) :: Tolerance integer :: q if (chemistry) then if (avg_state == 1 .and. abs(c_c) > Tolerance) then - c = sqrt(c_c - (gamma - 1.0d0)*(vel_sum - H)) + c = sqrt(c_c - (gamma - 1.0_wp)*(vel_sum - H)) else - c = sqrt((1.0d0 + 1.0d0/gamma)*pres/rho) + c = sqrt((1.0_wp + 1.0_wp/gamma)*pres/rho) end if else if (alt_soundspeed) then - blkmod1 = ((gammas(1) + 1d0)*pres + & + blkmod1 = ((gammas(1) + 1._wp)*pres + & pi_infs(1))/gammas(1) - blkmod2 = ((gammas(2) + 1d0)*pres + & + blkmod2 = ((gammas(2) + 1._wp)*pres + & pi_infs(2))/gammas(2) - c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2))) + c = (1._wp/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2))) elseif (model_eqns == 3) then - c = 0d0 + c = 0._wp !$acc loop seq do q = 1, num_fluids - c = c + adv(q)*(1d0/gammas(q) + 1d0)* & - (pres + pi_infs(q)/(gammas(q) + 1d0)) + c = c + adv(q)*(1._wp/gammas(q) + 1._wp)* & + (pres + pi_infs(q)/(gammas(q) + 1._wp)) end do c = c/rho elseif (((model_eqns == 4) .or. (model_eqns == 2 .and. bubbles))) then ! Sound speed for bubble mmixture to order O(\alpha) if (mpp_lim .and. (num_fluids > 1)) then - c = (1d0/gamma + 1d0)* & - (pres + pi_inf/(gamma + 1d0))/rho + c = (1._wp/gamma + 1._wp)* & + (pres + pi_inf/(gamma + 1._wp))/rho else c = & - (1d0/gamma + 1d0)* & - (pres + pi_inf/(gamma + 1d0))/ & - (rho*(1d0 - adv(num_fluids))) + (1._wp/gamma + 1._wp)* & + (pres + pi_inf/(gamma + 1._wp))/ & + (rho*(1._wp - adv(num_fluids))) end if else - c = ((H - 5d-1*vel_sum)/gamma) + c = ((H - 5e-1*vel_sum)/gamma) end if - if (mixture_err .and. c < 0d0) then - c = 100.d0*sgm_eps + if (mixture_err .and. c < 0._wp) then + c = 100._wp*sgm_eps else c = sqrt(c) end if diff --git a/src/post_process/m_checker.fpp b/src/post_process/m_checker.fpp index 2b2bf88e6..817e2ce00 100644 --- a/src/post_process/m_checker.fpp +++ b/src/post_process/m_checker.fpp @@ -104,7 +104,7 @@ contains do i = 1, num_fluids call s_int_to_str(i, iStr) - @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. schlieren_alpha(i) <= 0d0, & + @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. schlieren_alpha(i) <= 0._wp, & "schlieren_alpha("//trim(iStr)//") must be greater than zero") @:PROHIBIT(.not. f_is_default(schlieren_alpha(i)) .and. i > num_fluids, & "Index of schlieren_alpha("//trim(iStr)//") exceeds the total number of fluids") diff --git a/src/post_process/m_data_input.f90 b/src/post_process/m_data_input.f90 index 48694092b..5fb944734 100644 --- a/src/post_process/m_data_input.f90 +++ b/src/post_process/m_data_input.f90 @@ -74,7 +74,7 @@ subroutine s_read_serial_data_files(t_step) !! Generic string used to store the location of a particular file character(LEN= & - int(floor(log10(real(sys_size, kind(0d0))))) + 1) :: file_num !< + int(floor(log10(real(sys_size, wp)))) + 1) :: file_num !< !! Used to store the variable position, in character form, of the !! currently manipulated conservative variable file @@ -140,7 +140,7 @@ subroutine s_read_serial_data_files(t_step) dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) ! Computing the cell-center locations - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2d0 + x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp ! ================================================================== @@ -167,7 +167,7 @@ subroutine s_read_serial_data_files(t_step) dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) ! Computing the cell-center locations - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2d0 + y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp ! ================================================================== @@ -194,7 +194,7 @@ subroutine s_read_serial_data_files(t_step) dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) ! Computing the cell-center locations - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2d0 + z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp end if @@ -255,11 +255,11 @@ subroutine s_read_parallel_data_files(t_step) #ifdef MFC_MPI - real(kind(0d0)), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb + real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb integer :: ifile, ierr, data_size integer, dimension(MPI_STATUS_SIZE) :: status - real(kind(0d0)) :: start, finish + real(wp) :: start, finish integer(KIND=MPI_OFFSET_KIND) :: disp integer(KIND=MPI_OFFSET_KIND) :: m_MOK, n_MOK, p_MOK integer(KIND=MPI_OFFSET_KIND) :: WP_MOK, var_MOK, str_MOK @@ -284,7 +284,7 @@ subroutine s_read_parallel_data_files(t_step) if (file_exist) then data_size = m_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, x_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, x_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -295,7 +295,7 @@ subroutine s_read_parallel_data_files(t_step) ! Computing the cell width distribution dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) ! Computing the cell center location - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2d0 + x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp if (n > 0) then ! Read in cell boundary locations in y-direction @@ -305,7 +305,7 @@ subroutine s_read_parallel_data_files(t_step) if (file_exist) then data_size = n_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, y_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, y_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -316,7 +316,7 @@ subroutine s_read_parallel_data_files(t_step) ! Computing the cell width distribution dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) ! Computing the cell center location - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2d0 + y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp if (p > 0) then ! Read in cell boundary locations in z-direction @@ -326,7 +326,7 @@ subroutine s_read_parallel_data_files(t_step) if (file_exist) then data_size = p_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, z_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, z_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -337,7 +337,7 @@ subroutine s_read_parallel_data_files(t_step) ! Computing the cell width distribution dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) ! Computing the cell center location - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2d0 + z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp end if end if @@ -365,8 +365,8 @@ subroutine s_read_parallel_data_files(t_step) m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -376,14 +376,14 @@ subroutine s_read_parallel_data_files(t_step) var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do else do i = 1, adv_idx%end var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -439,8 +439,8 @@ subroutine s_read_parallel_data_files(t_step) m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -452,10 +452,10 @@ subroutine s_read_parallel_data_files(t_step) ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do else do i = 1, sys_size @@ -464,10 +464,10 @@ subroutine s_read_parallel_data_files(t_step) ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -554,7 +554,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - x_cc(-i) = x_cc(1 - i) - (dx(1 - i) + dx(-i))/2d0 + x_cc(-i) = x_cc(1 - i) - (dx(1 - i) + dx(-i))/2._wp end do ! Ghost-cell extrapolation BC at the end @@ -590,7 +590,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - x_cc(m + i) = x_cc(m + (i - 1)) + (dx(m + (i - 1)) + dx(m + i))/2d0 + x_cc(m + i) = x_cc(m + (i - 1)) + (dx(m + (i - 1)) + dx(m + i))/2._wp end do ! END: Populating Buffer Regions in the x-direction ================ @@ -632,7 +632,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - y_cc(-i) = y_cc(1 - i) - (dy(1 - i) + dy(-i))/2d0 + y_cc(-i) = y_cc(1 - i) - (dy(1 - i) + dy(-i))/2._wp end do ! Ghost-cell extrapolation BC at the end @@ -668,7 +668,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - y_cc(n + i) = y_cc(n + (i - 1)) + (dy(n + (i - 1)) + dy(n + i))/2d0 + y_cc(n + i) = y_cc(n + (i - 1)) + (dy(n + (i - 1)) + dy(n + i))/2._wp end do ! END: Populating Buffer Regions in the y-direction ================ @@ -710,7 +710,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - z_cc(-i) = z_cc(1 - i) - (dz(1 - i) + dz(-i))/2d0 + z_cc(-i) = z_cc(1 - i) - (dz(1 - i) + dz(-i))/2._wp end do ! Ghost-cell extrapolation BC at the end @@ -746,7 +746,7 @@ subroutine s_populate_grid_variables_buffer_regions end do do i = 1, buff_size - z_cc(p + i) = z_cc(p + (i - 1)) + (dz(p + (i - 1)) + dz(p + i))/2d0 + z_cc(p + i) = z_cc(p + (i - 1)) + (dz(p + (i - 1)) + dz(p + i))/2._wp end do end if diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index 784dd7c00..5e0a1111e 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -41,20 +41,20 @@ module m_data_output ! database file(s). Note that for 1D simulations, q_root_sf is employed to ! gather the flow variable(s) from all sub-domains on to the root process. ! If the run is not parallel, but serial, then q_root_sf is equal to q_sf. - real(kind(0d0)), allocatable, dimension(:, :, :), public :: q_sf - real(kind(0d0)), allocatable, dimension(:, :, :) :: q_root_sf - real(kind(0d0)), allocatable, dimension(:, :, :) :: cyl_q_sf + real(wp), allocatable, dimension(:, :, :), public :: q_sf + real(wp), allocatable, dimension(:, :, :) :: q_root_sf + real(wp), allocatable, dimension(:, :, :) :: cyl_q_sf ! Single precision storage for flow variables - real(kind(0.0)), allocatable, dimension(:, :, :), public :: q_sf_s - real(kind(0.0)), allocatable, dimension(:, :, :) :: q_root_sf_s - real(kind(0.0)), allocatable, dimension(:, :, :) :: cyl_q_sf_s + real(sp), allocatable, dimension(:, :, :), public :: q_sf_s + real(sp), allocatable, dimension(:, :, :) :: q_root_sf_s + real(sp), allocatable, dimension(:, :, :) :: cyl_q_sf_s ! The spatial and data extents array variables contain information about the ! minimum and maximum values of the grid and flow variable(s), respectively. ! The purpose of bookkeeping this information is to boost the visualization ! of the Silo-HDF5 database file(s) in VisIt. - real(kind(0d0)), allocatable, dimension(:, :) :: spatial_extents - real(kind(0d0)), allocatable, dimension(:, :) :: data_extents + real(wp), allocatable, dimension(:, :) :: spatial_extents + real(wp), allocatable, dimension(:, :) :: data_extents ! The size of the ghost zone layer at beginning of each coordinate direction ! (lo) and at end of each coordinate direction (hi). Adding this information @@ -102,7 +102,7 @@ module m_data_output contains - subroutine s_initialize_data_output_module + subroutine s_initialize_data_output_module() ! ---------------------------- ! Description: Computation of parameters, allocation procedures, and/or ! any other tasks needed to properly setup the module @@ -409,9 +409,9 @@ contains ! END: Querying Number of Flow Variable(s) in Binary Output ======== - end subroutine s_initialize_data_output_module + end subroutine s_initialize_data_output_module ! -------------------------- - subroutine s_open_formatted_database_file(t_step) + subroutine s_open_formatted_database_file(t_step) ! -------------------- ! Description: This subroutine opens a new formatted database file, or ! replaces an old one, and readies it for the data storage ! of the grid and the flow variable(s) associated with the @@ -424,7 +424,7 @@ contains ! not performed in multidimensions. ! Time-step that is currently being post-processed - integer, intent(in) :: t_step + integer, intent(IN) :: t_step ! Generic string used to store the location of a particular file character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc @@ -441,7 +441,7 @@ contains ! Creating formatted database slave file at the above location ! and setting up the structure of the file and its header info ierr = DBCREATE(trim(file_loc), len_trim(file_loc), & - DB_CLOBBER, DB_LOCAL, 'MFC', 8, & + DB_CLOBBER, DB_LOCAL, 'MFC v3.0', 8, & DB_HDF5, dbfile) ! Verifying that the creation and setup process of the formatted @@ -462,7 +462,7 @@ contains file_loc = trim(rootdir)//trim(file_loc) ierr = DBCREATE(trim(file_loc), len_trim(file_loc), & - DB_CLOBBER, DB_LOCAL, 'MFC', 8, & + DB_CLOBBER, DB_LOCAL, 'MFC v3.0', 8, & DB_HDF5, dbroot) if (dbroot == -1) then @@ -528,9 +528,9 @@ contains ! END: Binary Database Format ====================================== - end subroutine s_open_formatted_database_file + end subroutine s_open_formatted_database_file ! ------------------------ - subroutine s_write_grid_to_formatted_database_file(t_step) + subroutine s_write_grid_to_formatted_database_file(t_step) ! ----------- ! Description: The general objective of this subroutine is to write the ! necessary grid data to the formatted database file, for ! the current time-step, t_step. The local processor will @@ -551,7 +551,7 @@ contains ! subroutine s_write_variable_to_formatted_database_file. ! Time-step that is currently being post-processed - integer, intent(in) :: t_step + integer, intent(IN) :: t_step ! Bookkeeping variables storing the name and type of mesh that is ! handled by the local processor(s). Note that due to an internal @@ -623,18 +623,10 @@ contains if (precision == 1) then if (p > 0) then - do i = -1 - offset_z%beg, p + offset_z%end - z_cb_s(i) = real(z_cb(i)) - end do - else - do i = -1 - offset_x%beg, m + offset_x%end - x_cb_s(i) = real(x_cb(i)) - end do - - do i = -1 - offset_y%beg, n + offset_y%end - y_cb_s(i) = real(y_cb(i)) - end do + z_cb_s = real(z_cb, sp) end if + x_cb_s = real(x_cb, sp) + y_cb_s = real(y_cb, sp) end if #:for PRECISION, SFX, DBT in [(1,'_s','DB_FLOAT'),(2,'',"DB_DOUBLE")] @@ -670,6 +662,7 @@ contains end if end if #:endfor + ! END: Silo-HDF5 Database Format =================================== ! Binary Database Format =========================================== @@ -681,17 +674,17 @@ contains ! in multidimensions. if (p > 0) then if (precision == 1) then - write (dbfile) real(x_cb, kind(0.0)), & - real(y_cb, kind(0.0)), & - real(z_cb, kind(0.0)) + write (dbfile) real(x_cb, sp), & + real(y_cb, sp), & + real(z_cb, sp) else write (dbfile) x_cb, y_cb, z_cb end if elseif (n > 0) then if (precision == 1) then - write (dbfile) real(x_cb, kind(0.0)), & - real(y_cb, kind(0.0)) + write (dbfile) real(x_cb, sp), & + real(y_cb, sp) else write (dbfile) x_cb, y_cb end if @@ -702,7 +695,7 @@ contains else if (precision == 1) then - write (dbfile) real(x_cb, kind(0.0)) + write (dbfile) real(x_cb, wp) else write (dbfile) x_cb end if @@ -715,7 +708,7 @@ contains if (proc_rank == 0) then if (precision == 1) then - write (dbroot) real(x_root_cb, kind(0.0)) + write (dbroot) real(x_root_cb, wp) else write (dbroot) x_root_cb end if @@ -727,7 +720,7 @@ contains ! ================================================================== - end subroutine s_write_grid_to_formatted_database_file + end subroutine s_write_grid_to_formatted_database_file ! --------------- subroutine s_write_variable_to_formatted_database_file(varname, t_step) ! Description: The goal of this subroutine is to write to the formatted @@ -748,10 +741,10 @@ contains ! Name of the flow variable, which will be written to the formatted ! database file at the current time-step, t_step - character(LEN=*), intent(in) :: varname + character(LEN=*), intent(IN) :: varname ! Time-step that is currently being post-processed - integer, intent(in) :: t_step + integer, intent(IN) :: t_step ! Bookkeeping variables storing the name and type of flow variable ! that is about to be handled by the local processor(s). Note that @@ -762,7 +755,7 @@ contains ! Generic loop iterator integer :: i, j, k - real(kind(0d0)) :: start, finish + real(wp) :: start, finish ! Silo-HDF5 Database Format ======================================== @@ -775,30 +768,57 @@ contains ! and write it to the formatted database master file. if (n == 0) then + if (precision == 1 .and. wp == dp) then + x_cc_s = real(x_cc, sp) + q_sf_s = real(q_sf, sp) + elseif (precision == 1 .and. wp == sp) then + x_cc_s = x_cc + q_sf_s = q_sf + end if + ! Writing the curve object associated with the local process ! to the formatted database slave file - err = DBPUTCURVE(dbfile, trim(varname), len_trim(varname), & - x_cc(0:m), q_sf, DB_DOUBLE, m + 1, & - DB_F77NULL, ierr) + #:for PRECISION, SFX, DBT in [(1,'_s','DB_FLOAT'),(2,'',"DB_DOUBLE")] + if (precision == ${PRECISION}$) then + err = DBPUTCURVE(dbfile, trim(varname), len_trim(varname), & + x_cc${SFX}$ (0:m), q_sf${SFX}$, ${DBT}$, m + 1, & + DB_F77NULL, ierr) + end if + #:endfor ! Assembling the local grid and flow variable data for the ! entire computational domain on to the root process + if (num_procs > 1) then call s_mpi_defragment_1d_grid_variable() call s_mpi_defragment_1d_flow_variable(q_sf, q_root_sf) + + if (precision == 1) then + x_root_cc_s = real(x_root_cc, sp) + q_root_sf_s = real(q_root_sf, sp) + end if else - x_root_cc = x_cc(0:m) - q_root_sf = q_sf + if (precision == 1) then + x_root_cc_s = real(x_cc, sp) + q_root_sf_s = real(q_sf, sp) + else + x_root_cc = x_cc + q_root_sf = q_sf + end if end if ! Writing the curve object associated with the root process ! to the formatted database master file if (proc_rank == 0) then - err = DBPUTCURVE(dbroot, trim(varname), & - len_trim(varname), & - x_root_cc, q_root_sf, & - DB_DOUBLE, m_root + 1, & - DB_F77NULL, ierr) + #:for PRECISION, SFX, DBT in [(1,'_s','DB_FLOAT'),(2,'',"DB_DOUBLE")] + if (precision == ${PRECISION}$) then + err = DBPUTCURVE(dbroot, trim(varname), & + len_trim(varname), & + x_root_cc${SFX}$, q_root_sf${SFX}$, & + ${DBT}$, m_root + 1, & + DB_F77NULL, ierr) + end if + #:endfor end if return @@ -845,25 +865,52 @@ contains ! Finally, each of the local processor(s) proceeds to write ! the flow variable data that it is responsible for to the ! formatted database slave file. - - if (precision == 1) then - do i = -offset_x%beg, m + offset_x%end - do j = -offset_y%beg, n + offset_y%end - do k = -offset_z%beg, p + offset_z%end - q_sf_s(i, j, k) = real(q_sf(i, j, k)) + if (wp == dp) then + if (precision == 1) then + do i = -offset_x%beg, m + offset_x%end + do j = -offset_y%beg, n + offset_y%end + do k = -offset_z%beg, p + offset_z%end + q_sf_s(i, j, k) = real(q_sf(i, j, k), sp) + end do end do end do - end do - end if - - if (grid_geometry == 3) then + if (grid_geometry == 3) then + do i = -offset_x%beg, m + offset_x%end + do j = -offset_y%beg, n + offset_y%end + do k = -offset_z%beg, p + offset_z%end + cyl_q_sf_s(j, k, i) = q_sf_s(i, j, k) + end do + end do + end do + end if + else + if (grid_geometry == 3) then + do i = -offset_x%beg, m + offset_x%end + do j = -offset_y%beg, n + offset_y%end + do k = -offset_z%beg, p + offset_z%end + cyl_q_sf(j, k, i) = q_sf(i, j, k) + end do + end do + end do + end if + end if + elseif (wp == dp) then do i = -offset_x%beg, m + offset_x%end do j = -offset_y%beg, n + offset_y%end do k = -offset_z%beg, p + offset_z%end - cyl_q_sf(j, k, i) = q_sf(i, j, k) + q_sf_s(i, j, k) = q_sf(i, j, k) end do end do end do + if (grid_geometry == 3) then + do i = -offset_x%beg, m + offset_x%end + do j = -offset_y%beg, n + offset_y%end + do k = -offset_z%beg, p + offset_z%end + cyl_q_sf_s(j, k, i) = q_sf_s(i, j, k) + end do + end do + end do + end if end if #:for PRECISION, SFX, DBT in [(1,'_s','DB_FLOAT'),(2,'',"DB_DOUBLE")] @@ -906,7 +953,7 @@ contains ! Writing the name of the flow variable and its data, associated ! with the local processor, to the formatted database slave file if (precision == 1) then - write (dbfile) varname, real(q_sf, kind(0.0)) + write (dbfile) varname, real(q_sf, wp) else write (dbfile) varname, q_sf end if @@ -924,7 +971,7 @@ contains if (proc_rank == 0) then if (precision == 1) then - write (dbroot) varname, real(q_root_sf, kind(0.0)) + write (dbroot) varname, real(q_root_sf, wp) else write (dbroot) varname, q_root_sf end if @@ -936,9 +983,9 @@ contains ! ================================================================== - end subroutine s_write_variable_to_formatted_database_file + end subroutine s_write_variable_to_formatted_database_file ! ----------- - subroutine s_close_formatted_database_file + subroutine s_close_formatted_database_file() ! ------------------------- ! Description: The purpose of this subroutine is to close any formatted ! database file(s) that may be opened at the time-step that ! is currently being post-processed. The root process must @@ -963,9 +1010,9 @@ contains end if - end subroutine s_close_formatted_database_file + end subroutine s_close_formatted_database_file ! ----------------------- - subroutine s_finalize_data_output_module + subroutine s_finalize_data_output_module() ! ------------------------- ! Description: Deallocation procedures for the module ! Deallocating the generic storage employed for the flow variable(s) @@ -989,6 +1036,6 @@ contains deallocate (dims) end if - end subroutine s_finalize_data_output_module + end subroutine s_finalize_data_output_module ! ----------------------- end module m_data_output diff --git a/src/post_process/m_derived_variables.fpp b/src/post_process/m_derived_variables.fpp index e08973bd2..0f03ccb11 100644 --- a/src/post_process/m_derived_variables.fpp +++ b/src/post_process/m_derived_variables.fpp @@ -33,7 +33,7 @@ module m_derived_variables s_compute_speed_of_sound, & s_finalize_derived_variables_module - real(kind(0d0)), allocatable, dimension(:, :, :) :: gm_rho_sf !< + real(wp), allocatable, dimension(:, :, :) :: gm_rho_sf !< !! Gradient magnitude (gm) of the density for each cell of the computational !! sub-domain. This variable is employed in the calculation of the numerical !! Schlieren function. @@ -43,9 +43,9 @@ module m_derived_variables !! active coordinate directions, the centered family of the finite-difference !! schemes is used. !> @{ - real(kind(0d0)), allocatable, dimension(:, :), public :: fd_coeff_x - real(kind(0d0)), allocatable, dimension(:, :), public :: fd_coeff_y - real(kind(0d0)), allocatable, dimension(:, :), public :: fd_coeff_z + real(wp), allocatable, dimension(:, :), public :: fd_coeff_x + real(wp), allocatable, dimension(:, :), public :: fd_coeff_y + real(wp), allocatable, dimension(:, :), public :: fd_coeff_z !> @} integer, private :: flg !< @@ -119,7 +119,7 @@ contains !! @param q_sf Specific heat ratio subroutine s_derive_specific_heat_ratio(q_sf) - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & @@ -131,7 +131,7 @@ contains do k = -offset_z%beg, p + offset_z%end do j = -offset_y%beg, n + offset_y%end do i = -offset_x%beg, m + offset_x%end - q_sf(i, j, k) = 1d0 + 1d0/gamma_sf(i, j, k) + q_sf(i, j, k) = 1._wp + 1._wp/gamma_sf(i, j, k) end do end do end do @@ -146,7 +146,7 @@ contains !! @param q_sf Liquid stiffness subroutine s_derive_liquid_stiffness(q_sf) - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & @@ -159,7 +159,7 @@ contains do k = -offset_z%beg, p + offset_z%end do j = -offset_y%beg, n + offset_y%end do i = -offset_x%beg, m + offset_x%end - q_sf(i, j, k) = pi_inf_sf(i, j, k)/(gamma_sf(i, j, k) + 1d0) + q_sf(i, j, k) = pi_inf_sf(i, j, k)/(gamma_sf(i, j, k) + 1._wp) end do end do end do @@ -179,7 +179,7 @@ contains dimension(sys_size), & intent(in) :: q_prim_vf - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & @@ -188,7 +188,7 @@ contains integer :: i, j, k !< Generic loop iterators ! Fluid bulk modulus for alternate sound speed - real(kind(0d0)) :: blkmod1, blkmod2 + real(wp) :: blkmod1, blkmod2 ! Computing speed of sound values from those of pressure, density, ! specific heat ratio function and the liquid stiffness function @@ -198,21 +198,21 @@ contains ! Compute mixture sound speed if (alt_soundspeed .neqv. .true.) then - q_sf(i, j, k) = (((gamma_sf(i, j, k) + 1d0)* & + q_sf(i, j, k) = (((gamma_sf(i, j, k) + 1._wp)* & q_prim_vf(E_idx)%sf(i, j, k) + & pi_inf_sf(i, j, k))/(gamma_sf(i, j, k)* & rho_sf(i, j, k))) else - blkmod1 = ((fluid_pp(1)%gamma + 1d0)*q_prim_vf(E_idx)%sf(i, j, k) + & + blkmod1 = ((fluid_pp(1)%gamma + 1._wp)*q_prim_vf(E_idx)%sf(i, j, k) + & fluid_pp(1)%pi_inf)/fluid_pp(1)%gamma - blkmod2 = ((fluid_pp(2)%gamma + 1d0)*q_prim_vf(E_idx)%sf(i, j, k) + & + blkmod2 = ((fluid_pp(2)%gamma + 1._wp)*q_prim_vf(E_idx)%sf(i, j, k) + & fluid_pp(2)%pi_inf)/fluid_pp(2)%gamma - q_sf(i, j, k) = (1d0/(rho_sf(i, j, k)*(q_prim_vf(adv_idx%beg)%sf(i, j, k)/blkmod1 + & - (1d0 - q_prim_vf(adv_idx%beg)%sf(i, j, k))/blkmod2))) + q_sf(i, j, k) = (1._wp/(rho_sf(i, j, k)*(q_prim_vf(adv_idx%beg)%sf(i, j, k)/blkmod1 + & + (1._wp - q_prim_vf(adv_idx%beg)%sf(i, j, k))/blkmod2))) end if - if (mixture_err .and. q_sf(i, j, k) < 0d0) then - q_sf(i, j, k) = 1d-16 + if (mixture_err .and. q_sf(i, j, k) < 0._wp) then + q_sf(i, j, k) = 1e-16_wp else q_sf(i, j, k) = sqrt(q_sf(i, j, k)) end if @@ -236,19 +236,19 @@ contains type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf - real(kind(0d0)), dimension(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end), & + real(wp), dimension(-offset_x%beg:m + offset_x%end, & + -offset_y%beg:n + offset_y%end, & + -offset_z%beg:p + offset_z%end), & intent(inout) :: q_sf - real(kind(0d0)) :: top, bottom, slope !< Flux limiter calcs + real(wp) :: top, bottom, slope !< Flux limiter calcs integer :: j, k, l !< Generic loop iterators do l = -offset_z%beg, p + offset_z%end do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end if (i == 1) then - if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0d0) then + if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0._wp) then top = q_prim_vf(adv_idx%beg)%sf(j, k, l) - & q_prim_vf(adv_idx%beg)%sf(j - 1, k, l) bottom = q_prim_vf(adv_idx%beg)%sf(j + 1, k, l) - & @@ -260,7 +260,7 @@ contains q_prim_vf(adv_idx%beg)%sf(j, k, l) end if elseif (i == 2) then - if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0d0) then + if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0._wp) then top = q_prim_vf(adv_idx%beg)%sf(j, k, l) - & q_prim_vf(adv_idx%beg)%sf(j, k - 1, l) bottom = q_prim_vf(adv_idx%beg)%sf(j, k + 1, l) - & @@ -272,7 +272,7 @@ contains q_prim_vf(adv_idx%beg)%sf(j, k, l) end if else - if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0d0) then + if (q_prim_vf(cont_idx%end + i)%sf(j, k, l) >= 0._wp) then top = q_prim_vf(adv_idx%beg)%sf(j, k, l) - & q_prim_vf(adv_idx%beg)%sf(j, k, l - 1) bottom = q_prim_vf(adv_idx%beg)%sf(j, k, l + 1) - & @@ -285,34 +285,34 @@ contains end if end if - if (abs(top) < 1d-8) top = 0d0 - if (abs(bottom) < 1d-8) bottom = 0d0 + if (abs(top) < 1e-8_wp) top = 0._wp + if (abs(bottom) < 1e-8_wp) bottom = 0._wp if (top == bottom) then - slope = 1d0 - ! ELSEIF((top == 0d0 .AND. bottom /= 0d0) & + slope = 1._wp + ! ELSEIF((top == 0._wp .AND. bottom /= 0._wp) & ! .OR. & - ! (bottom == 0d0 .AND. top /= 0d0)) THEN - ! slope = 0d0 + ! (bottom == 0._wp .AND. top /= 0._wp)) THEN + ! slope = 0._wp else - slope = (top*bottom)/(bottom**2d0 + 1d-16) + slope = (top*bottom)/(bottom**2._wp + 1e-16_wp) end if ! Flux limiter function if (flux_lim == 1) then ! MINMOD (MM) - q_sf(j, k, l) = max(0d0, min(1d0, slope)) + q_sf(j, k, l) = max(0._wp, min(1._wp, slope)) elseif (flux_lim == 2) then ! MUSCL (MC) - q_sf(j, k, l) = max(0d0, min(2d0*slope, 5d-1*(1d0 + slope), 2d0)) + q_sf(j, k, l) = max(0._wp, min(2._wp*slope, 5e-1_wp*(1._wp + slope), 2._wp)) elseif (flux_lim == 3) then ! OSPRE (OP) - q_sf(j, k, l) = (15d-1*(slope**2d0 + slope))/(slope**2d0 + slope + 1d0) + q_sf(j, k, l) = (15e-1_wp*(slope**2._wp + slope))/(slope**2._wp + slope + 1._wp) elseif (flux_lim == 4) then ! SUPERBEE (SB) - q_sf(j, k, l) = max(0d0, min(1d0, 2d0*slope), min(slope, 2d0)) + q_sf(j, k, l) = max(0._wp, min(1._wp, 2._wp*slope), min(slope, 2._wp)) elseif (flux_lim == 5) then ! SWEBY (SW) (beta = 1.5) - q_sf(j, k, l) = max(0d0, min(15d-1*slope, 1d0), min(slope, 15d-1)) + q_sf(j, k, l) = max(0._wp, min(15e-1_wp*slope, 1._wp), min(slope, 15e-1_wp)) elseif (flux_lim == 6) then ! VAN ALBADA (VA) - q_sf(j, k, l) = (slope**2d0 + slope)/(slope**2d0 + 1d0) + q_sf(j, k, l) = (slope**2._wp + slope)/(slope**2._wp + 1._wp) elseif (flux_lim == 7) then ! VAN LEER (VL) - q_sf(j, k, l) = (abs(slope) + slope)/(1d0 + abs(slope)) + q_sf(j, k, l) = (abs(slope) + slope)/(1._wp + abs(slope)) end if end do end do @@ -321,15 +321,15 @@ contains !> Computes the solution to the linear system Ax=b w/ sol = x !! @param A Input matrix - !! @param b right-hand-side + !! @param b right-hane-side !! @param sol Solution !! @param ndim Problem size subroutine s_solve_linear_system(A, b, sol, ndim) integer, intent(in) :: ndim - real(kind(0d0)), dimension(ndim, ndim), intent(inout) :: A - real(kind(0d0)), dimension(ndim), intent(inout) :: b - real(kind(0d0)), dimension(ndim), intent(out) :: sol + real(wp), dimension(ndim, ndim), intent(inout) :: A + real(wp), dimension(ndim), intent(inout) :: b + real(wp), dimension(ndim), intent(out) :: sol integer, dimension(ndim) :: ipiv @@ -385,7 +385,7 @@ contains dimension(sys_size), & intent(in) :: q_prim_vf - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & @@ -399,12 +399,12 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - q_sf(j, k, l) = 0d0 + q_sf(j, k, l) = 0._wp do r = -fd_number, fd_number if (grid_geometry == 3) then q_sf(j, k, l) = & - q_sf(j, k, l) + 1d0/y_cc(k)* & + q_sf(j, k, l) + 1._wp/y_cc(k)* & (fd_coeff_y(r, k)*y_cc(r + k)* & q_prim_vf(mom_idx%end)%sf(j, r + k, l) & - fd_coeff_z(r, l)* & @@ -428,7 +428,7 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - q_sf(j, k, l) = 0d0 + q_sf(j, k, l) = 0._wp do r = -fd_number, fd_number if (grid_geometry == 3) then @@ -456,7 +456,7 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - q_sf(j, k, l) = 0d0 + q_sf(j, k, l) = 0._wp do r = -fd_number, fd_number q_sf(j, k, l) = & @@ -484,16 +484,16 @@ contains dimension(sys_size), & intent(in) :: q_prim_vf - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & intent(inout) :: q_sf - real(kind(0d0)), & + real(wp), & dimension(1:3, 1:3) :: q_jacobian_sf, S, S2, O, O2 - real(kind(0d0)) :: trS, trS2, trO2, Q, IIS + real(wp) :: trS, trS2, trO2, Q, IIS integer :: j, k, l, r, jj, kk !< Generic loop iterators do l = -offset_z%beg, p + offset_z%end @@ -501,7 +501,7 @@ contains do j = -offset_x%beg, m + offset_x%end ! Get velocity gradient tensor - q_jacobian_sf(:, :) = 0d0 + q_jacobian_sf(:, :) = 0._wp do r = -fd_number, fd_number do jj = 1, 3 @@ -526,9 +526,9 @@ contains ! Decompose J into asymmetric matrix, S, and a skew-symmetric matrix, O do jj = 1, 3 do kk = 1, 3 - S(jj, kk) = 0.5d0* & + S(jj, kk) = 0.5_wp* & (q_jacobian_sf(jj, kk) + q_jacobian_sf(kk, jj)) - O(jj, kk) = 0.5d0* & + O(jj, kk) = 0.5_wp* & (q_jacobian_sf(jj, kk) - q_jacobian_sf(kk, jj)) end do end do @@ -546,11 +546,11 @@ contains end do ! Compute Q - Q = 0.5*((O2(1, 1) + O2(2, 2) + O2(3, 3)) - & - (S2(1, 1) + S2(2, 2) + S2(3, 3))) + Q = 0.5_wp*((O2(1, 1) + O2(2, 2) + O2(3, 3)) - & + (S2(1, 1) + S2(2, 2) + S2(3, 3))) trS = S(1, 1) + S(2, 2) + S(3, 3) - IIS = 0.5*((S(1, 1) + S(2, 2) + S(3, 3))**2 - & - (S2(1, 1) + S2(2, 2) + S2(3, 3))) + IIS = 0.5_wp*((S(1, 1) + S(2, 2) + S(3, 3))**2 - & + (S2(1, 1) + S2(2, 2) + S2(3, 3))) q_sf(j, k, l) = Q + IIS end do @@ -572,22 +572,22 @@ contains dimension(sys_size), & intent(in) :: q_cons_vf - real(kind(0d0)), & + real(wp), & dimension(-offset_x%beg:m + offset_x%end, & -offset_y%beg:n + offset_y%end, & -offset_z%beg:p + offset_z%end), & intent(inout) :: q_sf - real(kind(0d0)) :: drho_dx, drho_dy, drho_dz !< + real(wp) :: drho_dx, drho_dy, drho_dz !< !! Spatial derivatives of the density in the x-, y- and z-directions - real(kind(0d0)), dimension(2) :: gm_rho_max !< + real(wp), dimension(2) :: gm_rho_max !< !! Maximum value of the gradient magnitude (gm) of the density field !! in entire computational domain and not just the local sub-domain. !! The first position in the variable contains the maximum value and !! the second contains the rank of the processor on which it occurred. - real(kind(0d0)) :: alpha_unadv !< Unadvected volume fraction + real(wp) :: alpha_unadv !< Unadvected volume fraction integer :: i, j, k, l !< Generic loop iterators @@ -598,8 +598,8 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - drho_dx = 0d0 - drho_dy = 0d0 + drho_dx = 0._wp + drho_dy = 0._wp do i = -fd_number, fd_number drho_dx = drho_dx + fd_coeff_x(i, j)*rho_sf(i + j, k, l) @@ -618,7 +618,7 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - drho_dz = 0d0 + drho_dz = 0._wp do i = -fd_number, fd_number if (grid_geometry == 3) then @@ -648,7 +648,7 @@ contains ! Determining the local maximum of the gradient magnitude of density ! and bookkeeping the result, along with rank of the local processor - gm_rho_max = (/maxval(gm_rho_sf), real(proc_rank, kind(0d0))/) + gm_rho_max = (/maxval(gm_rho_sf), real(proc_rank, wp)/) ! Comparing the local maximum gradient magnitude of the density on ! this processor to the those computed on the remaining processors. @@ -674,7 +674,7 @@ contains do k = -offset_y%beg, n + offset_y%end do j = -offset_x%beg, m + offset_x%end - q_sf(j, k, l) = 0d0 + q_sf(j, k, l) = 0._wp do i = 1, adv_idx%end - E_idx q_sf(j, k, l) = & diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index b150f23e7..46dedba19 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -58,18 +58,19 @@ module m_global_parameters !> @name Cell-boundary locations in the x-, y- and z-coordinate directions !> @{ - real(kind(0d0)), allocatable, dimension(:) :: x_cb, x_root_cb, y_cb, z_cb - real(kind(0.0)), allocatable, dimension(:) :: x_cb_s, y_cb_s, z_cb_s + real(wp), allocatable, dimension(:) :: x_cb, x_root_cb, y_cb, z_cb + real(wp), allocatable, dimension(:) :: x_cb_s, y_cb_s, z_cb_s !> @} !> @name Cell-center locations in the x-, y- and z-coordinate directions !> @{ - real(kind(0d0)), allocatable, dimension(:) :: x_cc, x_root_cc, y_cc, z_cc + real(wp), allocatable, dimension(:) :: x_cc, x_root_cc, y_cc, z_cc + real(sp), allocatable, dimension(:) :: x_root_cc_s, x_cc_s !> @} !> Cell-width distributions in the x-, y- and z-coordinate directions !> @{ - real(kind(0d0)), allocatable, dimension(:) :: dx, dy, dz + real(wp), allocatable, dimension(:) :: dx, dy, dz !> @} integer :: buff_size !< @@ -84,9 +85,9 @@ module m_global_parameters !> @name IO options for adaptive time-stepping !> @{ logical :: cfl_adap_dt, cfl_const_dt, cfl_dt - real(kind(0d0)) :: t_save - real(kind(0d0)) :: t_stop - real(kind(0d0)) :: cfl_target + real(wp) :: t_save + real(wp) :: t_stop + real(wp) :: cfl_target integer :: n_save integer :: n_start !> @} @@ -182,7 +183,7 @@ module m_global_parameters ! ========================================================================== - real(kind(0d0)), allocatable, dimension(:) :: adv !< Advection variables + real(wp), allocatable, dimension(:) :: adv !< Advection variables ! Formatted Database File(s) Structure Parameters ========================== @@ -231,7 +232,7 @@ module m_global_parameters logical :: chem_wrt_T !> @} - real(kind(0d0)), dimension(num_fluids_max) :: schlieren_alpha !< + real(wp), dimension(num_fluids_max) :: schlieren_alpha !< !! Amplitude coefficients of the numerical Schlieren function that are used !! to adjust the intensity of numerical Schlieren renderings for individual !! fluids. This enables waves and interfaces of varying strengths and in all @@ -251,34 +252,35 @@ module m_global_parameters !> @name Reference parameters for Tait EOS !> @{ - real(kind(0d0)) :: rhoref, pref + real(wp) :: rhoref, pref !> @} !> @name Bubble modeling variables and parameters !> @{ integer :: nb - real(kind(0d0)) :: R0ref - real(kind(0d0)) :: Ca, Web, Re_inv - real(kind(0d0)), dimension(:), allocatable :: weight, R0, V0 + real(wp) :: R0ref + real(wp) :: Ca, Web, Re_inv + real(wp), dimension(:), allocatable :: weight, R0, V0 logical :: bubbles logical :: qbmm logical :: polytropic logical :: polydisperse logical :: adv_n integer :: thermal !< 1 = adiabatic, 2 = isotherm, 3 = transfer - real(kind(0d0)) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, G, pv, M_n, M_v - real(kind(0d0)), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T - real(kind(0d0)), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN - real(kind(0d0)) :: mul0, ss, gamma_v, mu_v - real(kind(0d0)) :: gamma_m, gamma_n, mu_n - real(kind(0d0)) :: poly_sigma - real(kind(0d0)) :: sigR + real(wp) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, G, pv, M_n, M_v + real(wp), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T + real(wp), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN + real(wp) :: mul0, ss, gamma_v, mu_v + real(wp) :: gamma_m, gamma_n, mu_n + real(wp) :: poly_sigma + real(wp) :: sigR integer :: nmom !> @} !> @name surface tension coefficient !> @{ - real(kind(0d0)) :: sigma + + real(wp) :: sigma logical :: surface_tension !> #} @@ -338,8 +340,8 @@ contains #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0d0 - bc_${DIM}$%ve${DIR}$ = 0d0 + bc_${DIM}$%vb${DIR}$ = 0._wp + bc_${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor @@ -347,9 +349,9 @@ contains do i = 1, num_fluids_max fluid_pp(i)%gamma = dflt_real fluid_pp(i)%pi_inf = dflt_real - fluid_pp(i)%cv = 0d0 - fluid_pp(i)%qv = 0d0 - fluid_pp(i)%qvp = 0d0 + fluid_pp(i)%cv = 0._wp + fluid_pp(i)%qv = 0._wp + fluid_pp(i)%qvp = 0._wp fluid_pp(i)%G = dflt_real end do @@ -518,12 +520,12 @@ contains end if if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 0d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 0._wp else if (nb > 1) then !call s_simpson - V0(:) = 0d0 + V0(:) = 0._wp else stop 'Invalid value of nb' end if @@ -531,8 +533,8 @@ contains if (polytropic .neqv. .true.) then !call s_initialize_nonpoly else - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if @@ -613,18 +615,18 @@ contains end do if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 0d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 0._wp else if (nb > 1) then - V0(:) = 0d0 + V0(:) = 0._wp else stop 'Invalid value of nb' end if if (polytropic) then - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if end if @@ -726,6 +728,8 @@ contains allocate (z_cb_s(-1 - offset_x%beg:m + offset_x%end)) end if end if + else + allocate (x_cc_s(-buff_size:m + buff_size)) end if ! Allocating the grid variables in the x-coordinate direction @@ -753,6 +757,10 @@ contains allocate (x_root_cb(-1:m_root)) allocate (x_root_cc(0:m_root)) + if (precision == 1) then + allocate (x_root_cc_s(0:m_root)) + end if + end if allocate (adv(num_fluids)) diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index 20c5346d2..3fa7b6990 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -29,8 +29,8 @@ module m_mpi_proxy !! processors. Note that these variables are structured as vectors rather !! than arrays. !> @{ - real(kind(0d0)), allocatable, dimension(:) :: q_cons_buffer_in - real(kind(0d0)), allocatable, dimension(:) :: q_cons_buffer_out + real(wp), allocatable, dimension(:) :: q_cons_buffer_in + real(wp), allocatable, dimension(:) :: q_cons_buffer_out !> @} !> @name Receive counts and displacement vector variables, respectively, used in @@ -106,8 +106,8 @@ contains ! Initially zeroing out the vectorized buffer region variables ! to avoid possible underflow from any unused allocated memory - q_cons_buffer_in = 0d0 - q_cons_buffer_out = 0d0 + q_cons_buffer_in = 0._wp + q_cons_buffer_out = 0._wp end if @@ -182,19 +182,19 @@ contains call MPI_BCAST(alpha_wrt(1), num_fluids_max, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr) do i = 1, num_fluids_max - call MPI_BCAST(fluid_pp(i)%gamma, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(fluid_pp(i)%pi_inf, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(fluid_pp(i)%cv, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(fluid_pp(i)%qv, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(fluid_pp(i)%qvp, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(fluid_pp(i)%G, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%gamma, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%pi_inf, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%cv, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%qv, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%qvp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%G, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) end do #:for VAR in [ 'pref', 'rhoref', 'R0ref', 'poly_sigma', 'Web', 'Ca', & & 'Re_inv', 'sigma', 't_save', 't_stop' ] - call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor - call MPI_BCAST(schlieren_alpha(1), num_fluids_max, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(schlieren_alpha(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr) #endif end subroutine s_mpi_bcast_user_inputs @@ -213,10 +213,10 @@ contains ! Temporary # of processors in x-, y- and z-coordinate directions ! used during the processor factorization optimization procedure - real(kind(0d0)) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z + real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z ! Processor factorization (fct) minimization parameter - real(kind(0d0)) :: fct_min + real(wp) :: fct_min ! Cartesian processor topology communicator integer :: MPI_COMM_CART @@ -262,8 +262,8 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -306,10 +306,10 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) & - + 10d0*abs((n + 1)/tmp_num_procs_y & - - (p + 1)/tmp_num_procs_z) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) & + + 10._wp*abs((n + 1)/tmp_num_procs_y & + - (p + 1)/tmp_num_procs_z) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -448,8 +448,8 @@ contains ! Computing minimization variable for these initial values tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -667,9 +667,9 @@ contains ! Sending/receiving the data to/from bc_x%end/bc_x%beg call MPI_SENDRECV(dx(m - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & dx(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -678,9 +678,9 @@ contains ! Sending/receiving the data to/from bc_x%beg/bc_x%beg call MPI_SENDRECV(dx(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & dx(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -693,9 +693,9 @@ contains ! Sending/receiving the data to/from bc_x%beg/bc_x%end call MPI_SENDRECV(dx(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & dx(m + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -704,9 +704,9 @@ contains ! Sending/receiving the data to/from bc_x%end/bc_x%end call MPI_SENDRECV(dx(m - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & dx(m + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -727,9 +727,9 @@ contains ! Sending/receiving the data to/from bc_y%end/bc_y%beg call MPI_SENDRECV(dy(n - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 0, & + mpi_p, bc_y%end, 0, & dy(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -738,9 +738,9 @@ contains ! Sending/receiving the data to/from bc_y%beg/bc_y%beg call MPI_SENDRECV(dy(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 1, & + mpi_p, bc_y%beg, 1, & dy(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -753,9 +753,9 @@ contains ! Sending/receiving the data to/from bc_y%beg/bc_y%end call MPI_SENDRECV(dy(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 1, & + mpi_p, bc_y%beg, 1, & dy(n + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -764,9 +764,9 @@ contains ! Sending/receiving the data to/from bc_y%end/bc_y%end call MPI_SENDRECV(dy(n - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 0, & + mpi_p, bc_y%end, 0, & dy(n + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -787,9 +787,9 @@ contains ! Sending/receiving the data to/from bc_z%end/bc_z%beg call MPI_SENDRECV(dz(p - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & dz(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -798,9 +798,9 @@ contains ! Sending/receiving the data to/from bc_z%beg/bc_z%beg call MPI_SENDRECV(dz(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & dz(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -813,9 +813,9 @@ contains ! Sending/receiving the data to/from bc_z%beg/bc_z%end call MPI_SENDRECV(dz(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & dz(p + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -824,9 +824,9 @@ contains ! Sending/receiving the data to/from bc_z%end/bc_z%end call MPI_SENDRECV(dz(p - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & dz(p + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -890,10 +890,10 @@ contains ! Sending/receiving the data to/from bc_x%end/bc_x%beg call MPI_SENDRECV(q_cons_buffer_out(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & q_cons_buffer_in(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -918,10 +918,10 @@ contains ! Sending/receiving the data to/from bc_x%beg/bc_x%beg call MPI_SENDRECV(q_cons_buffer_out(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & q_cons_buffer_in(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -970,10 +970,10 @@ contains ! Sending/receiving the data to/from bc_x%beg/bc_x%end call MPI_SENDRECV(q_cons_buffer_out(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & q_cons_buffer_in(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -998,10 +998,10 @@ contains ! Sending/receiving the data to/from bc_x%end/bc_x%end call MPI_SENDRECV(q_cons_buffer_out(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & q_cons_buffer_in(0), & buff_size*sys_size*(n + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1060,11 +1060,11 @@ contains ! Sending/receiving the data to/from bc_y%end/bc_y%beg call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & - (p + 1), MPI_DOUBLE_PRECISION, & + (p + 1), mpi_p, & bc_y%end, 0, q_cons_buffer_in(0), & buff_size*sys_size* & (m + 2*buff_size + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1090,11 +1090,11 @@ contains ! Sending/receiving the data to/from bc_y%beg/bc_y%beg call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & - (p + 1), MPI_DOUBLE_PRECISION, & + (p + 1), mpi_p, & bc_y%beg, 1, q_cons_buffer_in(0), & buff_size*sys_size* & (m + 2*buff_size + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1145,11 +1145,11 @@ contains ! Sending/receiving the data to/from bc_y%beg/bc_y%end call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & - (p + 1), MPI_DOUBLE_PRECISION, & + (p + 1), mpi_p, & bc_y%beg, 1, q_cons_buffer_in(0), & buff_size*sys_size* & (m + 2*buff_size + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1176,11 +1176,11 @@ contains ! Sending/receiving the data to/from bc_y%end/bc_y%end call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & - (p + 1), MPI_DOUBLE_PRECISION, & + (p + 1), mpi_p, & bc_y%end, 0, q_cons_buffer_in(0), & buff_size*sys_size* & (m + 2*buff_size + 1)*(p + 1), & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1242,11 +1242,11 @@ contains call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & q_cons_buffer_in(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1274,11 +1274,11 @@ contains call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & q_cons_buffer_in(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1332,11 +1332,11 @@ contains call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & q_cons_buffer_in(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1365,11 +1365,11 @@ contains call MPI_SENDRECV(q_cons_buffer_out(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & q_cons_buffer_in(0), buff_size* & sys_size*(m + 2*buff_size + 1)* & (n + 2*buff_size + 1), & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, & ierr) @@ -1415,7 +1415,7 @@ contains !! the second dimension corresponds to the processor rank. subroutine s_mpi_gather_spatial_extents(spatial_extents) - real(kind(0d0)), dimension(1:, 0:), intent(inout) :: spatial_extents + real(wp), dimension(1:, 0:), intent(INOUT) :: spatial_extents #ifdef MFC_MPI @@ -1423,102 +1423,102 @@ contains if (p > 0) then if (grid_geometry == 3) then ! Minimum spatial extent in the r-direction - call MPI_GATHERV(minval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(y_cb), 1, mpi_p, & spatial_extents(1, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Minimum spatial extent in the theta-direction - call MPI_GATHERV(minval(z_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(z_cb), 1, mpi_p, & spatial_extents(2, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Minimum spatial extent in the z-direction - call MPI_GATHERV(minval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(x_cb), 1, mpi_p, & spatial_extents(3, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the r-direction - call MPI_GATHERV(maxval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(y_cb), 1, mpi_p, & spatial_extents(4, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the theta-direction - call MPI_GATHERV(maxval(z_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(z_cb), 1, mpi_p, & spatial_extents(5, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the z-direction - call MPI_GATHERV(maxval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(x_cb), 1, mpi_p, & spatial_extents(6, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) else ! Minimum spatial extent in the x-direction - call MPI_GATHERV(minval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(x_cb), 1, mpi_p, & spatial_extents(1, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Minimum spatial extent in the y-direction - call MPI_GATHERV(minval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(y_cb), 1, mpi_p, & spatial_extents(2, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Minimum spatial extent in the z-direction - call MPI_GATHERV(minval(z_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(z_cb), 1, mpi_p, & spatial_extents(3, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the x-direction - call MPI_GATHERV(maxval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(x_cb), 1, mpi_p, & spatial_extents(4, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the y-direction - call MPI_GATHERV(maxval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(y_cb), 1, mpi_p, & spatial_extents(5, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the z-direction - call MPI_GATHERV(maxval(z_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(z_cb), 1, mpi_p, & spatial_extents(6, 0), recvcounts, 6*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) end if ! Simulation is 2D else ! Minimum spatial extent in the x-direction - call MPI_GATHERV(minval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(x_cb), 1, mpi_p, & spatial_extents(1, 0), recvcounts, 4*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Minimum spatial extent in the y-direction - call MPI_GATHERV(minval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(y_cb), 1, mpi_p, & spatial_extents(2, 0), recvcounts, 4*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the x-direction - call MPI_GATHERV(maxval(x_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(x_cb), 1, mpi_p, & spatial_extents(3, 0), recvcounts, 4*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Maximum spatial extent in the y-direction - call MPI_GATHERV(maxval(y_cb), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(y_cb), 1, mpi_p, & spatial_extents(4, 0), recvcounts, 4*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) end if @@ -1539,17 +1539,17 @@ contains ! Silo-HDF5 database format if (format == 1) then - call MPI_GATHERV(x_cc(0), m + 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(x_cc(0), m + 1, mpi_p, & x_root_cc(0), recvcounts, displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) ! Binary database format else - call MPI_GATHERV(x_cb(0), m + 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(x_cb(0), m + 1, mpi_p, & x_root_cb(0), recvcounts, displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, & + mpi_p, 0, MPI_COMM_WORLD, & ierr) if (proc_rank == 0) x_root_cb(-1) = x_cb(-1) @@ -1570,23 +1570,23 @@ contains !! to each processor's rank. subroutine s_mpi_gather_data_extents(q_sf, data_extents) - real(kind(0d0)), dimension(:, :, :), intent(in) :: q_sf + real(wp), dimension(:, :, :), intent(in) :: q_sf - real(kind(0d0)), & + real(wp), & dimension(1:2, 0:num_procs - 1), & intent(inout) :: data_extents #ifdef MFC_MPI ! Minimum flow variable extent - call MPI_GATHERV(minval(q_sf), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(minval(q_sf), 1, mpi_p, & data_extents(1, 0), recvcounts, 2*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + mpi_p, 0, MPI_COMM_WORLD, ierr) ! Maximum flow variable extent - call MPI_GATHERV(maxval(q_sf), 1, MPI_DOUBLE_PRECISION, & + call MPI_GATHERV(maxval(q_sf), 1, mpi_p, & data_extents(2, 0), recvcounts, 2*displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + mpi_p, 0, MPI_COMM_WORLD, ierr) #endif @@ -1600,12 +1600,12 @@ contains !! @param q_root_sf Flow variable defined on the entire computational domain subroutine s_mpi_defragment_1d_flow_variable(q_sf, q_root_sf) - real(kind(0d0)), & - dimension(0:m, 0:0, 0:0), & + real(wp), & + dimension(0:m), & intent(in) :: q_sf - real(kind(0d0)), & - dimension(0:m_root, 0:0, 0:0), & + real(wp), & + dimension(0:m), & intent(inout) :: q_root_sf #ifdef MFC_MPI @@ -1613,9 +1613,9 @@ contains ! Gathering the sub-domain flow variable data from all the processes ! and putting it back together for the entire computational domain ! on the process with rank 0 - call MPI_GATHERV(q_sf(0, 0, 0), m + 1, MPI_DOUBLE_PRECISION, & - q_root_sf(0, 0, 0), recvcounts, displs, & - MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(q_sf(0), m + 1, mpi_p, & + q_root_sf(0), recvcounts, displs, & + mpi_p, 0, MPI_COMM_WORLD, ierr) #endif diff --git a/src/post_process/m_start_up.f90 b/src/post_process/m_start_up.f90 index 301e385d3..6e8b23962 100644 --- a/src/post_process/m_start_up.f90 +++ b/src/post_process/m_start_up.f90 @@ -155,11 +155,11 @@ subroutine s_perform_time_step(t_step) if (proc_rank == 0) then if (cfl_dt) then print '(" ["I3"%] Saving "I8" of "I0"")', & - int(ceiling(100d0*(real(t_step - n_start)/(n_save)))), & + int(ceiling(100._wp*(real(t_step - n_start)/(n_save)))), & t_step, n_save else print '(" ["I3"%] Saving "I8" of "I0" @ t_step = "I0"")', & - int(ceiling(100d0*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & + int(ceiling(100._wp*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & (t_step - t_step_start)/t_step_save + 1, & (t_step_stop - t_step_start)/t_step_save + 1, & t_step @@ -187,7 +187,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) integer, intent(inout) :: t_step character(LEN=name_len), intent(inout) :: varname - real(kind(0d0)), intent(inout) :: pres, c, H + real(wp), intent(inout) :: pres, c, H integer :: i, j, k, l @@ -494,12 +494,12 @@ subroutine s_save_data(t_step, varname, pres, c, H) pres = q_prim_vf(E_idx)%sf(i, j, k) - H = ((gamma_sf(i, j, k) + 1d0)*pres + & + H = ((gamma_sf(i, j, k) + 1._wp)*pres + & pi_inf_sf(i, j, k))/rho_sf(i, j, k) call s_compute_speed_of_sound(pres, rho_sf(i, j, k), & gamma_sf(i, j, k), pi_inf_sf(i, j, k), & - H, adv, 0d0, 0d0, c) + H, adv, 0._wp, 0._wp, c) q_sf(i, j, k) = c end do diff --git a/src/post_process/p_main.fpp b/src/post_process/p_main.fpp index 33a1729a8..ce3e0271a 100644 --- a/src/post_process/p_main.fpp +++ b/src/post_process/p_main.fpp @@ -26,9 +26,9 @@ program p_main !! Generic storage for the name(s) of the flow variable(s) that will be added !! to the formatted database file(s) - real(kind(0d0)) :: pres - real(kind(0d0)) :: c - real(kind(0d0)) :: H + real(wp) :: pres + real(wp) :: c + real(wp) :: H call s_initialize_mpi_domain() diff --git a/src/pre_process/include/2dHardcodedIC.fpp b/src/pre_process/include/2dHardcodedIC.fpp index 7d6ee9602..1149cd610 100644 --- a/src/pre_process/include/2dHardcodedIC.fpp +++ b/src/pre_process/include/2dHardcodedIC.fpp @@ -1,11 +1,11 @@ #:def Hardcoded2DVariables() - real(kind(0d0)) :: eps - real(kind(0d0)) :: r, rmax, gam, umax, p0 + real(wp) :: eps + real(wp) :: r, rmax, gam, umax, p0 - real(kind(0d0)) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, alph + real(wp) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, alph - eps = 1e-9 + eps = 1e-9_wp #:enddef @@ -13,91 +13,91 @@ select case (patch_icpp(patch_id)%hcid) ! 2D_hardcoded_ic example case case (200) - if (y_cc(j) <= (-x_cc(i)**3 + 1)**(1d0/3d0)) then + if (y_cc(j) <= (-x_cc(i)**3 + 1)**(1._wp/3._wp)) then ! Volume Fractions q_prim_vf(advxb)%sf(i, j, 0) = eps - q_prim_vf(advxe)%sf(i, j, 0) = 1d0 - eps + q_prim_vf(advxe)%sf(i, j, 0) = 1._wp - eps ! Denssities - q_prim_vf(contxb)%sf(i, j, 0) = eps*1000d0 - q_prim_vf(contxe)%sf(i, j, 0) = (1d0 - eps)*1d0 + q_prim_vf(contxb)%sf(i, j, 0) = eps*1000._wp + q_prim_vf(contxe)%sf(i, j, 0) = (1._wp - eps)*1._wp ! Pressure - q_prim_vf(E_idx)%sf(i, j, 0) = 1000d0 + q_prim_vf(E_idx)%sf(i, j, 0) = 1000._wp end if case (202) ! Gresho vortex (Gouasmi et al 2022 JCP) - r = ((x_cc(i) - 0.5d0)**2 + (y_cc(j) - 0.5d0)**2)**0.5d0 - rmax = 0.2 + r = ((x_cc(i) - 0.5_wp)**2 + (y_cc(j) - 0.5_wp)**2)**0.5_wp + rmax = 0.2_wp - gam = 1d0 + 1d0/fluid_pp(1)%gamma + gam = 1._wp + 1._wp/fluid_pp(1)%gamma umax = 2*pi*rmax*patch_icpp(patch_id)%vel(2) - p0 = umax**2*(1d0/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5d0) + p0 = umax**2*(1._wp/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5_wp) if (r < rmax) then - q_prim_vf(momxb)%sf(i, j, 0) = -(y_cc(j) - 0.5d0)*umax/rmax - q_prim_vf(momxe)%sf(i, j, 0) = (x_cc(i) - 0.5d0)*umax/rmax - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2d0) + q_prim_vf(momxb)%sf(i, j, 0) = -(y_cc(j) - 0.5_wp)*umax/rmax + q_prim_vf(momxe)%sf(i, j, 0) = (x_cc(i) - 0.5_wp)*umax/rmax + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp) else if (r < 2*rmax) then - q_prim_vf(momxb)%sf(i, j, 0) = -((y_cc(j) - 0.5d0)/r)*umax*(2d0 - r/rmax) - q_prim_vf(momxe)%sf(i, j, 0) = ((x_cc(i) - 0.5d0)/r)*umax*(2d0 - r/rmax) - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2d0 + 4*(1 - (r/rmax) + log(r/rmax))) + q_prim_vf(momxb)%sf(i, j, 0) = -((y_cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(momxe)%sf(i, j, 0) = ((x_cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp + 4*(1 - (r/rmax) + log(r/rmax))) else - q_prim_vf(momxb)%sf(i, j, 0) = 0d0 - q_prim_vf(momxe)%sf(i, j, 0) = 0d0 - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*(-2 + 4*log(2.)) + q_prim_vf(momxb)%sf(i, j, 0) = 0._wp + q_prim_vf(momxe)%sf(i, j, 0) = 0._wp + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*(-2 + 4*log(2._wp)) end if case (203) ! Gresho vortex (Gouasmi et al 2022 JCP) with density correction - r = ((x_cc(i) - 0.5d0)**2 + (y_cc(j) - 0.5d0)**2)**0.5d0 - rmax = 0.2 + r = ((x_cc(i) - 0.5_wp)**2._wp + (y_cc(j) - 0.5_wp)**2)**0.5_wp + rmax = 0.2_wp - gam = 1d0 + 1d0/fluid_pp(1)%gamma + gam = 1._wp + 1._wp/fluid_pp(1)%gamma umax = 2*pi*rmax*patch_icpp(patch_id)%vel(2) - p0 = umax**2*(1d0/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5d0) + p0 = umax**2*(1._wp/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5_wp) if (r < rmax) then - q_prim_vf(momxb)%sf(i, j, 0) = -(y_cc(j) - 0.5d0)*umax/rmax - q_prim_vf(momxe)%sf(i, j, 0) = (x_cc(i) - 0.5d0)*umax/rmax - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2d0) + q_prim_vf(momxb)%sf(i, j, 0) = -(y_cc(j) - 0.5_wp)*umax/rmax + q_prim_vf(momxe)%sf(i, j, 0) = (x_cc(i) - 0.5_wp)*umax/rmax + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2._wp/2._wp) else if (r < 2*rmax) then - q_prim_vf(momxb)%sf(i, j, 0) = -((y_cc(j) - 0.5d0)/r)*umax*(2d0 - r/rmax) - q_prim_vf(momxe)%sf(i, j, 0) = ((x_cc(i) - 0.5d0)/r)*umax*(2d0 - r/rmax) - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2d0 + 4*(1 - (r/rmax) + log(r/rmax))) + q_prim_vf(momxb)%sf(i, j, 0) = -((y_cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(momxe)%sf(i, j, 0) = ((x_cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp + 4._wp*(1._wp - (r/rmax) + log(r/rmax))) else - q_prim_vf(momxb)%sf(i, j, 0) = 0d0 - q_prim_vf(momxe)%sf(i, j, 0) = 0d0 - q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*(-2 + 4*log(2.)) + q_prim_vf(momxb)%sf(i, j, 0) = 0._wp + q_prim_vf(momxe)%sf(i, j, 0) = 0._wp + q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2._wp*(-2._wp + 4*log(2._wp)) end if - q_prim_vf(contxb)%sf(i, j, 0) = q_prim_vf(E_idx)%sf(i, j, 0)**(1d0/gam) + q_prim_vf(contxb)%sf(i, j, 0) = q_prim_vf(E_idx)%sf(i, j, 0)**(1._wp/gam) case (204) ! Rayleigh-Taylor instability - rhoH = 3 - rhoL = 1 - pRef = 1e5 + rhoH = 3._wp + rhoL = 1._wp + pRef = 1.e5_wp pInt = pRef - h = 0.7 - lam = 0.2 - wl = 2*pi/lam - amp = 0.05/wl + h = 0.7_wp + lam = 0.2_wp + wl = 2._wp*pi/lam + amp = 0.05_wp/wl - intH = amp*sin(2*pi*x_cc(i)/lam - pi/2) + h + intH = amp*sin(2._wp*pi*x_cc(i)/lam - pi/2._wp) + h - alph = 5d-1*(1 + tanh((y_cc(j) - intH)/2.5e-3)) + alph = 0.5_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp)) if (alph < eps) alph = eps - if (alph > 1 - eps) alph = 1 - eps + if (alph > 1._wp - eps) alph = 1._wp - eps if (y_cc(j) > intH) then q_prim_vf(advxb)%sf(i, j, 0) = alph - q_prim_vf(advxe)%sf(i, j, 0) = 1 - alph + q_prim_vf(advxe)%sf(i, j, 0) = 1._wp - alph q_prim_vf(contxb)%sf(i, j, 0) = alph*rhoH - q_prim_vf(contxe)%sf(i, j, 0) = (1 - alph)*rhoL - q_prim_vf(E_idx)%sf(i, j, 0) = pref + rhoH*9.81*(1.2 - y_cc(j)) + q_prim_vf(contxe)%sf(i, j, 0) = (1._wp - alph)*rhoL + q_prim_vf(E_idx)%sf(i, j, 0) = pref + rhoH*9.81_wp*(1.2_wp - y_cc(j)) else q_prim_vf(advxb)%sf(i, j, 0) = alph - q_prim_vf(advxe)%sf(i, j, 0) = 1 - alph + q_prim_vf(advxe)%sf(i, j, 0) = 1._wp - alph q_prim_vf(contxb)%sf(i, j, 0) = alph*rhoH - q_prim_vf(contxe)%sf(i, j, 0) = (1 - alph)*rhoL - pInt = pref + rhoH*9.81*(1.2 - intH) - q_prim_vf(E_idx)%sf(i, j, 0) = pInt + rhoL*9.81*(intH - y_cc(j)) + q_prim_vf(contxe)%sf(i, j, 0) = (1._wp - alph)*rhoL + pInt = pref + rhoH*9.81_wp*(1.2_wp - intH) + q_prim_vf(E_idx)%sf(i, j, 0) = pInt + rhoL*9.81_wp*(intH - y_cc(j)) end if case default diff --git a/src/pre_process/include/3dHardcodedIC.fpp b/src/pre_process/include/3dHardcodedIC.fpp index 3d9a4e2f1..a75476c37 100644 --- a/src/pre_process/include/3dHardcodedIC.fpp +++ b/src/pre_process/include/3dHardcodedIC.fpp @@ -1,46 +1,46 @@ #:def Hardcoded3DVariables() ! Place any declaration of intermediate variables here - real(kind(0d0)) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, alph + real(wp) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, alph - real(kind(0d0)) :: eps + real(wp) :: eps - eps = 1e-9 + eps = 1e-9_wp #:enddef #:def Hardcoded3D() select case (patch_icpp(patch_id)%hcid) case (300) ! Rayleigh-Taylor instability - rhoH = 3 - rhoL = 1 - pRef = 1e5 + rhoH = 3._wp + rhoL = 1._wp + pRef = 1.e5_wp pInt = pRef - h = 0.7 - lam = 0.2 - wl = 2*pi/lam - amp = 0.025/wl + h = 0.7_wp + lam = 0.2_wp + wl = 2._wp*pi/lam + amp = 0.025_wp/wl - intH = amp*(sin(2*pi*x_cc(i)/lam - pi/2) + sin(2*pi*z_cc(k)/lam - pi/2)) + h + intH = amp*(sin(2._wp*pi*x_cc(i)/lam - pi/2._wp) + sin(2._wp*pi*z_cc(k)/lam - pi/2._wp)) + h - alph = 5d-1*(1 + tanh((y_cc(j) - intH)/2.5e-3)) + alph = 5e-1_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp)) if (alph < eps) alph = eps - if (alph > 1 - eps) alph = 1 - eps + if (alph > 1._wp - eps) alph = 1._wp - eps if (y_cc(j) > intH) then q_prim_vf(advxb)%sf(i, j, k) = alph - q_prim_vf(advxe)%sf(i, j, k) = 1 - alph + q_prim_vf(advxe)%sf(i, j, k) = 1._wp - alph q_prim_vf(contxb)%sf(i, j, k) = alph*rhoH - q_prim_vf(contxe)%sf(i, j, k) = (1 - alph)*rhoL - q_prim_vf(E_idx)%sf(i, j, k) = pref + rhoH*9.81*(1.2 - y_cc(j)) + q_prim_vf(contxe)%sf(i, j, k) = (1._wp - alph)*rhoL + q_prim_vf(E_idx)%sf(i, j, k) = pref + rhoH*9.81_wp*(1.2_wp - y_cc(j)) else q_prim_vf(advxb)%sf(i, j, k) = alph - q_prim_vf(advxe)%sf(i, j, k) = 1 - alph + q_prim_vf(advxe)%sf(i, j, k) = 1._wp - alph q_prim_vf(contxb)%sf(i, j, k) = alph*rhoH - q_prim_vf(contxe)%sf(i, j, k) = (1 - alph)*rhoL - pInt = pref + rhoH*9.81*(1.2 - intH) - q_prim_vf(E_idx)%sf(i, j, k) = pInt + rhoL*9.81*(intH - y_cc(j)) + q_prim_vf(contxe)%sf(i, j, k) = (1._wp - alph)*rhoL + pInt = pref + rhoH*9.81_wp*(1.2_wp - intH) + q_prim_vf(E_idx)%sf(i, j, k) = pInt + rhoL*9.81_wp*(intH - y_cc(j)) end if ! Put your variable assignments here diff --git a/src/pre_process/m_assign_variables.fpp b/src/pre_process/m_assign_variables.fpp index c24e0ee40..4b1e8d184 100644 --- a/src/pre_process/m_assign_variables.fpp +++ b/src/pre_process/m_assign_variables.fpp @@ -49,11 +49,11 @@ module m_assign_variables subroutine s_assign_patch_xxxxx_primitive_variables(patch_id, j, k, l, & eta, q_prim_vf, patch_id_fp) - import :: scalar_field, sys_size, n, m, p + import :: scalar_field, sys_size, n, m, p, wp integer, intent(in) :: patch_id integer, intent(in) :: j, k, l - real(kind(0d0)), intent(in) :: eta + real(wp), intent(in) :: eta type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer, dimension(0:m, 0:n, 0:p), intent(inout) :: patch_id_fp @@ -111,18 +111,18 @@ contains integer, intent(in) :: patch_id integer, intent(in) :: j, k, l - real(kind(0d0)), intent(in) :: eta + real(wp), intent(in) :: eta type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer, dimension(0:m, 0:n, 0:p), intent(inout) :: patch_id_fp - real(kind(0d0)) :: rho !< density - real(kind(0d0)), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity - real(kind(0d0)) :: pres !< pressure - real(kind(0d0)) :: gamma !< specific heat ratio function - real(kind(0d0)) :: x_centroid, y_centroid - real(kind(0d0)) :: epsilon, beta - real(kind(0d0)) :: Ys(1:num_species) - real(kind(0d0)) :: mean_molecular_weight + real(wp) :: rho !< density + real(wp), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity + real(wp) :: pres !< pressure + real(wp) :: gamma !< specific heat ratio function + real(wp) :: x_centroid, y_centroid + real(wp) :: epsilon, beta + real(wp) :: Ys(1:num_species) + real(wp) :: mean_molecular_weight integer :: smooth_patch_id integer :: i !< generic loop operator @@ -135,47 +135,47 @@ contains ! Density q_prim_vf(1)%sf(j, k, l) = & eta*patch_icpp(patch_id)%rho & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%rho + + (1._wp - eta)*patch_icpp(smooth_patch_id)%rho ! Velocity do i = 1, E_idx - mom_idx%beg q_prim_vf(i + 1)%sf(j, k, l) = & - 1d0/q_prim_vf(1)%sf(j, k, l)* & + 1._wp/q_prim_vf(1)%sf(j, k, l)* & (eta*patch_icpp(patch_id)%rho & *patch_icpp(patch_id)%vel(i) & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%rho & + + (1._wp - eta)*patch_icpp(smooth_patch_id)%rho & *patch_icpp(smooth_patch_id)%vel(i)) end do ! Specific heat ratio function q_prim_vf(gamma_idx)%sf(j, k, l) = & eta*patch_icpp(patch_id)%gamma & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%gamma + + (1._wp - eta)*patch_icpp(smooth_patch_id)%gamma ! Pressure q_prim_vf(E_idx)%sf(j, k, l) = & - 1d0/q_prim_vf(gamma_idx)%sf(j, k, l)* & + 1._wp/q_prim_vf(gamma_idx)%sf(j, k, l)* & (eta*patch_icpp(patch_id)%gamma & *patch_icpp(patch_id)%pres & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%gamma & + + (1._wp - eta)*patch_icpp(smooth_patch_id)%gamma & *patch_icpp(smooth_patch_id)%pres) ! Liquid stiffness function q_prim_vf(pi_inf_idx)%sf(j, k, l) = & eta*patch_icpp(patch_id)%pi_inf & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%pi_inf + + (1._wp - eta)*patch_icpp(smooth_patch_id)%pi_inf ! Species Concentrations if (chemistry) then block - real(kind(0d0)) :: sum, term + real(wp) :: sum, term ! Accumulating the species concentrations - sum = 0d0 + sum = 0._wp do i = 1, num_species term = & eta*patch_icpp(patch_id)%Y(i) & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%Y(i) + + (1._wp - eta)*patch_icpp(smooth_patch_id)%Y(i) q_prim_vf(chemxb + i - 1)%sf(j, k, l) = term sum = sum + term end do @@ -197,7 +197,7 @@ contains end if ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(j, k, l) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(j, k, l) = patch_id end subroutine s_assign_patch_mixture_primitive_variables @@ -212,59 +212,59 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i - real(kind(0d0)) :: pres_mag, loc, n_tait, B_tait, p0 - real(kind(0d0)) :: R3bar, n0, ratio, nH, vfH, velH, rhoH, deno + real(wp) :: pres_mag, loc, n_tait, B_tait, p0 + real(wp) :: R3bar, n0, ratio, nH, vfH, velH, rhoH, deno p0 = 101325 - pres_mag = 1d-1 + pres_mag = 1e-1_wp loc = x_cc(177) n_tait = fluid_pp(1)%gamma B_tait = fluid_pp(1)%pi_inf - n_tait = 1.d0/n_tait + 1.d0 - B_tait = B_tait*(n_tait - 1d0)/n_tait + n_tait = 1._wp/n_tait + 1._wp + B_tait = B_tait*(n_tait - 1._wp)/n_tait if (j < 177) then - q_prim_vf(E_idx)%sf(j, k, l) = 0.5*q_prim_vf(E_idx)%sf(j, k, l) + q_prim_vf(E_idx)%sf(j, k, l) = 0.5_wp*q_prim_vf(E_idx)%sf(j, k, l) end if if (qbmm) then do i = 1, nb - q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)*((p0 - fluid_pp(1)%pv)/(q_prim_vf(E_idx)%sf(j, k, l)*p0 - fluid_pp(1)%pv))**(1/3d0) + q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)*((p0 - fluid_pp(1)%pv)/(q_prim_vf(E_idx)%sf(j, k, l)*p0 - fluid_pp(1)%pv))**(1/3._wp) end do end if - R3bar = 0d0 + R3bar = 0._wp if (qbmm) then do i = 1, nb - R3bar = R3bar + weight(i)*0.5d0*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3d0 - R3bar = R3bar + weight(i)*0.5d0*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3d0 + R3bar = R3bar + weight(i)*0.5_wp*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3._wp + R3bar = R3bar + weight(i)*0.5_wp*(q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l))**3._wp end do else do i = 1, nb if (polytropic) then - R3bar = R3bar + weight(i)*(q_prim_vf(bubxb + (i - 1)*2)%sf(j, k, l))**3d0 + R3bar = R3bar + weight(i)*(q_prim_vf(bubxb + (i - 1)*2)%sf(j, k, l))**3._wp else - R3bar = R3bar + weight(i)*(q_prim_vf(bubxb + (i - 1)*4)%sf(j, k, l))**3d0 + R3bar = R3bar + weight(i)*(q_prim_vf(bubxb + (i - 1)*4)%sf(j, k, l))**3._wp end if end do end if - n0 = 3d0*q_prim_vf(alf_idx)%sf(j, k, l)/(4d0*pi*R3bar) + n0 = 3._wp*q_prim_vf(alf_idx)%sf(j, k, l)/(4._wp*pi*R3bar) - ratio = ((1d0 + B_tait)/(q_prim_vf(E_idx)%sf(j, k, l) + B_tait))**(1d0/n_tait) + ratio = ((1._wp + B_tait)/(q_prim_vf(E_idx)%sf(j, k, l) + B_tait))**(1._wp/n_tait) - nH = n0/((1d0 - q_prim_vf(alf_idx)%sf(j, k, l))*ratio + (4d0*pi/3d0)*n0*R3bar) - vfH = (4d0*pi/3d0)*nH*R3bar - rhoH = (1d0 - vfH)/ratio - deno = 1d0 - (1d0 - q_prim_vf(alf_idx)%sf(j, k, l))/rhoH + nH = n0/((1._wp - q_prim_vf(alf_idx)%sf(j, k, l))*ratio + (4._wp*pi/3._wp)*n0*R3bar) + vfH = (4._wp*pi/3._wp)*nH*R3bar + rhoH = (1._wp - vfH)/ratio + deno = 1._wp - (1._wp - q_prim_vf(alf_idx)%sf(j, k, l))/rhoH - if (deno == 0d0) then - velH = 0d0 + if (deno == 0._wp) then + velH = 0._wp else - velH = (q_prim_vf(E_idx)%sf(j, k, l) - 1d0)/(1d0 - q_prim_vf(alf_idx)%sf(j, k, l))/deno - velH = dsqrt(velH) + velH = (q_prim_vf(E_idx)%sf(j, k, l) - 1._wp)/(1._wp - q_prim_vf(alf_idx)%sf(j, k, l))/deno + velH = sqrt(velH) velH = velH*deno end if @@ -296,34 +296,34 @@ contains integer, intent(in) :: patch_id integer, intent(in) :: j, k, l - real(kind(0d0)), intent(in) :: eta + real(wp), intent(in) :: eta integer, dimension(0:m, 0:n, 0:p), intent(inout) :: patch_id_fp type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf ! Density, the specific heat ratio function and the liquid stiffness ! function, respectively, obtained from the combination of primitive ! variables of the current and smoothing patches - real(kind(0d0)) :: rho !< density - real(kind(0d0)) :: gamma - real(kind(0d0)) :: lit_gamma !< specific heat ratio - real(kind(0d0)) :: pi_inf !< stiffness from SEOS - real(kind(0d0)) :: qv !< reference energy from SEOS - real(kind(0d0)) :: orig_rho - real(kind(0d0)) :: orig_gamma - real(kind(0d0)) :: orig_pi_inf - real(kind(0d0)) :: orig_qv - real(kind(0d0)) :: muR, muV - real(kind(0d0)) :: R3bar - - real(kind(0d0)), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity - real(kind(0d0)) :: pres !< pressure - real(kind(0d0)) :: x_centroid, y_centroid - real(kind(0d0)) :: epsilon, beta - - real(kind(0d0)) :: Ys(1:num_species) - real(kind(0d0)) :: mean_molecular_weight - - real(kind(0d0)), dimension(sys_size) :: orig_prim_vf !< + real(wp) :: rho !< density + real(wp) :: gamma + real(wp) :: lit_gamma !< specific heat ratio + real(wp) :: pi_inf !< stiffness from SEOS + real(wp) :: qv !< reference energy from SEOS + real(wp) :: orig_rho + real(wp) :: orig_gamma + real(wp) :: orig_pi_inf + real(wp) :: orig_qv + real(wp) :: muR, muV + real(wp) :: R3bar + + real(wp), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity + real(wp) :: pres !< pressure + real(wp) :: x_centroid, y_centroid + real(wp) :: epsilon, beta + + real(wp) :: Ys(1:num_species) + real(wp) :: mean_molecular_weight + + real(wp), dimension(sys_size) :: orig_prim_vf !< !! Vector to hold original values of cell for smoothing purposes integer :: i !< Generic loop iterator @@ -339,13 +339,13 @@ contains if (mpp_lim .and. bubbles) then !adjust volume fractions, according to modeled gas void fraction - alf_sum%sf = 0d0 + alf_sum%sf = 0._wp do i = adv_idx%beg, adv_idx%end - 1 alf_sum%sf = alf_sum%sf + q_prim_vf(i)%sf end do do i = adv_idx%beg, adv_idx%end - 1 - q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1.d0 - q_prim_vf(alf_idx)%sf) & + q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1._wp - q_prim_vf(alf_idx)%sf) & /alf_sum%sf end do end if @@ -367,13 +367,13 @@ contains if (mpp_lim .and. bubbles) then !adjust volume fractions, according to modeled gas void fraction - alf_sum%sf = 0d0 + alf_sum%sf = 0._wp do i = adv_idx%beg, adv_idx%end - 1 alf_sum%sf = alf_sum%sf + q_prim_vf(i)%sf end do do i = adv_idx%beg, adv_idx%end - 1 - q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1.d0 - q_prim_vf(alf_idx)%sf) & + q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1._wp - q_prim_vf(alf_idx)%sf) & /alf_sum%sf end do end if @@ -412,13 +412,13 @@ contains if (mpp_lim .and. bubbles) then !adjust volume fractions, according to modeled gas void fraction - alf_sum%sf = 0d0 + alf_sum%sf = 0._wp do i = adv_idx%beg, adv_idx%end - 1 alf_sum%sf = alf_sum%sf + q_prim_vf(i)%sf end do do i = adv_idx%beg, adv_idx%end - 1 - q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1.d0 - q_prim_vf(alf_idx)%sf) & + q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1._wp - q_prim_vf(alf_idx)%sf) & /alf_sum%sf end do end if @@ -431,18 +431,18 @@ contains if (qbmm) then ! Initialize the moment set if (dist_type == 1) then - q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1d0 + q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1._wp q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = muR q_prim_vf(bub_idx%fullmom(i, 0, 1))%sf(j, k, l) = muV q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = muR**2 + sigR**2 q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = muR*muV + rhoRV*sigR*sigV q_prim_vf(bub_idx%fullmom(i, 0, 2))%sf(j, k, l) = muV**2 + sigV**2 else if (dist_type == 2) then - q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1d0 - q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = dexp((sigR**2)/2d0)*muR + q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1._wp + q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = exp((sigR**2)/2._wp)*muR q_prim_vf(bub_idx%fullmom(i, 0, 1))%sf(j, k, l) = muV - q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = dexp((sigR**2)*2d0)*(muR**2) - q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = dexp((sigR**2)/2d0)*muR*muV + q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = exp((sigR**2)*2._wp)*(muR**2) + q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = exp((sigR**2)/2._wp)*muR*muV q_prim_vf(bub_idx%fullmom(i, 0, 2))%sf(j, k, l) = muV**2 + sigV**2 end if else @@ -457,9 +457,9 @@ contains if (adv_n) then ! Initialize number density - R3bar = 0d0 + R3bar = 0._wp do i = 1, nb - R3bar = R3bar + weight(i)*(q_prim_vf(bub_idx%rs(i))%sf(j, k, l))**3d0 + R3bar = R3bar + weight(i)*(q_prim_vf(bub_idx%rs(i))%sf(j, k, l))**3._wp end do q_prim_vf(n_idx)%sf(j, k, l) = 3*q_prim_vf(alf_idx)%sf(j, k, l)/(4*pi*R3bar) end if @@ -479,13 +479,13 @@ contains ! Pressure q_prim_vf(E_idx)%sf(j, k, l) = & (eta*patch_icpp(patch_id)%pres & - + (1d0 - eta)*orig_prim_vf(E_idx)) + + (1._wp - eta)*orig_prim_vf(E_idx)) ! Volume fractions \alpha do i = adv_idx%beg, adv_idx%end q_prim_vf(i)%sf(j, k, l) = & eta*patch_icpp(patch_id)%alpha(i - E_idx) & - + (1d0 - eta)*orig_prim_vf(i) + + (1._wp - eta)*orig_prim_vf(i) end do ! Elastic Shear Stress @@ -493,19 +493,19 @@ contains do i = 1, (stress_idx%end - stress_idx%beg) + 1 q_prim_vf(i + stress_idx%beg - 1)%sf(j, k, l) = & (eta*patch_icpp(patch_id)%tau_e(i) & - + (1d0 - eta)*orig_prim_vf(i + stress_idx%beg - 1)) + + (1._wp - eta)*orig_prim_vf(i + stress_idx%beg - 1)) end do end if if (mpp_lim .and. bubbles) then !adjust volume fractions, according to modeled gas void fraction - alf_sum%sf = 0d0 + alf_sum%sf = 0._wp do i = adv_idx%beg, adv_idx%end - 1 alf_sum%sf = alf_sum%sf + q_prim_vf(i)%sf end do do i = adv_idx%beg, adv_idx%end - 1 - q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1.d0 - q_prim_vf(alf_idx)%sf) & + q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1._wp - q_prim_vf(alf_idx)%sf) & /alf_sum%sf end do end if @@ -516,13 +516,13 @@ contains do i = 1, cont_idx%end q_prim_vf(i)%sf(j, k, l) = & eta*patch_icpp(patch_id)%alpha_rho(i) & - + (1d0 - eta)*orig_prim_vf(i) + + (1._wp - eta)*orig_prim_vf(i) end do else !get mixture density from pressure via Tait EOS pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1.d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! \rho = (( p_l + pi_inf)/( p_ref + pi_inf))**(1/little_gam) * rhoref(1-alf) q_prim_vf(1)%sf(j, k, l) = & @@ -539,26 +539,26 @@ contains do i = 1, E_idx - mom_idx%beg q_prim_vf(i + cont_idx%end)%sf(j, k, l) = & (eta*patch_icpp(patch_id)%vel(i) & - + (1d0 - eta)*orig_prim_vf(i + cont_idx%end)) + + (1._wp - eta)*orig_prim_vf(i + cont_idx%end)) end do ! Species Concentrations if (chemistry) then block - real(kind(0d0)) :: sum, term + real(wp) :: sum, term ! Accumulating the species concentrations - sum = 0d0 + sum = 0._wp do i = 1, num_species term = & eta*patch_icpp(patch_id)%Y(i) & - + (1d0 - eta)*patch_icpp(smooth_patch_id)%Y(i) + + (1._wp - eta)*patch_icpp(smooth_patch_id)%Y(i) q_prim_vf(chemxb + i - 1)%sf(j, k, l) = term sum = sum + term end do if (sum < verysmall) then - sum = 1d0 + sum = 1._wp end if ! Normalizing the species concentrations @@ -578,7 +578,7 @@ contains if (mixlayer_vel_profile) then q_prim_vf(1 + cont_idx%end)%sf(j, k, l) = & (eta*patch_icpp(patch_id)%vel(1)*tanh(y_cc(k)*mixlayer_vel_coef) & - + (1d0 - eta)*orig_prim_vf(1 + cont_idx%end)) + + (1._wp - eta)*orig_prim_vf(1 + cont_idx%end)) end if ! Set partial pressures to mixture pressure for the 6-eqn model @@ -596,27 +596,27 @@ contains if (qbmm) then ! Initialize the moment set if (dist_type == 1) then - q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1d0 + q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1._wp q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = muR q_prim_vf(bub_idx%fullmom(i, 0, 1))%sf(j, k, l) = muV q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = muR**2 + sigR**2 q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = muR*muV + rhoRV*sigR*sigV q_prim_vf(bub_idx%fullmom(i, 0, 2))%sf(j, k, l) = muV**2 + sigV**2 else if (dist_type == 2) then - q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1d0 - q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = dexp((sigR**2)/2d0)*muR + q_prim_vf(bub_idx%fullmom(i, 0, 0))%sf(j, k, l) = 1._wp + q_prim_vf(bub_idx%fullmom(i, 1, 0))%sf(j, k, l) = exp((sigR**2)/2._wp)*muR q_prim_vf(bub_idx%fullmom(i, 0, 1))%sf(j, k, l) = muV - q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = dexp((sigR**2)*2d0)*(muR**2) - q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = dexp((sigR**2)/2d0)*muR*muV + q_prim_vf(bub_idx%fullmom(i, 2, 0))%sf(j, k, l) = exp((sigR**2)*2._wp)*(muR**2) + q_prim_vf(bub_idx%fullmom(i, 1, 1))%sf(j, k, l) = exp((sigR**2)/2._wp)*muR*muV q_prim_vf(bub_idx%fullmom(i, 0, 2))%sf(j, k, l) = muV**2 + sigV**2 end if else ! q_prim_vf(bub_idx%rs(i))%sf(j,k,l) = & ! (eta * R0(i)*patch_icpp(patch_id)%r0 & - ! + (1d0-eta)*orig_prim_vf(bub_idx%rs(i))) + ! + (1._wp-eta)*orig_prim_vf(bub_idx%rs(i))) ! q_prim_vf(bub_idx%vs(i))%sf(j,k,l) = & ! (eta * V0(i)*patch_icpp(patch_id)%v0 & - ! + (1d0-eta)*orig_prim_vf(bub_idx%vs(i))) + ! + (1._wp-eta)*orig_prim_vf(bub_idx%vs(i))) q_prim_vf(bub_idx%rs(i))%sf(j, k, l) = muR q_prim_vf(bub_idx%vs(i))%sf(j, k, l) = muV @@ -630,9 +630,9 @@ contains if (adv_n) then ! Initialize number density - R3bar = 0d0 + R3bar = 0._wp do i = 1, nb - R3bar = R3bar + weight(i)*(q_prim_vf(bub_idx%rs(i))%sf(j, k, l))**3d0 + R3bar = R3bar + weight(i)*(q_prim_vf(bub_idx%rs(i))%sf(j, k, l))**3._wp end do q_prim_vf(n_idx)%sf(j, k, l) = 3*q_prim_vf(alf_idx)%sf(j, k, l)/(4*pi*R3bar) end if @@ -640,13 +640,13 @@ contains if (mpp_lim .and. bubbles) then !adjust volume fractions, according to modeled gas void fraction - alf_sum%sf = 0d0 + alf_sum%sf = 0._wp do i = adv_idx%beg, adv_idx%end - 1 alf_sum%sf = alf_sum%sf + q_prim_vf(i)%sf end do do i = adv_idx%beg, adv_idx%end - 1 - q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1.d0 - q_prim_vf(alf_idx)%sf) & + q_prim_vf(i)%sf = q_prim_vf(i)%sf*(1._wp - q_prim_vf(alf_idx)%sf) & /alf_sum%sf end do end if @@ -665,11 +665,11 @@ contains if (surface_tension) then q_prim_vf(c_idx)%sf(j, k, l) = eta*patch_icpp(patch_id)%cf_val + & - (1d0 - eta)*patch_icpp(smooth_patch_id)%cf_val + (1._wp - eta)*patch_icpp(smooth_patch_id)%cf_val end if ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(j, k, l) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(j, k, l) = patch_id end subroutine s_assign_patch_species_primitive_variables diff --git a/src/pre_process/m_check_ib_patches.fpp b/src/pre_process/m_check_ib_patches.fpp index c19d321c7..d5ab5c5a7 100644 --- a/src/pre_process/m_check_ib_patches.fpp +++ b/src/pre_process/m_check_ib_patches.fpp @@ -94,7 +94,7 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(n == 0 .or. p > 0 & - .or. patch_ib(patch_id)%radius <= 0d0 & + .or. patch_ib(patch_id)%radius <= 0._wp & .or. f_is_default(patch_ib(patch_id)%x_centroid) & .or. f_is_default(patch_ib(patch_id)%y_centroid), & 'in circle IB patch '//trim(iStr)) @@ -112,10 +112,10 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(n == 0 .or. p > 0 & - .or. patch_ib(patch_id)%c <= 0d0 & - .or. patch_ib(patch_id)%p <= 0d0 & - .or. patch_ib(patch_id)%t <= 0d0 & - .or. patch_ib(patch_id)%m <= 0d0 & + .or. patch_ib(patch_id)%c <= 0._wp & + .or. patch_ib(patch_id)%p <= 0._wp & + .or. patch_ib(patch_id)%t <= 0._wp & + .or. patch_ib(patch_id)%m <= 0._wp & .or. f_is_default(patch_ib(patch_id)%x_centroid) & .or. f_is_default(patch_ib(patch_id)%y_centroid), & 'in airfoil IB patch '//trim(iStr)) @@ -133,10 +133,10 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(n == 0 .or. p == 0 & - .or. patch_ib(patch_id)%c <= 0d0 & - .or. patch_ib(patch_id)%p <= 0d0 & - .or. patch_ib(patch_id)%t <= 0d0 & - .or. patch_ib(patch_id)%m <= 0d0 & + .or. patch_ib(patch_id)%c <= 0._wp & + .or. patch_ib(patch_id)%p <= 0._wp & + .or. patch_ib(patch_id)%t <= 0._wp & + .or. patch_ib(patch_id)%m <= 0._wp & .or. f_is_default(patch_ib(patch_id)%x_centroid) & .or. f_is_default(patch_ib(patch_id)%y_centroid) & .or. f_is_default(patch_ib(patch_id)%z_centroid) & @@ -161,9 +161,9 @@ contains .or. & f_is_default(patch_ib(patch_id)%y_centroid) & .or. & - patch_ib(patch_id)%length_x <= 0d0 & + patch_ib(patch_id)%length_x <= 0._wp & .or. & - patch_ib(patch_id)%length_y <= 0d0, & + patch_ib(patch_id)%length_y <= 0._wp, & 'in rectangle IB patch '//trim(iStr)) end subroutine s_check_rectangle_ib_patch_geometry @@ -186,7 +186,7 @@ contains .or. & f_is_default(patch_ib(patch_id)%z_centroid) & .or. & - patch_ib(patch_id)%radius <= 0d0, & + patch_ib(patch_id)%radius <= 0._wp, & 'in sphere IB patch '//trim(iStr)) end subroutine s_check_sphere_ib_patch_geometry @@ -209,11 +209,11 @@ contains .or. & f_is_default(patch_ib(patch_id)%z_centroid) & .or. & - patch_ib(patch_id)%length_x <= 0d0 & + patch_ib(patch_id)%length_x <= 0._wp & .or. & - patch_ib(patch_id)%length_y <= 0d0 & + patch_ib(patch_id)%length_y <= 0._wp & .or. & - patch_ib(patch_id)%length_z <= 0d0, & + patch_ib(patch_id)%length_z <= 0._wp, & 'in cuboid IB patch '//trim(iStr)) end subroutine s_check_cuboid_ib_patch_geometry @@ -236,23 +236,23 @@ contains .or. & f_is_default(patch_ib(patch_id)%z_centroid) & .or. & - (patch_ib(patch_id)%length_x <= 0d0 .and. & - patch_ib(patch_id)%length_y <= 0d0 .and. & - patch_ib(patch_id)%length_z <= 0d0) & + (patch_ib(patch_id)%length_x <= 0._wp .and. & + patch_ib(patch_id)%length_y <= 0._wp .and. & + patch_ib(patch_id)%length_z <= 0._wp) & .or. & - patch_ib(patch_id)%radius <= 0d0, & + patch_ib(patch_id)%radius <= 0._wp, & 'in cylinder IB patch '//trim(iStr)) @:PROHIBIT( & - (patch_ib(patch_id)%length_x > 0d0 .and. & + (patch_ib(patch_id)%length_x > 0._wp .and. & ((.not. f_is_default(patch_ib(patch_id)%length_y)) .or. & (.not. f_is_default(patch_ib(patch_id)%length_z)))) & .or. & - (patch_ib(patch_id)%length_y > 0d0 .and. & + (patch_ib(patch_id)%length_y > 0._wp .and. & ((.not. f_is_default(patch_ib(patch_id)%length_x)) .or. & (.not. f_is_default(patch_ib(patch_id)%length_z)))) & .or. & - (patch_ib(patch_id)%length_z > 0d0 .and. & + (patch_ib(patch_id)%length_z > 0._wp .and. & ((.not. f_is_default(patch_ib(patch_id)%length_x)) .or. & (.not. f_is_default(patch_ib(patch_id)%length_y)))), & 'in cylinder IB patch '//trim(iStr)) @@ -272,11 +272,11 @@ contains @:PROHIBIT(patch_ib(patch_id)%model_filepath == dflt_char, & 'Empty model file path for patch '//trim(iStr)) - @:PROHIBIT(patch_ib(patch_id)%model_scale(1) <= 0d0 & + @:PROHIBIT(patch_ib(patch_id)%model_scale(1) <= 0._wp & .or. & - patch_ib(patch_id)%model_scale(2) <= 0d0 & + patch_ib(patch_id)%model_scale(2) <= 0._wp & .or. & - patch_ib(patch_id)%model_scale(3) <= 0d0, & + patch_ib(patch_id)%model_scale(3) <= 0._wp, & 'Negative scale in model IB patch '//trim(iStr)) end subroutine s_check_model_ib_patch_geometry diff --git a/src/pre_process/m_check_patches.fpp b/src/pre_process/m_check_patches.fpp index 136d4d168..2f379a1b8 100644 --- a/src/pre_process/m_check_patches.fpp +++ b/src/pre_process/m_check_patches.fpp @@ -155,7 +155,7 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(n > 0, "Line segment patch "//trim(iStr)//": n must be zero") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "Line segment patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "Line segment patch "//trim(iStr)//": length_x must be greater than zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Line segment patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(cyl_coord, "Line segment patch "//trim(iStr)//": cyl_coord is not supported") @@ -170,7 +170,7 @@ contains @:PROHIBIT(n == 0, "Circle patch "//trim(iStr)//": n must be zero") @:PROHIBIT(p > 0, "Circle patch "//trim(iStr)//": p must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radius <= 0d0, "Circle patch "//trim(iStr)//": radius must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radius <= 0._wp, "Circle patch "//trim(iStr)//": radius must be greater than zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Circle patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Circle patch "//trim(iStr)//": y_centroid must be set") @@ -187,8 +187,8 @@ contains @:PROHIBIT(p > 0, "Rectangle patch "//trim(iStr)//": p must be zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Rectangle patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Rectangle patch "//trim(iStr)//": y_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "Rectangle patch "//trim(iStr)//": length_x must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0d0, "Rectangle patch "//trim(iStr)//": length_y must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "Rectangle patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0._wp, "Rectangle patch "//trim(iStr)//": length_y must be greater than zero") end subroutine s_check_rectangle_patch_geometry @@ -220,8 +220,8 @@ contains @:PROHIBIT(p > 0, "Ellipse patch "//trim(iStr)//": p must be zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Ellipse patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Ellipse patch "//trim(iStr)//": y_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%radii(1) <= 0d0, "Ellipse patch "//trim(iStr)//": radii(1) must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radii(2) <= 0d0, "Ellipse patch "//trim(iStr)//": radii(2) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radii(1) <= 0._wp, "Ellipse patch "//trim(iStr)//": radii(1) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radii(2) <= 0._wp, "Ellipse patch "//trim(iStr)//": radii(2) must be greater than zero") @:PROHIBIT(.not. f_is_default(patch_icpp(patch_id)%radii(3)), "Ellipse patch "//trim(iStr)//": radii(3) must not be set") end subroutine s_check_ellipse_patch_geometry @@ -237,9 +237,9 @@ contains @:PROHIBIT(p > 0, "Taylor Green vortex patch "//trim(iStr)//": p must be zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Taylor Green vortex patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Taylor Green vortex patch "//trim(iStr)//": y_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "Taylor Green vortex patch "//trim(iStr)//": length_x must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0d0, "Taylor Green vortex patch "//trim(iStr)//": length_y must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%vel(2) <= 0d0, "Taylor Green vortex patch "//trim(iStr)//": vel(2) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "Taylor Green vortex patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0._wp, "Taylor Green vortex patch "//trim(iStr)//": length_y must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%vel(2) <= 0._wp, "Taylor Green vortex patch "//trim(iStr)//": vel(2) must be greater than zero") end subroutine s_check_2D_TaylorGreen_vortex_patch_geometry @@ -254,7 +254,7 @@ contains @:PROHIBIT(p > 0, "1D analytical patch "//trim(iStr)//": p must be zero") @:PROHIBIT(model_eqns /= 4 .and. model_eqns /= 2, "1D analytical patch "//trim(iStr)//": model_eqns must be either 4 or 2") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "1D analytical patch "//trim(iStr)//": x_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "1D analytical patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "1D analytical patch "//trim(iStr)//": length_x must be greater than zero") end subroutine s_check_1D_analytical_patch_geometry @@ -269,8 +269,8 @@ contains @:PROHIBIT(p > 0, "2D analytical patch "//trim(iStr)//": p must be zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "2D analytical patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "2D analytical patch "//trim(iStr)//": y_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "2D analytical patch "//trim(iStr)//": length_x must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0d0, "2D analytical patch "//trim(iStr)//": length_y must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "2D analytical patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0._wp, "2D analytical patch "//trim(iStr)//": length_y must be greater than zero") end subroutine s_check_2D_analytical_patch_geometry @@ -285,9 +285,9 @@ contains @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "3D analytical patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "3D analytical patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "3D analytical patch "//trim(iStr)//": z_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "3D analytical patch "//trim(iStr)//": length_x must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0d0, "3D analytical patch "//trim(iStr)//": length_y must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_z <= 0d0, "3D analytical patch "//trim(iStr)//": length_z must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "3D analytical patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0._wp, "3D analytical patch "//trim(iStr)//": length_y must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_z <= 0._wp, "3D analytical patch "//trim(iStr)//": length_z must be greater than zero") end subroutine s_check_3D_analytical_patch_geometry @@ -299,7 +299,7 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(p == 0, "Sphere patch "//trim(iStr)//": p must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radius <= 0d0, "Sphere patch "//trim(iStr)//": radius must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radius <= 0._wp, "Sphere patch "//trim(iStr)//": radius must be greater than zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Sphere patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Sphere patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "Sphere patch "//trim(iStr)//": z_centroid must be set") @@ -314,13 +314,13 @@ contains call s_int_to_str(patch_id, iStr) @:PROHIBIT(p == 0, "Spherical harmonic patch "//trim(iStr)//": p must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radius <= 0d0, "Spherical harmonic patch "//trim(iStr)//": radius must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radius <= 0._wp, "Spherical harmonic patch "//trim(iStr)//": radius must be greater than zero") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Spherical harmonic patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Spherical harmonic patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "Spherical harmonic patch "//trim(iStr)//": z_centroid must be set") - @:PROHIBIT(all(patch_icpp(patch_id)%epsilon /= (/1d0, 2d0, 3d0, 4d0, 5d0/)), & + @:PROHIBIT(all(patch_icpp(patch_id)%epsilon /= (/1._wp, 2._wp, 3._wp, 4._wp, 5._wp/)), & "Spherical harmonic patch "//trim(iStr)//": epsilon must be one of 1, 2, 3, 4, 5") - @:PROHIBIT(patch_icpp(patch_id)%beta < 0d0, & + @:PROHIBIT(patch_icpp(patch_id)%beta < 0._wp, & "Spherical harmonic patch "//trim(iStr)//": beta must be greater than or equal to zero") @:PROHIBIT(patch_icpp(patch_id)%beta > patch_icpp(patch_id)%epsilon, & "Spherical harmonic patch "//trim(iStr)//": beta must be less than or equal to epsilon") @@ -339,9 +339,9 @@ contains @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Cuboid patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Cuboid patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "Cuboid patch "//trim(iStr)//": z_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0d0, "Cuboid patch "//trim(iStr)//": length_x must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0d0, "Cuboid patch "//trim(iStr)//": length_y must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%length_z <= 0d0, "Cuboid patch "//trim(iStr)//": length_z must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "Cuboid patch "//trim(iStr)//": length_x must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_y <= 0._wp, "Cuboid patch "//trim(iStr)//": length_y must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%length_z <= 0._wp, "Cuboid patch "//trim(iStr)//": length_z must be greater than zero") end subroutine s_check_cuboid_patch_geometry @@ -357,20 +357,20 @@ contains @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Cylinder patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Cylinder patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "Cylinder patch "//trim(iStr)//": z_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%radius <= 0d0, "Cylinder patch "//trim(iStr)//": radius must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radius <= 0._wp, "Cylinder patch "//trim(iStr)//": radius must be greater than zero") ! Check if exactly one length is defined @:PROHIBIT(count([ & - patch_icpp(patch_id)%length_x > 0d0, & - patch_icpp(patch_id)%length_y > 0d0, & - patch_icpp(patch_id)%length_z > 0d0 & + patch_icpp(patch_id)%length_x > 0._wp, & + patch_icpp(patch_id)%length_y > 0._wp, & + patch_icpp(patch_id)%length_z > 0._wp & ]) /= 1, "Cylinder patch "//trim(iStr)//": Exactly one of length_x, length_y, or length_z must be defined and positive") ! Ensure the defined length is positive @:PROHIBIT( & - (.not. f_is_default(patch_icpp(patch_id)%length_x) .and. patch_icpp(patch_id)%length_x <= 0d0) .or. & - (.not. f_is_default(patch_icpp(patch_id)%length_y) .and. patch_icpp(patch_id)%length_y <= 0d0) .or. & - (.not. f_is_default(patch_icpp(patch_id)%length_z) .and. patch_icpp(patch_id)%length_z <= 0d0), & + (.not. f_is_default(patch_icpp(patch_id)%length_x) .and. patch_icpp(patch_id)%length_x <= 0._wp) .or. & + (.not. f_is_default(patch_icpp(patch_id)%length_y) .and. patch_icpp(patch_id)%length_y <= 0._wp) .or. & + (.not. f_is_default(patch_icpp(patch_id)%length_z) .and. patch_icpp(patch_id)%length_z <= 0._wp), & "Cylinder patch "//trim(iStr)//": The defined length_{} must be greater than zero") end subroutine s_check_cylinder_patch_geometry @@ -404,9 +404,9 @@ contains @:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Ellipsoid patch "//trim(iStr)//": x_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%y_centroid), "Ellipsoid patch "//trim(iStr)//": y_centroid must be set") @:PROHIBIT(f_is_default(patch_icpp(patch_id)%z_centroid), "Ellipsoid patch "//trim(iStr)//": z_centroid must be set") - @:PROHIBIT(patch_icpp(patch_id)%radii(1) <= 0d0, "Ellipsoid patch "//trim(iStr)//": radii(1) must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radii(2) <= 0d0, "Ellipsoid patch "//trim(iStr)//": radii(2) must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%radii(3) <= 0d0, "Ellipsoid patch "//trim(iStr)//": radii(3) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radii(1) <= 0._wp, "Ellipsoid patch "//trim(iStr)//": radii(1) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radii(2) <= 0._wp, "Ellipsoid patch "//trim(iStr)//": radii(2) must be greater than zero") + @:PROHIBIT(patch_icpp(patch_id)%radii(3) <= 0._wp, "Ellipsoid patch "//trim(iStr)//": radii(3) must be greater than zero") end subroutine s_check_ellipsoid_patch_geometry @@ -474,7 +474,7 @@ contains "Smoothen enabled. Patch "//trim(iStr)//": smooth_patch_id must be less than patch_id") @:PROHIBIT(patch_icpp(patch_id)%smooth_patch_id == 0, & "Smoothen enabled. Patch "//trim(iStr)//": smooth_patch_id must be greater than zero") - @:PROHIBIT(patch_icpp(patch_id)%smooth_coeff <= 0d0, & + @:PROHIBIT(patch_icpp(patch_id)%smooth_coeff <= 0._wp, & "Smoothen enabled. Patch "//trim(iStr)//": smooth_coeff must be greater than zero") else @:PROHIBIT(patch_icpp(patch_id)%smooth_patch_id /= patch_id, & @@ -520,15 +520,15 @@ contains "Patch "//trim(iStr)//": vel(3) must not be set when p = 0") @:PROHIBIT(p > 0 .and. f_is_default(patch_icpp(patch_id)%vel(3)), & "Patch "//trim(iStr)//": vel(3) must be set when p > 0") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%rho <= 0d0, & + @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%rho <= 0._wp, & "Patch "//trim(iStr)//": rho must be greater than zero when model_eqns = 1") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%gamma <= 0d0, & + @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%gamma <= 0._wp, & "Patch "//trim(iStr)//": gamma must be greater than zero when model_eqns = 1") - @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%pi_inf < 0d0, & + @:PROHIBIT(model_eqns == 1 .and. patch_icpp(patch_id)%pi_inf < 0._wp, & "Patch "//trim(iStr)//": pi_inf must be greater than or equal to zero when model_eqns = 1") @:PROHIBIT(patch_icpp(patch_id)%geometry == 5 .and. patch_icpp(patch_id)%pi_inf > 0, & "Patch "//trim(iStr)//": pi_inf must be less than or equal to zero when geometry = 5") - @:PROHIBIT(model_eqns == 2 .and. any(patch_icpp(patch_id)%alpha_rho(1:num_fluids) < 0d0), & + @:PROHIBIT(model_eqns == 2 .and. any(patch_icpp(patch_id)%alpha_rho(1:num_fluids) < 0._wp), & "Patch "//trim(iStr)//": alpha_rho(1:num_fluids) must be greater than or equal to zero when model_eqns = 2") if (model_eqns == 2 .and. num_fluids < num_fluids_max) then @@ -541,7 +541,7 @@ contains end if if (chemistry) then - !@:ASSERT(all(patch_icpp(patch_id)%Y(1:num_species) >= 0d0), "Patch " // trim(iStr) // ".") + !@:ASSERT(all(patch_icpp(patch_id)%Y(1:num_species) >= 0._wp), "Patch " // trim(iStr) // ".") !@:ASSERT(any(patch_icpp(patch_id)%Y(1:num_species) > verysmall), "Patch " // trim(iStr) // ".") end if diff --git a/src/pre_process/m_checker.fpp b/src/pre_process/m_checker.fpp index efd1ef190..ec5600c76 100644 --- a/src/pre_process/m_checker.fpp +++ b/src/pre_process/m_checker.fpp @@ -87,11 +87,11 @@ contains "n must be positive (2D or 3D) for cylindrical coordinates") @:PROHIBIT(cyl_coord .and. (f_is_default(y_domain%beg) .or. f_is_default(y_domain%end)), & "y_domain%beg and y_domain%end must be set for n = 0 (2D cylindrical coordinates)") - @:PROHIBIT(cyl_coord .and. (y_domain%beg /= 0d0 .or. y_domain%end <= 0d0), & + @:PROHIBIT(cyl_coord .and. (y_domain%beg /= 0._wp .or. y_domain%end <= 0._wp), & "y_domain%beg must be 0 and y_domain%end must be positive for cylindrical coordinates") @:PROHIBIT(cyl_coord .and. p == 0 .and. ((.not. f_is_default(z_domain%beg)) .or. (.not. f_is_default(z_domain%end))), & "z_domain%beg and z_domain%end are not supported for p = 0 (2D cylindrical coordinates)") - @:PROHIBIT(cyl_coord .and. p > 0 .and. (z_domain%beg /= 0d0 .or. z_domain%end /= 2d0*pi), & + @:PROHIBIT(cyl_coord .and. p > 0 .and. (z_domain%beg /= 0._wp .or. z_domain%end /= 2._wp*pi), & "z_domain%beg must be 0 and z_domain%end must be 2*pi for 3D cylindrical coordinates") @:PROHIBIT(num_patches < 0) @@ -124,11 +124,11 @@ contains !&< Deactivate prettify @:PROHIBIT(stretch_${X}$ .and. (a_${X}$ + log(cosh(a_${X}$*(${X}$_domain%beg - ${X}$_a))) & + log(cosh(a_${X}$*(${X}$_domain%beg - ${X}$_b))) & - - 2d0*log(cosh(0.5d0*a_${X}$*(${X}$_b - ${X}$_a)))) / a_${X}$ <= 0d0, & + - 2._wp*log(cosh(0.5_wp*a_${X}$*(${X}$_b - ${X}$_a)))) / a_${X}$ <= 0._wp, & "${X}$_domain%beg is too close to ${X}$_a and ${X}$_b for the given a_${X}$") @:PROHIBIT(stretch_${X}$ .and. (a_${X}$ + log(cosh(a_${X}$*(${X}$_domain%end - ${X}$_a))) & + log(cosh(a_${X}$*(${X}$_domain%end - ${X}$_b))) & - - 2d0*log(cosh(0.5d0*a_${X}$*(${X}$_b - ${X}$_a)))) / a_${X}$ <= 0d0, & + - 2._wp*log(cosh(0.5_wp*a_${X}$*(${X}$_b - ${X}$_a)))) / a_${X}$ <= 0._wp, & "${X}$_domain%end is too close to ${X}$_a and ${X}$_b for the given a_${X}$") !&> #:endfor @@ -138,7 +138,7 @@ contains !! (qbmm, polydisperse, dist_type, rhoRV, and R0_type) subroutine s_check_inputs_qbmm_and_polydisperse @:PROHIBIT(qbmm .and. dist_type == dflt_int, "dist_type must be set if using QBMM") - @:PROHIBIT(qbmm .and. dist_type /= 1 .and. rhoRV > 0d0, "rhoRV cannot be used with dist_type != 1") + @:PROHIBIT(qbmm .and. dist_type /= 1 .and. rhoRV > 0._wp, "rhoRV cannot be used with dist_type != 1") @:PROHIBIT(polydisperse .and. R0_type == dflt_int, "R0 type must be set if using Polydisperse") end subroutine s_check_inputs_qbmm_and_polydisperse diff --git a/src/pre_process/m_compute_levelset.fpp b/src/pre_process/m_compute_levelset.fpp index db4c5f04e..a79b26c0f 100644 --- a/src/pre_process/m_compute_levelset.fpp +++ b/src/pre_process/m_compute_levelset.fpp @@ -27,9 +27,9 @@ module m_compute_levelset s_cuboid_levelset, & s_sphere_levelset - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid - real(kind(0d0)) :: length_x, length_y, length_z - real(kind(0d0)) :: radius + real(wp) :: x_centroid, y_centroid, z_centroid + real(wp) :: length_x, length_y, length_z + real(wp) :: radius type(bounds_info) :: x_boundary, y_boundary, z_boundary !< !! These variables combine the centroid and length parameters associated with @@ -45,9 +45,9 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: radius, dist - real(kind(0d0)) :: x_centroid, y_centroid - real(kind(0d0)), dimension(3) :: dist_vec + real(wp) :: radius, dist + real(wp) :: x_centroid, y_centroid + real(wp), dimension(3) :: dist_vec integer :: i, j !< Loop index variables @@ -61,7 +61,7 @@ contains dist_vec(1) = x_cc(i) - x_centroid dist_vec(2) = y_cc(j) - y_centroid dist_vec(3) = 0 - dist = dsqrt(sum(dist_vec**2)) + dist = sqrt(sum(dist_vec**2)) levelset%sf(i, j, 0, ib_patch_id) = dist - radius if (dist == 0) then levelset_norm%sf(i, j, 0, ib_patch_id, :) = 0 @@ -81,16 +81,16 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: radius, dist, global_dist + real(wp) :: radius, dist, global_dist integer :: global_id - real(kind(0d0)) :: x_centroid, y_centroid, x_act, y_act, theta - real(kind(0d0)), dimension(3) :: dist_vec + real(wp) :: x_centroid, y_centroid, x_act, y_act, theta + real(wp), dimension(3) :: dist_vec integer :: i, j, k !< Loop index variables x_centroid = patch_ib(ib_patch_id)%x_centroid y_centroid = patch_ib(ib_patch_id)%y_centroid - theta = pi*patch_ib(ib_patch_id)%theta/180d0 + theta = pi*patch_ib(ib_patch_id)%theta/180._wp do i = 0, m do j = 0, n @@ -108,7 +108,7 @@ contains dist_vec(1) = x_cc(i) - airfoil_grid_u(k)%x dist_vec(2) = y_cc(j) - airfoil_grid_u(k)%y dist_vec(3) = 0 - dist = dsqrt(sum(dist_vec**2)) + dist = sqrt(sum(dist_vec**2)) if (k == 1) then global_dist = dist global_id = k @@ -128,7 +128,7 @@ contains dist_vec(1) = x_cc(i) - airfoil_grid_l(k)%x dist_vec(2) = y_cc(j) - airfoil_grid_l(k)%y dist_vec(3) = 0 - dist = dsqrt(sum(dist_vec**2)) + dist = sqrt(sum(dist_vec**2)) if (k == 1) then global_dist = dist global_id = k @@ -164,10 +164,10 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: radius, dist, dist_surf, dist_side, global_dist + real(wp) :: radius, dist, dist_surf, dist_side, global_dist integer :: global_id - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid, lz, z_max, z_min, x_act, y_act, theta - real(kind(0d0)), dimension(3) :: dist_vec + real(wp) :: x_centroid, y_centroid, z_centroid, lz, z_max, z_min, x_act, y_act, theta + real(wp), dimension(3) :: dist_vec integer :: i, j, k, l !< Loop index variables @@ -175,7 +175,7 @@ contains y_centroid = patch_ib(ib_patch_id)%y_centroid z_centroid = patch_ib(ib_patch_id)%z_centroid lz = patch_ib(ib_patch_id)%length_z - theta = pi*patch_ib(ib_patch_id)%theta/180d0 + theta = pi*patch_ib(ib_patch_id)%theta/180._wp z_max = z_centroid + lz/2 z_min = z_centroid - lz/2 @@ -197,7 +197,7 @@ contains dist_vec(1) = x_cc(i) - airfoil_grid_u(k)%x dist_vec(2) = y_cc(j) - airfoil_grid_u(k)%y dist_vec(3) = 0 - dist_surf = dsqrt(sum(dist_vec**2)) + dist_surf = sqrt(sum(dist_vec**2)) if (k == 1) then global_dist = dist_surf global_id = k @@ -217,7 +217,7 @@ contains dist_vec(1) = x_cc(i) - airfoil_grid_l(k)%x dist_vec(2) = y_cc(j) - airfoil_grid_l(k)%y dist_vec(3) = 0 - dist_surf = dsqrt(sum(dist_vec**2)) + dist_surf = sqrt(sum(dist_vec**2)) if (k == 1) then global_dist = dist_surf global_id = k @@ -266,9 +266,9 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer :: ib_patch_id - real(kind(0d0)) :: top_right(2), bottom_left(2) - real(kind(0d0)) :: x, y, min_dist - real(kind(0d0)) :: side_dists(4) + real(wp) :: top_right(2), bottom_left(2) + real(wp) :: x, y, min_dist + real(wp) :: side_dists(4) integer :: i, j, k !< Loop index variables integer :: idx !< Shortest path direction indicator @@ -310,7 +310,7 @@ contains if (idx == 1) then levelset%sf(i, j, 0, ib_patch_id) = side_dists(1) if (side_dists(1) == 0) then - levelset_norm%sf(i, j, 0, ib_patch_id, 1) = 0d0 + levelset_norm%sf(i, j, 0, ib_patch_id, 1) = 0._wp else levelset_norm%sf(i, j, 0, ib_patch_id, 1) = side_dists(1)/ & abs(side_dists(1)) @@ -319,7 +319,7 @@ contains else if (idx == 2) then levelset%sf(i, j, 0, ib_patch_id) = side_dists(2) if (side_dists(2) == 0) then - levelset_norm%sf(i, j, 0, ib_patch_id, 1) = 0d0 + levelset_norm%sf(i, j, 0, ib_patch_id, 1) = 0._wp else levelset_norm%sf(i, j, 0, ib_patch_id, 1) = -side_dists(2)/ & abs(side_dists(2)) @@ -328,7 +328,8 @@ contains else if (idx == 3) then levelset%sf(i, j, 0, ib_patch_id) = side_dists(3) if (side_dists(3) == 0) then - levelset_norm%sf(i, j, 0, ib_patch_id, 2) = 0d0 + + levelset_norm%sf(i, j, 0, ib_patch_id, 2) = 0._wp else levelset_norm%sf(i, j, 0, ib_patch_id, 2) = side_dists(3)/ & abs(side_dists(3)) @@ -337,7 +338,8 @@ contains else if (idx == 4) then levelset%sf(i, j, 0, ib_patch_id) = side_dists(4) if (side_dists(4) == 0) then - levelset_norm%sf(i, j, 0, ib_patch_id, 2) = 0d0 + + levelset_norm%sf(i, j, 0, ib_patch_id, 2) = 0._wp else levelset_norm%sf(i, j, 0, ib_patch_id, 2) = -side_dists(4)/ & abs(side_dists(4)) @@ -358,9 +360,9 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: Right, Left, Bottom, Top, Front, Back - real(kind(0d0)) :: x, y, z, min_dist - real(kind(0d0)) :: side_dists(6) + real(wp) :: Right, Left, Bottom, Top, Front, Back + real(wp) :: x, y, z, min_dist + real(wp) :: side_dists(6) integer :: i, j, k !< Loop index variables @@ -405,7 +407,7 @@ contains if (min_dist == abs(side_dists(1))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(1) if (side_dists(1) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 1) = side_dists(1)/ & abs(side_dists(1)) @@ -414,7 +416,7 @@ contains else if (min_dist == abs(side_dists(2))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(2) if (side_dists(2) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 1) = -side_dists(2)/ & abs(side_dists(2)) @@ -423,7 +425,7 @@ contains else if (min_dist == abs(side_dists(3))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(3) if (side_dists(3) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 2) = side_dists(3)/ & abs(side_dists(3)) @@ -432,7 +434,7 @@ contains else if (min_dist == abs(side_dists(4))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(4) if (side_dists(4) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 2) = -side_dists(4)/ & abs(side_dists(4)) @@ -441,7 +443,7 @@ contains else if (min_dist == abs(side_dists(5))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(5) if (side_dists(5) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 3) = side_dists(5)/ & abs(side_dists(5)) @@ -450,7 +452,7 @@ contains else if (min_dist == abs(side_dists(6))) then levelset%sf(i, j, k, ib_patch_id) = side_dists(6) if (side_dists(6) == 0) then - levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0d0 + levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0._wp else levelset_norm%sf(i, j, k, ib_patch_id, 3) = -side_dists(6)/ & abs(side_dists(6)) @@ -472,9 +474,9 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: radius, dist - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid - real(kind(0d0)), dimension(3) :: dist_vec + real(wp) :: radius, dist + real(wp) :: x_centroid, y_centroid, z_centroid + real(wp), dimension(3) :: dist_vec integer :: i, j, k !< Loop index variables @@ -489,7 +491,7 @@ contains dist_vec(1) = x_cc(i) - x_centroid dist_vec(2) = y_cc(j) - y_centroid dist_vec(3) = z_cc(k) - z_centroid - dist = dsqrt(sum(dist_vec**2)) + dist = sqrt(sum(dist_vec**2)) levelset%sf(i, j, k, ib_patch_id) = dist - radius if (dist == 0) then levelset_norm%sf(i, j, k, ib_patch_id, :) = (/1, 0, 0/) @@ -509,11 +511,11 @@ contains type(levelset_norm_field), intent(INOUT) :: levelset_norm integer, intent(IN) :: ib_patch_id - real(kind(0d0)) :: radius, dist - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid - real(kind(0d0)) :: length_x, length_y, length_z - real(kind(0d0)), dimension(3) :: pos_vec, centroid_vec, dist_vec, dist_sides_vec, dist_surface_vec - real(kind(0d0)) :: dist_side, dist_surface, side_pos + real(wp) :: radius, dist + real(wp) :: x_centroid, y_centroid, z_centroid + real(wp) :: length_x, length_y, length_z + real(wp), dimension(3) :: pos_vec, centroid_vec, dist_vec, dist_sides_vec, dist_surface_vec + real(wp) :: dist_side, dist_surface, side_pos type(bounds_info) :: boundary integer :: i, j, k !< Loop index variables @@ -525,19 +527,19 @@ contains length_y = patch_ib(ib_patch_id)%length_y length_z = patch_ib(ib_patch_id)%length_z - if (length_x /= 0d0) then - boundary%beg = x_centroid - 0.5*length_x - boundary%end = x_centroid + 0.5*length_x + if (length_x /= 0._wp) then + boundary%beg = x_centroid - 0.5_wp*length_x + boundary%end = x_centroid + 0.5_wp*length_x dist_sides_vec = (/1, 0, 0/) dist_surface_vec = (/0, 1, 1/) - else if (length_y /= 0d0) then - boundary%beg = y_centroid - 0.5*length_y - boundary%end = y_centroid + 0.5*length_y + else if (length_y /= 0._wp) then + boundary%beg = y_centroid - 0.5_wp*length_y + boundary%end = y_centroid + 0.5_wp*length_y dist_sides_vec = (/0, 1, 0/) dist_surface_vec = (/1, 0, 1/) - else if (length_z /= 0d0) then - boundary%beg = z_centroid - 0.5*length_z - boundary%end = z_centroid + 0.5*length_z + else if (length_z /= 0._wp) then + boundary%beg = z_centroid - 0.5_wp*length_z + boundary%end = z_centroid + 0.5_wp*length_z dist_sides_vec = (/0, 0, 1/) dist_surface_vec = (/1, 1, 0/) end if diff --git a/src/pre_process/m_data_output.fpp b/src/pre_process/m_data_output.fpp index 8c6147ade..616434481 100644 --- a/src/pre_process/m_data_output.fpp +++ b/src/pre_process/m_data_output.fpp @@ -114,7 +114,7 @@ contains character(LEN=3) :: status character(LEN= & - int(floor(log10(real(sys_size, kind(0d0))))) + 1) :: file_num !< Used to store + int(floor(log10(real(sys_size, wp)))) + 1) :: file_num !< Used to store !! the number, in character form, of the currently !! manipulated conservative variable data file @@ -124,16 +124,16 @@ contains integer :: i, j, k, l, r, c, dir !< Generic loop iterator integer :: t_step - real(kind(0d0)), dimension(nb) :: nRtmp !< Temporary bubble concentration - real(kind(0d0)) :: nbub !< Temporary bubble number density - real(kind(0d0)) :: gamma, lit_gamma, pi_inf, qv !< Temporary EOS params - real(kind(0d0)) :: rho !< Temporary density - real(kind(0d0)) :: pres, Temp !< Temporary pressure + real(wp), dimension(nb) :: nRtmp !< Temporary bubble concentration + real(wp) :: nbub !< Temporary bubble number density + real(wp) :: gamma, lit_gamma, pi_inf, qv !< Temporary EOS params + real(wp) :: rho !< Temporary density + real(wp) :: pres, Temp !< Temporary pressure - real(kind(0d0)) :: nR3 - real(kind(0d0)) :: ntmp + real(wp) :: nR3 + real(wp) :: ntmp - real(kind(0d0)) :: rhoYks(1:num_species) !< Temporary species mass fractions + real(wp) :: rhoYks(1:num_species) !< Temporary species mass fractions t_step = 0 @@ -252,7 +252,7 @@ contains ! ================================================================== gamma = fluid_pp(1)%gamma - lit_gamma = 1d0/fluid_pp(1)%gamma + 1d0 + lit_gamma = 1._wp/fluid_pp(1)%gamma + 1._wp pi_inf = fluid_pp(1)%pi_inf qv = fluid_pp(1)%qv @@ -288,7 +288,7 @@ contains call s_convert_to_mixture_variables(q_cons_vf, j, 0, 0, rho, gamma, pi_inf, qv) - lit_gamma = 1d0/gamma + 1d0 + lit_gamma = 1._wp/gamma + 1._wp if ((i >= chemxb) .and. (i <= chemxe)) then write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0)/rho @@ -309,7 +309,7 @@ contains call s_compute_pressure( & q_cons_vf(E_idx)%sf(j, 0, 0), & q_cons_vf(alf_idx)%sf(j, 0, 0), & - 0.5d0*(q_cons_vf(mom_idx%beg)%sf(j, 0, 0)**2.d0)/rho, & + 0.5_wp*(q_cons_vf(mom_idx%beg)%sf(j, 0, 0)**2._wp)/rho, & pi_inf, gamma, rho, qv, rhoYks, pres, Temp) write (2, FMT) x_cb(j), pres else if ((i >= bub_idx%beg) .and. (i <= bub_idx%end) .and. bubbles) then @@ -603,8 +603,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -614,7 +614,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Additional variables pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -622,7 +622,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -631,7 +631,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -667,8 +667,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -680,10 +680,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Additional variables pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -693,10 +693,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -707,10 +707,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -752,10 +752,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelset_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelset_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_levelset_DATA%var%sf, data_size*num_ibs, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) @@ -772,10 +772,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelsetnorm_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelsetnorm_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_levelsetnorm_DATA%var%sf, data_size*num_ibs*3, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) end if @@ -798,10 +798,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(1), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_airfoil_IB_DATA%view(1), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_airfoil_IB_DATA%var(1:Np), 3*Np, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) @@ -817,10 +817,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(2), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_airfoil_IB_DATA%view(2), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_airfoil_IB_DATA%var(Np + 1:2*Np), 3*Np, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) end if diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index 7d1ad9a39..215bda634 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -53,13 +53,13 @@ module m_global_parameters logical :: cyl_coord integer :: grid_geometry !< Cylindrical coordinates (either axisymmetric or full 3D) - real(kind(0d0)), allocatable, dimension(:) :: x_cc, y_cc, z_cc !< + real(wp), allocatable, dimension(:) :: x_cc, y_cc, z_cc !< !! Locations of cell-centers (cc) in x-, y- and z-directions, respectively - real(kind(0d0)), allocatable, dimension(:) :: x_cb, y_cb, z_cb !< + real(wp), allocatable, dimension(:) :: x_cb, y_cb, z_cb !< !! Locations of cell-boundaries (cb) in x-, y- and z-directions, respectively - real(kind(0d0)) :: dx, dy, dz !< + real(wp) :: dx, dy, dz !< !! Minimum cell-widths in the x-, y- and z-coordinate directions type(bounds_info) :: x_domain, y_domain, z_domain !< @@ -72,10 +72,10 @@ module m_global_parameters ! directions. The "a" parameters are a measure of the rate at which the grid ! is stretched while the remaining parameters are indicative of the location ! on the grid at which the stretching begins. - real(kind(0d0)) :: a_x, a_y, a_z + real(wp) :: a_x, a_y, a_z integer :: loops_x, loops_y, loops_z - real(kind(0d0)) :: x_a, y_a, z_a - real(kind(0d0)) :: x_b, y_b, z_b + real(wp) :: x_a, y_a, z_a + real(wp) :: x_b, y_b, z_b ! ========================================================================== @@ -83,8 +83,8 @@ module m_global_parameters integer :: model_eqns !< Multicomponent flow model logical :: relax !< activate phase change integer :: relax_model !< Relax Model - real(kind(0d0)) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model - real(kind(0d0)) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model + real(wp) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model + real(wp) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model integer :: num_fluids !< Number of different fluids present in the flow logical :: mpp_lim !< Alpha limiter integer :: sys_size !< Number of unknowns in the system of equations @@ -125,19 +125,19 @@ module m_global_parameters integer :: precision !< Precision of output files logical :: mixlayer_vel_profile !< Set hyperbolic tangent streamwise velocity profile - real(kind(0d0)) :: mixlayer_vel_coef !< Coefficient for the hyperbolic tangent streamwise velocity profile - real(kind(0d0)) :: mixlayer_domain !< Domain for the hyperbolic tangent streamwise velocity profile + real(wp) :: mixlayer_vel_coef !< Coefficient for the hyperbolic tangent streamwise velocity profile + real(wp) :: mixlayer_domain !< Domain for the hyperbolic tangent streamwise velocity profile logical :: mixlayer_perturb !< Superimpose instability waves to surrounding fluid flow - real(kind(0d0)) :: pi_fac !< Factor for artificial pi_inf + real(wp) :: pi_fac !< Factor for artificial pi_inf ! Perturb density of surrounding air so as to break symmetry of grid logical :: perturb_flow integer :: perturb_flow_fluid !< Fluid to be perturbed with perturb_flow flag - real(kind(0d0)) :: perturb_flow_mag !< Magnitude of perturbation with perturb_flow flag + real(wp) :: perturb_flow_mag !< Magnitude of perturbation with perturb_flow flag logical :: perturb_sph integer :: perturb_sph_fluid !< Fluid to be perturbed with perturb_sph flag - real(kind(0d0)), dimension(num_fluids_max) :: fluid_rho + real(wp), dimension(num_fluids_max) :: fluid_rho integer, allocatable, dimension(:) :: proc_coords !< !! Processor coordinates in MPI_CART_COMM @@ -180,18 +180,18 @@ module m_global_parameters ! ========================================================================== - real(kind(0d0)) :: rhoref, pref !< Reference parameters for Tait EOS + real(wp) :: rhoref, pref !< Reference parameters for Tait EOS !> @name Bubble modeling !> @{ integer :: nb - real(kind(0d0)) :: R0ref - real(kind(0d0)) :: Ca, Web, Re_inv - real(kind(0d0)), dimension(:), allocatable :: weight, R0, V0 + real(wp) :: R0ref + real(wp) :: Ca, Web, Re_inv + real(wp), dimension(:), allocatable :: weight, R0, V0 logical :: bubbles logical :: qbmm !< Quadrature moment method integer :: nmom !< Number of carried moments - real(kind(0d0)) :: sigR, sigV, rhoRV !< standard deviations in R/V + real(wp) :: sigR, sigV, rhoRV !< standard deviations in R/V logical :: adv_n !< Solve the number density equation and compute alpha from number density !> @} @@ -217,19 +217,19 @@ module m_global_parameters logical :: polytropic logical :: polydisperse integer :: thermal !1 = adiabatic, 2 = isotherm, 3 = transfer - real(kind(0d0)) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, pv, M_n, M_v - real(kind(0d0)), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T - real(kind(0d0)), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN - real(kind(0d0)) :: mul0, ss, gamma_v, mu_v - real(kind(0d0)) :: gamma_m, gamma_n, mu_n - real(kind(0d0)) :: poly_sigma + real(wp) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, pv, M_n, M_v + real(wp), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T + real(wp), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN + real(wp) :: mul0, ss, gamma_v, mu_v + real(wp) :: gamma_m, gamma_n, mu_n + real(wp) :: poly_sigma integer :: dist_type !1 = binormal, 2 = lognormal-normal integer :: R0_type !1 = simpson !> @} !> @name Surface Tension Modeling !> @{ - real(kind(0d0)) :: sigma + real(wp) :: sigma logical :: surface_tension !> @} @@ -316,8 +316,8 @@ contains #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0d0 - bc_${DIM}$%ve${DIR}$ = 0d0 + bc_${DIM}$%vb${DIR}$ = 0._wp + bc_${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor @@ -325,8 +325,8 @@ contains file_per_process = .false. precision = 2 mixlayer_vel_profile = .false. - mixlayer_vel_coef = 1d0 - mixlayer_domain = 1d0 + mixlayer_vel_coef = 1._wp + mixlayer_domain = 1._wp mixlayer_perturb = .false. perturb_flow = .false. perturb_flow_fluid = dflt_int @@ -340,8 +340,8 @@ contains do i = 1, num_patches_max patch_icpp(i)%geometry = dflt_int - patch_icpp(i)%model_scale(:) = 1d0 - patch_icpp(i)%model_translate(:) = 0d0 + patch_icpp(i)%model_scale(:) = 1._wp + patch_icpp(i)%model_translate(:) = 0._wp patch_icpp(i)%model_filepath(:) = dflt_char patch_icpp(i)%model_spc = num_ray patch_icpp(i)%model_threshold = ray_tracing_threshold @@ -368,10 +368,10 @@ contains patch_icpp(i)%alpha = dflt_real patch_icpp(i)%gamma = dflt_real patch_icpp(i)%pi_inf = dflt_real - patch_icpp(i)%cv = 0d0 - patch_icpp(i)%qv = 0d0 - patch_icpp(i)%qvp = 0d0 - patch_icpp(i)%tau_e = 0d0 + patch_icpp(i)%cv = 0._wp + patch_icpp(i)%qv = 0._wp + patch_icpp(i)%qvp = 0._wp + patch_icpp(i)%tau_e = 0._wp !should get all of r0's and v0's patch_icpp(i)%r0 = dflt_real patch_icpp(i)%v0 = dflt_real @@ -382,7 +382,7 @@ contains patch_icpp(i)%hcid = dflt_int if (chemistry) then - patch_icpp(i)%Y(:) = 0d0 + patch_icpp(i)%Y(:) = 0._wp end if end do @@ -411,7 +411,7 @@ contains nmom = 1 sigR = dflt_real sigV = dflt_real - rhoRV = 0d0 + rhoRV = 0._wp dist_type = dflt_int R0_type = dflt_int @@ -424,7 +424,7 @@ contains ! surface tension modeling sigma = dflt_real - pi_fac = 1d0 + pi_fac = 1._wp ! Immersed Boundaries ib = .false. @@ -447,9 +447,9 @@ contains patch_ib(i)%slip = .false. ! Proper default values for translating STL models - patch_ib(i)%model_scale(:) = 1d0 - patch_ib(i)%model_translate(:) = 0d0 - patch_ib(i)%model_rotate(:) = 0d0 + patch_ib(i)%model_scale(:) = 1._wp + patch_ib(i)%model_translate(:) = 0._wp + patch_ib(i)%model_rotate(:) = 0._wp patch_ib(i)%model_filepath(:) = dflt_char patch_ib(i)%model_spc = num_ray patch_ib(i)%model_threshold = ray_tracing_threshold @@ -466,10 +466,10 @@ contains fluid_pp(i)%M_v = dflt_real fluid_pp(i)%mu_v = dflt_real fluid_pp(i)%k_v = dflt_real - fluid_pp(i)%cv = 0d0 - fluid_pp(i)%qv = 0d0 - fluid_pp(i)%qvp = 0d0 - fluid_pp(i)%G = 0d0 + fluid_pp(i)%cv = 0._wp + fluid_pp(i)%qv = 0._wp + fluid_pp(i)%qvp = 0._wp + fluid_pp(i)%G = 0._wp end do end subroutine s_assign_default_values_to_user_inputs @@ -588,11 +588,11 @@ contains end if if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 1d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 1._wp else if (nb > 1) then - V0(:) = 1d0 + V0(:) = 1._wp !R0 and weight initialized in s_simpson else stop 'Invalid value of nb' @@ -601,8 +601,8 @@ contains !Initialize pref,rhoref for polytropic qbmm (done in s_initialize_nonpoly for non-polytropic) if (.not. qbmm) then if (polytropic) then - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if @@ -613,9 +613,9 @@ contains if ((f_is_default(Web))) then pb0 = pref pb0 = pb0/pref - pref = 1d0 + pref = 1._wp end if - rhoref = 1d0 + rhoref = 1._wp end if end if end if @@ -698,18 +698,18 @@ contains end do if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 0d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 0._wp else if (nb > 1) then - V0(:) = 1d0 + V0(:) = 1._wp else stop 'Invalid value of nb' end if if (polytropic) then - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if diff --git a/src/pre_process/m_grid.f90 b/src/pre_process/m_grid.f90 index 84fdb14f4..48491eaff 100644 --- a/src/pre_process/m_grid.f90 +++ b/src/pre_process/m_grid.f90 @@ -58,14 +58,14 @@ subroutine s_generate_serial_grid ! Generic loop iterator integer :: i, j !< generic loop operators - real(kind(0d0)) :: length !< domain lengths + real(wp) :: length !< domain lengths ! Grid Generation in the x-direction =============================== - dx = (x_domain%end - x_domain%beg)/real(m + 1, kind(0d0)) + dx = (x_domain%end - x_domain%beg)/real(m + 1, wp) do i = 0, m - x_cc(i) = x_domain%beg + 5d-1*dx*real(2*i + 1, kind(0d0)) - x_cb(i - 1) = x_domain%beg + dx*real(i, kind(0d0)) + x_cc(i) = x_domain%beg + 5e-1_wp*dx*real(2*i + 1, wp) + x_cb(i - 1) = x_domain%beg + dx*real(i, wp) end do x_cb(m) = x_domain%end @@ -82,12 +82,12 @@ subroutine s_generate_serial_grid x_cb(i) = x_cb(i)/a_x* & (a_x + log(cosh(a_x*(x_cb(i) - x_a))) & + log(cosh(a_x*(x_cb(i) - x_b))) & - - 2d0*log(cosh(a_x*(x_b - x_a)/2d0))) + - 2._wp*log(cosh(a_x*(x_b - x_a)/2._wp))) end do end do x_cb = x_cb*length - x_cc = (x_cb(0:m) + x_cb(-1:m - 1))/2d0 + x_cc = (x_cb(0:m) + x_cb(-1:m - 1))/2._wp dx = minval(x_cb(0:m) - x_cb(-1:m - 1)) print *, 'Stretched grid: min/max x grid: ', minval(x_cc(:)), maxval(x_cc(:)) @@ -99,26 +99,26 @@ subroutine s_generate_serial_grid ! Grid Generation in the y-direction =============================== if (n == 0) return - if (grid_geometry == 2 .and. y_domain%beg == 0.0d0) then + if (grid_geometry == 2 .and. y_domain%beg == 0.0_wp) then !IF (grid_geometry == 2) THEN - dy = (y_domain%end - y_domain%beg)/real(2*n + 1, kind(0d0)) + dy = (y_domain%end - y_domain%beg)/real(2*n + 1, wp) - y_cc(0) = y_domain%beg + 5d-1*dy + y_cc(0) = y_domain%beg + 5e-1_wp*dy y_cb(-1) = y_domain%beg do i = 1, n - y_cc(i) = y_domain%beg + 2d0*dy*real(i, kind(0d0)) - y_cb(i - 1) = y_domain%beg + dy*real(2*i - 1, kind(0d0)) + y_cc(i) = y_domain%beg + 2._wp*dy*real(i, wp) + y_cb(i - 1) = y_domain%beg + dy*real(2*i - 1, wp) end do else - dy = (y_domain%end - y_domain%beg)/real(n + 1, kind(0d0)) + dy = (y_domain%end - y_domain%beg)/real(n + 1, wp) do i = 0, n - y_cc(i) = y_domain%beg + 5d-1*dy*real(2*i + 1, kind(0d0)) - y_cb(i - 1) = y_domain%beg + dy*real(i, kind(0d0)) + y_cc(i) = y_domain%beg + 5e-1_wp*dy*real(2*i + 1, wp) + y_cb(i - 1) = y_domain%beg + dy*real(i, wp) end do end if @@ -137,12 +137,12 @@ subroutine s_generate_serial_grid y_cb(i) = y_cb(i)/a_y* & (a_y + log(cosh(a_y*(y_cb(i) - y_a))) & + log(cosh(a_y*(y_cb(i) - y_b))) & - - 2d0*log(cosh(a_y*(y_b - y_a)/2d0))) + - 2._wp*log(cosh(a_y*(y_b - y_a)/2._wp))) end do end do y_cb = y_cb*length - y_cc = (y_cb(0:n) + y_cb(-1:n - 1))/2d0 + y_cc = (y_cb(0:n) + y_cb(-1:n - 1))/2._wp dy = minval(y_cb(0:n) - y_cb(-1:n - 1)) @@ -154,11 +154,11 @@ subroutine s_generate_serial_grid ! Grid Generation in the z-direction =============================== if (p == 0) return - dz = (z_domain%end - z_domain%beg)/real(p + 1, kind(0d0)) + dz = (z_domain%end - z_domain%beg)/real(p + 1, wp) do i = 0, p - z_cc(i) = z_domain%beg + 5d-1*dz*real(2*i + 1, kind(0d0)) - z_cb(i - 1) = z_domain%beg + dz*real(i, kind(0d0)) + z_cc(i) = z_domain%beg + 5e-1_wp*dz*real(2*i + 1, wp) + z_cb(i - 1) = z_domain%beg + dz*real(i, wp) end do z_cb(p) = z_domain%end @@ -175,12 +175,12 @@ subroutine s_generate_serial_grid z_cb(i) = z_cb(i)/a_z* & (a_z + log(cosh(a_z*(z_cb(i) - z_a))) & + log(cosh(a_z*(z_cb(i) - z_b))) & - - 2d0*log(cosh(a_z*(z_b - z_a)/2d0))) + - 2._wp*log(cosh(a_z*(z_b - z_a)/2._wp))) end do end do z_cb = z_cb*length - z_cc = (z_cb(0:p) + z_cb(-1:p - 1))/2d0 + z_cc = (z_cb(0:p) + z_cb(-1:p - 1))/2._wp dz = minval(z_cb(0:p) - z_cb(-1:p - 1)) @@ -200,10 +200,10 @@ subroutine s_generate_parallel_grid #ifdef MFC_MPI - real(kind(0d0)) :: length !< domain lengths + real(wp) :: length !< domain lengths ! Locations of cell boundaries - real(kind(0d0)), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb !< + real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb !< !! Locations of cell boundaries character(LEN=path_len + name_len) :: file_loc !< @@ -219,9 +219,9 @@ subroutine s_generate_parallel_grid allocate (z_cb_glb(-1:p_glb)) ! Grid generation in the x-direction - dx = (x_domain%end - x_domain%beg)/real(m_glb + 1, kind(0d0)) + dx = (x_domain%end - x_domain%beg)/real(m_glb + 1, wp) do i = 0, m_glb - x_cb_glb(i - 1) = x_domain%beg + dx*real(i, kind(0d0)) + x_cb_glb(i - 1) = x_domain%beg + dx*real(i, wp) end do x_cb_glb(m_glb) = x_domain%end if (stretch_x) then @@ -237,7 +237,7 @@ subroutine s_generate_parallel_grid x_cb_glb(i) = x_cb_glb(i)/a_x* & (a_x + log(cosh(a_x*(x_cb_glb(i) - x_a))) & + log(cosh(a_x*(x_cb_glb(i) - x_b))) & - - 2d0*log(cosh(a_x*(x_b - x_a)/2d0))) + - 2._wp*log(cosh(a_x*(x_b - x_a)/2._wp))) end do end do @@ -248,16 +248,16 @@ subroutine s_generate_parallel_grid ! Grid generation in the y-direction if (n_glb > 0) then - if (grid_geometry == 2 .and. y_domain%beg == 0.0d0) then - dy = (y_domain%end - y_domain%beg)/real(2*n_glb + 1, kind(0d0)) + if (grid_geometry == 2 .and. y_domain%beg == 0.0_wp) then + dy = (y_domain%end - y_domain%beg)/real(2*n_glb + 1, wp) y_cb_glb(-1) = y_domain%beg do i = 1, n_glb - y_cb_glb(i - 1) = y_domain%beg + dy*real(2*i - 1, kind(0d0)) + y_cb_glb(i - 1) = y_domain%beg + dy*real(2*i - 1, wp) end do else - dy = (y_domain%end - y_domain%beg)/real(n_glb + 1, kind(0d0)) + dy = (y_domain%end - y_domain%beg)/real(n_glb + 1, wp) do i = 0, n_glb - y_cb_glb(i - 1) = y_domain%beg + dy*real(i, kind(0d0)) + y_cb_glb(i - 1) = y_domain%beg + dy*real(i, wp) end do end if y_cb_glb(n_glb) = y_domain%end @@ -274,7 +274,7 @@ subroutine s_generate_parallel_grid y_cb_glb(i) = y_cb_glb(i)/a_y* & (a_y + log(cosh(a_y*(y_cb_glb(i) - y_a))) & + log(cosh(a_y*(y_cb_glb(i) - y_b))) & - - 2d0*log(cosh(a_y*(y_b - y_a)/2d0))) + - 2._wp*log(cosh(a_y*(y_b - y_a)/2._wp))) end do end do @@ -284,9 +284,9 @@ subroutine s_generate_parallel_grid ! Grid generation in the z-direction if (p_glb > 0) then - dz = (z_domain%end - z_domain%beg)/real(p_glb + 1, kind(0d0)) + dz = (z_domain%end - z_domain%beg)/real(p_glb + 1, wp) do i = 0, p_glb - z_cb_glb(i - 1) = z_domain%beg + dz*real(i, kind(0d0)) + z_cb_glb(i - 1) = z_domain%beg + dz*real(i, wp) end do z_cb_glb(p_glb) = z_domain%end if (stretch_z) then @@ -301,7 +301,7 @@ subroutine s_generate_parallel_grid z_cb_glb(i) = z_cb_glb(i)/a_z* & (a_z + log(cosh(a_z*(z_cb_glb(i) - z_a))) & + log(cosh(a_z*(z_cb_glb(i) - z_b))) & - - 2d0*log(cosh(a_z*(z_b - z_a)/2d0))) + - 2._wp*log(cosh(a_z*(z_b - z_a)/2._wp))) end do end do @@ -316,7 +316,7 @@ subroutine s_generate_parallel_grid data_size = m_glb + 2 call MPI_FILE_OPEN(MPI_COMM_SELF, file_loc, ior(MPI_MODE_WRONLY, MPI_MODE_CREATE), & mpi_info_int, ifile, ierr) - call MPI_FILE_WRITE(ifile, x_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_WRITE(ifile, x_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) if (n > 0) then @@ -324,7 +324,7 @@ subroutine s_generate_parallel_grid data_size = n_glb + 2 call MPI_FILE_OPEN(MPI_COMM_SELF, file_loc, ior(MPI_MODE_WRONLY, MPI_MODE_CREATE), & mpi_info_int, ifile, ierr) - call MPI_FILE_WRITE(ifile, y_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_WRITE(ifile, y_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) if (p > 0) then @@ -332,7 +332,7 @@ subroutine s_generate_parallel_grid data_size = p_glb + 2 call MPI_FILE_OPEN(MPI_COMM_SELF, file_loc, ior(MPI_MODE_WRONLY, MPI_MODE_CREATE), & mpi_info_int, ifile, ierr) - call MPI_FILE_WRITE(ifile, z_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_WRITE(ifile, z_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) end if end if diff --git a/src/pre_process/m_model.fpp b/src/pre_process/m_model.fpp index 02d316fd5..1e8df1621 100644 --- a/src/pre_process/m_model.fpp +++ b/src/pre_process/m_model.fpp @@ -492,19 +492,19 @@ contains t_vec3, intent(in) :: spacing integer, intent(in) :: spc - real(kind(0d0)) :: fraction + real(wp) :: fraction type(t_ray) :: ray integer :: i, j, nInOrOut, nHits - real(kind(0d0)), dimension(1:spc, 1:3) :: ray_origins, ray_dirs + real(wp), dimension(1:spc, 1:3) :: ray_origins, ray_dirs do i = 1, spc call random_number(ray_origins(i, :)) - ray_origins(i, :) = point + (ray_origins(i, :) - 0.5)*spacing(:) + ray_origins(i, :) = point + (ray_origins(i, :) - 0.5_wp)*spacing(:) call random_number(ray_dirs(i, :)) - ray_dirs(i, :) = ray_dirs(i, :) - 0.5 + ray_dirs(i, :) = ray_dirs(i, :) - 0.5_wp ray_dirs(i, :) = ray_dirs(i, :)/sqrt(sum(ray_dirs(i, :)*ray_dirs(i, :))) end do @@ -527,7 +527,7 @@ contains end function f_model_is_inside - ! From https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution.html + ! From https://www.scratchapixel.com/lessons/3e-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution.html !> This procedure checks if a ray intersects a triangle. !! @param ray Ray. !! @param triangle Triangle. @@ -539,8 +539,8 @@ contains logical :: intersects - real(kind(0d0)) :: v0v1(3), v0v2(3), N(3), P(3), C(3), edge(3), vp(3) - real(kind(0d0)) :: area2, d, t, NdotRayDirection + real(wp) :: v0v1(3), v0v2(3), N(3), P(3), C(3), edge(3), vp(3) + real(wp) :: area2, d, t, NdotRayDirection intersects = .false. @@ -549,7 +549,7 @@ contains NdotRayDirection = sum(N(:)*ray%d(:)) - if (abs(NdotRayDirection) < 0.0000001) then + if (abs(NdotRayDirection) < 0.0000001_wp) then return end if @@ -594,16 +594,16 @@ contains !! @param boundary_edge_count Output total boundary edge counts subroutine f_check_boundary(model, boundary_v, boundary_vertex_count, boundary_edge_count) type(t_model), intent(in) :: model - real(kind(0d0)), allocatable, intent(out), dimension(:, :, :) :: boundary_v !< Output boundary vertices/normals + real(wp), allocatable, intent(out), dimension(:, :, :) :: boundary_v !< Output boundary vertices/normals integer, intent(out) :: boundary_vertex_count, boundary_edge_count !< Output boundary vertex/edge count integer :: i, j !< Model index iterator integer :: edge_count, edge_index, store_index !< Boundary edge index iterator - real(kind(0d0)), dimension(1:2, 1:2) :: edge !< Edge end points buffer - real(kind(0d0)), dimension(1:2) :: boundary_edge !< Boundary edge end points buffer - real(kind(0d0)), dimension(1:(3*model%ntrs), 1:2, 1:2) :: temp_boundary_v !< Temporary boundary vertex buffer + real(wp), dimension(1:2, 1:2) :: edge !< Edge end points buffer + real(wp), dimension(1:2) :: boundary_edge !< Boundary edge end points buffer + real(wp), dimension(1:(3*model%ntrs), 1:2, 1:2) :: temp_boundary_v !< Temporary boundary vertex buffer integer, dimension(1:(3*model%ntrs)) :: edge_occurrence !< The manifoldness of the edges - real(kind(0d0)) :: edgetan, initial, v_norm, xnormal, ynormal !< The manifoldness of the edges + real(wp) :: edgetan, initial, v_norm, xnormal, ynormal !< The manifoldness of the edges ! Total number of edges in 2D STL edge_count = 3*model%ntrs @@ -680,12 +680,12 @@ contains edgetan = boundary_edge(1)/boundary_edge(2) if (abs(boundary_edge(2)) < threshold_vector_zero) then - if (edgetan > 0d0) then + if (edgetan > 0._wp) then ynormal = -1 - xnormal = 0d0 + xnormal = 0._wp else ynormal = 1 - xnormal = 0d0 + xnormal = 0._wp end if else initial = boundary_edge(2) @@ -693,7 +693,7 @@ contains xnormal = initial end if - v_norm = dsqrt(xnormal**2 + ynormal**2) + v_norm = sqrt(xnormal**2 + ynormal**2) boundary_v(i, 3, 1) = xnormal/v_norm boundary_v(i, 3, 2) = ynormal/v_norm end do @@ -708,8 +708,8 @@ contains subroutine f_register_edge(temp_boundary_v, edge, edge_index, edge_count) integer, intent(inout) :: edge_index !< Edge index iterator integer, intent(inout) :: edge_count !< Total number of edges - real(kind(0d0)), intent(in), dimension(1:2, 1:2) :: edge !< Edges end points to be registered - real(kind(0d0)), dimension(1:edge_count, 1:2, 1:2) :: temp_boundary_v !< Temporary edge end vertex buffer + real(wp), intent(in), dimension(1:2, 1:2) :: edge !< Edges end points to be registered + real(wp), dimension(1:edge_count, 1:2, 1:2) :: temp_boundary_v !< Temporary edge end vertex buffer ! Increment edge index and store the edge edge_index = edge_index + 1 @@ -726,10 +726,10 @@ contains subroutine f_check_interpolation_2D(boundary_v, boundary_edge_count, spacing, interpolate) logical, intent(inout) :: interpolate !< Logical indicator of interpolation integer, intent(in) :: boundary_edge_count !< Number of boundary edges - real(kind(0d0)), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v + real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v t_vec3, intent(in) :: spacing - real(kind(0d0)) :: l1, cell_width !< Length of each boundary edge and cell width + real(wp) :: l1, cell_width !< Length of each boundary edge and cell width integer :: j !< Boundary edge index iterator cell_width = minval(spacing(1:2)) @@ -737,8 +737,8 @@ contains do j = 1, boundary_edge_count - l1 = dsqrt((boundary_v(j, 2, 1) - boundary_v(j, 1, 1))**2 + & - (boundary_v(j, 2, 2) - boundary_v(j, 1, 2))**2) + l1 = sqrt((boundary_v(j, 2, 1) - boundary_v(j, 1, 1))**2 + & + (boundary_v(j, 2, 2) - boundary_v(j, 1, 2))**2) if ((l1 > cell_width)) then interpolate = .true. @@ -758,8 +758,8 @@ contains type(t_model), intent(in) :: model t_vec3, intent(in) :: spacing t_vec3 :: edge_l - real(kind(0d0)) :: cell_width - real(kind(0d0)), dimension(1:3, 1:3) :: tri_v + real(wp) :: cell_width + real(wp), dimension(1:3, 1:3) :: tri_v integer :: i, j !< Loop iterator cell_width = minval(spacing) @@ -772,15 +772,15 @@ contains tri_v(3, j) = model%trs(i)%v(3, j) end do - edge_l(1) = dsqrt((tri_v(1, 2) - tri_v(1, 1))**2 + & - (tri_v(2, 2) - tri_v(2, 1))**2 + & - (tri_v(3, 2) - tri_v(3, 1))**2) - edge_l(2) = dsqrt((tri_v(1, 3) - tri_v(1, 2))**2 + & - (tri_v(2, 3) - tri_v(2, 2))**2 + & - (tri_v(3, 3) - tri_v(3, 2))**2) - edge_l(3) = dsqrt((tri_v(1, 1) - tri_v(1, 3))**2 + & - (tri_v(2, 1) - tri_v(2, 3))**2 + & - (tri_v(3, 1) - tri_v(3, 3))**2) + edge_l(1) = sqrt((tri_v(1, 2) - tri_v(1, 1))**2 + & + (tri_v(2, 2) - tri_v(2, 1))**2 + & + (tri_v(3, 2) - tri_v(3, 1))**2) + edge_l(2) = sqrt((tri_v(1, 3) - tri_v(1, 2))**2 + & + (tri_v(2, 3) - tri_v(2, 2))**2 + & + (tri_v(3, 3) - tri_v(3, 2))**2) + edge_l(3) = sqrt((tri_v(1, 1) - tri_v(1, 3))**2 + & + (tri_v(2, 1) - tri_v(2, 3))**2 + & + (tri_v(3, 1) - tri_v(3, 3))**2) if ((edge_l(1) > cell_width) .or. & (edge_l(2) > cell_width) .or. & @@ -800,14 +800,14 @@ contains !! @param interpolated_boundary_v Output all the boundary vertices of the interpolated 2D model !! @param total_vertices Total number of vertices after interpolation subroutine f_interpolate_2D(boundary_v, boundary_edge_count, spacing, interpolated_boundary_v, total_vertices) - real(kind(0d0)), intent(in), dimension(:, :, :) :: boundary_v + real(wp), intent(in), dimension(:, :, :) :: boundary_v t_vec3, intent(in) :: spacing - real(kind(0d0)), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v + real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v integer :: i, j, num_segments, total_vertices, boundary_edge_count - real(kind(0d0)) :: edge_length, cell_width - real(kind(0d0)), dimension(1:2) :: edge_x, edge_y, edge_del - real(kind(0d0)), allocatable :: temp_boundary_v(:, :) + real(wp) :: edge_length, cell_width + real(wp), dimension(1:2) :: edge_x, edge_y, edge_del + real(wp), allocatable :: temp_boundary_v(:, :) ! Get the number of boundary edges cell_width = minval(spacing(1:2)) @@ -823,8 +823,8 @@ contains edge_y(2) = boundary_v(i, 2, 2) ! Compute the length of the edge - edge_length = dsqrt((edge_x(2) - edge_x(1))**2 + & - (edge_y(2) - edge_y(1))**2) + edge_length = sqrt((edge_x(2) - edge_x(1))**2 + & + (edge_y(2) - edge_y(1))**2) ! Determine the number of segments if (edge_length > cell_width) then @@ -850,8 +850,8 @@ contains edge_y(2) = boundary_v(i, 2, 2) ! Compute the length of the edge - edge_length = dsqrt((edge_x(2) - edge_x(1))**2 + & - (edge_y(2) - edge_y(1))**2) + edge_length = sqrt((edge_x(2) - edge_x(1))**2 + & + (edge_y(2) - edge_y(1))**2) ! Determine the number of segments and interpolation step if (edge_length > cell_width) then @@ -860,13 +860,13 @@ contains edge_del(2) = (edge_y(2) - edge_y(1))/num_segments else num_segments = 1 - edge_del(1) = 0d0 - edge_del(2) = 0d0 + edge_del(1) = 0._wp + edge_del(2) = 0._wp end if interpolated_boundary_v(1, 1) = edge_x(1) interpolated_boundary_v(1, 2) = edge_y(1) - interpolated_boundary_v(1, 3) = 0d0 + interpolated_boundary_v(1, 3) = 0._wp ! Add original and interpolated vertices to the output array do j = 1, num_segments - 1 @@ -893,15 +893,15 @@ contains subroutine f_interpolate_3D(model, spacing, interpolated_boundary_v, total_vertices) t_vec3, intent(in) :: spacing type(t_model), intent(in) :: model - real(kind(0d0)), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v + real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v integer, intent(out) :: total_vertices integer :: i, j, k, num_triangles, num_segments, num_inner_vertices - real(kind(0d0)), dimension(1:3, 1:3) :: tri + real(wp), dimension(1:3, 1:3) :: tri t_vec3 :: edge_del, cell_area t_vec3 :: bary_coord !< Barycentric coordinates - real(kind(0d0)) :: edge_length, cell_width, cell_area_min, tri_area - real(kind(0d0)), allocatable :: temp_boundary_v(:, :) + real(wp) :: edge_length, cell_width, cell_area_min, tri_area + real(wp), allocatable :: temp_boundary_v(:, :) ! Number of triangles in the model num_triangles = model%ntrs @@ -928,9 +928,9 @@ contains tri(2, 3) = model%trs(i)%v(mod(j, 3) + 1, 3) ! Compute the length of the edge - edge_length = dsqrt((tri(2, 1) - tri(1, 1))**2 + & - (tri(2, 2) - tri(1, 2))**2 + & - (tri(2, 3) - tri(1, 3))**2) + edge_length = sqrt((tri(2, 1) - tri(1, 1))**2 + & + (tri(2, 2) - tri(1, 2))**2 + & + (tri(2, 3) - tri(1, 3))**2) ! Determine the number of segments if (edge_length > cell_width) then @@ -975,9 +975,9 @@ contains tri(2, 3) = model%trs(i)%v(mod(j, 3) + 1, 3) ! Compute the length of the edge - edge_length = dsqrt((tri(2, 1) - tri(1, 1))**2 + & - (tri(2, 2) - tri(1, 2))**2 + & - (tri(2, 3) - tri(1, 3))**2) + edge_length = sqrt((tri(2, 1) - tri(1, 1))**2 + & + (tri(2, 2) - tri(1, 2))**2 + & + (tri(2, 3) - tri(1, 3))**2) ! Determine the number of segments and interpolation step if (edge_length > cell_width) then @@ -987,7 +987,7 @@ contains edge_del(3) = (tri(2, 3) - tri(1, 3))/num_segments else num_segments = 1 - edge_del = 0d0 + edge_del = 0._wp end if ! Add original and interpolated vertices to the output array @@ -1020,11 +1020,11 @@ contains call random_number(bary_coord(1)) call random_number(bary_coord(2)) - if ((bary_coord(1) + bary_coord(2)) >= 1.0d0) then - bary_coord(1) = 1d0 - bary_coord(1) - bary_coord(2) = 1d0 - bary_coord(2) + if ((bary_coord(1) + bary_coord(2)) >= 1._wp) then + bary_coord(1) = 1._wp - bary_coord(1) + bary_coord(2) = 1._wp - bary_coord(2) end if - bary_coord(3) = 1d0 - bary_coord(1) - bary_coord(2) + bary_coord(3) = 1._wp - bary_coord(1) - bary_coord(2) total_vertices = total_vertices + 1 interpolated_boundary_v(total_vertices, 1) = dot_product(bary_coord, tri(1:3, 1)) @@ -1045,19 +1045,19 @@ contains type(t_model), intent(IN) :: model t_vec3, intent(in) :: point t_vec3, intent(out) :: normals - real(kind(0d0)), intent(out) :: distance + real(wp), intent(out) :: distance - real(kind(0d0)), dimension(1:model%ntrs, 1:3) :: tri_normals - real(kind(0d0)), dimension(1:3, 1:3) :: tri - real(kind(0d0)) :: dist_min, dist_t_min - real(kind(0d0)) :: dist_min_normal, dist_buffer_normal + real(wp), dimension(1:model%ntrs, 1:3) :: tri_normals + real(wp), dimension(1:3, 1:3) :: tri + real(wp) :: dist_min, dist_t_min + real(wp) :: dist_min_normal, dist_buffer_normal t_vec3 :: midp !< Centers of the triangle facets t_vec3 :: dist_buffer !< Distance between the cell center and the vertices integer :: i, j, tri_idx !< Iterator - dist_min = 1d12 - dist_min_normal = 1d12 - distance = 0d0 + dist_min = 1e12_wp + dist_min_normal = 1e12_wp + distance = 0._wp tri_idx = 0 do i = 1, model%ntrs @@ -1065,9 +1065,9 @@ contains tri(j, 1) = model%trs(i)%v(j, 1) tri(j, 2) = model%trs(i)%v(j, 2) tri(j, 3) = model%trs(i)%v(j, 3) - dist_buffer(j) = dsqrt((point(1) - tri(j, 1))**2 + & - (point(2) - tri(j, 2))**2 + & - (point(3) - tri(j, 3))**2) + dist_buffer(j) = sqrt((point(1) - tri(j, 1))**2 + & + (point(2) - tri(j, 2))**2 + & + (point(3) - tri(j, 3))**2) end do ! Get the surface center of each triangle facet @@ -1076,9 +1076,9 @@ contains end do dist_t_min = minval(dist_buffer(1:3)) - dist_buffer_normal = dsqrt((point(1) - midp(1))**2 + & - (point(2) - midp(2))**2 + & - (point(3) - midp(3))**2) + dist_buffer_normal = sqrt((point(1) - midp(1))**2 + & + (point(2) - midp(2))**2 + & + (point(3) - midp(3))**2) if (dist_t_min < dist_min) then dist_min = dist_t_min @@ -1106,21 +1106,21 @@ contains !! @return Distance which the levelset distance without interpolation function f_distance(boundary_v, boundary_vertex_count, boundary_edge_count, point, spacing) result(distance) integer, intent(in) :: boundary_vertex_count, boundary_edge_count - real(kind(0d0)), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v + real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v t_vec3, intent(in) :: point t_vec3, intent(in) :: spacing integer :: i - real(kind(0d0)) :: dist_buffer1, dist_buffer2 - real(kind(0d0)), dimension(1:boundary_edge_count) :: dist_buffer - real(kind(0d0)) :: distance + real(wp) :: dist_buffer1, dist_buffer2 + real(wp), dimension(1:boundary_edge_count) :: dist_buffer + real(wp) :: distance - distance = 0d0 + distance = 0._wp do i = 1, boundary_edge_count - dist_buffer1 = dsqrt((point(1) - boundary_v(i, 1, 1))**2 + & + dist_buffer1 = sqrt((point(1) - boundary_v(i, 1, 1))**2 + & & (point(2) - boundary_v(i, 1, 2))**2) - dist_buffer2 = dsqrt((point(1) - boundary_v(i, 2, 1))**2 + & + dist_buffer2 = sqrt((point(1) - boundary_v(i, 2, 1))**2 + & & (point(2) - boundary_v(i, 2, 2))**2) dist_buffer(i) = minval((/dist_buffer1, dist_buffer2/)) @@ -1139,25 +1139,25 @@ contains !! @param normals Output levelset normals without interpolation subroutine f_normals(boundary_v, boundary_vertex_count, boundary_edge_count, point, spacing, normals) integer, intent(in) :: boundary_vertex_count, boundary_edge_count - real(kind(0d0)), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v + real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v t_vec3, intent(in) :: point t_vec3, intent(in) :: spacing t_vec3, intent(out) :: normals integer :: i, idx_buffer - real(kind(0d0)) :: dist_min, dist_buffer - real(kind(0d0)) :: midp(1:3) + real(wp) :: dist_min, dist_buffer + real(wp) :: midp(1:3) - dist_buffer = 0d0 + dist_buffer = 0._wp dist_min = initial_distance_buffer idx_buffer = 0 do i = 1, boundary_edge_count midp(1) = (boundary_v(i, 2, 1) + boundary_v(i, 1, 1))/2 midp(2) = (boundary_v(i, 2, 2) + boundary_v(i, 1, 2))/2 - midp(3) = 0d0 + midp(3) = 0._wp - dist_buffer = dsqrt((point(1) - midp(1))**2 + & + dist_buffer = sqrt((point(1) - midp(1))**2 + & & (point(2) - midp(2))**2) if (dist_buffer < dist_min) then @@ -1168,7 +1168,7 @@ contains normals(1) = boundary_v(idx_buffer, 3, 1) normals(2) = boundary_v(idx_buffer, 3, 2) - normals(3) = 0d0 + normals(3) = 0._wp end subroutine f_normals @@ -1180,22 +1180,22 @@ contains !! @return Distance which the levelset distance without interpolation function f_interpolated_distance(interpolated_boundary_v, total_vertices, point, spacing) result(distance) integer, intent(in) :: total_vertices - real(kind(0d0)), intent(in), dimension(1:total_vertices, 1:3) :: interpolated_boundary_v + real(wp), intent(in), dimension(1:total_vertices, 1:3) :: interpolated_boundary_v t_vec3, intent(in) :: point t_vec3, intent(in) :: spacing integer :: i !< Loop iterator - real(kind(0d0)) :: dist_buffer, min_dist - real(kind(0d0)) :: distance + real(wp) :: dist_buffer, min_dist + real(wp) :: distance distance = initial_distance_buffer dist_buffer = initial_distance_buffer min_dist = initial_distance_buffer do i = 1, total_vertices - dist_buffer = dsqrt((point(1) - interpolated_boundary_v(i, 1))**2 + & - (point(2) - interpolated_boundary_v(i, 2))**2 + & - (point(3) - interpolated_boundary_v(i, 3))**2) + dist_buffer = sqrt((point(1) - interpolated_boundary_v(i, 1))**2 + & + (point(2) - interpolated_boundary_v(i, 2))**2 + & + (point(3) - interpolated_boundary_v(i, 3))**2) if (min_dist > dist_buffer) then min_dist = dist_buffer @@ -1208,9 +1208,9 @@ contains !> This procedure calculates the barycentric facet area function f_tri_area(tri) result(tri_area) - real(kind(0d0)), dimension(1:3, 1:3), intent(in) :: tri + real(wp), dimension(1:3, 1:3), intent(in) :: tri t_vec3 :: AB, AC, cross - real(kind(0d0)) :: tri_area + real(wp) :: tri_area integer :: i !< Loop iterator do i = 1, 3 @@ -1221,7 +1221,7 @@ contains cross(1) = AB(2)*AC(3) - AB(3)*AC(2) cross(2) = AB(3)*AC(1) - AB(1)*AC(3) cross(3) = AB(1)*AC(2) - AB(2)*AC(1) - tri_area = 0.5d0*dsqrt(cross(1)**2 + cross(2)**2 + cross(3)**2) + tri_area = 0.5_wp*sqrt(cross(1)**2 + cross(2)**2 + cross(3)**2) end function f_tri_area diff --git a/src/pre_process/m_mpi_proxy.fpp b/src/pre_process/m_mpi_proxy.fpp index c68767c41..4673d3424 100644 --- a/src/pre_process/m_mpi_proxy.fpp +++ b/src/pre_process/m_mpi_proxy.fpp @@ -69,7 +69,7 @@ contains & 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV', 'palpha_eps', & & 'ptgalpha_eps', 'sigma', 'pi_fac', 'mixlayer_vel_coef', & & 'mixlayer_domain' ] - call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor do i = 1, num_patches_max @@ -85,14 +85,14 @@ contains & 'beta', 'smooth_coeff', 'rho', 'p0', 'm0', 'r0', 'v0', & & 'pres', 'gamma', 'pi_inf', 'hcid', 'cv', 'qv', 'qvp', & & 'model_threshold', 'cf_val'] - call MPI_BCAST(patch_icpp(i)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(patch_icpp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(patch_icpp(i)%model_filepath, len(patch_icpp(i)%model_filepath), MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) #:for VAR in [ 'model_translate', 'model_scale', 'model_rotate', & 'normal', 'radii', 'vel', 'tau_e', 'alpha_rho', 'alpha' ] - call MPI_BCAST(patch_icpp(i)%${VAR}$, size(patch_icpp(i)%${VAR}$), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(patch_icpp(i)%${VAR}$, size(patch_icpp(i)%${VAR}$), mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(patch_icpp(i)%model_spc, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) @@ -105,7 +105,7 @@ contains #:for VAR in [ 'x_centroid', 'y_centroid', 'z_centroid', & & 'length_x', 'length_y', 'length_z', 'radius', 'c', 'p', 't', 'm', 'theta', 'slip'] - call MPI_BCAST(patch_ib(i)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor #:for VAR in [ 'model_translate', 'model_scale', 'model_rotate'] @@ -117,7 +117,7 @@ contains do i = 1, num_fluids_max #:for VAR in [ 'gamma','pi_inf','mul0','ss','pv','gamma_v','M_v', & & 'mu_v','k_v', 'G', 'cv', 'qv', 'qvp' ] - call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do #endif @@ -138,10 +138,10 @@ contains ! Temporary # of processors in x-, y- and z-coordinate directions ! used during the processor factorization optimization procedure - real(kind(0d0)) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z + real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z ! Processor factorization (fct) minimization parameter - real(kind(0d0)) :: fct_min + real(wp) :: fct_min ! Cartesian processor topology communicator integer :: MPI_COMM_CART @@ -187,8 +187,8 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -231,10 +231,10 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) & - + 10d0*abs((n + 1)/tmp_num_procs_y & - - (p + 1)/tmp_num_procs_z) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) & + + 10._wp*abs((n + 1)/tmp_num_procs_y & + - (p + 1)/tmp_num_procs_z) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -313,7 +313,7 @@ contains ! Preliminary uniform cell-width spacing if (old_grid .neqv. .true.) then - dz = (z_domain%end - z_domain%beg)/real(p + 1, kind(0d0)) + dz = (z_domain%end - z_domain%beg)/real(p + 1, wp) end if ! Optimal number of cells per processor @@ -365,8 +365,8 @@ contains ! Computing minimization variable for these initial values tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -428,7 +428,7 @@ contains ! Preliminary uniform cell-width spacing if (old_grid .neqv. .true.) then - dy = (y_domain%end - y_domain%beg)/real(n + 1, kind(0d0)) + dy = (y_domain%end - y_domain%beg)/real(n + 1, wp) end if ! Optimal number of cells per processor @@ -497,7 +497,7 @@ contains ! Preliminary uniform cell-width spacing if (old_grid .neqv. .true.) then - dx = (x_domain%end - x_domain%beg)/real(m + 1, kind(0d0)) + dx = (x_domain%end - x_domain%beg)/real(m + 1, wp) end if ! Optimal number of cells per processor diff --git a/src/pre_process/m_patches.fpp b/src/pre_process/m_patches.fpp index d0a00c3c4..d3151a717 100644 --- a/src/pre_process/m_patches.fpp +++ b/src/pre_process/m_patches.fpp @@ -54,24 +54,24 @@ module m_patches s_sweep_plane, & s_model - real(kind(0d0)) :: x_centroid, y_centroid, z_centroid - real(kind(0d0)) :: length_x, length_y, length_z + real(wp) :: x_centroid, y_centroid, z_centroid + real(wp) :: length_x, length_y, length_z integer :: smooth_patch_id - real(kind(0d0)) :: smooth_coeff !< + real(wp) :: smooth_coeff !< !! These variables are analogous in both meaning and use to the similarly !! named components in the ic_patch_parameters type (see m_derived_types.f90 !! for additional details). They are employed as a means to more concisely !! perform the actions necessary to lay out a particular patch on the grid. - real(kind(0d0)) :: eta !< + real(wp) :: eta !< !! In the case that smoothing of patch boundaries is enabled and the boundary !! between two adjacent patches is to be smeared out, this variable's purpose !! is to act as a pseudo volume fraction to indicate the contribution of each !! patch toward the composition of a cell's fluid state. - real(kind(0d0)) :: cart_y, cart_z - real(kind(0d0)) :: sph_phi !< + real(wp) :: cart_y, cart_z + real(wp) :: sph_phi !< !! Variables to be used to hold cell locations in Cartesian coordinates if !! 3D simulation is using cylindrical coordinates @@ -99,13 +99,13 @@ contains integer, dimension(0:m, 0:n, 0:p), intent(inout) :: patch_id_fp type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)) :: pi_inf, gamma, lit_gamma + real(wp) :: pi_inf, gamma, lit_gamma integer :: i, j, k !< Generic loop operators pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the line segment's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -113,14 +113,14 @@ contains ! Computing the beginning and end x-coordinates of the line segment ! based on its centroid and length - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x ! Since the line segment patch does not allow for its boundaries to ! be smoothed out, the pseudo volume fraction is set to 1 to ensure ! that only the current patch contributes to the fluid state in the ! cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the line segment covers a particular cell in the ! domain and verifying whether the current patch has the permission @@ -137,7 +137,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, 0, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, 0, 0) = patch_id end if end do @@ -158,8 +158,8 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< Generic loop iterators - real(kind(0d0)) :: th, thickness, nturns, mya - real(kind(0d0)) :: spiral_x_min, spiral_x_max, spiral_y_min, spiral_y_max + real(wp) :: th, thickness, nturns, mya + real(wp) :: spiral_x_min, spiral_x_max, spiral_y_min, spiral_y_max ! Transferring the circular patch's radius, centroid, smearing patch ! identity and smearing coefficient information @@ -172,16 +172,16 @@ contains ! logic_grid = 0 do k = 0, int(m*91*nturns) - th = k/real(int(m*91d0*nturns))*nturns*2.d0*pi + th = k/real(int(m*91._wp*nturns))*nturns*2._wp*pi - spiral_x_min = minval((/f_r(th, 0.0d0, mya)*cos(th), & + spiral_x_min = minval((/f_r(th, 0.0_wp, mya)*cos(th), & f_r(th, thickness, mya)*cos(th)/)) - spiral_y_min = minval((/f_r(th, 0.0d0, mya)*sin(th), & + spiral_y_min = minval((/f_r(th, 0.0_wp, mya)*sin(th), & f_r(th, thickness, mya)*sin(th)/)) - spiral_x_max = maxval((/f_r(th, 0.0d0, mya)*cos(th), & + spiral_x_max = maxval((/f_r(th, 0.0_wp, mya)*cos(th), & f_r(th, thickness, mya)*cos(th)/)) - spiral_y_max = maxval((/f_r(th, 0.0d0, mya)*sin(th), & + spiral_y_max = maxval((/f_r(th, 0.0_wp, mya)*sin(th), & f_r(th, thickness, mya)*sin(th)/)) do j = 0, n; do i = 0, m; @@ -201,7 +201,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id end if end do end do @@ -224,7 +224,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf logical, optional, intent(in) :: ib - real(kind(0d0)) :: radius + real(wp) :: radius integer :: i, j, k !< Generic loop iterators @@ -246,7 +246,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smoothing of the circular patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the circle covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -261,7 +261,7 @@ contains eta = tanh(smooth_coeff/min(dx, dy)* & (sqrt((x_cc(i) - x_centroid)**2 & + (y_cc(j) - y_centroid)**2) & - - radius))*(-0.5d0) + 0.5d0 + - radius))*(-0.5_wp) + 0.5_wp end if @@ -301,7 +301,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf logical, optional, intent(in) :: ib - real(kind(0d0)) :: x0, y0, f, x_act, y_act, ca, pa, ma, ta, theta, xa, ya, yt, xu, yu, xl, yl, xc, yc, dycdxc, sin_c, cos_c + real(wp) :: x0, y0, f, x_act, y_act, ca, pa, ma, ta, theta, xa, ya, yt, xu, yu, xl, yl, xc, yc, dycdxc, sin_c, cos_c integer :: i, j, k, l integer :: Np1, Np2 @@ -312,7 +312,7 @@ contains pa = patch_ib(patch_id)%p ma = patch_ib(patch_id)%m ta = patch_ib(patch_id)%t - theta = pi*patch_ib(patch_id)%theta/180d0 + theta = pi*patch_ib(patch_id)%theta/180._wp Np1 = int((pa*ca/dx)*20) Np2 = int(((ca - pa*ca)/dx)*20) @@ -327,7 +327,7 @@ contains airfoil_grid_l(1)%x = x0 airfoil_grid_l(1)%y = y0 - eta = 1d0 + eta = 1._wp do i = 1, Np1 + Np2 - 1 if (i <= Np1) then @@ -342,9 +342,9 @@ contains dycdxc = (2*ma/(1 - pa)**2)*(pa - xa) end if - yt = (5d0*ta)*(0.2969*xa**0.5d0 - 0.126*xa - 0.3516*xa**2d0 + 0.2843*xa**3 - 0.1015*xa**4) - sin_c = dycdxc/(1 + dycdxc**2)**0.5 - cos_c = 1/(1 + dycdxc**2)**0.5 + yt = (5._wp*ta)*(0.2969_wp*xa**0.5_wp - 0.126_wp*xa - 0.3516_wp*xa**2._wp + 0.2843_wp*xa**3 - 0.1015_wp*xa**4) + sin_c = dycdxc/(1 + dycdxc**2)**0.5_wp + cos_c = 1/(1 + dycdxc**2)**0.5_wp xu = xa - yt*sin_c yu = yc + yt*cos_c @@ -406,7 +406,7 @@ contains end if else f = (airfoil_grid_u(k)%x - x_act)/(airfoil_grid_u(k)%x - airfoil_grid_u(k - 1)%x) - if (y_act <= ((1d0 - f)*airfoil_grid_u(k)%y + f*airfoil_grid_u(k - 1)%y)) then + if (y_act <= ((1._wp - f)*airfoil_grid_u(k)%y + f*airfoil_grid_u(k - 1)%y)) then !!IB !call s_assign_patch_primitive_variables(patch_id, i, j, 0, & !eta, q_prim_vf, patch_id_fp) @@ -428,7 +428,7 @@ contains else f = (airfoil_grid_l(k)%x - x_act)/(airfoil_grid_l(k)%x - airfoil_grid_l(k - 1)%x) - if (y_act >= ((1d0 - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then + if (y_act >= ((1._wp - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then !!IB !call s_assign_patch_primitive_variables(patch_id, i, j, 0, & !eta, q_prim_vf, patch_id_fp) @@ -443,10 +443,10 @@ contains if (.not. f_is_default(patch_ib(patch_id)%theta)) then do i = 1, Np airfoil_grid_l(i)%x = (airfoil_grid_l(i)%x - x0)*cos(theta) + (airfoil_grid_l(i)%y - y0)*sin(theta) + x0 - airfoil_grid_l(i)%y = -1d0*(airfoil_grid_l(i)%x - x0)*sin(theta) + (airfoil_grid_l(i)%y - y0)*cos(theta) + y0 + airfoil_grid_l(i)%y = -1._wp*(airfoil_grid_l(i)%x - x0)*sin(theta) + (airfoil_grid_l(i)%y - y0)*cos(theta) + y0 airfoil_grid_u(i)%x = (airfoil_grid_u(i)%x - x0)*cos(theta) + (airfoil_grid_u(i)%y - y0)*sin(theta) + x0 - airfoil_grid_u(i)%y = -1d0*(airfoil_grid_u(i)%x - x0)*sin(theta) + (airfoil_grid_u(i)%y - y0)*cos(theta) + y0 + airfoil_grid_u(i)%y = -1._wp*(airfoil_grid_u(i)%x - x0)*sin(theta) + (airfoil_grid_u(i)%y - y0)*cos(theta) + y0 end do end if @@ -463,7 +463,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf logical, optional, intent(in) :: ib - real(kind(0d0)) :: x0, y0, z0, lz, z_max, z_min, f, x_act, y_act, ca, pa, ma, ta, theta, xa, ya, yt, xu, yu, xl, yl, xc, yc, dycdxc, sin_c, cos_c + real(wp) :: x0, y0, z0, lz, z_max, z_min, f, x_act, y_act, ca, pa, ma, ta, theta, xa, ya, yt, xu, yu, xl, yl, xc, yc, dycdxc, sin_c, cos_c integer :: i, j, k, l integer :: Np1, Np2 @@ -476,7 +476,7 @@ contains pa = patch_ib(patch_id)%p ma = patch_ib(patch_id)%m ta = patch_ib(patch_id)%t - theta = pi*patch_ib(patch_id)%theta/180d0 + theta = pi*patch_ib(patch_id)%theta/180._wp Np1 = int((pa*ca/dx)*20) Np2 = int(((ca - pa*ca)/dx)*20) @@ -494,7 +494,7 @@ contains z_max = z0 + lz/2 z_min = z0 - lz/2 - eta = 1d0 + eta = 1._wp do i = 1, Np1 + Np2 - 1 if (i <= Np1) then @@ -509,9 +509,9 @@ contains dycdxc = (2*ma/(1 - pa)**2)*(pa - xa) end if - yt = (5d0*ta)*(0.2969*xa**0.5d0 - 0.126*xa - 0.3516*xa**2d0 + 0.2843*xa**3 - 0.1015*xa**4) - sin_c = dycdxc/(1 + dycdxc**2)**0.5 - cos_c = 1/(1 + dycdxc**2)**0.5 + yt = (5._wp*ta)*(0.2969_wp*xa**0.5_wp - 0.126_wp*xa - 0.3516_wp*xa**2._wp + 0.2843_wp*xa**3 - 0.1015_wp*xa**4) + sin_c = dycdxc/(1 + dycdxc**2)**0.5_wp + cos_c = 1/(1 + dycdxc**2)**0.5_wp xu = xa - yt*sin_c yu = yc + yt*cos_c @@ -575,7 +575,7 @@ contains end if else f = (airfoil_grid_u(k)%x - x_act)/(airfoil_grid_u(k)%x - airfoil_grid_u(k - 1)%x) - if (y_act <= ((1d0 - f)*airfoil_grid_u(k)%y + f*airfoil_grid_u(k - 1)%y)) then + if (y_act <= ((1._wp - f)*airfoil_grid_u(k)%y + f*airfoil_grid_u(k - 1)%y)) then !!IB !call s_assign_patch_primitive_variables(patch_id, i, j, 0, & !eta, q_prim_vf, patch_id_fp) @@ -597,7 +597,7 @@ contains else f = (airfoil_grid_l(k)%x - x_act)/(airfoil_grid_l(k)%x - airfoil_grid_l(k - 1)%x) - if (y_act >= ((1d0 - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then + if (y_act >= ((1._wp - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then !!IB !call s_assign_patch_primitive_variables(patch_id, i, j, 0, & !eta, q_prim_vf, patch_id_fp) @@ -614,10 +614,10 @@ contains if (.not. f_is_default(patch_ib(patch_id)%theta)) then do i = 1, Np airfoil_grid_l(i)%x = (airfoil_grid_l(i)%x - x0)*cos(theta) + (airfoil_grid_l(i)%y - y0)*sin(theta) + x0 - airfoil_grid_l(i)%y = -1d0*(airfoil_grid_l(i)%x - x0)*sin(theta) + (airfoil_grid_l(i)%y - y0)*cos(theta) + y0 + airfoil_grid_l(i)%y = -1._wp*(airfoil_grid_l(i)%x - x0)*sin(theta) + (airfoil_grid_l(i)%y - y0)*cos(theta) + y0 airfoil_grid_u(i)%x = (airfoil_grid_u(i)%x - x0)*cos(theta) + (airfoil_grid_u(i)%y - y0)*sin(theta) + x0 - airfoil_grid_u(i)%y = -1d0*(airfoil_grid_u(i)%x - x0)*sin(theta) + (airfoil_grid_u(i)%y - y0)*cos(theta) + y0 + airfoil_grid_u(i)%y = -1._wp*(airfoil_grid_u(i)%x - x0)*sin(theta) + (airfoil_grid_u(i)%y - y0)*cos(theta) + y0 end do end if @@ -637,7 +637,7 @@ contains ! Generic loop iterators integer :: i, j, k - real(kind(0d0)) :: radius, myr, thickness + real(wp) :: radius, myr, thickness ! Transferring the circular patch's radius, centroid, smearing patch ! identity and smearing coefficient information @@ -651,7 +651,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smoothing of the circular patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the circle covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -659,11 +659,11 @@ contains ! the current patch are assigned to this cell. do j = 0, n do i = 0, m - myr = dsqrt((x_cc(i) - x_centroid)**2 & - + (y_cc(j) - y_centroid)**2) + myr = sqrt((x_cc(i) - x_centroid)**2 & + + (y_cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2.d0 .and. & - myr >= radius - thickness/2.d0 .and. & + if (myr <= radius + thickness/2._wp .and. & + myr >= radius - thickness/2._wp .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, & @@ -672,10 +672,10 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id q_prim_vf(alf_idx)%sf(i, j, 0) = patch_icpp(patch_id)%alpha(1)* & - dexp(-0.5d0*((myr - radius)**2.d0)/(thickness/3.d0)**2.d0) + exp(-0.5_wp*((myr - radius)**2._wp)/(thickness/3._wp)**2._wp) end if end do @@ -695,7 +695,7 @@ contains ! Generic loop iterators integer :: i, j, k - real(kind(0d0)) :: radius, myr, thickness + real(wp) :: radius, myr, thickness ! Transferring the circular patch's radius, centroid, smearing patch ! identity and smearing coefficient information @@ -711,7 +711,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smoothing of the circular patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! write for all z @@ -722,11 +722,11 @@ contains do k = 0, p do j = 0, n do i = 0, m - myr = dsqrt((x_cc(i) - x_centroid)**2 & - + (y_cc(j) - y_centroid)**2) + myr = sqrt((x_cc(i) - x_centroid)**2 & + + (y_cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2.d0 .and. & - myr >= radius - thickness/2.d0 .and. & + if (myr <= radius + thickness/2._wp .and. & + myr >= radius - thickness/2._wp .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) then call s_assign_patch_primitive_variables(patch_id, i, j, k, & @@ -735,10 +735,10 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id q_prim_vf(alf_idx)%sf(i, j, k) = patch_icpp(patch_id)%alpha(1)* & - dexp(-0.5d0*((myr - radius)**2.d0)/(thickness/3.d0)**2.d0) + exp(-0.5_wp*((myr - radius)**2._wp)/(thickness/3._wp)**2._wp) end if end do @@ -761,7 +761,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< Generic loop operators - real(kind(0d0)) :: a, b + real(wp) :: a, b ! Transferring the elliptical patch's radii, centroid, smearing ! patch identity, and smearing coefficient information @@ -776,7 +776,7 @@ contains ! be modified as the patch is laid out on the grid, but only in ! the case that smoothing of the elliptical patch's boundary is ! enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the ellipse covers a particular cell in the ! domain and verifying whether the current patch has permission @@ -789,11 +789,11 @@ contains eta = tanh(smooth_coeff/min(dx, dy)* & (sqrt(((x_cc(i) - x_centroid)/a)**2 + & ((y_cc(j) - y_centroid)/b)**2) & - - 1d0))*(-0.5d0) + 0.5d0 + - 1._wp))*(-0.5_wp) + 0.5_wp end if if ((((x_cc(i) - x_centroid)/a)**2 + & - ((y_cc(j) - y_centroid)/b)**2 <= 1d0 & + ((y_cc(j) - y_centroid)/b)**2 <= 1._wp & .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) & .or. & @@ -806,7 +806,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id end if end do end do @@ -829,7 +829,7 @@ contains ! Generic loop iterators integer :: i, j, k - real(kind(0d0)) :: a, b, c + real(wp) :: a, b, c ! Transferring the ellipsoidal patch's radii, centroid, smearing ! patch identity, and smearing coefficient information @@ -846,7 +846,7 @@ contains ! be modified as the patch is laid out on the grid, but only in ! the case that smoothing of the ellipsoidal patch's boundary is ! enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the ellipsoid covers a particular cell in the ! domain and verifying whether the current patch has permission @@ -868,12 +868,12 @@ contains (sqrt(((x_cc(i) - x_centroid)/a)**2 + & ((cart_y - y_centroid)/b)**2 + & ((cart_z - z_centroid)/c)**2) & - - 1d0))*(-0.5d0) + 0.5d0 + - 1._wp))*(-0.5_wp) + 0.5_wp end if if ((((x_cc(i) - x_centroid)/a)**2 + & ((cart_y - y_centroid)/b)**2 + & - ((cart_z - z_centroid)/c)**2 <= 1d0 & + ((cart_z - z_centroid)/c)**2 <= 1._wp & .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) & .or. & @@ -886,7 +886,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id end if end do end do @@ -914,11 +914,11 @@ contains logical, optional, intent(in) :: ib !< True if this patch is an immersed boundary integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: pi_inf, gamma, lit_gamma !< Equation of state parameters + real(wp) :: pi_inf, gamma, lit_gamma !< Equation of state parameters pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the rectangle's centroid and length information if (present(ib)) then @@ -935,16 +935,16 @@ contains ! Computing the beginning and the end x- and y-coordinates of the ! rectangle based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y ! Since the rectangular patch does not allow for its boundaries to ! be smoothed out, the pseudo volume fraction is set to 1 to ensure ! that only the current patch contributes to the fluid state in the ! cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the rectangle covers a particular cell in the ! domain and verifying whether the current patch has the permission @@ -971,12 +971,12 @@ contains if ((q_prim_vf(1)%sf(i, j, 0) < 1.e-10) .and. (model_eqns == 4)) then !zero density, reassign according to Tait EOS q_prim_vf(1)%sf(i, j, 0) = & - (((q_prim_vf(E_idx)%sf(i, j, 0) + pi_inf)/(pref + pi_inf))**(1d0/lit_gamma))* & - rhoref*(1d0 - q_prim_vf(alf_idx)%sf(i, j, 0)) + (((q_prim_vf(E_idx)%sf(i, j, 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))* & + rhoref*(1._wp - q_prim_vf(alf_idx)%sf(i, j, 0)) end if ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id end if end if @@ -1003,7 +1003,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< Generic loop operators - real(kind(0d0)) :: a, b, c + real(wp) :: a, b, c ! Transferring the centroid information of the line to be swept x_centroid = patch_icpp(patch_id)%x_centroid @@ -1019,7 +1019,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smoothing of the sweep line patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the region swept by the line covers a particular ! cell in the domain and verifying whether the current patch has the @@ -1029,12 +1029,12 @@ contains do i = 0, m if (patch_icpp(patch_id)%smoothen) then - eta = 5d-1 + 5d-1*tanh(smooth_coeff/min(dx, dy) & - *(a*x_cc(i) + b*y_cc(j) + c) & - /sqrt(a**2 + b**2)) + eta = 5e-1_wp + 5e-1_wp*tanh(smooth_coeff/min(dx, dy) & + *(a*x_cc(i) + b*y_cc(j) + c) & + /sqrt(a**2 + b**2)) end if - if ((a*x_cc(i) + b*y_cc(j) + c >= 0d0 & + if ((a*x_cc(i) + b*y_cc(j) + c >= 0._wp & .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) & .or. & @@ -1046,7 +1046,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id end if end do @@ -1068,12 +1068,12 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: pi_inf, gamma, lit_gamma !< equation of state parameters - real(kind(0d0)) :: L0, U0 !< Taylor Green Vortex parameters + real(wp) :: pi_inf, gamma, lit_gamma !< equation of state parameters + real(wp) :: L0, U0 !< Taylor Green Vortex parameters pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the patch's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1083,16 +1083,16 @@ contains ! Computing the beginning and the end x- and y-coordinates ! of the patch based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y ! Since the patch doesn't allow for its boundaries to be ! smoothed out, the pseudo volume fraction is set to 1 to ! ensure that only the current patch contributes to the fluid ! state in the cells that this patch covers. - eta = 1d0 + eta = 1._wp ! U0 is the characteristic velocity of the vortex U0 = patch_icpp(patch_id)%vel(1) ! L0 is the characteristic length of the vortex @@ -1116,7 +1116,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id ! Assign Parameters ========================================================= q_prim_vf(mom_idx%beg)%sf(i, j, 0) = U0*sin(x_cc(i)/L0)*cos(y_cc(j)/L0) @@ -1147,13 +1147,13 @@ contains ! Generic loop iterators integer :: i, j, k ! Placeholders for the cell boundary values - real(kind(0d0)) :: a, b, c, d, pi_inf, gamma, lit_gamma + real(wp) :: a, b, c, d, pi_inf, gamma, lit_gamma @:Hardcoded1DVariables() pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the patch's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1161,14 +1161,14 @@ contains ! Computing the beginning and the end x- and y-coordinates ! of the patch based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x ! Since the patch doesn't allow for its boundaries to be ! smoothed out, the pseudo volume fraction is set to 1 to ! ensure that only the current patch contributes to the fluid ! state in the cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the line segment covers a particular cell in the ! domain and verifying whether the current patch has the permission @@ -1185,7 +1185,7 @@ contains @:Hardcoded1D() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, 0, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, 0, 0) = patch_id end if end do @@ -1207,11 +1207,11 @@ contains ! Generic loop iterators integer :: i, j, k ! Placeholders for the cell boundary values - real(kind(0d0)) :: fac, a, b, c, d, pi_inf, gamma, lit_gamma + real(wp) :: fac, a, b, c, d, pi_inf, gamma, lit_gamma pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the patch's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1219,14 +1219,14 @@ contains ! Computing the beginning and the end x- and y-coordinates ! of the patch based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x ! Since the patch doesn't allow for its boundaries to be ! smoothed out, the pseudo volume fraction is set to 1 to ! ensure that only the current patch contributes to the fluid ! state in the cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the line segment covers a particular cell in the ! domain and verifying whether the current patch has the permission @@ -1259,15 +1259,15 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: a, b, c, d !< placeholderrs for the cell boundary values - real(kind(0d0)) :: pi_inf, gamma, lit_gamma !< equation of state parameters - real(kind(0d0)) :: l, U0 !< Taylor Green Vortex parameters + real(wp) :: a, b, c, d !< placeholderrs for the cell boundary values + real(wp) :: pi_inf, gamma, lit_gamma !< equation of state parameters + real(wp) :: l, U0 !< Taylor Green Vortex parameters @:Hardcoded2DVariables() pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the patch's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1277,18 +1277,18 @@ contains ! Computing the beginning and the end x- and y-coordinates ! of the patch based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y ! Since the patch doesn't allow for its boundaries to be ! smoothed out, the pseudo volume fraction is set to 1 to ! ensure that only the current patch contributes to the fluid ! state in the cells that this patch covers. - eta = 1d0 - l = 1d0 - U0 = 0.1 + eta = 1._wp + l = 1._wp + U0 = 0.1_wp ! Checking whether the patch covers a particular cell in the ! domain and verifying whether the current patch has the ! permission to write to that cell. If both queries check out, @@ -1308,7 +1308,7 @@ contains @:Hardcoded2D() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, 0) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, 0) = patch_id end if end do @@ -1328,13 +1328,13 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: pi_inf, gamma, lit_gamma !< equation of state parameters + real(wp) :: pi_inf, gamma, lit_gamma !< equation of state parameters @:Hardcoded3DVariables() pi_inf = fluid_pp(1)%pi_inf gamma = fluid_pp(1)%gamma - lit_gamma = (1d0 + gamma)/gamma + lit_gamma = (1._wp + gamma)/gamma ! Transferring the patch's centroid and length information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1346,18 +1346,18 @@ contains ! Computing the beginning and the end x-, y- and z-coordinates of ! the patch based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y - z_boundary%beg = z_centroid - 0.5d0*length_z - z_boundary%end = z_centroid + 0.5d0*length_z + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y + z_boundary%beg = z_centroid - 0.5_wp*length_z + z_boundary%end = z_centroid + 0.5_wp*length_z ! Since the analytical patch does not allow for its boundaries to get ! smoothed out, the pseudo volume fraction is set to 1 to make sure ! that only the current patch contributes to the fluid state in the ! cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the patch covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -1390,7 +1390,7 @@ contains @:Hardcoded3D() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id end if @@ -1412,9 +1412,9 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: radius, epsilon, beta - complex(kind(0d0)) :: cmplx_i = (0d0, 1d0) - complex(kind(0d0)) :: H + real(wp) :: radius, epsilon, beta + complex(wp) :: cmplx_i = (0._wp, 1._wp) + complex(wp) :: H ! Transferring the patch's centroid and radius information x_centroid = patch_icpp(patch_id)%x_centroid @@ -1428,7 +1428,7 @@ contains ! smoothed out, the pseudo volume fraction is set to 1 to make sure ! that only the current patch contributes to the fluid state in the ! cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the patch covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -1454,72 +1454,72 @@ contains call s_convert_cylindrical_to_spherical_coord(x_cc(i), y_cc(j)) - if (epsilon == 1d0) then - if (beta == 0d0) then - H = 5d-1*sqrt(3d0/pi)*cos(sph_phi) - elseif (beta == 1d0) then - H = -5d-1*sqrt(3d0/(2d0*pi))*exp(cmplx_i*z_cc(k))*sin(sph_phi) + if (epsilon == 1._wp) then + if (beta == 0._wp) then + H = 5e-1_wp*sqrt(3._wp/pi)*cos(sph_phi) + elseif (beta == 1._wp) then + H = -5e-1_wp*sqrt(3._wp/(2._wp*pi))*exp(cmplx_i*z_cc(k))*sin(sph_phi) end if - elseif (epsilon == 2d0) then - if (beta == 0d0) then - H = 25d-2*sqrt(5d0/pi)*(3d0*cos(sph_phi)**2 - 1d0) - elseif (beta == 1d0) then - H = -5d-1*sqrt(15d0/(2d0*pi))*exp(cmplx_i*z_cc(k))*sin(sph_phi)*cos(sph_phi) - elseif (beta == 2d0) then - H = 25d-2*sqrt(15d0/(2d0*pi))*exp(2d0*cmplx_i*z_cc(k))*sin(sph_phi)**2 + elseif (epsilon == 2._wp) then + if (beta == 0._wp) then + H = 25e-2_wp*sqrt(5._wp/pi)*(3._wp*cos(sph_phi)**2 - 1._wp) + elseif (beta == 1._wp) then + H = -5e-1_wp*sqrt(15._wp/(2._wp*pi))*exp(cmplx_i*z_cc(k))*sin(sph_phi)*cos(sph_phi) + elseif (beta == 2._wp) then + H = 25e-2_wp*sqrt(15._wp/(2._wp*pi))*exp(2._wp*cmplx_i*z_cc(k))*sin(sph_phi)**2 end if - elseif (epsilon == 3d0) then - if (beta == 0d0) then - H = 25d-2*sqrt(7d0/pi)*(5d0*cos(sph_phi)**3d0 - 3d0*cos(sph_phi)) - elseif (beta == 1d0) then - H = -125d-3*sqrt(21d0/pi)*exp(cmplx_i*z_cc(k))*sin(sph_phi)* & - (5d0*cos(sph_phi)**2 - 1d0) - elseif (beta == 2d0) then - H = 25d-2*sqrt(105d0/(2d0*pi))*exp(2d0*cmplx_i*z_cc(k))* & + elseif (epsilon == 3._wp) then + if (beta == 0._wp) then + H = 25e-2_wp*sqrt(7._wp/pi)*(5._wp*cos(sph_phi)**3._wp - 3._wp*cos(sph_phi)) + elseif (beta == 1._wp) then + H = -125e-3_wp*sqrt(21._wp/pi)*exp(cmplx_i*z_cc(k))*sin(sph_phi)* & + (5._wp*cos(sph_phi)**2 - 1._wp) + elseif (beta == 2._wp) then + H = 25e-2_wp*sqrt(105._wp/(2._wp*pi))*exp(2._wp*cmplx_i*z_cc(k))* & sin(sph_phi)**2*cos(sph_phi) - elseif (beta == 3d0) then - H = -125d-3*sqrt(35d0/pi)*exp(3d0*cmplx_i*z_cc(k))*sin(sph_phi)**3d0 + elseif (beta == 3._wp) then + H = -125e-3_wp*sqrt(35._wp/pi)*exp(3._wp*cmplx_i*z_cc(k))*sin(sph_phi)**3._wp end if - elseif (epsilon == 4d0) then - if (beta == 0d0) then - H = 3d0/16d0*sqrt(1d0/pi)*(35d0*cos(sph_phi)**4d0 - & - 3d1*cos(sph_phi)**2 + 3d0) - elseif (beta == 1d0) then - H = -3d0/8d0*sqrt(5d0/pi)*exp(cmplx_i*z_cc(k))* & - sin(sph_phi)*(7d0*cos(sph_phi)**3d0 - 3d0*cos(sph_phi)) - elseif (beta == 2d0) then - H = 3d0/8d0*sqrt(5d0/(2d0*pi))*exp(2d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**2*(7d0*cos(sph_phi)**2 - 1d0) - elseif (beta == 3d0) then - H = -3d0/8d0*sqrt(35d0/pi)*exp(3d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**3d0*cos(sph_phi) - elseif (beta == 4d0) then - H = 3d0/16d0*sqrt(35d0/(2d0*pi))*exp(4d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**4d0 + elseif (epsilon == 4._wp) then + if (beta == 0._wp) then + H = 3._wp/16._wp*sqrt(1._wp/pi)*(35._wp*cos(sph_phi)**4._wp - & + 3e1_wp*cos(sph_phi)**2 + 3._wp) + elseif (beta == 1._wp) then + H = -3._wp/8._wp*sqrt(5._wp/pi)*exp(cmplx_i*z_cc(k))* & + sin(sph_phi)*(7._wp*cos(sph_phi)**3._wp - 3._wp*cos(sph_phi)) + elseif (beta == 2._wp) then + H = 3._wp/8._wp*sqrt(5._wp/(2._wp*pi))*exp(2._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**2*(7._wp*cos(sph_phi)**2 - 1._wp) + elseif (beta == 3._wp) then + H = -3._wp/8._wp*sqrt(35._wp/pi)*exp(3._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**3._wp*cos(sph_phi) + elseif (beta == 4._wp) then + H = 3._wp/16._wp*sqrt(35._wp/(2._wp*pi))*exp(4._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**4._wp end if - elseif (epsilon == 5d0) then - if (beta == 0d0) then - H = 1d0/16d0*sqrt(11d0/pi)*(63d0*cos(sph_phi)**5d0 - & - 7d1*cos(sph_phi)**3d0 + 15d0*cos(sph_phi)) - elseif (beta == 1d0) then - H = -1d0/16d0*sqrt(165d0/(2d0*pi))*exp(cmplx_i*z_cc(k))* & - sin(sph_phi)*(21d0*cos(sph_phi)**4d0 - 14d0*cos(sph_phi)**2 + 1d0) - elseif (beta == 2d0) then - H = 125d-3*sqrt(1155d0/(2d0*pi))*exp(2d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**2*(3d0*cos(sph_phi)**3d0 - cos(sph_phi)) - elseif (beta == 3d0) then - H = -1d0/32d0*sqrt(385d0/pi)*exp(3d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**3d0*(9d0*cos(sph_phi)**2 - 1d0) - elseif (beta == 4d0) then - H = 3d0/16d0*sqrt(385d0/(2d0*pi))*exp(4d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**4d0*cos(sph_phi) - elseif (beta == 5d0) then - H = -3d0/32d0*sqrt(77d0/pi)*exp(5d0*cmplx_i*z_cc(k))* & - sin(sph_phi)**5d0 + elseif (epsilon == 5._wp) then + if (beta == 0._wp) then + H = 1._wp/16._wp*sqrt(11._wp/pi)*(63._wp*cos(sph_phi)**5._wp - & + 7e1_wp*cos(sph_phi)**3._wp + 15._wp*cos(sph_phi)) + elseif (beta == 1._wp) then + H = -1._wp/16._wp*sqrt(165._wp/(2._wp*pi))*exp(cmplx_i*z_cc(k))* & + sin(sph_phi)*(21._wp*cos(sph_phi)**4._wp - 14._wp*cos(sph_phi)**2 + 1._wp) + elseif (beta == 2._wp) then + H = 125e-3_wp*sqrt(1155._wp/(2._wp*pi))*exp(2._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**2*(3._wp*cos(sph_phi)**3._wp - cos(sph_phi)) + elseif (beta == 3._wp) then + H = -1._wp/32._wp*sqrt(385._wp/pi)*exp(3._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**3._wp*(9._wp*cos(sph_phi)**2 - 1._wp) + elseif (beta == 4._wp) then + H = 3._wp/16._wp*sqrt(385._wp/(2._wp*pi))*exp(4._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**4._wp*cos(sph_phi) + elseif (beta == 5._wp) then + H = -3._wp/32._wp*sqrt(77._wp/pi)*exp(5._wp*cmplx_i*z_cc(k))* & + sin(sph_phi)**5._wp end if end if - q_prim_vf(adv_idx%beg)%sf(i, j, k) = 1d0 - abs(real(H, kind(0d0))) + q_prim_vf(adv_idx%beg)%sf(i, j, k) = 1._wp - abs(real(H, wp)) end if @@ -1547,9 +1547,9 @@ contains ! Generic loop iterators integer :: i, j, k !< generic loop iterators - real(kind(0d0)) :: radius + real(wp) :: radius - real(kind(0d0)) :: radius_pressure, pressure_bubble, pressure_inf !< + real(wp) :: radius_pressure, pressure_bubble, pressure_inf !< !! Variables to initialize the pressure field that corresponds to the !! bubble-collapse test case found in Tiwari et al. (2013) @@ -1572,7 +1572,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smoothing of the spherical patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the sphere covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -1612,7 +1612,7 @@ contains (sqrt((x_cc(i) - x_centroid)**2 & + (cart_y - y_centroid)**2 & + (cart_z - z_centroid)**2) & - - radius))*(-0.5d0) + 0.5d0 + - radius))*(-0.5_wp) + 0.5_wp end if end if end if @@ -1662,18 +1662,18 @@ contains ! Computing the beginning and the end x-, y- and z-coordinates of ! the cuboid based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y - z_boundary%beg = z_centroid - 0.5d0*length_z - z_boundary%end = z_centroid + 0.5d0*length_z + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y + z_boundary%beg = z_centroid - 0.5_wp*length_z + z_boundary%end = z_centroid + 0.5_wp*length_z ! Since the cuboidal patch does not allow for its boundaries to get ! smoothed out, the pseudo volume fraction is set to 1 to make sure ! that only the current patch contributes to the fluid state in the ! cells that this patch covers. - eta = 1d0 + eta = 1._wp ! Checking whether the cuboid covers a particular cell in the domain ! and verifying whether the current patch has permission to write to @@ -1709,7 +1709,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id end if end if @@ -1740,7 +1740,7 @@ contains logical, optional, intent(in) :: ib !< True if this patch is an immersed boundary integer :: i, j, k !< Generic loop iterators - real(kind(0d0)) :: radius + real(wp) :: radius ! Transferring the cylindrical patch's centroid, length, radius, ! smoothing patch identity and smoothing coefficient information @@ -1767,17 +1767,17 @@ contains ! Computing the beginning and the end x-, y- and z-coordinates of ! the cylinder based on its centroid and lengths - x_boundary%beg = x_centroid - 0.5d0*length_x - x_boundary%end = x_centroid + 0.5d0*length_x - y_boundary%beg = y_centroid - 0.5d0*length_y - y_boundary%end = y_centroid + 0.5d0*length_y - z_boundary%beg = z_centroid - 0.5d0*length_z - z_boundary%end = z_centroid + 0.5d0*length_z + x_boundary%beg = x_centroid - 0.5_wp*length_x + x_boundary%end = x_centroid + 0.5_wp*length_x + y_boundary%beg = y_centroid - 0.5_wp*length_y + y_boundary%end = y_centroid + 0.5_wp*length_y + z_boundary%beg = z_centroid - 0.5_wp*length_z + z_boundary%end = z_centroid + 0.5_wp*length_z ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smearing of the cylindrical patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the cylinder covers a particular cell in the ! domain and verifying whether the current patch has the permission @@ -1825,7 +1825,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id end if if (patch_icpp(patch_id)%smoothen) then @@ -1833,17 +1833,17 @@ contains eta = tanh(smooth_coeff/min(dy, dz)* & (sqrt((cart_y - y_centroid)**2 & + (cart_z - z_centroid)**2) & - - radius))*(-0.5d0) + 0.5d0 + - radius))*(-0.5_wp) + 0.5_wp elseif (.not. f_is_default(length_y)) then eta = tanh(smooth_coeff/min(dx, dz)* & (sqrt((x_cc(i) - x_centroid)**2 & + (cart_z - z_centroid)**2) & - - radius))*(-0.5d0) + 0.5d0 + - radius))*(-0.5_wp) + 0.5_wp else eta = tanh(smooth_coeff/min(dx, dy)* & (sqrt((x_cc(i) - x_centroid)**2 & + (cart_y - y_centroid)**2) & - - radius))*(-0.5d0) + 0.5d0 + - radius))*(-0.5_wp) + 0.5_wp end if end if end if @@ -1871,7 +1871,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf integer :: i, j, k !< Generic loop iterators - real(kind(0d0)) :: a, b, c, d + real(wp) :: a, b, c, d ! Transferring the centroid information of the plane to be swept x_centroid = patch_icpp(patch_id)%x_centroid @@ -1889,7 +1889,7 @@ contains ! Initializing the pseudo volume fraction value to 1. The value will ! be modified as the patch is laid out on the grid, but only in the ! case that smearing of the sweep plane patch's boundary is enabled. - eta = 1d0 + eta = 1._wp ! Checking whether the region swept by the plane covers a particular ! cell in the domain and verifying whether the current patch has the @@ -1907,14 +1907,14 @@ contains end if if (patch_icpp(patch_id)%smoothen) then - eta = 5d-1 + 5d-1*tanh(smooth_coeff/min(dx, dy, dz) & - *(a*x_cc(i) + & - b*cart_y + & - c*cart_z + d) & - /sqrt(a**2 + b**2 + c**2)) + eta = 5e-1_wp + 5e-1_wp*tanh(smooth_coeff/min(dx, dy, dz) & + *(a*x_cc(i) + & + b*cart_y + & + c*cart_z + d) & + /sqrt(a**2 + b**2 + c**2)) end if - if ((a*x_cc(i) + b*cart_y + c*cart_z + d >= 0d0 & + if ((a*x_cc(i) + b*cart_y + c*cart_z + d >= 0._wp & .and. & patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) & .or. & @@ -1927,7 +1927,7 @@ contains @:analytical() ! Updating the patch identities bookkeeping variable - if (1d0 - eta < 1d-16) patch_id_fp(i, j, k) = patch_id + if (1._wp - eta < 1e-16_wp) patch_id_fp(i, j, k) = patch_id end if end do @@ -1953,11 +1953,11 @@ contains type(levelset_field), optional, intent(inout) :: STL_levelset !< Levelset determined by models type(levelset_norm_field), optional, intent(inout) :: STL_levelset_norm !< Levelset_norm determined by models logical, optional, intent(in) :: ib !< True if this patch is an immersed boundary - real(kind(0d0)) :: normals(1:3) !< Boundary normal buffer + real(wp) :: normals(1:3) !< Boundary normal buffer integer :: boundary_vertex_count, boundary_edge_count, total_vertices !< Boundary vertex - real(kind(0d0)), allocatable, dimension(:, :, :) :: boundary_v !< Boundary vertex buffer - real(kind(0d0)), allocatable, dimension(:, :) :: interpolated_boundary_v !< Interpolated vertex buffer - real(kind(0d0)) :: distance !< Levelset distance buffer + real(wp), allocatable, dimension(:, :, :) :: boundary_v !< Boundary vertex buffer + real(wp), allocatable, dimension(:, :) :: interpolated_boundary_v !< Interpolated vertex buffer + real(wp) :: distance !< Levelset distance buffer logical :: interpolate !< Logical variable to determine whether or not the model should be interpolated integer :: i, j, k !< Generic loop iterators @@ -1968,7 +1968,7 @@ contains t_vec3 :: point - real(kind(0d0)) :: grid_mm(1:3, 1:2) + real(wp) :: grid_mm(1:3, 1:2) integer :: cell_num integer :: ncells @@ -2044,23 +2044,23 @@ contains if (proc_rank == 0) then write (*, "(A, 3(2X, F20.10))") " > Model: Min:", bbox%min(1:3) - write (*, "(A, 3(2X, F20.10))") " > Cen:", (bbox%min(1:3) + bbox%max(1:3))/2d0 + write (*, "(A, 3(2X, F20.10))") " > Cen:", (bbox%min(1:3) + bbox%max(1:3))/2._wp write (*, "(A, 3(2X, F20.10))") " > Max:", bbox%max(1:3) !call s_model_write("__out__.stl", model) !call s_model_write("__out__.obj", model) - grid_mm(1, :) = (/minval(x_cc) - 0d5*dx, maxval(x_cc) + 0d5*dx/) - grid_mm(2, :) = (/minval(y_cc) - 0d5*dy, maxval(y_cc) + 0d5*dy/) + grid_mm(1, :) = (/minval(x_cc) - 0e5_wp*dx, maxval(x_cc) + 0e5_wp*dx/) + grid_mm(2, :) = (/minval(y_cc) - 0e5_wp*dy, maxval(y_cc) + 0e5_wp*dy/) if (p > 0) then - grid_mm(3, :) = (/minval(z_cc) - 0d5*dz, maxval(z_cc) + 0d5*dz/) + grid_mm(3, :) = (/minval(z_cc) - 0e5_wp*dz, maxval(z_cc) + 0e5_wp*dz/) else - grid_mm(3, :) = (/0d0, 0d0/) + grid_mm(3, :) = (/0._wp, 0._wp/) end if write (*, "(A, 3(2X, F20.10))") " > Domain: Min:", grid_mm(:, 1) - write (*, "(A, 3(2X, F20.10))") " > Cen:", (grid_mm(:, 1) + grid_mm(:, 2))/2d0 + write (*, "(A, 3(2X, F20.10))") " > Cen:", (grid_mm(:, 1) + grid_mm(:, 2))/2._wp write (*, "(A, 3(2X, F20.10))") " > Max:", grid_mm(:, 2) end if @@ -2074,7 +2074,7 @@ contains nint(100*real(cell_num)/ncells), "%" end if - point = (/x_cc(i), y_cc(j), 0d0/) + point = (/x_cc(i), y_cc(j), 0._wp/) if (p > 0) then point(3) = z_cc(k) end if @@ -2164,13 +2164,13 @@ contains else if (patch_icpp(patch_id)%smoothen) then if (eta > patch_icpp(patch_id)%model_threshold) then - eta = 1d0 + eta = 1._wp end if else if (eta > patch_icpp(patch_id)%model_threshold) then - eta = 1d0 + eta = 1._wp else - eta = 0d0 + eta = 0._wp end if end if call s_assign_patch_primitive_variables(patch_id, i, j, k, & @@ -2194,7 +2194,7 @@ contains subroutine s_convert_cylindrical_to_cartesian_coord(cyl_y, cyl_z) !$acc routine seq - real(kind(0d0)), intent(in) :: cyl_y, cyl_z + real(wp), intent(in) :: cyl_y, cyl_z cart_y = cyl_y*sin(cyl_z) cart_z = cyl_y*cos(cyl_z) @@ -2217,7 +2217,7 @@ contains subroutine s_convert_cylindrical_to_spherical_coord(cyl_x, cyl_y) !$acc routine seq - real(kind(0d0)), intent(IN) :: cyl_x, cyl_y + real(wp), intent(IN) :: cyl_x, cyl_y sph_phi = atan(cyl_y/cyl_x) @@ -2229,13 +2229,13 @@ contains !! @param a Starting position function f_r(myth, offset, a) !$acc routine seq - real(kind(0d0)), intent(in) :: myth, offset, a - real(kind(0d0)) :: b - real(kind(0d0)) :: f_r + real(wp), intent(in) :: myth, offset, a + real(wp) :: b + real(wp) :: f_r !r(th) = a + b*th - b = 2.d0*a/(2.d0*pi) + b = 2._wp*a/(2._wp*pi) f_r = a + b*myth + offset end function f_r diff --git a/src/pre_process/m_perturbation.fpp b/src/pre_process/m_perturbation.fpp index 0247043dc..8137365d2 100644 --- a/src/pre_process/m_perturbation.fpp +++ b/src/pre_process/m_perturbation.fpp @@ -54,9 +54,9 @@ contains type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf integer :: i, j, k, l !< generic loop operators - real(kind(0d0)) :: perturb_alpha - real(kind(0d0)) :: alpha_unadv - real(kind(0d0)) :: rand_real + real(wp) :: perturb_alpha + real(wp) :: alpha_unadv + real(wp) :: rand_real call random_seed() do k = 0, p @@ -67,8 +67,8 @@ contains perturb_alpha = q_prim_vf(E_idx + perturb_sph_fluid)%sf(i, j, k) ! Perturb partial density fields to match perturbed volume fraction fields - ! IF ((perturb_alpha >= 25d-2) .AND. (perturb_alpha <= 75d-2)) THEN - if ((perturb_alpha /= 0d0) .and. (perturb_alpha /= 1d0)) then + ! IF ((perturb_alpha >= 25e-2_wp) .AND. (perturb_alpha <= 75e-2_wp)) THEN + if ((perturb_alpha /= 0._wp) .and. (perturb_alpha /= 1._wp)) then ! Derive new partial densities do l = 1, num_fluids @@ -86,8 +86,8 @@ contains type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf integer :: i, j, k, l !< generic loop iterators - real(kind(0d0)) :: perturb_alpha - real(kind(0d0)) :: rand_real + real(wp) :: perturb_alpha + real(wp) :: rand_real call random_seed() ! Perturb partial density or velocity of surrounding flow by some random small amount of noise @@ -97,10 +97,10 @@ contains perturb_alpha = q_prim_vf(E_idx + perturb_flow_fluid)%sf(i, j, k) call random_number(rand_real) rand_real = rand_real*perturb_flow_mag - q_prim_vf(mom_idx%beg)%sf(i, j, k) = (1.d0 + rand_real)*q_prim_vf(mom_idx%beg)%sf(i, j, k) + q_prim_vf(mom_idx%beg)%sf(i, j, k) = (1._wp + rand_real)*q_prim_vf(mom_idx%beg)%sf(i, j, k) q_prim_vf(mom_idx%end)%sf(i, j, k) = rand_real*q_prim_vf(mom_idx%beg)%sf(i, j, k) if (bubbles) then - q_prim_vf(alf_idx)%sf(i, j, k) = (1.d0 + rand_real)*q_prim_vf(alf_idx)%sf(i, j, k) + q_prim_vf(alf_idx)%sf(i, j, k) = (1._wp + rand_real)*q_prim_vf(alf_idx)%sf(i, j, k) end if end do end do @@ -116,41 +116,41 @@ contains !! (2,2), (2,-2), (1,1), (1,-1) areadded on top of 2D waves. subroutine s_superposition_instability_wave(q_prim_vf) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(mixlayer_nvar, 0:m, 0:n, 0:p) :: wave, wave1, wave2, wave_tmp - real(kind(0d0)) :: uratio, Ldomain + real(wp), dimension(mixlayer_nvar, 0:m, 0:n, 0:p) :: wave, wave1, wave2, wave_tmp + real(wp) :: uratio, Ldomain integer :: i, j, k, q - uratio = 1d0/patch_icpp(1)%vel(1) + uratio = 1._wp/patch_icpp(1)%vel(1) Ldomain = mixlayer_domain*patch_icpp(1)%length_y - wave = 0d0 - wave1 = 0d0 - wave2 = 0d0 + wave = 0._wp + wave1 = 0._wp + wave2 = 0._wp ! Compute 2D waves - call s_instability_wave(2*pi*4.0/Ldomain, 0d0, wave_tmp, 0d0) + call s_instability_wave(2*pi*4.0_wp/Ldomain, 0._wp, wave_tmp, 0._wp) wave1 = wave1 + wave_tmp - call s_instability_wave(2*pi*2.0/Ldomain, 0d0, wave_tmp, 0d0) + call s_instability_wave(2*pi*2.0_wp/Ldomain, 0._wp, wave_tmp, 0._wp) wave1 = wave1 + wave_tmp - call s_instability_wave(2*pi*1.0/Ldomain, 0d0, wave_tmp, 0d0) + call s_instability_wave(2*pi*1.0_wp/Ldomain, 0._wp, wave_tmp, 0._wp) wave1 = wave1 + wave_tmp - wave = wave1*0.05 + wave = wave1*0.05_wp if (p > 0) then ! Compute 3D waves with phase shifts. - call s_instability_wave(2*pi*4.0/Ldomain, 2*pi*4.0/Ldomain, wave_tmp, 2*pi*11d0/31d0) + call s_instability_wave(2*pi*4.0_wp/Ldomain, 2*pi*4.0_wp/Ldomain, wave_tmp, 2*pi*11._wp/31._wp) wave2 = wave2 + wave_tmp - call s_instability_wave(2*pi*2.0/Ldomain, 2*pi*2.0/Ldomain, wave_tmp, 2*pi*13d0/31d0) + call s_instability_wave(2*pi*2.0_wp/Ldomain, 2*pi*2.0_wp/Ldomain, wave_tmp, 2*pi*13._wp/31._wp) wave2 = wave2 + wave_tmp - call s_instability_wave(2*pi*1.0/Ldomain, 2*pi*1.0/Ldomain, wave_tmp, 2*pi*17d0/31d0) + call s_instability_wave(2*pi*1.0_wp/Ldomain, 2*pi*1.0_wp/Ldomain, wave_tmp, 2*pi*17._wp/31._wp) wave2 = wave2 + wave_tmp - call s_instability_wave(2*pi*4.0/Ldomain, -2*pi*4.0/Ldomain, wave_tmp, 2*pi*19d0/31d0) + call s_instability_wave(2*pi*4.0_wp/Ldomain, -2*pi*4.0_wp/Ldomain, wave_tmp, 2*pi*19._wp/31._wp) wave2 = wave2 + wave_tmp - call s_instability_wave(2*pi*2.0/Ldomain, -2*pi*2.0/Ldomain, wave_tmp, 2*pi*23d0/31d0) + call s_instability_wave(2*pi*2.0_wp/Ldomain, -2*pi*2.0_wp/Ldomain, wave_tmp, 2*pi*23._wp/31._wp) wave2 = wave2 + wave_tmp - call s_instability_wave(2*pi*1.0/Ldomain, -2*pi*1.0/Ldomain, wave_tmp, 2*pi*29d0/31d0) + call s_instability_wave(2*pi*1.0_wp/Ldomain, -2*pi*1.0_wp/Ldomain, wave_tmp, 2*pi*29._wp/31._wp) wave2 = wave2 + wave_tmp - wave = wave + 0.15*wave2 + wave = wave + 0.15_wp*wave2 end if ! Superpose velocity perturbuations (instability waves) to the velocity field @@ -178,22 +178,22 @@ contains !> This subroutine computes equilibrium bubble radius of the perturbed pressure field subroutine s_compute_equilibrium_state(fP, fR0, fR) - real(kind(0d0)), intent(in) :: fP, fR0 - real(kind(0d0)), intent(inout) :: fR - real(kind(0d0)) :: f0, f1 - real(kind(0d0)) :: gam_b + real(wp), intent(in) :: fP, fR0 + real(wp), intent(inout) :: fR + real(wp) :: f0, f1 + real(wp) :: gam_b integer :: ii, jj - gam_b = 1d0 + 1d0/fluid_pp(num_fluids + 1)%gamma + gam_b = 1._wp + 1._wp/fluid_pp(num_fluids + 1)%gamma ! Loop ii = 1 do while (.true.) - f0 = (Ca + 2d0/Web)*(fR0/fR)**(3d0*gam_b) - 2d0/(Web*fR) + 1d0 - Ca - fP - f1 = -3d0*gam_b*(Ca + 2d0/Web)*(fR0/fR)**(3d0*gam_b + 1d0) + 2d0/(Web*fR**2d0) + f0 = (Ca + 2._wp/Web)*(fR0/fR)**(3._wp*gam_b) - 2._wp/(Web*fR) + 1._wp - Ca - fP + f1 = -3._wp*gam_b*(Ca + 2._wp/Web)*(fR0/fR)**(3._wp*gam_b + 1._wp) + 2._wp/(Web*fR**2._wp) - if (abs(f0) <= 1e-10) then + if (abs(f0) <= 1e-10_wp) then ! Converged exit else @@ -205,7 +205,7 @@ contains if (ieee_is_nan(f0) .or. & ieee_is_nan(f1) .or. & ii > 1000 .or. & - fR < 0d0) then + fR < 0._wp) then print *, "Failed to compute equilibrium radius" @@ -224,31 +224,31 @@ contains !! Euler equations with parallel mean flow assumption !! (See Sandham 1989 PhD thesis for details). subroutine s_instability_wave(alpha, beta, wave, shift) - real(kind(0d0)), intent(in) :: alpha, beta !< spatial wavenumbers - real(kind(0d0)), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave !< instability wave - real(kind(0d0)) :: shift !< phase shift - real(kind(0d0)), dimension(0:nbp - 1) :: u_mean !< mean density and velocity profiles - real(kind(0d0)) :: rho_mean, p_mean !< mean density and pressure - real(kind(0d0)), dimension(0:nbp - 1, 0:nbp - 1) :: d !< differential operator in y dir - real(kind(0d0)) :: gam, pi_inf, mach, c1, adv - real(kind(0d0)) :: xratio, uratio + real(wp), intent(in) :: alpha, beta !< spatial wavenumbers + real(wp), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave !< instability wave + real(wp) :: shift !< phase shift + real(wp), dimension(0:nbp - 1) :: u_mean !< mean density and velocity profiles + real(wp) :: rho_mean, p_mean !< mean density and pressure + real(wp), dimension(0:nbp - 1, 0:nbp - 1) :: d !< differential operator in y dir + real(wp) :: gam, pi_inf, mach, c1, adv + real(wp) :: xratio, uratio integer :: i, j !< generic loop iterators xratio = mixlayer_vel_coef - uratio = 1d0/patch_icpp(1)%vel(1) + uratio = 1._wp/patch_icpp(1)%vel(1) ! Set fluid flow properties if (bubbles) then adv = patch_icpp(1)%alpha(num_fluids) else - adv = 0d0 + adv = 0._wp end if - gam = 1d0 + 1d0/fluid_pp(1)%gamma - pi_inf = fluid_pp(1)%pi_inf*(gam - 1d0)/gam*uratio**2 + gam = 1._wp + 1._wp/fluid_pp(1)%gamma + pi_inf = fluid_pp(1)%pi_inf*(gam - 1._wp)/gam*uratio**2 rho_mean = patch_icpp(1)%alpha_rho(1) p_mean = patch_icpp(1)%pres*uratio**2 - c1 = sqrt((gam*(p_mean + pi_inf))/(rho_mean*(1d0 - adv))) - mach = 1d0/c1 + c1 = sqrt((gam*(p_mean + pi_inf))/(rho_mean*(1._wp - adv))) + mach = 1._wp/c1 ! Assign mean profiles do j = 0, n + 1 @@ -257,15 +257,15 @@ contains ! Compute differential operator in y-dir ! based on 2nd order central difference - d = 0d0 - d(0, 0) = -1d0/((y_cb(0) - y_cb(-1))*xratio) - d(0, 1) = 1d0/((y_cb(0) - y_cb(-1))*xratio) + d = 0._wp + d(0, 0) = -1._wp/((y_cb(0) - y_cb(-1))*xratio) + d(0, 1) = 1._wp/((y_cb(0) - y_cb(-1))*xratio) do j = 1, n - d(j, j - 1) = -1d0/((y_cb(j) - y_cb(j - 2))*xratio) - d(j, j + 1) = 1d0/((y_cb(j) - y_cb(j - 2))*xratio) + d(j, j - 1) = -1._wp/((y_cb(j) - y_cb(j - 2))*xratio) + d(j, j + 1) = 1._wp/((y_cb(j) - y_cb(j - 2))*xratio) end do - d(n + 1, n) = -1d0/((y_cb(n) - y_cb(n - 1))*xratio) - d(n + 1, n + 1) = 1d0/((y_cb(n) - y_cb(n - 1))*xratio) + d(n + 1, n) = -1._wp/((y_cb(n) - y_cb(n - 1))*xratio) + d(n + 1, n + 1) = 1._wp/((y_cb(n) - y_cb(n - 1))*xratio) ! Compute call s_solve_linear_system(alpha, beta, u_mean, rho_mean, p_mean, d, gam, pi_inf, mach, wave, shift) @@ -276,21 +276,21 @@ contains !! generate instability waves for the given set of spatial !! wave numbers and phase shift. subroutine s_solve_linear_system(alpha, beta, u_mean, rho_mean, p_mean, d, gam, pi_inf, mach, wave, shift) - real(kind(0d0)), intent(in) :: alpha, beta !< spatial wavenumbers - real(kind(0d0)), dimension(0:nbp - 1), intent(in) :: u_mean !< mean velocity profiles - real(kind(0d0)), intent(in) :: rho_mean, p_mean !< mean density and pressure - real(kind(0d0)), dimension(0:nbp - 1, 0:nbp - 1), intent(in) :: d !< differential operator in y dir - real(kind(0d0)), intent(in) :: gam, pi_inf, mach, shift - real(kind(0d0)), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave - - real(kind(0d0)), dimension(0:nbp - 1) :: drho_mean, du_mean !< y-derivatives of mean profiles - real(kind(0d0)), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1) :: ar, ai !< matrices for eigenvalue problem - real(kind(0d0)), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1) :: br, bi, ci !< matrices for eigenvalue problem - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1) :: hr, hi !< matrices for eigenvalue problem - - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1) :: zr, zi !< eigenvectors - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: wr, wi !< eigenvalues - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: fv1, fv2, fv3 !< temporary memory + real(wp), intent(in) :: alpha, beta !< spatial wavenumbers + real(wp), dimension(0:nbp - 1), intent(in) :: u_mean !< mean velocity profiles + real(wp), intent(in) :: rho_mean, p_mean !< mean density and pressure + real(wp), dimension(0:nbp - 1, 0:nbp - 1), intent(in) :: d !< differential operator in y dir + real(wp), intent(in) :: gam, pi_inf, mach, shift + real(wp), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave + + real(wp), dimension(0:nbp - 1) :: drho_mean, du_mean !< y-derivatives of mean profiles + real(wp), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1) :: ar, ai !< matrices for eigenvalue problem + real(wp), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1) :: br, bi, ci !< matrices for eigenvalue problem + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1) :: hr, hi !< matrices for eigenvalue problem + + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1) :: zr, zi !< eigenvectors + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: wr, wi !< eigenvalues + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: fv1, fv2, fv3 !< temporary memory integer :: ierr integer :: i, j, k, l !< generic loop iterators @@ -301,7 +301,7 @@ contains drho_mean(j) = 0 du_mean(j) = 0 do k = 0, nbp - 1 - drho_mean(j) = 0d0 + drho_mean(j) = 0._wp du_mean(j) = du_mean(j) + d(j, k)*u_mean(k) end do end do @@ -310,9 +310,9 @@ contains ! systems of equation (i.e. we are going to solve x for Ax = lambda x). ! Here, B includes components of A without differential operator, and ! C includes components of A with differential operator. - br = 0d0 - bi = 0d0 - ci = 0d0 + br = 0._wp + bi = 0._wp + ci = 0._wp do j = 0, nbp - 1 ii = mixlayer_var(1); jj = mixlayer_var(1); br((ii - 1)*nbp + j, (jj - 1)*nbp + j) = alpha*u_mean(j); ii = mixlayer_var(1); jj = mixlayer_var(2); br((ii - 1)*nbp + j, (jj - 1)*nbp + j) = alpha*rho_mean; @@ -353,12 +353,12 @@ contains !> This subroutine applies non-reflecting subsonic buffer boundary condition !! to the linear system of equations (i.e. matrix A). subroutine s_instability_nonreflecting_subsonic_buffer_bc(ar, ai, hr, hi, rho_mean, mach) - real(kind(0d0)), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1), intent(inout) :: ar, ai !< matrices for eigenvalue problem - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1), intent(out) :: hr, hi !< matrices for eigenvalue problem - real(kind(0d0)), intent(in) :: rho_mean !< mean density profiles - real(kind(0d0)), intent(in) :: mach - real(kind(0d0)), dimension(0:mixlayer_nvar*n - 1, 0:mixlayer_nvar*n - 1) :: fr, fi !< matrices for eigenvalue problem - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - 1) :: gr, gi !< matrices for eigenvalue problem + real(wp), dimension(0:mixlayer_nvar*nbp - 1, 0:mixlayer_nvar*nbp - 1), intent(inout) :: ar, ai !< matrices for eigenvalue problem + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1), intent(out) :: hr, hi !< matrices for eigenvalue problem + real(wp), intent(in) :: rho_mean !< mean density profiles + real(wp), intent(in) :: mach + real(wp), dimension(0:mixlayer_nvar*n - 1, 0:mixlayer_nvar*n - 1) :: fr, fi !< matrices for eigenvalue problem + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - 1) :: gr, gi !< matrices for eigenvalue problem integer :: i, j, k, l, ii, jj ! Condition 1: v = 0 at BC - no action required here @@ -424,8 +424,8 @@ contains end do ! Remove unnecessary rows of the matrix A (rho, u, v, w, p at the boundaries) - fr = 0d0 - fi = 0d0 + fr = 0._wp + fi = 0._wp do ii = 1, mixlayer_nvar do jj = 1, mixlayer_nvar do k = 0, n - 1 @@ -437,8 +437,8 @@ contains end do end do - gr = 0d0 - gi = 0d0 + gr = 0._wp + gi = 0._wp do ii = 1, mixlayer_nvar do j = 0, mixlayer_nvar*n - 1 if (ii <= mixlayer_var(2)) then @@ -460,8 +460,8 @@ contains end do end do - hr = 0d0 - hi = 0d0 + hr = 0._wp + hi = 0._wp do i = 0, mixlayer_nvar*n - n_bc_skip - 1 do jj = 1, mixlayer_nvar if (jj <= mixlayer_var(2)) then @@ -489,17 +489,17 @@ contains !! eigenvalue and corresponding eigenvector among the !! given set of eigenvalues and eigenvectors. subroutine s_generate_wave(wr, wi, zr, zi, rho_mean, mach, alpha, beta, wave, shift) - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1), intent(in) :: wr, wi !< eigenvalues - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1), intent(in) :: zr, zi !< eigenvectors - real(kind(0d0)), intent(in) :: rho_mean - real(kind(0d0)), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave - real(kind(0d0)), intent(in) :: alpha, beta, mach, shift - real(kind(0d0)), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: vr, vi, vnr, vni !< most unstable eigenvector - real(kind(0d0)), dimension(0:mixlayer_nvar*nbp - 1) :: xbr, xbi !< eigenvectors - real(kind(0d0)), dimension(0:mixlayer_nvar*(nbp - 1) - 1) :: xcr, xci !< eigenvectors - real(kind(0d0)) :: ang, norm - real(kind(0d0)) :: tr, ti, cr, ci !< temporary memory - real(kind(0d0)) :: xratio + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1), intent(in) :: wr, wi !< eigenvalues + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1, 0:mixlayer_nvar*n - n_bc_skip - 1), intent(in) :: zr, zi !< eigenvectors + real(wp), intent(in) :: rho_mean + real(wp), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave + real(wp), intent(in) :: alpha, beta, mach, shift + real(wp), dimension(0:mixlayer_nvar*n - n_bc_skip - 1) :: vr, vi, vnr, vni !< most unstable eigenvector + real(wp), dimension(0:mixlayer_nvar*nbp - 1) :: xbr, xbi !< eigenvectors + real(wp), dimension(0:mixlayer_nvar*(nbp - 1) - 1) :: xcr, xci !< eigenvectors + real(wp) :: ang, norm + real(wp) :: tr, ti, cr, ci !< temporary memory + real(wp) :: xratio integer idx integer i, j, k @@ -516,11 +516,11 @@ contains vi = zi(:, k) ! Normalize the eigenvector by its component with the largest modulus. - norm = 0d0 + norm = 0._wp do i = 0, mixlayer_nvar*n - n_bc_skip - 1 - if (dsqrt(vr(i)**2 + vi(i)**2) > norm) then + if (sqrt(vr(i)**2 + vi(i)**2) > norm) then idx = i - norm = dsqrt(vr(i)**2 + vi(i)**2) + norm = sqrt(vr(i)**2 + vi(i)**2) end if end do @@ -533,8 +533,8 @@ contains end do ! Reassign missing values at boundaries based on the boundary condition - xbr = 0d0 - xbi = 0d0 + xbr = 0._wp + xbi = 0._wp do i = 1, mixlayer_nvar if (i <= mixlayer_var(2)) then do k = 0, n - 1 @@ -579,12 +579,12 @@ contains xbi(mixlayer_var(4)*nbp + nbp - 1) = xbi(mixlayer_var(4)*nbp + n) - xbi(mixlayer_var(2)*nbp + n)*rho_mean/mach ! Compute average to get cell-centered values - xcr = 0d0 - xci = 0d0 + xcr = 0._wp + xci = 0._wp do i = 1, mixlayer_nvar do k = 0, n - xcr((i - 1)*(nbp - 1) + k) = 5d-1*(xbr((i - 1)*nbp + k) + xbr((i - 1)*nbp + k + 1)) - xci((i - 1)*(nbp - 1) + k) = 5d-1*(xbi((i - 1)*nbp + k) + xbi((i - 1)*nbp + k + 1)) + xcr((i - 1)*(nbp - 1) + k) = 5e-1_wp*(xbr((i - 1)*nbp + k) + xbr((i - 1)*nbp + k + 1)) + xci((i - 1)*(nbp - 1) + k) = 5e-1_wp*(xbi((i - 1)*nbp + k) + xbi((i - 1)*nbp + k + 1)) end do end do diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index b1766418b..ba6c0b7fc 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -263,7 +263,7 @@ contains end if ! Computing cell-center locations - x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2d0 + x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp ! Computing minimum cell-width dx = minval(x_cb(0:m) - x_cb(-1:m - 1)) @@ -295,7 +295,7 @@ contains end if ! Computing cell-center locations - y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2d0 + y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp ! Computing minimum cell-width dy = minval(y_cb(0:n) - y_cb(-1:n - 1)) @@ -327,7 +327,7 @@ contains end if ! Computing cell-center locations - z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2d0 + z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp ! Computing minimum cell-width dz = minval(z_cb(0:p) - z_cb(-1:p - 1)) @@ -364,7 +364,7 @@ contains ! Cell-boundary Data Consistency Check in x-direction ============== - if (any(x_cb(0:m) - x_cb(-1:m - 1) <= 0d0)) then + if (any(x_cb(0:m) - x_cb(-1:m - 1) <= 0._wp)) then call s_mpi_abort('x_cb.dat in '//trim(t_step_dir)// & ' contains non-positive cell-spacings. Exiting ...') end if @@ -375,7 +375,7 @@ contains if (n > 0) then - if (any(y_cb(0:n) - y_cb(-1:n - 1) <= 0d0)) then + if (any(y_cb(0:n) - y_cb(-1:n - 1) <= 0._wp)) then call s_mpi_abort('y_cb.dat in '//trim(t_step_dir)// & ' contains non-positive cell-spacings. '// & 'Exiting ...') @@ -387,7 +387,7 @@ contains if (p > 0) then - if (any(z_cb(0:p) - z_cb(-1:p - 1) <= 0d0)) then + if (any(z_cb(0:p) - z_cb(-1:p - 1) <= 0._wp)) then call s_mpi_abort('z_cb.dat in '//trim(t_step_dir)// & ' contains non-positive cell-spacings'// & ' .Exiting ...') @@ -420,7 +420,7 @@ contains ! Generic string used to store the address of a particular file character(LEN= & - int(floor(log10(real(sys_size, kind(0d0))))) + 1) :: file_num !< + int(floor(log10(real(sys_size, wp)))) + 1) :: file_num !< !! Used to store the variable position, in character form, of the !! currently manipulated conservative variable file @@ -544,7 +544,7 @@ contains #ifdef MFC_MPI - real(kind(0d0)), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb + real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb integer :: ifile, ierr, data_size integer, dimension(MPI_STATUS_SIZE) :: status @@ -563,7 +563,7 @@ contains if (file_exist) then data_size = m_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ_ALL(ifile, x_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ_ALL(ifile, x_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting... ') @@ -572,7 +572,7 @@ contains ! Assigning local cell boundary locations x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) ! Computing cell center locations - x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2d0 + x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp ! Computing minimum cell width dx = minval(x_cb(0:m) - x_cb(-1:(m - 1))) if (num_procs > 1) call s_mpi_reduce_min(dx) @@ -588,7 +588,7 @@ contains if (file_exist) then data_size = n_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ_ALL(ifile, y_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ_ALL(ifile, y_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting... ') @@ -597,7 +597,7 @@ contains ! Assigning local cell boundary locations y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) ! Computing cell center locations - y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2d0 + y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp ! Computing minimum cell width dy = minval(y_cb(0:n) - y_cb(-1:(n - 1))) if (num_procs > 1) call s_mpi_reduce_min(dy) @@ -613,7 +613,7 @@ contains if (file_exist) then data_size = p_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ_ALL(ifile, z_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ_ALL(ifile, z_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting... ') @@ -622,7 +622,7 @@ contains ! Assigning local cell boundary locations z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) ! Computing cell center locations - z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2d0 + z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp ! Computing minimum cell width dz = minval(z_cb(0:p) - z_cb(-1:(p - 1))) if (num_procs > 1) call s_mpi_reduce_min(dz) @@ -695,8 +695,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -707,10 +707,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do if (qbmm .and. .not. polytropic) then @@ -720,10 +720,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -778,9 +778,9 @@ contains end if !Initialize pb based on surface tension for qbmm (polytropic) if (qbmm .and. polytropic .and. (.not. f_is_default(Web))) then - pb0 = pref + 2d0*fluid_pp(1)%ss/(R0*R0ref) + pb0 = pref + 2._wp*fluid_pp(1)%ss/(R0*R0ref) pb0 = pb0/pref - pref = 1d0 + pref = 1._wp end if call s_initialize_data_output_module() call s_initialize_variables_conversion_module() @@ -829,9 +829,9 @@ contains subroutine s_apply_initial_condition(start, finish, proc_time, time_avg, time_final, file_exists) - real(kind(0d0)), intent(inout) :: start, finish - real(kind(0d0)), dimension(:), intent(inout) :: proc_time - real(kind(0d0)), intent(inout) :: time_avg, time_final + real(wp), intent(inout) :: start, finish + real(wp), dimension(:), intent(inout) :: proc_time + real(wp), intent(inout) :: time_avg, time_final logical, intent(inout) :: file_exists ! Setting up the grid and the initial condition. If the grid is read in from @@ -866,8 +866,8 @@ contains subroutine s_save_data(proc_time, time_avg, time_final, file_exists) - real(kind(0d0)), dimension(:), intent(inout) :: proc_time - real(kind(0d0)), intent(inout) :: time_avg, time_final + real(wp), dimension(:), intent(inout) :: proc_time + real(wp), intent(inout) :: time_avg, time_final logical, intent(inout) :: file_exists call s_mpi_barrier() @@ -877,7 +877,7 @@ contains end if if (proc_rank == 0) then - time_final = 0d0 + time_final = 0._wp if (num_procs == 1) then time_final = time_avg print *, "Elapsed Time", time_final diff --git a/src/pre_process/p_main.f90 b/src/pre_process/p_main.f90 index 544c0311a..0bda585c0 100644 --- a/src/pre_process/p_main.f90 +++ b/src/pre_process/p_main.f90 @@ -18,8 +18,8 @@ program p_main integer :: i logical :: file_exists - real(kind(0d0)) :: start, finish, time_avg, time_final - real(kind(0d0)), allocatable, dimension(:) :: proc_time + real(wp) :: start, finish, time_avg, time_final + real(wp), allocatable, dimension(:) :: proc_time call random_seed() diff --git a/src/simulation/include/inline_riemann.fpp b/src/simulation/include/inline_riemann.fpp index 1af67bfb4..513c8c8c5 100644 --- a/src/simulation/include/inline_riemann.fpp +++ b/src/simulation/include/inline_riemann.fpp @@ -1,25 +1,26 @@ #:def arithmetic_avg() - rho_avg = 5d-1*(rho_L + rho_R) - vel_avg_rms = 0d0 + rho_avg = 5e-1_wp*(rho_L + rho_R) + vel_avg_rms = 0._wp !$acc loop seq do i = 1, num_dims - vel_avg_rms = vel_avg_rms + (5d-1*(vel_L(i) + vel_R(i)))**2d0 + vel_avg_rms = vel_avg_rms + (5e-1_wp*(vel_L(i) + vel_R(i)))**2._wp end do - H_avg = 5d-1*(H_L + H_R) - gamma_avg = 5d-1*(gamma_L + gamma_R) + H_avg = 5e-1_wp*(H_L + H_R) + gamma_avg = 5e-1_wp*(gamma_L + gamma_R) #:enddef arithmetic_avg #:def roe_avg() rho_avg = sqrt(rho_L*rho_R) - vel_avg_rms = 0d0 + + vel_avg_rms = 0._wp !$acc loop seq do i = 1, num_dims - vel_avg_rms = vel_avg_rms + (sqrt(rho_L)*vel_L(i) + sqrt(rho_R)*vel_R(i))**2d0/ & - (sqrt(rho_L) + sqrt(rho_R))**2d0 + vel_avg_rms = vel_avg_rms + (sqrt(rho_L)*vel_L(i) + sqrt(rho_R)*vel_R(i))**2._wp/ & + (sqrt(rho_L) + sqrt(rho_R))**2._wp end do H_avg = (sqrt(rho_L)*H_L + sqrt(rho_R)*H_R)/ & @@ -28,11 +29,11 @@ gamma_avg = (sqrt(rho_L)*gamma_L + sqrt(rho_R)*gamma_R)/ & (sqrt(rho_L) + sqrt(rho_R)) - vel_avg_rms = (sqrt(rho_L)*vel_L(1) + sqrt(rho_R)*vel_R(1))**2d0/ & - (sqrt(rho_L) + sqrt(rho_R))**2d0 + vel_avg_rms = (sqrt(rho_L)*vel_L(1) + sqrt(rho_R)*vel_R(1))**2._wp/ & + (sqrt(rho_L) + sqrt(rho_R))**2._wp if (chemistry) then - eps = 0.001d0 + eps = 0.001_wp call get_species_enthalpies_rt(T_L, h_iL) call get_species_enthalpies_rt(T_R, h_iR) @@ -47,8 +48,8 @@ if (abs(T_L - T_R) < eps) then ! Case when T_L and T_R are very close - Cp_avg = sum(Yi_avg(:)*(0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(:))*gas_constant/mol_weights(:)) - Cv_avg = sum(Yi_avg(:)*((0.5d0*Cp_iL(i) + 0.5d0*Cp_iR(:))*gas_constant/mol_weights(:) - gas_constant/mol_weights(:))) + Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(i) + 0.5_wp*Cp_iR(:))*gas_constant/mol_weights(:)) + Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(i) + 0.5_wp*Cp_iR(:))*gas_constant/mol_weights(:) - gas_constant/mol_weights(:))) else ! Normal calculation when T_L and T_R are sufficiently different Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L)) @@ -57,7 +58,7 @@ gamma_avg = Cp_avg/Cv_avg - Phi_avg(:) = (gamma_avg - 1.d0)*(vel_avg_rms/2.0d0 - h_avg_2(:)) + gamma_avg*gas_constant/mol_weights(:)*T_avg + Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - h_avg_2(:)) + gamma_avg*gas_constant/mol_weights(:)*T_avg c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:)) end if @@ -77,17 +78,17 @@ #:def compute_low_Mach_correction() - zcoef = min(1d0, max(vel_L_rms**5d-1/c_L, vel_R_rms**5d-1/c_R)) - pcorr = 0d0 + zcoef = min(1._wp, max(vel_L_rms**5e-1_wp/c_L, vel_R_rms**5e-1_wp/c_R)) + pcorr = 0._wp if (low_Mach == 1) then pcorr = rho_L*rho_R* & (s_L - vel_L(dir_idx(1)))*(s_R - vel_R(dir_idx(1)))*(vel_R(dir_idx(1)) - vel_L(dir_idx(1)))/ & (rho_R*(s_R - vel_R(dir_idx(1))) - rho_L*(s_L - vel_L(dir_idx(1))))* & - (zcoef - 1d0) + (zcoef - 1._wp) else if (low_Mach == 2) then - vel_L_tmp = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) - vel_R_tmp = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_R(dir_idx(1)) - vel_L(dir_idx(1)))) + vel_L_tmp = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + vel_R_tmp = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_R(dir_idx(1)) - vel_L(dir_idx(1)))) vel_L(dir_idx(1)) = vel_L_tmp vel_R(dir_idx(1)) = vel_R_tmp end if diff --git a/src/simulation/m_acoustic_src.fpp b/src/simulation/m_acoustic_src.fpp index 7879390bf..2af0dd672 100644 --- a/src/simulation/m_acoustic_src.fpp +++ b/src/simulation/m_acoustic_src.fpp @@ -29,19 +29,19 @@ module m_acoustic_src logical, allocatable, dimension(:) :: dipole !$acc declare create(dipole) - real(kind(0d0)), allocatable, target, dimension(:, :) :: loc_acoustic + real(wp), allocatable, target, dimension(:, :) :: loc_acoustic !$acc declare create(loc_acoustic) - real(kind(0d0)), allocatable, dimension(:) :: mag, length, height, wavelength, frequency, gauss_sigma_dist, gauss_sigma_time, npulse, dir, delay + real(wp), allocatable, dimension(:) :: mag, length, height, wavelength, frequency, gauss_sigma_dist, gauss_sigma_time, npulse, dir, delay !$acc declare create(mag, length, height, wavelength, frequency, gauss_sigma_dist, gauss_sigma_time, npulse, dir, delay) - real(kind(0d0)), allocatable, dimension(:) :: foc_length, aperture + real(wp), allocatable, dimension(:) :: foc_length, aperture !$acc declare create(foc_length, aperture) - real(kind(0d0)), allocatable, dimension(:) :: element_spacing_angle, element_polygon_ratio, rotate_angle + real(wp), allocatable, dimension(:) :: element_spacing_angle, element_polygon_ratio, rotate_angle !$acc declare create(element_spacing_angle, element_polygon_ratio, rotate_angle) - real(kind(0d0)), allocatable, dimension(:) :: bb_bandwidth, bb_lowest_freq + real(wp), allocatable, dimension(:) :: bb_bandwidth, bb_lowest_freq !$acc declare create(bb_bandwidth, bb_lowest_freq) integer, allocatable, dimension(:) :: num_elements, element_on, bb_num_freq @@ -49,8 +49,8 @@ module m_acoustic_src !> @name Acoustic source terms !> @{ - real(kind(0d0)), allocatable, dimension(:, :, :) :: mass_src, e_src - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: mom_src + real(wp), allocatable, dimension(:, :, :) :: mass_src, e_src + real(wp), allocatable, dimension(:, :, :, :) :: mom_src !> @} !$acc declare create(mass_src, e_src, mom_src) @@ -99,12 +99,12 @@ contains element_on(i) = acoustic(i)%element_on end if if (f_is_default(acoustic(i)%rotate_angle)) then - rotate_angle(i) = 0d0 + rotate_angle(i) = 0._wp else rotate_angle(i) = acoustic(i)%rotate_angle end if if (f_is_default(acoustic(i)%delay)) then ! m_checker guarantees acoustic(i)%delay is set for pulse = 2 (Gaussian) - delay(i) = 0d0 ! Defaults to zero for sine and square waves + delay(i) = 0._wp ! Defaults to zero for sine and square waves else delay(i) = acoustic(i)%delay end if @@ -138,17 +138,17 @@ contains integer, intent(in) :: t_step - real(kind(0d0)) :: myalpha(num_fluids), myalpha_rho(num_fluids) - real(kind(0d0)) :: myRho, B_tait - real(kind(0d0)) :: sim_time, c, small_gamma - real(kind(0d0)) :: frequency_local, gauss_sigma_time_local - real(kind(0d0)) :: mass_src_diff, mom_src_diff - real(kind(0d0)) :: source_temporal - real(kind(0d0)) :: period_BB !< period of each sine wave in broadband source - real(kind(0d0)) :: sl_BB !< spectral level at each frequency - real(kind(0d0)) :: ffre_BB !< source term corresponding to each frequency - real(kind(0d0)) :: sum_BB !< total source term for the broadband wave - real(kind(0d0)), allocatable, dimension(:) :: phi_rn !< random phase shift for each frequency + real(wp) :: myalpha(num_fluids), myalpha_rho(num_fluids) + real(wp) :: myRho, B_tait + real(wp) :: sim_time, c, small_gamma + real(wp) :: frequency_local, gauss_sigma_time_local + real(wp) :: mass_src_diff, mom_src_diff + real(wp) :: source_temporal + real(wp) :: period_BB !< period of each sine wave in broadband source + real(wp) :: sl_BB !< spectral level at each frequency + real(wp) :: ffre_BB !< source term corresponding to each frequency + real(wp) :: sum_BB !< total source term for the broadband wave + real(wp), allocatable, dimension(:) :: phi_rn !< random phase shift for each frequency integer :: i, j, k, l, q !< generic loop variables integer :: ai !< acoustic source index @@ -164,11 +164,11 @@ contains do l = 0, p do k = 0, n do j = 0, m - mass_src(j, k, l) = 0d0 - mom_src(1, j, k, l) = 0d0 - e_src(j, k, l) = 0d0 - if (n > 0) mom_src(2, j, k, l) = 0d0 - if (p > 0) mom_src(3, j, k, l) = 0d0 + mass_src(j, k, l) = 0._wp + mom_src(1, j, k, l) = 0._wp + e_src(j, k, l) = 0._wp + if (n > 0) mom_src(2, j, k, l) = 0._wp + if (p > 0) mom_src(3, j, k, l) = 0._wp end do end do end do @@ -185,10 +185,10 @@ contains num_points = source_spatials_num_points(ai) ! Use scalar to force firstprivate to prevent GPU bug ! Calculate the broadband source - period_BB = 0d0 - sl_BB = 0d0 - ffre_BB = 0d0 - sum_BB = 0d0 + period_BB = 0._wp + sl_BB = 0._wp + ffre_BB = 0._wp + sum_BB = 0._wp ! Allocate buffers for random phase shift allocate (phi_rn(1:bb_num_freq(ai))) @@ -202,11 +202,11 @@ contains !$acc loop reduction(+:sum_BB) do k = 1, bb_num_freq(ai) ! Acoustic period of the wave at each discrete frequency - period_BB = 1d0/(bb_lowest_freq(ai) + k*bb_bandwidth(ai)) + period_BB = 1._wp/(bb_lowest_freq(ai) + k*bb_bandwidth(ai)) ! Spectral level at each frequency sl_BB = broadband_spectral_level_constant*mag(ai) + k*mag(ai)/broadband_spectral_level_growth_rate ! Source term corresponding to each frequencies - ffre_BB = dsqrt((2d0*sl_BB*bb_bandwidth(ai)))*cos((sim_time)*2d0*pi/period_BB + 2d0*pi*phi_rn(k)) + ffre_BB = sqrt((2._wp*sl_BB*bb_bandwidth(ai)))*cos((sim_time)*2._wp*pi/period_BB + 2._wp*pi*phi_rn(k)) ! Sum up the source term of each frequency to obtain the total source term for broadband wave sum_BB = sum_BB + ffre_BB end do @@ -220,9 +220,9 @@ contains l = source_spatials(ai)%coord(3, i) ! Compute speed of sound - myRho = 0d0 - B_tait = 0d0 - small_gamma = 0d0 + myRho = 0._wp + B_tait = 0._wp + small_gamma = 0._wp !$acc loop do q = 1, num_fluids @@ -254,8 +254,8 @@ contains end do end if - small_gamma = 1d0/small_gamma + 1d0 - c = dsqrt(small_gamma*(q_prim_vf(E_idx)%sf(j, k, l) + ((small_gamma - 1d0)/small_gamma)*B_tait)/myRho) + small_gamma = 1._wp/small_gamma + 1._wp + c = sqrt(small_gamma*(q_prim_vf(E_idx)%sf(j, k, l) + ((small_gamma - 1._wp)/small_gamma)*B_tait)/myRho) ! Wavelength to frequency conversion if (pulse(ai) == 1 .or. pulse(ai) == 3) frequency_local = f_frequency_local(freq_conv_flag, ai, c) @@ -266,13 +266,13 @@ contains mom_src_diff = source_temporal*source_spatials(ai)%val(i) if (dipole(ai)) then ! Double amplitude & No momentum source term (only works for Planar) - mass_src(j, k, l) = mass_src(j, k, l) + 2d0*mom_src_diff/c - if (model_eqns /= 4) E_src(j, k, l) = E_src(j, k, l) + 2d0*mom_src_diff*c/(small_gamma - 1d0) + mass_src(j, k, l) = mass_src(j, k, l) + 2._wp*mom_src_diff/c + if (model_eqns /= 4) E_src(j, k, l) = E_src(j, k, l) + 2._wp*mom_src_diff*c/(small_gamma - 1._wp) cycle end if if (n == 0) then ! 1D - mom_src(1, j, k, l) = mom_src(1, j, k, l) + mom_src_diff*sign(1d0, dir(ai)) ! Left or right-going wave + mom_src(1, j, k, l) = mom_src(1, j, k, l) + mom_src_diff*sign(1._wp, dir(ai)) ! Left or right-going wave elseif (p == 0) then ! 2D if (support(ai) < 5) then ! Planar @@ -306,7 +306,7 @@ contains ! Update energy source term if (model_eqns /= 4) then - E_src(j, k, l) = E_src(j, k, l) + mass_src_diff*c**2d0/(small_gamma - 1d0) + E_src(j, k, l) = E_src(j, k, l) + mass_src_diff*c**2._wp/(small_gamma - 1._wp) end if end do @@ -342,55 +342,55 @@ contains subroutine s_source_temporal(sim_time, c, ai, term_index, frequency_local, gauss_sigma_time_local, source, sum_BB) !$acc routine seq integer, intent(in) :: ai, term_index - real(kind(0d0)), intent(in) :: sim_time, c, sum_BB - real(kind(0d0)), intent(in) :: frequency_local, gauss_sigma_time_local - real(kind(0d0)), intent(out) :: source + real(wp), intent(in) :: sim_time, c, sum_BB + real(wp), intent(in) :: frequency_local, gauss_sigma_time_local + real(wp), intent(out) :: source - real(kind(0d0)) :: omega ! angular frequency - real(kind(0d0)) :: sine_wave ! sine function for square wave - real(kind(0d0)) :: foc_length_factor ! Scale amplitude with radius for spherical support + real(wp) :: omega ! angular frequency + real(wp) :: sine_wave ! sine function for square wave + real(wp) :: foc_length_factor ! Scale amplitude with radius for spherical support ! i.e. Spherical support -> 1/r scaling; Cylindrical support -> 1/sqrt(r) [empirical correction: ^-0.5 -> ^-0.85] integer, parameter :: mass_label = 1 if (n == 0) then - foc_length_factor = 1d0 + foc_length_factor = 1._wp elseif (p == 0 .and. (.not. cyl_coord)) then ! 2D axisymmetric case is physically 3D - foc_length_factor = foc_length(ai)**(-0.85d0); ! Empirical correction + foc_length_factor = foc_length(ai)**(-0.85_wp); ! Empirical correction else foc_length_factor = 1/foc_length(ai); end if - source = 0d0 + source = 0._wp if (pulse(ai) == 1) then ! Sine wave if ((sim_time - delay(ai))*frequency_local > npulse(ai)) return - omega = 2d0*pi*frequency_local + omega = 2._wp*pi*frequency_local source = mag(ai)*sin((sim_time - delay(ai))*omega) if (term_index == mass_label) then - source = source/c + foc_length_factor*mag(ai)*(cos((sim_time - delay(ai))*omega) - 1d0)/omega + source = source/c + foc_length_factor*mag(ai)*(cos((sim_time - delay(ai))*omega) - 1._wp)/omega end if elseif (pulse(ai) == 2) then ! Gaussian pulse - source = mag(ai)*dexp(-0.5d0*((sim_time - delay(ai))**2d0)/(gauss_sigma_time_local**2d0)) + source = mag(ai)*exp(-0.5_wp*((sim_time - delay(ai))**2._wp)/(gauss_sigma_time_local**2._wp)) if (term_index == mass_label) then source = source/c - & - foc_length_factor*mag(ai)*dsqrt(pi/2)*gauss_sigma_time_local* & - (erf((sim_time - delay(ai))/(dsqrt(2d0)*gauss_sigma_time_local)) + 1) + foc_length_factor*mag(ai)*sqrt(pi/2)*gauss_sigma_time_local* & + (erf((sim_time - delay(ai))/(sqrt(2._wp)*gauss_sigma_time_local)) + 1) end if elseif (pulse(ai) == 3) then ! Square wave if ((sim_time - delay(ai))*frequency_local > npulse(ai)) return - omega = 2d0*pi*frequency_local + omega = 2._wp*pi*frequency_local sine_wave = sin((sim_time - delay(ai))*omega) - source = mag(ai)*sign(1d0, sine_wave) + source = mag(ai)*sign(1._wp, sine_wave) ! Prevent max-norm differences due to compilers to pass CI - if (abs(sine_wave) < 1d-2) then - source = mag(ai)*sine_wave*1d2 + if (abs(sine_wave) < 1e-2_wp) then + source = mag(ai)*sine_wave*1e2_wp end if elseif (pulse(ai) == 4) then ! Broadband wave @@ -403,8 +403,8 @@ contains integer :: j, k, l, ai integer :: count integer :: dim - real(kind(0d0)) :: source_spatial, angle, xyz_to_r_ratios(3) - real(kind(0d0)), parameter :: threshold = 1d-10 + real(wp) :: source_spatial, angle, xyz_to_r_ratios(3) + real(wp), parameter :: threshold = 1e-10_wp if (n == 0) then dim = 1 @@ -500,10 +500,10 @@ contains !! @param xyz_to_r_ratios Ratios of the [xyz]-component of the source term to the magnitude (for 3D) subroutine s_source_spatial(j, k, l, loc, ai, source, angle, xyz_to_r_ratios) integer, intent(in) :: j, k, l, ai - real(kind(0d0)), dimension(3), intent(in) :: loc - real(kind(0d0)), intent(out) :: source, angle, xyz_to_r_ratios(3) + real(wp), dimension(3), intent(in) :: loc + real(wp), intent(out) :: source, angle, xyz_to_r_ratios(3) - real(kind(0d0)) :: sig, r(3) + real(wp) :: sig, r(3) ! Calculate sig spatial support width if (n == 0) then @@ -536,22 +536,22 @@ contains !! @param source Source term amplitude subroutine s_source_spatial_planar(ai, sig, r, source) integer, intent(in) :: ai - real(kind(0d0)), intent(in) :: sig, r(3) - real(kind(0d0)), intent(out) :: source + real(wp), intent(in) :: sig, r(3) + real(wp), intent(out) :: source - real(kind(0d0)) :: dist + real(wp) :: dist - source = 0d0 + source = 0._wp if (support(ai) == 1) then ! 1D - source = 1d0/(dsqrt(2d0*pi)*sig/2d0)*dexp(-0.5d0*(r(1)/(sig/2d0))**2d0) + source = 1._wp/(sqrt(2._wp*pi)*sig/2._wp)*exp(-0.5_wp*(r(1)/(sig/2._wp))**2._wp) elseif (support(ai) == 2 .or. support(ai) == 3) then ! 2D or 3D ! If we let unit vector e = (cos(dir), sin(dir)), dist = r(1)*cos(dir(ai)) + r(2)*sin(dir(ai)) ! dot(r,e) - if ((r(1) - dist*cos(dir(ai)))**2d0 + (r(2) - dist*sin(dir(ai)))**2d0 < 0.25d0*length(ai)**2d0) then ! |r - dist*e| < length/2 - if (support(ai) /= 3 .or. abs(r(3)) < 0.25d0*height(ai)) then ! additional height constraint for 3D - source = 1d0/(dsqrt(2d0*pi)*sig/2d0)*dexp(-0.5d0*(dist/(sig/2d0))**2d0) + if ((r(1) - dist*cos(dir(ai)))**2._wp + (r(2) - dist*sin(dir(ai)))**2._wp < 0.25_wp*length(ai)**2._wp) then ! |r - dist*e| < length/2 + if (support(ai) /= 3 .or. abs(r(3)) < 0.25_wp*height(ai)) then ! additional height constraint for 3D + source = 1._wp/(sqrt(2._wp*pi)*sig/2._wp)*exp(-0.5_wp*(dist/(sig/2._wp))**2._wp) end if end if end if @@ -566,34 +566,34 @@ contains !! @param xyz_to_r_ratios Ratios of the [xyz]-component of the source term to the magnitude (for 3D) subroutine s_source_spatial_transducer(ai, sig, r, source, angle, xyz_to_r_ratios) integer, intent(in) :: ai - real(kind(0d0)), intent(in) :: sig, r(3) - real(kind(0d0)), intent(out) :: source, angle, xyz_to_r_ratios(3) + real(wp), intent(in) :: sig, r(3) + real(wp), intent(out) :: source, angle, xyz_to_r_ratios(3) - real(kind(0d0)) :: current_angle, angle_half_aperture, dist, norm + real(wp) :: current_angle, angle_half_aperture, dist, norm - source = 0d0 ! If not affected by transducer - angle = 0d0 - xyz_to_r_ratios = 0d0 + source = 0._wp ! If not affected by transducer + angle = 0._wp + xyz_to_r_ratios = 0._wp if (support(ai) == 5 .or. support(ai) == 6) then ! 2D or 2D axisymmetric current_angle = -atan(r(2)/(foc_length(ai) - r(1))) - angle_half_aperture = asin((aperture(ai)/2d0)/(foc_length(ai))) + angle_half_aperture = asin((aperture(ai)/2._wp)/(foc_length(ai))) if (abs(current_angle) < angle_half_aperture .and. r(1) < foc_length(ai)) then - dist = foc_length(ai) - dsqrt(r(2)**2d0 + (foc_length(ai) - r(1))**2d0) - source = 1d0/(dsqrt(2d0*pi)*sig/2d0)*dexp(-0.5d0*(dist/(sig/2d0))**2d0) + dist = foc_length(ai) - sqrt(r(2)**2._wp + (foc_length(ai) - r(1))**2._wp) + source = 1._wp/(sqrt(2._wp*pi)*sig/2._wp)*exp(-0.5_wp*(dist/(sig/2._wp))**2._wp) angle = -atan(r(2)/(foc_length(ai) - r(1))) end if elseif (support(ai) == 7) then ! 3D - current_angle = -atan(dsqrt(r(2)**2 + r(3)**2)/(foc_length(ai) - r(1))) - angle_half_aperture = asin((aperture(ai)/2d0)/(foc_length(ai))) + current_angle = -atan(sqrt(r(2)**2 + r(3)**2)/(foc_length(ai) - r(1))) + angle_half_aperture = asin((aperture(ai)/2._wp)/(foc_length(ai))) if (abs(current_angle) < angle_half_aperture .and. r(1) < foc_length(ai)) then - dist = foc_length(ai) - dsqrt(r(2)**2d0 + r(3)**2d0 + (foc_length(ai) - r(1))**2d0) - source = 1d0/(dsqrt(2d0*pi)*sig/2d0)*dexp(-0.5d0*(dist/(sig/2d0))**2d0) + dist = foc_length(ai) - sqrt(r(2)**2._wp + r(3)**2._wp + (foc_length(ai) - r(1))**2._wp) + source = 1._wp/(sqrt(2._wp*pi)*sig/2._wp)*exp(-0.5_wp*(dist/(sig/2._wp))**2._wp) - norm = dsqrt(r(2)**2d0 + r(3)**2d0 + (foc_length(ai) - r(1))**2d0) + norm = sqrt(r(2)**2._wp + r(3)**2._wp + (foc_length(ai) - r(1))**2._wp) xyz_to_r_ratios(1) = -(r(1) - foc_length(ai))/norm xyz_to_r_ratios(2) = -r(2)/norm xyz_to_r_ratios(3) = -r(3)/norm @@ -611,14 +611,14 @@ contains !! @param xyz_to_r_ratios Ratios of the [xyz]-component of the source term to the magnitude (for 3D) subroutine s_source_spatial_transducer_array(ai, sig, r, source, angle, xyz_to_r_ratios) integer, intent(in) :: ai - real(kind(0d0)), intent(in) :: sig, r(3) - real(kind(0d0)), intent(out) :: source, angle, xyz_to_r_ratios(3) + real(wp), intent(in) :: sig, r(3) + real(wp), intent(out) :: source, angle, xyz_to_r_ratios(3) integer :: elem, elem_min, elem_max - real(kind(0d0)) :: current_angle, angle_half_aperture, angle_per_elem, dist - real(kind(0d0)) :: angle_min, angle_max, norm - real(kind(0d0)) :: poly_side_length, aperture_element_3D, angle_elem - real(kind(0d0)) :: x2, y2, z2, x3, y3, z3, C, f, half_apert, dist_interp_to_elem_center + real(wp) :: current_angle, angle_half_aperture, angle_per_elem, dist + real(wp) :: angle_min, angle_max, norm + real(wp) :: poly_side_length, aperture_element_3D, angle_elem + real(wp) :: x2, y2, z2, x3, y3, z3, C, f, half_apert, dist_interp_to_elem_center if (element_on(ai) == 0) then ! Full transducer elem_min = 1 @@ -628,22 +628,22 @@ contains elem_max = element_on(ai) end if - source = 0d0 ! If not affected by any transducer element - angle = 0d0 - xyz_to_r_ratios = 0d0 + source = 0._wp ! If not affected by any transducer element + angle = 0._wp + xyz_to_r_ratios = 0._wp if (support(ai) == 9 .or. support(ai) == 10) then ! 2D or 2D axisymmetric current_angle = -atan(r(2)/(foc_length(ai) - r(1))) - angle_half_aperture = asin((aperture(ai)/2d0)/(foc_length(ai))) - angle_per_elem = (2d0*angle_half_aperture - (num_elements(ai) - 1d0)*element_spacing_angle(ai))/num_elements(ai) - dist = foc_length(ai) - dsqrt(r(2)**2d0 + (foc_length(ai) - r(1))**2d0) + angle_half_aperture = asin((aperture(ai)/2._wp)/(foc_length(ai))) + angle_per_elem = (2._wp*angle_half_aperture - (num_elements(ai) - 1._wp)*element_spacing_angle(ai))/num_elements(ai) + dist = foc_length(ai) - sqrt(r(2)**2._wp + (foc_length(ai) - r(1))**2._wp) do elem = elem_min, elem_max - angle_max = angle_half_aperture - (element_spacing_angle(ai) + angle_per_elem)*(elem - 1d0) + angle_max = angle_half_aperture - (element_spacing_angle(ai) + angle_per_elem)*(elem - 1._wp) angle_min = angle_max - angle_per_elem if (current_angle > angle_min .and. current_angle < angle_max .and. r(1) < foc_length(ai)) then - source = dexp(-0.5d0*(dist/(sig/2d0))**2d0)/(dsqrt(2d0*pi)*sig/2d0) + source = exp(-0.5_wp*(dist/(sig/2._wp))**2._wp)/(sqrt(2._wp*pi)*sig/2._wp) angle = current_angle exit ! Assume elements don't overlap end if @@ -653,29 +653,29 @@ contains poly_side_length = aperture(ai)*sin(pi/num_elements(ai)) aperture_element_3D = poly_side_length*element_polygon_ratio(ai) f = foc_length(ai) - half_apert = aperture(ai)/2d0 + half_apert = aperture(ai)/2._wp do elem = elem_min, elem_max - angle_elem = 2d0*pi*real(elem, kind(0d0))/real(num_elements(ai), kind(0d0)) + rotate_angle(ai) + angle_elem = 2._wp*pi*real(elem, wp)/real(num_elements(ai), wp) + rotate_angle(ai) ! Point 2 is the elem center - x2 = f - dsqrt(f**2 - half_apert**2) + x2 = f - sqrt(f**2 - half_apert**2) y2 = half_apert*cos(angle_elem) z2 = half_apert*sin(angle_elem) ! Construct a plane normal to the line from the focal point to the elem center, ! Point 3 is the intercept of the plane and the line from the focal point to the current location - C = f**2d0/((r(1) - f)*(x2 - f) + r(2)*y2 + r(3)*z2) ! Constant for intermediate step + C = f**2._wp/((r(1) - f)*(x2 - f) + r(2)*y2 + r(3)*z2) ! Constant for intermediate step x3 = C*(r(1) - f) + f y3 = C*r(2) z3 = C*r(3) - dist_interp_to_elem_center = dsqrt((x2 - x3)**2d0 + (y2 - y3)**2d0 + (z2 - z3)**2d0) - if ((dist_interp_to_elem_center < aperture_element_3D/2d0) .and. (r(1) < f)) then - dist = dsqrt((x3 - r(1))**2d0 + (y3 - r(2))**2d0 + (z3 - r(3))**2d0) - source = dexp(-0.5d0*(dist/(sig/2d0))**2d0)/(dsqrt(2d0*pi)*sig/2d0) + dist_interp_to_elem_center = sqrt((x2 - x3)**2._wp + (y2 - y3)**2._wp + (z2 - z3)**2._wp) + if ((dist_interp_to_elem_center < aperture_element_3D/2._wp) .and. (r(1) < f)) then + dist = sqrt((x3 - r(1))**2._wp + (y3 - r(2))**2._wp + (z3 - r(3))**2._wp) + source = exp(-0.5_wp*(dist/(sig/2._wp))**2._wp)/(sqrt(2._wp*pi)*sig/2._wp) - norm = dsqrt(r(2)**2d0 + r(3)**2d0 + (f - r(1))**2d0) + norm = sqrt(r(2)**2._wp + r(3)**2._wp + (f - r(1))**2._wp) xyz_to_r_ratios(1) = -(r(1) - f)/norm xyz_to_r_ratios(2) = -r(2)/norm xyz_to_r_ratios(3) = -r(3)/norm @@ -695,8 +695,8 @@ contains !$acc routine seq logical, intent(in) :: freq_conv_flag integer, intent(in) :: ai - real(kind(0d0)), intent(in) :: c - real(kind(0d0)) :: f_frequency_local + real(wp), intent(in) :: c + real(wp) :: f_frequency_local if (freq_conv_flag) then f_frequency_local = c/wavelength(ai) @@ -714,8 +714,8 @@ contains !$acc routine seq logical, intent(in) :: gauss_conv_flag integer, intent(in) :: ai - real(kind(0d0)), intent(in) :: c - real(kind(0d0)) :: f_gauss_sigma_time_local + real(wp), intent(in) :: c + real(wp) :: f_gauss_sigma_time_local if (gauss_conv_flag) then f_gauss_sigma_time_local = gauss_sigma_dist(ai)/c diff --git a/src/simulation/m_body_forces.fpp b/src/simulation/m_body_forces.fpp index 7368fc046..9892e48f4 100644 --- a/src/simulation/m_body_forces.fpp +++ b/src/simulation/m_body_forces.fpp @@ -24,7 +24,7 @@ module m_body_forces s_initialize_body_forces_module, & s_finalize_body_forces_module - real(kind(0d0)), allocatable, dimension(:, :, :) :: rhoM + real(wp), allocatable, dimension(:, :, :) :: rhoM !$acc declare create(rhoM) contains @@ -58,7 +58,7 @@ contains !> This subroutine computes the acceleration at time t subroutine s_compute_acceleration(t) - real(kind(0d0)), intent(in) :: t + real(wp), intent(in) :: t if (m > 0) then accel_bf(1) = g_x + k_x*sin(w_x*t - p_x) @@ -86,7 +86,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - rhoM(j, k, l) = 0d0 + rhoM(j, k, l) = 0._wp do i = 1, num_fluids rhoM(j, k, l) = rhoM(j, k, l) + & q_cons_vf(contxb + i - 1)%sf(j, k, l) @@ -117,7 +117,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - rhs_vf(i)%sf(j, k, l) = 0d0 + rhs_vf(i)%sf(j, k, l) = 0._wp end do end do end do diff --git a/src/simulation/m_boundary_conditions.fpp b/src/simulation/m_boundary_conditions.fpp index 266be8ed0..a15b14447 100644 --- a/src/simulation/m_boundary_conditions.fpp +++ b/src/simulation/m_boundary_conditions.fpp @@ -30,7 +30,7 @@ contains subroutine s_populate_variables_buffers(q_prim_vf, pb, mv) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer :: bc_loc, bc_dir @@ -217,7 +217,7 @@ contains subroutine s_ghost_cell_extrapolation(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -328,7 +328,7 @@ contains subroutine s_symmetry(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -610,7 +610,7 @@ contains subroutine s_periodic(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -830,7 +830,7 @@ contains subroutine s_axis(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -903,7 +903,7 @@ contains subroutine s_slip_wall(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -920,7 +920,7 @@ contains do j = 1, buff_size if (i == momxb) then q_prim_vf(i)%sf(-j, k, l) = & - -q_prim_vf(i)%sf(j - 1, k, l) + 2d0*bc_x%vb1 + -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb1 else q_prim_vf(i)%sf(-j, k, l) = & q_prim_vf(i)%sf(0, k, l) @@ -939,7 +939,7 @@ contains do j = 1, buff_size if (i == momxb) then q_prim_vf(i)%sf(m + j, k, l) = & - -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2d0*bc_x%ve1 + -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve1 else q_prim_vf(i)%sf(m + j, k, l) = & q_prim_vf(i)%sf(m, k, l) @@ -963,7 +963,7 @@ contains do l = -buff_size, m + buff_size if (i == momxb + 1) then q_prim_vf(i)%sf(l, -j, k) = & - -q_prim_vf(i)%sf(l, j - 1, k) + 2d0*bc_y%vb2 + -q_prim_vf(i)%sf(l, j - 1, k) + 2._wp*bc_y%vb2 else q_prim_vf(i)%sf(l, -j, k) = & q_prim_vf(i)%sf(l, 0, k) @@ -982,7 +982,7 @@ contains do l = -buff_size, m + buff_size if (i == momxb + 1) then q_prim_vf(i)%sf(l, n + j, k) = & - -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2d0*bc_y%ve2 + -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2._wp*bc_y%ve2 else q_prim_vf(i)%sf(l, n + j, k) = & q_prim_vf(i)%sf(l, n, k) @@ -1006,7 +1006,7 @@ contains do k = -buff_size, m + buff_size if (i == momxe) then q_prim_vf(i)%sf(k, l, -j) = & - -q_prim_vf(i)%sf(k, l, j - 1) + 2d0*bc_z%vb3 + -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb3 else q_prim_vf(i)%sf(k, l, -j) = & q_prim_vf(i)%sf(k, l, 0) @@ -1025,7 +1025,7 @@ contains do k = -buff_size, m + buff_size if (i == momxe) then q_prim_vf(i)%sf(k, l, p + j) = & - -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2d0*bc_z%ve3 + -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve3 else q_prim_vf(i)%sf(k, l, p + j) = & q_prim_vf(i)%sf(k, l, p) @@ -1045,7 +1045,7 @@ contains subroutine s_no_slip_wall(q_prim_vf, pb, mv, bc_dir, bc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i @@ -1062,13 +1062,13 @@ contains do j = 1, buff_size if (i == momxb) then q_prim_vf(i)%sf(-j, k, l) = & - -q_prim_vf(i)%sf(j - 1, k, l) + 2d0*bc_x%vb1 + -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(-j, k, l) = & - -q_prim_vf(i)%sf(j - 1, k, l) + 2d0*bc_x%vb2 + -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(-j, k, l) = & - -q_prim_vf(i)%sf(j - 1, k, l) + 2d0*bc_x%vb3 + -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb3 else q_prim_vf(i)%sf(-j, k, l) = & q_prim_vf(i)%sf(0, k, l) @@ -1087,13 +1087,13 @@ contains do j = 1, buff_size if (i == momxb) then q_prim_vf(i)%sf(m + j, k, l) = & - -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2d0*bc_x%ve1 + -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(m + j, k, l) = & - -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2d0*bc_x%ve2 + -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(m + j, k, l) = & - -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2d0*bc_x%ve3 + -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve3 else q_prim_vf(i)%sf(m + j, k, l) = & q_prim_vf(i)%sf(m, k, l) @@ -1117,13 +1117,13 @@ contains do l = -buff_size, m + buff_size if (i == momxb) then q_prim_vf(i)%sf(l, -j, k) = & - -q_prim_vf(i)%sf(l, j - 1, k) + 2d0*bc_y%vb1 + -q_prim_vf(i)%sf(l, j - 1, k) + 2._wp*bc_y%vb1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(l, -j, k) = & - -q_prim_vf(i)%sf(l, j - 1, k) + 2d0*bc_y%vb2 + -q_prim_vf(i)%sf(l, j - 1, k) + 2._wp*bc_y%vb2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(l, -j, k) = & - -q_prim_vf(i)%sf(l, j - 1, k) + 2d0*bc_y%vb3 + -q_prim_vf(i)%sf(l, j - 1, k) + 2._wp*bc_y%vb3 else q_prim_vf(i)%sf(l, -j, k) = & q_prim_vf(i)%sf(l, 0, k) @@ -1142,13 +1142,13 @@ contains do l = -buff_size, m + buff_size if (i == momxb) then q_prim_vf(i)%sf(l, n + j, k) = & - -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2d0*bc_y%ve1 + -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2._wp*bc_y%ve1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(l, n + j, k) = & - -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2d0*bc_y%ve2 + -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2._wp*bc_y%ve2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(l, n + j, k) = & - -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2d0*bc_y%ve3 + -q_prim_vf(i)%sf(l, n - (j - 1), k) + 2._wp*bc_y%ve3 else q_prim_vf(i)%sf(l, n + j, k) = & q_prim_vf(i)%sf(l, n, k) @@ -1172,13 +1172,13 @@ contains do k = -buff_size, m + buff_size if (i == momxb) then q_prim_vf(i)%sf(k, l, -j) = & - -q_prim_vf(i)%sf(k, l, j - 1) + 2d0*bc_z%vb1 + -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(k, l, -j) = & - -q_prim_vf(i)%sf(k, l, j - 1) + 2d0*bc_z%vb2 + -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(k, l, -j) = & - -q_prim_vf(i)%sf(k, l, j - 1) + 2d0*bc_z%vb3 + -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb3 else q_prim_vf(i)%sf(k, l, -j) = & q_prim_vf(i)%sf(k, l, 0) @@ -1197,13 +1197,13 @@ contains do k = -buff_size, m + buff_size if (i == momxb) then q_prim_vf(i)%sf(k, l, p + j) = & - -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2d0*bc_z%ve1 + -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve1 elseif (i == momxb + 1 .and. num_dims > 1) then q_prim_vf(i)%sf(k, l, p + j) = & - -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2d0*bc_z%ve2 + -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve2 elseif (i == momxb + 2 .and. num_dims > 2) then q_prim_vf(i)%sf(k, l, p + j) = & - -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2d0*bc_z%ve3 + -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve3 else q_prim_vf(i)%sf(k, l, p + j) = & q_prim_vf(i)%sf(k, l, p) @@ -1222,7 +1222,7 @@ contains subroutine s_qbmm_extrapolation(pb, mv, bc_dir, bc_loc) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: bc_dir, bc_loc integer :: j, k, l, q, i diff --git a/src/simulation/m_bubbles.fpp b/src/simulation/m_bubbles.fpp index b0027f42c..4beb03352 100644 --- a/src/simulation/m_bubbles.fpp +++ b/src/simulation/m_bubbles.fpp @@ -21,13 +21,13 @@ module m_bubbles implicit none - real(kind(0.d0)) :: chi_vw !< Bubble wall properties (Ando 2010) - real(kind(0.d0)) :: k_mw !< Bubble wall properties (Ando 2010) - real(kind(0.d0)) :: rho_mw !< Bubble wall properties (Ando 2010) + real(wp) :: chi_vw !< Bubble wall properties (Ando 2010) + real(wp) :: k_mw !< Bubble wall properties (Ando 2010) + real(wp) :: rho_mw !< Bubble wall properties (Ando 2010) !$acc declare create(chi_vw, k_mw, rho_mw) - real(kind(0d0)), allocatable, dimension(:, :, :) :: bub_adv_src - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: bub_r_src, bub_v_src, bub_p_src, bub_m_src + real(wp), allocatable, dimension(:, :, :) :: bub_adv_src + real(wp), allocatable, dimension(:, :, :, :) :: bub_r_src, bub_v_src, bub_p_src, bub_m_src !$acc declare create(bub_adv_src, bub_r_src, bub_v_src, bub_p_src, bub_m_src) type(scalar_field) :: divu !< matrix for div(u) @@ -78,19 +78,19 @@ contains !! @param q_cons_vf is the conservative variable subroutine s_comp_alpha_from_n(q_cons_vf) type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf - real(kind(0d0)) :: nR3bar - integer(kind(0d0)) :: i, j, k, l + real(wp) :: nR3bar + integer(wp) :: i, j, k, l !$acc parallel loop collapse(3) gang vector default(present) do l = 0, p do k = 0, n do j = 0, m - nR3bar = 0d0 + nR3bar = 0._wp !$acc loop seq do i = 1, nb - nR3bar = nR3bar + weight(i)*(q_cons_vf(rs(i))%sf(j, k, l))**3d0 + nR3bar = nR3bar + weight(i)*(q_cons_vf(rs(i))%sf(j, k, l))**3._wp end do - q_cons_vf(alf_idx)%sf(j, k, l) = (4d0*pi*nR3bar)/(3d0*q_cons_vf(n_idx)%sf(j, k, l)**2d0) + q_cons_vf(alf_idx)%sf(j, k, l) = (4._wp*pi*nR3bar)/(3._wp*q_cons_vf(n_idx)%sf(j, k, l)**2._wp) end do end do end do @@ -111,10 +111,10 @@ contains do l = 0, p do k = 0, n do j = 0, m - divu%sf(j, k, l) = 0d0 + divu%sf(j, k, l) = 0._wp divu%sf(j, k, l) = & - 5d-1/dx(j)*(q_prim_vf(contxe + idir)%sf(j + 1, k, l) - & - q_prim_vf(contxe + idir)%sf(j - 1, k, l)) + 5e-1_wp/dx(j)*(q_prim_vf(contxe + idir)%sf(j + 1, k, l) - & + q_prim_vf(contxe + idir)%sf(j - 1, k, l)) end do end do @@ -128,8 +128,8 @@ contains do k = 0, n do j = 0, m divu%sf(j, k, l) = divu%sf(j, k, l) + & - 5d-1/dy(k)*(q_prim_vf(contxe + idir)%sf(j, k + 1, l) - & - q_prim_vf(contxe + idir)%sf(j, k - 1, l)) + 5e-1_wp/dy(k)*(q_prim_vf(contxe + idir)%sf(j, k + 1, l) - & + q_prim_vf(contxe + idir)%sf(j, k - 1, l)) end do end do @@ -142,8 +142,8 @@ contains do k = 0, n do j = 0, m divu%sf(j, k, l) = divu%sf(j, k, l) + & - 5d-1/dz(l)*(q_prim_vf(contxe + idir)%sf(j, k, l + 1) - & - q_prim_vf(contxe + idir)%sf(j, k, l - 1)) + 5e-1_wp/dz(l)*(q_prim_vf(contxe + idir)%sf(j, k, l + 1) - & + q_prim_vf(contxe + idir)%sf(j, k, l - 1)) end do end do @@ -163,32 +163,33 @@ contains integer, intent(in) :: t_step type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf - real(kind(0d0)) :: rddot - real(kind(0d0)) :: pb, mv, vflux, pbdot - real(kind(0d0)) :: n_tait, B_tait - real(kind(0d0)), dimension(nb) :: Rtmp, Vtmp - real(kind(0d0)) :: myR, myV, alf, myP, myRho, R2Vav, R3 - real(kind(0d0)), dimension(num_fluids) :: myalpha, myalpha_rho - real(kind(0d0)) :: nbub !< Bubble number density + real(wp) :: rddot + real(wp) :: pb, mv, vflux, pbdot + real(wp) :: n_tait, B_tait + real(wp), dimension(nb) :: Rtmp, Vtmp + real(wp) :: myR, myV, alf, myP, myRho, R2Vav, R3 + real(wp), dimension(num_fluids) :: myalpha, myalpha_rho + real(wp) :: nbub !< Bubble number density + integer :: i, j, k, l, q, ii !< Loop variables - real(kind(0d0)) :: err1, err2, err3, err4, err5 !< Error estimates for adaptive time stepping - real(kind(0d0)) :: t_new !< Updated time step size - real(kind(0d0)) :: h !< Time step size - real(kind(0d0)), dimension(4) :: myR_tmp1, myV_tmp1, myR_tmp2, myV_tmp2 !< Bubble radius, radial velocity, and radial acceleration for the inner loop + real(wp) :: err1, err2, err3, err4, err5 !< Error estimates for adaptive time stepping + real(wp) :: t_new !< Updated time step size + real(wp) :: h !< Time step size + real(wp), dimension(4) :: myR_tmp1, myV_tmp1, myR_tmp2, myV_tmp2 !< Bubble radius, radial velocity, and radial acceleration for the inner loop !$acc parallel loop collapse(3) gang vector default(present) do l = 0, p do k = 0, n do j = 0, m - bub_adv_src(j, k, l) = 0d0 + bub_adv_src(j, k, l) = 0._wp !$acc loop seq do q = 1, nb - bub_r_src(j, k, l, q) = 0d0 - bub_v_src(j, k, l, q) = 0d0 - bub_p_src(j, k, l, q) = 0d0 - bub_m_src(j, k, l, q) = 0d0 + bub_r_src(j, k, l, q) = 0._wp + bub_v_src(j, k, l, q) = 0._wp + bub_p_src(j, k, l, q) = 0._wp + bub_m_src(j, k, l, q) = 0._wp end do end do end do @@ -208,25 +209,25 @@ contains Vtmp(q) = q_prim_vf(vs(q))%sf(j, k, l) end do - R3 = 0d0 + R3 = 0._wp !$acc loop seq do q = 1, nb - R3 = R3 + weight(q)*Rtmp(q)**3.d0 + R3 = R3 + weight(q)*Rtmp(q)**3._wp end do - nbub = (3.d0/(4.d0*pi))*q_prim_vf(alf_idx)%sf(j, k, l)/R3 + nbub = (3._wp/(4._wp*pi))*q_prim_vf(alf_idx)%sf(j, k, l)/R3 end if if (.not. adap_dt) then - R2Vav = 0d0 + R2Vav = 0._wp !$acc loop seq do q = 1, nb - R2Vav = R2Vav + weight(q)*Rtmp(q)**2.d0*Vtmp(q) + R2Vav = R2Vav + weight(q)*Rtmp(q)**2._wp*Vtmp(q) end do - bub_adv_src(j, k, l) = 4.d0*pi*nbub*R2Vav + bub_adv_src(j, k, l) = 4._wp*pi*nbub*R2Vav end if !$acc loop seq @@ -238,9 +239,9 @@ contains myalpha(ii) = q_cons_vf(advxb + ii - 1)%sf(j, k, l) end do - myRho = 0d0 - n_tait = 0d0 - B_tait = 0d0 + myRho = 0._wp + n_tait = 0._wp + B_tait = 0._wp if (mpp_lim .and. (num_fluids > 2)) then !$acc loop seq @@ -262,7 +263,7 @@ contains B_tait = pi_infs(1)/pi_fac end if - n_tait = 1.d0/n_tait + 1.d0 !make this the usual little 'gamma' + n_tait = 1._wp/n_tait + 1._wp !make this the usual little 'gamma' B_tait = B_tait*(n_tait - 1)/n_tait ! make this the usual pi_inf myRho = q_prim_vf(1)%sf(j, k, l) @@ -279,9 +280,9 @@ contains pbdot = f_bpres_dot(vflux, myR, myV, pb, mv, q) bub_p_src(j, k, l, q) = nbub*pbdot - bub_m_src(j, k, l, q) = nbub*vflux*4.d0*pi*(myR**2.d0) + bub_m_src(j, k, l, q) = nbub*vflux*4._wp*pi*(myR**2._wp) else - pb = 0d0; mv = 0d0; vflux = 0d0; pbdot = 0d0 + pb = 0._wp; mv = 0._wp; vflux = 0._wp; pbdot = 0._wp end if ! Adaptive time stepping @@ -292,10 +293,10 @@ contains bub_adv_src(j, k, l), divu%sf(j, k, l), h) ! Advancing one step - t_new = 0d0 + t_new = 0._wp do while (.true.) - if (t_new + h > 0.5d0*dt) then - h = 0.5d0*dt - t_new + if (t_new + h > 0.5_wp*dt) then + h = 0.5_wp*dt - t_new end if ! Advancing one sub-step @@ -309,26 +310,26 @@ contains ! Advance one sub-step by advancing two half steps call s_advance_substep(myRho, myP, myR, myV, R0(q), & pb, pbdot, alf, n_tait, B_tait, & - bub_adv_src(j, k, l), divu%sf(j, k, l), 0.5d0*h, & + bub_adv_src(j, k, l), divu%sf(j, k, l), 0.5_wp*h, & myR_tmp2, myV_tmp2, err2) call s_advance_substep(myRho, myP, myR_tmp2(4), myV_tmp2(4), R0(q), & pb, pbdot, alf, n_tait, B_tait, & - bub_adv_src(j, k, l), divu%sf(j, k, l), 0.5d0*h, & + bub_adv_src(j, k, l), divu%sf(j, k, l), 0.5_wp*h, & myR_tmp2, myV_tmp2, err3) err4 = abs((myR_tmp1(4) - myR_tmp2(4))/myR_tmp1(4)) err5 = abs((myV_tmp1(4) - myV_tmp2(4))/myV_tmp1(4)) - if (abs(myV_tmp1(4)) < 1e-12) err5 = 0d0 + if (abs(myV_tmp1(4)) < 1e-12_wp) err5 = 0._wp ! Determine acceptance/rejection and update step size ! Rule 1: err1, err2, err3 < tol - ! Rule 2: myR_tmp1(4) > 0d0 + ! Rule 2: myR_tmp1(4) > 0._wp ! Rule 3: abs((myR_tmp1(4) - myR_tmp2(4))/myR) < tol ! Rule 4: abs((myV_tmp1(4) - myV_tmp2(4))/myV) < tol - if ((err1 <= 1d-4) .and. (err2 <= 1d-4) .and. (err3 <= 1d-4) & - .and. (err4 < 1d-4) .and. (err5 < 1d-4) & - .and. myR_tmp1(4) > 0d0) then + if ((err1 <= 1e-4_wp) .and. (err2 <= 1e-4_wp) .and. (err3 <= 1e-4_wp) & + .and. (err4 < 1e-4_wp) .and. (err5 < 1e-4_wp) & + .and. myR_tmp1(4) > 0._wp) then ! Accepted. Finalize the sub-step t_new = t_new + h @@ -338,22 +339,22 @@ contains myV = myV_tmp1(4) ! Update step size for the next sub-step - h = h*min(2d0, max(0.5d0, (1d-4/err1)**(1d0/3d0))) + h = h*min(2._wp, max(0.5_wp, (1e-4_wp/err1)**(1._wp/3._wp))) exit else ! Rejected. Update step size for the next try on sub-step - if (err2 <= 1d-4) then - h = 0.5d0*h + if (err2 <= 1e-4_wp) then + h = 0.5_wp*h else - h = 0.25d0*h + h = 0.25_wp*h end if end if end do ! Exit the loop if the final time reached dt - if (t_new == 0.5d0*dt) exit + if (t_new == 0.5_wp*dt) exit end do @@ -368,13 +369,13 @@ contains bub_r_src(j, k, l, q) = q_cons_vf(vs(q))%sf(j, k, l) end if - if (alf < 1.d-11) then - bub_adv_src(j, k, l) = 0d0 - bub_r_src(j, k, l, q) = 0d0 - bub_v_src(j, k, l, q) = 0d0 + if (alf < 1.e-11_wp) then + bub_adv_src(j, k, l) = 0._wp + bub_r_src(j, k, l, q) = 0._wp + bub_v_src(j, k, l, q) = 0._wp if (.not. polytropic) then - bub_p_src(j, k, l, q) = 0d0 - bub_m_src(j, k, l, q) = 0d0 + bub_p_src(j, k, l, q) = 0._wp + bub_m_src(j, k, l, q) = 0._wp end if end if end do @@ -424,13 +425,13 @@ contains subroutine s_initialize_adap_dt(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, & fntait, fBtait, f_bub_adv_src, f_divu, h) !$acc routine seq - real(kind(0d0)), intent(IN) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf - real(kind(0d0)), intent(IN) :: fntait, fBtait, f_bub_adv_src, f_divu - real(kind(0d0)), intent(out) :: h + real(wp), intent(IN) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf + real(wp), intent(IN) :: fntait, fBtait, f_bub_adv_src, f_divu + real(wp), intent(out) :: h - real(kind(0d0)) :: h0, h1 !< Time step size - real(kind(0d0)) :: d0, d1, d2 !< norms - real(kind(0d0)), dimension(2) :: myR_tmp, myV_tmp, myA_tmp !< Bubble radius, radial velocity, and radial acceleration + real(wp) :: h0, h1 !< Time step size + real(wp) :: d0, d1, d2 !< norms + real(wp), dimension(2) :: myR_tmp, myV_tmp, myA_tmp !< Bubble radius, radial velocity, and radial acceleration ! Determine the starting time step ! Evaluate f(x0,y0) @@ -441,12 +442,12 @@ contains f_bub_adv_src, f_divu) ! Compute d0 = ||y0|| and d1 = ||f(x0,y0)|| - d0 = DSQRT((myR_tmp(1)**2d0 + myV_tmp(1)**2d0)/2d0) - d1 = DSQRT((myV_tmp(1)**2d0 + myA_tmp(1)**2d0)/2d0) - if (d0 < 1d-5 .or. d1 < 1d-5) then - h0 = 1d-6 + d0 = sqrt((myR_tmp(1)**2._wp + myV_tmp(1)**2._wp)/2._wp) + d1 = sqrt((myV_tmp(1)**2._wp + myA_tmp(1)**2._wp)/2._wp) + if (d0 < 1e-5_wp .or. d1 < 1e-5_wp) then + h0 = 1e-6_wp else - h0 = 1d-2*(d0/d1) + h0 = 1e-2_wp*(d0/d1) end if ! Evaluate f(x0+h0,y0+h0*f(x0,y0)) @@ -457,18 +458,18 @@ contains f_bub_adv_src, f_divu) ! Compute d2 = ||f(x0+h0,y0+h0*f(x0,y0))-f(x0,y0)||/h0 - d2 = DSQRT(((myV_tmp(2) - myV_tmp(1))**2d0 + (myA_tmp(2) - myA_tmp(1))**2d0)/2d0)/h0 + d2 = sqrt(((myV_tmp(2) - myV_tmp(1))**2._wp + (myA_tmp(2) - myA_tmp(1))**2._wp)/2._wp)/h0 ! Set h1 = (0.01/max(d1,d2))^{1/(p+1)} - ! if max(d1,d2) < 1e-15, h1 = max(1e-6, h0*1e-3) - if (max(d1, d2) < 1d-15) then - h1 = max(1d-6, h0*1d-3) + ! if max(d1,d2) < 1e-15_wp, h1 = max(1e-6_wp, h0*1e-3_wp) + if (max(d1, d2) < 1e-15_wp) then + h1 = max(1e-6_wp, h0*1e-3_wp) else - h1 = (1d-2/max(d1, d2))**(1d0/3d0) + h1 = (1e-2_wp/max(d1, d2))**(1._wp/3._wp) end if ! Set h = min(100*h0,h1) - h = min(100d0*h0, h1) + h = min(100._wp*h0, h1) end subroutine s_initialize_adap_dt @@ -493,12 +494,12 @@ contains fntait, fBtait, f_bub_adv_src, f_divu, h, & myR_tmp, myV_tmp, err) !$acc routine seq - real(kind(0d0)), intent(IN) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf - real(kind(0d0)), intent(IN) :: fntait, fBtait, f_bub_adv_src, f_divu, h - real(kind(0d0)), dimension(4), intent(OUT) :: myR_tmp, myV_tmp - real(kind(0d0)), dimension(4) :: myA_tmp - real(kind(0d0)), intent(OUT) :: err - real(kind(0d0)) :: err_R, err_V + real(wp), intent(IN) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf + real(wp), intent(IN) :: fntait, fBtait, f_bub_adv_src, f_divu, h + real(wp), dimension(4), intent(OUT) :: myR_tmp, myV_tmp + real(wp), dimension(4) :: myA_tmp + real(wp), intent(OUT) :: err + real(wp) :: err_R, err_V ! Stage 0 myR_tmp(1) = fR @@ -515,25 +516,25 @@ contains f_bub_adv_src, f_divu) ! Stage 2 - myR_tmp(3) = myR_tmp(1) + (h/4d0)*(myV_tmp(1) + myV_tmp(2)) - myV_tmp(3) = myV_tmp(1) + (h/4d0)*(myA_tmp(1) + myA_tmp(2)) + myR_tmp(3) = myR_tmp(1) + (h/4._wp)*(myV_tmp(1) + myV_tmp(2)) + myV_tmp(3) = myV_tmp(1) + (h/4._wp)*(myA_tmp(1) + myA_tmp(2)) myA_tmp(3) = f_rddot(fRho, fP, myR_tmp(3), myV_tmp(3), fR0, & fpb, fpbdot, alf, fntait, fBtait, & f_bub_adv_src, f_divu) ! Stage 3 - myR_tmp(4) = myR_tmp(1) + (h/6d0)*(myV_tmp(1) + myV_tmp(2) + 4d0*myV_tmp(3)) - myV_tmp(4) = myV_tmp(1) + (h/6d0)*(myA_tmp(1) + myA_tmp(2) + 4d0*myA_tmp(3)) + myR_tmp(4) = myR_tmp(1) + (h/6._wp)*(myV_tmp(1) + myV_tmp(2) + 4._wp*myV_tmp(3)) + myV_tmp(4) = myV_tmp(1) + (h/6._wp)*(myA_tmp(1) + myA_tmp(2) + 4._wp*myA_tmp(3)) myA_tmp(4) = f_rddot(fRho, fP, myR_tmp(4), myV_tmp(4), fR0, & fpb, fpbdot, alf, fntait, fBtait, & f_bub_adv_src, f_divu) ! Estimate error - err_R = (-5d0*h/24d0)*(myV_tmp(2) + myV_tmp(3) - 2d0*myV_tmp(4)) & + err_R = (-5._wp*h/24._wp)*(myV_tmp(2) + myV_tmp(3) - 2._wp*myV_tmp(4)) & /max(abs(myR_tmp(1)), abs(myR_tmp(4))) - err_V = (-5d0*h/24d0)*(myA_tmp(2) + myA_tmp(3) - 2d0*myA_tmp(4)) & + err_V = (-5._wp*h/24._wp)*(myA_tmp(2) + myA_tmp(3) - 2._wp*myA_tmp(4)) & /max(abs(myV_tmp(1)), abs(myV_tmp(4))) - err = DSQRT((err_R**2d0 + err_V**2d0)/2d0) + err = sqrt((err_R**2._wp + err_V**2._wp)/2._wp) end subroutine s_advance_substep @@ -544,14 +545,14 @@ contains !! @param fpb Internal bubble pressure function f_cpbw(fR0, fR, fV, fpb) !$acc routine seq - real(kind(0d0)), intent(in) :: fR0, fR, fV, fpb + real(wp), intent(in) :: fR0, fR, fV, fpb - real(kind(0d0)) :: f_cpbw + real(wp) :: f_cpbw if (polytropic) then - f_cpbw = (Ca + 2.d0/Web/fR0)*((fR0/fR)**(3.d0*gam)) - Ca - 4.d0*Re_inv*fV/fR - 2.d0/(fR*Web) + f_cpbw = (Ca + 2._wp/Web/fR0)*((fR0/fR)**(3._wp*gam)) - Ca - 4._wp*Re_inv*fV/fR - 2._wp/(fR*Web) else - f_cpbw = fpb - 1.d0 - 4.d0*Re_inv*fV/fR - 2.d0/(fR*Web) + f_cpbw = fpb - 1._wp - 4._wp*Re_inv*fV/fR - 2._wp/(fR*Web) end if end function f_cpbw @@ -563,16 +564,16 @@ contains !! @param fBtait Tait EOS parameter function f_H(fCpbw, fCpinf, fntait, fBtait) !$acc routine seq - real(kind(0d0)), intent(in) :: fCpbw, fCpinf, fntait, fBtait + real(wp), intent(in) :: fCpbw, fCpinf, fntait, fBtait - real(kind(0d0)) :: tmp1, tmp2, tmp3 - real(kind(0d0)) :: f_H + real(wp) :: tmp1, tmp2, tmp3 + real(wp) :: f_H - tmp1 = (fntait - 1.d0)/fntait - tmp2 = (fCpbw/(1.d0 + fBtait) + 1.d0)**tmp1 - tmp3 = (fCpinf/(1.d0 + fBtait) + 1.d0)**tmp1 + tmp1 = (fntait - 1._wp)/fntait + tmp2 = (fCpbw/(1._wp + fBtait) + 1._wp)**tmp1 + tmp3 = (fCpinf/(1._wp + fBtait) + 1._wp)**tmp1 - f_H = (tmp2 - tmp3)*fntait*(1.d0 + fBtait)/(fntait - 1.d0) + f_H = (tmp2 - tmp3)*fntait*(1._wp + fBtait)/(fntait - 1._wp) end function f_H @@ -583,16 +584,16 @@ contains !! @param fH Bubble enthalpy function f_cgas(fCpinf, fntait, fBtait, fH) !$acc routine seq - real(kind(0d0)), intent(in) :: fCpinf, fntait, fBtait, fH + real(wp), intent(in) :: fCpinf, fntait, fBtait, fH - real(kind(0d0)) :: tmp - real(kind(0d0)) :: f_cgas + real(wp) :: tmp + real(wp) :: f_cgas ! get sound speed for Gilmore equations "C" -> c_gas - tmp = (fCpinf/(1.d0 + fBtait) + 1.d0)**((fntait - 1.d0)/fntait) - tmp = fntait*(1.d0 + fBtait)*tmp + tmp = (fCpinf/(1._wp + fBtait) + 1._wp)**((fntait - 1._wp)/fntait) + tmp = fntait*(1._wp + fBtait)*tmp - f_cgas = dsqrt(tmp + (fntait - 1.d0)*fH) + f_cgas = sqrt(tmp + (fntait - 1._wp)*fH) end function f_cgas @@ -606,17 +607,17 @@ contains !! @param divu Divergence of velocity function f_cpinfdot(fRho, fP, falf, fntait, fBtait, advsrc, divu) !$acc routine seq - real(kind(0d0)), intent(in) :: fRho, fP, falf, fntait, fBtait, advsrc, divu + real(wp), intent(in) :: fRho, fP, falf, fntait, fBtait, advsrc, divu - real(kind(0d0)) :: c2_liquid - real(kind(0d0)) :: f_cpinfdot + real(wp) :: c2_liquid + real(wp) :: f_cpinfdot ! get sound speed squared for liquid (only needed for pbdot) ! c_l^2 = gam (p+B) / (rho*(1-alf)) if (mpp_lim) then c2_liquid = fntait*(fP + fBtait)/fRho else - c2_liquid = fntait*(fP + fBtait)/(fRho*(1.d0 - falf)) + c2_liquid = fntait*(fP + fBtait)/(fRho*(1._wp - falf)) end if ! \dot{Cp_inf} = rho sound^2 (alf_src - divu) @@ -636,30 +637,30 @@ contains !! @param fpbdot Time derivative of the internal bubble pressure function f_Hdot(fCpbw, fCpinf, fCpinf_dot, fntait, fBtait, fR, fV, fR0, fpbdot) !$acc routine seq - real(kind(0d0)), intent(in) :: fCpbw, fCpinf, fCpinf_dot, fntait, fBtait - real(kind(0d0)), intent(in) :: fR, fV, fR0, fpbdot + real(wp), intent(in) :: fCpbw, fCpinf, fCpinf_dot, fntait, fBtait + real(wp), intent(in) :: fR, fV, fR0, fpbdot - real(kind(0d0)) :: tmp1, tmp2 - real(kind(0d0)) :: f_Hdot + real(wp) :: tmp1, tmp2 + real(wp) :: f_Hdot if (polytropic) then - tmp1 = (fR0/fR)**(3.d0*gam) - tmp1 = -3.d0*gam*(Ca + 2d0/Web/fR0)*tmp1*fV/fR + tmp1 = (fR0/fR)**(3._wp*gam) + tmp1 = -3._wp*gam*(Ca + 2._wp/Web/fR0)*tmp1*fV/fR else tmp1 = fpbdot end if - tmp2 = (2.d0/Web + 4.d0*Re_inv*fV)*fV/(fR**2.d0) + tmp2 = (2._wp/Web + 4._wp*Re_inv*fV)*fV/(fR**2._wp) f_Hdot = & - (fCpbw/(1.d0 + fBtait) + 1.d0)**(-1.d0/fntait)*(tmp1 + tmp2) & - - (fCpinf/(1.d0 + fBtait) + 1.d0)**(-1.d0/fntait)*fCpinf_dot + (fCpbw/(1._wp + fBtait) + 1._wp)**(-1._wp/fntait)*(tmp1 + tmp2) & + - (fCpinf/(1._wp + fBtait) + 1._wp)**(-1._wp/fntait)*fCpinf_dot ! Hdot = (Cpbw/(1+B) + 1)^(-1/n_tait)*(-3 gam)*(R0/R)^(3gam) V/R - !f_Hdot = ((fCpbw/(1d0+fBtait)+1.d0)**(-1.d0/fntait))*(-3.d0)*gam * & - ! ( (fR0/fR)**(3.d0*gam ))*(fV/fR) + !f_Hdot = ((fCpbw/(1._wp+fBtait)+1._wp)**(-1._wp/fntait))*(-3._wp)*gam * & + ! ( (fR0/fR)**(3._wp*gam ))*(fV/fR) ! Hdot = Hdot - (Cpinf/(1+B) + 1)^(-1/n_tait) Cpinfdot - !f_Hdot = f_Hdot - ((fCpinf/(1.d0+fBtait)+1.d0)**(-1.d0/fntait))*fCpinf_dot + !f_Hdot = f_Hdot - ((fCpinf/(1._wp+fBtait)+1._wp)**(-1._wp/fntait))*fCpinf_dot end function f_Hdot @@ -678,11 +679,11 @@ contains !! @param f_divu Divergence of velocity function f_rddot(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, fntait, fBtait, f_bub_adv_src, f_divu) !$acc routine seq - real(kind(0d0)), intent(in) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf - real(kind(0d0)), intent(in) :: fntait, fBtait, f_bub_adv_src, f_divu + real(wp), intent(in) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf + real(wp), intent(in) :: fntait, fBtait, f_bub_adv_src, f_divu - real(kind(0d0)) :: fCpbw, fCpinf, fCpinf_dot, fH, fHdot, c_gas, c_liquid - real(kind(0d0)) :: f_rddot + real(wp) :: fCpbw, fCpinf, fCpinf_dot, fH, fHdot, c_gas, c_liquid + real(wp) :: f_rddot if (bubble_model == 1) then ! Gilmore bubbles @@ -697,7 +698,7 @@ contains ! Keller-Miksis bubbles fCpinf = fP fCpbw = f_cpbw_KM(fR0, fR, fV, fpb) - c_liquid = dsqrt(fntait*(fP + fBtait)/(fRho*(1.d0 - alf))) + c_liquid = sqrt(fntait*(fP + fBtait)/(fRho*(1._wp - alf))) f_rddot = f_rddot_KM(fpbdot, fCpinf, fCpbw, fRho, fR, fV, fR0, c_liquid) else if (bubble_model == 3) then ! Rayleigh-Plesset bubbles @@ -716,15 +717,15 @@ contains !! @param fCpbw Boundary wall pressure function f_rddot_RP(fCp, fRho, fR, fV, fR0, fCpbw) !$acc routine seq - real(kind(0d0)), intent(in) :: fCp, fRho, fR, fV, fR0, fCpbw + real(wp), intent(in) :: fCp, fRho, fR, fV, fR0, fCpbw - real(kind(0d0)) :: f_rddot_RP + real(wp) :: f_rddot_RP !! rddot = (1/r) ( -3/2 rdot^2 + ((r0/r)^3\gamma - Cp)/rho ) !! rddot = (1/r) ( -3/2 rdot^2 + (tmp1 - Cp)/rho ) !! rddot = (1/r) ( tmp2 ) - f_rddot_RP = (-1.5d0*(fV**2d0) + (fCpbw - fCp)/fRho)/fR + f_rddot_RP = (-1.5_wp*(fV**2._wp) + (fCpbw - fCp)/fRho)/fR end function f_rddot_RP @@ -739,19 +740,19 @@ contains !! @param fBtait Tait EOS parameter function f_rddot_G(fCpbw, fR, fV, fH, fHdot, fcgas, fntait, fBtait) !$acc routine seq - real(kind(0d0)), intent(in) :: fCpbw, fR, fV, fH, fHdot - real(kind(0d0)), intent(in) :: fcgas, fntait, fBtait + real(wp), intent(in) :: fCpbw, fR, fV, fH, fHdot + real(wp), intent(in) :: fcgas, fntait, fBtait - real(kind(0d0)) :: tmp1, tmp2, tmp3 - real(kind(0d0)) :: f_rddot_G + real(wp) :: tmp1, tmp2, tmp3 + real(wp) :: f_rddot_G tmp1 = fV/fcgas - tmp2 = 1.d0 + 4.d0*Re_inv/fcgas/fR*(fCpbw/(1.d0 + fBtait) + 1.d0) & - **(-1.d0/fntait) - tmp3 = 1.5d0*fV**2d0*(tmp1/3.d0 - 1.d0) + fH*(1.d0 + tmp1) & - + fR*fHdot*(1.d0 - tmp1)/fcgas + tmp2 = 1._wp + 4._wp*Re_inv/fcgas/fR*(fCpbw/(1._wp + fBtait) + 1._wp) & + **(-1._wp/fntait) + tmp3 = 1.5_wp*fV**2._wp*(tmp1/3._wp - 1._wp) + fH*(1._wp + tmp1) & + + fR*fHdot*(1._wp - tmp1)/fcgas - f_rddot_G = tmp3/(fR*(1.d0 - tmp1)*tmp2) + f_rddot_G = tmp3/(fR*(1._wp - tmp1)*tmp2) end function f_rddot_G @@ -762,20 +763,20 @@ contains !! @param fpb Internal bubble pressure function f_cpbw_KM(fR0, fR, fV, fpb) !$acc routine seq - real(kind(0d0)), intent(in) :: fR0, fR, fV, fpb + real(wp), intent(in) :: fR0, fR, fV, fpb - real(kind(0d0)) :: f_cpbw_KM + real(wp) :: f_cpbw_KM if (polytropic) then - f_cpbw_KM = Ca*((fR0/fR)**(3.d0*gam)) - Ca + 1d0 + f_cpbw_KM = Ca*((fR0/fR)**(3._wp*gam)) - Ca + 1._wp if (.not. f_is_default(Web)) f_cpbw_KM = f_cpbw_KM + & - (2.d0/(Web*fR0))*((fR0/fR)**(3.d0*gam)) + (2._wp/(Web*fR0))*((fR0/fR)**(3._wp*gam)) else f_cpbw_KM = fpb end if - if (.not. f_is_default(Web)) f_cpbw_KM = f_cpbw_KM - 2.d0/(fR*Web) - if (.not. f_is_default(Re_inv)) f_cpbw_KM = f_cpbw_KM - 4.d0*Re_inv*fV/fR + if (.not. f_is_default(Web)) f_cpbw_KM = f_cpbw_KM - 2._wp/(fR*Web) + if (.not. f_is_default(Re_inv)) f_cpbw_KM = f_cpbw_KM - 4._wp*Re_inv*fV/fR end function f_cpbw_KM @@ -790,32 +791,32 @@ contains !! @param fC Current sound speed function f_rddot_KM(fpbdot, fCp, fCpbw, fRho, fR, fV, fR0, fC) !$acc routine seq - real(kind(0d0)), intent(in) :: fpbdot, fCp, fCpbw - real(kind(0d0)), intent(in) :: fRho, fR, fV, fR0, fC + real(wp), intent(in) :: fpbdot, fCp, fCpbw + real(wp), intent(in) :: fRho, fR, fV, fR0, fC - real(kind(0d0)) :: tmp1, tmp2, cdot_star - real(kind(0d0)) :: f_rddot_KM + real(wp) :: tmp1, tmp2, cdot_star + real(wp) :: f_rddot_KM if (polytropic) then - cdot_star = -3d0*gam*Ca*((fR0/fR)**(3d0*gam))*fV/fR + cdot_star = -3._wp*gam*Ca*((fR0/fR)**(3._wp*gam))*fV/fR if (.not. f_is_default(Web)) cdot_star = cdot_star - & - 3d0*gam*(2d0/(Web*fR0))*((fR0/fR)**(3d0*gam))*fV/fR + 3._wp*gam*(2._wp/(Web*fR0))*((fR0/fR)**(3._wp*gam))*fV/fR else cdot_star = fpbdot end if - if (.not. f_is_default(Web)) cdot_star = cdot_star + (2d0/Web)*fV/(fR**2d0) - if (.not. f_is_default(Re_inv)) cdot_star = cdot_star + 4d0*Re_inv*((fV/fR)**2d0) + if (.not. f_is_default(Web)) cdot_star = cdot_star + (2._wp/Web)*fV/(fR**2._wp) + if (.not. f_is_default(Re_inv)) cdot_star = cdot_star + 4._wp*Re_inv*((fV/fR)**2._wp) tmp1 = fV/fC - tmp2 = 1.5d0*(fV**2d0)*(tmp1/3d0 - 1d0) + & - (1d0 + tmp1)*(fCpbw - fCp)/fRho + & + tmp2 = 1.5_wp*(fV**2._wp)*(tmp1/3._wp - 1._wp) + & + (1._wp + tmp1)*(fCpbw - fCp)/fRho + & cdot_star*fR/(fRho*fC) if (f_is_default(Re_inv)) then - f_rddot_KM = tmp2/(fR*(1d0 - tmp1)) + f_rddot_KM = tmp2/(fR*(1._wp - tmp1)) else - f_rddot_KM = tmp2/(fR*(1d0 - tmp1) + 4d0*Re_inv/(fRho*fC)) + f_rddot_KM = tmp2/(fR*(1._wp - tmp1) + 4._wp*Re_inv/(fRho*fC)) end if end function f_rddot_KM @@ -825,17 +826,17 @@ contains !! @param iR0 Current bubble size index subroutine s_bwproperty(pb, iR0) !$acc routine seq - real(kind(0.d0)), intent(in) :: pb + real(wp), intent(in) :: pb integer, intent(in) :: iR0 - real(kind(0.d0)) :: x_vw + real(wp) :: x_vw ! mass fraction of vapor - chi_vw = 1.d0/(1.d0 + R_v/R_n*(pb/pv - 1.d0)) + chi_vw = 1._wp/(1._wp + R_v/R_n*(pb/pv - 1._wp)) ! mole fraction of vapor & thermal conductivity of gas mixture x_vw = M_n*chi_vw/(M_v + (M_n - M_v)*chi_vw) - k_mw = x_vw*k_v(iR0)/(x_vw + (1.d0 - x_vw)*phi_vn) & - + (1.d0 - x_vw)*k_n(iR0)/(x_vw*phi_nv + 1.d0 - x_vw) + k_mw = x_vw*k_v(iR0)/(x_vw + (1._wp - x_vw)*phi_vn) & + + (1._wp - x_vw)*k_n(iR0)/(x_vw*phi_nv + 1._wp - x_vw) ! gas mixture density rho_mw = pv/(chi_vw*R_v*Tw) @@ -848,20 +849,20 @@ contains !! @param iR0 Bubble size index function f_vflux(fR, fV, fmass_v, iR0) !$acc routine seq - real(kind(0.d0)), intent(in) :: fR - real(kind(0.d0)), intent(in) :: fV - real(kind(0.d0)), intent(in) :: fmass_v + real(wp), intent(in) :: fR + real(wp), intent(in) :: fV + real(wp), intent(in) :: fmass_v integer, intent(in) :: iR0 - real(kind(0.d0)) :: chi_bar - real(kind(0.d0)) :: grad_chi - real(kind(0.d0)) :: f_vflux + real(wp) :: chi_bar + real(wp) :: grad_chi + real(wp) :: f_vflux if (thermal == 3) then !transfer ! constant transfer model chi_bar = fmass_v/(fmass_v + mass_n0(iR0)) grad_chi = -Re_trans_c(iR0)*(chi_bar - chi_vw) - f_vflux = rho_mw*grad_chi/Pe_c/(1.d0 - chi_vw)/fR + f_vflux = rho_mw*grad_chi/Pe_c/(1._wp - chi_vw)/fR else ! polytropic f_vflux = pv*fV/(R_v*Tw) @@ -879,25 +880,25 @@ contains !! @param iR0 Bubble size index function f_bpres_dot(fvflux, fR, fV, fpb, fmass_v, iR0) !$acc routine seq - real(kind(0.d0)), intent(in) :: fvflux - real(kind(0.d0)), intent(in) :: fR - real(kind(0.d0)), intent(in) :: fV - real(kind(0.d0)), intent(in) :: fpb - real(kind(0.d0)), intent(in) :: fmass_v + real(wp), intent(in) :: fvflux + real(wp), intent(in) :: fR + real(wp), intent(in) :: fV + real(wp), intent(in) :: fpb + real(wp), intent(in) :: fmass_v integer, intent(in) :: iR0 - real(kind(0.d0)) :: T_bar - real(kind(0.d0)) :: grad_T - real(kind(0.d0)) :: f_bpres_dot + real(wp) :: T_bar + real(wp) :: grad_T + real(wp) :: f_bpres_dot if (thermal == 3) then T_bar = Tw*(fpb/pb0(iR0))*(fR/R0(iR0))**3 & *(mass_n0(iR0) + mass_v0(iR0))/(mass_n0(iR0) + fmass_v) grad_T = -Re_trans_T(iR0)*(T_bar - Tw) - f_bpres_dot = 3.d0*gamma_m*(-fV*fpb + fvflux*R_v*Tw & - + pb0(iR0)*k_mw*grad_T/Pe_T(iR0)/fR)/fR + f_bpres_dot = 3._wp*gamma_m*(-fV*fpb + fvflux*R_v*Tw & + + pb0(iR0)*k_mw*grad_T/Pe_T(iR0)/fR)/fR else - f_bpres_dot = -3.d0*gamma_m*fV/fR*(fpb - pv) + f_bpres_dot = -3._wp*gamma_m*fV/fR*(fpb - pv) end if end function f_bpres_dot diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index 2ab816965..d888a3f91 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -40,18 +40,18 @@ module m_cbc !! q_prim_vf in the coordinate direction normal to the domain boundary along !! which the CBC is applied. - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: q_prim_rsx_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: q_prim_rsy_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: q_prim_rsz_vf + real(wp), allocatable, dimension(:, :, :, :) :: q_prim_rsx_vf + real(wp), allocatable, dimension(:, :, :, :) :: q_prim_rsy_vf + real(wp), allocatable, dimension(:, :, :, :) :: q_prim_rsz_vf type(scalar_field), allocatable, dimension(:) :: F_rs_vf, F_src_rs_vf !< !! Cell-average fluxes (src - source). These are directly determined from the !! cell-average primitive variables, q_prims_rs_vf, and not a Riemann solver. - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: F_rsx_vf, F_src_rsx_vf !< - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: F_rsy_vf, F_src_rsy_vf !< - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: F_rsz_vf, F_src_rsz_vf !< + real(wp), allocatable, dimension(:, :, :, :) :: F_rsx_vf, F_src_rsx_vf !< + real(wp), allocatable, dimension(:, :, :, :) :: F_rsy_vf, F_src_rsy_vf !< + real(wp), allocatable, dimension(:, :, :, :) :: F_rsz_vf, F_src_rsz_vf !< !! There is a CCE bug that is causing some subset of these variables to interfere !! with variables of the same name in m_riemann_solvers.fpp, and giving this versions @@ -59,34 +59,34 @@ module m_cbc !! in `acc declare create` clauses don't have this problem, so we still need to !! isolate this bug. - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsx_vf_l, flux_src_rsx_vf_l !< - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsy_vf_l, flux_src_rsy_vf_l - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsz_vf_l, flux_src_rsz_vf_l + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsx_vf_l, flux_src_rsx_vf_l !< + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsy_vf_l, flux_src_rsy_vf_l + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsz_vf_l, flux_src_rsz_vf_l - real(kind(0d0)) :: c !< Cell averaged speed of sound - real(kind(0d0)), dimension(2) :: Re !< Cell averaged Reynolds numbers + real(wp) :: c !< Cell averaged speed of sound + real(wp), dimension(2) :: Re !< Cell averaged Reynolds numbers !$acc declare create(c, Re) - real(kind(0d0)) :: dpres_ds !< Spatial derivatives in s-dir of pressure + real(wp) :: dpres_ds !< Spatial derivatives in s-dir of pressure !$acc declare create(dpres_ds) - real(kind(0d0)), allocatable, dimension(:) :: ds !< Cell-width distribution in the s-direction + real(wp), allocatable, dimension(:) :: ds !< Cell-width distribution in the s-direction ! CBC Coefficients ========================================================= - real(kind(0d0)), allocatable, dimension(:, :) :: fd_coef_x !< Finite diff. coefficients x-dir - real(kind(0d0)), allocatable, dimension(:, :) :: fd_coef_y !< Finite diff. coefficients y-dir - real(kind(0d0)), allocatable, dimension(:, :) :: fd_coef_z !< Finite diff. coefficients z-dir + real(wp), allocatable, dimension(:, :) :: fd_coef_x !< Finite diff. coefficients x-dir + real(wp), allocatable, dimension(:, :) :: fd_coef_y !< Finite diff. coefficients y-dir + real(wp), allocatable, dimension(:, :) :: fd_coef_z !< Finite diff. coefficients z-dir !! The first dimension identifies the location of a coefficient in the FD !! formula, while the last dimension denotes the location of the CBC. ! Bug with NVHPC when using nullified pointers in a declare create - ! real(kind(0d0)), pointer, dimension(:, :) :: fd_coef => null() + ! real(wp), pointer, dimension(:, :) :: fd_coef => null() - real(kind(0d0)), allocatable, dimension(:, :, :) :: pi_coef_x !< Polynomial interpolant coefficients in x-dir - real(kind(0d0)), allocatable, dimension(:, :, :) :: pi_coef_y !< Polynomial interpolant coefficients in y-dir - real(kind(0d0)), allocatable, dimension(:, :, :) :: pi_coef_z !< Polynomial interpolant coefficients in z-dir + real(wp), allocatable, dimension(:, :, :) :: pi_coef_x !< Polynomial interpolant coefficients in x-dir + real(wp), allocatable, dimension(:, :, :) :: pi_coef_y !< Polynomial interpolant coefficients in y-dir + real(wp), allocatable, dimension(:, :, :) :: pi_coef_z !< Polynomial interpolant coefficients in z-dir !! The first dimension of the array identifies the polynomial, the !! second dimension identifies the position of its coefficients and the last @@ -106,9 +106,9 @@ module m_cbc !! inflow velocities, pressure, density and void fraction as well as !! outflow velocities and pressure - real(kind(0d0)), allocatable, dimension(:) :: pres_in, pres_out, Del_in, Del_out - real(kind(0d0)), allocatable, dimension(:, :) :: vel_in, vel_out - real(kind(0d0)), allocatable, dimension(:, :) :: alpha_rho_in, alpha_in + real(wp), allocatable, dimension(:) :: pres_in, pres_out, Del_in, Del_out + real(wp), allocatable, dimension(:, :) :: vel_in, vel_out + real(wp), allocatable, dimension(:, :) :: alpha_rho_in, alpha_in !$acc declare create(pres_in, pres_out, Del_in, Del_out) !$acc declare create(vel_in, vel_out) !$acc declare create(alpha_rho_in, alpha_in) @@ -448,7 +448,7 @@ contains integer, intent(in) :: cbc_dir_in, cbc_loc_in ! Cell-boundary locations in the s-direction - real(kind(0d0)), dimension(0:buff_size + 1) :: s_cb + real(wp), dimension(0:buff_size + 1) :: s_cb ! Generic loop iterator integer :: i @@ -457,7 +457,7 @@ contains call s_associate_cbc_coefficients_pointers(cbc_dir_in, cbc_loc_in) ! Determining the cell-boundary locations in the s-direction - s_cb(0) = 0d0 + s_cb(0) = 0._wp do i = 0, buff_size s_cb(i + 1) = s_cb(i) + ds(i) @@ -468,8 +468,8 @@ contains if (cbc_dir_in == ${CBC_DIR}$) then if (weno_order == 1) then - fd_coef_${XYZ}$ (:, cbc_loc_in) = 0d0 - fd_coef_${XYZ}$ (0, cbc_loc_in) = -2d0/(ds(0) + ds(1)) + fd_coef_${XYZ}$ (:, cbc_loc_in) = 0._wp + fd_coef_${XYZ}$ (0, cbc_loc_in) = -2._wp/(ds(0) + ds(1)) fd_coef_${XYZ}$ (1, cbc_loc_in) = -fd_coef_${XYZ}$ (0, cbc_loc_in) ! ================================================================== @@ -477,10 +477,10 @@ contains ! Computing CBC2 Coefficients ====================================== elseif (weno_order == 3) then - fd_coef_${XYZ}$ (:, cbc_loc_in) = 0d0 - fd_coef_${XYZ}$ (0, cbc_loc_in) = -6d0/(3d0*ds(0) + 2d0*ds(1) - ds(2)) - fd_coef_${XYZ}$ (1, cbc_loc_in) = -4d0*fd_coef_${XYZ}$ (0, cbc_loc_in)/3d0 - fd_coef_${XYZ}$ (2, cbc_loc_in) = fd_coef_${XYZ}$ (0, cbc_loc_in)/3d0 + fd_coef_${XYZ}$ (:, cbc_loc_in) = 0._wp + fd_coef_${XYZ}$ (0, cbc_loc_in) = -6._wp/(3._wp*ds(0) + 2._wp*ds(1) - ds(2)) + fd_coef_${XYZ}$ (1, cbc_loc_in) = -4._wp*fd_coef_${XYZ}$ (0, cbc_loc_in)/3._wp + fd_coef_${XYZ}$ (2, cbc_loc_in) = fd_coef_${XYZ}$ (0, cbc_loc_in)/3._wp pi_coef_${XYZ}$ (0, 0, cbc_loc_in) = (s_cb(0) - s_cb(1))/(s_cb(0) - s_cb(2)) @@ -489,14 +489,14 @@ contains ! Computing CBC4 Coefficients ====================================== else - fd_coef_${XYZ}$ (:, cbc_loc_in) = 0d0 - fd_coef_${XYZ}$ (0, cbc_loc_in) = -50d0/(25d0*ds(0) + 2d0*ds(1) & - - 1d1*ds(2) + 1d1*ds(3) & - - 3d0*ds(4)) - fd_coef_${XYZ}$ (1, cbc_loc_in) = -48d0*fd_coef_${XYZ}$ (0, cbc_loc_in)/25d0 - fd_coef_${XYZ}$ (2, cbc_loc_in) = 36d0*fd_coef_${XYZ}$ (0, cbc_loc_in)/25d0 - fd_coef_${XYZ}$ (3, cbc_loc_in) = -16d0*fd_coef_${XYZ}$ (0, cbc_loc_in)/25d0 - fd_coef_${XYZ}$ (4, cbc_loc_in) = 3d0*fd_coef_${XYZ}$ (0, cbc_loc_in)/25d0 + fd_coef_${XYZ}$ (:, cbc_loc_in) = 0._wp + fd_coef_${XYZ}$ (0, cbc_loc_in) = -50._wp/(25._wp*ds(0) + 2._wp*ds(1) & + - 1e1_wp*ds(2) + 1e1_wp*ds(3) & + - 3._wp*ds(4)) + fd_coef_${XYZ}$ (1, cbc_loc_in) = -48._wp*fd_coef_${XYZ}$ (0, cbc_loc_in)/25._wp + fd_coef_${XYZ}$ (2, cbc_loc_in) = 36._wp*fd_coef_${XYZ}$ (0, cbc_loc_in)/25._wp + fd_coef_${XYZ}$ (3, cbc_loc_in) = -16._wp*fd_coef_${XYZ}$ (0, cbc_loc_in)/25._wp + fd_coef_${XYZ}$ (4, cbc_loc_in) = 3._wp*fd_coef_${XYZ}$ (0, cbc_loc_in)/25._wp pi_coef_${XYZ}$ (0, 0, cbc_loc_in) = & ((s_cb(0) - s_cb(1))*(s_cb(1) - s_cb(2))* & @@ -640,37 +640,38 @@ contains ! First-order time derivatives of the partial densities, density, ! velocity, pressure, advection variables, and the specific heat ! ratio and liquid stiffness functions - real(kind(0d0)), dimension(num_fluids) :: dalpha_rho_dt - real(kind(0d0)) :: drho_dt - real(kind(0d0)), dimension(num_dims) :: dvel_dt - real(kind(0d0)) :: dpres_dt - real(kind(0d0)), dimension(num_fluids) :: dadv_dt - real(kind(0d0)) :: dgamma_dt - real(kind(0d0)) :: dpi_inf_dt - real(kind(0d0)) :: dqv_dt - real(kind(0d0)), dimension(contxe) :: alpha_rho, dalpha_rho_ds, mf - real(kind(0d0)), dimension(2) :: Re_cbc - real(kind(0d0)), dimension(num_dims) :: vel, dvel_ds - real(kind(0d0)), dimension(num_fluids) :: adv, dadv_ds - real(kind(0d0)), dimension(sys_size) :: L - real(kind(0d0)), dimension(3) :: lambda - real(kind(0d0)), dimension(num_species) :: Y_s - - real(kind(0d0)) :: rho !< Cell averaged density - real(kind(0d0)) :: pres !< Cell averaged pressure - real(kind(0d0)) :: E !< Cell averaged energy - real(kind(0d0)) :: H !< Cell averaged enthalpy - real(kind(0d0)) :: gamma !< Cell averaged specific heat ratio - real(kind(0d0)) :: pi_inf !< Cell averaged liquid stiffness - real(kind(0d0)) :: qv !< Cell averaged fluid reference energy - real(kind(0d0)) :: c - real(kind(0d0)) :: Ma - - real(kind(0d0)) :: vel_K_sum, vel_dv_dt_sum + + real(wp), dimension(num_fluids) :: dalpha_rho_dt + real(wp) :: drho_dt + real(wp), dimension(num_dims) :: dvel_dt + real(wp) :: dpres_dt + real(wp), dimension(num_fluids) :: dadv_dt + real(wp) :: dgamma_dt + real(wp) :: dpi_inf_dt + real(wp) :: dqv_dt + real(wp), dimension(contxe) :: alpha_rho, dalpha_rho_ds, mf + real(wp), dimension(2) :: Re_cbc + real(wp), dimension(num_dims) :: vel, dvel_ds + real(wp), dimension(num_fluids) :: adv, dadv_ds + real(wp), dimension(sys_size) :: L + real(wp), dimension(3) :: lambda + real(wp), dimension(num_species) :: Y_s + + real(wp) :: rho !< Cell averaged density + real(wp) :: pres !< Cell averaged pressure + real(wp) :: E !< Cell averaged energy + real(wp) :: H !< Cell averaged enthalpy + real(wp) :: gamma !< Cell averaged specific heat ratio + real(wp) :: pi_inf !< Cell averaged liquid stiffness + real(wp) :: qv !< Cell averaged fluid reference energy + real(wp) :: c + real(wp) :: Ma + + real(wp) :: vel_K_sum, vel_dv_dt_sum integer :: i, j, k, r, q !< Generic loop iterators - real(kind(0d0)) :: blkmod1, blkmod2 !< Fluid bulk modulus for Wood mixture sound speed + real(wp) :: blkmod1, blkmod2 !< Fluid bulk modulus for Wood mixture sound speed ! Reshaping of inputted data and association of the FD and PI ! coefficients, or CBC coefficients, respectively, hinging on @@ -788,10 +789,10 @@ contains vel(i) = q_prim_rs${XYZ}$_vf(0, k, r, contxe + i) end do - vel_K_sum = 0d0 + vel_K_sum = 0._wp !$acc loop seq do i = 1, num_dims - vel_K_sum = vel_K_sum + vel(i)**2d0 + vel_K_sum = vel_K_sum + vel(i)**2._wp end do pres = q_prim_rs${XYZ}$_vf(0, k, r, E_idx) @@ -812,29 +813,29 @@ contains mf(i) = alpha_rho(i)/rho end do - E = gamma*pres + pi_inf + 5d-1*rho*vel_K_sum + E = gamma*pres + pi_inf + 5e-1_wp*rho*vel_K_sum H = (E + pres)/rho ! Compute mixture sound speed - call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_K_sum, 0d0, c) + call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_K_sum, 0._wp, c) ! ============================================================ ! First-Order Spatial Derivatives of Primitive Variables ===== !$acc loop seq do i = 1, contxe - dalpha_rho_ds(i) = 0d0 + dalpha_rho_ds(i) = 0._wp end do !$acc loop seq do i = 1, num_dims - dvel_ds(i) = 0d0 + dvel_ds(i) = 0._wp end do - dpres_ds = 0d0 + dpres_ds = 0._wp !$acc loop seq do i = 1, advxe - E_idx - dadv_ds(i) = 0d0 + dadv_ds(i) = 0._wp end do !$acc loop seq @@ -882,7 +883,7 @@ contains if (bc_${XYZ}$%grcbc_in) then !$acc loop seq do i = 2, momxb - L(2) = c**3d0*Ma*(alpha_rho(i - 1) - alpha_rho_in(i - 1, ${CBC_DIR}$))/Del_in(${CBC_DIR}$) - c*Ma*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) + L(2) = c**3._wp*Ma*(alpha_rho(i - 1) - alpha_rho_in(i - 1, ${CBC_DIR}$))/Del_in(${CBC_DIR}$) - c*Ma*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) end do if (n > 0) then L(momxb + 1) = c*Ma*(vel(dir_idx(2)) - vel_in(${CBC_DIR}$, dir_idx(2)))/Del_in(${CBC_DIR}$) @@ -894,17 +895,17 @@ contains do i = E_idx, advxe - 1 L(i) = c*Ma*(adv(i + 1 - E_idx) - alpha_in(i + 1 - E_idx, ${CBC_DIR}$))/Del_in(${CBC_DIR}$) end do - L(advxe) = rho*c**2d0*(1d0 + Ma)*(vel(dir_idx(1)) + vel_in(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_in(${CBC_DIR}$) + c*(1d0 + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) + L(advxe) = rho*c**2._wp*(1._wp + Ma)*(vel(dir_idx(1)) + vel_in(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_in(${CBC_DIR}$) + c*(1._wp + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) end if else if ((cbc_loc == -1 .and. bc${XYZ}$b == -8) .or. (cbc_loc == 1 .and. bc${XYZ}$e == -8)) then call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds) ! Add GRCBC for Subsonic Outflow (Pressure) if (bc_${XYZ}$%grcbc_out) then - L(advxe) = c*(1d0 - Ma)*(pres - pres_out(${CBC_DIR}$))/Del_out(${CBC_DIR}$) + L(advxe) = c*(1._wp - Ma)*(pres - pres_out(${CBC_DIR}$))/Del_out(${CBC_DIR}$) ! Add GRCBC for Subsonic Outflow (Normal Velocity) if (bc_${XYZ}$%grcbc_vel_out) then - L(advxe) = L(advxe) + rho*c**2d0*(1d0 - Ma)*(vel(dir_idx(1)) + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) + L(advxe) = L(advxe) + rho*c**2._wp*(1._wp - Ma)*(vel(dir_idx(1)) + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) end if end if else if ((cbc_loc == -1 .and. bc${XYZ}$b == -9) .or. (cbc_loc == 1 .and. bc${XYZ}$e == -9)) then @@ -919,10 +920,10 @@ contains ! Be careful about the cylindrical coordinate! if (cyl_coord .and. cbc_dir == 2 .and. cbc_loc == 1) then - dpres_dt = -5d-1*(L(advxe) + L(1)) + rho*c*c*vel(dir_idx(1)) & + dpres_dt = -5e-1_wp*(L(advxe) + L(1)) + rho*c*c*vel(dir_idx(1)) & /y_cc(n) else - dpres_dt = -5d-1*(L(advxe) + L(1)) + dpres_dt = -5e-1_wp*(L(advxe) + L(1)) end if !$acc loop seq @@ -934,12 +935,12 @@ contains !$acc loop seq do i = 1, num_dims dvel_dt(dir_idx(i)) = dir_flg(dir_idx(i))* & - (L(1) - L(advxe))/(2d0*rho*c) + & - (dir_flg(dir_idx(i)) - 1d0)* & + (L(1) - L(advxe))/(2._wp*rho*c) + & + (dir_flg(dir_idx(i)) - 1._wp)* & L(momxb + i - 1) end do - vel_dv_dt_sum = 0d0 + vel_dv_dt_sum = 0._wp !$acc loop seq do i = 1, num_dims vel_dv_dt_sum = vel_dv_dt_sum + vel(i)*dvel_dt(i) @@ -958,7 +959,7 @@ contains end do end if - drho_dt = 0d0; dgamma_dt = 0d0; dpi_inf_dt = 0d0; dqv_dt = 0d0 + drho_dt = 0._wp; dgamma_dt = 0._wp; dpi_inf_dt = 0._wp; dqv_dt = 0._wp if (model_eqns == 1) then drho_dt = dalpha_rho_dt(1) @@ -995,19 +996,19 @@ contains + dpi_inf_dt & + dqv_dt & + rho*vel_dv_dt_sum & - + 5d-1*drho_dt*vel_K_sum) + + 5e-1_wp*drho_dt*vel_K_sum) if (riemann_solver == 1) then !$acc loop seq do i = advxb, advxe - flux_rs${XYZ}$_vf_l(-1, k, r, i) = 0d0 + flux_rs${XYZ}$_vf_l(-1, k, r, i) = 0._wp end do !$acc loop seq do i = advxb, advxe flux_src_rs${XYZ}$_vf_l(-1, k, r, i) = & - 1d0/max(abs(vel(dir_idx(1))), sgm_eps) & - *sign(1d0, vel(dir_idx(1))) & + 1._wp/max(abs(vel(dir_idx(1))), sgm_eps) & + *sign(1._wp, vel(dir_idx(1))) & *(flux_rs${XYZ}$_vf_l(0, k, r, i) & + vel(dir_idx(1)) & *flux_src_rs${XYZ}$_vf_l(0, k, r, i) & @@ -1077,13 +1078,13 @@ contains if (cbc_dir == 1) then is1%beg = 0; is1%end = buff_size; is2 = iy; is3 = iz - dir_idx = (/1, 2, 3/); dir_flg = (/1d0, 0d0, 0d0/) + dir_idx = (/1, 2, 3/); dir_flg = (/1._wp, 0._wp, 0._wp/) elseif (cbc_dir == 2) then is1%beg = 0; is1%end = buff_size; is2 = ix; is3 = iz - dir_idx = (/2, 1, 3/); dir_flg = (/0d0, 1d0, 0d0/) + dir_idx = (/2, 1, 3/); dir_flg = (/0._wp, 1._wp, 0._wp/) else is1%beg = 0; is1%end = buff_size; is2 = iy; is3 = ix - dir_idx = (/3, 1, 2/); dir_flg = (/0d0, 0d0, 1d0/) + dir_idx = (/3, 1, 2/); dir_flg = (/0._wp, 0._wp, 1._wp/) end if dj = max(0, cbc_loc) @@ -1111,7 +1112,7 @@ contains do j = 0, buff_size q_prim_rsx_vf(j, k, r, momxb) = & q_prim_vf(momxb)%sf(dj*(m - 2*j) + j, k, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1123,7 +1124,7 @@ contains do j = -1, buff_size flux_rsx_vf_l(j, k, r, i) = & flux_vf(i)%sf(dj*((m - 1) - 2*j) + j, k, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1158,7 +1159,7 @@ contains do j = -1, buff_size flux_src_rsx_vf_l(j, k, r, advxb) = & flux_src_vf(advxb)%sf(dj*((m - 1) - 2*j) + j, k, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1187,7 +1188,7 @@ contains do j = 0, buff_size q_prim_rsy_vf(j, k, r, momxb + 1) = & q_prim_vf(momxb + 1)%sf(k, dj*(n - 2*j) + j, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1199,7 +1200,7 @@ contains do j = -1, buff_size flux_rsy_vf_l(j, k, r, i) = & flux_vf(i)%sf(k, dj*((n - 1) - 2*j) + j, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1234,7 +1235,7 @@ contains do j = -1, buff_size flux_src_rsy_vf_l(j, k, r, advxb) = & flux_src_vf(advxb)%sf(k, dj*((n - 1) - 2*j) + j, r)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1263,7 +1264,7 @@ contains do j = 0, buff_size q_prim_rsz_vf(j, k, r, momxe) = & q_prim_vf(momxe)%sf(r, k, dj*(p - 2*j) + j)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1275,7 +1276,7 @@ contains do j = -1, buff_size flux_rsz_vf_l(j, k, r, i) = & flux_vf(i)%sf(r, k, dj*((p - 1) - 2*j) + j)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1310,7 +1311,7 @@ contains do j = -1, buff_size flux_src_rsz_vf_l(j, k, r, advxb) = & flux_src_vf(advxb)%sf(r, k, dj*((p - 1) - 2*j) + j)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1360,7 +1361,7 @@ contains do j = -1, buff_size flux_vf(i)%sf(dj*((m - 1) - 2*j) + j, k, r) = & flux_rsx_vf_l(j, k, r, i)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1394,7 +1395,7 @@ contains do j = -1, buff_size flux_src_vf(advxb)%sf(dj*((m - 1) - 2*j) + j, k, r) = & flux_src_rsx_vf_l(j, k, r, advxb)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1411,7 +1412,7 @@ contains do j = -1, buff_size flux_vf(i)%sf(k, dj*((n - 1) - 2*j) + j, r) = & flux_rsy_vf_l(j, k, r, i)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1446,7 +1447,7 @@ contains do j = -1, buff_size flux_src_vf(advxb)%sf(k, dj*((n - 1) - 2*j) + j, r) = & flux_src_rsy_vf_l(j, k, r, advxb)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1464,7 +1465,7 @@ contains do j = -1, buff_size flux_vf(i)%sf(r, k, dj*((p - 1) - 2*j) + j) = & flux_rsz_vf_l(j, k, r, i)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do @@ -1499,7 +1500,7 @@ contains do j = -1, buff_size flux_src_vf(advxb)%sf(r, k, dj*((p - 1) - 2*j) + j) = & flux_src_rsz_vf_l(j, k, r, advxb)* & - sign(1d0, -real(cbc_loc, kind(0d0))) + sign(1._wp, -1._wp*cbc_loc) end do end do end do diff --git a/src/simulation/m_checker.fpp b/src/simulation/m_checker.fpp index d19a85f07..933f4e995 100644 --- a/src/simulation/m_checker.fpp +++ b/src/simulation/m_checker.fpp @@ -39,6 +39,7 @@ contains call s_check_inputs_body_forces call s_check_inputs_misc call s_check_inputs_grcbc + call s_check_inputs_geometry_precision end subroutine s_check_inputs @@ -51,6 +52,7 @@ contains #ifndef MFC_cuTENSOR @:PROHIBIT(cu_tensor, "MFC was not built with the NVIDIA cuTENSOR library") #endif + end subroutine s_check_inputs_compilers !> Checks constraints on WENO scheme parameters @@ -66,13 +68,15 @@ contains "For 3D simulation, p must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is "//trim(numStr)) @:PROHIBIT(weno_order /= 1 .and. f_is_default(weno_eps), & "weno_order != 1, but weno_eps is not set. A typical value of weno_eps is 1e-6") - @:PROHIBIT(weno_eps <= 0d0, "weno_eps must be positive. A typical value of weno_eps is 1e-6") - @:PROHIBIT(wenoz .and. weno_order == 7 .and. f_is_default(wenoz_q), & + + @:PROHIBIT(weno_eps <= 0._wp, "weno_eps must be positive. A typical value of weno_eps is 1e-6") + @:PROHIBIT(wenoz .and. weno_order == real(7, wp) .and. f_is_default(real(wenoz_q, wp)), & "wenoz is used at 7th order, but wenoz_q is not set. It should be either 2, 3, or 4") - @:PROHIBIT(wenoz .and. weno_order == 7 .and. .not. (f_approx_equal(wenoz_q, 2d0) .or. f_approx_equal(wenoz_q, 3d0) .or. f_approx_equal(wenoz_q, 4d0)), & + @:PROHIBIT(wenoz .and. weno_order == real(7, wp) .and. .not. (f_approx_equal(real(wenoz_q, wp), real(2, wp)) .or. & + f_approx_equal(real(wenoz_q, wp), real(3, wp)) .or. f_approx_equal(real(wenoz_q, wp), real(4, wp))), & "wenoz_q must be either 2, 3, or 4") @:PROHIBIT(teno .and. f_is_default(teno_CT), "teno is used, but teno_CT is not set. A typical value of teno_CT is 1e-6") - @:PROHIBIT(teno .and. teno_CT <= 0d0, "teno_CT must be positive. A typical value of teno_CT is 1e-6") + @:PROHIBIT(teno .and. teno_CT <= 0._wp, "teno_CT must be positive. A typical value of teno_CT is 1e-6") @:PROHIBIT(count([mapped_weno, wenoz, teno]) >= 2, "Only one of mapped_weno, wenoz, or teno can be set to true") @:PROHIBIT(weno_order == 1 .and. mapped_weno) @:PROHIBIT(weno_order == 1 .and. wenoz) @@ -95,6 +99,14 @@ contains @:PROHIBIT(low_Mach /= 0 .and. model_eqns /= 2, "low_Mach = 1 or 2 requires model_eqns = 2") end subroutine s_check_inputs_riemann_solver + !> Checks constraints on geometry and precision + subroutine s_check_inputs_geometry_precision + ! Prevent spherical geometry in single precision +#ifdef MFC_SINGLE_PRECISION + @:PROHIBIT(.not. (cyl_coord .neqv. .true. .or. (cyl_coord .and. p == 0)), "Fully 3D cylindrical grid (geometry = 3) is not supported in single precision.") +#endif + end subroutine s_check_inputs_geometry_precision + !> Checks constraints on time stepping parameters subroutine s_check_inputs_time_stepping if (.not. cfl_dt) then @@ -200,7 +212,7 @@ contains "acoustic("//trim(jStr)//")%dipole is not supported for support >= 5 (non-planar supports)") @:PROHIBIT(acoustic(j)%support < 5 .and. f_is_default(acoustic(j)%dir), & "acoustic("//trim(jStr)//")%dir must be specified for support < 5 (planer support)") - @:PROHIBIT(acoustic(j)%support == 1 .and. f_approx_equal(acoustic(j)%dir, 0d0), & + @:PROHIBIT(acoustic(j)%support == 1 .and. f_approx_equal(acoustic(j)%dir, 0._wp), & "acoustic("//trim(jStr)//")dir must be non-zero for support = 1") @:PROHIBIT(acoustic(j)%pulse == 2 .and. f_is_default(acoustic(j)%delay), & "acoustic("//trim(jStr)//")%delay must be specified for pulse = 2 (Gaussian)") @@ -209,20 +221,20 @@ contains @:PROHIBIT((acoustic(j)%support == 2 .or. acoustic(j)%support == 3) .and. f_is_default(acoustic(j)%length), & "acoustic("//trim(jStr)//")%length must be specified for support = 2 or 3") - @:PROHIBIT((acoustic(j)%support == 2 .or. acoustic(j)%support == 3) .and. acoustic(j)%length <= 0d0, & + @:PROHIBIT((acoustic(j)%support == 2 .or. acoustic(j)%support == 3) .and. acoustic(j)%length <= 0._wp, & "acoustic("//trim(jStr)//")%length must be positive for support = 2 or 3") @:PROHIBIT(acoustic(j)%support == 3 .and. f_is_default(acoustic(j)%height), & "acoustic("//trim(jStr)//")%height must be specified for support = 3") - @:PROHIBIT(acoustic(j)%support == 3 .and. acoustic(j)%height <= 0d0, & + @:PROHIBIT(acoustic(j)%support == 3 .and. acoustic(j)%height <= 0._wp, & "acoustic("//trim(jStr)//")%height must be positive for support = 3") @:PROHIBIT(acoustic(j)%support >= 5 .and. f_is_default(acoustic(j)%foc_length), & "acoustic("//trim(jStr)//")%foc_length must be specified for support >= 5 (non-planar supports)") - @:PROHIBIT(acoustic(j)%support >= 5 .and. acoustic(j)%foc_length <= 0d0, & + @:PROHIBIT(acoustic(j)%support >= 5 .and. acoustic(j)%foc_length <= 0._wp, & "acoustic("//trim(jStr)//")%foc_length must be positive for support >= 5 (non-planar supports)") @:PROHIBIT(acoustic(j)%support >= 5 .and. f_is_default(acoustic(j)%aperture), & "acoustic("//trim(jStr)//")%aperture must be specified for support >= 5 (non-planar supports)") - @:PROHIBIT(acoustic(j)%support >= 5 .and. acoustic(j)%aperture <= 0d0, & + @:PROHIBIT(acoustic(j)%support >= 5 .and. acoustic(j)%aperture <= 0._wp, & "acoustic("//trim(jStr)//")%aperture must be positive for support >= 5 (non-planar supports)") @:PROHIBIT(any(acoustic(j)%support == (/9, 10, 11/)) .and. acoustic(j)%num_elements == dflt_int, & @@ -235,11 +247,11 @@ contains "acoustic("//trim(jStr)//")%element_on must be less than or equal to num_elements for support = 9, 10, or 11 (transducer array)") @:PROHIBIT(any(acoustic(j)%support == (/9, 10/)) .and. f_is_default(acoustic(j)%element_spacing_angle), & "acoustic("//trim(jStr)//")%element_spacing_angle must be specified for support = 9 or 10 (2D transducer array)") - @:PROHIBIT(any(acoustic(j)%support == (/9, 10/)) .and. acoustic(j)%element_spacing_angle < 0d0, & + @:PROHIBIT(any(acoustic(j)%support == (/9, 10/)) .and. acoustic(j)%element_spacing_angle < 0._wp, & "acoustic("//trim(jStr)//")%element_spacing_angle must be non-negative for support = 9 or 10 (2D transducer array)") @:PROHIBIT(acoustic(j)%support == 11 .and. f_is_default(acoustic(j)%element_polygon_ratio), & "acoustic("//trim(jStr)//")%element_polygon_ratio must be specified for support = 11 (3D transducer array)") - @:PROHIBIT(acoustic(j)%support == 11 .and. acoustic(j)%element_polygon_ratio <= 0d0, & + @:PROHIBIT(acoustic(j)%support == 11 .and. acoustic(j)%element_polygon_ratio <= 0._wp, & "acoustic("//trim(jStr)//")%element_polygon_ratio must be positive for support = 11 (3D transducer array)") end do @@ -282,7 +294,7 @@ contains do i = 1, num_fluids do j = 1, 2 call s_int_to_str(j, jStr) - @:PROHIBIT((.not. f_is_default(fluid_pp(i)%Re(j))) .and. fluid_pp(i)%Re(j) <= 0d0, & + @:PROHIBIT((.not. f_is_default(fluid_pp(i)%Re(j))) .and. fluid_pp(i)%Re(j) <= 0._wp, & "fluid_pp("//trim(iStr)//")%"// "Re("//trim(jStr)//") must be positive.") @:PROHIBIT(model_eqns == 1 .and. (.not. f_is_default(fluid_pp(i)%Re(j))), & "model_eqns = 1 does not support fluid_pp("//trim(iStr)//")%"// "Re("//trim(jStr)//")") diff --git a/src/simulation/m_chemistry.fpp b/src/simulation/m_chemistry.fpp index 27e2923e3..d4c468420 100644 --- a/src/simulation/m_chemistry.fpp +++ b/src/simulation/m_chemistry.fpp @@ -39,7 +39,7 @@ contains !$acc kernels do i = 1, num_dims - grads(i)%sf(:, :, :) = 0.0d0 + grads(i)%sf(:, :, :) = 0.0_wp end do !$acc end kernels @@ -56,10 +56,11 @@ contains type(scalar_field), dimension(sys_size), intent(INOUT) :: rhs_vf, q_cons_qp, q_prim_qp integer :: x, y, z integer :: eqn - real(kind(0d0)) :: T - real(kind(0d0)) :: rho, omega_m - real(kind(0d0)), dimension(num_species) :: Ys - real(kind(0d0)), dimension(num_species) :: omega + + real(wp) :: T + real(wp) :: rho, omega_m + real(wp), dimension(num_species) :: Ys + real(wp), dimension(num_species) :: omega if (chemistry) then !$acc parallel loop collapse(3) gang vector default(present) & diff --git a/src/simulation/m_compute_cbc.fpp b/src/simulation/m_compute_cbc.fpp index 6a18c1eb4..f7ef81c81 100644 --- a/src/simulation/m_compute_cbc.fpp +++ b/src/simulation/m_compute_cbc.fpp @@ -33,20 +33,20 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i L(1) = lambda(1)*(dpres_ds - rho*c*dvel_ds(dir_idx(1))) do i = 2, advxe - L(i) = 0d0 + L(i) = 0._wp end do L(advxe) = L(1) @@ -63,35 +63,35 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i !< Generic loop iterator - L(1) = (5d-1 - 5d-1*sign(1d0, lambda(1)))*lambda(1) & + L(1) = (5e-1_wp - 5e-1_wp*sign(1._wp, lambda(1)))*lambda(1) & *(dpres_ds - rho*c*dvel_ds(dir_idx(1))) do i = 2, momxb - L(i) = (5d-1 - 5d-1*sign(1d0, lambda(2)))*lambda(2) & + L(i) = (5e-1_wp - 5e-1_wp*sign(1._wp, lambda(2)))*lambda(2) & *(c*c*dalpha_rho_ds(i - 1) - mf(i - 1)*dpres_ds) end do do i = momxb + 1, momxe - L(i) = (5d-1 - 5d-1*sign(1d0, lambda(2)))*lambda(2) & + L(i) = (5e-1_wp - 5e-1_wp*sign(1._wp, lambda(2)))*lambda(2) & *(dvel_ds(dir_idx(i - contxe))) end do do i = E_idx, advxe - 1 - L(i) = (5d-1 - 5d-1*sign(1d0, lambda(2)))*lambda(2) & + L(i) = (5e-1_wp - 5e-1_wp*sign(1._wp, lambda(2)))*lambda(2) & *(dadv_ds(i - momxe)) end do - L(advxe) = (5d-1 - 5d-1*sign(1d0, lambda(3)))*lambda(3) & + L(advxe) = (5e-1_wp - 5e-1_wp*sign(1._wp, lambda(3)))*lambda(3) & *(dpres_ds + rho*c*dvel_ds(dir_idx(1))) end subroutine s_compute_nonreflecting_subsonic_buffer_L @@ -105,20 +105,20 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i L(1) = lambda(1)*(dpres_ds - rho*c*dvel_ds(dir_idx(1))) do i = 2, advxe - L(i) = 0d0 + L(i) = 0._wp end do end subroutine s_compute_nonreflecting_subsonic_inflow_L @@ -133,13 +133,13 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i !> Generic loop iterator @@ -158,7 +158,7 @@ contains end do ! bubble index - L(advxe) = 0d0 + L(advxe) = 0._wp end subroutine s_compute_nonreflecting_subsonic_outflow_L @@ -175,13 +175,13 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i !> Generic loop iterator @@ -199,7 +199,7 @@ contains L(i) = lambda(2)*(dadv_ds(i - momxe)) end do - L(advxe) = L(1) + 2d0*rho*c*lambda(2)*dvel_ds(dir_idx(1)) + L(advxe) = L(1) + 2._wp*rho*c*lambda(2)*dvel_ds(dir_idx(1)) end subroutine s_compute_force_free_subsonic_outflow_L @@ -213,13 +213,13 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i !> Generic loop iterator @@ -252,17 +252,17 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i do i = 1, advxe - L(i) = 0d0 + L(i) = 0._wp end do end subroutine s_compute_supersonic_inflow_L @@ -277,13 +277,13 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(3), intent(in) :: lambda - real(kind(0d0)), dimension(sys_size), intent(inout) :: L - real(kind(0d0)), intent(in) :: rho, c - real(kind(0d0)), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds - real(kind(0d0)), intent(in) :: dpres_ds - real(kind(0d0)), dimension(num_dims), intent(in) :: dvel_ds - real(kind(0d0)), dimension(num_fluids), intent(in) :: dadv_ds + real(wp), dimension(3), intent(in) :: lambda + real(wp), dimension(sys_size), intent(inout) :: L + real(wp), intent(in) :: rho, c + real(wp), dimension(num_fluids), intent(in) :: mf, dalpha_rho_ds + real(wp), intent(in) :: dpres_ds + real(wp), dimension(num_dims), intent(in) :: dvel_ds + real(wp), dimension(num_fluids), intent(in) :: dadv_ds integer :: i !< Generic loop iterator diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index f69418f7e..2c74e757a 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -48,24 +48,24 @@ module m_data_output s_close_probe_files, & s_finalize_data_output_module - real(kind(0d0)), allocatable, dimension(:, :, :) :: icfl_sf !< ICFL stability criterion - real(kind(0d0)), allocatable, dimension(:, :, :) :: vcfl_sf !< VCFL stability criterion - real(kind(0d0)), allocatable, dimension(:, :, :) :: ccfl_sf !< CCFL stability criterion - real(kind(0d0)), allocatable, dimension(:, :, :) :: Rc_sf !< Rc stability criterion + real(wp), allocatable, dimension(:, :, :) :: icfl_sf !< ICFL stability criterion + real(wp), allocatable, dimension(:, :, :) :: vcfl_sf !< VCFL stability criterion + real(wp), allocatable, dimension(:, :, :) :: ccfl_sf !< CCFL stability criterion + real(wp), allocatable, dimension(:, :, :) :: Rc_sf !< Rc stability criterion !$acc declare create(icfl_sf, vcfl_sf, ccfl_sf, Rc_sf) - real(kind(0d0)) :: icfl_max_loc, icfl_max_glb !< ICFL stability extrema on local and global grids - real(kind(0d0)) :: vcfl_max_loc, vcfl_max_glb !< VCFL stability extrema on local and global grids - real(kind(0d0)) :: ccfl_max_loc, ccfl_max_glb !< CCFL stability extrema on local and global grids - real(kind(0d0)) :: Rc_min_loc, Rc_min_glb !< Rc stability extrema on local and global grids + real(wp) :: icfl_max_loc, icfl_max_glb !< ICFL stability extrema on local and global grids + real(wp) :: vcfl_max_loc, vcfl_max_glb !< VCFL stability extrema on local and global grids + real(wp) :: ccfl_max_loc, ccfl_max_glb !< CCFL stability extrema on local and global grids + real(wp) :: Rc_min_loc, Rc_min_glb !< Rc stability extrema on local and global grids !$acc declare create(icfl_max_loc, icfl_max_glb, vcfl_max_loc, vcfl_max_glb, ccfl_max_loc, ccfl_max_glb, Rc_min_loc, Rc_min_glb) !> @name ICFL, VCFL, CCFL and Rc stability criteria extrema over all the time-steps !> @{ - real(kind(0d0)) :: icfl_max !< ICFL criterion maximum - real(kind(0d0)) :: vcfl_max !< VCFL criterion maximum - real(kind(0d0)) :: ccfl_max !< CCFL criterion maximum - real(kind(0d0)) :: Rc_min !< Rc criterion maximum + real(wp) :: icfl_max !< ICFL criterion maximum + real(wp) :: vcfl_max !< VCFL criterion maximum + real(wp) :: ccfl_max !< CCFL criterion maximum + real(wp) :: Rc_min !< Rc criterion maximum !> @} contains @@ -215,16 +215,16 @@ contains type(scalar_field), dimension(sys_size), intent(IN) :: q_prim_vf integer, intent(IN) :: t_step - real(kind(0d0)) :: rho !< Cell-avg. density - real(kind(0d0)), dimension(num_dims) :: vel !< Cell-avg. velocity - real(kind(0d0)) :: vel_sum !< Cell-avg. velocity sum - real(kind(0d0)) :: pres !< Cell-avg. pressure - real(kind(0d0)), dimension(num_fluids) :: alpha !< Cell-avg. volume fraction - real(kind(0d0)) :: gamma !< Cell-avg. sp. heat ratio - real(kind(0d0)) :: pi_inf !< Cell-avg. liquid stiffness function - real(kind(0d0)) :: c !< Cell-avg. sound speed - real(kind(0d0)) :: H !< Cell-avg. enthalpy - real(kind(0d0)), dimension(2) :: Re !< Cell-avg. Reynolds numbers + real(wp) :: rho !< Cell-avg. density + real(wp), dimension(num_dims) :: vel !< Cell-avg. velocity + real(wp) :: vel_sum !< Cell-avg. velocity sum + real(wp) :: pres !< Cell-avg. pressure + real(wp), dimension(num_fluids) :: alpha !< Cell-avg. volume fraction + real(wp) :: gamma !< Cell-avg. sp. heat ratio + real(wp) :: pi_inf !< Cell-avg. liquid stiffness function + real(wp) :: c !< Cell-avg. sound speed + real(wp) :: H !< Cell-avg. enthalpy + real(wp), dimension(2) :: Re !< Cell-avg. Reynolds numbers integer :: j, k, l ! Computing Stability Criteria at Current Time-step ================ @@ -233,7 +233,8 @@ contains do k = 0, n do j = 0, m call s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel, vel_sum, j, k, l) - call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0d0, c) + + call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0._wp, c) if (viscous) then call s_compute_stability_from_dt(vel, c, rho, Re, j, k, l, icfl_sf, vcfl_sf, Rc_sf) @@ -312,7 +313,7 @@ contains if (icfl_max_glb /= icfl_max_glb) then call s_mpi_abort('ICFL is NaN. Exiting ...') - elseif (icfl_max_glb > 1d0) then + elseif (icfl_max_glb > 1._wp) then print *, 'icfl', icfl_max_glb call s_mpi_abort('ICFL is greater than 1.0. Exiting ...') end if @@ -320,7 +321,7 @@ contains if (viscous) then if (vcfl_max_glb /= vcfl_max_glb) then call s_mpi_abort('VCFL is NaN. Exiting ...') - elseif (vcfl_max_glb > 1d0) then + elseif (vcfl_max_glb > 1._wp) then print *, 'vcfl', vcfl_max_glb call s_mpi_abort('VCFL is greater than 1.0. Exiting ...') end if @@ -355,7 +356,7 @@ contains integer :: i, j, k, l, r - real(kind(0d0)) :: gamma, lit_gamma, pi_inf, qv !< Temporary EOS params + real(wp) :: gamma, lit_gamma, pi_inf, qv !< Temporary EOS params ! Creating or overwriting the time-step root directory write (t_step_dir, '(A,I0,A,I0)') trim(case_dir)//'/p_all' @@ -452,7 +453,7 @@ contains end if gamma = fluid_pp(1)%gamma - lit_gamma = 1d0/fluid_pp(1)%gamma + 1d0 + lit_gamma = 1._wp/fluid_pp(1)%gamma + 1._wp pi_inf = fluid_pp(1)%pi_inf qv = fluid_pp(1)%qv @@ -475,9 +476,9 @@ contains do i = 1, sys_size !$acc update host(q_prim_vf(i)%sf(:,:,:)) end do - ! q_prim_vf(bubxb) stores the value of nb needed in riemann solvers, so replace with true primitive value (=1d0) + ! q_prim_vf(bubxb) stores the value of nb needed in riemann solvers, so replace with true primitive value (=1._wp) if (qbmm) then - q_prim_vf(bubxb)%sf = 1d0 + q_prim_vf(bubxb)%sf = 1._wp end if end if @@ -770,8 +771,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -781,7 +782,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Write pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -789,7 +790,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -797,7 +798,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -827,8 +828,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -840,10 +841,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Write pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -853,10 +854,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -866,10 +867,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_WRITE_ALL(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -888,89 +889,90 @@ contains integer, intent(in) :: t_step type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf - real(kind(0d0)), dimension(0:m, 0:n, 0:p), intent(in) :: accel_mag + real(wp), dimension(0:m, 0:n, 0:p), intent(in) :: accel_mag - real(kind(0d0)), dimension(-1:m) :: distx - real(kind(0d0)), dimension(-1:n) :: disty - real(kind(0d0)), dimension(-1:p) :: distz + real(wp), dimension(-1:m) :: distx + real(wp), dimension(-1:n) :: disty + real(wp), dimension(-1:p) :: distz ! The cell-averaged partial densities, density, velocity, pressure, ! volume fractions, specific heat ratio function, liquid stiffness ! function, and sound speed. - real(kind(0d0)) :: lit_gamma, nbub - real(kind(0d0)) :: rho - real(kind(0d0)), dimension(num_dims) :: vel - real(kind(0d0)) :: pres - real(kind(0d0)) :: ptilde - real(kind(0d0)) :: ptot - real(kind(0d0)) :: alf - real(kind(0d0)) :: alfgr - real(kind(0d0)), dimension(num_fluids) :: alpha - real(kind(0d0)) :: gamma - real(kind(0d0)) :: pi_inf - real(kind(0d0)) :: qv - real(kind(0d0)) :: c - real(kind(0d0)) :: M00, M10, M01, M20, M11, M02 - real(kind(0d0)) :: varR, varV - real(kind(0d0)), dimension(Nb) :: nR, R, nRdot, Rdot - real(kind(0d0)) :: nR3 - real(kind(0d0)) :: accel - real(kind(0d0)) :: int_pres - real(kind(0d0)) :: max_pres - real(kind(0d0)), dimension(2) :: Re - real(kind(0d0)), dimension(6) :: tau_e - real(kind(0d0)) :: G - real(kind(0d0)) :: dyn_p, Temp + + real(wp) :: lit_gamma, nbub + real(wp) :: rho + real(wp), dimension(num_dims) :: vel + real(wp) :: pres + real(wp) :: ptilde + real(wp) :: ptot + real(wp) :: alf + real(wp) :: alfgr + real(wp), dimension(num_fluids) :: alpha + real(wp) :: gamma + real(wp) :: pi_inf + real(wp) :: qv + real(wp) :: c + real(wp) :: M00, M10, M01, M20, M11, M02 + real(wp) :: varR, varV + real(wp), dimension(Nb) :: nR, R, nRdot, Rdot + real(wp) :: nR3 + real(wp) :: accel + real(wp) :: int_pres + real(wp) :: max_pres + real(wp), dimension(2) :: Re + real(wp), dimension(6) :: tau_e + real(wp) :: G + real(wp) :: dyn_p, Temp integer :: i, j, k, l, s, d !< Generic loop iterator - real(kind(0d0)) :: nondim_time !< Non-dimensional time + real(wp) :: nondim_time !< Non-dimensional time - real(kind(0d0)) :: tmp !< + real(wp) :: tmp !< !! Temporary variable to store quantity for mpi_allreduce integer :: npts !< Number of included integral points - real(kind(0d0)) :: rad, thickness !< For integral quantities + real(wp) :: rad, thickness !< For integral quantities logical :: trigger !< For integral quantities - real(kind(0d0)) :: rhoYks(1:num_species) + real(wp) :: rhoYks(1:num_species) ! Non-dimensional time calculation if (time_stepper == 23) then nondim_time = mytime else if (t_step_old /= dflt_int) then - nondim_time = real(t_step + t_step_old, kind(0d0))*dt + nondim_time = real(t_step + t_step_old, wp)*dt else - nondim_time = real(t_step, kind(0d0))*dt + nondim_time = real(t_step, wp)*dt end if end if do i = 1, num_probes ! Zeroing out flow variables for all processors - rho = 0d0 + rho = 0._wp do s = 1, num_dims - vel(s) = 0d0 + vel(s) = 0._wp end do - pres = 0d0 - gamma = 0d0 - pi_inf = 0d0 - qv = 0d0 - c = 0d0 - accel = 0d0 - nR = 0d0; R = 0d0 - nRdot = 0d0; Rdot = 0d0 - nbub = 0d0 - M00 = 0d0 - M10 = 0d0 - M01 = 0d0 - M20 = 0d0 - M11 = 0d0 - M02 = 0d0 - varR = 0d0; varV = 0d0 - alf = 0d0 + pres = 0._wp + gamma = 0._wp + pi_inf = 0._wp + qv = 0._wp + c = 0._wp + accel = 0._wp + nR = 0._wp; R = 0._wp + nRdot = 0._wp; Rdot = 0._wp + nbub = 0._wp + M00 = 0._wp + M10 = 0._wp + M01 = 0._wp + M20 = 0._wp + M11 = 0._wp + M02 = 0._wp + varR = 0._wp; varV = 0._wp + alf = 0._wp do s = 1, (num_dims*(num_dims + 1))/2 - tau_e(s) = 0d0 + tau_e(s) = 0._wp end do ! Find probe location in terms of indices on a @@ -979,7 +981,7 @@ contains if ((probe(i)%x >= x_cb(-1)) .and. (probe(i)%x <= x_cb(m))) then do s = -1, m distx(s) = x_cb(s) - probe(i)%x - if (distx(s) < 0d0) distx(s) = 1000d0 + if (distx(s) < 0._wp) distx(s) = 1000._wp end do j = minloc(distx, 1) if (j == 1) j = 2 ! Pick first point if probe is at edge @@ -1005,7 +1007,7 @@ contains vel(s) = q_cons_vf(cont_idx%end + s)%sf(j - 2, k, l)/rho end do - dyn_p = 0.5d0*rho*dot_product(vel, vel) + dyn_p = 0.5_wp*rho*dot_product(vel, vel) if (hypoelasticity) then call s_compute_pressure( & @@ -1022,7 +1024,7 @@ contains end if if (model_eqns == 4) then - lit_gamma = 1d0/fluid_pp(1)%gamma + 1d0 + lit_gamma = 1._wp/fluid_pp(1)%gamma + 1._wp else if (hypoelasticity) then tau_e(1) = q_cons_vf(stress_idx%end)%sf(j - 2, k, l)/rho end if @@ -1040,12 +1042,12 @@ contains if (adv_n) then nbub = q_cons_vf(n_idx)%sf(j - 2, k, l) else - nR3 = 0d0 + nR3 = 0._wp do s = 1, nb - nR3 = nR3 + weight(s)*(nR(s)**3d0) + nR3 = nR3 + weight(s)*(nR(s)**3._wp) end do - nbub = dsqrt((4.d0*pi/3.d0)*nR3/alf) + nbub = sqrt((4._wp*pi/3._wp)*nR3/alf) end if #ifdef DEBUG print *, 'In probe, nbub: ', nbub @@ -1064,8 +1066,8 @@ contains M11 = M11/M00 M02 = M02/M00 - varR = M20 - M10**2d0 - varV = M02 - M01**2d0 + varR = M20 - M10**2._wp + varV = M02 - M01**2._wp end if R(:) = nR(:)/nbub Rdot(:) = nRdot(:)/nbub @@ -1076,7 +1078,7 @@ contains ! Compute mixture sound Speed call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, & - ((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c) + ((gamma + 1._wp)*pres + pi_inf)/rho, alpha, 0._wp, 0._wp, c) accel = accel_mag(j - 2, k, l) end if @@ -1091,11 +1093,11 @@ contains if ((probe(i)%y >= y_cb(-1)) .and. (probe(i)%y <= y_cb(n))) then do s = -1, m distx(s) = x_cb(s) - probe(i)%x - if (distx(s) < 0d0) distx(s) = 1000d0 + if (distx(s) < 0._wp) distx(s) = 1000._wp end do do s = -1, n disty(s) = y_cb(s) - probe(i)%y - if (disty(s) < 0d0) disty(s) = 1000d0 + if (disty(s) < 0._wp) disty(s) = 1000._wp end do j = minloc(distx, 1) k = minloc(disty, 1) @@ -1111,7 +1113,7 @@ contains vel(s) = q_cons_vf(cont_idx%end + s)%sf(j - 2, k - 2, l)/rho end do - dyn_p = 0.5d0*rho*dot_product(vel, vel) + dyn_p = 0.5_wp*rho*dot_product(vel, vel) if (hypoelasticity) then call s_compute_pressure( & @@ -1131,7 +1133,7 @@ contains end if if (model_eqns == 4) then - lit_gamma = 1d0/fluid_pp(1)%gamma + 1d0 + lit_gamma = 1._wp/fluid_pp(1)%gamma + 1._wp else if (hypoelasticity) then do s = 1, 3 tau_e(s) = q_cons_vf(s)%sf(j - 2, k - 2, l)/rho @@ -1148,12 +1150,12 @@ contains if (adv_n) then nbub = q_cons_vf(n_idx)%sf(j - 2, k - 2, l) else - nR3 = 0d0 + nR3 = 0._wp do s = 1, nb - nR3 = nR3 + weight(s)*(nR(s)**3d0) + nR3 = nR3 + weight(s)*(nR(s)**3._wp) end do - nbub = dsqrt((4.d0*pi/3.d0)*nR3/alf) + nbub = sqrt((4._wp*pi/3._wp)*nR3/alf) end if R(:) = nR(:)/nbub @@ -1162,7 +1164,7 @@ contains ! Compute mixture sound speed call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, & - ((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c) + ((gamma + 1._wp)*pres + pi_inf)/rho, alpha, 0._wp, 0._wp, c) accel = accel_mag(j - 2, k - 2, l) end if @@ -1173,15 +1175,15 @@ contains if ((probe(i)%z >= z_cb(-1)) .and. (probe(i)%z <= z_cb(p))) then do s = -1, m distx(s) = x_cb(s) - probe(i)%x - if (distx(s) < 0d0) distx(s) = 1000d0 + if (distx(s) < 0._wp) distx(s) = 1000._wp end do do s = -1, n disty(s) = y_cb(s) - probe(i)%y - if (disty(s) < 0d0) disty(s) = 1000d0 + if (disty(s) < 0._wp) disty(s) = 1000._wp end do do s = -1, p distz(s) = z_cb(s) - probe(i)%z - if (distz(s) < 0d0) distz(s) = 1000d0 + if (distz(s) < 0._wp) distz(s) = 1000._wp end do j = minloc(distx, 1) k = minloc(disty, 1) @@ -1198,7 +1200,7 @@ contains vel(s) = q_cons_vf(cont_idx%end + s)%sf(j - 2, k - 2, l - 2)/rho end do - dyn_p = 0.5d0*rho*dot_product(vel, vel) + dyn_p = 0.5_wp*rho*dot_product(vel, vel) if (chemistry) then do d = 1, num_species @@ -1223,7 +1225,7 @@ contains ! Compute mixture sound speed call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, & - ((gamma + 1d0)*pres + pi_inf)/rho, alpha, 0d0, 0d0, c) + ((gamma + 1._wp)*pres + pi_inf)/rho, alpha, 0._wp, 0._wp, c) accel = accel_mag(j - 2, k - 2, l - 2) end if @@ -1390,20 +1392,20 @@ contains if (integral_wrt .and. bubbles) then if (n == 0) then ! 1D simulation do i = 1, num_integrals - int_pres = 0d0 - max_pres = 0d0 + int_pres = 0._wp + max_pres = 0._wp k = 0; l = 0 npts = 0 do j = 1, m - pres = 0d0 + pres = 0._wp do s = 1, num_dims - vel(s) = 0d0 + vel(s) = 0._wp end do - rho = 0d0 - pres = 0d0 - gamma = 0d0 - pi_inf = 0d0 - qv = 0d0 + rho = 0._wp + pres = 0._wp + gamma = 0._wp + pi_inf = 0._wp + qv = 0._wp if ((integral(i)%xmin <= x_cb(j)) .and. (integral(i)%xmax >= x_cb(j))) then npts = npts + 1 @@ -1415,14 +1417,14 @@ contains pres = ( & (q_cons_vf(E_idx)%sf(j, k, l) - & - 0.5d0*(q_cons_vf(mom_idx%beg)%sf(j, k, l)**2.d0)/rho)/ & - (1.d0 - q_cons_vf(alf_idx)%sf(j, k, l)) - & + 0.5_wp*(q_cons_vf(mom_idx%beg)%sf(j, k, l)**2._wp)/rho)/ & + (1._wp - q_cons_vf(alf_idx)%sf(j, k, l)) - & pi_inf - qv & )/gamma - int_pres = int_pres + (pres - 1.d0)**2.d0 + int_pres = int_pres + (pres - 1._wp)**2._wp end if end do - int_pres = dsqrt(int_pres/(1.d0*npts)) + int_pres = sqrt(int_pres/(1._wp*npts)) if (num_procs > 1) then tmp = int_pres @@ -1445,8 +1447,8 @@ contains thickness = integral(1)%xmin do i = 1, num_integrals - int_pres = 0d0 - max_pres = 0d0 + int_pres = 0._wp + max_pres = 0._wp l = 0 npts = 0 do j = 1, m @@ -1454,28 +1456,28 @@ contains trigger = .false. if (i == 1) then !inner portion - if (dsqrt(x_cb(j)**2.d0 + y_cb(k)**2.d0) < (rad - 0.5d0*thickness)) & + if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) < (rad - 0.5_wp*thickness)) & trigger = .true. elseif (i == 2) then !net region - if (dsqrt(x_cb(j)**2.d0 + y_cb(k)**2.d0) > (rad - 0.5d0*thickness) .and. & - dsqrt(x_cb(j)**2.d0 + y_cb(k)**2.d0) < (rad + 0.5d0*thickness)) & + if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) > (rad - 0.5_wp*thickness) .and. & + sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) < (rad + 0.5_wp*thickness)) & trigger = .true. elseif (i == 3) then !everything else - if (dsqrt(x_cb(j)**2.d0 + y_cb(k)**2.d0) > (rad + 0.5d0*thickness)) & + if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) > (rad + 0.5_wp*thickness)) & trigger = .true. end if - pres = 0d0 + pres = 0._wp do s = 1, num_dims - vel(s) = 0d0 + vel(s) = 0._wp end do - rho = 0d0 - pres = 0d0 - gamma = 0d0 - pi_inf = 0d0 - qv = 0d0 + rho = 0._wp + pres = 0._wp + gamma = 0._wp + pi_inf = 0._wp + qv = 0._wp if (trigger) then npts = npts + 1 @@ -1487,21 +1489,21 @@ contains pres = ( & (q_cons_vf(E_idx)%sf(j, k, l) - & - 0.5d0*(q_cons_vf(mom_idx%beg)%sf(j, k, l)**2.d0)/rho)/ & - (1.d0 - q_cons_vf(alf_idx)%sf(j, k, l)) - & + 0.5_wp*(q_cons_vf(mom_idx%beg)%sf(j, k, l)**2._wp)/rho)/ & + (1._wp - q_cons_vf(alf_idx)%sf(j, k, l)) - & pi_inf - qv & )/gamma - int_pres = int_pres + abs(pres - 1.d0) - max_pres = max(max_pres, abs(pres - 1.d0)) + int_pres = int_pres + abs(pres - 1._wp) + max_pres = max(max_pres, abs(pres - 1._wp)) end if end do end do if (npts > 0) then - int_pres = int_pres/(1.d0*npts) + int_pres = int_pres/(1._wp*npts) else - int_pres = 0.d0 + int_pres = 0._wp end if if (num_procs > 1) then @@ -1531,7 +1533,7 @@ contains !! all of the time-steps and the simulation run-time. subroutine s_close_run_time_information_file - real(kind(0d0)) :: run_time !< Run-time of the simulation + real(wp) :: run_time !< Run-time of the simulation ! Writing the footer of and closing the run-time information file write (3, '(A)') '----------------------------------------'// & '----------------------------------------' @@ -1569,14 +1571,14 @@ contains ! Allocating/initializing ICFL, VCFL, CCFL and Rc stability criteria @:ALLOCATE(icfl_sf(0:m, 0:n, 0:p)) - icfl_max = 0d0 + icfl_max = 0._wp if (viscous) then @:ALLOCATE(vcfl_sf(0:m, 0:n, 0:p)) @:ALLOCATE(Rc_sf (0:m, 0:n, 0:p)) - vcfl_max = 0d0 - Rc_min = 1d3 + vcfl_max = 0._wp + Rc_min = 1e3_wp end if end subroutine s_initialize_data_output_module diff --git a/src/simulation/m_derived_variables.f90 b/src/simulation/m_derived_variables.f90 index 1c4e838a5..6e45fe59f 100644 --- a/src/simulation/m_derived_variables.f90 +++ b/src/simulation/m_derived_variables.f90 @@ -39,15 +39,15 @@ module m_derived_variables !! active coordinate directions, the centered family of the finite-difference !! schemes is used. !> @{ - real(kind(0d0)), public, allocatable, dimension(:, :) :: fd_coeff_x - real(kind(0d0)), public, allocatable, dimension(:, :) :: fd_coeff_y - real(kind(0d0)), public, allocatable, dimension(:, :) :: fd_coeff_z + real(wp), public, allocatable, dimension(:, :) :: fd_coeff_x + real(wp), public, allocatable, dimension(:, :) :: fd_coeff_y + real(wp), public, allocatable, dimension(:, :) :: fd_coeff_z !> @} ! @name Variables for computing acceleration !> @{ - real(kind(0d0)), public, allocatable, dimension(:, :, :) :: accel_mag - real(kind(0d0)), public, allocatable, dimension(:, :, :) :: x_accel, y_accel, z_accel + real(wp), public, allocatable, dimension(:, :, :) :: accel_mag + real(wp), public, allocatable, dimension(:, :, :) :: x_accel, y_accel, z_accel !> @} contains @@ -148,12 +148,12 @@ subroutine s_compute_derived_variables(t_step) do j = 0, n do i = 0, m if (p > 0) then - accel_mag(i, j, k) = sqrt(x_accel(i, j, k)**2d0 + & - y_accel(i, j, k)**2d0 + & - z_accel(i, j, k)**2d0) + accel_mag(i, j, k) = sqrt(x_accel(i, j, k)**2._wp + & + y_accel(i, j, k)**2._wp + & + z_accel(i, j, k)**2._wp) elseif (n > 0) then - accel_mag(i, j, k) = sqrt(x_accel(i, j, k)**2d0 + & - y_accel(i, j, k)**2d0) + accel_mag(i, j, k) = sqrt(x_accel(i, j, k)**2._wp + & + y_accel(i, j, k)**2._wp) else accel_mag(i, j, k) = x_accel(i, j, k) end if @@ -188,7 +188,7 @@ subroutine s_derive_acceleration_component(i, q_prim_vf0, q_prim_vf1, & type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf2 type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf3 - real(kind(0d0)), dimension(0:m, 0:n, 0:p), intent(out) :: q_sf + real(wp), dimension(0:m, 0:n, 0:p), intent(out) :: q_sf integer :: j, k, l, r !< Generic loop iterators @@ -198,10 +198,10 @@ subroutine s_derive_acceleration_component(i, q_prim_vf0, q_prim_vf1, & do k = 0, n do j = 0, m - q_sf(j, k, l) = (11d0*q_prim_vf0(mom_idx%beg)%sf(j, k, l) & - - 18d0*q_prim_vf1(mom_idx%beg)%sf(j, k, l) & - + 9d0*q_prim_vf2(mom_idx%beg)%sf(j, k, l) & - - 2d0*q_prim_vf3(mom_idx%beg)%sf(j, k, l))/(6d0*dt) + q_sf(j, k, l) = (11._wp*q_prim_vf0(mom_idx%beg)%sf(j, k, l) & + - 18._wp*q_prim_vf1(mom_idx%beg)%sf(j, k, l) & + + 9._wp*q_prim_vf2(mom_idx%beg)%sf(j, k, l) & + - 2._wp*q_prim_vf3(mom_idx%beg)%sf(j, k, l))/(6._wp*dt) do r = -fd_number, fd_number if (n == 0) then ! 1D simulation @@ -244,10 +244,10 @@ subroutine s_derive_acceleration_component(i, q_prim_vf0, q_prim_vf1, & do k = 0, n do j = 0, m - q_sf(j, k, l) = (11d0*q_prim_vf0(mom_idx%beg + 1)%sf(j, k, l) & - - 18d0*q_prim_vf1(mom_idx%beg + 1)%sf(j, k, l) & - + 9d0*q_prim_vf2(mom_idx%beg + 1)%sf(j, k, l) & - - 2d0*q_prim_vf3(mom_idx%beg + 1)%sf(j, k, l))/(6d0*dt) + q_sf(j, k, l) = (11._wp*q_prim_vf0(mom_idx%beg + 1)%sf(j, k, l) & + - 18._wp*q_prim_vf1(mom_idx%beg + 1)%sf(j, k, l) & + + 9._wp*q_prim_vf2(mom_idx%beg + 1)%sf(j, k, l) & + - 2._wp*q_prim_vf3(mom_idx%beg + 1)%sf(j, k, l))/(6._wp*dt) do r = -fd_number, fd_number if (p == 0) then ! 2D simulation @@ -265,7 +265,7 @@ subroutine s_derive_acceleration_component(i, q_prim_vf0, q_prim_vf1, & q_prim_vf0(mom_idx%beg + 1)%sf(j, r + k, l) & + q_prim_vf0(mom_idx%end)%sf(j, k, l)*fd_coeff_z(r, l)* & q_prim_vf0(mom_idx%beg + 1)%sf(j, k, r + l)/y_cc(k) & - - (q_prim_vf0(mom_idx%end)%sf(j, k, l)**2d0)/y_cc(k) + - (q_prim_vf0(mom_idx%end)%sf(j, k, l)**2._wp)/y_cc(k) else q_sf(j, k, l) = q_sf(j, k, l) & + q_prim_vf0(mom_idx%beg)%sf(j, k, l)*fd_coeff_x(r, j)* & @@ -286,10 +286,10 @@ subroutine s_derive_acceleration_component(i, q_prim_vf0, q_prim_vf1, & do l = 0, p do k = 0, n do j = 0, m - q_sf(j, k, l) = (11d0*q_prim_vf0(mom_idx%end)%sf(j, k, l) & - - 18d0*q_prim_vf1(mom_idx%end)%sf(j, k, l) & - + 9d0*q_prim_vf2(mom_idx%end)%sf(j, k, l) & - - 2d0*q_prim_vf3(mom_idx%end)%sf(j, k, l))/(6d0*dt) + q_sf(j, k, l) = (11._wp*q_prim_vf0(mom_idx%end)%sf(j, k, l) & + - 18._wp*q_prim_vf1(mom_idx%end)%sf(j, k, l) & + + 9._wp*q_prim_vf2(mom_idx%end)%sf(j, k, l) & + - 2._wp*q_prim_vf3(mom_idx%end)%sf(j, k, l))/(6._wp*dt) do r = -fd_number, fd_number if (grid_geometry == 3) then diff --git a/src/simulation/m_fftw.fpp b/src/simulation/m_fftw.fpp index c647f593e..9ab5c0c5f 100644 --- a/src/simulation/m_fftw.fpp +++ b/src/simulation/m_fftw.fpp @@ -51,9 +51,9 @@ module m_fftw #if defined(MFC_OpenACC) !$acc declare create(real_size, cmplx_size, x_size, batch_size, Nfq) - real(kind(0d0)), allocatable, target :: data_real_gpu(:) - complex(kind(0d0)), allocatable, target :: data_cmplx_gpu(:) - complex(kind(0d0)), allocatable, target :: data_fltr_cmplx_gpu(:) + real(dp), allocatable, target :: data_real_gpu(:) + complex(dp), allocatable, target :: data_cmplx_gpu(:) + complex(dp), allocatable, target :: data_fltr_cmplx_gpu(:) !$acc declare create(data_real_gpu, data_cmplx_gpu, data_fltr_cmplx_gpu) #if defined(__PGI) @@ -146,7 +146,7 @@ contains do k = 1, sys_size do j = 0, m do l = 1, cmplx_size - data_fltr_cmplx_gpu(l + j*cmplx_size + (k - 1)*cmplx_size*x_size) = (0d0, 0d0) + data_fltr_cmplx_gpu(l + j*cmplx_size + (k - 1)*cmplx_size*x_size) = (0_dp, 0_dp) end do end do end do @@ -198,7 +198,7 @@ contains do k = 1, sys_size do j = 0, m do l = 0, p - data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size)/real(real_size, kind(0d0)) + data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size)/real(real_size, dp) q_cons_vf(k)%sf(j, 0, l) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) end do end do @@ -210,7 +210,7 @@ contains do k = 1, sys_size do j = 0, m do l = 1, cmplx_size - data_fltr_cmplx_gpu(l + j*cmplx_size + (k - 1)*cmplx_size*x_size) = (0d0, 0d0) + data_fltr_cmplx_gpu(l + j*cmplx_size + (k - 1)*cmplx_size*x_size) = (0_dp, 0_dp) end do end do end do @@ -233,7 +233,7 @@ contains #endif !$acc end host_data - Nfq = min(floor(2d0*real(i, kind(0d0))*pi), cmplx_size) + Nfq = min(floor(2_dp*real(i, dp)*pi), cmplx_size) !$acc update device(Nfq) !$acc parallel loop collapse(3) gang vector default(present) @@ -258,7 +258,7 @@ contains do k = 1, sys_size do j = 0, m do l = 0, p - data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size)/real(real_size, kind(0d0)) + data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size)/real(real_size, dp) q_cons_vf(k)%sf(j, i, l) = data_real_gpu(l + j*real_size + 1 + (k - 1)*real_size*x_size) end do end do @@ -270,27 +270,27 @@ contains Nfq = 3 do j = 0, m do k = 1, sys_size - data_fltr_cmplx(:) = (0d0, 0d0) + data_fltr_cmplx(:) = (0_dp, 0_dp) data_real(1:p + 1) = q_cons_vf(k)%sf(j, 0, 0:p) call fftw_execute_dft_r2c(fwd_plan, data_real, data_cmplx) data_fltr_cmplx(1:Nfq) = data_cmplx(1:Nfq) call fftw_execute_dft_c2r(bwd_plan, data_fltr_cmplx, data_real) - data_real(:) = data_real(:)/real(real_size, kind(0d0)) + data_real(:) = data_real(:)/real(real_size, dp) q_cons_vf(k)%sf(j, 0, 0:p) = data_real(1:p + 1) end do end do ! Apply Fourier filter to additional rings do i = 1, fourier_rings - Nfq = min(floor(2d0*real(i, kind(0d0))*pi), cmplx_size) + Nfq = min(floor(2_dp*real(i, dp)*pi), cmplx_size) do j = 0, m do k = 1, sys_size - data_fltr_cmplx(:) = (0d0, 0d0) + data_fltr_cmplx(:) = (0_dp, 0_dp) data_real(1:p + 1) = q_cons_vf(k)%sf(j, i, 0:p) call fftw_execute_dft_r2c(fwd_plan, data_real, data_cmplx) data_fltr_cmplx(1:Nfq) = data_cmplx(1:Nfq) call fftw_execute_dft_c2r(bwd_plan, data_fltr_cmplx, data_real) - data_real(:) = data_real(:)/real(real_size, kind(0d0)) + data_real(:) = data_real(:)/real(real_size, dp) q_cons_vf(k)%sf(j, i, 0:p) = data_real(1:p + 1) end do end do diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index db5d17656..52a6b1228 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -30,7 +30,7 @@ module m_global_parameters implicit none - real(kind(0d0)) :: time = 0 + real(wp) :: time = 0 ! Logistics ================================================================ integer :: num_procs !< Number of processors @@ -61,21 +61,24 @@ module m_global_parameters !> @name Cell-boundary (CB) locations in the x-, y- and z-directions, respectively !> @{ - real(kind(0d0)), target, allocatable, dimension(:) :: x_cb, y_cb, z_cb + + real(wp), target, allocatable, dimension(:) :: x_cb, y_cb, z_cb !> @} !> @name Cell-center (CC) locations in the x-, y- and z-directions, respectively !> @{ - real(kind(0d0)), target, allocatable, dimension(:) :: x_cc, y_cc, z_cc + + real(wp), target, allocatable, dimension(:) :: x_cc, y_cc, z_cc !> @} !type(bounds_info) :: x_domain, y_domain, z_domain !< !! Locations of the domain bounds in the x-, y- and z-coordinate directions !> @name Cell-width distributions in the x-, y- and z-directions, respectively !> @{ - real(kind(0d0)), target, allocatable, dimension(:) :: dx, dy, dz + + real(wp), target, allocatable, dimension(:) :: dx, dy, dz !> @} - real(kind(0d0)) :: dt !< Size of the time-step + real(wp) :: dt !< Size of the time-step !$acc declare create(x_cb, y_cb, z_cb, x_cc, y_cc, z_cc, dx, dy, dz, dt, m, n, p) @@ -88,7 +91,7 @@ module m_global_parameters !> @name Starting time, stopping time, and time between backups, simulation time, !! and prescribed cfl respectively !> @{ - real(kind(0d0)) :: t_stop, t_save, cfl_target + real(wp) :: t_stop, t_save, cfl_target integer :: n_start !> @} !$acc declare create(cfl_target) @@ -119,7 +122,7 @@ module m_global_parameters logical, parameter :: mapped_weno = (${mapped_weno}$ /= 0) !< WENO-M (WENO with mapping of nonlinear weights) logical, parameter :: wenoz = (${wenoz}$ /= 0) !< WENO-Z logical, parameter :: teno = (${teno}$ /= 0) !< TENO (Targeted ENO) - real(kind(0d0)), parameter :: wenoz_q = ${wenoz_q}$ !< Power constant for WENO-Z + real(wp), parameter :: wenoz_q = ${wenoz_q}$ !< Power constant for WENO-Z #:else integer :: weno_polyn !< Degree of the WENO polynomials (polyn) integer :: weno_order !< Order of the WENO reconstruction @@ -129,11 +132,11 @@ module m_global_parameters logical :: mapped_weno !< WENO-M (WENO with mapping of nonlinear weights) logical :: wenoz !< WENO-Z logical :: teno !< TENO (Targeted ENO) - real(kind(0d0)) :: wenoz_q !< Power constant for WENO-Z + real(wp) :: wenoz_q !< Power constant for WENO-Z #:endif - real(kind(0d0)) :: weno_eps !< Binding for the WENO nonlinear weights - real(kind(0d0)) :: teno_CT !< Smoothness threshold for TENO + real(wp) :: weno_eps !< Binding for the WENO nonlinear weights + real(wp) :: teno_CT !< Smoothness threshold for TENO logical :: mp_weno !< Monotonicity preserving (MP) WENO logical :: weno_avg ! Average left/right cell-boundary states logical :: weno_Re_flux !< WENO reconstruct velocity gradients for viscous stress tensor @@ -158,10 +161,10 @@ module m_global_parameters !< amplitude, frequency, and phase shift sinusoid in each direction #:for dir in {'x', 'y', 'z'} #:for param in {'k','w','p','g'} - real(kind(0d0)) :: ${param}$_${dir}$ + real(wp) :: ${param}$_${dir}$ #:endfor #:endfor - real(kind(0d0)), dimension(3) :: accel_bf + real(wp), dimension(3) :: accel_bf !$acc declare create(accel_bf) integer :: cpu_start, cpu_end, cpu_rate @@ -174,8 +177,8 @@ module m_global_parameters logical :: relax !< activate phase change integer :: relax_model !< Relaxation model - real(kind(0d0)) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model - real(kind(0d0)) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model + real(wp) :: palpha_eps !< trigger parameter for the p relaxation procedure, phase change model + real(wp) :: ptgalpha_eps !< trigger parameter for the pTg relaxation procedure, phase change model !#ifndef _CRAYFTN !$acc declare create(relax, relax_model, palpha_eps,ptgalpha_eps) @@ -260,7 +263,7 @@ module m_global_parameters ! values or simply, the unaltered left and right, WENO-reconstructed, cell- ! boundary values. !> @{ - real(kind(0d0)) :: wa_flg + real(wp) :: wa_flg !> @{ !$acc declare create(wa_flg) @@ -271,7 +274,7 @@ module m_global_parameters !! the dimensionally split system of equations. !> @{ integer, dimension(3) :: dir_idx - real(kind(0d0)), dimension(3) :: dir_flg + real(wp), dimension(3) :: dir_flg integer, dimension(3) :: dir_idx_tau !!used for hypoelasticity=true !> @} @@ -320,7 +323,7 @@ module m_global_parameters !> @name Reference density and pressure for Tait EOS !> @{ - real(kind(0d0)) :: rhoref, pref + real(wp) :: rhoref, pref !> @} !$acc declare create(rhoref, pref) @@ -349,14 +352,14 @@ module m_global_parameters integer :: nb !< Number of eq. bubble sizes #:endif - real(kind(0d0)) :: R0ref !< Reference bubble size - real(kind(0d0)) :: Ca !< Cavitation number - real(kind(0d0)) :: Web !< Weber number - real(kind(0d0)) :: Re_inv !< Inverse Reynolds number + real(wp) :: R0ref !< Reference bubble size + real(wp) :: Ca !< Cavitation number + real(wp) :: Web !< Weber number + real(wp) :: Re_inv !< Inverse Reynolds number - real(kind(0d0)), dimension(:), allocatable :: weight !< Simpson quadrature weights - real(kind(0d0)), dimension(:), allocatable :: R0 !< Bubble sizes - real(kind(0d0)), dimension(:), allocatable :: V0 !< Bubble velocities + real(wp), dimension(:), allocatable :: weight !< Simpson quadrature weights + real(wp), dimension(:), allocatable :: R0 !< Bubble sizes + real(wp), dimension(:), allocatable :: V0 !< Bubble velocities !$acc declare create(weight, R0, V0) logical :: bubbles !< Bubbles on/off @@ -368,10 +371,10 @@ module m_global_parameters integer :: bubble_model !< Gilmore or Keller--Miksis bubble model integer :: thermal !< Thermal behavior. 1 = adiabatic, 2 = isotherm, 3 = transfer - real(kind(0d0)), allocatable, dimension(:, :, :) :: ptil !< Pressure modification + real(wp), allocatable, dimension(:, :, :) :: ptil !< Pressure modification !$acc declare create(ptil) - real(kind(0d0)) :: poly_sigma !< log normal sigma for polydisperse PDF + real(wp) :: poly_sigma !< log normal sigma for polydisperse PDF logical :: qbmm !< Quadrature moment method integer, parameter :: nmom = 6 !< Number of carried moments per R0 location @@ -379,7 +382,7 @@ module m_global_parameters integer :: nmomtot !< Total number of carried moments moments/transport equations integer :: R0_type - real(kind(0d0)) :: pi_fac !< Factor for artificial pi_inf + real(wp) :: pi_fac !< Factor for artificial pi_inf #:if not MFC_CASE_OPTIMIZATION !$acc declare create(nb) @@ -398,16 +401,17 @@ module m_global_parameters !> @name Physical bubble parameters (see Ando 2010, Preston 2007) !> @{ - real(kind(0d0)) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, pv, M_n, M_v + + real(wp) :: R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, pv, M_n, M_v !$acc declare create(R_n, R_v, phi_vn, phi_nv, Pe_c, Tw, pv, M_n, M_v) - real(kind(0d0)), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T - real(kind(0d0)), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN + real(wp), dimension(:), allocatable :: k_n, k_v, pb0, mass_n0, mass_v0, Pe_T + real(wp), dimension(:), allocatable :: Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN !$acc declare create( k_n, k_v, pb0, mass_n0, mass_v0, Pe_T, Re_trans_T, Re_trans_c, Im_trans_T, Im_trans_c, omegaN) - real(kind(0d0)) :: mul0, ss, gamma_v, mu_v - real(kind(0d0)) :: gamma_m, gamma_n, mu_n - real(kind(0d0)) :: gam + real(wp) :: mul0, ss, gamma_v, mu_v + real(wp) :: gamma_m, gamma_n, mu_n + real(wp) :: gam !> @} !$acc declare create(mul0, ss, gamma_v, mu_v, gamma_m, gamma_n, mu_n, gam) @@ -422,7 +426,8 @@ module m_global_parameters !> @name Surface tension parameters !> @{ - real(kind(0d0)) :: sigma + + real(wp) :: sigma logical :: surface_tension !$acc declare create(sigma, surface_tension) !> @} @@ -437,11 +442,11 @@ module m_global_parameters !$acc declare create(momxb, momxe, advxb, advxe, contxb, contxe, intxb, intxe, bubxb, bubxe, strxb, strxe, chemxb, chemxe) - real(kind(0d0)), allocatable, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps + real(wp), allocatable, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps !$acc declare create(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps) - real(kind(0d0)) :: mytime !< Current simulation time - real(kind(0d0)) :: finaltime !< Final simulation time + real(wp) :: mytime !< Current simulation time + real(wp) :: finaltime !< Final simulation time logical :: weno_flat, riemann_flat, rdma_mpi @@ -536,8 +541,8 @@ contains #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0d0 - bc_${DIM}$%ve${DIR}$ = 0d0 + bc_${DIM}$%vb${DIR}$ = 0._wp + bc_${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor @@ -549,9 +554,9 @@ contains do i = 1, num_fluids_max fluid_pp(i)%gamma = dflt_real fluid_pp(i)%pi_inf = dflt_real - fluid_pp(i)%cv = 0d0 - fluid_pp(i)%qv = 0d0 - fluid_pp(i)%qvp = 0d0 + fluid_pp(i)%cv = 0._wp + fluid_pp(i)%qv = 0._wp + fluid_pp(i)%qvp = 0._wp fluid_pp(i)%Re(:) = dflt_real fluid_pp(i)%mul0 = dflt_real fluid_pp(i)%ss = dflt_real @@ -560,7 +565,7 @@ contains fluid_pp(i)%M_v = dflt_real fluid_pp(i)%mu_v = dflt_real fluid_pp(i)%k_v = dflt_real - fluid_pp(i)%G = 0d0 + fluid_pp(i)%G = 0._wp end do ! Tait EOS @@ -590,7 +595,7 @@ contains adv_n = .false. adap_dt = .false. - pi_fac = 1d0 + pi_fac = 1._wp ! User inputs for qbmm for simulation code qbmm = .false. @@ -780,9 +785,9 @@ contains @:ALLOCATE(bub_idx%ps(nb), bub_idx%ms(nb)) if (num_fluids == 1) then - gam = 1.d0/fluid_pp(num_fluids + 1)%gamma + 1.d0 + gam = 1._wp/fluid_pp(num_fluids + 1)%gamma + 1._wp else - gam = 1.d0/fluid_pp(num_fluids)%gamma + 1.d0 + gam = 1._wp/fluid_pp(num_fluids)%gamma + 1._wp end if if (qbmm) then @@ -814,11 +819,11 @@ contains end if if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 1d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 1._wp else if (nb > 1) then - V0(:) = 1d0 + V0(:) = 1._wp !R0 and weight initialized in s_simpson else stop 'Invalid value of nb' @@ -827,8 +832,8 @@ contains !Initialize pref,rhoref for polytropic qbmm (done in s_initialize_nonpoly for non-polytropic) if (.not. qbmm) then if (polytropic) then - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if @@ -841,9 +846,9 @@ contains if ((f_is_default(Web))) then pb0 = pref pb0 = pb0/pref - pref = 1d0 + pref = 1._wp end if - rhoref = 1d0 + rhoref = 1._wp end if end if end if @@ -917,18 +922,18 @@ contains end if end do if (nb == 1) then - weight(:) = 1d0 - R0(:) = 1d0 - V0(:) = 0d0 + weight(:) = 1._wp + R0(:) = 1._wp + V0(:) = 0._wp else if (nb > 1) then - V0(:) = 1d0 + V0(:) = 1._wp else stop 'Invalid value of nb' end if if (polytropic) then - rhoref = 1.d0 - pref = 1.d0 + rhoref = 1._wp + pref = 1._wp end if end if end if @@ -940,8 +945,8 @@ contains if (fluid_pp(i)%Re(2) > 0) Re_size(2) = Re_size(2) + 1 end do - if (Re_size(1) > 0d0) shear_stress = .true. - if (Re_size(2) > 0d0) bulk_stress = .true. + if (Re_size(1) > 0._wp) shear_stress = .true. + if (Re_size(2) > 0._wp) bulk_stress = .true. !$acc update device(Re_size, viscous, shear_stress, bulk_stress) @@ -1003,7 +1008,7 @@ contains ! using the arithmetic mean of left and right, WENO-reconstructed, ! cell-boundary values or otherwise, the unaltered left and right, ! WENO-reconstructed, cell-boundary values - wa_flg = 0d0; if (weno_avg) wa_flg = 1d0 + wa_flg = 0._wp; if (weno_avg) wa_flg = 1._wp !$acc update device(wa_flg) ! Resort to default WENO-JS if no other WENO scheme is selected diff --git a/src/simulation/m_hypoelastic.fpp b/src/simulation/m_hypoelastic.fpp index 43b600cd3..33ebb8fe6 100644 --- a/src/simulation/m_hypoelastic.fpp +++ b/src/simulation/m_hypoelastic.fpp @@ -22,15 +22,15 @@ module m_hypoelastic private; public :: s_initialize_hypoelastic_module, & s_compute_hypoelastic_rhs - real(kind(0d0)), allocatable, dimension(:) :: Gs + real(wp), allocatable, dimension(:) :: Gs !$acc declare create(Gs) - real(kind(0d0)), allocatable, dimension(:, :, :) :: du_dx, du_dy, du_dz - real(kind(0d0)), allocatable, dimension(:, :, :) :: dv_dx, dv_dy, dv_dz - real(kind(0d0)), allocatable, dimension(:, :, :) :: dw_dx, dw_dy, dw_dz + real(wp), allocatable, dimension(:, :, :) :: du_dx, du_dy, du_dz + real(wp), allocatable, dimension(:, :, :) :: dv_dx, dv_dy, dv_dz + real(wp), allocatable, dimension(:, :, :) :: dw_dx, dw_dy, dw_dz !$acc declare create(du_dx,du_dy,du_dz,dv_dx,dv_dy,dv_dz,dw_dx,dw_dy,dw_dz) - real(kind(0d0)), allocatable, dimension(:, :, :) :: rho_K_field, G_K_field + real(wp), allocatable, dimension(:, :, :) :: rho_K_field, G_K_field !$acc declare create(rho_K_field, G_K_field) contains @@ -68,7 +68,7 @@ contains type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf - real(kind(0d0)) :: rho_K, G_K + real(wp) :: rho_K, G_K integer :: i, k, l, q !< Loop variables integer :: ndirs !< Number of coordinate directions @@ -85,10 +85,10 @@ contains do k = 0, m du_dx(k, l, q) = & (q_prim_vf(momxb)%sf(k - 2, l, q) & - - 8d0*q_prim_vf(momxb)%sf(k - 1, l, q) & - + 8d0*q_prim_vf(momxb)%sf(k + 1, l, q) & + - 8._wp*q_prim_vf(momxb)%sf(k - 1, l, q) & + + 8._wp*q_prim_vf(momxb)%sf(k + 1, l, q) & - q_prim_vf(momxb)%sf(k + 2, l, q)) & - /(12d0*dx(k)) + /(12._wp*dx(k)) end do end do end do @@ -100,22 +100,22 @@ contains do k = 0, m du_dy(k, l, q) = & (q_prim_vf(momxb)%sf(k, l - 2, q) & - - 8d0*q_prim_vf(momxb)%sf(k, l - 1, q) & - + 8d0*q_prim_vf(momxb)%sf(k, l + 1, q) & + - 8._wp*q_prim_vf(momxb)%sf(k, l - 1, q) & + + 8._wp*q_prim_vf(momxb)%sf(k, l + 1, q) & - q_prim_vf(momxb)%sf(k, l + 2, q)) & - /(12d0*dy(l)) + /(12._wp*dy(l)) dv_dx(k, l, q) = & (q_prim_vf(momxb + 1)%sf(k - 2, l, q) & - - 8d0*q_prim_vf(momxb + 1)%sf(k - 1, l, q) & - + 8d0*q_prim_vf(momxb + 1)%sf(k + 1, l, q) & + - 8._wp*q_prim_vf(momxb + 1)%sf(k - 1, l, q) & + + 8._wp*q_prim_vf(momxb + 1)%sf(k + 1, l, q) & - q_prim_vf(momxb + 1)%sf(k + 2, l, q)) & - /(12d0*dx(k)) + /(12._wp*dx(k)) dv_dy(k, l, q) = & (q_prim_vf(momxb + 1)%sf(k, l - 2, q) & - - 8d0*q_prim_vf(momxb + 1)%sf(k, l - 1, q) & - + 8d0*q_prim_vf(momxb + 1)%sf(k, l + 1, q) & + - 8._wp*q_prim_vf(momxb + 1)%sf(k, l - 1, q) & + + 8._wp*q_prim_vf(momxb + 1)%sf(k, l + 1, q) & - q_prim_vf(momxb + 1)%sf(k, l + 2, q)) & - /(12d0*dy(l)) + /(12._wp*dy(l)) end do end do end do @@ -128,34 +128,34 @@ contains do k = 0, m du_dz(k, l, q) = & (q_prim_vf(momxb)%sf(k, l, q - 2) & - - 8d0*q_prim_vf(momxb)%sf(k, l, q - 1) & - + 8d0*q_prim_vf(momxb)%sf(k, l, q + 1) & + - 8._wp*q_prim_vf(momxb)%sf(k, l, q - 1) & + + 8._wp*q_prim_vf(momxb)%sf(k, l, q + 1) & - q_prim_vf(momxb)%sf(k, l, q + 2)) & - /(12d0*dz(q)) + /(12._wp*dz(q)) dv_dz(k, l, q) = & (q_prim_vf(momxb + 1)%sf(k, l, q - 2) & - - 8d0*q_prim_vf(momxb + 1)%sf(k, l, q - 1) & - + 8d0*q_prim_vf(momxb + 1)%sf(k, l, q + 1) & + - 8._wp*q_prim_vf(momxb + 1)%sf(k, l, q - 1) & + + 8._wp*q_prim_vf(momxb + 1)%sf(k, l, q + 1) & - q_prim_vf(momxb + 1)%sf(k, l, q + 2)) & - /(12d0*dz(q)) + /(12._wp*dz(q)) dw_dx(k, l, q) = & (q_prim_vf(momxe)%sf(k - 2, l, q) & - - 8d0*q_prim_vf(momxe)%sf(k - 1, l, q) & - + 8d0*q_prim_vf(momxe)%sf(k + 1, l, q) & + - 8._wp*q_prim_vf(momxe)%sf(k - 1, l, q) & + + 8._wp*q_prim_vf(momxe)%sf(k + 1, l, q) & - q_prim_vf(momxe)%sf(k + 2, l, q)) & - /(12d0*dx(k)) + /(12._wp*dx(k)) dw_dy(k, l, q) = & (q_prim_vf(momxe)%sf(k, l - 2, q) & - - 8d0*q_prim_vf(momxe)%sf(k, l - 1, q) & - + 8d0*q_prim_vf(momxe)%sf(k, l + 1, q) & + - 8._wp*q_prim_vf(momxe)%sf(k, l - 1, q) & + + 8._wp*q_prim_vf(momxe)%sf(k, l + 1, q) & - q_prim_vf(momxe)%sf(k, l + 2, q)) & - /(12d0*dy(l)) + /(12._wp*dy(l)) dw_dz(k, l, q) = & (q_prim_vf(momxe)%sf(k, l, q - 2) & - - 8d0*q_prim_vf(momxe)%sf(k, l, q - 1) & - + 8d0*q_prim_vf(momxe)%sf(k, l, q + 1) & + - 8._wp*q_prim_vf(momxe)%sf(k, l, q - 1) & + + 8._wp*q_prim_vf(momxe)%sf(k, l, q + 1) & - q_prim_vf(momxe)%sf(k, l, q + 2)) & - /(12d0*dz(q)) + /(12._wp*dz(q)) end do end do end do @@ -166,7 +166,7 @@ contains do q = 0, p do l = 0, n do k = 0, m - rho_K = 0d0; G_K = 0d0 + rho_K = 0._wp; G_K = 0._wp do i = 1, num_fluids rho_K = rho_K + q_prim_vf(i)%sf(k, l, q) !alpha_rho_K(1) G_K = G_K + q_prim_vf(advxb - 1 + i)%sf(k, l, q)*Gs(i) !alpha_K(1) * Gs(1) @@ -189,7 +189,7 @@ contains do k = 0, m rhs_vf(strxb)%sf(k, l, q) = & rhs_vf(strxb)%sf(k, l, q) + rho_K_field(k, l, q)* & - ((4d0*G_K_field(k, l, q)/3d0) + & + ((4._wp*G_K_field(k, l, q)/3._wp) + & q_prim_vf(strxb)%sf(k, l, q))* & du_dx(k, l, q) end do @@ -205,7 +205,7 @@ contains (q_prim_vf(strxb + 1)%sf(k, l, q)*du_dy(k, l, q) + & q_prim_vf(strxb + 1)%sf(k, l, q)*du_dy(k, l, q) - & q_prim_vf(strxb)%sf(k, l, q)*dv_dy(k, l, q) - & - 2d0*G_K_field(k, l, q)*(1d0/3d0)*dv_dy(k, l, q)) + 2._wp*G_K_field(k, l, q)*(1._wp/3._wp)*dv_dy(k, l, q)) rhs_vf(strxb + 1)%sf(k, l, q) = rhs_vf(strxb + 1)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxb + 1)%sf(k, l, q)*du_dx(k, l, q) + & @@ -214,8 +214,8 @@ contains q_prim_vf(strxb + 2)%sf(k, l, q)*du_dy(k, l, q) + & q_prim_vf(strxb + 1)%sf(k, l, q)*dv_dy(k, l, q) - & q_prim_vf(strxb + 1)%sf(k, l, q)*dv_dy(k, l, q) + & - 2d0*G_K_field(k, l, q)*(1d0/2d0)*(du_dy(k, l, q) + & - dv_dx(k, l, q))) + 2._wp*G_K_field(k, l, q)*(1._wp/2._wp)*(du_dy(k, l, q) + & + dv_dx(k, l, q))) rhs_vf(strxb + 2)%sf(k, l, q) = rhs_vf(strxb + 2)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxb + 1)%sf(k, l, q)*dv_dx(k, l, q) + & @@ -224,9 +224,9 @@ contains q_prim_vf(strxb + 2)%sf(k, l, q)*dv_dy(k, l, q) + & q_prim_vf(strxb + 2)%sf(k, l, q)*dv_dy(k, l, q) - & q_prim_vf(strxb + 2)%sf(k, l, q)*dv_dy(k, l, q) + & - 2d0*G_K_field(k, l, q)*(dv_dy(k, l, q) - (1d0/3d0)* & - (du_dx(k, l, q) + & - dv_dy(k, l, q)))) + 2._wp*G_K_field(k, l, q)*(dv_dy(k, l, q) - (1._wp/3._wp)* & + (du_dx(k, l, q) + & + dv_dy(k, l, q)))) end do end do end do @@ -240,7 +240,7 @@ contains (q_prim_vf(strxb + 3)%sf(k, l, q)*du_dz(k, l, q) + & q_prim_vf(strxb + 3)%sf(k, l, q)*du_dz(k, l, q) - & q_prim_vf(strxb)%sf(k, l, q)*dw_dz(k, l, q) - & - 2d0*G_K_field(k, l, q)*(1d0/3d0)*dw_dz(k, l, q)) + 2._wp*G_K_field(k, l, q)*(1._wp/3._wp)*dw_dz(k, l, q)) rhs_vf(strxb + 1)%sf(k, l, q) = rhs_vf(strxb + 1)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxb + 4)%sf(k, l, q)*du_dz(k, l, q) + & @@ -251,7 +251,7 @@ contains (q_prim_vf(strxb + 4)%sf(k, l, q)*dv_dz(k, l, q) + & q_prim_vf(strxb + 4)%sf(k, l, q)*dv_dz(k, l, q) - & q_prim_vf(strxb + 2)%sf(k, l, q)*dw_dz(k, l, q) - & - 2d0*G_K_field(k, l, q)*(1d0/3d0)*dw_dz(k, l, q)) + 2._wp*G_K_field(k, l, q)*(1._wp/3._wp)*dw_dz(k, l, q)) rhs_vf(strxb + 3)%sf(k, l, q) = rhs_vf(strxb + 3)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxb + 3)%sf(k, l, q)*du_dx(k, l, q) + & @@ -263,8 +263,8 @@ contains q_prim_vf(strxb + 5)%sf(k, l, q)*du_dz(k, l, q) + & q_prim_vf(strxb + 3)%sf(k, l, q)*dw_dz(k, l, q) - & q_prim_vf(strxb + 3)%sf(k, l, q)*dw_dz(k, l, q) + & - 2d0*G_K_field(k, l, q)*(1d0/2d0)*(du_dz(k, l, q) + & - dw_dx(k, l, q))) + 2._wp*G_K_field(k, l, q)*(1._wp/2._wp)*(du_dz(k, l, q) + & + dw_dx(k, l, q))) rhs_vf(strxb + 4)%sf(k, l, q) = rhs_vf(strxb + 4)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxb + 3)%sf(k, l, q)*dv_dx(k, l, q) + & @@ -276,8 +276,8 @@ contains q_prim_vf(strxb + 5)%sf(k, l, q)*dv_dz(k, l, q) + & q_prim_vf(strxb + 4)%sf(k, l, q)*dw_dz(k, l, q) - & q_prim_vf(strxb + 4)%sf(k, l, q)*dw_dz(k, l, q) + & - 2d0*G_K_field(k, l, q)*(1d0/2d0)*(dv_dz(k, l, q) + & - dw_dy(k, l, q))) + 2._wp*G_K_field(k, l, q)*(1._wp/2._wp)*(dv_dz(k, l, q) + & + dw_dy(k, l, q))) rhs_vf(strxe)%sf(k, l, q) = rhs_vf(strxe)%sf(k, l, q) + rho_K_field(k, l, q)* & (q_prim_vf(strxe - 2)%sf(k, l, q)*dw_dx(k, l, q) + & @@ -289,10 +289,10 @@ contains q_prim_vf(strxe)%sf(k, l, q)*dw_dz(k, l, q) + & q_prim_vf(strxe)%sf(k, l, q)*dw_dz(k, l, q) - & q_prim_vf(strxe)%sf(k, l, q)*dw_dz(k, l, q) + & - 2d0*G_K_field(k, l, q)*(dw_dz(k, l, q) - (1d0/3d0)* & - (du_dx(k, l, q) + & - dv_dy(k, l, q) + & - dw_dz(k, l, q)))) + 2._wp*G_K_field(k, l, q)*(dw_dz(k, l, q) - (1._wp/3._wp)* & + (du_dx(k, l, q) + & + dv_dy(k, l, q) + & + dw_dz(k, l, q)))) end do end do end do diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 1790734be..8e6a34e9f 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -125,31 +125,31 @@ contains dimension(sys_size), & intent(INOUT) :: q_prim_vf !< Primitive Variables - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), optional, intent(INOUT) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), optional, intent(INOUT) :: pb, mv integer :: i, j, k, l, q, r!< Iterator variables integer :: patch_id !< Patch ID of ghost point - real(kind(0d0)) :: rho, gamma, pi_inf, dyn_pres !< Mixture variables - real(kind(0d0)), dimension(2) :: Re_K - real(kind(0d0)) :: G_K - real(kind(0d0)) :: qv_K - real(kind(0d0)), dimension(num_fluids) :: Gs - - real(kind(0d0)) :: pres_IP, coeff - real(kind(0d0)), dimension(3) :: vel_IP, vel_norm_IP - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_IP, alpha_IP - real(kind(0d0)), dimension(nb) :: r_IP, v_IP, pb_IP, mv_IP - real(kind(0d0)), dimension(nb*nmom) :: nmom_IP - real(kind(0d0)), dimension(nb*nnode) :: presb_IP, massv_IP + real(wp) :: rho, gamma, pi_inf, dyn_pres !< Mixture variables + real(wp), dimension(2) :: Re_K + real(wp) :: G_K + real(wp) :: qv_K + real(wp), dimension(num_fluids) :: Gs + + real(wp) :: pres_IP, coeff + real(wp), dimension(3) :: vel_IP, vel_norm_IP + real(wp), dimension(num_fluids) :: alpha_rho_IP, alpha_IP + real(wp), dimension(nb) :: r_IP, v_IP, pb_IP, mv_IP + real(wp), dimension(nb*nmom) :: nmom_IP + real(wp), dimension(nb*nnode) :: presb_IP, massv_IP !! Primitive variables at the image point associated with a ghost point, !! interpolated from surrounding fluid cells. - real(kind(0d0)), dimension(3) :: norm !< Normal vector from GP to IP - real(kind(0d0)), dimension(3) :: physical_loc !< Physical loc of GP - real(kind(0d0)), dimension(3) :: vel_g !< Velocity of GP + real(wp), dimension(3) :: norm !< Normal vector from GP to IP + real(wp), dimension(3) :: physical_loc !< Physical loc of GP + real(wp), dimension(3) :: vel_g !< Velocity of GP - real(kind(0d0)) :: nbub - real(kind(0d0)) :: buf + real(wp) :: nbub + real(wp) :: buf type(ghost_point) :: gp type(ghost_point) :: innerp @@ -166,7 +166,7 @@ contains if (p > 0) then physical_loc = [x_cc(j), y_cc(k), z_cc(l)] else - physical_loc = [x_cc(j), y_cc(k), 0d0] + physical_loc = [x_cc(j), y_cc(k), 0._wp] end if !Interpolate primitive variables at image point associated w/ GP @@ -187,7 +187,7 @@ contains alpha_rho_IP, alpha_IP, pres_IP, vel_IP) end if - dyn_pres = 0d0 + dyn_pres = 0._wp ! Set q_prim_vf params at GP so that mixture vars calculated properly !$acc loop seq @@ -216,7 +216,7 @@ contains vel_norm_IP = sum(vel_IP*norm)*norm vel_g = vel_IP - vel_norm_IP else - vel_g = 0d0 + vel_g = 0._wp end if ! Set momentum @@ -224,7 +224,7 @@ contains do q = momxb, momxe q_cons_vf(q)%sf(j, k, l) = rho*vel_g(q - momxb + 1) dyn_pres = dyn_pres + q_cons_vf(q)%sf(j, k, l)* & - vel_g(q - momxb + 1)/2d0 + vel_g(q - momxb + 1)/2._wp end do ! Set continuity and adv vars @@ -289,7 +289,7 @@ contains !$acc parallel loop gang vector private(physical_loc, dyn_pres, alpha_rho_IP, alpha_IP, vel_g, rho, gamma, pi_inf, Re_K, innerp, j, k, l, q) do i = 1, num_inner_gps - vel_g = 0d0 + vel_g = 0._wp innerp = inner_points(i) j = innerp%loc(1) k = innerp%loc(2) @@ -300,7 +300,7 @@ contains if (p > 0) then physical_loc = [x_cc(j), y_cc(k), z_cc(l)] else - physical_loc = [x_cc(j), y_cc(k), 0d0] + physical_loc = [x_cc(j), y_cc(k), 0._wp] end if !$acc loop seq @@ -312,13 +312,13 @@ contains call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, & alpha_rho_IP, Re_K, j, k, l) - dyn_pres = 0d0 + dyn_pres = 0._wp !$acc loop seq do q = momxb, momxe q_cons_vf(q)%sf(j, k, l) = rho*vel_g(q - momxb + 1) dyn_pres = dyn_pres + q_cons_vf(q)%sf(j, k, l)* & - vel_g(q - momxb + 1)/2d0 + vel_g(q - momxb + 1)/2._wp end do end do @@ -334,11 +334,11 @@ contains type(levelset_field), intent(IN) :: levelset type(levelset_norm_field), intent(IN) :: levelset_norm - real(kind(0d0)) :: dist - real(kind(0d0)), dimension(3) :: norm - real(kind(0d0)), dimension(3) :: physical_loc - real(kind(0d0)) :: temp_loc - real(kind(0d0)), pointer, dimension(:) :: s_cc => null() + real(wp) :: dist + real(wp), dimension(3) :: norm + real(wp), dimension(3) :: physical_loc + real(wp) :: temp_loc + real(wp), pointer, dimension(:) :: s_cc => null() integer :: bound type(ghost_point) :: gp @@ -358,7 +358,7 @@ contains if (p > 0) then physical_loc = [x_cc(i), y_cc(j), z_cc(k)] else - physical_loc = [x_cc(i), y_cc(j), 0d0] + physical_loc = [x_cc(i), y_cc(j), 0._wp] end if ! Calculate and store the precise location of the image point @@ -599,11 +599,11 @@ contains type(ghost_point), dimension(num_gps), intent(INOUT) :: ghost_points - real(kind(0d0)), dimension(2, 2, 2) :: dist - real(kind(0d0)), dimension(2, 2, 2) :: alpha - real(kind(0d0)), dimension(2, 2, 2) :: interp_coeffs - real(kind(0d0)) :: buf - real(kind(0d0)), dimension(2, 2, 2) :: eta + real(wp), dimension(2, 2, 2) :: dist + real(wp), dimension(2, 2, 2) :: alpha + real(wp), dimension(2, 2, 2) :: interp_coeffs + real(wp) :: buf + real(wp), dimension(2, 2, 2) :: eta type(ghost_point) :: gp integer :: i, j, k, l, q !< Iterator variables integer :: i1, i2, j1, j2, k1, k2 !< Grid indexes @@ -617,8 +617,8 @@ contains i1 = gp%ip_grid(1); i2 = i1 + 1 j1 = gp%ip_grid(2); j2 = j1 + 1 - dist = 0d0 - buf = 1d0 + dist = 0._wp + buf = 1._wp dist(1, 1, 1) = sqrt( & (x_cc(i1) - gp%ip_loc(1))**2 + & (y_cc(j1) - gp%ip_loc(2))**2) @@ -632,26 +632,26 @@ contains (x_cc(i2) - gp%ip_loc(1))**2 + & (y_cc(j2) - gp%ip_loc(2))**2) - interp_coeffs = 0d0 + interp_coeffs = 0._wp - if (dist(1, 1, 1) <= 1d-16) then - interp_coeffs(1, 1, 1) = 1d0 - else if (dist(2, 1, 1) <= 1d-16) then - interp_coeffs(2, 1, 1) = 1d0 - else if (dist(1, 2, 1) <= 1d-16) then - interp_coeffs(1, 2, 1) = 1d0 - else if (dist(2, 2, 1) <= 1d-16) then - interp_coeffs(2, 2, 1) = 1d0 + if (dist(1, 1, 1) <= 1e-16_wp) then + interp_coeffs(1, 1, 1) = 1._wp + else if (dist(2, 1, 1) <= 1e-16_wp) then + interp_coeffs(2, 1, 1) = 1._wp + else if (dist(1, 2, 1) <= 1e-16_wp) then + interp_coeffs(1, 2, 1) = 1._wp + else if (dist(2, 2, 1) <= 1e-16_wp) then + interp_coeffs(2, 2, 1) = 1._wp else - eta(:, :, 1) = 1d0/dist(:, :, 1)**2 - alpha = 1d0 + eta(:, :, 1) = 1._wp/dist(:, :, 1)**2 + alpha = 1._wp patch_id = gp%ib_patch_id - if (ib_markers%sf(i1, j1, 0) /= 0) alpha(1, 1, 1) = 0d0 - if (ib_markers%sf(i2, j1, 0) /= 0) alpha(2, 1, 1) = 0d0 - if (ib_markers%sf(i1, j2, 0) /= 0) alpha(1, 2, 1) = 0d0 - if (ib_markers%sf(i2, j2, 0) /= 0) alpha(2, 2, 1) = 0d0 + if (ib_markers%sf(i1, j1, 0) /= 0) alpha(1, 1, 1) = 0._wp + if (ib_markers%sf(i2, j1, 0) /= 0) alpha(2, 1, 1) = 0._wp + if (ib_markers%sf(i1, j2, 0) /= 0) alpha(1, 2, 1) = 0._wp + if (ib_markers%sf(i2, j2, 0) /= 0) alpha(2, 2, 1) = 0._wp buf = sum(alpha(:, :, 1)*eta(:, :, 1)) - if (buf > 0d0) then + if (buf > 0._wp) then interp_coeffs(:, :, 1) = alpha(:, :, 1)*eta(:, :, 1)/buf else buf = sum(eta(:, :, 1)) @@ -703,37 +703,37 @@ contains (x_cc(i2) - gp%ip_loc(1))**2 + & (y_cc(j2) - gp%ip_loc(2))**2 + & (z_cc(k2) - gp%ip_loc(3))**2) - interp_coeffs = 0d0 - buf = 1d0 - if (dist(1, 1, 1) <= 1d-16) then - interp_coeffs(1, 1, 1) = 1d0 - else if (dist(2, 1, 1) <= 1d-16) then - interp_coeffs(2, 1, 1) = 1d0 - else if (dist(1, 2, 1) <= 1d-16) then - interp_coeffs(1, 2, 1) = 1d0 - else if (dist(2, 2, 1) <= 1d-16) then - interp_coeffs(2, 2, 1) = 1d0 - else if (dist(1, 1, 2) <= 1d-16) then - interp_coeffs(1, 1, 2) = 1d0 - else if (dist(2, 1, 2) <= 1d-16) then - interp_coeffs(2, 1, 2) = 1d0 - else if (dist(1, 2, 2) <= 1d-16) then - interp_coeffs(1, 2, 2) = 1d0 - else if (dist(2, 2, 2) <= 1d-16) then - interp_coeffs(2, 2, 2) = 1d0 + interp_coeffs = 0._wp + buf = 1._wp + if (dist(1, 1, 1) <= 1e-16_wp) then + interp_coeffs(1, 1, 1) = 1._wp + else if (dist(2, 1, 1) <= 1e-16_wp) then + interp_coeffs(2, 1, 1) = 1._wp + else if (dist(1, 2, 1) <= 1e-16_wp) then + interp_coeffs(1, 2, 1) = 1._wp + else if (dist(2, 2, 1) <= 1e-16_wp) then + interp_coeffs(2, 2, 1) = 1._wp + else if (dist(1, 1, 2) <= 1e-16_wp) then + interp_coeffs(1, 1, 2) = 1._wp + else if (dist(2, 1, 2) <= 1e-16_wp) then + interp_coeffs(2, 1, 2) = 1._wp + else if (dist(1, 2, 2) <= 1e-16_wp) then + interp_coeffs(1, 2, 2) = 1._wp + else if (dist(2, 2, 2) <= 1e-16_wp) then + interp_coeffs(2, 2, 2) = 1._wp else - eta = 1d0/dist**2 - alpha = 1d0 - if (ib_markers%sf(i1, j1, k1) /= 0) alpha(1, 1, 1) = 0d0 - if (ib_markers%sf(i2, j1, k1) /= 0) alpha(2, 1, 1) = 0d0 - if (ib_markers%sf(i1, j2, k1) /= 0) alpha(1, 2, 1) = 0d0 - if (ib_markers%sf(i2, j2, k1) /= 0) alpha(2, 2, 1) = 0d0 - if (ib_markers%sf(i1, j1, k2) /= 0) alpha(1, 1, 2) = 0d0 - if (ib_markers%sf(i2, j1, k2) /= 0) alpha(2, 1, 2) = 0d0 - if (ib_markers%sf(i1, j2, k2) /= 0) alpha(1, 2, 2) = 0d0 - if (ib_markers%sf(i2, j2, k2) /= 0) alpha(2, 2, 2) = 0d0 + eta = 1._wp/dist**2 + alpha = 1._wp + if (ib_markers%sf(i1, j1, k1) /= 0) alpha(1, 1, 1) = 0._wp + if (ib_markers%sf(i2, j1, k1) /= 0) alpha(2, 1, 1) = 0._wp + if (ib_markers%sf(i1, j2, k1) /= 0) alpha(1, 2, 1) = 0._wp + if (ib_markers%sf(i2, j2, k1) /= 0) alpha(2, 2, 1) = 0._wp + if (ib_markers%sf(i1, j1, k2) /= 0) alpha(1, 1, 2) = 0._wp + if (ib_markers%sf(i2, j1, k2) /= 0) alpha(2, 1, 2) = 0._wp + if (ib_markers%sf(i1, j2, k2) /= 0) alpha(1, 2, 2) = 0._wp + if (ib_markers%sf(i2, j2, k2) /= 0) alpha(2, 2, 2) = 0._wp buf = sum(alpha*eta) - if (buf > 0d0) then + if (buf > 0._wp) then interp_coeffs = alpha*eta/buf else buf = sum(eta) @@ -754,19 +754,19 @@ contains type(scalar_field), & dimension(sys_size), & intent(IN) :: q_prim_vf !< Primitive Variables - real(kind(0d0)), optional, dimension(startx:, starty:, startz:, 1:, 1:), intent(INOUT) :: pb, mv + real(wp), optional, dimension(startx:, starty:, startz:, 1:, 1:), intent(INOUT) :: pb, mv type(ghost_point), intent(IN) :: gp - real(kind(0d0)), intent(INOUT) :: pres_IP - real(kind(0d0)), dimension(3), intent(INOUT) :: vel_IP - real(kind(0d0)), dimension(num_fluids), intent(INOUT) :: alpha_IP, alpha_rho_IP - real(kind(0d0)), optional, dimension(:), intent(INOUT) :: r_IP, v_IP, pb_IP, mv_IP - real(kind(0d0)), optional, dimension(:), intent(INOUT) :: nmom_IP - real(kind(0d0)), optional, dimension(:), intent(INOUT) :: presb_IP, massv_IP + real(wp), intent(INOUT) :: pres_IP + real(wp), dimension(3), intent(INOUT) :: vel_IP + real(wp), dimension(num_fluids), intent(INOUT) :: alpha_IP, alpha_rho_IP + real(wp), optional, dimension(:), intent(INOUT) :: r_IP, v_IP, pb_IP, mv_IP + real(wp), optional, dimension(:), intent(INOUT) :: nmom_IP + real(wp), optional, dimension(:), intent(INOUT) :: presb_IP, massv_IP integer :: i, j, k, l, q !< Iterator variables integer :: i1, i2, j1, j2, k1, k2 !< Iterator variables - real(kind(0d0)) :: coeff + real(wp) :: coeff i1 = gp%ip_grid(1); i2 = i1 + 1 j1 = gp%ip_grid(2); j2 = j1 + 1 @@ -777,25 +777,25 @@ contains k2 = 0 end if - alpha_rho_IP = 0d0 - alpha_IP = 0d0 - pres_IP = 0d0 - vel_IP = 0d0 + alpha_rho_IP = 0._wp + alpha_IP = 0._wp + pres_IP = 0._wp + vel_IP = 0._wp if (bubbles) then - r_IP = 0d0 - v_IP = 0d0 + r_IP = 0._wp + v_IP = 0._wp if (.not. polytropic) then - mv_IP = 0d0 - pb_IP = 0d0 + mv_IP = 0._wp + pb_IP = 0._wp end if end if if (qbmm) then - nmom_IP = 0d0 + nmom_IP = 0._wp if (.not. polytropic) then - presb_IP = 0d0 - massv_IP = 0d0 + presb_IP = 0._wp + massv_IP = 0._wp end if end if diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index 8b1ea7749..b57701cd7 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -34,22 +34,22 @@ module m_mpi_proxy implicit none - real(kind(0d0)), private, allocatable, dimension(:), target :: q_cons_buff_send !< + real(wp), private, allocatable, dimension(:), target :: q_cons_buff_send !< !! This variable is utilized to pack and send the buffer of the cell-average !! conservative variables, for a single computational domain boundary at the !! time, to the relevant neighboring processor. - real(kind(0d0)), private, allocatable, dimension(:), target :: q_cons_buff_recv !< + real(wp), private, allocatable, dimension(:), target :: q_cons_buff_recv !< !! q_cons_buff_recv is utilized to receive and unpack the buffer of the cell- !! average conservative variables, for a single computational domain boundary !! at the time, from the relevant neighboring processor. - real(kind(0d0)), private, allocatable, dimension(:), target :: c_divs_buff_send !< + real(wp), private, allocatable, dimension(:), target :: c_divs_buff_send !< !! c_divs_buff_send is utilized to send and unpack the buffer of the cell- !! centered color function derivatives, for a single computational domain !! boundary at the time, to the the relevant neighboring processor - real(kind(0d0)), private, allocatable, dimension(:), target :: c_divs_buff_recv + real(wp), private, allocatable, dimension(:), target :: c_divs_buff_recv !! c_divs_buff_recv is utilized to receiver and unpack the buffer of the cell- !! centered color function derivatives, for a single computational domain !! boundary at the time, from the relevant neighboring processor @@ -74,10 +74,6 @@ module m_mpi_proxy !> @} !$acc declare create(v_size) - !real :: s_time, e_time - !real :: compress_time, mpi_time, decompress_time - !integer :: nCalls_time = 0 - integer :: nVars !< nVars for surface tension communication !$acc declare create(nVars) @@ -174,7 +170,7 @@ contains #:for VAR in ['k_x', 'k_y', 'k_z', 'w_x', 'w_y', 'w_z', 'p_x', 'p_y', & & 'p_z', 'g_x', 'g_y', 'g_z'] - call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor #:for VAR in ['t_step_old', 'm', 'n', 'p', 'm_glb', 'n_glb', 'p_glb', & @@ -220,7 +216,7 @@ contains & 'bc_x%pres_in','bc_x%pres_out','bc_y%pres_in','bc_y%pres_out', 'bc_z%pres_in','bc_z%pres_out', & & 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', & & 'z_domain%beg', 'z_domain%end', 't_stop', 't_save', 'cfl_target'] - call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor do i = 1, 3 @@ -237,15 +233,15 @@ contains call MPI_BCAST(weno_order, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) call MPI_BCAST(nb, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) call MPI_BCAST(num_fluids, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(wenoz_q, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(wenoz_q, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endif do i = 1, num_fluids_max #:for VAR in [ 'gamma','pi_inf','mul0','ss','pv','gamma_v','M_v', & & 'mu_v','k_v','G', 'cv', 'qv', 'qvp' ] - call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor - call MPI_BCAST(fluid_pp(i)%Re(1), 2, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(fluid_pp(i)%Re(1), 2, mpi_p, 0, MPI_COMM_WORLD, ierr) end do do i = 1, num_fluids_max @@ -257,14 +253,14 @@ contains do i = 1, num_ibs #:for VAR in [ 'radius', 'length_x', 'length_y', & & 'x_centroid', 'y_centroid', 'c', 'm', 'p', 't', 'theta', 'slip' ] - call MPI_BCAST(patch_ib(i)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(patch_ib(i)%geometry, 2, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) end do do j = 1, num_probes_max do i = 1, 3 - call MPI_BCAST(acoustic(j)%loc(i), 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(acoustic(j)%loc(i), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) end do call MPI_BCAST(acoustic(j)%dipole, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr) @@ -278,15 +274,15 @@ contains 'npulse', 'dir', 'delay', 'foc_length', 'aperture', & 'element_spacing_angle', 'element_polygon_ratio', 'rotate_angle', & 'bb_bandwidth', 'bb_lowest_freq' ] - call MPI_BCAST(acoustic(j)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(acoustic(j)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor #:for VAR in [ 'x','y','z' ] - call MPI_BCAST(probe(j)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(probe(j)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor #:for VAR in [ 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax' ] - call MPI_BCAST(integral(j)%${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(integral(j)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do @@ -307,10 +303,10 @@ contains integer :: num_procs_x, num_procs_y, num_procs_z !< !! Optimal number of processors in the x-, y- and z-directions - real(kind(0d0)) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z !< + real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z !< !! Non-optimal number of processors in the x-, y- and z-directions - real(kind(0d0)) :: fct_min !< + real(wp) :: fct_min !< !! Processor factorization (fct) minimization parameter integer :: MPI_COMM_CART !< @@ -349,8 +345,8 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Searching for optimal computational domain distribution do i = 1, num_procs @@ -393,10 +389,10 @@ contains tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y tmp_num_procs_z = num_procs_z - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) & - + 10d0*abs((n + 1)/tmp_num_procs_y & - - (p + 1)/tmp_num_procs_z) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) & + + 10._wp*abs((n + 1)/tmp_num_procs_y & + - (p + 1)/tmp_num_procs_z) ! Optimization of the initial processor topology do i = 1, num_procs @@ -516,8 +512,8 @@ contains ! Benchmarking the quality of this initial guess tmp_num_procs_x = num_procs_x tmp_num_procs_y = num_procs_y - fct_min = 10d0*abs((m + 1)/tmp_num_procs_x & - - (n + 1)/tmp_num_procs_y) + fct_min = 10._wp*abs((m + 1)/tmp_num_procs_x & + - (n + 1)/tmp_num_procs_y) ! Optimization of the initial processor topology do i = 1, num_procs @@ -697,9 +693,9 @@ contains ! Send/receive buffer to/from bc_x%end/bc_x%beg call MPI_SENDRECV( & dx(m - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & dx(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only @@ -707,9 +703,9 @@ contains ! Send/receive buffer to/from bc_x%beg/bc_x%beg call MPI_SENDRECV( & dx(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & dx(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 0, & + mpi_p, bc_x%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -721,9 +717,9 @@ contains ! Send/receive buffer to/from bc_x%beg/bc_x%end call MPI_SENDRECV( & dx(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%beg, 1, & + mpi_p, bc_x%beg, 1, & dx(m + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only @@ -731,9 +727,9 @@ contains ! Send/receive buffer to/from bc_x%end/bc_x%end call MPI_SENDRECV( & dx(m - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 0, & + mpi_p, bc_x%end, 0, & dx(m + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_x%end, 1, & + mpi_p, bc_x%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -751,9 +747,9 @@ contains ! Send/receive buffer to/from bc_y%end/bc_y%beg call MPI_SENDRECV( & dy(n - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 0, & + mpi_p, bc_y%end, 0, & dy(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only @@ -761,9 +757,9 @@ contains ! Send/receive buffer to/from bc_y%beg/bc_y%beg call MPI_SENDRECV( & dy(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 1, & + mpi_p, bc_y%beg, 1, & dy(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 0, & + mpi_p, bc_y%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -775,9 +771,9 @@ contains ! Send/receive buffer to/from bc_y%beg/bc_y%end call MPI_SENDRECV( & dy(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%beg, 1, & + mpi_p, bc_y%beg, 1, & dy(n + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only @@ -785,9 +781,9 @@ contains ! Send/receive buffer to/from bc_y%end/bc_y%end call MPI_SENDRECV( & dy(n - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 0, & + mpi_p, bc_y%end, 0, & dy(n + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_y%end, 1, & + mpi_p, bc_y%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -805,9 +801,9 @@ contains ! Send/receive buffer to/from bc_z%end/bc_z%beg call MPI_SENDRECV( & dz(p - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & dz(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only @@ -815,9 +811,9 @@ contains ! Send/receive buffer to/from bc_z%beg/bc_z%beg call MPI_SENDRECV( & dz(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & dz(-buff_size), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 0, & + mpi_p, bc_z%beg, 0, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -829,9 +825,9 @@ contains ! Send/receive buffer to/from bc_z%beg/bc_z%end call MPI_SENDRECV( & dz(0), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%beg, 1, & + mpi_p, bc_z%beg, 1, & dz(p + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only @@ -839,9 +835,9 @@ contains ! Send/receive buffer to/from bc_z%end/bc_z%end call MPI_SENDRECV( & dz(p - buff_size + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 0, & + mpi_p, bc_z%end, 0, & dz(p + 1), buff_size, & - MPI_DOUBLE_PRECISION, bc_z%end, 1, & + mpi_p, bc_z%end, 1, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if @@ -867,7 +863,7 @@ contains pbc_loc) type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv integer, intent(in) :: mpi_dir, pbc_loc integer :: i, j, k, l, r, q !< Generic loop iterators @@ -881,7 +877,8 @@ contains logical :: beg_end_geq_0 integer :: pack_offset, unpack_offset - real(kind(0d0)), pointer :: p_send, p_recv + + real(wp), pointer :: p_send, p_recv #ifdef MFC_MPI @@ -1097,8 +1094,8 @@ contains #:endif call MPI_SENDRECV( & - p_send, buffer_count, MPI_DOUBLE_PRECISION, dst_proc, send_tag, & - p_recv, buffer_count, MPI_DOUBLE_PRECISION, src_proc, recv_tag, & + p_send, buffer_count, mpi_p, dst_proc, send_tag, & + p_recv, buffer_count, mpi_p, src_proc, recv_tag, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) call nvtxEndRange ! RHS-MPI-SENDRECV-(NO)-RDMA @@ -2155,7 +2152,7 @@ contains logical :: beg_end_geq_0 integer :: pack_offset, unpack_offset - real(kind(0d0)), pointer :: p_send, p_recv + real(wp), pointer :: p_send, p_recv #ifdef MFC_MPI @@ -2261,8 +2258,8 @@ contains #:endif call MPI_SENDRECV( & - p_send, buffer_count, MPI_DOUBLE_PRECISION, dst_proc, send_tag, & - p_recv, buffer_count, MPI_DOUBLE_PRECISION, src_proc, recv_tag, & + p_send, buffer_count, mpi_p, dst_proc, send_tag, & + p_recv, buffer_count, mpi_p, src_proc, recv_tag, & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) #:if rdma_mpi @@ -2352,9 +2349,9 @@ contains subroutine s_mpi_send_random_number(phi_rn, num_freq) integer, intent(in) :: num_freq - real(kind(0d0)), intent(inout), dimension(1:num_freq) :: phi_rn + real(wp), intent(inout), dimension(1:num_freq) :: phi_rn #ifdef MFC_MPI - call MPI_BCAST(phi_rn, num_freq, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST(phi_rn, num_freq, mpi_p, 0, MPI_COMM_WORLD, ierr) #endif end subroutine s_mpi_send_random_number diff --git a/src/simulation/m_qbmm.fpp b/src/simulation/m_qbmm.fpp index b22163b21..457084934 100644 --- a/src/simulation/m_qbmm.fpp +++ b/src/simulation/m_qbmm.fpp @@ -28,7 +28,7 @@ module m_qbmm private; public :: s_initialize_qbmm_module, s_mom_inv, s_coeff, s_compute_qbmm_rhs - real(kind(0d0)), allocatable, dimension(:, :, :, :, :) :: momrhs + real(wp), allocatable, dimension(:, :, :, :, :) :: momrhs !$acc declare create(momrhs) #:if MFC_CASE_OPTIMIZATION @@ -67,7 +67,7 @@ contains #:endif @:ALLOCATE(momrhs(1:3, 0:2, 0:2, 1:nterms, 1:nb)) - momrhs = 0d0 + momrhs = 0._wp ! Assigns the required RHS moments for moment transport equations ! The rhs%(:,3) is only to be used for R0 quadrature, not for computing X/Y indices @@ -77,169 +77,169 @@ contains do i1 = 0, 2; do i2 = 0, 2 if ((i1 + i2) <= 2) then if (bubble_model == 3) then - momrhs(1, i1, i2, 1, q) = -1.d0 + i1 - momrhs(2, i1, i2, 1, q) = -1.d0 + i2 - momrhs(3, i1, i2, 1, q) = 0d0 + momrhs(1, i1, i2, 1, q) = -1._wp + i1 + momrhs(2, i1, i2, 1, q) = -1._wp + i2 + momrhs(3, i1, i2, 1, q) = 0._wp - momrhs(1, i1, i2, 2, q) = -1.d0 + i1 - momrhs(2, i1, i2, 2, q) = 1.d0 + i2 - momrhs(3, i1, i2, 2, q) = 0d0 + momrhs(1, i1, i2, 2, q) = -1._wp + i1 + momrhs(2, i1, i2, 2, q) = 1._wp + i2 + momrhs(3, i1, i2, 2, q) = 0._wp - momrhs(1, i1, i2, 3, q) = -1.d0 + i1 - momrhs(2, i1, i2, 3, q) = -1.d0 + i2 - momrhs(3, i1, i2, 3, q) = 0d0 + momrhs(1, i1, i2, 3, q) = -1._wp + i1 + momrhs(2, i1, i2, 3, q) = -1._wp + i2 + momrhs(3, i1, i2, 3, q) = 0._wp - momrhs(1, i1, i2, 4, q) = -1.d0 + i1 - momrhs(2, i1, i2, 4, q) = 1.d0 + i2 - momrhs(3, i1, i2, 4, q) = 0d0 + momrhs(1, i1, i2, 4, q) = -1._wp + i1 + momrhs(2, i1, i2, 4, q) = 1._wp + i2 + momrhs(3, i1, i2, 4, q) = 0._wp if (.not. f_is_default(Re_inv)) then ! add viscosity - momrhs(1, i1, i2, 5, q) = -2.d0 + i1 + momrhs(1, i1, i2, 5, q) = -2._wp + i1 momrhs(2, i1, i2, 5, q) = i2 - momrhs(3, i1, i2, 5, q) = 0d0 + momrhs(3, i1, i2, 5, q) = 0._wp end if if (.not. f_is_default(Web)) then ! add surface tension - momrhs(1, i1, i2, 6, q) = -2.d0 + i1 - momrhs(2, i1, i2, 6, q) = -1.d0 + i2 - momrhs(3, i1, i2, 6, q) = 0d0 + momrhs(1, i1, i2, 6, q) = -2._wp + i1 + momrhs(2, i1, i2, 6, q) = -1._wp + i2 + momrhs(3, i1, i2, 6, q) = 0._wp end if - momrhs(1, i1, i2, 7, q) = -1.d0 + i1 - momrhs(2, i1, i2, 7, q) = -1.d0 + i2 - momrhs(3, i1, i2, 7, q) = 0d0 + momrhs(1, i1, i2, 7, q) = -1._wp + i1 + momrhs(2, i1, i2, 7, q) = -1._wp + i2 + momrhs(3, i1, i2, 7, q) = 0._wp else if (bubble_model == 2) then ! KM with approximation of 1/(1-V/C) = 1+V/C - momrhs(1, i1, i2, 1, q) = -1d0 + i1 - momrhs(2, i1, i2, 1, q) = 1d0 + i2 - momrhs(3, i1, i2, 1, q) = 0d0 + momrhs(1, i1, i2, 1, q) = -1._wp + i1 + momrhs(2, i1, i2, 1, q) = 1._wp + i2 + momrhs(3, i1, i2, 1, q) = 0._wp - momrhs(1, i1, i2, 2, q) = -1d0 + i1 - momrhs(2, i1, i2, 2, q) = 2d0 + i2 - momrhs(3, i1, i2, 2, q) = 0d0 + momrhs(1, i1, i2, 2, q) = -1._wp + i1 + momrhs(2, i1, i2, 2, q) = 2._wp + i2 + momrhs(3, i1, i2, 2, q) = 0._wp - momrhs(1, i1, i2, 3, q) = -1d0 + i1 - momrhs(2, i1, i2, 3, q) = 3d0 + i2 - momrhs(3, i1, i2, 3, q) = 0d0 + momrhs(1, i1, i2, 3, q) = -1._wp + i1 + momrhs(2, i1, i2, 3, q) = 3._wp + i2 + momrhs(3, i1, i2, 3, q) = 0._wp - momrhs(1, i1, i2, 4, q) = -1d0 + i1 - momrhs(2, i1, i2, 4, q) = -1d0 + i2 - momrhs(3, i1, i2, 4, q) = 0d0 + momrhs(1, i1, i2, 4, q) = -1._wp + i1 + momrhs(2, i1, i2, 4, q) = -1._wp + i2 + momrhs(3, i1, i2, 4, q) = 0._wp - momrhs(1, i1, i2, 5, q) = -1d0 + i1 + momrhs(1, i1, i2, 5, q) = -1._wp + i1 momrhs(2, i1, i2, 5, q) = i2 - momrhs(3, i1, i2, 5, q) = 0d0 + momrhs(3, i1, i2, 5, q) = 0._wp - momrhs(1, i1, i2, 6, q) = -1d0 + i1 - momrhs(2, i1, i2, 6, q) = 1d0 + i2 - momrhs(3, i1, i2, 6, q) = 0d0 + momrhs(1, i1, i2, 6, q) = -1._wp + i1 + momrhs(2, i1, i2, 6, q) = 1._wp + i2 + momrhs(3, i1, i2, 6, q) = 0._wp - momrhs(1, i1, i2, 7, q) = -1d0 + i1 - momrhs(2, i1, i2, 7, q) = -1d0 + i2 - momrhs(3, i1, i2, 7, q) = 0d0 + momrhs(1, i1, i2, 7, q) = -1._wp + i1 + momrhs(2, i1, i2, 7, q) = -1._wp + i2 + momrhs(3, i1, i2, 7, q) = 0._wp - momrhs(1, i1, i2, 8, q) = -1d0 + i1 + momrhs(1, i1, i2, 8, q) = -1._wp + i1 momrhs(2, i1, i2, 8, q) = i2 - momrhs(3, i1, i2, 8, q) = 0d0 + momrhs(3, i1, i2, 8, q) = 0._wp - momrhs(1, i1, i2, 9, q) = -1d0 + i1 - momrhs(2, i1, i2, 9, q) = 1d0 + i2 - momrhs(3, i1, i2, 9, q) = 0d0 + momrhs(1, i1, i2, 9, q) = -1._wp + i1 + momrhs(2, i1, i2, 9, q) = 1._wp + i2 + momrhs(3, i1, i2, 9, q) = 0._wp - momrhs(1, i1, i2, 10, q) = -1d0 + i1 + momrhs(1, i1, i2, 10, q) = -1._wp + i1 momrhs(2, i1, i2, 10, q) = i2 - momrhs(3, i1, i2, 10, q) = 0d0 + momrhs(3, i1, i2, 10, q) = 0._wp - momrhs(1, i1, i2, 11, q) = -1d0 + i1 - momrhs(2, i1, i2, 11, q) = 1d0 + i2 - momrhs(3, i1, i2, 11, q) = 0d0 + momrhs(1, i1, i2, 11, q) = -1._wp + i1 + momrhs(2, i1, i2, 11, q) = 1._wp + i2 + momrhs(3, i1, i2, 11, q) = 0._wp - momrhs(1, i1, i2, 12, q) = -1d0 + i1 - momrhs(2, i1, i2, 12, q) = 1d0 + i2 - momrhs(3, i1, i2, 12, q) = 0d0 + momrhs(1, i1, i2, 12, q) = -1._wp + i1 + momrhs(2, i1, i2, 12, q) = 1._wp + i2 + momrhs(3, i1, i2, 12, q) = 0._wp - momrhs(1, i1, i2, 13, q) = -1d0 + i1 - momrhs(2, i1, i2, 13, q) = -1d0 + i2 - momrhs(3, i1, i2, 13, q) = 0d0 + momrhs(1, i1, i2, 13, q) = -1._wp + i1 + momrhs(2, i1, i2, 13, q) = -1._wp + i2 + momrhs(3, i1, i2, 13, q) = 0._wp - momrhs(1, i1, i2, 14, q) = -1d0 + i1 + momrhs(1, i1, i2, 14, q) = -1._wp + i1 momrhs(2, i1, i2, 14, q) = i2 - momrhs(3, i1, i2, 14, q) = 0d0 + momrhs(3, i1, i2, 14, q) = 0._wp - momrhs(1, i1, i2, 15, q) = -1d0 + i1 - momrhs(2, i1, i2, 15, q) = 1d0 + i2 - momrhs(3, i1, i2, 15, q) = 0d0 + momrhs(1, i1, i2, 15, q) = -1._wp + i1 + momrhs(2, i1, i2, 15, q) = 1._wp + i2 + momrhs(3, i1, i2, 15, q) = 0._wp - momrhs(1, i1, i2, 16, q) = -2d0 + i1 + momrhs(1, i1, i2, 16, q) = -2._wp + i1 momrhs(2, i1, i2, 16, q) = i2 - momrhs(3, i1, i2, 16, q) = 0d0 + momrhs(3, i1, i2, 16, q) = 0._wp - momrhs(1, i1, i2, 17, q) = -2d0 + i1 - momrhs(2, i1, i2, 17, q) = -1d0 + i2 - momrhs(3, i1, i2, 17, q) = 0d0 + momrhs(1, i1, i2, 17, q) = -2._wp + i1 + momrhs(2, i1, i2, 17, q) = -1._wp + i2 + momrhs(3, i1, i2, 17, q) = 0._wp - momrhs(1, i1, i2, 18, q) = -2d0 + i1 - momrhs(2, i1, i2, 18, q) = 1d0 + i2 - momrhs(3, i1, i2, 18, q) = 0d0 + momrhs(1, i1, i2, 18, q) = -2._wp + i1 + momrhs(2, i1, i2, 18, q) = 1._wp + i2 + momrhs(3, i1, i2, 18, q) = 0._wp - momrhs(1, i1, i2, 19, q) = -2d0 + i1 - momrhs(2, i1, i2, 19, q) = 2d0 + i2 - momrhs(3, i1, i2, 19, q) = 0d0 + momrhs(1, i1, i2, 19, q) = -2._wp + i1 + momrhs(2, i1, i2, 19, q) = 2._wp + i2 + momrhs(3, i1, i2, 19, q) = 0._wp - momrhs(1, i1, i2, 20, q) = -2d0 + i1 - momrhs(2, i1, i2, 20, q) = -1d0 + i2 - momrhs(3, i1, i2, 20, q) = 0d0 + momrhs(1, i1, i2, 20, q) = -2._wp + i1 + momrhs(2, i1, i2, 20, q) = -1._wp + i2 + momrhs(3, i1, i2, 20, q) = 0._wp - momrhs(1, i1, i2, 21, q) = -2d0 + i1 + momrhs(1, i1, i2, 21, q) = -2._wp + i1 momrhs(2, i1, i2, 21, q) = i2 - momrhs(3, i1, i2, 21, q) = 0d0 + momrhs(3, i1, i2, 21, q) = 0._wp - momrhs(1, i1, i2, 22, q) = -2d0 + i1 - momrhs(2, i1, i2, 22, q) = -1d0 + i2 - momrhs(3, i1, i2, 22, q) = 0d0 + momrhs(1, i1, i2, 22, q) = -2._wp + i1 + momrhs(2, i1, i2, 22, q) = -1._wp + i2 + momrhs(3, i1, i2, 22, q) = 0._wp - momrhs(1, i1, i2, 23, q) = -2d0 + i1 + momrhs(1, i1, i2, 23, q) = -2._wp + i1 momrhs(2, i1, i2, 23, q) = i2 - momrhs(3, i1, i2, 23, q) = 0d0 + momrhs(3, i1, i2, 23, q) = 0._wp - momrhs(1, i1, i2, 24, q) = -3d0 + i1 + momrhs(1, i1, i2, 24, q) = -3._wp + i1 momrhs(2, i1, i2, 24, q) = i2 - momrhs(3, i1, i2, 24, q) = 0d0 + momrhs(3, i1, i2, 24, q) = 0._wp - momrhs(1, i1, i2, 25, q) = -3d0 + i1 - momrhs(2, i1, i2, 25, q) = -1d0 + i2 - momrhs(3, i1, i2, 25, q) = 0d0 + momrhs(1, i1, i2, 25, q) = -3._wp + i1 + momrhs(2, i1, i2, 25, q) = -1._wp + i2 + momrhs(3, i1, i2, 25, q) = 0._wp - momrhs(1, i1, i2, 26, q) = -2d0 + i1 + momrhs(1, i1, i2, 26, q) = -2._wp + i1 momrhs(2, i1, i2, 26, q) = i2 - momrhs(3, i1, i2, 26, q) = 0d0 + momrhs(3, i1, i2, 26, q) = 0._wp - momrhs(1, i1, i2, 27, q) = -1d0 + i1 - momrhs(2, i1, i2, 27, q) = -1d0 + i2 - momrhs(3, i1, i2, 27, q) = 0d0 + momrhs(1, i1, i2, 27, q) = -1._wp + i1 + momrhs(2, i1, i2, 27, q) = -1._wp + i2 + momrhs(3, i1, i2, 27, q) = 0._wp - momrhs(1, i1, i2, 28, q) = -1d0 + i1 + momrhs(1, i1, i2, 28, q) = -1._wp + i1 momrhs(2, i1, i2, 28, q) = i2 - momrhs(3, i1, i2, 28, q) = 0d0 + momrhs(3, i1, i2, 28, q) = 0._wp - momrhs(1, i1, i2, 29, q) = -2d0 + i1 + momrhs(1, i1, i2, 29, q) = -2._wp + i1 momrhs(2, i1, i2, 29, q) = i2 - momrhs(3, i1, i2, 29, q) = 0d0 + momrhs(3, i1, i2, 29, q) = 0._wp - momrhs(1, i1, i2, 30, q) = -1d0 + i1 - momrhs(2, i1, i2, 30, q) = -1d0 + i2 - momrhs(3, i1, i2, 30, q) = 0d0 + momrhs(1, i1, i2, 30, q) = -1._wp + i1 + momrhs(2, i1, i2, 30, q) = -1._wp + i2 + momrhs(3, i1, i2, 30, q) = 0._wp - momrhs(1, i1, i2, 31, q) = -1d0 + i1 + momrhs(1, i1, i2, 31, q) = -1._wp + i1 momrhs(2, i1, i2, 31, q) = i2 - momrhs(3, i1, i2, 31, q) = 0d0 + momrhs(3, i1, i2, 31, q) = 0._wp - momrhs(1, i1, i2, 32, q) = -2d0 + i1 + momrhs(1, i1, i2, 32, q) = -2._wp + i1 momrhs(2, i1, i2, 32, q) = i2 - momrhs(3, i1, i2, 32, q) = 0d0 + momrhs(3, i1, i2, 32, q) = 0._wp end if end if end do; end do @@ -250,145 +250,145 @@ contains do i1 = 0, 2; do i2 = 0, 2 if ((i1 + i2) <= 2) then if (bubble_model == 3) then - momrhs(1, i1, i2, 1, q) = -1.d0 + i1 - momrhs(2, i1, i2, 1, q) = -1.d0 + i2 - momrhs(3, i1, i2, 1, q) = 0d0 + momrhs(1, i1, i2, 1, q) = -1._wp + i1 + momrhs(2, i1, i2, 1, q) = -1._wp + i2 + momrhs(3, i1, i2, 1, q) = 0._wp - momrhs(1, i1, i2, 2, q) = -1.d0 + i1 - momrhs(2, i1, i2, 2, q) = 1.d0 + i2 - momrhs(3, i1, i2, 2, q) = 0d0 + momrhs(1, i1, i2, 2, q) = -1._wp + i1 + momrhs(2, i1, i2, 2, q) = 1._wp + i2 + momrhs(3, i1, i2, 2, q) = 0._wp - momrhs(1, i1, i2, 3, q) = -1.d0 + i1 - 3.d0*gam - momrhs(2, i1, i2, 3, q) = -1.d0 + i2 - momrhs(3, i1, i2, 3, q) = 3.d0*gam + momrhs(1, i1, i2, 3, q) = -1._wp + i1 - 3._wp*gam + momrhs(2, i1, i2, 3, q) = -1._wp + i2 + momrhs(3, i1, i2, 3, q) = 3._wp*gam - momrhs(1, i1, i2, 4, q) = -1.d0 + i1 - momrhs(2, i1, i2, 4, q) = 1.d0 + i2 - momrhs(3, i1, i2, 4, q) = 0d0 + momrhs(1, i1, i2, 4, q) = -1._wp + i1 + momrhs(2, i1, i2, 4, q) = 1._wp + i2 + momrhs(3, i1, i2, 4, q) = 0._wp if (.not. f_is_default(Re_inv)) then ! add viscosity - momrhs(1, i1, i2, 5, q) = -2.d0 + i1 + momrhs(1, i1, i2, 5, q) = -2._wp + i1 momrhs(2, i1, i2, 5, q) = i2 - momrhs(3, i1, i2, 5, q) = 0d0 + momrhs(3, i1, i2, 5, q) = 0._wp end if if (.not. f_is_default(Web)) then ! add surface tension - momrhs(1, i1, i2, 6, q) = -2.d0 + i1 - momrhs(2, i1, i2, 6, q) = -1.d0 + i2 - momrhs(3, i1, i2, 6, q) = 0d0 + momrhs(1, i1, i2, 6, q) = -2._wp + i1 + momrhs(2, i1, i2, 6, q) = -1._wp + i2 + momrhs(3, i1, i2, 6, q) = 0._wp end if - momrhs(1, i1, i2, 7, q) = -1.d0 + i1 - momrhs(2, i1, i2, 7, q) = -1.d0 + i2 - momrhs(3, i1, i2, 7, q) = 0d0 + momrhs(1, i1, i2, 7, q) = -1._wp + i1 + momrhs(2, i1, i2, 7, q) = -1._wp + i2 + momrhs(3, i1, i2, 7, q) = 0._wp else if (bubble_model == 2) then ! KM with approximation of 1/(1-V/C) = 1+V/C - momrhs(1, i1, i2, 1, q) = -1d0 + i1 - momrhs(2, i1, i2, 1, q) = 1d0 + i2 - momrhs(3, i1, i2, 1, q) = 0d0 + momrhs(1, i1, i2, 1, q) = -1._wp + i1 + momrhs(2, i1, i2, 1, q) = 1._wp + i2 + momrhs(3, i1, i2, 1, q) = 0._wp - momrhs(1, i1, i2, 2, q) = -1d0 + i1 - momrhs(2, i1, i2, 2, q) = 2d0 + i2 - momrhs(3, i1, i2, 2, q) = 0d0 + momrhs(1, i1, i2, 2, q) = -1._wp + i1 + momrhs(2, i1, i2, 2, q) = 2._wp + i2 + momrhs(3, i1, i2, 2, q) = 0._wp - momrhs(1, i1, i2, 3, q) = -1d0 + i1 - momrhs(2, i1, i2, 3, q) = 3d0 + i2 - momrhs(3, i1, i2, 3, q) = 0d0 + momrhs(1, i1, i2, 3, q) = -1._wp + i1 + momrhs(2, i1, i2, 3, q) = 3._wp + i2 + momrhs(3, i1, i2, 3, q) = 0._wp - momrhs(1, i1, i2, 4, q) = -1d0 + i1 - momrhs(2, i1, i2, 4, q) = -1d0 + i2 - momrhs(3, i1, i2, 4, q) = 0d0 + momrhs(1, i1, i2, 4, q) = -1._wp + i1 + momrhs(2, i1, i2, 4, q) = -1._wp + i2 + momrhs(3, i1, i2, 4, q) = 0._wp - momrhs(1, i1, i2, 5, q) = -1d0 + i1 + momrhs(1, i1, i2, 5, q) = -1._wp + i1 momrhs(2, i1, i2, 5, q) = i2 - momrhs(3, i1, i2, 5, q) = 0d0 + momrhs(3, i1, i2, 5, q) = 0._wp - momrhs(1, i1, i2, 6, q) = -1d0 + i1 - momrhs(2, i1, i2, 6, q) = 1d0 + i2 - momrhs(3, i1, i2, 6, q) = 0d0 + momrhs(1, i1, i2, 6, q) = -1._wp + i1 + momrhs(2, i1, i2, 6, q) = 1._wp + i2 + momrhs(3, i1, i2, 6, q) = 0._wp - momrhs(1, i1, i2, 7, q) = -1d0 + i1 - 3d0*gam - momrhs(2, i1, i2, 7, q) = -1d0 + i2 - momrhs(3, i1, i2, 7, q) = 3d0*gam + momrhs(1, i1, i2, 7, q) = -1._wp + i1 - 3._wp*gam + momrhs(2, i1, i2, 7, q) = -1._wp + i2 + momrhs(3, i1, i2, 7, q) = 3._wp*gam - momrhs(1, i1, i2, 8, q) = -1d0 + i1 - 3d0*gam + momrhs(1, i1, i2, 8, q) = -1._wp + i1 - 3._wp*gam momrhs(2, i1, i2, 8, q) = i2 - momrhs(3, i1, i2, 8, q) = 3d0*gam + momrhs(3, i1, i2, 8, q) = 3._wp*gam - momrhs(1, i1, i2, 9, q) = -1d0 + i1 - 3d0*gam - momrhs(2, i1, i2, 9, q) = 1d0 + i2 - momrhs(3, i1, i2, 9, q) = 3d0*gam + momrhs(1, i1, i2, 9, q) = -1._wp + i1 - 3._wp*gam + momrhs(2, i1, i2, 9, q) = 1._wp + i2 + momrhs(3, i1, i2, 9, q) = 3._wp*gam - momrhs(1, i1, i2, 10, q) = -1d0 + i1 - 3d0*gam + momrhs(1, i1, i2, 10, q) = -1._wp + i1 - 3._wp*gam momrhs(2, i1, i2, 10, q) = i2 - momrhs(3, i1, i2, 10, q) = 3d0*gam + momrhs(3, i1, i2, 10, q) = 3._wp*gam - momrhs(1, i1, i2, 11, q) = -1d0 + i1 - 3d0*gam - momrhs(2, i1, i2, 11, q) = 1d0 + i2 - momrhs(3, i1, i2, 11, q) = 3d0*gam + momrhs(1, i1, i2, 11, q) = -1._wp + i1 - 3._wp*gam + momrhs(2, i1, i2, 11, q) = 1._wp + i2 + momrhs(3, i1, i2, 11, q) = 3._wp*gam - momrhs(1, i1, i2, 12, q) = -1d0 + i1 - momrhs(2, i1, i2, 12, q) = 1d0 + i2 - momrhs(3, i1, i2, 12, q) = 0d0 + momrhs(1, i1, i2, 12, q) = -1._wp + i1 + momrhs(2, i1, i2, 12, q) = 1._wp + i2 + momrhs(3, i1, i2, 12, q) = 0._wp - momrhs(1, i1, i2, 13, q) = -1d0 + i1 - momrhs(2, i1, i2, 13, q) = -1d0 + i2 - momrhs(3, i1, i2, 13, q) = 0d0 + momrhs(1, i1, i2, 13, q) = -1._wp + i1 + momrhs(2, i1, i2, 13, q) = -1._wp + i2 + momrhs(3, i1, i2, 13, q) = 0._wp - momrhs(1, i1, i2, 14, q) = -1d0 + i1 + momrhs(1, i1, i2, 14, q) = -1._wp + i1 momrhs(2, i1, i2, 14, q) = i2 - momrhs(3, i1, i2, 14, q) = 0d0 + momrhs(3, i1, i2, 14, q) = 0._wp - momrhs(1, i1, i2, 15, q) = -1d0 + i1 - momrhs(2, i1, i2, 15, q) = 1d0 + i2 - momrhs(3, i1, i2, 15, q) = 0d0 + momrhs(1, i1, i2, 15, q) = -1._wp + i1 + momrhs(2, i1, i2, 15, q) = 1._wp + i2 + momrhs(3, i1, i2, 15, q) = 0._wp - momrhs(1, i1, i2, 16, q) = -2d0 + i1 + momrhs(1, i1, i2, 16, q) = -2._wp + i1 momrhs(2, i1, i2, 16, q) = i2 - momrhs(3, i1, i2, 16, q) = 0d0 + momrhs(3, i1, i2, 16, q) = 0._wp - momrhs(1, i1, i2, 17, q) = -2d0 + i1 - momrhs(2, i1, i2, 17, q) = -1d0 + i2 - momrhs(3, i1, i2, 17, q) = 0d0 + momrhs(1, i1, i2, 17, q) = -2._wp + i1 + momrhs(2, i1, i2, 17, q) = -1._wp + i2 + momrhs(3, i1, i2, 17, q) = 0._wp - momrhs(1, i1, i2, 18, q) = -2d0 + i1 - momrhs(2, i1, i2, 18, q) = 1d0 + i2 - momrhs(3, i1, i2, 18, q) = 0d0 + momrhs(1, i1, i2, 18, q) = -2._wp + i1 + momrhs(2, i1, i2, 18, q) = 1._wp + i2 + momrhs(3, i1, i2, 18, q) = 0._wp - momrhs(1, i1, i2, 19, q) = -2d0 + i1 - momrhs(2, i1, i2, 19, q) = 2d0 + i2 - momrhs(3, i1, i2, 19, q) = 0d0 + momrhs(1, i1, i2, 19, q) = -2._wp + i1 + momrhs(2, i1, i2, 19, q) = 2._wp + i2 + momrhs(3, i1, i2, 19, q) = 0._wp - momrhs(1, i1, i2, 20, q) = -2d0 + i1 - momrhs(2, i1, i2, 20, q) = -1d0 + i2 - momrhs(3, i1, i2, 20, q) = 0d0 + momrhs(1, i1, i2, 20, q) = -2._wp + i1 + momrhs(2, i1, i2, 20, q) = -1._wp + i2 + momrhs(3, i1, i2, 20, q) = 0._wp - momrhs(1, i1, i2, 21, q) = -2d0 + i1 + momrhs(1, i1, i2, 21, q) = -2._wp + i1 momrhs(2, i1, i2, 21, q) = i2 - momrhs(3, i1, i2, 21, q) = 0d0 + momrhs(3, i1, i2, 21, q) = 0._wp - momrhs(1, i1, i2, 22, q) = -2d0 + i1 - 3d0*gam - momrhs(2, i1, i2, 22, q) = -1d0 + i2 - momrhs(3, i1, i2, 22, q) = 3d0*gam + momrhs(1, i1, i2, 22, q) = -2._wp + i1 - 3._wp*gam + momrhs(2, i1, i2, 22, q) = -1._wp + i2 + momrhs(3, i1, i2, 22, q) = 3._wp*gam - momrhs(1, i1, i2, 23, q) = -2d0 + i1 - 3d0*gam + momrhs(1, i1, i2, 23, q) = -2._wp + i1 - 3._wp*gam momrhs(2, i1, i2, 23, q) = i2 - momrhs(3, i1, i2, 23, q) = 3d0*gam + momrhs(3, i1, i2, 23, q) = 3._wp*gam - momrhs(1, i1, i2, 24, q) = -3d0 + i1 + momrhs(1, i1, i2, 24, q) = -3._wp + i1 momrhs(2, i1, i2, 24, q) = i2 - momrhs(3, i1, i2, 24, q) = 0d0 + momrhs(3, i1, i2, 24, q) = 0._wp - momrhs(1, i1, i2, 25, q) = -3d0 + i1 - momrhs(2, i1, i2, 25, q) = -1d0 + i2 - momrhs(3, i1, i2, 25, q) = 0d0 + momrhs(1, i1, i2, 25, q) = -3._wp + i1 + momrhs(2, i1, i2, 25, q) = -1._wp + i2 + momrhs(3, i1, i2, 25, q) = 0._wp - momrhs(1, i1, i2, 26, q) = -2d0 + i1 - 3d0*gam + momrhs(1, i1, i2, 26, q) = -2._wp + i1 - 3._wp*gam momrhs(2, i1, i2, 26, q) = i2 - momrhs(3, i1, i2, 26, q) = 3d0*gam + momrhs(3, i1, i2, 26, q) = 3._wp*gam end if end if @@ -421,12 +421,12 @@ contains type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf, q_prim_vf type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf type(scalar_field), dimension(sys_size), intent(in) :: flux_n_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv integer :: i, j, k, l, q - real(kind(0d0)) :: nb_q, nb_dot, R, R2, nR, nR2, nR_dot, nR2_dot, var, AX + real(wp) :: nb_q, nb_dot, R, R2, nR, nR2, nR_dot, nR2_dot, var, AX if (idir == 1) then @@ -445,36 +445,36 @@ contains R = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) R2 = q_prim_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - if (R2 - R**2d0 > 0d0) then - var = R2 - R**2d0 + if (R2 - R**2._wp > 0._wp) then + var = R2 - R**2._wp else var = verysmall end if if (q <= 2) then - AX = R - dsqrt(var) + AX = R - sqrt(var) else - AX = R + dsqrt(var) + AX = R + sqrt(var) end if nb_dot = flux_n_vf(bubxb + (i - 1)*nmom)%sf(j - 1, k, l) - flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l) nR_dot = flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j - 1, k, l) - flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) nR2_dot = flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j - 1, k, l) - flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dx(j)*AX*nb_q**2)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dx(j)*AX*nb_q**2)* & (nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) if (q <= 2) then - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dx(j)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dx(j)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dx(j)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dx(j)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end do @@ -529,36 +529,36 @@ contains R = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) R2 = q_prim_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - if (R2 - R**2d0 > 0d0) then - var = R2 - R**2d0 + if (R2 - R**2._wp > 0._wp) then + var = R2 - R**2._wp else var = verysmall end if if (q <= 2) then - AX = R - dsqrt(var) + AX = R - sqrt(var) else - AX = R + dsqrt(var) + AX = R + sqrt(var) end if nb_dot = flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k - 1, l) - flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l) nR_dot = flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k - 1, l) - flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) nR2_dot = flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k - 1, l) - flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dy(k)*AX*nb_q**2)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dy(k)*AX*nb_q**2)* & (nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) if (q <= 2) then - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dy(k)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dy(k)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dy(k)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dy(k)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end do @@ -586,36 +586,36 @@ contains R = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) R2 = q_prim_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - if (R2 - R**2d0 > 0d0) then - var = R2 - R**2d0 + if (R2 - R**2._wp > 0._wp) then + var = R2 - R**2._wp else var = verysmall end if if (q <= 2) then - AX = R - dsqrt(var) + AX = R - sqrt(var) else - AX = R + dsqrt(var) + AX = R + sqrt(var) end if nb_dot = q_prim_vf(contxe + idir)%sf(j, k, l)*(flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l)) nR_dot = q_prim_vf(contxe + idir)%sf(j, k, l)*(flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)) nR2_dot = q_prim_vf(contxe + idir)%sf(j, k, l)*(flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*y_cc(k)*AX*nb_q**2)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2)* & (nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) if (q <= 2) then - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dz(l)*y_cc(k)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dz(l)*y_cc(k)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*y_cc(k)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*y_cc(k)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end do end do @@ -637,36 +637,36 @@ contains R = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) R2 = q_prim_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - if (R2 - R**2d0 > 0d0) then - var = R2 - R**2d0 + if (R2 - R**2._wp > 0._wp) then + var = R2 - R**2._wp else var = verysmall end if if (q <= 2) then - AX = R - dsqrt(var) + AX = R - sqrt(var) else - AX = R + dsqrt(var) + AX = R + sqrt(var) end if nb_dot = flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + (i - 1)*nmom)%sf(j, k, l) nR_dot = flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) nR2_dot = flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l - 1) - flux_n_vf(bubxb + 3 + (i - 1)*nmom)%sf(j, k, l) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*AX*nb_q**2)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*AX*nb_q**2)* & (nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) if (q <= 2) then - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dz(l)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3d0*gam/(dz(l)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) + 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*AX*nb_q**2*dsqrt(var)*2d0)* & + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)* & (nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) - rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3d0*gam/(dz(l)*AX*nb_q**2*dsqrt(var)*2d0)* & - (-2d0*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, i) - 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)* & + (-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end do @@ -689,65 +689,65 @@ contains #else !$acc routine seq #endif - real(kind(0.d0)), intent(in) :: pres, rho, c - real(kind(0.d0)), dimension(nterms, 0:2, 0:2), intent(out) :: coeffs + real(wp), intent(in) :: pres, rho, c + real(wp), dimension(nterms, 0:2, 0:2), intent(out) :: coeffs integer :: i1, i2 - coeffs = 0d0 + coeffs = 0._wp do i2 = 0, 2; do i1 = 0, 2 if ((i1 + i2) <= 2) then if (bubble_model == 3) then ! RPE - coeffs(1, i1, i2) = -1d0*i2*pres/rho - coeffs(2, i1, i2) = -3d0*i2/2d0 + coeffs(1, i1, i2) = -1._wp*i2*pres/rho + coeffs(2, i1, i2) = -3._wp*i2/2._wp coeffs(3, i1, i2) = i2/rho coeffs(4, i1, i2) = i1 - if (.not. f_is_default(Re_inv)) coeffs(5, i1, i2) = -4d0*i2*Re_inv/rho - if (.not. f_is_default(Web)) coeffs(6, i1, i2) = -2d0*i2/Web/rho - coeffs(7, i1, i2) = 0d0 + if (.not. f_is_default(Re_inv)) coeffs(5, i1, i2) = -4._wp*i2*Re_inv/rho + if (.not. f_is_default(Web)) coeffs(6, i1, i2) = -2._wp*i2/Web/rho + coeffs(7, i1, i2) = 0._wp else if (bubble_model == 2) then ! KM with approximation of 1/(1-V/C) = 1+V/C - coeffs(1, i1, i2) = -3d0*i2/2d0 + coeffs(1, i1, i2) = -3._wp*i2/2._wp coeffs(2, i1, i2) = -i2/c - coeffs(3, i1, i2) = i2/(2d0*c*c) + coeffs(3, i1, i2) = i2/(2._wp*c*c) coeffs(4, i1, i2) = -i2*pres/rho - coeffs(5, i1, i2) = -2d0*i2*pres/(c*rho) + coeffs(5, i1, i2) = -2._wp*i2*pres/(c*rho) coeffs(6, i1, i2) = -i2*pres/(c*c*rho) coeffs(7, i1, i2) = i2/rho - coeffs(8, i1, i2) = 2d0*i2/(c*rho) + coeffs(8, i1, i2) = 2._wp*i2/(c*rho) coeffs(9, i1, i2) = i2/(c*c*rho) - coeffs(10, i1, i2) = -3d0*i2*gam/(c*rho) - coeffs(11, i1, i2) = -3d0*i2*gam/(c*c*rho) + coeffs(10, i1, i2) = -3._wp*i2*gam/(c*rho) + coeffs(11, i1, i2) = -3._wp*i2*gam/(c*c*rho) coeffs(12, i1, i2) = i1 - coeffs(13, i1, i2) = 0d0 - coeffs(14, i1, i2) = 0d0 - coeffs(15, i1, i2) = 0d0 - if (.not. f_is_default(Re_inv)) coeffs(16, i1, i2) = -i2*4d0*Re_inv/rho - if (.not. f_is_default(Web)) coeffs(17, i1, i2) = -i2*2d0/Web/rho + coeffs(13, i1, i2) = 0._wp + coeffs(14, i1, i2) = 0._wp + coeffs(15, i1, i2) = 0._wp + if (.not. f_is_default(Re_inv)) coeffs(16, i1, i2) = -i2*4._wp*Re_inv/rho + if (.not. f_is_default(Web)) coeffs(17, i1, i2) = -i2*2._wp/Web/rho if (.not. f_is_default(Re_inv)) then - coeffs(18, i1, i2) = i2*6d0*Re_inv/(rho*c) - coeffs(19, i1, i2) = -i2*2d0*Re_inv/(rho*c*c) - coeffs(20, i1, i2) = i2*4d0*pres*Re_inv/(rho*rho*c) - coeffs(21, i1, i2) = i2*4d0*pres*Re_inv/(rho*rho*c*c) - coeffs(22, i1, i2) = -i2*4d0/(rho*rho*c) - coeffs(23, i1, i2) = -i2*4d0/(rho*rho*c*c) - coeffs(24, i1, i2) = i2*16d0*Re_inv*Re_inv/(rho*rho*c) + coeffs(18, i1, i2) = i2*6._wp*Re_inv/(rho*c) + coeffs(19, i1, i2) = -i2*2._wp*Re_inv/(rho*c*c) + coeffs(20, i1, i2) = i2*4._wp*pres*Re_inv/(rho*rho*c) + coeffs(21, i1, i2) = i2*4._wp*pres*Re_inv/(rho*rho*c*c) + coeffs(22, i1, i2) = -i2*4._wp/(rho*rho*c) + coeffs(23, i1, i2) = -i2*4._wp/(rho*rho*c*c) + coeffs(24, i1, i2) = i2*16._wp*Re_inv*Re_inv/(rho*rho*c) if (.not. f_is_default(Web)) then - coeffs(25, i1, i2) = i2*8d0*Re_inv/Web/(rho*rho*c) + coeffs(25, i1, i2) = i2*8._wp*Re_inv/Web/(rho*rho*c) end if - coeffs(26, i1, i2) = -12d0*i2*gam*Re_inv/(rho*rho*c*c) + coeffs(26, i1, i2) = -12._wp*i2*gam*Re_inv/(rho*rho*c*c) end if - coeffs(27, i1, i2) = 3d0*i2*gam*R_v*Tw/(c*rho) - coeffs(28, i1, i2) = 3d0*i2*gam*R_v*Tw/(c*c*rho) + coeffs(27, i1, i2) = 3._wp*i2*gam*R_v*Tw/(c*rho) + coeffs(28, i1, i2) = 3._wp*i2*gam*R_v*Tw/(c*c*rho) if (.not. f_is_default(Re_inv)) then - coeffs(29, i1, i2) = 12d0*i2*gam*R_v*Tw*Re_inv/(rho*rho*c*c) + coeffs(29, i1, i2) = 12._wp*i2*gam*R_v*Tw*Re_inv/(rho*rho*c*c) end if - coeffs(30, i1, i2) = 3d0*i2*gam/(c*rho) - coeffs(31, i1, i2) = 3d0*i2*gam/(c*c*rho) + coeffs(30, i1, i2) = 3._wp*i2*gam/(c*rho) + coeffs(31, i1, i2) = 3._wp*i2*gam/(c*c*rho) if (.not. f_is_default(Re_inv)) then - coeffs(32, i1, i2) = 12d0*i2*gam*Re_inv/(rho*rho*c*c) + coeffs(32, i1, i2) = 12._wp*i2*gam*Re_inv/(rho*rho*c*c) end if end if end if @@ -763,55 +763,55 @@ contains !$acc routine seq #endif - real(kind(0.d0)), intent(inout) :: pres, rho, c - real(kind(0.d0)), dimension(nterms, 0:2, 0:2), intent(out) :: coeffs + real(wp), intent(inout) :: pres, rho, c + real(wp), dimension(nterms, 0:2, 0:2), intent(out) :: coeffs integer :: i1, i2 - coeffs = 0d0 + coeffs = 0._wp do i2 = 0, 2; do i1 = 0, 2 if ((i1 + i2) <= 2) then if (bubble_model == 3) then ! RPE - coeffs(1, i1, i2) = -1d0*i2*pres/rho - coeffs(2, i1, i2) = -3d0*i2/2d0 + coeffs(1, i1, i2) = -1._wp*i2*pres/rho + coeffs(2, i1, i2) = -3._wp*i2/2._wp coeffs(3, i1, i2) = i2/rho coeffs(4, i1, i2) = i1 - if (.not. f_is_default(Re_inv)) coeffs(5, i1, i2) = -4d0*i2*Re_inv/rho - if (.not. f_is_default(Web)) coeffs(6, i1, i2) = -2d0*i2/Web/rho + if (.not. f_is_default(Re_inv)) coeffs(5, i1, i2) = -4._wp*i2*Re_inv/rho + if (.not. f_is_default(Web)) coeffs(6, i1, i2) = -2._wp*i2/Web/rho coeffs(7, i1, i2) = i2*pv/rho else if (bubble_model == 2) then ! KM with approximation of 1/(1-V/C) = 1+V/C - coeffs(1, i1, i2) = -3d0*i2/2d0 + coeffs(1, i1, i2) = -3._wp*i2/2._wp coeffs(2, i1, i2) = -i2/c - coeffs(3, i1, i2) = i2/(2d0*c*c) + coeffs(3, i1, i2) = i2/(2._wp*c*c) coeffs(4, i1, i2) = -i2*pres/rho - coeffs(5, i1, i2) = -2d0*i2*pres/(c*rho) + coeffs(5, i1, i2) = -2._wp*i2*pres/(c*rho) coeffs(6, i1, i2) = -i2*pres/(c*c*rho) coeffs(7, i1, i2) = i2/rho - coeffs(8, i1, i2) = 2d0*i2/(c*rho) + coeffs(8, i1, i2) = 2._wp*i2/(c*rho) coeffs(9, i1, i2) = i2/(c*c*rho) - coeffs(10, i1, i2) = -3d0*i2*gam/(c*rho) - coeffs(11, i1, i2) = -3d0*i2*gam/(c*c*rho) + coeffs(10, i1, i2) = -3._wp*i2*gam/(c*rho) + coeffs(11, i1, i2) = -3._wp*i2*gam/(c*c*rho) coeffs(12, i1, i2) = i1 coeffs(13, i1, i2) = i2*(pv)/rho - coeffs(14, i1, i2) = 2d0*i2*(pv)/(c*rho) + coeffs(14, i1, i2) = 2._wp*i2*(pv)/(c*rho) coeffs(15, i1, i2) = i2*(pv)/(c*c*rho) - if (.not. f_is_default(Re_inv)) coeffs(16, i1, i2) = -i2*4d0*Re_inv/rho - if (.not. f_is_default(Web)) coeffs(17, i1, i2) = -i2*2d0/Web/rho + if (.not. f_is_default(Re_inv)) coeffs(16, i1, i2) = -i2*4._wp*Re_inv/rho + if (.not. f_is_default(Web)) coeffs(17, i1, i2) = -i2*2._wp/Web/rho if (.not. f_is_default(Re_inv)) then - coeffs(18, i1, i2) = i2*6d0*Re_inv/(rho*c) - coeffs(19, i1, i2) = -i2*2d0*Re_inv/(rho*c*c) - coeffs(20, i1, i2) = i2*4d0*pres*Re_inv/(rho*rho*c) - coeffs(21, i1, i2) = i2*4d0*pres*Re_inv/(rho*rho*c*c) - coeffs(22, i1, i2) = -i2*4d0/(rho*rho*c) - coeffs(23, i1, i2) = -i2*4d0/(rho*rho*c*c) - coeffs(24, i1, i2) = i2*16d0*Re_inv*Re_inv/(rho*rho*c) + coeffs(18, i1, i2) = i2*6._wp*Re_inv/(rho*c) + coeffs(19, i1, i2) = -i2*2._wp*Re_inv/(rho*c*c) + coeffs(20, i1, i2) = i2*4._wp*pres*Re_inv/(rho*rho*c) + coeffs(21, i1, i2) = i2*4._wp*pres*Re_inv/(rho*rho*c*c) + coeffs(22, i1, i2) = -i2*4._wp/(rho*rho*c) + coeffs(23, i1, i2) = -i2*4._wp/(rho*rho*c*c) + coeffs(24, i1, i2) = i2*16._wp*Re_inv*Re_inv/(rho*rho*c) if (.not. f_is_default(Web)) then - coeffs(25, i1, i2) = i2*8d0*Re_inv/Web/(rho*rho*c) + coeffs(25, i1, i2) = i2*8._wp*Re_inv/Web/(rho*rho*c) end if - coeffs(26, i1, i2) = -12d0*i2*gam*Re_inv/(rho*rho*c*c) + coeffs(26, i1, i2) = -12._wp*i2*gam*Re_inv/(rho*rho*c*c) end if end if end if @@ -824,16 +824,16 @@ contains type(scalar_field), dimension(:), intent(inout) :: q_cons_vf, q_prim_vf type(scalar_field), dimension(:), intent(inout) :: momsp type(scalar_field), dimension(0:, 0:, :), intent(inout) :: moms3d - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv type(int_bounds_info), intent(in) :: ix, iy, iz - real(kind(0d0)), dimension(startx:, starty:, startz:) :: nbub_sc !> Unused Variable not sure what to put as intent + real(wp), dimension(startx:, starty:, startz:) :: nbub_sc !> Unused Variable not sure what to put as intent - real(kind(0d0)), dimension(nmom) :: moms, msum - real(kind(0d0)), dimension(nnode, nb) :: wght, abscX, abscY, wght_pb, wght_mv, wght_ht, ht - real(kind(0d0)), dimension(nterms, 0:2, 0:2) :: coeff - real(kind(0d0)) :: pres, rho, nbub, c, alf, momsum, drdt, drdt2, chi_vw, x_vw, rho_mw, k_mw, T_bar, grad_T - real(kind(0d0)) :: n_tait, B_tait + real(wp), dimension(nmom) :: moms, msum + real(wp), dimension(nnode, nb) :: wght, abscX, abscY, wght_pb, wght_mv, wght_ht, ht + real(wp), dimension(nterms, 0:2, 0:2) :: coeff + real(wp) :: pres, rho, nbub, c, alf, momsum, drdt, drdt2, chi_vw, x_vw, rho_mw, k_mw, T_bar, grad_T + real(wp) :: n_tait, B_tait integer :: id1, id2, id3 integer :: i1, i2 @@ -853,12 +853,12 @@ contains rho = q_prim_vf(contxb)%sf(id1, id2, id3) if (bubble_model == 2) then n_tait = gammas(1) - n_tait = 1.d0/n_tait + 1.d0 !make this the usual little 'gamma' + n_tait = 1._wp/n_tait + 1._wp !make this the usual little 'gamma' B_tait = pi_infs(1)*(n_tait - 1)/n_tait - c = n_tait*(pres + B_tait)*(1d0 - alf)/(rho) + c = n_tait*(pres + B_tait)*(1._wp - alf)/(rho) - if (c > 0.d0) then - c = DSQRT(c) + if (c > 0._wp) then + c = sqrt(c) else c = sgm_eps end if @@ -871,7 +871,7 @@ contains end if ! SHB: Manually adjusted pressure here for no-coupling case - ! pres = 1d0/0.3d0 + ! pres = 1._wp/0.3_wp if (alf > small_alf) then nbub = q_cons_vf(bubxb)%sf(id1, id2, id3) @@ -884,7 +884,7 @@ contains moms(r) = q_prim_vf(bubmoms(q, r))%sf(id1, id2, id3) end do - moms(1) = 1d0 + moms(1) = 1._wp call s_chyqmom(moms, wght(:, q), abscX(:, q), abscY(:, q)) @@ -898,13 +898,13 @@ contains !Account for bubble pressure, mass transfer rate and heat transfer rate in wght_pb, wght_mv and wght_ht using Preston model !$acc loop seq do j = 1, nnode - chi_vw = 1.d0/(1.d0 + R_v/R_n*(pb(id1, id2, id3, j, q)/pv - 1.d0)) + chi_vw = 1._wp/(1._wp + R_v/R_n*(pb(id1, id2, id3, j, q)/pv - 1._wp)) x_vw = M_n*chi_vw/(M_v + (M_n - M_v)*chi_vw) - k_mw = x_vw*k_v(q)/(x_vw + (1.d0 - x_vw)*phi_vn) & - + (1.d0 - x_vw)*k_n(q)/(x_vw*phi_nv + 1.d0 - x_vw) + k_mw = x_vw*k_v(q)/(x_vw + (1._wp - x_vw)*phi_vn) & + + (1._wp - x_vw)*k_n(q)/(x_vw*phi_nv + 1._wp - x_vw) rho_mw = pv/(chi_vw*R_v*Tw) rhs_mv(id1, id2, id3, j, q) = -Re_trans_c(q)*((mv(id1, id2, id3, j, q)/(mv(id1, id2, id3, j, q) + mass_n0(q))) - chi_vw) - rhs_mv(id1, id2, id3, j, q) = rho_mw*rhs_mv(id1, id2, id3, j, q)/Pe_c/(1.d0 - chi_vw)/abscX(j, q) + rhs_mv(id1, id2, id3, j, q) = rho_mw*rhs_mv(id1, id2, id3, j, q)/Pe_c/(1._wp - chi_vw)/abscX(j, q) T_bar = Tw*(pb(id1, id2, id3, j, q)/pb0(q))*(abscX(j, q)/R0(q))**3 & *(mass_n0(q) + mass_v0(q))/(mass_n0(q) + mv(id1, id2, id3, j, q)) @@ -924,7 +924,7 @@ contains !$acc loop seq do i1 = 0, 2 if ((i1 + i2) <= 2) then - momsum = 0d0 + momsum = 0._wp !$acc loop seq do j = 1, nterms ! Account for term with pb in Rayleigh Plesset equation @@ -964,48 +964,48 @@ contains do j = 1, nnode ! Compute Rdot (drdt) at quadrature node in the ODE for pb (note this is not the same as bubble variable Rdot) drdt = msum(2) - if (moms(4) - moms(2)**2d0 > 0d0) then + if (moms(4) - moms(2)**2._wp > 0._wp) then if (j == 1 .or. j == 2) then - drdt2 = -1d0/(2d0*dsqrt(moms(4) - moms(2)**2d0)) + drdt2 = -1._wp/(2._wp*sqrt(moms(4) - moms(2)**2._wp)) else - drdt2 = 1d0/(2d0*dsqrt(moms(4) - moms(2)**2d0)) + drdt2 = 1._wp/(2._wp*sqrt(moms(4) - moms(2)**2._wp)) end if else ! Edge case where variance < 0 if (j == 1 .or. j == 2) then - drdt2 = -1d0/(2d0*dsqrt(verysmall)) + drdt2 = -1._wp/(2._wp*sqrt(verysmall)) else - drdt2 = 1d0/(2d0*dsqrt(verysmall)) + drdt2 = 1._wp/(2._wp*sqrt(verysmall)) end if end if - drdt2 = drdt2*(msum(3) - 2d0*moms(2)*msum(2)) + drdt2 = drdt2*(msum(3) - 2._wp*moms(2)*msum(2)) drdt = drdt + drdt2 - rhs_pb(id1, id2, id3, j, q) = (-3d0*gam*drdt/abscX(j, q))*(pb(id1, id2, id3, j, q)) - rhs_pb(id1, id2, id3, j, q) = rhs_pb(id1, id2, id3, j, q) + (3d0*gam/abscX(j, q))*rhs_mv(id1, id2, id3, j, q)*R_v*Tw - rhs_pb(id1, id2, id3, j, q) = rhs_pb(id1, id2, id3, j, q) + (3d0*gam/abscX(j, q))*ht(j, q) - rhs_mv(id1, id2, id3, j, q) = rhs_mv(id1, id2, id3, j, q)*(4d0*pi*abscX(j, q)**2d0) + rhs_pb(id1, id2, id3, j, q) = (-3._wp*gam*drdt/abscX(j, q))*(pb(id1, id2, id3, j, q)) + rhs_pb(id1, id2, id3, j, q) = rhs_pb(id1, id2, id3, j, q) + (3._wp*gam/abscX(j, q))*rhs_mv(id1, id2, id3, j, q)*R_v*Tw + rhs_pb(id1, id2, id3, j, q) = rhs_pb(id1, id2, id3, j, q) + (3._wp*gam/abscX(j, q))*ht(j, q) + rhs_mv(id1, id2, id3, j, q) = rhs_mv(id1, id2, id3, j, q)*(4._wp*pi*abscX(j, q)**2._wp) end do end if end do ! Compute special high-order moments - momsp(1)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght, 3d0, 0d0, 0d0) - momsp(2)%sf(id1, id2, id3) = 4.d0*pi*nbub*f_quad(abscX, abscY, wght, 2d0, 1d0, 0d0) - momsp(3)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght, 3d0, 2d0, 0d0) - if (abs(gam - 1.d0) <= 1.d-4) then + momsp(1)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght, 3._wp, 0._wp, 0._wp) + momsp(2)%sf(id1, id2, id3) = 4._wp*pi*nbub*f_quad(abscX, abscY, wght, 2._wp, 1._wp, 0._wp) + momsp(3)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght, 3._wp, 2._wp, 0._wp) + if (abs(gam - 1._wp) <= 1.e-4_wp) then ! Gam \approx 1, don't risk imaginary quadrature - momsp(4)%sf(id1, id2, id3) = 1.d0 + momsp(4)%sf(id1, id2, id3) = 1._wp else !Special moment with bubble pressure pb if (polytropic) then - momsp(4)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght_pb, 3d0*(1d0 - gam), 0d0, 3d0*gam) + pv*f_quad(abscX, abscY, wght, 3d0, 0d0, 0d0) & - - 4d0*Re_inv*f_quad(abscX, abscY, wght, 2d0, 1d0, 0d0) - (2d0/Web)*f_quad(abscX, abscY, wght, 2d0, 0d0, 0d0) + momsp(4)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght_pb, 3._wp*(1._wp - gam), 0._wp, 3._wp*gam) + pv*f_quad(abscX, abscY, wght, 3._wp, 0._wp, 0._wp) & + - 4._wp*Re_inv*f_quad(abscX, abscY, wght, 2._wp, 1._wp, 0._wp) - (2._wp/Web)*f_quad(abscX, abscY, wght, 2._wp, 0._wp, 0._wp) else - momsp(4)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght_pb, 3d0, 0d0, 0d0) & - - 4d0*Re_inv*f_quad(abscX, abscY, wght, 2d0, 1d0, 0d0) - (2d0/Web)*f_quad(abscX, abscY, wght, 2d0, 0d0, 0d0) + momsp(4)%sf(id1, id2, id3) = f_quad(abscX, abscY, wght_pb, 3._wp, 0._wp, 0._wp) & + - 4._wp*Re_inv*f_quad(abscX, abscY, wght, 2._wp, 1._wp, 0._wp) - (2._wp/Web)*f_quad(abscX, abscY, wght, 2._wp, 0._wp, 0._wp) end if end if @@ -1016,15 +1016,15 @@ contains do i1 = 0, 2 !$acc loop seq do i2 = 0, 2 - moms3d(i1, i2, q)%sf(id1, id2, id3) = 0d0 + moms3d(i1, i2, q)%sf(id1, id2, id3) = 0._wp end do end do end do - momsp(1)%sf(id1, id2, id3) = 0d0 - momsp(2)%sf(id1, id2, id3) = 0d0 - momsp(3)%sf(id1, id2, id3) = 0d0 - momsp(4)%sf(id1, id2, id3) = 0d0 + momsp(1)%sf(id1, id2, id3) = 0._wp + momsp(2)%sf(id1, id2, id3) = 0._wp + momsp(3)%sf(id1, id2, id3) = 0._wp + momsp(4)%sf(id1, id2, id3) = 0._wp end if @@ -1040,14 +1040,14 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(nmom), intent(in) :: momin - real(kind(0d0)), dimension(nnode), intent(inout) :: wght, abscX, abscY + real(wp), dimension(nmom), intent(in) :: momin + real(wp), dimension(nnode), intent(inout) :: wght, abscX, abscY - real(kind(0d0)), dimension(0:2, 0:2) :: moms - real(kind(0d0)), dimension(3) :: M1, M3 - real(kind(0d0)), dimension(2) :: myrho, myrho3, up, up3, Vf - real(kind(0d0)) :: bu, bv, d20, d11, d02, c20, c11, c02 - real(kind(0d0)) :: mu2avg, mu2, vp21, vp22, rho21, rho22 + real(wp), dimension(0:2, 0:2) :: moms + real(wp), dimension(3) :: M1, M3 + real(wp), dimension(2) :: myrho, myrho3, up, up3, Vf + real(wp) :: bu, bv, d20, d11, d02, c20, c11, c02 + real(wp) :: mu2avg, mu2, vp21, vp22, rho21, rho22 moms(0, 0) = momin(1) moms(1, 0) = momin(2) @@ -1062,18 +1062,18 @@ contains d11 = moms(1, 1)/moms(0, 0) d02 = moms(0, 2)/moms(0, 0) - c20 = d20 - bu**2d0; + c20 = d20 - bu**2._wp; c11 = d11 - bu*bv; - c02 = d02 - bv**2d0; - M1 = (/1d0, 0d0, c20/) + c02 = d02 - bv**2._wp; + M1 = (/1._wp, 0._wp, c20/) call s_hyqmom(myrho, up, M1) Vf = c11*up/c20 - mu2avg = c02 - sum(myrho(:)*(Vf(:)**2d0)) + mu2avg = c02 - sum(myrho(:)*(Vf(:)**2._wp)) - mu2avg = maxval((/mu2avg, 0d0/)) + mu2avg = maxval((/mu2avg, 0._wp/)) mu2 = mu2avg - M3 = (/1d0, 0d0, mu2/) + M3 = (/1._wp, 0._wp, mu2/) call s_hyqmom(myrho3, up3, M3) vp21 = up3(1) @@ -1107,31 +1107,31 @@ contains #else !$acc routine seq #endif - real(kind(0d0)), dimension(2), intent(inout) :: frho, fup - real(kind(0d0)), dimension(3), intent(in) :: fmom + real(wp), dimension(2), intent(inout) :: frho, fup + real(wp), dimension(3), intent(in) :: fmom - real(kind(0d0)) :: bu, d2, c2 + real(wp) :: bu, d2, c2 bu = fmom(2)/fmom(1) d2 = fmom(3)/fmom(1) - c2 = d2 - bu**2d0 - frho(1) = fmom(1)/2d0; - frho(2) = fmom(1)/2d0; + c2 = d2 - bu**2._wp + frho(1) = fmom(1)/2._wp; + frho(2) = fmom(1)/2._wp; c2 = maxval((/c2, verysmall/)) - fup(1) = bu - DSQRT(c2) - fup(2) = bu + DSQRT(c2) + fup(1) = bu - sqrt(c2) + fup(2) = bu + sqrt(c2) end subroutine s_hyqmom function f_quad(abscX, abscY, wght_in, q, r, s) !$acc routine seq - real(kind(0.d0)), dimension(nnode, nb), intent(in) :: abscX, abscY, wght_in - real(kind(0.d0)), intent(in) :: q, r, s + real(wp), dimension(nnode, nb), intent(in) :: abscX, abscY, wght_in + real(wp), intent(in) :: q, r, s - real(kind(0.d0)) :: f_quad_RV, f_quad + real(wp) :: f_quad_RV, f_quad integer :: i - f_quad = 0d0 + f_quad = 0._wp do i = 1, nb f_quad_RV = sum(wght_in(:, i)*(abscX(:, i)**q)*(abscY(:, i)**r)) f_quad = f_quad + weight(i)*(R0(i)**s)*f_quad_RV @@ -1141,10 +1141,10 @@ contains function f_quad2D(abscX, abscY, wght_in, pow) !$acc routine seq - real(kind(0.d0)), dimension(nnode), intent(in) :: abscX, abscY, wght_in - real(kind(0.d0)), dimension(3), intent(in) :: pow + real(wp), dimension(nnode), intent(in) :: abscX, abscY, wght_in + real(wp), dimension(3), intent(in) :: pow - real(kind(0.d0)) :: f_quad2D + real(wp) :: f_quad2D f_quad2D = sum(wght_in(:)*(abscX(:)**pow(1))*(abscY(:)**pow(2))) end function f_quad2D diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index 0e5572b59..2f89dc3eb 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -6,7 +6,7 @@ #:include 'macros.fpp' !> @brief The module contains the subroutines used to calculate the right- -!! hand-side (RHS) in the quasi-conservative, shock- and interface- +!! hane-side (RHS) in the quasi-conservative, shock- and interface- !! capturing finite-volume framework for the multicomponent Navier- !! Stokes equations supplemented by appropriate advection equations !! used to capture the material interfaces. The system of equations @@ -147,20 +147,20 @@ module m_rhs !> @} !$acc declare create(alf_sum) - real(kind(0d0)), allocatable, dimension(:, :, :) :: blkmod1, blkmod2, alpha1, alpha2, Kterm - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: qL_rsx_vf, qL_rsy_vf, qL_rsz_vf, qR_rsx_vf, qR_rsy_vf, qR_rsz_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: dqL_rsx_vf, dqL_rsy_vf, dqL_rsz_vf, dqR_rsx_vf, dqR_rsy_vf, dqR_rsz_vf + real(wp), allocatable, dimension(:, :, :) :: blkmod1, blkmod2, alpha1, alpha2, Kterm + real(wp), allocatable, dimension(:, :, :, :) :: qL_rsx_vf, qL_rsy_vf, qL_rsz_vf, qR_rsx_vf, qR_rsy_vf, qR_rsz_vf + real(wp), allocatable, dimension(:, :, :, :) :: dqL_rsx_vf, dqL_rsy_vf, dqL_rsz_vf, dqR_rsx_vf, dqR_rsy_vf, dqR_rsz_vf !$acc declare create(blkmod1, blkmod2, alpha1, alpha2, Kterm) !$acc declare create(qL_rsx_vf, qL_rsy_vf, qL_rsz_vf, qR_rsx_vf, qR_rsy_vf, qR_rsz_vf) !$acc declare create(dqL_rsx_vf, dqL_rsy_vf, dqL_rsz_vf, dqR_rsx_vf, dqR_rsy_vf, dqR_rsz_vf) - real(kind(0d0)), allocatable, dimension(:) :: gamma_min, pres_inf + real(wp), allocatable, dimension(:) :: gamma_min, pres_inf !$acc declare create(gamma_min, pres_inf) - real(kind(0d0)), allocatable, dimension(:, :) :: Res + real(wp), allocatable, dimension(:, :) :: Res !$acc declare create(Res) - real(kind(0d0)), allocatable, dimension(:, :, :) :: nbub !< Bubble number density + real(wp), allocatable, dimension(:, :, :) :: nbub !< Bubble number density !$acc declare create(nbub) contains @@ -571,8 +571,8 @@ contains @:ALLOCATE(gamma_min(1:num_fluids), pres_inf(1:num_fluids)) do i = 1, num_fluids - gamma_min(i) = 1d0/fluid_pp(i)%gamma + 1d0 - pres_inf(i) = fluid_pp(i)%pi_inf/(1d0 + fluid_pp(i)%gamma) + gamma_min(i) = 1._wp/fluid_pp(i)%gamma + 1._wp + pres_inf(i) = fluid_pp(i)%pi_inf/(1._wp + fluid_pp(i)%gamma) end do !$acc update device(gamma_min, pres_inf) @@ -595,7 +595,7 @@ contains do l = startz, p - startz do k = starty, n - starty do j = startx, m - startx - flux_gsrc_n(id)%vf(i)%sf(j, k, l) = 0d0 + flux_gsrc_n(id)%vf(i)%sf(j, k, l) = 0._wp end do end do end do @@ -613,13 +613,13 @@ contains type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf type(scalar_field), dimension(sys_size), intent(inout) :: rhs_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb + real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv integer, intent(in) :: t_step - real(kind(0d0)), intent(inout) :: time_avg + real(wp), intent(inout) :: time_avg - real(kind(0d0)), dimension(0:m, 0:n, 0:p) :: nbub - real(kind(0d0)) :: t_start, t_finish + real(wp), dimension(0:m, 0:n, 0:p) :: nbub + real(wp) :: t_start, t_finish integer :: i, j, k, l, id !< Generic loop iterators call nvtxStartRange("COMPUTE-RHS") @@ -646,14 +646,14 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end - alf_sum%sf(j, k, l) = 0d0 + alf_sum%sf(j, k, l) = 0._wp !$acc loop seq do i = advxb, advxe - 1 alf_sum%sf(j, k, l) = alf_sum%sf(j, k, l) + q_cons_qp%vf(i)%sf(j, k, l) end do !$acc loop seq do i = advxb, advxe - 1 - q_cons_qp%vf(i)%sf(j, k, l) = q_cons_qp%vf(i)%sf(j, k, l)*(1.d0 - q_cons_qp%vf(alf_idx)%sf(j, k, l)) & + q_cons_qp%vf(i)%sf(j, k, l) = q_cons_qp%vf(i)%sf(j, k, l)*(1._wp - q_cons_qp%vf(alf_idx)%sf(j, k, l)) & /alf_sum%sf(j, k, l) end do end do @@ -867,7 +867,7 @@ contains do j = 0, m if (ib_markers%sf(j, k, l) /= 0) then do i = 1, sys_size - rhs_vf(i)%sf(j, k, l) = 0d0 + rhs_vf(i)%sf(j, k, l) = 0._wp end do end if end do @@ -899,7 +899,7 @@ contains if (chemistry) then !$acc kernels - rhs_vf(T_idx)%sf(:, :, :) = 0d0 + rhs_vf(T_idx)%sf(:, :, :) = 0.0_wp !$acc end kernels if (chem_params%reactions) then @@ -929,7 +929,7 @@ contains if (t_step >= 4) then time_avg = (abs(t_finish - t_start) + (t_step - 4)*time_avg)/(t_step - 3) else - time_avg = 0d0 + time_avg = 0._wp end if ! ================================================================== @@ -952,9 +952,9 @@ contains do l = 0, p do k = 0, n do j = 0, m - blkmod1(j, k, l) = ((gammas(1) + 1d0)*q_prim_vf%vf(E_idx)%sf(j, k, l) + & + blkmod1(j, k, l) = ((gammas(1) + 1._wp)*q_prim_vf%vf(E_idx)%sf(j, k, l) + & pi_infs(1))/gammas(1) - blkmod2(j, k, l) = ((gammas(2) + 1d0)*q_prim_vf%vf(E_idx)%sf(j, k, l) + & + blkmod2(j, k, l) = ((gammas(2) + 1._wp)*q_prim_vf%vf(E_idx)%sf(j, k, l) + & pi_infs(2))/gammas(2) alpha1(j, k, l) = q_cons_vf%vf(advxb)%sf(j, k, l) @@ -988,7 +988,7 @@ contains do q = 0, p do l = 0, n do k = 0, m - rhs_vf(j)%sf(k, l, q) = 1d0/dx(k)* & + rhs_vf(j)%sf(k, l, q) = 1._wp/dx(k)* & (flux_n(1)%vf(j)%sf(k - 1, l, q) & - flux_n(1)%vf(j)%sf(k, l, q)) end do @@ -1003,7 +1003,7 @@ contains do j = 0, m do i = 1, num_fluids rhs_vf(i + intxb - 1)%sf(j, k, l) = & - rhs_vf(i + intxb - 1)%sf(j, k, l) - 1d0/dx(j)* & + rhs_vf(i + intxb - 1)%sf(j, k, l) - 1._wp/dx(j)* & q_cons_vf%vf(i + advxb - 1)%sf(j, k, l)* & q_prim_vf%vf(E_idx)%sf(j, k, l)* & (flux_src_n(1)%vf(advxb)%sf(j, k, l) - & @@ -1021,7 +1021,7 @@ contains do l = 0, n do k = 0, m rhs_vf(j)%sf(k, l, q) = & - rhs_vf(j)%sf(k, l, q) + 1d0/dx(k)* & + rhs_vf(j)%sf(k, l, q) + 1._wp/dx(k)* & q_prim_vf%vf(contxe + idir)%sf(k, l, q)* & (flux_src_n(1)%vf(j)%sf(k - 1, l, q) & - flux_src_n(1)%vf(j)%sf(k, l, q)) @@ -1038,7 +1038,7 @@ contains do l = 0, n do k = 0, m rhs_vf(j)%sf(k, l, q) = & - rhs_vf(j)%sf(k, l, q) + 1d0/dx(k)* & + rhs_vf(j)%sf(k, l, q) + 1._wp/dx(k)* & (q_cons_vf%vf(j)%sf(k, l, q) - Kterm(k, l, q))* & (flux_src_n(1)%vf(j)%sf(k, l, q) & - flux_src_n(1)%vf(j)%sf(k - 1, l, q)) @@ -1051,7 +1051,7 @@ contains do l = 0, n do k = 0, m rhs_vf(j)%sf(k, l, q) = & - rhs_vf(j)%sf(k, l, q) + 1d0/dx(k)* & + rhs_vf(j)%sf(k, l, q) + 1._wp/dx(k)* & (q_cons_vf%vf(j)%sf(k, l, q) + Kterm(k, l, q))* & (flux_src_n(1)%vf(j)%sf(k, l, q) & - flux_src_n(1)%vf(j)%sf(k - 1, l, q)) @@ -1067,7 +1067,7 @@ contains do l = 0, n do k = 0, m rhs_vf(j)%sf(k, l, q) = & - rhs_vf(j)%sf(k, l, q) + 1d0/dx(k)* & + rhs_vf(j)%sf(k, l, q) + 1._wp/dx(k)* & q_cons_vf%vf(j)%sf(k, l, q)* & (flux_src_n(1)%vf(j)%sf(k, l, q) & - flux_src_n(1)%vf(j)%sf(k - 1, l, q)) @@ -1098,7 +1098,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & (flux_n(2)%vf(j)%sf(q, k - 1, l) & - flux_n(2)%vf(j)%sf(q, k, l)) end do @@ -1113,7 +1113,7 @@ contains do j = 0, m do i = 1, num_fluids rhs_vf(i + intxb - 1)%sf(j, k, l) = & - rhs_vf(i + intxb - 1)%sf(j, k, l) - 1d0/dy(k)* & + rhs_vf(i + intxb - 1)%sf(j, k, l) - 1._wp/dy(k)* & q_cons_vf%vf(i + advxb - 1)%sf(j, k, l)* & q_prim_vf%vf(E_idx)%sf(j, k, l)* & (flux_src_n(2)%vf(advxb)%sf(j, k, l) - & @@ -1130,7 +1130,7 @@ contains do j = 0, m do i = 1, num_fluids rhs_vf(i + intxb - 1)%sf(j, k, l) = & - rhs_vf(i + intxb - 1)%sf(j, k, l) - 5d-1/y_cc(k)* & + rhs_vf(i + intxb - 1)%sf(j, k, l) - 5e-1_wp/y_cc(k)* & q_cons_vf%vf(i + advxb - 1)%sf(j, k, l)* & q_prim_vf%vf(E_idx)%sf(j, k, l)* & (flux_src_n(2)%vf(advxb)%sf(j, k, l) + & @@ -1149,7 +1149,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) - 5d-1/y_cc(k)* & + rhs_vf(j)%sf(q, k, l) - 5e-1_wp/y_cc(k)* & (flux_gsrc_n(2)%vf(j)%sf(q, k - 1, l) & + flux_gsrc_n(2)%vf(j)%sf(q, k, l)) end do @@ -1165,7 +1165,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & q_prim_vf%vf(contxe + idir)%sf(q, k, l)* & (flux_src_n(2)%vf(j)%sf(q, k - 1, l) & - flux_src_n(2)%vf(j)%sf(q, k, l)) @@ -1183,7 +1183,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & (q_cons_vf%vf(j)%sf(q, k, l) - Kterm(q, k, l))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1197,7 +1197,7 @@ contains do q = 0, m rhs_vf(j)%sf(q, k, l) = & rhs_vf(j)%sf(q, k, l) - & - (Kterm(q, k, l)/2d0/y_cc(k))* & + (Kterm(q, k, l)/2._wp/y_cc(k))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & + flux_src_n(2)%vf(j)%sf(q, k - 1, l)) end do @@ -1210,7 +1210,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & (q_cons_vf%vf(j)%sf(q, k, l) + Kterm(q, k, l))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1224,7 +1224,7 @@ contains do q = 0, m rhs_vf(j)%sf(q, k, l) = & rhs_vf(j)%sf(q, k, l) + & - (Kterm(q, k, l)/2d0/y_cc(k))* & + (Kterm(q, k, l)/2._wp/y_cc(k))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & + flux_src_n(2)%vf(j)%sf(q, k - 1, l)) end do @@ -1240,7 +1240,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & q_cons_vf%vf(j)%sf(q, k, l)* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1273,7 +1273,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)/y_cc(q)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)/y_cc(q)* & q_prim_vf%vf(contxe + idir)%sf(l, q, k)* & (flux_n(3)%vf(j)%sf(l, q, k - 1) & - flux_n(3)%vf(j)%sf(l, q, k)) @@ -1288,7 +1288,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) - 5d-1/y_cc(q)* & + rhs_vf(j)%sf(l, q, k) - 5e-1_wp/y_cc(q)* & (flux_gsrc_n(3)%vf(j)%sf(l, q, k - 1) & - flux_gsrc_n(3)%vf(j)%sf(l, q, k)) end do @@ -1303,7 +1303,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)* & (flux_n(3)%vf(j)%sf(l, q, k - 1) & - flux_n(3)%vf(j)%sf(l, q, k)) end do @@ -1319,7 +1319,7 @@ contains do j = 0, m do i = 1, num_fluids rhs_vf(i + intxb - 1)%sf(j, k, l) = & - rhs_vf(i + intxb - 1)%sf(j, k, l) - 1d0/dz(l)* & + rhs_vf(i + intxb - 1)%sf(j, k, l) - 1._wp/dz(l)* & q_cons_vf%vf(i + advxb - 1)%sf(j, k, l)* & q_prim_vf%vf(E_idx)%sf(j, k, l)* & (flux_src_n(3)%vf(advxb)%sf(j, k, l) - & @@ -1338,7 +1338,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & q_prim_vf%vf(contxe + idir)%sf(q, k, l)* & (flux_src_n(2)%vf(j)%sf(q, k - 1, l) & - flux_src_n(2)%vf(j)%sf(q, k, l)) @@ -1356,7 +1356,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & (q_cons_vf%vf(j)%sf(q, k, l) - Kterm(q, k, l))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1370,7 +1370,7 @@ contains do q = 0, m rhs_vf(j)%sf(q, k, l) = & rhs_vf(j)%sf(q, k, l) - & - (Kterm(q, k, l)/2d0/y_cc(k))* & + (Kterm(q, k, l)/2._wp/y_cc(k))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & + flux_src_n(2)%vf(j)%sf(q, k - 1, l)) end do @@ -1383,7 +1383,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & (q_cons_vf%vf(j)%sf(q, k, l) + Kterm(q, k, l))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1397,7 +1397,7 @@ contains do q = 0, m rhs_vf(j)%sf(q, k, l) = & rhs_vf(j)%sf(q, k, l) + & - (Kterm(q, k, l)/2d0/y_cc(k))* & + (Kterm(q, k, l)/2._wp/y_cc(k))* & (flux_src_n(2)%vf(j)%sf(q, k, l) & + flux_src_n(2)%vf(j)%sf(q, k - 1, l)) end do @@ -1413,7 +1413,7 @@ contains do k = 0, n do q = 0, m rhs_vf(j)%sf(q, k, l) = & - rhs_vf(j)%sf(q, k, l) + 1d0/dy(k)* & + rhs_vf(j)%sf(q, k, l) + 1._wp/dy(k)* & q_cons_vf%vf(j)%sf(q, k, l)* & (flux_src_n(2)%vf(j)%sf(q, k, l) & - flux_src_n(2)%vf(j)%sf(q, k - 1, l)) @@ -1431,7 +1431,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)* & q_prim_vf%vf(contxe + idir)%sf(l, q, k)* & (flux_src_n(3)%vf(j)%sf(l, q, k - 1) & - flux_src_n(3)%vf(j)%sf(l, q, k)) @@ -1448,7 +1448,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)* & (q_cons_vf%vf(j)%sf(l, q, k) - Kterm(l, q, k))* & (flux_src_n(3)%vf(j)%sf(l, q, k) & - flux_src_n(3)%vf(j)%sf(l, q, k - 1)) @@ -1461,7 +1461,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)* & (q_cons_vf%vf(j)%sf(l, q, k) + Kterm(l, q, k))* & (flux_src_n(3)%vf(j)%sf(l, q, k) & - flux_src_n(3)%vf(j)%sf(l, q, k - 1)) @@ -1477,7 +1477,7 @@ contains do q = 0, n do l = 0, m rhs_vf(j)%sf(l, q, k) = & - rhs_vf(j)%sf(l, q, k) + 1d0/dz(k)* & + rhs_vf(j)%sf(l, q, k) + 1._wp/dz(k)* & q_cons_vf%vf(j)%sf(l, q, k)* & (flux_src_n(3)%vf(j)%sf(l, q, k) & - flux_src_n(3)%vf(j)%sf(l, q, k - 1)) @@ -1511,7 +1511,7 @@ contains do k = 0, n do j = 0, m rhs_vf(c_idx)%sf(j, k, l) = & - rhs_vf(c_idx)%sf(j, k, l) + 1d0/dx(j)* & + rhs_vf(c_idx)%sf(j, k, l) + 1._wp/dx(j)* & q_prim_vf(c_idx)%sf(j, k, l)* & (flux_src_n(advxb)%sf(j, k, l) - & flux_src_n(advxb)%sf(j - 1, k, l)) @@ -1527,7 +1527,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) + 1d0/dx(j)* & + rhs_vf(i)%sf(j, k, l) + 1._wp/dx(j)* & (flux_src_n(i)%sf(j - 1, k, l) & - flux_src_n(i)%sf(j, k, l)) end do @@ -1543,7 +1543,7 @@ contains do k = 0, n do j = 0, m rhs_vf(c_idx)%sf(j, k, l) = & - rhs_vf(c_idx)%sf(j, k, l) + 1d0/dy(k)* & + rhs_vf(c_idx)%sf(j, k, l) + 1._wp/dy(k)* & q_prim_vf(c_idx)%sf(j, k, l)* & (flux_src_n(advxb)%sf(j, k, l) - & flux_src_n(advxb)%sf(j, k - 1, l)) @@ -1576,7 +1576,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, 0, l) = & - rhs_vf(i)%sf(j, 0, l) + 1d0/(y_cc(1) - y_cc(-1))* & + rhs_vf(i)%sf(j, 0, l) + 1._wp/(y_cc(1) - y_cc(-1))* & (tau_Re_vf(i)%sf(j, -1, l) & - tau_Re_vf(i)%sf(j, 1, l)) end do @@ -1592,7 +1592,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) + 1d0/dy(k)* & + rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)* & (flux_src_n(i)%sf(j, k - 1, l) & - flux_src_n(i)%sf(j, k, l)) end do @@ -1608,7 +1608,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) + 1d0/dy(k)* & + rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)* & (flux_src_n(i)%sf(j, k - 1, l) & - flux_src_n(i)%sf(j, k, l)) end do @@ -1629,7 +1629,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) - 5d-1/y_cc(k)* & + rhs_vf(i)%sf(j, k, l) - 5e-1_wp/y_cc(k)* & (flux_src_n(i)%sf(j, k - 1, l) & + flux_src_n(i)%sf(j, k, l)) end do @@ -1644,7 +1644,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, 0, l) = & - rhs_vf(i)%sf(j, 0, l) - 1d0/y_cc(0)* & + rhs_vf(i)%sf(j, 0, l) - 1._wp/y_cc(0)* & tau_Re_vf(i)%sf(j, 0, l) end do end do @@ -1659,7 +1659,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) - 5d-1/y_cc(k)* & + rhs_vf(i)%sf(j, k, l) - 5e-1_wp/y_cc(k)* & (flux_src_n(i)%sf(j, k - 1, l) & + flux_src_n(i)%sf(j, k, l)) end do @@ -1678,7 +1678,7 @@ contains do k = 0, n do j = 0, m rhs_vf(c_idx)%sf(j, k, l) = & - rhs_vf(c_idx)%sf(j, k, l) + 1d0/dz(l)* & + rhs_vf(c_idx)%sf(j, k, l) + 1._wp/dz(l)* & q_prim_vf(c_idx)%sf(j, k, l)* & (flux_src_n(advxb)%sf(j, k, l) - & flux_src_n(advxb)%sf(j, k, l - 1)) @@ -1694,7 +1694,7 @@ contains !$acc loop seq do i = momxb, E_idx rhs_vf(i)%sf(j, k, l) = & - rhs_vf(i)%sf(j, k, l) + 1d0/dz(l)* & + rhs_vf(i)%sf(j, k, l) + 1._wp/dz(l)* & (flux_src_n(i)%sf(j, k, l - 1) & - flux_src_n(i)%sf(j, k, l)) end do @@ -1708,12 +1708,12 @@ contains do k = 0, n do j = 0, m rhs_vf(momxb + 1)%sf(j, k, l) = & - rhs_vf(momxb + 1)%sf(j, k, l) + 5d-1* & + rhs_vf(momxb + 1)%sf(j, k, l) + 5e-1_wp* & (flux_src_n(momxe)%sf(j, k, l - 1) & + flux_src_n(momxe)%sf(j, k, l)) rhs_vf(momxe)%sf(j, k, l) = & - rhs_vf(momxe)%sf(j, k, l) - 5d-1* & + rhs_vf(momxe)%sf(j, k, l) - 5e-1_wp* & (flux_src_n(momxb + 1)%sf(j, k, l - 1) & + flux_src_n(momxb + 1)%sf(j, k, l)) end do @@ -1741,19 +1741,19 @@ contains !! function, liquid stiffness function (two variations of the last two !! ones), shear and volume Reynolds numbers and the Weber numbers !> @{ - real(kind(0d0)) :: pres_relax - real(kind(0d0)), dimension(num_fluids) :: pres_K_init - real(kind(0d0)) :: f_pres - real(kind(0d0)) :: df_pres - real(kind(0d0)), dimension(num_fluids) :: rho_K_s - real(kind(0d0)), dimension(num_fluids) :: alpha_rho - real(kind(0d0)), dimension(num_fluids) :: alpha - real(kind(0d0)) :: sum_alpha - real(kind(0d0)) :: rho - real(kind(0d0)) :: dyn_pres - real(kind(0d0)) :: gamma - real(kind(0d0)) :: pi_inf - real(kind(0d0)), dimension(2) :: Re + real(wp) :: pres_relax + real(wp), dimension(num_fluids) :: pres_K_init + real(wp) :: f_pres + real(wp) :: df_pres + real(wp), dimension(num_fluids) :: rho_K_s + real(wp), dimension(num_fluids) :: alpha_rho + real(wp), dimension(num_fluids) :: alpha + real(wp) :: sum_alpha + real(wp) :: rho + real(wp) :: dyn_pres + real(wp) :: gamma + real(wp) :: pi_inf + real(wp), dimension(2) :: Re integer :: i, j, k, l, q, iter !< Generic loop iterators integer :: relax !< Relaxation procedure determination variable @@ -1765,19 +1765,19 @@ contains ! Numerical correction of the volume fractions if (mpp_lim) then - sum_alpha = 0d0 + sum_alpha = 0._wp !$acc loop seq do i = 1, num_fluids - if ((q_cons_vf(i + contxb - 1)%sf(j, k, l) < 0d0) .or. & - (q_cons_vf(i + advxb - 1)%sf(j, k, l) < 0d0)) then - q_cons_vf(i + contxb - 1)%sf(j, k, l) = 0d0 - q_cons_vf(i + advxb - 1)%sf(j, k, l) = 0d0 - q_cons_vf(i + intxb - 1)%sf(j, k, l) = 0d0 + if ((q_cons_vf(i + contxb - 1)%sf(j, k, l) < 0._wp) .or. & + (q_cons_vf(i + advxb - 1)%sf(j, k, l) < 0._wp)) then + q_cons_vf(i + contxb - 1)%sf(j, k, l) = 0._wp + q_cons_vf(i + advxb - 1)%sf(j, k, l) = 0._wp + q_cons_vf(i + intxb - 1)%sf(j, k, l) = 0._wp end if - if (q_cons_vf(i + advxb - 1)%sf(j, k, l) > 1d0) & - q_cons_vf(i + advxb - 1)%sf(j, k, l) = 1d0 + if (q_cons_vf(i + advxb - 1)%sf(j, k, l) > 1._wp) & + q_cons_vf(i + advxb - 1)%sf(j, k, l) = 1._wp sum_alpha = sum_alpha + q_cons_vf(i + advxb - 1)%sf(j, k, l) end do @@ -1794,12 +1794,12 @@ contains !$acc loop seq do i = 1, num_fluids - if (q_cons_vf(i + advxb - 1)%sf(j, k, l) > (1d0 - sgm_eps)) relax = 0 + if (q_cons_vf(i + advxb - 1)%sf(j, k, l) > (1._wp - sgm_eps)) relax = 0 end do if (relax == 1) then ! Initial state - pres_relax = 0d0 + pres_relax = 0._wp !$acc loop seq do i = 1, num_fluids @@ -1809,38 +1809,38 @@ contains q_cons_vf(i + advxb - 1)%sf(j, k, l) & - pi_infs(i))/gammas(i) - if (pres_K_init(i) <= -(1d0 - 1d-8)*pres_inf(i) + 1d-8) & - pres_K_init(i) = -(1d0 - 1d-8)*pres_inf(i) + 1d-8 + if (pres_K_init(i) <= -(1._wp - 1e-8_wp)*pres_inf(i) + 1e-8_wp) & + pres_K_init(i) = -(1._wp - 1e-8_wp)*pres_inf(i) + 1e-8_wp else - pres_K_init(i) = 0d0 + pres_K_init(i) = 0._wp end if pres_relax = pres_relax + q_cons_vf(i + advxb - 1)%sf(j, k, l)*pres_K_init(i) end do ! Iterative process for relaxed pressure determination - f_pres = 1d-9 - df_pres = 1d9 + f_pres = 1e-9_wp + df_pres = 1e9_wp !$acc loop seq do i = 1, num_fluids - rho_K_s(i) = 0d0 + rho_K_s(i) = 0._wp end do !$acc loop seq do iter = 0, 49 - if (DABS(f_pres) > 1d-10) then + if (abs(f_pres) > 1e-10_wp) then pres_relax = pres_relax - f_pres/df_pres ! Physical pressure do i = 1, num_fluids - if (pres_relax <= -(1d0 - 1d-8)*pres_inf(i) + 1d-8) & - pres_relax = -(1d0 - 1d-8)*pres_inf(i) + 1d0 + if (pres_relax <= -(1._wp - 1e-8_wp)*pres_inf(i) + 1e-8_wp) & + pres_relax = -(1._wp - 1e-8_wp)*pres_inf(i) + 1._wp end do ! Newton-Raphson method - f_pres = -1d0 - df_pres = 0d0 + f_pres = -1._wp + df_pres = 0._wp !$acc loop seq do i = 1, num_fluids @@ -1848,7 +1848,7 @@ contains rho_K_s(i) = q_cons_vf(i + contxb - 1)%sf(j, k, l)/ & max(q_cons_vf(i + advxb - 1)%sf(j, k, l), sgm_eps) & *((pres_relax + pres_inf(i))/(pres_K_init(i) + & - pres_inf(i)))**(1d0/gamma_min(i)) + pres_inf(i)))**(1._wp/gamma_min(i)) f_pres = f_pres + q_cons_vf(i + contxb - 1)%sf(j, k, l) & /rho_K_s(i) @@ -1887,9 +1887,9 @@ contains end do if (bubbles) then - rho = 0d0 - gamma = 0d0 - pi_inf = 0d0 + rho = 0._wp + gamma = 0._wp + pi_inf = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then !$acc loop seq @@ -1911,17 +1911,17 @@ contains pi_inf = pi_infs(1) end if else - rho = 0d0 - gamma = 0d0 - pi_inf = 0d0 + rho = 0._wp + gamma = 0._wp + pi_inf = 0._wp - sum_alpha = 0d0 + sum_alpha = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho(i) = max(0d0, alpha_rho(i)) - alpha(i) = min(max(0d0, alpha(i)), 1d0) + alpha_rho(i) = max(0._wp, alpha_rho(i)) + alpha(i) = min(max(0._wp, alpha(i)), 1._wp) sum_alpha = sum_alpha + alpha(i) end do @@ -1941,24 +1941,24 @@ contains do i = 1, 2 Re(i) = dflt_real - if (Re_size(i) > 0) Re(i) = 0d0 + if (Re_size(i) > 0) Re(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) Re(i) = alpha(Re_idx(i, q))/Res(i, q) & + Re(i) end do - Re(i) = 1d0/max(Re(i), sgm_eps) + Re(i) = 1._wp/max(Re(i), sgm_eps) end do end if end if - dyn_pres = 0d0 + dyn_pres = 0._wp !$acc loop seq do i = momxb, momxe - dyn_pres = dyn_pres + 5d-1*q_cons_vf(i)%sf(j, k, l)* & + dyn_pres = dyn_pres + 5e-1_wp*q_cons_vf(i)%sf(j, k, l)* & q_cons_vf(i)%sf(j, k, l)/max(rho, sgm_eps) end do @@ -1991,8 +1991,8 @@ contains norm_dir) type(scalar_field), dimension(iv%beg:iv%end), intent(in) :: v_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_x, vR_y, vR_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_x, vR_y, vR_z integer, intent(in) :: norm_dir integer :: weno_dir !< Coordinate direction of the WENO reconstruction @@ -2044,8 +2044,8 @@ contains norm_dir) type(scalar_field), dimension(iv%beg:iv%end), intent(in) :: v_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_x, vR_y, vR_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_x, vR_y, vR_z integer, intent(in) :: norm_dir integer :: recon_dir !< Coordinate direction of the WENO reconstruction diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index 7a9bdbb11..a7d1f3f3c 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -59,9 +59,10 @@ module m_riemann_solvers !! source terms, by using the left and right states given in qK_prim_rs_vf, !! dqK_prim_ds_vf where ds = dx, dy or dz. !> @{ - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsx_vf, flux_src_rsx_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsy_vf, flux_src_rsy_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_rsz_vf, flux_src_rsz_vf + + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsx_vf, flux_src_rsx_vf + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsy_vf, flux_src_rsy_vf + real(wp), allocatable, dimension(:, :, :, :) :: flux_rsz_vf, flux_src_rsz_vf !$acc declare create( flux_rsx_vf, flux_src_rsx_vf, flux_rsy_vf, & !$acc flux_src_rsy_vf, flux_rsz_vf, flux_src_rsz_vf ) !> @} @@ -70,27 +71,29 @@ module m_riemann_solvers !! through the chosen Riemann problem solver by using the left and right !! states given in qK_prim_rs_vf. Currently 2D axisymmetric for inviscid only. !> @{ - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsx_vf !< - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsy_vf !< - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsz_vf !< + + real(wp), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsx_vf !< + real(wp), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsy_vf !< + real(wp), allocatable, dimension(:, :, :, :) :: flux_gsrc_rsz_vf !< !$acc declare create( flux_gsrc_rsx_vf, flux_gsrc_rsy_vf, flux_gsrc_rsz_vf ) !> @} ! The cell-boundary values of the velocity. vel_src_rs_vf is determined as ! part of Riemann problem solution and is used to evaluate the source flux. - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: vel_src_rsx_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: vel_src_rsy_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: vel_src_rsz_vf + + real(wp), allocatable, dimension(:, :, :, :) :: vel_src_rsx_vf + real(wp), allocatable, dimension(:, :, :, :) :: vel_src_rsy_vf + real(wp), allocatable, dimension(:, :, :, :) :: vel_src_rsz_vf !$acc declare create(vel_src_rsx_vf, vel_src_rsy_vf, vel_src_rsz_vf) - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: mom_sp_rsx_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: mom_sp_rsy_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: mom_sp_rsz_vf + real(wp), allocatable, dimension(:, :, :, :) :: mom_sp_rsx_vf + real(wp), allocatable, dimension(:, :, :, :) :: mom_sp_rsy_vf + real(wp), allocatable, dimension(:, :, :, :) :: mom_sp_rsz_vf !$acc declare create(mom_sp_rsx_vf, mom_sp_rsy_vf, mom_sp_rsz_vf) - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: Re_avg_rsx_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: Re_avg_rsy_vf - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: Re_avg_rsz_vf + real(wp), allocatable, dimension(:, :, :, :) :: Re_avg_rsx_vf + real(wp), allocatable, dimension(:, :, :, :) :: Re_avg_rsy_vf + real(wp), allocatable, dimension(:, :, :, :) :: Re_avg_rsz_vf !$acc declare create(Re_avg_rsx_vf, Re_avg_rsy_vf, Re_avg_rsz_vf) !> @name Indical bounds in the s1-, s2- and s3-directions @@ -101,10 +104,10 @@ module m_riemann_solvers !$acc declare create(is1, is2, is3, isx, isy, isz) - real(kind(0d0)), allocatable, dimension(:) :: Gs + real(wp), allocatable, dimension(:) :: Gs !$acc declare create(Gs) - real(kind(0d0)), allocatable, dimension(:, :) :: Res + real(wp), allocatable, dimension(:, :) :: Res !$acc declare create(Res) contains @@ -153,7 +156,7 @@ contains flux_gsrc_vf, & norm_dir, ix, iy, iz) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(INOUT) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf + real(wp), dimension(startx:, starty:, startz:, 1:), intent(INOUT) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf type(scalar_field), dimension(sys_size), intent(IN) :: q_prim_vf type(scalar_field), allocatable, dimension(:), intent(INOUT) :: qL_prim_vf, qR_prim_vf @@ -274,7 +277,7 @@ contains flux_gsrc_vf, & norm_dir, ix, iy, iz) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf type(scalar_field), allocatable, dimension(:), intent(inout) :: qL_prim_vf, qR_prim_vf @@ -293,44 +296,44 @@ contains integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R - real(kind(0d0)) :: rho_L, rho_R - real(kind(0d0)), dimension(num_dims) :: vel_L, vel_R - real(kind(0d0)) :: pres_L, pres_R - real(kind(0d0)) :: E_L, E_R - real(kind(0d0)) :: H_L, H_R - real(kind(0d0)), dimension(num_fluids) :: alpha_L, alpha_R - real(kind(0d0)), dimension(num_species) :: Ys_L, Ys_R - real(kind(0d0)), dimension(num_species) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR - real(kind(0d0)), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 - real(kind(0d0)) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi - real(kind(0d0)) :: T_L, T_R - real(kind(0d0)) :: Y_L, Y_R - real(kind(0d0)) :: MW_L, MW_R - real(kind(0d0)) :: R_gas_L, R_gas_R - real(kind(0d0)) :: Cp_L, Cp_R - real(kind(0d0)) :: Cv_L, Cv_R - real(kind(0d0)) :: Gamm_L, Gamm_R - real(kind(0d0)) :: gamma_L, gamma_R - real(kind(0d0)) :: pi_inf_L, pi_inf_R - real(kind(0d0)) :: qv_L, qv_R - real(kind(0d0)) :: c_L, c_R - real(kind(0d0)), dimension(6) :: tau_e_L, tau_e_R - real(kind(0d0)) :: G_L, G_R - real(kind(0d0)), dimension(2) :: Re_L, Re_R - - real(kind(0d0)) :: rho_avg - real(kind(0d0)) :: H_avg - real(kind(0d0)) :: gamma_avg - real(kind(0d0)) :: c_avg - - real(kind(0d0)) :: s_L, s_R, s_M, s_P, s_S - real(kind(0d0)) :: xi_M, xi_P - - real(kind(0d0)) :: ptilde_L, ptilde_R - real(kind(0d0)) :: vel_L_rms, vel_R_rms, vel_avg_rms - real(kind(0d0)) :: Ms_L, Ms_R, pres_SL, pres_SR - real(kind(0d0)) :: alpha_L_sum, alpha_R_sum + real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R + real(wp) :: rho_L, rho_R + real(wp), dimension(num_dims) :: vel_L, vel_R + real(wp) :: pres_L, pres_R + real(wp) :: E_L, E_R + real(wp) :: H_L, H_R + real(wp), dimension(num_fluids) :: alpha_L, alpha_R + real(wp), dimension(num_species) :: Ys_L, Ys_R + real(wp), dimension(num_species) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR + real(wp), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 + real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi + real(wp) :: T_L, T_R + real(wp) :: Y_L, Y_R + real(wp) :: MW_L, MW_R + real(wp) :: R_gas_L, R_gas_R + real(wp) :: Cp_L, Cp_R + real(wp) :: Cv_L, Cv_R + real(wp) :: Gamm_L, Gamm_R + real(wp) :: gamma_L, gamma_R + real(wp) :: pi_inf_L, pi_inf_R + real(wp) :: qv_L, qv_R + real(wp) :: c_L, c_R + real(wp), dimension(6) :: tau_e_L, tau_e_R + real(wp) :: G_L, G_R + real(wp), dimension(2) :: Re_L, Re_R + + real(wp) :: rho_avg + real(wp) :: H_avg + real(wp) :: gamma_avg + real(wp) :: c_avg + + real(wp) :: s_L, s_R, s_M, s_P, s_S + real(wp) :: xi_M, xi_P + + real(wp) :: ptilde_L, ptilde_R + real(wp) :: vel_L_rms, vel_R_rms, vel_avg_rms + real(wp) :: Ms_L, Ms_R, pres_SL, pres_SR + real(wp) :: alpha_L_sum, alpha_R_sum integer :: i, j, k, l, q !< Generic loop iterators @@ -377,12 +380,12 @@ contains vel_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, contxe + i) end do - vel_L_rms = 0d0; vel_R_rms = 0d0 + vel_L_rms = 0._wp; vel_R_rms = 0._wp !$acc loop seq do i = 1, num_dims - vel_L_rms = vel_L_rms + vel_L(i)**2d0 - vel_R_rms = vel_R_rms + vel_R(i)**2d0 + vel_L_rms = vel_L_rms + vel_L(i)**2._wp + vel_R_rms = vel_R_rms + vel_R(i)**2._wp end do !$acc loop seq @@ -394,24 +397,24 @@ contains pres_L = qL_prim_rs${XYZ}$_vf(j, k, l, E_idx) pres_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx) - rho_L = 0d0 - gamma_L = 0d0 - pi_inf_L = 0d0 - qv_L = 0d0 + rho_L = 0._wp + gamma_L = 0._wp + pi_inf_L = 0._wp + qv_L = 0._wp - rho_R = 0d0 - gamma_R = 0d0 - pi_inf_R = 0d0 - qv_R = 0d0 + rho_R = 0._wp + gamma_R = 0._wp + pi_inf_R = 0._wp + qv_R = 0._wp - alpha_L_sum = 0d0 - alpha_R_sum = 0d0 + alpha_L_sum = 0._wp + alpha_R_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho_L(i) = max(0d0, alpha_rho_L(i)) - alpha_L(i) = min(max(0d0, alpha_L(i)), 1d0) + alpha_rho_L(i) = max(0._wp, alpha_rho_L(i)) + alpha_L(i) = min(max(0._wp, alpha_L(i)), 1._wp) alpha_L_sum = alpha_L_sum + alpha_L(i) end do @@ -419,8 +422,8 @@ contains !$acc loop seq do i = 1, num_fluids - alpha_rho_R(i) = max(0d0, alpha_rho_R(i)) - alpha_R(i) = min(max(0d0, alpha_R(i)), 1d0) + alpha_rho_R(i) = max(0._wp, alpha_rho_R(i)) + alpha_R(i) = min(max(0._wp, alpha_R(i)), 1._wp) alpha_R_sum = alpha_R_sum + alpha_R(i) end do @@ -445,7 +448,7 @@ contains do i = 1, 2 Re_L(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0d0 + if (Re_size(i) > 0) Re_L(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -453,7 +456,7 @@ contains + Re_L(i) end do - Re_L(i) = 1d0/max(Re_L(i), sgm_eps) + Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) end do @@ -461,7 +464,7 @@ contains do i = 1, 2 Re_R(i) = dflt_real - if (Re_size(i) > 0) Re_R(i) = 0d0 + if (Re_size(i) > 0) Re_R(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -469,7 +472,7 @@ contains + Re_R(i) end do - Re_R(i) = 1d0/max(Re_R(i), sgm_eps) + Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) end do end if @@ -497,11 +500,11 @@ contains if (chem_params%gamma_method == 1) then ! gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. - Gamma_iL = Cp_iL/(Cp_iL - 1.0d0) - Gamma_iR = Cp_iR/(Cp_iR - 1.0d0) + Gamma_iL = Cp_iL/(Cp_iL - 1.0_wp) + Gamma_iR = Cp_iR/(Cp_iR - 1.0_wp) - gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0d0)) - gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0d0)) + gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) + gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) else if (chem_params%gamma_method == 2) then ! gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) @@ -510,21 +513,21 @@ contains call get_mixture_specific_heat_cv_mass(T_R, Ys_R, Cv_R) Gamm_L = Cp_L/Cv_L - gamma_L = 1.0d0/(Gamm_L - 1.0d0) + gamma_L = 1.0_wp/(Gamm_L - 1.0_wp) Gamm_R = Cp_R/Cv_R - gamma_R = 1.0d0/(Gamm_R - 1.0d0) + gamma_R = 1.0_wp/(Gamm_R - 1.0_wp) end if call get_mixture_energy_mass(T_L, Ys_L, E_L) call get_mixture_energy_mass(T_R, Ys_R, E_R) - E_L = rho_L*E_L + 5d-1*rho_L*vel_L_rms - E_R = rho_R*E_R + 5d-1*rho_R*vel_R_rms + E_L = rho_L*E_L + 5e-1*rho_L*vel_L_rms + E_R = rho_R*E_R + 5e-1*rho_R*vel_R_rms H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R else - E_L = gamma_L*pres_L + pi_inf_L + 5d-1*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5d-1*rho_R*vel_R_rms + qv_R + E_L = gamma_L*pres_L + pi_inf_L + 5e-1*rho_L*vel_L_rms + qv_L + E_R = gamma_R*pres_R + pi_inf_R + 5e-1*rho_R*vel_R_rms + qv_R H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R end if @@ -536,8 +539,8 @@ contains tau_e_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, strxb - 1 + i) end do - G_L = 0d0 - G_R = 0d0 + G_L = 0._wp + G_R = 0._wp !$acc loop seq do i = 1, num_fluids @@ -549,12 +552,12 @@ contains ! Elastic contribution to energy if G large enough !TODO take out if statement if stable without if ((G_L > 1000) .and. (G_R > 1000)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4d0*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4d0*G_R) + E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) + E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) ! Additional terms in 2D and 3D if ((i == 2) .or. (i == 4) .or. (i == 5)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4d0*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4d0*G_R) + E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) + E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) end if end if end do @@ -563,10 +566,10 @@ contains @:compute_average_state() call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, & - vel_L_rms, 0d0, c_L) + vel_L_rms, 0._wp, c_L) call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, & - vel_R_rms, 0d0, c_R) + vel_R_rms, 0._wp, c_R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. @@ -577,23 +580,23 @@ contains if (viscous) then !$acc loop seq do i = 1, 2 - Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2d0/(1d0/Re_L(i) + 1d0/Re_R(i)) + Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) end do end if if (wave_speeds == 1) then if (hypoelasticity) then s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + & - (((4d0*G_L)/3d0) + & + (((4._wp*G_L)/3._wp) + & tau_e_L(dir_idx_tau(1)))/rho_L) & , vel_R(dir_idx(1)) - sqrt(c_R*c_R + & - (((4d0*G_R)/3d0) + & + (((4._wp*G_R)/3._wp) + & tau_e_R(dir_idx_tau(1)))/rho_R)) s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + & - (((4d0*G_R)/3d0) + & + (((4._wp*G_R)/3._wp) + & tau_e_R(dir_idx_tau(1)))/rho_R) & , vel_L(dir_idx(1)) + sqrt(c_L*c_L + & - (((4d0*G_L)/3d0) + & + (((4._wp*G_L)/3._wp) + & tau_e_L(dir_idx_tau(1)))/rho_L)) else s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) @@ -607,35 +610,35 @@ contains /(rho_L*(s_L - vel_L(dir_idx(1))) - & rho_R*(s_R - vel_R(dir_idx(1)))) elseif (wave_speeds == 2) then - pres_SL = 5d-1*(pres_L + pres_R + rho_avg*c_avg* & - (vel_L(dir_idx(1)) - & - vel_R(dir_idx(1)))) + pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* & + (vel_L(dir_idx(1)) - & + vel_R(dir_idx(1)))) pres_SR = pres_SL - Ms_L = max(1d0, sqrt(1d0 + ((5d-1 + gamma_L)/(1d0 + gamma_L))* & - (pres_SL/pres_L - 1d0)*pres_L/ & - ((pres_L + pi_inf_L/(1d0 + gamma_L))))) - Ms_R = max(1d0, sqrt(1d0 + ((5d-1 + gamma_R)/(1d0 + gamma_R))* & - (pres_SR/pres_R - 1d0)*pres_R/ & - ((pres_R + pi_inf_R/(1d0 + gamma_R))))) + Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* & + (pres_SL/pres_L - 1._wp)*pres_L/ & + ((pres_L + pi_inf_L/(1._wp + gamma_L))))) + Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* & + (pres_SR/pres_R - 1._wp)*pres_R/ & + ((pres_R + pi_inf_R/(1._wp + gamma_R))))) s_L = vel_L(dir_idx(1)) - c_L*Ms_L s_R = vel_R(dir_idx(1)) + c_R*Ms_R - s_S = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & - (pres_L - pres_R)/ & - (rho_avg*c_avg)) + s_S = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & + (pres_L - pres_R)/ & + (rho_avg*c_avg)) end if - s_M = min(0d0, s_L); s_P = max(0d0, s_R) + s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) - xi_M = (5d-1 + sign(5d-1, s_L)) & - + (5d-1 - sign(5d-1, s_L)) & - *(5d-1 + sign(5d-1, s_R)) - xi_P = (5d-1 - sign(5d-1, s_R)) & - + (5d-1 - sign(5d-1, s_L)) & - *(5d-1 + sign(5d-1, s_R)) + xi_M = (5e-1_wp + sign(5e-1_wp, s_L)) & + + (5e-1_wp - sign(5e-1_wp, s_L)) & + *(5e-1_wp + sign(5e-1_wp, s_R)) + xi_P = (5e-1_wp - sign(5e-1_wp, s_R)) & + + (5e-1_wp - sign(5e-1_wp, s_L)) & + *(5e-1_wp + sign(5e-1_wp, s_R)) ! Mass !$acc loop seq @@ -787,7 +790,7 @@ contains if (bubbles) then ! From HLLC: Kills mass transport @ bubble gas density if (num_fluids > 1) then - flux_rs${XYZ}$_vf(j, k, l, contxe) = 0d0 + flux_rs${XYZ}$_vf(j, k, l, contxe) = 0._wp end if end if @@ -801,7 +804,7 @@ contains - s_P*Y_L*rho_L*vel_L(dir_idx(1)) & + s_M*s_P*(Y_L*rho_L - Y_R*rho_R)) & /(s_M - s_P) - flux_src_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_src_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do end if end do @@ -888,7 +891,7 @@ contains flux_gsrc_vf, & norm_dir, ix, iy, iz) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf type(scalar_field), allocatable, dimension(:), intent(inout) :: qL_prim_vf, qR_prim_vf @@ -907,56 +910,57 @@ contains integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz - real(kind(0d0)), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R - real(kind(0d0)) :: rho_L, rho_R - real(kind(0d0)), dimension(num_dims) :: vel_L, vel_R - real(kind(0d0)) :: pres_L, pres_R - real(kind(0d0)) :: E_L, E_R - real(kind(0d0)) :: H_L, H_R - real(kind(0d0)), dimension(num_fluids) :: alpha_L, alpha_R - real(kind(0d0)), dimension(num_species) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR - real(kind(0d0)), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 - real(kind(0d0)) :: Cp_avg, Cv_avg, T_avg, c_sum_Yi_Phi, eps - real(kind(0d0)) :: T_L, T_R - real(kind(0d0)) :: MW_L, MW_R - real(kind(0d0)) :: R_gas_L, R_gas_R - real(kind(0d0)) :: Cp_L, Cp_R - real(kind(0d0)) :: Cv_L, Cv_R - real(kind(0d0)) :: Gamm_L, Gamm_R - real(kind(0d0)) :: Y_L, Y_R - real(kind(0d0)) :: gamma_L, gamma_R - real(kind(0d0)) :: pi_inf_L, pi_inf_R - real(kind(0d0)) :: qv_L, qv_R - real(kind(0d0)) :: c_L, c_R - real(kind(0d0)), dimension(2) :: Re_L, Re_R - - real(kind(0d0)) :: rho_avg - real(kind(0d0)) :: H_avg - real(kind(0d0)) :: gamma_avg - real(kind(0d0)) :: c_avg - - real(kind(0d0)) :: s_L, s_R, s_M, s_P, s_S - real(kind(0d0)) :: xi_L, xi_R !< Left and right wave speeds functions - real(kind(0d0)) :: xi_M, xi_P - - real(kind(0d0)) :: nbub_L, nbub_R - real(kind(0d0)), dimension(nb) :: R0_L, R0_R - real(kind(0d0)), dimension(nb) :: V0_L, V0_R - real(kind(0d0)), dimension(nb) :: P0_L, P0_R - real(kind(0d0)), dimension(nb) :: pbw_L, pbw_R - real(kind(0d0)) :: ptilde_L, ptilde_R - - real(kind(0d0)) :: alpha_L_sum, alpha_R_sum, nbub_L_denom, nbub_R_denom - - real(kind(0d0)) :: PbwR3Lbar, Pbwr3Rbar - real(kind(0d0)) :: R3Lbar, R3Rbar - real(kind(0d0)) :: R3V2Lbar, R3V2Rbar - - real(kind(0d0)) :: vel_L_rms, vel_R_rms, vel_avg_rms - real(kind(0d0)) :: vel_L_tmp, vel_R_tmp - real(kind(0d0)) :: rho_Star, E_Star, p_Star, p_K_Star - real(kind(0d0)) :: pres_SL, pres_SR, Ms_L, Ms_R - real(kind(0d0)) :: zcoef, pcorr !< low Mach number correction + real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R + real(wp) :: rho_L, rho_R + real(wp), dimension(num_dims) :: vel_L, vel_R + real(wp) :: pres_L, pres_R + real(wp) :: E_L, E_R + real(wp) :: H_L, H_R + real(wp), dimension(num_fluids) :: alpha_L, alpha_R + real(wp), dimension(num_species) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR + real(wp), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 + real(wp) :: Cp_avg, Cv_avg, T_avg, c_sum_Yi_Phi, eps + real(wp) :: T_L, T_R + real(wp) :: MW_L, MW_R + real(wp) :: R_gas_L, R_gas_R + real(wp) :: Cp_L, Cp_R + real(wp) :: Cv_L, Cv_R + real(wp) :: Gamm_L, Gamm_R + real(wp) :: Y_L, Y_R + real(wp) :: gamma_L, gamma_R + real(wp) :: pi_inf_L, pi_inf_R + real(wp) :: qv_L, qv_R + real(wp) :: c_L, c_R + real(wp), dimension(2) :: Re_L, Re_R + + real(wp) :: rho_avg + real(wp) :: H_avg + real(wp) :: gamma_avg + real(wp) :: c_avg + + real(wp) :: s_L, s_R, s_M, s_P, s_S + real(wp) :: xi_L, xi_R !< Left and right wave speeds functions + real(wp) :: xi_M, xi_P + + real(wp) :: nbub_L, nbub_R + real(wp), dimension(nb) :: R0_L, R0_R + real(wp), dimension(nb) :: V0_L, V0_R + real(wp), dimension(nb) :: P0_L, P0_R + real(wp), dimension(nb) :: pbw_L, pbw_R + real(wp) :: ptilde_L, ptilde_R + + real(wp) :: alpha_L_sum, alpha_R_sum, nbub_L_denom, nbub_R_denom + + real(wp) :: PbwR3Lbar, Pbwr3Rbar + real(wp) :: R3Lbar, R3Rbar + real(wp) :: R3V2Lbar, R3V2Rbar + + real(wp) :: vel_L_rms, vel_R_rms, vel_avg_rms + real(wp) :: vel_L_tmp, vel_R_tmp + real(wp) :: rho_Star, E_Star, p_Star, p_K_Star + real(wp) :: pres_SL, pres_SR, Ms_L, Ms_R + real(wp) :: zcoef, pcorr !< low Mach number correction + integer :: i, j, k, l, q !< Generic loop iterators integer :: idx1, idxi @@ -997,37 +1001,37 @@ contains do k = is2%beg, is2%end do j = is1%beg, is1%end - vel_L_rms = 0d0; vel_R_rms = 0d0 + vel_L_rms = 0._wp; vel_R_rms = 0._wp !$acc loop seq do i = 1, num_dims vel_L(i) = qL_prim_rs${XYZ}$_vf(j, k, l, contxe + i) vel_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, contxe + i) - vel_L_rms = vel_L_rms + vel_L(i)**2d0 - vel_R_rms = vel_R_rms + vel_R(i)**2d0 + vel_L_rms = vel_L_rms + vel_L(i)**2._wp + vel_R_rms = vel_R_rms + vel_R(i)**2._wp end do pres_L = qL_prim_rs${XYZ}$_vf(j, k, l, E_idx) pres_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx) - rho_L = 0d0 - gamma_L = 0d0 - pi_inf_L = 0d0 - qv_L = 0d0 + rho_L = 0._wp + gamma_L = 0._wp + pi_inf_L = 0._wp + qv_L = 0._wp - rho_R = 0d0 - gamma_R = 0d0 - pi_inf_R = 0d0 - qv_R = 0d0 + rho_R = 0._wp + gamma_R = 0._wp + pi_inf_R = 0._wp + qv_R = 0._wp - alpha_L_sum = 0d0 - alpha_R_sum = 0d0 + alpha_L_sum = 0._wp + alpha_R_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - qL_prim_rs${XYZ}$_vf(j, k, l, i) = max(0d0, qL_prim_rs${XYZ}$_vf(j, k, l, i)) - qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) = min(max(0d0, qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i)), 1d0) + qL_prim_rs${XYZ}$_vf(j, k, l, i) = max(0._wp, qL_prim_rs${XYZ}$_vf(j, k, l, i)) + qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) = min(max(0._wp, qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i)), 1._wp) alpha_L_sum = alpha_L_sum + qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) end do @@ -1038,8 +1042,8 @@ contains !$acc loop seq do i = 1, num_fluids - qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) = max(0d0, qR_prim_rs${XYZ}$_vf(j + 1, k, l, i)) - qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) = min(max(0d0, qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i)), 1d0) + qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) = max(0._wp, qR_prim_rs${XYZ}$_vf(j + 1, k, l, i)) + qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) = min(max(0._wp, qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i)), 1._wp) alpha_R_sum = alpha_R_sum + qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) end do @@ -1070,7 +1074,7 @@ contains do i = 1, 2 Re_L(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0d0 + if (Re_size(i) > 0) Re_L(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -1078,7 +1082,7 @@ contains + Re_L(i) end do - Re_L(i) = 1d0/max(Re_L(i), sgm_eps) + Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) end do @@ -1086,7 +1090,7 @@ contains do i = 1, 2 Re_R(i) = dflt_real - if (Re_size(i) > 0) Re_R(i) = 0d0 + if (Re_size(i) > 0) Re_R(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -1094,13 +1098,13 @@ contains + Re_R(i) end do - Re_R(i) = 1d0/max(Re_R(i), sgm_eps) + Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) end do end if - E_L = gamma_L*pres_L + pi_inf_L + 5d-1*rho_L*vel_L_rms + qv_L + E_L = gamma_L*pres_L + pi_inf_L + 5e-1_wp*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5d-1*rho_R*vel_R_rms + qv_R + E_R = gamma_R*pres_R + pi_inf_R + 5e-1_wp*rho_R*vel_R_rms + qv_R H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R @@ -1108,21 +1112,21 @@ contains @:compute_average_state() call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, & - vel_L_rms, 0d0, c_L) + vel_L_rms, 0._wp, c_L) call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, & - vel_R_rms, 0d0, c_R) + vel_R_rms, 0._wp, c_R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, & - vel_avg_rms, 0d0, c_avg) + vel_avg_rms, 0._wp, c_avg) if (viscous) then !$acc loop seq do i = 1, 2 - Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2d0/(1d0/Re_L(i) + 1d0/Re_R(i)) + Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) end do end if @@ -1137,28 +1141,28 @@ contains /(rho_L*(s_L - vel_L(dir_idx(1))) - & rho_R*(s_R - vel_R(dir_idx(1)))) elseif (wave_speeds == 2) then - pres_SL = 5d-1*(pres_L + pres_R + rho_avg*c_avg* & - (vel_L(dir_idx(1)) - & - vel_R(dir_idx(1)))) + pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* & + (vel_L(dir_idx(1)) - & + vel_R(dir_idx(1)))) pres_SR = pres_SL - Ms_L = max(1d0, sqrt(1d0 + ((5d-1 + gamma_L)/(1d0 + gamma_L))* & - (pres_SL/pres_L - 1d0)*pres_L/ & - ((pres_L + pi_inf_L/(1d0 + gamma_L))))) - Ms_R = max(1d0, sqrt(1d0 + ((5d-1 + gamma_R)/(1d0 + gamma_R))* & - (pres_SR/pres_R - 1d0)*pres_R/ & - ((pres_R + pi_inf_R/(1d0 + gamma_R))))) + Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* & + (pres_SL/pres_L - 1._wp)*pres_L/ & + ((pres_L + pi_inf_L/(1._wp + gamma_L))))) + Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* & + (pres_SR/pres_R - 1._wp)*pres_R/ & + ((pres_R + pi_inf_R/(1._wp + gamma_R))))) s_L = vel_L(dir_idx(1)) - c_L*Ms_L s_R = vel_R(dir_idx(1)) + c_R*Ms_R - s_S = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & - (pres_L - pres_R)/ & - (rho_avg*c_avg)) + s_S = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & + (pres_L - pres_R)/ & + (rho_avg*c_avg)) end if - if (s_L >= 0d0) then + if (s_L >= 0._wp) then p_Star = pres_L ! Only useful to recalculate the radial momentum geometric source flux !$acc loop seq do i = 1, num_fluids @@ -1191,7 +1195,7 @@ contains end if ! Compute right solution state - else if (s_R <= 0d0) then + else if (s_R <= 0._wp) then p_Star = pres_R ! Only useful to recalculate the radial momentum geometric source flux !$acc loop seq @@ -1225,7 +1229,7 @@ contains end if ! Compute left star solution state - else if (s_S >= 0d0) then + else if (s_S >= 0._wp) then xi_L = (s_L - vel_L(dir_idx(1)))/(s_L - s_S) rho_Star = rho_L*xi_L E_Star = xi_L*(E_L + (s_S - vel_L(dir_idx(1)))* & @@ -1233,8 +1237,8 @@ contains p_Star = rho_L*(s_L - vel_L(dir_idx(1)))*(s_S - vel_L(dir_idx(1))) + pres_L !$acc loop seq do i = 1, num_fluids - p_K_Star = (pres_L + pi_infs(i)/(1d0 + gammas(i)))* & - xi_L**(1d0/gammas(i) + 1d0) - pi_infs(i)/(1d0 + gammas(i)) + p_K_Star = (pres_L + pi_infs(i)/(1._wp + gammas(i)))* & + xi_L**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) flux_rs${XYZ}$_vf(j, k, l, i + advxb - 1) = & qL_prim_rs${XYZ}$_vf(j, k, l, i + advxb - 1)*s_S @@ -1252,7 +1256,7 @@ contains do i = 1, num_dims flux_rs${XYZ}$_vf(j, k, l, momxb - 1 + dir_idx(i)) = & rho_Star*s_S*(s_S*dir_flg(dir_idx(i)) + vel_L(dir_idx(i))* & - (1d0 - dir_flg(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star + (1._wp - dir_flg(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(i)) = vel_L(dir_idx(i)) + & dir_flg(dir_idx(i))*(s_S*xi_L - vel_L(dir_idx(i))) @@ -1277,8 +1281,8 @@ contains p_Star = rho_R*(s_R - vel_R(dir_idx(1)))*(s_S - vel_R(dir_idx(1))) + pres_R !$acc loop seq do i = 1, num_fluids - p_K_Star = (pres_R + pi_infs(i)/(1d0 + gammas(i)))* & - xi_R**(1d0/gammas(i) + 1d0) - pi_infs(i)/(1d0 + gammas(i)) + p_K_Star = (pres_R + pi_infs(i)/(1._wp + gammas(i)))* & + xi_R**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) flux_rs${XYZ}$_vf(j, k, l, i + advxb - 1) = & qR_prim_rs${XYZ}$_vf(j + 1, k, l, i + advxb - 1)*s_S @@ -1295,7 +1299,7 @@ contains !$acc loop seq do i = 1, num_dims flux_rs${XYZ}$_vf(j, k, l, momxb - 1 + dir_idx(i)) = rho_Star*s_S* & - (s_S*dir_flg(dir_idx(i)) + vel_R(dir_idx(i))*(1d0 - dir_flg(dir_idx(i)))) + & + (s_S*dir_flg(dir_idx(i)) + vel_R(dir_idx(i))*(1._wp - dir_flg(dir_idx(i)))) + & dir_flg(dir_idx(i))*p_Star vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(i)) = vel_R(dir_idx(i)) + & @@ -1331,7 +1335,7 @@ contains ! Geometrical source of the void fraction(s) is zero !$acc loop seq do i = advxb, advxe - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do end if @@ -1357,11 +1361,11 @@ contains vel_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, contxe + i) end do - vel_L_rms = 0d0; vel_R_rms = 0d0 + vel_L_rms = 0._wp; vel_R_rms = 0._wp !$acc loop seq do i = 1, num_dims - vel_L_rms = vel_L_rms + vel_L(i)**2d0 - vel_R_rms = vel_R_rms + vel_R(i)**2d0 + vel_L_rms = vel_L_rms + vel_L(i)**2._wp + vel_R_rms = vel_R_rms + vel_R(i)**2._wp end do !$acc loop seq @@ -1373,10 +1377,10 @@ contains pres_L = qL_prim_rs${XYZ}$_vf(j, k, l, E_idx) pres_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx) - rho_L = 0d0 - gamma_L = 0d0 - pi_inf_L = 0d0 - qv_L = 0d0 + rho_L = 0._wp + gamma_L = 0._wp + pi_inf_L = 0._wp + qv_L = 0._wp !$acc loop seq do i = 1, num_fluids rho_L = rho_L + alpha_rho_L(i) @@ -1385,10 +1389,10 @@ contains qv_L = qv_L + alpha_rho_L(i)*qvs(i) end do - rho_R = 0d0 - gamma_R = 0d0 - pi_inf_R = 0d0 - qv_R = 0d0 + rho_R = 0._wp + gamma_R = 0._wp + pi_inf_R = 0._wp + qv_R = 0._wp !$acc loop seq do i = 1, num_fluids rho_R = rho_R + alpha_rho_R(i) @@ -1397,9 +1401,9 @@ contains qv_R = qv_R + alpha_rho_R(i)*qvs(i) end do - E_L = gamma_L*pres_L + pi_inf_L + 5d-1*rho_L*vel_L_rms + qv_L + E_L = gamma_L*pres_L + pi_inf_L + 5e-1_wp*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5d-1*rho_R*vel_R_rms + qv_R + E_R = gamma_R*pres_R + pi_inf_R + 5e-1_wp*rho_R*vel_R_rms + qv_R H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R @@ -1407,16 +1411,16 @@ contains @:compute_average_state() call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, & - vel_L_rms, 0d0, c_L) + vel_L_rms, 0._wp, c_L) call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, & - vel_R_rms, 0d0, c_R) + vel_R_rms, 0._wp, c_R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, & - vel_avg_rms, 0d0, c_avg) + vel_avg_rms, 0._wp, c_avg) if (wave_speeds == 1) then s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) @@ -1429,30 +1433,30 @@ contains /(rho_L*(s_L - vel_L(dir_idx(1))) - & rho_R*(s_R - vel_R(dir_idx(1)))) elseif (wave_speeds == 2) then - pres_SL = 5d-1*(pres_L + pres_R + rho_avg*c_avg* & - (vel_L(dir_idx(1)) - & - vel_R(dir_idx(1)))) + pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* & + (vel_L(dir_idx(1)) - & + vel_R(dir_idx(1)))) pres_SR = pres_SL - Ms_L = max(1d0, sqrt(1d0 + ((5d-1 + gamma_L)/(1d0 + gamma_L))* & - (pres_SL/pres_L - 1d0)*pres_L/ & - ((pres_L + pi_inf_L/(1d0 + gamma_L))))) - Ms_R = max(1d0, sqrt(1d0 + ((5d-1 + gamma_R)/(1d0 + gamma_R))* & - (pres_SR/pres_R - 1d0)*pres_R/ & - ((pres_R + pi_inf_R/(1d0 + gamma_R))))) + Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* & + (pres_SL/pres_L - 1._wp)*pres_L/ & + ((pres_L + pi_inf_L/(1._wp + gamma_L))))) + Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* & + (pres_SR/pres_R - 1._wp)*pres_R/ & + ((pres_R + pi_inf_R/(1._wp + gamma_R))))) s_L = vel_L(dir_idx(1)) - c_L*Ms_L s_R = vel_R(dir_idx(1)) + c_R*Ms_R - s_S = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & - (pres_L - pres_R)/ & - (rho_avg*c_avg)) + s_S = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & + (pres_L - pres_R)/ & + (rho_avg*c_avg)) end if ! follows Einfeldt et al. ! s_M/P = min/max(0.,s_L/R) - s_M = min(0d0, s_L); s_P = max(0d0, s_R) + s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) ! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) @@ -1461,16 +1465,16 @@ contains ! goes with numerical velocity in x/y/z directions ! xi_P/M = 0.5 +/m sgn(0.5,s_star) - xi_M = (5d-1 + sign(5d-1, s_S)) - xi_P = (5d-1 - sign(5d-1, s_S)) + xi_M = (5e-1_wp + sign(5e-1_wp, s_S)) + xi_P = (5e-1_wp - sign(5e-1_wp, s_S)) !$acc loop seq do i = 1, contxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*alpha_rho_L(i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*alpha_rho_R(i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do ! Momentum flux. @@ -1481,13 +1485,13 @@ contains xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(i)) + & s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + & - (1d0 - dir_flg(dir_idx(i)))* & + (1._wp - dir_flg(dir_idx(i)))* & vel_L(dir_idx(i))) - vel_L(dir_idx(i)))) + & dir_flg(dir_idx(i))*pres_L) & + xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(i)) + & s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + & - (1d0 - dir_flg(dir_idx(i)))* & + (1._wp - dir_flg(dir_idx(i)))* & vel_R(dir_idx(i))) - vel_R(dir_idx(i)))) + & dir_flg(dir_idx(i))*pres_R) end do @@ -1498,28 +1502,28 @@ contains do i = 1, num_dims flux_rs${XYZ}$_vf(j, k, l, contxe + dir_idx(i)) = & flux_rs${XYZ}$_vf(j, k, l, contxe + dir_idx(i)) + & - xi_M*(dir_flg(dir_idx(i))*(-1d0*ptilde_L)) & - + xi_P*(dir_flg(dir_idx(i))*(-1d0*ptilde_R)) + xi_M*(dir_flg(dir_idx(i))*(-1._wp*ptilde_L)) & + + xi_P*(dir_flg(dir_idx(i))*(-1._wp*ptilde_R)) end do end if - flux_rs${XYZ}$_vf(j, k, l, E_idx) = 0.d0 + flux_rs${XYZ}$_vf(j, k, l, E_idx) = 0._wp !$acc loop seq do i = alf_idx, alf_idx !only advect the void fraction flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do ! Source for volume fraction advection equation !$acc loop seq do i = 1, num_dims - vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(i)) = 0d0 - !IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0d0 + vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(i)) = 0._wp + !IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0._wp end do flux_src_rs${XYZ}$_vf(j, k, l, advxb) = vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(1)) @@ -1530,9 +1534,9 @@ contains do i = bubxb, bubxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*nbub_L*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*nbub_R*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do end if @@ -1550,17 +1554,17 @@ contains xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(1)) + & s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & + xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(1)) + & s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero !$acc loop seq do i = advxb, advxe - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do end if #:endif @@ -1568,18 +1572,18 @@ contains if (grid_geometry == 3) then !$acc loop seq do i = 1, sys_size - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do flux_gsrc_rs${XYZ}$_vf(j, k, l, momxb + 1) = & -xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(1)) + & s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(1)) + & s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) flux_gsrc_rs${XYZ}$_vf(j, k, l, momxe) = flux_rs${XYZ}$_vf(j, k, l, momxb + 1) end if @@ -1601,23 +1605,23 @@ contains alpha_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) end do - vel_L_rms = 0d0; vel_R_rms = 0d0 + vel_L_rms = 0._wp; vel_R_rms = 0._wp !$acc loop seq do i = 1, num_dims vel_L(i) = qL_prim_rs${XYZ}$_vf(j, k, l, contxe + i) vel_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, contxe + i) - vel_L_rms = vel_L_rms + vel_L(i)**2d0 - vel_R_rms = vel_R_rms + vel_R(i)**2d0 + vel_L_rms = vel_L_rms + vel_L(i)**2._wp + vel_R_rms = vel_R_rms + vel_R(i)**2._wp end do pres_L = qL_prim_rs${XYZ}$_vf(j, k, l, E_idx) pres_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx) - rho_L = 0d0 - gamma_L = 0d0 - pi_inf_L = 0d0 - qv_L = 0d0 + rho_L = 0._wp + gamma_L = 0._wp + pi_inf_L = 0._wp + qv_L = 0._wp ! Retain this in the refactor if (mpp_lim .and. (num_fluids > 2)) then @@ -1643,10 +1647,10 @@ contains qv_L = qvs(1) end if - rho_R = 0d0 - gamma_R = 0d0 - pi_inf_R = 0d0 - qv_R = 0d0 + rho_R = 0._wp + gamma_R = 0._wp + pi_inf_R = 0._wp + qv_R = 0._wp if (mpp_lim .and. (num_fluids > 2)) then !$acc loop seq @@ -1677,15 +1681,15 @@ contains do i = 1, 2 Re_L(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0d0 + if (Re_size(i) > 0) Re_L(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) - Re_L(i) = (1d0 - qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + Re_idx(i, q)))/Res(i, q) & + Re_L(i) = (1._wp - qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + Re_idx(i, q)))/Res(i, q) & + Re_L(i) end do - Re_L(i) = 1d0/max(Re_L(i), sgm_eps) + Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) end do @@ -1693,22 +1697,22 @@ contains do i = 1, 2 Re_R(i) = dflt_real - if (Re_size(i) > 0) Re_R(i) = 0d0 + if (Re_size(i) > 0) Re_R(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) - Re_R(i) = (1d0 - qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + Re_idx(i, q)))/Res(i, q) & + Re_R(i) = (1._wp - qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + Re_idx(i, q)))/Res(i, q) & + Re_R(i) end do - Re_R(i) = 1d0/max(Re_R(i), sgm_eps) + Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) end do end if end if - E_L = gamma_L*pres_L + pi_inf_L + 5d-1*rho_L*vel_L_rms + E_L = gamma_L*pres_L + pi_inf_L + 5e-1_wp*rho_L*vel_L_rms - E_R = gamma_R*pres_R + pi_inf_R + 5d-1*rho_R*vel_R_rms + E_R = gamma_R*pres_R + pi_inf_R + 5e-1_wp*rho_R*vel_R_rms H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R @@ -1731,15 +1735,15 @@ contains nbub_L = qL_prim_rs${XYZ}$_vf(j, k, l, n_idx) nbub_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, n_idx) else - nbub_L_denom = 0d0 - nbub_R_denom = 0d0 + nbub_L_denom = 0._wp + nbub_R_denom = 0._wp !$acc loop seq do i = 1, nb - nbub_L_denom = nbub_L_denom + (R0_L(i)**3d0)*weight(i) - nbub_R_denom = nbub_R_denom + (R0_R(i)**3d0)*weight(i) + nbub_L_denom = nbub_L_denom + (R0_L(i)**3._wp)*weight(i) + nbub_R_denom = nbub_R_denom + (R0_R(i)**3._wp)*weight(i) end do - nbub_L = (3.d0/(4.d0*pi))*qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + num_fluids)/nbub_L_denom - nbub_R = (3.d0/(4.d0*pi))*qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + num_fluids)/nbub_R_denom + nbub_L = (3._wp/(4._wp*pi))*qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + num_fluids)/nbub_L_denom + nbub_R = (3._wp/(4._wp*pi))*qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + num_fluids)/nbub_R_denom end if else !nb stored in 0th moment of first R0 bin in variable conversion module @@ -1751,8 +1755,8 @@ contains do i = 1, nb if (.not. qbmm) then if (polytropic) then - pbw_L(i) = f_cpbw_KM(R0(i), R0_L(i), V0_L(i), 0d0) - pbw_R(i) = f_cpbw_KM(R0(i), R0_R(i), V0_R(i), 0d0) + pbw_L(i) = f_cpbw_KM(R0(i), R0_L(i), V0_L(i), 0._wp) + pbw_R(i) = f_cpbw_KM(R0(i), R0_R(i), V0_R(i), 0._wp) else pbw_L(i) = f_cpbw_KM(R0(i), R0_L(i), V0_L(i), P0_L(i)) pbw_R(i) = f_cpbw_KM(R0(i), R0_R(i), V0_R(i), P0_R(i)) @@ -1771,25 +1775,25 @@ contains R3V2Rbar = mom_sp_rs${XYZ}$_vf(j + 1, k, l, 3) else - PbwR3Lbar = 0d0 - PbwR3Rbar = 0d0 + PbwR3Lbar = 0._wp + PbwR3Rbar = 0._wp - R3Lbar = 0d0 - R3Rbar = 0d0 + R3Lbar = 0._wp + R3Rbar = 0._wp - R3V2Lbar = 0d0 - R3V2Rbar = 0d0 + R3V2Lbar = 0._wp + R3V2Rbar = 0._wp !$acc loop seq do i = 1, nb - PbwR3Lbar = PbwR3Lbar + pbw_L(i)*(R0_L(i)**3.d0)*weight(i) - PbwR3Rbar = PbwR3Rbar + pbw_R(i)*(R0_R(i)**3.d0)*weight(i) + PbwR3Lbar = PbwR3Lbar + pbw_L(i)*(R0_L(i)**3._wp)*weight(i) + PbwR3Rbar = PbwR3Rbar + pbw_R(i)*(R0_R(i)**3._wp)*weight(i) - R3Lbar = R3Lbar + (R0_L(i)**3.d0)*weight(i) - R3Rbar = R3Rbar + (R0_R(i)**3.d0)*weight(i) + R3Lbar = R3Lbar + (R0_L(i)**3._wp)*weight(i) + R3Rbar = R3Rbar + (R0_R(i)**3._wp)*weight(i) - R3V2Lbar = R3V2Lbar + (R0_L(i)**3.d0)*(V0_L(i)**2.d0)*weight(i) - R3V2Rbar = R3V2Rbar + (R0_R(i)**3.d0)*(V0_R(i)**2.d0)*weight(i) + R3V2Lbar = R3V2Lbar + (R0_L(i)**3._wp)*(V0_L(i)**2._wp)*weight(i) + R3V2Rbar = R3V2Rbar + (R0_R(i)**3._wp)*(V0_R(i)**2._wp)*weight(i) end do end if @@ -1810,34 +1814,34 @@ contains if ((ptilde_L /= ptilde_L) .or. (ptilde_R /= ptilde_R)) then end if - rho_avg = 5d-1*(rho_L + rho_R) - H_avg = 5d-1*(H_L + H_R) - gamma_avg = 5d-1*(gamma_L + gamma_R) - vel_avg_rms = 0d0 + rho_avg = 5e-1_wp*(rho_L + rho_R) + H_avg = 5e-1_wp*(H_L + H_R) + gamma_avg = 5e-1_wp*(gamma_L + gamma_R) + vel_avg_rms = 0._wp !$acc loop seq do i = 1, num_dims - vel_avg_rms = vel_avg_rms + (5d-1*(vel_L(i) + vel_R(i)))**2d0 + vel_avg_rms = vel_avg_rms + (5e-1_wp*(vel_L(i) + vel_R(i)))**2._wp end do end if call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, & - vel_L_rms, 0d0, c_L) + vel_L_rms, 0._wp, c_L) call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, & - vel_R_rms, 0d0, c_R) + vel_R_rms, 0._wp, c_R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, & - vel_avg_rms, 0d0, c_avg) + vel_avg_rms, 0._wp, c_avg) if (viscous) then !$acc loop seq do i = 1, 2 - Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2d0/(1d0/Re_L(i) + 1d0/Re_R(i)) + Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) end do end if @@ -1856,30 +1860,30 @@ contains /(rho_L*(s_L - vel_L(dir_idx(1))) - & rho_R*(s_R - vel_R(dir_idx(1)))) elseif (wave_speeds == 2) then - pres_SL = 5d-1*(pres_L + pres_R + rho_avg*c_avg* & - (vel_L(dir_idx(1)) - & - vel_R(dir_idx(1)))) + pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* & + (vel_L(dir_idx(1)) - & + vel_R(dir_idx(1)))) pres_SR = pres_SL - Ms_L = max(1d0, sqrt(1d0 + ((5d-1 + gamma_L)/(1d0 + gamma_L))* & - (pres_SL/pres_L - 1d0)*pres_L/ & - ((pres_L + pi_inf_L/(1d0 + gamma_L))))) - Ms_R = max(1d0, sqrt(1d0 + ((5d-1 + gamma_R)/(1d0 + gamma_R))* & - (pres_SR/pres_R - 1d0)*pres_R/ & - ((pres_R + pi_inf_R/(1d0 + gamma_R))))) + Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* & + (pres_SL/pres_L - 1._wp)*pres_L/ & + ((pres_L + pi_inf_L/(1._wp + gamma_L))))) + Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* & + (pres_SR/pres_R - 1._wp)*pres_R/ & + ((pres_R + pi_inf_R/(1._wp + gamma_R))))) s_L = vel_L(dir_idx(1)) - c_L*Ms_L s_R = vel_R(dir_idx(1)) + c_R*Ms_R - s_S = 5d-1*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & - (pres_L - pres_R)/ & - (rho_avg*c_avg)) + s_S = 5e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + & + (pres_L - pres_R)/ & + (rho_avg*c_avg)) end if ! follows Einfeldt et al. ! s_M/P = min/max(0.,s_L/R) - s_M = min(0d0, s_L); s_P = max(0d0, s_R) + s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) ! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) @@ -1888,27 +1892,27 @@ contains ! goes with numerical velocity in x/y/z directions ! xi_P/M = 0.5 +/m sgn(0.5,s_star) - xi_M = (5d-1 + sign(5d-1, s_S)) - xi_P = (5d-1 - sign(5d-1, s_S)) + xi_M = (5e-1_wp + sign(5e-1_wp, s_S)) + xi_P = (5e-1_wp - sign(5e-1_wp, s_S)) if (low_Mach == 1) then @:compute_low_Mach_correction() else - pcorr = 0d0 + pcorr = 0._wp end if !$acc loop seq do i = 1, contxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do if (bubbles .and. (num_fluids > 1)) then ! Kill mass transport @ gas density - flux_rs${XYZ}$_vf(j, k, l, contxe) = 0.d0 + flux_rs${XYZ}$_vf(j, k, l, contxe) = 0._wp end if ! Momentum flux. @@ -1922,13 +1926,13 @@ contains xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(i)) + & s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + & - (1d0 - dir_flg(dir_idx(i)))* & + (1._wp - dir_flg(dir_idx(i)))* & vel_L(dir_idx(i))) - vel_L(dir_idx(i)))) + & dir_flg(dir_idx(i))*(pres_L - ptilde_L)) & + xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(i)) + & s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + & - (1d0 - dir_flg(dir_idx(i)))* & + (1._wp - dir_flg(dir_idx(i)))* & vel_R(dir_idx(i))) - vel_R(dir_idx(i)))) + & dir_flg(dir_idx(i))*(pres_R - ptilde_R)) & + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr @@ -1954,9 +1958,9 @@ contains do i = advxb, advxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do ! Source for volume fraction advection equation @@ -1965,12 +1969,12 @@ contains vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(i)) = & xi_M*(vel_L(dir_idx(i)) + & dir_flg(dir_idx(i))* & - s_M*(xi_L - 1d0)) & + s_M*(xi_L - 1._wp)) & + xi_P*(vel_R(dir_idx(i)) + & dir_flg(dir_idx(i))* & - s_P*(xi_R - 1d0)) + s_P*(xi_R - 1._wp)) - !IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(idxi)%sf(j,k,l) = 0d0 + !IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(idxi)%sf(j,k,l) = 0._wp end do flux_src_rs${XYZ}$_vf(j, k, l, advxb) = vel_src_rs${XYZ}$_vf(j, k, l, dir_idx(1)) @@ -1980,25 +1984,25 @@ contains do i = bubxb, bubxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*nbub_L*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*nbub_R*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end do if (qbmm) then flux_rs${XYZ}$_vf(j, k, l, bubxb) = & xi_M*nbub_L & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*nbub_R & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end if if (adv_n) then flux_rs${XYZ}$_vf(j, k, l, n_idx) = & xi_M*nbub_L & - *(vel_L(dir_idx(1)) + s_M*(xi_L - 1d0)) & + *(vel_L(dir_idx(1)) + s_M*(xi_L - 1._wp)) & + xi_P*nbub_R & - *(vel_R(dir_idx(1)) + s_P*(xi_R - 1d0)) + *(vel_R(dir_idx(1)) + s_P*(xi_R - 1._wp)) end if ! Geometrical source flux for cylindrical coordinates @@ -2014,17 +2018,17 @@ contains xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(1)) + & s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & + xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(1)) + & s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero !$acc loop seq do i = advxb, advxe - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do end if #:endif @@ -2032,19 +2036,19 @@ contains if (grid_geometry == 3) then !$acc loop seq do i = 1, sys_size - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do flux_gsrc_rs${XYZ}$_vf(j, k, l, momxb + 1) = & -xi_M*(rho_L*(vel_L(dir_idx(1))* & vel_L(dir_idx(1)) + & s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - xi_P*(rho_R*(vel_R(dir_idx(1))* & vel_R(dir_idx(1)) + & s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + & - (1d0 - dir_flg(dir_idx(1)))* & + (1._wp - dir_flg(dir_idx(1)))* & vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) flux_gsrc_rs${XYZ}$_vf(j, k, l, momxe) = flux_rs${XYZ}$_vf(j, k, l, momxb + 1) @@ -2071,38 +2075,38 @@ contains alpha_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) end do - vel_L_rms = 0d0; vel_R_rms = 0d0 + vel_L_rms = 0._wp; vel_R_rms = 0._wp !$acc loop seq do i = 1, num_dims vel_L(i) = qL_prim_rs${XYZ}$_vf(j, k, l, contxe + i) vel_R(i) = qR_prim_rs${XYZ}$_vf(j + 1, k, l, contxe + i) - vel_L_rms = vel_L_rms + vel_L(i)**2d0 - vel_R_rms = vel_R_rms + vel_R(i)**2d0 + vel_L_rms = vel_L_rms + vel_L(i)**2._wp + vel_R_rms = vel_R_rms + vel_R(i)**2._wp end do pres_L = qL_prim_rs${XYZ}$_vf(j, k, l, E_idx) pres_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx) - rho_L = 0d0 - gamma_L = 0d0 - pi_inf_L = 0d0 - qv_L = 0d0 + rho_L = 0._wp + gamma_L = 0._wp + pi_inf_L = 0._wp + qv_L = 0._wp - rho_R = 0d0 - gamma_R = 0d0 - pi_inf_R = 0d0 - qv_R = 0d0 + rho_R = 0._wp + gamma_R = 0._wp + pi_inf_R = 0._wp + qv_R = 0._wp - alpha_L_sum = 0d0 - alpha_R_sum = 0d0 + alpha_L_sum = 0._wp + alpha_R_sum = 0._wp ! Change this by splitting it into the cases ! present in the bubbles if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - qL_prim_rs${XYZ}$_vf(j, k, l, i) = max(0d0, qL_prim_rs${XYZ}$_vf(j, k, l, i)) - qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) = min(max(0d0, qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i)), 1d0) + qL_prim_rs${XYZ}$_vf(j, k, l, i) = max(0._wp, qL_prim_rs${XYZ}$_vf(j, k, l, i)) + qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) = min(max(0._wp, qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i)), 1._wp) alpha_L_sum = alpha_L_sum + qL_prim_rs${XYZ}$_vf(j, k, l, E_idx + i) end do @@ -2113,8 +2117,8 @@ contains !$acc loop seq do i = 1, num_fluids - qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) = max(0d0, qR_prim_rs${XYZ}$_vf(j + 1, k, l, i)) - qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) = min(max(0d0, qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i)), 1d0) + qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) = max(0._wp, qR_prim_rs${XYZ}$_vf(j + 1, k, l, i)) + qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) = min(max(0._wp, qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i)), 1._wp) alpha_R_sum = alpha_R_sum + qR_prim_rs${XYZ}$_vf(j + 1, k, l, E_idx + i) end do @@ -2142,7 +2146,7 @@ contains do i = 1, 2 Re_L(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0d0 + if (Re_size(i) > 0) Re_L(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -2150,7 +2154,7 @@ contains + Re_L(i) end do - Re_L(i) = 1d0/max(Re_L(i), sgm_eps) + Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) end do @@ -2158,7 +2162,7 @@ contains do i = 1, 2 Re_R(i) = dflt_real - if (Re_size(i) > 0) Re_R(i) = 0d0 + if (Re_size(i) > 0) Re_R(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) @@ -2166,12 +2170,12 @@ contains + Re_R(i) end do - Re_R(i) = 1d0/max(Re_R(i), sgm_eps) + Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) end do end if if (chemistry) then - c_sum_Yi_Phi = 0.0d0 + c_sum_Yi_Phi = 0.0_wp !$acc loop seq do i = chemxb, chemxe Ys_L(i - chemxb + 1) = qL_prim_rs${XYZ}$_vf(j, k, l, i) @@ -2195,11 +2199,11 @@ contains if (chem_params%gamma_method == 1) then !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. - Gamma_iL = Cp_iL/(Cp_iL - 1.0d0) - Gamma_iR = Cp_iR/(Cp_iR - 1.0d0) + Gamma_iL = Cp_iL/(Cp_iL - 1.0_wp) + Gamma_iR = Cp_iR/(Cp_iR - 1.0_wp) - gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0d0)) - gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0d0)) + gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) + gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) else if (chem_params%gamma_method == 2) then !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) @@ -2208,22 +2212,22 @@ contains call get_mixture_specific_heat_cv_mass(T_R, Ys_R, Cv_R) Gamm_L = Cp_L/Cv_L - gamma_L = 1.0d0/(Gamm_L - 1.0d0) + gamma_L = 1.0_wp/(Gamm_L - 1.0_wp) Gamm_R = Cp_R/Cv_R - gamma_R = 1.0d0/(Gamm_R - 1.0d0) + gamma_R = 1.0_wp/(Gamm_R - 1.0_wp) end if call get_mixture_energy_mass(T_L, Ys_L, E_L) call get_mixture_energy_mass(T_R, Ys_R, E_R) - E_L = rho_L*E_L + 5d-1*rho_L*vel_L_rms - E_R = rho_R*E_R + 5d-1*rho_R*vel_R_rms + E_L = rho_L*E_L + 5e-1*rho_L*vel_L_rms + E_R = rho_R*E_R + 5e-1*rho_R*vel_R_rms H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R else - E_L = gamma_L*pres_L + pi_inf_L + 5d-1*rho_L*vel_L_rms + qv_L + E_L = gamma_L*pres_L + pi_inf_L + 5e-1*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5d-1*rho_R*vel_R_rms + qv_R + E_R = gamma_R*pres_R + pi_inf_R + 5e-1*rho_R*vel_R_rms + qv_R H_L = (E_L + pres_L)/rho_L H_R = (E_R + pres_R)/rho_R @@ -2232,10 +2236,10 @@ contains @:compute_average_state() call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, & - vel_L_rms, 0d0, c_L) + vel_L_rms, 0._wp, c_L) call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, & - vel_R_rms, 0d0, c_R) + vel_R_rms, 0._wp, c_R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. @@ -2246,7 +2250,7 @@ contains if (viscous) then !$acc loop seq do i = 1, 2 - Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2d0/(1d0/Re_L(i) + 1d0/Re_R(i)) + Re_avg_rs${XYZ}$_vf(j, k, l, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) end do end if @@ -2266,30 +2270,30 @@ contains rho_R*(s_R - vel_R(idx1))) elseif (wave_speeds == 2) then - pres_SL = 5d-1*(pres_L + pres_R + rho_avg*c_avg* & - (vel_L(idx1) - & - vel_R(idx1))) + pres_SL = 5e-1_wp*(pres_L + pres_R + rho_avg*c_avg* & + (vel_L(idx1) - & + vel_R(idx1))) pres_SR = pres_SL - Ms_L = max(1d0, sqrt(1d0 + ((5d-1 + gamma_L)/(1d0 + gamma_L))* & - (pres_SL/pres_L - 1d0)*pres_L/ & - ((pres_L + pi_inf_L/(1d0 + gamma_L))))) - Ms_R = max(1d0, sqrt(1d0 + ((5d-1 + gamma_R)/(1d0 + gamma_R))* & - (pres_SR/pres_R - 1d0)*pres_R/ & - ((pres_R + pi_inf_R/(1d0 + gamma_R))))) + Ms_L = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_L)/(1._wp + gamma_L))* & + (pres_SL/pres_L - 1._wp)*pres_L/ & + ((pres_L + pi_inf_L/(1._wp + gamma_L))))) + Ms_R = max(1._wp, sqrt(1._wp + ((5e-1_wp + gamma_R)/(1._wp + gamma_R))* & + (pres_SR/pres_R - 1._wp)*pres_R/ & + ((pres_R + pi_inf_R/(1._wp + gamma_R))))) s_L = vel_L(idx1) - c_L*Ms_L s_R = vel_R(idx1) + c_R*Ms_R - s_S = 5d-1*((vel_L(idx1) + vel_R(idx1)) + & - (pres_L - pres_R)/ & - (rho_avg*c_avg)) + s_S = 5e-1_wp*((vel_L(idx1) + vel_R(idx1)) + & + (pres_L - pres_R)/ & + (rho_avg*c_avg)) end if ! follows Einfeldt et al. ! s_M/P = min/max(0.,s_L/R) - s_M = min(0d0, s_L); s_P = max(0d0, s_R) + s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) ! xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) @@ -2298,22 +2302,22 @@ contains ! goes with numerical velocity in x/y/z directions ! xi_P/M = 0.5 +/m sgn(0.5,s_star) - xi_M = (5d-1 + sign(5d-1, s_S)) - xi_P = (5d-1 - sign(5d-1, s_S)) + xi_M = (5e-1_wp + sign(5e-1_wp, s_S)) + xi_P = (5e-1_wp - sign(5e-1_wp, s_S)) if (low_Mach == 1) then @:compute_low_Mach_correction() else - pcorr = 0d0 + pcorr = 0._wp end if !$acc loop seq do i = 1, contxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(idx1) + s_M*(xi_L - 1d0)) & + *(vel_L(idx1) + s_M*(xi_L - 1._wp)) & + xi_P*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(idx1) + s_P*(xi_R - 1d0)) + *(vel_R(idx1) + s_P*(xi_R - 1._wp)) end do ! Momentum flux. @@ -2325,13 +2329,13 @@ contains xi_M*(rho_L*(vel_L(idx1)* & vel_L(idxi) + & s_M*(xi_L*(dir_flg(idxi)*s_S + & - (1d0 - dir_flg(idxi))* & + (1._wp - dir_flg(idxi))* & vel_L(idxi)) - vel_L(idxi))) + & dir_flg(idxi)*(pres_L)) & + xi_P*(rho_R*(vel_R(idx1)* & vel_R(idxi) + & s_P*(xi_R*(dir_flg(idxi)*s_S + & - (1d0 - dir_flg(idxi))* & + (1._wp - dir_flg(idxi))* & vel_R(idxi)) - vel_R(idxi))) + & dir_flg(idxi)*(pres_R)) & + (s_M/s_L)*(s_P/s_R)*dir_flg(idxi)*pcorr @@ -2355,9 +2359,9 @@ contains do i = advxb, advxe flux_rs${XYZ}$_vf(j, k, l, i) = & xi_M*qL_prim_rs${XYZ}$_vf(j, k, l, i) & - *(vel_L(idx1) + s_M*(xi_L - 1d0)) & + *(vel_L(idx1) + s_M*(xi_L - 1._wp)) & + xi_P*qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) & - *(vel_R(idx1) + s_P*(xi_R - 1d0)) + *(vel_R(idx1) + s_P*(xi_R - 1._wp)) end do ! Source for volume fraction advection equation @@ -2367,12 +2371,12 @@ contains vel_src_rs${XYZ}$_vf(j, k, l, idxi) = & xi_M*(vel_L(idxi) + & dir_flg(idxi)* & - s_M*(xi_L - 1d0)) & + s_M*(xi_L - 1._wp)) & + xi_P*(vel_R(idxi) + & dir_flg(idxi)* & - s_P*(xi_R - 1d0)) + s_P*(xi_R - 1._wp)) - !if ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0d0 + !if ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0._wp end do flux_src_rs${XYZ}$_vf(j, k, l, advxb) = vel_src_rs${XYZ}$_vf(j, k, l, idx1) @@ -2383,9 +2387,9 @@ contains Y_L = qL_prim_rs${XYZ}$_vf(j, k, l, i) Y_R = qR_prim_rs${XYZ}$_vf(j + 1, k, l, i) - flux_rs${XYZ}$_vf(j, k, l, i) = xi_M*rho_L*Y_L*(vel_L(idx1) + s_M*(xi_L - 1d0)) & - + xi_P*rho_R*Y_R*(vel_R(idx1) + s_P*(xi_R - 1d0)) - flux_src_rs${XYZ}$_vf(j, k, l, i) = 0.0d0 + flux_rs${XYZ}$_vf(j, k, l, i) = xi_M*rho_L*Y_L*(vel_L(idx1) + s_M*(xi_L - 1._wp)) & + + xi_P*rho_R*Y_R*(vel_R(idx1) + s_P*(xi_R - 1._wp)) + flux_src_rs${XYZ}$_vf(j, k, l, i) = 0.0_wp end do end if @@ -2403,17 +2407,17 @@ contains xi_M*(rho_L*(vel_L(idx1)* & vel_L(idx1) + & s_M*(xi_L*(dir_flg(idx1)*s_S + & - (1d0 - dir_flg(idx1))* & + (1._wp - dir_flg(idx1))* & vel_L(idx1)) - vel_L(idx1)))) & + xi_P*(rho_R*(vel_R(idx1)* & vel_R(idx1) + & s_P*(xi_R*(dir_flg(idx1)*s_S + & - (1d0 - dir_flg(idx1))* & + (1._wp - dir_flg(idx1))* & vel_R(idx1)) - vel_R(idx1)))) ! Geometrical source of the void fraction(s) is zero !$acc loop seq do i = advxb, advxe - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do end if #:endif @@ -2421,19 +2425,19 @@ contains if (grid_geometry == 3) then !$acc loop seq do i = 1, sys_size - flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0d0 + flux_gsrc_rs${XYZ}$_vf(j, k, l, i) = 0._wp end do flux_gsrc_rs${XYZ}$_vf(j, k, l, momxb + 1) = & -xi_M*(rho_L*(vel_L(idx1)* & vel_L(idx1) + & s_M*(xi_L*(dir_flg(idx1)*s_S + & - (1d0 - dir_flg(idx1))* & + (1._wp - dir_flg(idx1))* & vel_L(idx1)) - vel_L(idx1)))) & - xi_P*(rho_R*(vel_R(idx1)* & vel_R(idx1) + & s_P*(xi_R*(dir_flg(idx1)*s_S + & - (1d0 - dir_flg(idx1))* & + (1._wp - dir_flg(idx1))* & vel_R(idx1)) - vel_R(idx1)))) flux_gsrc_rs${XYZ}$_vf(j, k, l, momxe) = flux_rs${XYZ}$_vf(j, k, l, momxb + 1) @@ -2642,7 +2646,7 @@ contains qR_prim_vf, & norm_dir, ix, iy, iz) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: qL_prim_rsx_vf, qL_prim_rsy_vf, qL_prim_rsz_vf, qR_prim_rsx_vf, qR_prim_rsy_vf, qR_prim_rsz_vf type(scalar_field), & allocatable, dimension(:), & @@ -2658,13 +2662,13 @@ contains if (norm_dir == 1) then is1 = ix; is2 = iy; is3 = iz - dir_idx = (/1, 2, 3/); dir_flg = (/1d0, 0d0, 0d0/) + dir_idx = (/1, 2, 3/); dir_flg = (/1._wp, 0._wp, 0._wp/) elseif (norm_dir == 2) then is1 = iy; is2 = ix; is3 = iz - dir_idx = (/2, 1, 3/); dir_flg = (/0d0, 1d0, 0d0/) + dir_idx = (/2, 1, 3/); dir_flg = (/0._wp, 1._wp, 0._wp/) else is1 = iz; is2 = iy; is3 = ix - dir_idx = (/3, 1, 2/); dir_flg = (/0d0, 0d0, 1d0/) + dir_idx = (/3, 1, 2/); dir_flg = (/0._wp, 0._wp, 1._wp/) end if !$acc update device(is1, is2, is3) @@ -3040,7 +3044,7 @@ contains do l = is3%beg, is3%end do k = is2%beg, is2%end do j = is1%beg, is1%end - flux_src_vf(i)%sf(j, k, l) = 0d0 + flux_src_vf(i)%sf(j, k, l) = 0._wp end do end do end do @@ -3072,7 +3076,7 @@ contains do l = is3%beg, is3%end do j = is1%beg, is1%end do k = is2%beg, is2%end - flux_src_vf(i)%sf(k, j, l) = 0d0 + flux_src_vf(i)%sf(k, j, l) = 0._wp end do end do end do @@ -3103,7 +3107,7 @@ contains do j = is1%beg, is1%end do k = is2%beg, is2%end do l = is3%beg, is3%end - flux_src_vf(i)%sf(l, k, j) = 0d0 + flux_src_vf(i)%sf(l, k, j) = 0._wp end do end do end do @@ -3175,13 +3179,13 @@ contains ! Arithmetic mean of the left and right, WENO-reconstructed, cell- ! boundary values of cell-average first-order spatial derivatives ! of velocity - real(kind(0d0)), dimension(num_dims) :: avg_vel - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dx - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dy - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dz + real(wp), dimension(num_dims) :: avg_vel + real(wp), dimension(num_dims) :: dvel_avg_dx + real(wp), dimension(num_dims) :: dvel_avg_dy + real(wp), dimension(num_dims) :: dvel_avg_dz ! Viscous stress tensor - real(kind(0d0)), dimension(num_dims, num_dims) :: tau_Re + real(wp), dimension(num_dims, num_dims) :: tau_Re ! Generic loop iterators integer :: i, j, k, l @@ -3194,10 +3198,10 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j + 1, k, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j + 1, k, l)) - tau_Re(1, 1) = (4d0/3d0)*dvel_avg_dx(1)/ & + tau_Re(1, 1) = (4._wp/3._wp)*dvel_avg_dx(1)/ & Re_avg_rsx_vf(j, k, l, 1) flux_src_vf(momxb)%sf(j, k, l) = & @@ -3220,8 +3224,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j + 1, k, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j + 1, k, l)) tau_Re(1, 1) = dvel_avg_dx(1)/ & Re_avg_rsx_vf(j, k, l, 2) @@ -3248,21 +3252,21 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(2) = 5d-1*(velL_vf(2)%sf(j, k, l) & - + velR_vf(2)%sf(j + 1, k, l)) + avg_vel(2) = 5e-1_wp*(velL_vf(2)%sf(j, k, l) & + + velR_vf(2)%sf(j + 1, k, l)) !$acc loop seq do i = 1, 2 dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j + 1, k, l)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j + 1, k, l)) end do - dvel_avg_dx(2) = 5d-1*(dvelL_dx_vf(2)%sf(j, k, l) & - + dvelR_dx_vf(2)%sf(j + 1, k, l)) + dvel_avg_dx(2) = 5e-1_wp*(dvelL_dx_vf(2)%sf(j, k, l) & + + dvelR_dx_vf(2)%sf(j + 1, k, l)) - tau_Re(1, 1) = -(2d0/3d0)*(dvel_avg_dy(2) + & - avg_vel(2)/y_cc(k))/ & + tau_Re(1, 1) = -(2._wp/3._wp)*(dvel_avg_dy(2) + & + avg_vel(2)/y_cc(k))/ & Re_avg_rsx_vf(j, k, l, 1) tau_Re(1, 2) = (dvel_avg_dy(1) + dvel_avg_dx(2))/ & @@ -3290,11 +3294,11 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(2) = 5d-1*(velL_vf(2)%sf(j, k, l) & - + velR_vf(2)%sf(j + 1, k, l)) + avg_vel(2) = 5e-1_wp*(velL_vf(2)%sf(j, k, l) & + + velR_vf(2)%sf(j + 1, k, l)) - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j + 1, k, l)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j + 1, k, l)) tau_Re(1, 1) = (dvel_avg_dy(2) + & avg_vel(2)/y_cc(k))/ & @@ -3325,14 +3329,14 @@ contains !$acc loop seq do i = 1, 3, 2 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j + 1, k, l)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j + 1, k, l)) end do - dvel_avg_dx(3) = 5d-1*(dvelL_dx_vf(3)%sf(j, k, l) & - + dvelR_dx_vf(3)%sf(j + 1, k, l)) + dvel_avg_dx(3) = 5e-1_wp*(dvelL_dx_vf(3)%sf(j, k, l) & + + dvelR_dx_vf(3)%sf(j + 1, k, l)) - tau_Re(1, 1) = -(2d0/3d0)*dvel_avg_dz(3)/y_cc(k)/ & + tau_Re(1, 1) = -(2._wp/3._wp)*dvel_avg_dz(3)/y_cc(k)/ & Re_avg_rsx_vf(j, k, l, 1) tau_Re(1, 3) = (dvel_avg_dz(1)/y_cc(k) + dvel_avg_dx(3))/ & @@ -3363,8 +3367,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j + 1, k, l)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j + 1, k, l)) tau_Re(1, 1) = dvel_avg_dz(3)/y_cc(k)/ & Re_avg_rsx_vf(j, k, l, 2) @@ -3394,29 +3398,29 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(2) = 5d-1*(velL_vf(2)%sf(j, k, l) & - + velR_vf(2)%sf(j, k + 1, l)) + avg_vel(2) = 5e-1_wp*(velL_vf(2)%sf(j, k, l) & + + velR_vf(2)%sf(j, k + 1, l)) !$acc loop seq do i = 1, 2 dvel_avg_dx(i) = & - 5d-1*(dvelL_dx_vf(i)%sf(j, k, l) & - + dvelR_dx_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dx_vf(i)%sf(j, k, l) & + + dvelR_dx_vf(i)%sf(j, k + 1, l)) dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j, k + 1, l)) end do tau_Re(2, 1) = (dvel_avg_dy(1) + dvel_avg_dx(2))/ & Re_avg_rsy_vf(k, j, l, 1) - tau_Re(2, 2) = (4d0*dvel_avg_dy(2) & - - 2d0*dvel_avg_dx(1) & - - 2d0*avg_vel(2)/y_cb(k))/ & - (3d0*Re_avg_rsy_vf(k, j, l, 1)) + tau_Re(2, 2) = (4._wp*dvel_avg_dy(2) & + - 2._wp*dvel_avg_dx(1) & + - 2._wp*avg_vel(2)/y_cb(k))/ & + (3._wp*Re_avg_rsy_vf(k, j, l, 1)) !$acc loop seq do i = 1, 2 @@ -3443,14 +3447,14 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(2) = 5d-1*(velL_vf(2)%sf(j, k, l) & - + velR_vf(2)%sf(j, k + 1, l)) + avg_vel(2) = 5e-1_wp*(velL_vf(2)%sf(j, k, l) & + + velR_vf(2)%sf(j, k + 1, l)) - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j, k + 1, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j, k + 1, l)) - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j, k + 1, l)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j, k + 1, l)) tau_Re(2, 2) = (dvel_avg_dx(1) + dvel_avg_dy(2) + & avg_vel(2)/y_cb(k))/ & @@ -3478,20 +3482,20 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(3) = 5d-1*(velL_vf(3)%sf(j, k, l) & - + velR_vf(3)%sf(j, k + 1, l)) + avg_vel(3) = 5e-1_wp*(velL_vf(3)%sf(j, k, l) & + + velR_vf(3)%sf(j, k + 1, l)) !$acc loop seq do i = 2, 3 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j, k + 1, l)) end do - dvel_avg_dy(3) = 5d-1*(dvelL_dy_vf(3)%sf(j, k, l) & - + dvelR_dy_vf(3)%sf(j, k + 1, l)) + dvel_avg_dy(3) = 5e-1_wp*(dvelL_dy_vf(3)%sf(j, k, l) & + + dvelR_dy_vf(3)%sf(j, k + 1, l)) - tau_Re(2, 2) = -(2d0/3d0)*dvel_avg_dz(3)/y_cb(k)/ & + tau_Re(2, 2) = -(2._wp/3._wp)*dvel_avg_dz(3)/y_cb(k)/ & Re_avg_rsy_vf(k, j, l, 1) tau_Re(2, 3) = ((dvel_avg_dz(2) - avg_vel(3))/ & @@ -3523,8 +3527,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j, k + 1, l)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j, k + 1, l)) tau_Re(2, 2) = dvel_avg_dz(3)/y_cb(k)/ & Re_avg_rsy_vf(k, j, l, 2) @@ -3555,28 +3559,28 @@ contains !$acc loop seq do i = 2, 3 - avg_vel(i) = 5d-1*(velL_vf(i)%sf(j, k, l) & - + velR_vf(i)%sf(j, k, l + 1)) + avg_vel(i) = 5e-1_wp*(velL_vf(i)%sf(j, k, l) & + + velR_vf(i)%sf(j, k, l + 1)) end do !$acc loop seq do i = 1, 3, 2 dvel_avg_dx(i) = & - 5d-1*(dvelL_dx_vf(i)%sf(j, k, l) & - + dvelR_dx_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dx_vf(i)%sf(j, k, l) & + + dvelR_dx_vf(i)%sf(j, k, l + 1)) end do do i = 2, 3 dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j, k, l + 1)) end do !$acc loop seq do i = 1, 3 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j, k, l + 1)) end do tau_Re(3, 1) = (dvel_avg_dz(1)/y_cc(k) + dvel_avg_dx(3))/ & @@ -3588,11 +3592,11 @@ contains Re_avg_rsz_vf(l, k, j, 1)/ & y_cc(k) - tau_Re(3, 3) = (4d0*dvel_avg_dz(3)/y_cc(k) & - - 2d0*dvel_avg_dx(1) & - - 2d0*dvel_avg_dy(2) & - + 4d0*avg_vel(2)/y_cc(k))/ & - (3d0*Re_avg_rsz_vf(l, k, j, 1))/ & + tau_Re(3, 3) = (4._wp*dvel_avg_dz(3)/y_cc(k) & + - 2._wp*dvel_avg_dx(1) & + - 2._wp*dvel_avg_dy(2) & + + 4._wp*avg_vel(2)/y_cc(k))/ & + (3._wp*Re_avg_rsz_vf(l, k, j, 1))/ & y_cc(k) !$acc loop seq @@ -3618,17 +3622,17 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - avg_vel(2) = 5d-1*(velL_vf(2)%sf(j, k, l) & - + velR_vf(2)%sf(j, k, l + 1)) + avg_vel(2) = 5e-1_wp*(velL_vf(2)%sf(j, k, l) & + + velR_vf(2)%sf(j, k, l + 1)) - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j, k, l + 1)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j, k, l + 1)) - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j, k, l + 1)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j, k, l + 1)) - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j, k, l + 1)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j, k, l + 1)) tau_Re(3, 3) = (dvel_avg_dx(1) & + dvel_avg_dy(2) & @@ -3701,11 +3705,11 @@ contains ! Arithmetic mean of the left and right, WENO-reconstructed, cell- ! boundary values of cell-average first-order spatial derivatives ! of velocity - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dx - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dy - real(kind(0d0)), dimension(num_dims) :: dvel_avg_dz + real(wp), dimension(num_dims) :: dvel_avg_dx + real(wp), dimension(num_dims) :: dvel_avg_dy + real(wp), dimension(num_dims) :: dvel_avg_dz - real(kind(0d0)), dimension(num_dims, num_dims) :: tau_Re !< Viscous stress tensor + real(wp), dimension(num_dims, num_dims) :: tau_Re !< Viscous stress tensor integer :: i, j, k, l !< Generic loop iterators @@ -3718,10 +3722,10 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j + 1, k, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j + 1, k, l)) - tau_Re(1, 1) = (4d0/3d0)*dvel_avg_dx(1)/ & + tau_Re(1, 1) = (4._wp/3._wp)*dvel_avg_dx(1)/ & Re_avg_rsx_vf(j, k, l, 1) flux_src_vf(momxb)%sf(j, k, l) = & @@ -3744,8 +3748,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j + 1, k, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j + 1, k, l)) tau_Re(1, 1) = dvel_avg_dx(1)/ & Re_avg_rsx_vf(j, k, l, 2) @@ -3775,14 +3779,14 @@ contains !$acc loop seq do i = 1, 2 dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j + 1, k, l)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j + 1, k, l)) end do - dvel_avg_dx(2) = 5d-1*(dvelL_dx_vf(2)%sf(j, k, l) & - + dvelR_dx_vf(2)%sf(j + 1, k, l)) + dvel_avg_dx(2) = 5e-1_wp*(dvelL_dx_vf(2)%sf(j, k, l) & + + dvelR_dx_vf(2)%sf(j + 1, k, l)) - tau_Re(1, 1) = -(2d0/3d0)*dvel_avg_dy(2)/ & + tau_Re(1, 1) = -(2._wp/3._wp)*dvel_avg_dy(2)/ & Re_avg_rsx_vf(j, k, l, 1) tau_Re(1, 2) = (dvel_avg_dy(1) + dvel_avg_dx(2))/ & @@ -3813,8 +3817,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j + 1, k, l)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j + 1, k, l)) tau_Re(1, 1) = dvel_avg_dy(2)/ & Re_avg_rsx_vf(j, k, l, 2) @@ -3844,14 +3848,14 @@ contains !$acc loop seq do i = 1, 3, 2 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j + 1, k, l)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j + 1, k, l)) end do - dvel_avg_dx(3) = 5d-1*(dvelL_dx_vf(3)%sf(j, k, l) & - + dvelR_dx_vf(3)%sf(j + 1, k, l)) + dvel_avg_dx(3) = 5e-1_wp*(dvelL_dx_vf(3)%sf(j, k, l) & + + dvelR_dx_vf(3)%sf(j + 1, k, l)) - tau_Re(1, 1) = -(2d0/3d0)*dvel_avg_dz(3)/ & + tau_Re(1, 1) = -(2._wp/3._wp)*dvel_avg_dz(3)/ & Re_avg_rsx_vf(j, k, l, 1) tau_Re(1, 3) = (dvel_avg_dz(1) + dvel_avg_dx(3))/ & @@ -3881,8 +3885,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j + 1, k, l)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j + 1, k, l)) tau_Re(1, 1) = dvel_avg_dz(3)/ & Re_avg_rsx_vf(j, k, l, 2) @@ -3915,21 +3919,21 @@ contains do i = 1, 2 dvel_avg_dx(i) = & - 5d-1*(dvelL_dx_vf(i)%sf(j, k, l) & - + dvelR_dx_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dx_vf(i)%sf(j, k, l) & + + dvelR_dx_vf(i)%sf(j, k + 1, l)) dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j, k + 1, l)) end do tau_Re(2, 1) = (dvel_avg_dy(1) + dvel_avg_dx(2))/ & Re_avg_rsy_vf(k, j, l, 1) - tau_Re(2, 2) = (4d0*dvel_avg_dy(2) & - - 2d0*dvel_avg_dx(1))/ & - (3d0*Re_avg_rsy_vf(k, j, l, 1)) + tau_Re(2, 2) = (4._wp*dvel_avg_dy(2) & + - 2._wp*dvel_avg_dx(1))/ & + (3._wp*Re_avg_rsy_vf(k, j, l, 1)) !$acc loop seq do i = 1, 2 @@ -3956,11 +3960,11 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j, k + 1, l)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j, k + 1, l)) - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j, k + 1, l)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j, k + 1, l)) tau_Re(2, 2) = (dvel_avg_dx(1) + dvel_avg_dy(2))/ & Re_avg_rsy_vf(k, j, l, 2) @@ -3990,14 +3994,14 @@ contains !$acc loop seq do i = 2, 3 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j, k + 1, l)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j, k + 1, l)) end do - dvel_avg_dy(3) = 5d-1*(dvelL_dy_vf(3)%sf(j, k, l) & - + dvelR_dy_vf(3)%sf(j, k + 1, l)) + dvel_avg_dy(3) = 5e-1_wp*(dvelL_dy_vf(3)%sf(j, k, l) & + + dvelR_dy_vf(3)%sf(j, k + 1, l)) - tau_Re(2, 2) = -(2d0/3d0)*dvel_avg_dz(3)/ & + tau_Re(2, 2) = -(2._wp/3._wp)*dvel_avg_dz(3)/ & Re_avg_rsy_vf(k, j, l, 1) tau_Re(2, 3) = (dvel_avg_dz(2) + dvel_avg_dy(3))/ & @@ -4028,8 +4032,8 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j, k + 1, l)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j, k + 1, l)) tau_Re(2, 2) = dvel_avg_dz(3)/ & Re_avg_rsy_vf(k, j, l, 2) @@ -4061,22 +4065,22 @@ contains !$acc loop seq do i = 1, 3, 2 dvel_avg_dx(i) = & - 5d-1*(dvelL_dx_vf(i)%sf(j, k, l) & - + dvelR_dx_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dx_vf(i)%sf(j, k, l) & + + dvelR_dx_vf(i)%sf(j, k, l + 1)) end do !$acc loop seq do i = 2, 3 dvel_avg_dy(i) = & - 5d-1*(dvelL_dy_vf(i)%sf(j, k, l) & - + dvelR_dy_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dy_vf(i)%sf(j, k, l) & + + dvelR_dy_vf(i)%sf(j, k, l + 1)) end do !$acc loop seq do i = 1, 3 dvel_avg_dz(i) = & - 5d-1*(dvelL_dz_vf(i)%sf(j, k, l) & - + dvelR_dz_vf(i)%sf(j, k, l + 1)) + 5e-1_wp*(dvelL_dz_vf(i)%sf(j, k, l) & + + dvelR_dz_vf(i)%sf(j, k, l + 1)) end do tau_Re(3, 1) = (dvel_avg_dz(1) + dvel_avg_dx(3))/ & @@ -4085,10 +4089,10 @@ contains tau_Re(3, 2) = (dvel_avg_dz(2) + dvel_avg_dy(3))/ & Re_avg_rsz_vf(l, k, j, 1) - tau_Re(3, 3) = (4d0*dvel_avg_dz(3) & - - 2d0*dvel_avg_dx(1) & - - 2d0*dvel_avg_dy(2))/ & - (3d0*Re_avg_rsz_vf(l, k, j, 1)) + tau_Re(3, 3) = (4._wp*dvel_avg_dz(3) & + - 2._wp*dvel_avg_dx(1) & + - 2._wp*dvel_avg_dy(2))/ & + (3._wp*Re_avg_rsz_vf(l, k, j, 1)) !$acc loop seq do i = 1, 3 @@ -4115,14 +4119,14 @@ contains do k = isy%beg, isy%end do j = isx%beg, isx%end - dvel_avg_dx(1) = 5d-1*(dvelL_dx_vf(1)%sf(j, k, l) & - + dvelR_dx_vf(1)%sf(j, k, l + 1)) + dvel_avg_dx(1) = 5e-1_wp*(dvelL_dx_vf(1)%sf(j, k, l) & + + dvelR_dx_vf(1)%sf(j, k, l + 1)) - dvel_avg_dy(2) = 5d-1*(dvelL_dy_vf(2)%sf(j, k, l) & - + dvelR_dy_vf(2)%sf(j, k, l + 1)) + dvel_avg_dy(2) = 5e-1_wp*(dvelL_dy_vf(2)%sf(j, k, l) & + + dvelR_dy_vf(2)%sf(j, k, l + 1)) - dvel_avg_dz(3) = 5d-1*(dvelL_dz_vf(3)%sf(j, k, l) & - + dvelR_dz_vf(3)%sf(j, k, l + 1)) + dvel_avg_dz(3) = 5e-1_wp*(dvelL_dz_vf(3)%sf(j, k, l) & + + dvelR_dz_vf(3)%sf(j, k, l + 1)) tau_Re(3, 3) = (dvel_avg_dx(1) & + dvel_avg_dy(2) & diff --git a/src/simulation/m_sim_helpers.f90 b/src/simulation/m_sim_helpers.f90 index 2e94be868..f52b25e65 100644 --- a/src/simulation/m_sim_helpers.f90 +++ b/src/simulation/m_sim_helpers.f90 @@ -38,11 +38,11 @@ subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, #endif type(scalar_field), dimension(sys_size) :: q_prim_vf - real(kind(0d0)), dimension(num_fluids) :: alpha_rho - real(kind(0d0)), dimension(num_fluids) :: alpha - real(kind(0d0)), dimension(num_dims) :: vel - real(kind(0d0)) :: rho, gamma, pi_inf, qv, vel_sum, E, H, pres - real(kind(0d0)), dimension(2) :: Re + real(wp), dimension(num_fluids) :: alpha_rho + real(wp), dimension(num_fluids) :: alpha + real(wp), dimension(num_dims) :: vel + real(wp) :: rho, gamma, pi_inf, qv, vel_sum, E, H, pres + real(wp), dimension(2) :: Re integer :: i, j, k, l do i = 1, num_fluids @@ -60,14 +60,14 @@ subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel(i) = q_prim_vf(contxe + i)%sf(j, k, l) end do - vel_sum = 0d0 + vel_sum = 0._wp do i = 1, num_dims - vel_sum = vel_sum + vel(i)**2d0 + vel_sum = vel_sum + vel(i)**2._wp end do pres = q_prim_vf(E_idx)%sf(j, k, l) - E = gamma*pres + pi_inf + 5d-1*rho*vel_sum + qv + E = gamma*pres + pi_inf + 5e-1_wp*rho*vel_sum + qv H = (E + pres)/rho @@ -85,22 +85,22 @@ end subroutine s_compute_enthalpy !! @param Rc_sf (optional) cell centered Rc subroutine s_compute_stability_from_dt(vel, c, rho, Re_l, j, k, l, icfl_sf, vcfl_sf, Rc_sf) !$acc routine seq - real(kind(0d0)), dimension(num_dims) :: vel - real(kind(0d0)) :: c, rho - real(kind(0d0)), dimension(0:m, 0:n, 0:p) :: icfl_sf - real(kind(0d0)), dimension(0:m, 0:n, 0:p), optional :: vcfl_sf, Rc_sf - real(kind(0d0)) :: fltr_dtheta !< + real(wp), dimension(num_dims) :: vel + real(wp) :: c, rho + real(wp), dimension(0:m, 0:n, 0:p) :: icfl_sf + real(wp), dimension(0:m, 0:n, 0:p), optional :: vcfl_sf, Rc_sf + real(wp) :: fltr_dtheta !< !! Modified dtheta accounting for Fourier filtering in azimuthal direction. integer :: j, k, l integer :: Nfq - real(kind(0d0)), dimension(2) :: Re_l + real(wp), dimension(2) :: Re_l if (grid_geometry == 3) then if (k == 0) then - fltr_dtheta = 2d0*pi*y_cb(0)/3d0 + fltr_dtheta = 2._wp*pi*y_cb(0)/3._wp elseif (k <= fourier_rings) then - Nfq = min(floor(2d0*real(k, kind(0d0))*pi), (p + 1)/2 + 1) - fltr_dtheta = 2d0*pi*y_cb(k - 1)/real(Nfq, kind(0d0)) + Nfq = min(floor(2._wp*real(k, wp)*pi), (p + 1)/2 + 1) + fltr_dtheta = 2._wp*pi*y_cb(k - 1)/real(Nfq, wp) else fltr_dtheta = y_cb(k - 1)*dz(l) end if @@ -122,20 +122,20 @@ subroutine s_compute_stability_from_dt(vel, c, rho, Re_l, j, k, l, icfl_sf, vcfl if (grid_geometry == 3) then vcfl_sf(j, k, l) = maxval(dt/Re_l/rho) & - /min(dx(j), dy(k), fltr_dtheta)**2d0 + /min(dx(j), dy(k), fltr_dtheta)**2._wp Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), & dy(k)*(abs(vel(2)) + c), & fltr_dtheta*(abs(vel(3)) + c)) & - /maxval(1d0/Re_l) + /maxval(1._wp/Re_l) else vcfl_sf(j, k, l) = maxval(dt/Re_l/rho) & - /min(dx(j), dy(k), dz(l))**2d0 + /min(dx(j), dy(k), dz(l))**2._wp Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), & dy(k)*(abs(vel(2)) + c), & dz(l)*(abs(vel(3)) + c)) & - /maxval(1d0/Re_l) + /maxval(1._wp/Re_l) end if end if @@ -147,11 +147,11 @@ subroutine s_compute_stability_from_dt(vel, c, rho, Re_l, j, k, l, icfl_sf, vcfl if (viscous) then - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(dx(j), dy(k))**2d0 + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(dx(j), dy(k))**2._wp Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), & dy(k)*(abs(vel(2)) + c)) & - /maxval(1d0/Re_l) + /maxval(1._wp/Re_l) end if @@ -161,9 +161,9 @@ subroutine s_compute_stability_from_dt(vel, c, rho, Re_l, j, k, l, icfl_sf, vcfl if (viscous) then - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/dx(j)**2d0 + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/dx(j)**2._wp - Rc_sf(j, k, l) = dx(j)*(abs(vel(1)) + c)/maxval(1d0/Re_l) + Rc_sf(j, k, l) = dx(j)*(abs(vel(1)) + c)/maxval(1._wp/Re_l) end if @@ -181,21 +181,21 @@ end subroutine s_compute_stability_from_dt !! @param l z coordinate subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l) !$acc routine seq - real(kind(0d0)), dimension(num_dims) :: vel - real(kind(0d0)) :: c, icfl_dt, vcfl_dt, rho - real(kind(0d0)), dimension(0:m, 0:n, 0:p) :: max_dt - real(kind(0d0)) :: fltr_dtheta !< + real(wp), dimension(num_dims) :: vel + real(wp) :: c, icfl_dt, vcfl_dt, rho + real(wp), dimension(0:m, 0:n, 0:p) :: max_dt + real(wp) :: fltr_dtheta !< !! Modified dtheta accounting for Fourier filtering in azimuthal direction. integer :: j, k, l integer :: Nfq - real(kind(0d0)), dimension(2) :: Re_l + real(wp), dimension(2) :: Re_l if (grid_geometry == 3) then if (k == 0) then - fltr_dtheta = 2d0*pi*y_cb(0)/3d0 + fltr_dtheta = 2._wp*pi*y_cb(0)/3._wp elseif (k <= fourier_rings) then - Nfq = min(floor(2d0*real(k, kind(0d0))*pi), (p + 1)/2 + 1) - fltr_dtheta = 2d0*pi*y_cb(k - 1)/real(Nfq, kind(0d0)) + Nfq = min(floor(2._wp*real(k, wp)*pi), (p + 1)/2 + 1) + fltr_dtheta = 2._wp*pi*y_cb(k - 1)/real(Nfq, wp) else fltr_dtheta = y_cb(k - 1)*dz(l) end if @@ -215,10 +215,10 @@ subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l) if (viscous) then if (grid_geometry == 3) then - vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2d0) & + vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) & /minval(1/(rho*Re_l)) else - vcfl_dt = cfl_target*(min(dx(j), dy(k), dz(l))**2d0) & + vcfl_dt = cfl_target*(min(dx(j), dy(k), dz(l))**2._wp) & /minval(1/(rho*Re_l)) end if end if @@ -229,7 +229,7 @@ subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l) dy(k)/(abs(vel(2)) + c)) if (viscous) then - vcfl_dt = cfl_target*(min(dx(j), dy(k))**2d0)/maxval((1/Re_l)/rho) + vcfl_dt = cfl_target*(min(dx(j), dy(k))**2._wp)/maxval((1/Re_l)/rho) end if else @@ -237,7 +237,7 @@ subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l) icfl_dt = cfl_target*(dx(j)/(abs(vel(1)) + c)) if (viscous) then - vcfl_dt = cfl_target*(dx(j)**2d0)/minval(1/(rho*Re_l)) + vcfl_dt = cfl_target*(dx(j)**2._wp)/minval(1/(rho*Re_l)) end if end if diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 2d6611d65..d2de693ec 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -36,7 +36,7 @@ module m_start_up use m_acoustic_src !< Acoustic source calculations - use m_rhs !< Right-hand-side (RHS) evaluation procedures + use m_rhs !< Right-hane-side (RHS) evaluation procedures use m_chemistry !< Chemistry module @@ -97,7 +97,7 @@ module m_start_up type(scalar_field), allocatable, dimension(:) :: grad_x_vf, grad_y_vf, grad_z_vf, norm_vf - real(kind(0d0)) :: dt_init + real(wp) :: dt_init contains @@ -109,6 +109,7 @@ contains dimension(sys_size), & intent(inout) :: q_cons_vf + if (.not. parallel_io) then call s_read_serial_data_files(q_cons_vf) else @@ -285,7 +286,7 @@ contains end if dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2d0 + x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp if (ib) then do i = 1, num_ibs @@ -314,7 +315,7 @@ contains end if dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2d0 + y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp end if ! ================================================================== @@ -337,7 +338,7 @@ contains end if dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2d0 + z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp end if ! ================================================================== @@ -488,7 +489,7 @@ contains #ifdef MFC_MPI - real(kind(0d0)), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb + real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb integer :: ifile, ierr, data_size integer, dimension(MPI_STATUS_SIZE) :: status @@ -516,7 +517,7 @@ contains if (file_exist) then data_size = m_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, x_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, x_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -527,7 +528,7 @@ contains ! Computing the cell width distribution dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) ! Computing the cell center locations - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2d0 + x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp if (ib) then do i = 1, num_ibs @@ -547,7 +548,7 @@ contains if (file_exist) then data_size = n_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, y_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, y_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -558,7 +559,7 @@ contains ! Computing the cell width distribution dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) ! Computing the cell center locations - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2d0 + y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp if (p > 0) then ! Read in cell boundary locations in z-direction @@ -568,7 +569,7 @@ contains if (file_exist) then data_size = p_glb + 2 call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr) - call MPI_FILE_READ(ifile, z_cb_glb, data_size, MPI_DOUBLE_PRECISION, status, ierr) + call MPI_FILE_READ(ifile, z_cb_glb, data_size, mpi_p, status, ierr) call MPI_FILE_CLOSE(ifile, ierr) else call s_mpi_abort('File '//trim(file_loc)//'is missing. Exiting...') @@ -579,7 +580,7 @@ contains ! Computing the cell width distribution dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) ! Computing the cell center locations - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2d0 + z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp end if end if @@ -614,8 +615,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -626,7 +627,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Read pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -634,7 +635,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -642,7 +643,7 @@ contains var_MOK = int(i, MPI_OFFSET_KIND) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -682,10 +683,10 @@ contains disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelset_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelset_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_levelset_DATA%var%sf, data_size * num_ibs, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -702,10 +703,10 @@ contains disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelsetnorm_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelsetnorm_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_levelsetnorm_DATA%var%sf, data_size * num_ibs * 3, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -749,8 +750,8 @@ contains m_MOK = int(m_glb + 1, MPI_OFFSET_KIND) n_MOK = int(n_glb + 1, MPI_OFFSET_KIND) p_MOK = int(p_glb + 1, MPI_OFFSET_KIND) - WP_MOK = int(8d0, MPI_OFFSET_KIND) - MOK = int(1d0, MPI_OFFSET_KIND) + WP_MOK = int(8._wp, MPI_OFFSET_KIND) + MOK = int(1._wp, MPI_OFFSET_KIND) str_MOK = int(name_len, MPI_OFFSET_KIND) NVARS_MOK = int(sys_size, MPI_OFFSET_KIND) @@ -762,10 +763,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do !Read pb and mv for non-polytropic qbmm if (qbmm .and. .not. polytropic) then @@ -774,10 +775,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if else @@ -787,10 +788,10 @@ contains ! Initial displacement to skip at beginning of file disp = m_MOK*max(MOK, n_MOK)*max(MOK, p_MOK)*WP_MOK*(var_MOK - 1) - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_DATA%view(i), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_DATA%view(i), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_DATA%var(i)%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end do end if @@ -832,10 +833,10 @@ contains disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelset_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelset_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_levelset_DATA%var%sf, data_size, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -852,10 +853,10 @@ contains disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_levelsetnorm_DATA%view, & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_levelsetnorm_DATA%view, & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_levelsetnorm_DATA%var%sf, data_size * num_ibs * 3, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) else call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting...') @@ -889,10 +890,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(1), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_airfoil_IB_DATA%view(1), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_airfoil_IB_DATA%var(1:Np), 3*Np, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end if @@ -906,10 +907,10 @@ contains ! Initial displacement to skip at beginning of file disp = 0 - call MPI_FILE_SET_VIEW(ifile, disp, MPI_DOUBLE_PRECISION, MPI_IO_airfoil_IB_DATA%view(2), & + call MPI_FILE_SET_VIEW(ifile, disp, mpi_p, MPI_IO_airfoil_IB_DATA%view(2), & 'native', mpi_info_int, ierr) call MPI_FILE_READ(ifile, MPI_IO_airfoil_IB_DATA%var(Np + 1:2*Np), 3*Np, & - MPI_DOUBLE_PRECISION, status, ierr) + mpi_p, status, ierr) end if do i = 1, Np @@ -970,7 +971,7 @@ contains ! Computing the cell-center locations buffer, at the beginning of ! the coordinate direction, from the cell-width distribution buffer do i = 1, buff_size - x_cc(-i) = x_cc(1 - i) - (dx(1 - i) + dx(-i))/2d0 + x_cc(-i) = x_cc(1 - i) - (dx(1 - i) + dx(-i))/2._wp end do ! Populating the cell-width distribution buffer, at the end of the @@ -1001,7 +1002,7 @@ contains ! Populating the cell-center locations buffer, at the end of the ! coordinate direction, from buffer of the cell-width distribution do i = 1, buff_size - x_cc(m + i) = x_cc(m + (i - 1)) + (dx(m + (i - 1)) + dx(m + i))/2d0 + x_cc(m + i) = x_cc(m + (i - 1)) + (dx(m + (i - 1)) + dx(m + i))/2._wp end do ! END: Population of Buffers in x-direction ======================== @@ -1038,7 +1039,7 @@ contains ! Computing the cell-center locations buffer, at the beginning of ! the coordinate direction, from the cell-width distribution buffer do i = 1, buff_size - y_cc(-i) = y_cc(1 - i) - (dy(1 - i) + dy(-i))/2d0 + y_cc(-i) = y_cc(1 - i) - (dy(1 - i) + dy(-i))/2._wp end do ! Populating the cell-width distribution buffer, at the end of the @@ -1069,7 +1070,7 @@ contains ! Populating the cell-center locations buffer, at the end of the ! coordinate direction, from buffer of the cell-width distribution do i = 1, buff_size - y_cc(n + i) = y_cc(n + (i - 1)) + (dy(n + (i - 1)) + dy(n + i))/2d0 + y_cc(n + i) = y_cc(n + (i - 1)) + (dy(n + (i - 1)) + dy(n + i))/2._wp end do ! END: Population of Buffers in y-direction ======================== @@ -1106,7 +1107,7 @@ contains ! Computing the cell-center locations buffer, at the beginning of ! the coordinate direction, from the cell-width distribution buffer do i = 1, buff_size - z_cc(-i) = z_cc(1 - i) - (dz(1 - i) + dz(-i))/2d0 + z_cc(-i) = z_cc(1 - i) - (dz(1 - i) + dz(-i))/2._wp end do ! Populating the cell-width distribution buffer, at the end of the @@ -1137,7 +1138,7 @@ contains ! Populating the cell-center locations buffer, at the end of the ! coordinate direction, from buffer of the cell-width distribution do i = 1, buff_size - z_cc(p + i) = z_cc(p + (i - 1)) + (dz(p + (i - 1)) + dz(p + i))/2d0 + z_cc(p + i) = z_cc(p + (i - 1)) + (dz(p + (i - 1)) + dz(p + i))/2._wp end do ! END: Population of Buffers in z-direction ======================== @@ -1153,17 +1154,17 @@ contains type(scalar_field), dimension(sys_size), intent(inout) :: v_vf - real(kind(0d0)) :: rho - real(kind(0d0)) :: dyn_pres - real(kind(0d0)) :: gamma - real(kind(0d0)) :: pi_inf - real(kind(0d0)) :: qv - real(kind(0d0)), dimension(2) :: Re - real(kind(0d0)) :: pres, T + real(wp) :: rho + real(wp) :: dyn_pres + real(wp) :: gamma + real(wp) :: pi_inf + real(wp) :: qv + real(wp), dimension(2) :: Re + real(wp) :: pres, T integer :: i, j, k, l, c - real(kind(0d0)), dimension(num_species) :: rhoYks + real(wp), dimension(num_species) :: rhoYks do j = 0, m do k = 0, n @@ -1171,9 +1172,9 @@ contains call s_convert_to_mixture_variables(v_vf, j, k, l, rho, gamma, pi_inf, qv, Re) - dyn_pres = 0d0 + dyn_pres = 0._wp do i = mom_idx%beg, mom_idx%end - dyn_pres = dyn_pres + 5d-1*v_vf(i)%sf(j, k, l)*v_vf(i)%sf(j, k, l) & + dyn_pres = dyn_pres + 5e-1_wp*v_vf(i)%sf(j, k, l)*v_vf(i)%sf(j, k, l) & /max(rho, sgm_eps) end do @@ -1183,7 +1184,8 @@ contains end do end if - call s_compute_pressure(v_vf(E_idx)%sf(j, k, l), 0d0, & + + call s_compute_pressure(v_vf(E_idx)%sf(j, k, l), 0._wp, & dyn_pres, pi_inf, gamma, rho, qv, rhoYks, pres, T) do i = 1, num_fluids @@ -1200,14 +1202,15 @@ contains subroutine s_perform_time_step(t_step, time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, file_exists, start, finish, nt) integer, intent(inout) :: t_step - real(kind(0d0)), intent(inout) :: time_avg, time_final - real(kind(0d0)), intent(inout) :: io_time_avg, io_time_final - real(kind(0d0)), dimension(:), intent(inout) :: proc_time - real(kind(0d0)), dimension(:), intent(inout) :: io_proc_time + real(wp), intent(inout) :: time_avg, time_final + real(wp), intent(inout) :: io_time_avg, io_time_final + real(wp), dimension(:), intent(inout) :: proc_time + real(wp), dimension(:), intent(inout) :: io_proc_time logical, intent(inout) :: file_exists - real(kind(0d0)), intent(inout) :: start, finish + real(wp), intent(inout) :: start, finish integer, intent(inout) :: nt + integer :: i if (cfl_dt) then @@ -1217,7 +1220,7 @@ contains if (t_step == 0) dt_init = dt - if (dt < 1d-3*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then + if (dt < 1e-3_wp*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then print*, "Delta t = ", dt call s_mpi_abort("Delta t has become too small") end if @@ -1232,7 +1235,7 @@ contains if (cfl_dt) then if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then print '(" ["I3"%] Time "ES16.6" dt = "ES16.6" @ Time Step = "I8"")', & - int(ceiling(100d0*(mytime/t_stop))), & + int(ceiling(100._wp*(mytime/t_stop))), & mytime, & dt, & t_step @@ -1240,7 +1243,7 @@ contains else if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then print '(" ["I3"%] Time step "I8" of "I0" @ t_step = "I0"")', & - int(ceiling(100d0*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & + int(ceiling(100._wp*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & t_step - t_step_start + 1, & t_step_stop - t_step_start + 1, & t_step @@ -1283,15 +1286,15 @@ contains subroutine s_save_performance_metrics(t_step, time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, file_exists, start, finish, nt) integer, intent(inout) :: t_step - real(kind(0d0)), intent(inout) :: time_avg, time_final - real(kind(0d0)), intent(inout) :: io_time_avg, io_time_final - real(kind(0d0)), dimension(:), intent(inout) :: proc_time - real(kind(0d0)), dimension(:), intent(inout) :: io_proc_time + real(wp), intent(inout) :: time_avg, time_final + real(wp), intent(inout) :: io_time_avg, io_time_final + real(wp), dimension(:), intent(inout) :: proc_time + real(wp), dimension(:), intent(inout) :: io_proc_time logical, intent(inout) :: file_exists - real(kind(0d0)), intent(inout) :: start, finish + real(wp), intent(inout) :: start, finish integer, intent(inout) :: nt - real(kind(0d0)) :: grind_time + real(wp) :: grind_time call s_mpi_barrier() @@ -1302,8 +1305,8 @@ contains end if if (proc_rank == 0) then - time_final = 0d0 - io_time_final = 0d0 + time_final = 0._wp + io_time_final = 0._wp if (num_procs == 1) then time_final = time_avg io_time_final = io_time_avg @@ -1312,7 +1315,7 @@ contains io_time_final = maxval(io_proc_time) end if - grind_time = time_final*1.0d9/(sys_size*maxval((/1,m_glb/))*maxval((/1,n_glb/))*maxval((/1,p_glb/))) + grind_time = time_final*1.0e9_wp/(sys_size*maxval((/1,m_glb/))*maxval((/1,n_glb/))*maxval((/1,p_glb/))) print *, "Performance:", grind_time, "ns/gp/eq/rhs" inquire (FILE='time_data.dat', EXIST=file_exists) @@ -1344,7 +1347,7 @@ contains subroutine s_save_data(t_step, start, finish, io_time_avg, nt) integer, intent(inout) :: t_step - real(kind(0d0)), intent(inout) :: start, finish, io_time_avg + real(wp), intent(inout) :: start, finish, io_time_avg integer, intent(inout) :: nt integer :: i, j, k, l @@ -1408,9 +1411,9 @@ contains end if !Initialize pb based on surface tension for qbmm (polytropic) if (qbmm .and. polytropic .and. (.not. f_is_default(Web))) then - pb0 = pref + 2d0*fluid_pp(1)%ss/(R0*R0ref) + pb0 = pref + 2._wp*fluid_pp(1)%ss/(R0*R0ref) pb0 = pb0/pref - pref = 1d0 + pref = 1._wp end if #if defined(MFC_OpenACC) && defined(MFC_MEMORY_DUMP) @@ -1488,7 +1491,7 @@ contains subroutine s_initialize_mpi_domain integer :: ierr #ifdef MFC_OpenACC - real(kind(0d0)) :: starttime, endtime + real(wp) :: starttime, endtime integer :: num_devices, local_size, num_nodes, ppn, my_device_num integer :: dev, devNum, local_rank #ifdef MFC_MPI diff --git a/src/simulation/m_surface_tension.fpp b/src/simulation/m_surface_tension.fpp index 85176a99a..8a771a27c 100644 --- a/src/simulation/m_surface_tension.fpp +++ b/src/simulation/m_surface_tension.fpp @@ -36,7 +36,7 @@ module m_surface_tension !> @name cell boundary reconstructed gradient components and magnitude !> @{ - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: gL_x, gR_x, gL_y, gR_y, gL_z, gR_z + real(wp), allocatable, dimension(:, :, :, :) :: gL_x, gR_x, gL_y, gR_y, gL_z, gR_z !> @} !$acc declare create(gL_x, gR_x, gL_y, gR_y, gL_z, gR_z) @@ -74,18 +74,18 @@ contains id, isx, isy, isz) type(scalar_field), dimension(sys_size) :: q_prim_vf !> unused so unsure what intent to give it - real(kind(0d0)), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsx_vf - real(kind(0d0)), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsy_vf - real(kind(0d0)), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsz_vf + real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsx_vf + real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsy_vf + real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsz_vf type(scalar_field), & dimension(sys_size), & intent(inout) :: flux_src_vf integer, intent(in) :: id type(int_bounds_info), intent(in) :: isx, isy, isz - real(kind(0d0)), dimension(num_dims, num_dims) :: Omega - real(kind(0d0)) :: w1L, w1R, w2L, w2R, w3L, w3R, w1, w2, w3 - real(kind(0d0)) :: normWL, normWR, normW + real(wp), dimension(num_dims, num_dims) :: Omega + real(wp) :: w1L, w1R, w2L, w2R, w3L, w3R, w1, w2, w3 + real(wp) :: normWL, normWR, normW if (id == 1) then !$acc parallel loop collapse(3) gang vector default(present) private(Omega, & @@ -96,21 +96,21 @@ contains w1L = gL_x(j, k, l, 1) w2L = gL_x(j, k, l, 2) - w3L = 0d0 + w3L = 0._wp if (p > 0) w3L = gL_x(j, k, l, 3) w1R = gR_x(j + 1, k, l, 1) w2R = gR_x(j + 1, k, l, 2) - w3R = 0d0 + w3R = 0._wp if (p > 0) w3R = gR_x(j + 1, k, l, 3) normWL = gL_x(j, k, l, num_dims + 1) normWR = gR_x(j + 1, k, l, num_dims + 1) - w1 = (w1L + w1R)/2d0 - w2 = (w2L + w2R)/2d0 - w3 = (w3L + w3R)/2d0 - normW = (normWL + normWR)/2d0 + w1 = (w1L + w1R)/2._wp + w2 = (w2L + w2R)/2._wp + w3 = (w3L + w3R)/2._wp + normW = (normWL + normWR)/2._wp if (normW > capillary_cutoff) then @:compute_capilary_stress_tensor() @@ -142,21 +142,21 @@ contains w1L = gL_y(k, j, l, 1) w2L = gL_y(k, j, l, 2) - w3L = 0d0 + w3L = 0._wp if (p > 0) w3L = gL_y(k, j, l, 3) w1R = gR_y(k + 1, j, l, 1) w2R = gR_y(k + 1, j, l, 2) - w3R = 0d0 + w3R = 0._wp if (p > 0) w3R = gR_y(k + 1, j, l, 3) normWL = gL_y(k, j, l, num_dims + 1) normWR = gR_y(k + 1, j, l, num_dims + 1) - w1 = (w1L + w1R)/2d0 - w2 = (w2L + w2R)/2d0 - w3 = (w3L + w3R)/2d0 - normW = (normWL + normWR)/2d0 + w1 = (w1L + w1R)/2._wp + w2 = (w2L + w2R)/2._wp + w3 = (w3L + w3R)/2._wp + normW = (normWL + normWR)/2._wp if (normW > capillary_cutoff) then @:compute_capilary_stress_tensor() @@ -188,21 +188,21 @@ contains w1L = gL_z(l, k, j, 1) w2L = gL_z(l, k, j, 2) - w3L = 0d0 + w3L = 0._wp if (p > 0) w3L = gL_z(l, k, j, 3) w1R = gR_z(l + 1, k, j, 1) w2R = gR_z(l + 1, k, j, 2) - w3R = 0d0 + w3R = 0._wp if (p > 0) w3R = gR_z(l + 1, k, j, 3) normWL = gL_z(l, k, j, num_dims + 1) normWR = gR_z(l + 1, k, j, num_dims + 1) - w1 = (w1L + w1R)/2d0 - w2 = (w2L + w2R)/2d0 - w3 = (w3L + w3R)/2d0 - normW = (normWL + normWR)/2d0 + w1 = (w1L + w1R)/2._wp + w2 = (w2L + w2R)/2._wp + w3 = (w3L + w3R)/2._wp + normW = (normWL + normWR)/2._wp if (normW > capillary_cutoff) then @:compute_capilary_stress_tensor() @@ -245,7 +245,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(1)%sf(j, k, l) = 1d0/(x_cc(j + 1) - x_cc(j - 1))* & + c_divs(1)%sf(j, k, l) = 1._wp/(x_cc(j + 1) - x_cc(j - 1))* & (q_prim_vf(c_idx)%sf(j + 1, k, l) - q_prim_vf(c_idx)%sf(j - 1, k, l)) end do end do @@ -255,7 +255,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(2)%sf(j, k, l) = 1d0/(y_cc(k + 1) - y_cc(k - 1))* & + c_divs(2)%sf(j, k, l) = 1._wp/(y_cc(k + 1) - y_cc(k - 1))* & (q_prim_vf(c_idx)%sf(j, k + 1, l) - q_prim_vf(c_idx)%sf(j, k - 1, l)) end do end do @@ -266,7 +266,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(3)%sf(j, k, l) = 1d0/(z_cc(l + 1) - z_cc(l - 1))* & + c_divs(3)%sf(j, k, l) = 1._wp/(z_cc(l + 1) - z_cc(l - 1))* & (q_prim_vf(c_idx)%sf(j, k, l + 1) - q_prim_vf(c_idx)%sf(j, k, l - 1)) end do end do @@ -277,12 +277,12 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(num_dims + 1)%sf(j, k, l) = 0d0 + c_divs(num_dims + 1)%sf(j, k, l) = 0._wp !s$acc loop seq do i = 1, num_dims c_divs(num_dims + 1)%sf(j, k, l) = & c_divs(num_dims + 1)%sf(j, k, l) + & - c_divs(i)%sf(j, k, l)**2d0 + c_divs(i)%sf(j, k, l)**2._wp end do c_divs(num_dims + 1)%sf(j, k, l) = & sqrt(c_divs(num_dims + 1)%sf(j, k, l)) @@ -306,8 +306,8 @@ contains type(scalar_field), dimension(iv%beg:iv%end), intent(in) :: v_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, iv%beg:), intent(out) :: vL_x, vL_y, vL_z - real(kind(0d0)), dimension(startx:, starty:, startz:, iv%beg:), intent(out) :: vR_x, vR_y, vR_z + real(wp), dimension(startx:, starty:, startz:, iv%beg:), intent(out) :: vL_x, vL_y, vL_z + real(wp), dimension(startx:, starty:, startz:, iv%beg:), intent(out) :: vR_x, vR_y, vR_z integer, intent(in) :: norm_dir integer :: recon_dir !< Coordinate direction of the WENO reconstruction diff --git a/src/simulation/m_time_steppers.fpp b/src/simulation/m_time_steppers.fpp index b78a88439..15b08a3cb 100644 --- a/src/simulation/m_time_steppers.fpp +++ b/src/simulation/m_time_steppers.fpp @@ -17,7 +17,7 @@ module m_time_steppers use m_global_parameters !< Definitions of the global parameters - use m_rhs !< Right-hand-side (RHS) evaluation procedures + use m_rhs !< Right-hane-side (RHS) evaluation procedures use m_data_output !< Run-time info & solution data output procedures @@ -56,11 +56,11 @@ module m_time_steppers type(vector_field), allocatable, dimension(:) :: q_prim_ts !< !! Cell-average primitive variables at consecutive TIMESTEPS - real(kind(0d0)), allocatable, dimension(:, :, :, :, :) :: rhs_pb + real(wp), allocatable, dimension(:, :, :, :, :) :: rhs_pb - real(kind(0d0)), allocatable, dimension(:, :, :, :, :) :: rhs_mv + real(wp), allocatable, dimension(:, :, :, :, :) :: rhs_mv - real(kind(0d0)), allocatable, dimension(:, :, :) :: max_dt + real(wp), allocatable, dimension(:, :, :) :: max_dt integer, private :: num_ts !< !! Number of time stages in the time-stepping scheme @@ -274,7 +274,7 @@ contains subroutine s_1st_order_tvd_rk(t_step, time_avg) integer, intent(in) :: t_step - real(kind(0d0)), intent(inout) :: time_avg + real(wp), intent(inout) :: time_avg integer :: i, j, k, l, q !< Generic loop iterator @@ -379,10 +379,10 @@ contains subroutine s_2nd_order_tvd_rk(t_step, time_avg) integer, intent(in) :: t_step - real(kind(0d0)), intent(inout) :: time_avg + real(wp), intent(inout) :: time_avg integer :: i, j, k, l, q!< Generic loop iterator - real(kind(0d0)) :: start, finish + real(wp) :: start, finish ! Stage 1 of 2 ===================================================== @@ -485,7 +485,7 @@ contains q_cons_ts(1)%vf(i)%sf(j, k, l) = & (q_cons_ts(1)%vf(i)%sf(j, k, l) & + q_cons_ts(2)%vf(i)%sf(j, k, l) & - + dt*rhs_vf(i)%sf(j, k, l))/2d0 + + dt*rhs_vf(i)%sf(j, k, l))/2._wp end do end do end do @@ -501,7 +501,7 @@ contains pb_ts(1)%sf(j, k, l, q, i) = & (pb_ts(1)%sf(j, k, l, q, i) & + pb_ts(2)%sf(j, k, l, q, i) & - + dt*rhs_pb(j, k, l, q, i))/2d0 + + dt*rhs_pb(j, k, l, q, i))/2._wp end do end do end do @@ -519,7 +519,7 @@ contains mv_ts(1)%sf(j, k, l, q, i) = & (mv_ts(1)%sf(j, k, l, q, i) & + mv_ts(2)%sf(j, k, l, q, i) & - + dt*rhs_mv(j, k, l, q, i))/2d0 + + dt*rhs_mv(j, k, l, q, i))/2._wp end do end do end do @@ -527,7 +527,7 @@ contains end do end if - if (bodyForces) call s_apply_bodyforces(q_cons_ts(1)%vf, q_prim_vf, rhs_vf, 2d0*dt/3d0) + if (bodyForces) call s_apply_bodyforces(q_cons_ts(1)%vf, q_prim_vf, rhs_vf, 2._wp*dt/3._wp) if (grid_geometry == 3) call s_apply_fourier_filter(q_cons_ts(1)%vf) @@ -557,10 +557,11 @@ contains subroutine s_3rd_order_tvd_rk(t_step, time_avg) ! -------------------------------- integer, intent(IN) :: t_step - real(kind(0d0)), intent(INOUT) :: time_avg + real(wp), intent(INOUT) :: time_avg integer :: i, j, k, l, q !< Generic loop iterator - real(kind(0d0)) :: start, finish + + real(wp) :: start, finish ! Stage 1 of 3 ===================================================== @@ -662,9 +663,9 @@ contains do k = 0, n do j = 0, m q_cons_ts(2)%vf(i)%sf(j, k, l) = & - (3d0*q_cons_ts(1)%vf(i)%sf(j, k, l) & + (3._wp*q_cons_ts(1)%vf(i)%sf(j, k, l) & + q_cons_ts(2)%vf(i)%sf(j, k, l) & - + dt*rhs_vf(i)%sf(j, k, l))/4d0 + + dt*rhs_vf(i)%sf(j, k, l))/4._wp end do end do end do @@ -678,9 +679,9 @@ contains do j = 0, m do q = 1, nnode pb_ts(2)%sf(j, k, l, q, i) = & - (3d0*pb_ts(1)%sf(j, k, l, q, i) & + (3._wp*pb_ts(1)%sf(j, k, l, q, i) & + pb_ts(2)%sf(j, k, l, q, i) & - + dt*rhs_pb(j, k, l, q, i))/4d0 + + dt*rhs_pb(j, k, l, q, i))/4._wp end do end do end do @@ -696,9 +697,9 @@ contains do j = 0, m do q = 1, nnode mv_ts(2)%sf(j, k, l, q, i) = & - (3d0*mv_ts(1)%sf(j, k, l, q, i) & + (3._wp*mv_ts(1)%sf(j, k, l, q, i) & + mv_ts(2)%sf(j, k, l, q, i) & - + dt*rhs_mv(j, k, l, q, i))/4d0 + + dt*rhs_mv(j, k, l, q, i))/4._wp end do end do end do @@ -706,7 +707,7 @@ contains end do end if - if (bodyForces) call s_apply_bodyforces(q_cons_ts(2)%vf, q_prim_vf, rhs_vf, dt/4d0) + if (bodyForces) call s_apply_bodyforces(q_cons_ts(2)%vf, q_prim_vf, rhs_vf, dt/4._wp) if (grid_geometry == 3) call s_apply_fourier_filter(q_cons_ts(2)%vf) @@ -735,8 +736,8 @@ contains do j = 0, m q_cons_ts(1)%vf(i)%sf(j, k, l) = & (q_cons_ts(1)%vf(i)%sf(j, k, l) & - + 2d0*q_cons_ts(2)%vf(i)%sf(j, k, l) & - + 2d0*dt*rhs_vf(i)%sf(j, k, l))/3d0 + + 2._wp*q_cons_ts(2)%vf(i)%sf(j, k, l) & + + 2._wp*dt*rhs_vf(i)%sf(j, k, l))/3._wp end do end do end do @@ -751,8 +752,8 @@ contains do q = 1, nnode pb_ts(1)%sf(j, k, l, q, i) = & (pb_ts(1)%sf(j, k, l, q, i) & - + 2d0*pb_ts(2)%sf(j, k, l, q, i) & - + 2d0*dt*rhs_pb(j, k, l, q, i))/3d0 + + 2._wp*pb_ts(2)%sf(j, k, l, q, i) & + + 2._wp*dt*rhs_pb(j, k, l, q, i))/3._wp end do end do end do @@ -769,8 +770,8 @@ contains do q = 1, nnode mv_ts(1)%sf(j, k, l, q, i) = & (mv_ts(1)%sf(j, k, l, q, i) & - + 2d0*mv_ts(2)%sf(j, k, l, q, i) & - + 2d0*dt*rhs_mv(j, k, l, q, i))/3d0 + + 2._wp*mv_ts(2)%sf(j, k, l, q, i) & + + 2._wp*dt*rhs_mv(j, k, l, q, i))/3._wp end do end do end do @@ -778,7 +779,7 @@ contains end do end if - if (bodyForces) call s_apply_bodyforces(q_cons_ts(1)%vf, q_prim_vf, rhs_vf, 2d0*dt/3d0) + if (bodyForces) call s_apply_bodyforces(q_cons_ts(1)%vf, q_prim_vf, rhs_vf, 2._wp*dt/3._wp) if (grid_geometry == 3) call s_apply_fourier_filter(q_cons_ts(1)%vf) @@ -813,9 +814,9 @@ contains subroutine s_strang_splitting(t_step, time_avg) integer, intent(in) :: t_step - real(kind(0d0)), intent(inout) :: time_avg + real(wp), intent(inout) :: time_avg - real(kind(0d0)) :: start, finish + real(wp) :: start, finish call cpu_time(start) @@ -862,18 +863,19 @@ contains subroutine s_compute_dt() - real(kind(0d0)) :: rho !< Cell-avg. density - real(kind(0d0)), dimension(num_dims) :: vel !< Cell-avg. velocity - real(kind(0d0)) :: vel_sum !< Cell-avg. velocity sum - real(kind(0d0)) :: pres !< Cell-avg. pressure - real(kind(0d0)), dimension(num_fluids) :: alpha !< Cell-avg. volume fraction - real(kind(0d0)) :: gamma !< Cell-avg. sp. heat ratio - real(kind(0d0)) :: pi_inf !< Cell-avg. liquid stiffness function - real(kind(0d0)) :: c !< Cell-avg. sound speed - real(kind(0d0)) :: H !< Cell-avg. enthalpy - real(kind(0d0)), dimension(2) :: Re !< Cell-avg. Reynolds numbers + real(wp) :: rho !< Cell-avg. density + real(wp), dimension(num_dims) :: vel !< Cell-avg. velocity + real(wp) :: vel_sum !< Cell-avg. velocity sum + real(wp) :: pres !< Cell-avg. pressure + real(wp), dimension(num_fluids) :: alpha !< Cell-avg. volume fraction + real(wp) :: gamma !< Cell-avg. sp. heat ratio + real(wp) :: pi_inf !< Cell-avg. liquid stiffness function + real(wp) :: c !< Cell-avg. sound speed + real(wp) :: H !< Cell-avg. enthalpy + real(wp), dimension(2) :: Re !< Cell-avg. Reynolds numbers type(vector_field) :: gm_alpha_qp - real(kind(0d0)) :: dt_local + + real(wp) :: dt_local integer :: j, k, l !< Generic loop iterators call s_convert_conservative_to_primitive_variables( & @@ -889,7 +891,7 @@ contains call s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha, vel, vel_sum, j, k, l) ! Compute mixture sound speed - call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0d0, c) + call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, alpha, vel_sum, 0._wp, c) call s_compute_dt_from_cfl(vel, c, max_dt, rho, Re, j, k, l) end do @@ -918,7 +920,7 @@ contains type(scalar_field), dimension(1:sys_size), intent(in) :: q_prim_vf type(scalar_field), dimension(1:sys_size), intent(inout) :: rhs_vf - real(kind(0d0)), intent(in) :: ldt !< local dt + real(wp), intent(in) :: ldt !< local dt integer :: i, j, k, l diff --git a/src/simulation/m_viscous.fpp b/src/simulation/m_viscous.fpp index afe909ca5..a09c6384b 100644 --- a/src/simulation/m_viscous.fpp +++ b/src/simulation/m_viscous.fpp @@ -28,7 +28,7 @@ module m_viscous type(int_bounds_info) :: is1_viscous, is2_viscous, is3_viscous !$acc declare create(is1_viscous, is2_viscous, is3_viscous, iv) - real(kind(0d0)), allocatable, dimension(:, :) :: Res_viscous + real(wp), allocatable, dimension(:, :) :: Res_viscous !$acc declare create(Res_viscous) contains @@ -67,11 +67,11 @@ contains type(scalar_field), dimension(1:sys_size), intent(inout) :: tau_Re_vf type(int_bounds_info), intent(in) :: ix, iy, iz - real(kind(0d0)) :: rho_visc, gamma_visc, pi_inf_visc, alpha_visc_sum !< Mixture variables - real(kind(0d0)), dimension(2) :: Re_visc - real(kind(0d0)), dimension(num_fluids) :: alpha_visc, alpha_rho_visc + real(wp) :: rho_visc, gamma_visc, pi_inf_visc, alpha_visc_sum !< Mixture variables + real(wp), dimension(2) :: Re_visc + real(wp), dimension(num_fluids) :: alpha_visc, alpha_rho_visc - real(kind(0d0)), dimension(num_dims, num_dims) :: tau_Re + real(wp), dimension(num_dims, num_dims) :: tau_Re integer :: i, j, k, l, q !< Generic loop iterator @@ -85,7 +85,7 @@ contains do j = is1_viscous%beg, is1_viscous%end !$acc loop seq do i = momxb, E_idx - tau_Re_vf(i)%sf(j, k, l) = 0d0 + tau_Re_vf(i)%sf(j, k, l) = 0._wp end do end do end do @@ -100,16 +100,16 @@ contains do i = 1, num_fluids alpha_rho_visc(i) = q_prim_vf(i)%sf(j, k, l) if (bubbles .and. num_fluids == 1) then - alpha_visc(i) = 1d0 - q_prim_vf(E_idx + i)%sf(j, k, l) + alpha_visc(i) = 1._wp - q_prim_vf(E_idx + i)%sf(j, k, l) else alpha_visc(i) = q_prim_vf(E_idx + i)%sf(j, k, l) end if end do if (bubbles) then - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then !$acc loop seq @@ -131,17 +131,17 @@ contains pi_inf_visc = pi_infs(1) end if else - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp - alpha_visc_sum = 0d0 + alpha_visc_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho_visc(i) = max(0d0, alpha_rho_visc(i)) - alpha_visc(i) = min(max(0d0, alpha_visc(i)), 1d0) + alpha_rho_visc(i) = max(0._wp, alpha_rho_visc(i)) + alpha_visc(i) = min(max(0._wp, alpha_visc(i)), 1._wp) alpha_visc_sum = alpha_visc_sum + alpha_visc(i) end do @@ -161,14 +161,14 @@ contains do i = 1, 2 Re_visc(i) = dflt_real - if (Re_size(i) > 0) Re_visc(i) = 0d0 + if (Re_size(i) > 0) Re_visc(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) Re_visc(i) = alpha_visc(Re_idx(i, q))/Res_viscous(i, q) & + Re_visc(i) end do - Re_visc(i) = 1d0/max(Re_visc(i), sgm_eps) + Re_visc(i) = 1._wp/max(Re_visc(i), sgm_eps) end do end if @@ -178,10 +178,10 @@ contains grad_x_vf(2)%sf(j, k, l))/ & Re_visc(1) - tau_Re(2, 2) = (4d0*grad_y_vf(2)%sf(j, k, l) & - - 2d0*grad_x_vf(1)%sf(j, k, l) & - - 2d0*q_prim_vf(momxb + 1)%sf(j, k, l)/y_cc(k))/ & - (3d0*Re_visc(1)) + tau_Re(2, 2) = (4._wp*grad_y_vf(2)%sf(j, k, l) & + - 2._wp*grad_x_vf(1)%sf(j, k, l) & + - 2._wp*q_prim_vf(momxb + 1)%sf(j, k, l)/y_cc(k))/ & + (3._wp*Re_visc(1)) !$acc loop seq do i = 1, 2 tau_Re_vf(contxe + i)%sf(j, k, l) = & @@ -207,16 +207,16 @@ contains do i = 1, num_fluids alpha_rho_visc(i) = q_prim_vf(i)%sf(j, k, l) if (bubbles .and. num_fluids == 1) then - alpha_visc(i) = 1d0 - q_prim_vf(E_idx + i)%sf(j, k, l) + alpha_visc(i) = 1._wp - q_prim_vf(E_idx + i)%sf(j, k, l) else alpha_visc(i) = q_prim_vf(E_idx + i)%sf(j, k, l) end if end do if (bubbles) then - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then !$acc loop seq @@ -238,17 +238,17 @@ contains pi_inf_visc = pi_infs(1) end if else - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp - alpha_visc_sum = 0d0 + alpha_visc_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho_visc(i) = max(0d0, alpha_rho_visc(i)) - alpha_visc(i) = min(max(0d0, alpha_visc(i)), 1d0) + alpha_rho_visc(i) = max(0._wp, alpha_rho_visc(i)) + alpha_visc(i) = min(max(0._wp, alpha_visc(i)), 1._wp) alpha_visc_sum = alpha_visc_sum + alpha_visc(i) end do @@ -268,14 +268,14 @@ contains do i = 1, 2 Re_visc(i) = dflt_real - if (Re_size(i) > 0) Re_visc(i) = 0d0 + if (Re_size(i) > 0) Re_visc(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) Re_visc(i) = alpha_visc(Re_idx(i, q))/Res_viscous(i, q) & + Re_visc(i) end do - Re_visc(i) = 1d0/max(Re_visc(i), sgm_eps) + Re_visc(i) = 1._wp/max(Re_visc(i), sgm_eps) end do end if @@ -311,16 +311,16 @@ contains do i = 1, num_fluids alpha_rho_visc(i) = q_prim_vf(i)%sf(j, k, l) if (bubbles .and. num_fluids == 1) then - alpha_visc(i) = 1d0 - q_prim_vf(E_idx + i)%sf(j, k, l) + alpha_visc(i) = 1._wp - q_prim_vf(E_idx + i)%sf(j, k, l) else alpha_visc(i) = q_prim_vf(E_idx + i)%sf(j, k, l) end if end do if (bubbles) then - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then !$acc loop seq @@ -342,17 +342,17 @@ contains pi_inf_visc = pi_infs(1) end if else - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp - alpha_visc_sum = 0d0 + alpha_visc_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho_visc(i) = max(0d0, alpha_rho_visc(i)) - alpha_visc(i) = min(max(0d0, alpha_visc(i)), 1d0) + alpha_rho_visc(i) = max(0._wp, alpha_rho_visc(i)) + alpha_visc(i) = min(max(0._wp, alpha_visc(i)), 1._wp) alpha_visc_sum = alpha_visc_sum + alpha_visc(i) end do @@ -372,20 +372,20 @@ contains do i = 1, 2 Re_visc(i) = dflt_real - if (Re_size(i) > 0) Re_visc(i) = 0d0 + if (Re_size(i) > 0) Re_visc(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) Re_visc(i) = alpha_visc(Re_idx(i, q))/Res_viscous(i, q) & + Re_visc(i) end do - Re_visc(i) = 1d0/max(Re_visc(i), sgm_eps) + Re_visc(i) = 1._wp/max(Re_visc(i), sgm_eps) end do end if end if - tau_Re(2, 2) = -(2d0/3d0)*grad_z_vf(3)%sf(j, k, l)/y_cc(k)/ & + tau_Re(2, 2) = -(2._wp/3._wp)*grad_z_vf(3)%sf(j, k, l)/y_cc(k)/ & Re_visc(1) tau_Re(2, 3) = ((grad_z_vf(2)%sf(j, k, l) - & @@ -419,16 +419,16 @@ contains do i = 1, num_fluids alpha_rho_visc(i) = q_prim_vf(i)%sf(j, k, l) if (bubbles .and. num_fluids == 1) then - alpha_visc(i) = 1d0 - q_prim_vf(E_idx + i)%sf(j, k, l) + alpha_visc(i) = 1._wp - q_prim_vf(E_idx + i)%sf(j, k, l) else alpha_visc(i) = q_prim_vf(E_idx + i)%sf(j, k, l) end if end do if (bubbles) then - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp if (mpp_lim .and. (model_eqns == 2) .and. (num_fluids > 2)) then !$acc loop seq @@ -450,17 +450,17 @@ contains pi_inf_visc = pi_infs(1) end if else - rho_visc = 0d0 - gamma_visc = 0d0 - pi_inf_visc = 0d0 + rho_visc = 0._wp + gamma_visc = 0._wp + pi_inf_visc = 0._wp - alpha_visc_sum = 0d0 + alpha_visc_sum = 0._wp if (mpp_lim) then !$acc loop seq do i = 1, num_fluids - alpha_rho_visc(i) = max(0d0, alpha_rho_visc(i)) - alpha_visc(i) = min(max(0d0, alpha_visc(i)), 1d0) + alpha_rho_visc(i) = max(0._wp, alpha_rho_visc(i)) + alpha_visc(i) = min(max(0._wp, alpha_visc(i)), 1._wp) alpha_visc_sum = alpha_visc_sum + alpha_visc(i) end do @@ -480,14 +480,14 @@ contains do i = 1, 2 Re_visc(i) = dflt_real - if (Re_size(i) > 0) Re_visc(i) = 0d0 + if (Re_size(i) > 0) Re_visc(i) = 0._wp !$acc loop seq do q = 1, Re_size(i) Re_visc(i) = alpha_visc(Re_idx(i, q))/Res_viscous(i, q) & + Re_visc(i) end do - Re_visc(i) = 1d0/max(Re_visc(i), sgm_eps) + Re_visc(i) = 1._wp/max(Re_visc(i), sgm_eps) end do end if @@ -524,7 +524,7 @@ contains dq_prim_dx_qp, dq_prim_dy_qp, dq_prim_dz_qp, & ix, iy, iz) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), & + real(wp), dimension(startx:, starty:, startz:, 1:), & intent(inout) :: qL_prim_rsx_vf, qR_prim_rsx_vf, & qL_prim_rsy_vf, qR_prim_rsy_vf, & qL_prim_rsz_vf, qR_prim_rsz_vf @@ -665,7 +665,7 @@ contains dqL_prim_dx_n(1)%vf(i)%sf(k, j - 1, l) + & dqR_prim_dx_n(1)%vf(i)%sf(k, j - 1, l)) - dqL_prim_dx_n(2)%vf(i)%sf(k, j, l) = 25d-2* & + dqL_prim_dx_n(2)%vf(i)%sf(k, j, l) = 25e-2_wp* & dqL_prim_dx_n(2)%vf(i)%sf(k, j, l) end do end do @@ -684,7 +684,7 @@ contains dqL_prim_dx_n(1)%vf(i)%sf(k, j, l) + & dqR_prim_dx_n(1)%vf(i)%sf(k, j, l)) - dqR_prim_dx_n(2)%vf(i)%sf(k, j, l) = 25d-2* & + dqR_prim_dx_n(2)%vf(i)%sf(k, j, l) = 25e-2_wp* & dqR_prim_dx_n(2)%vf(i)%sf(k, j, l) end do @@ -704,7 +704,7 @@ contains dqL_prim_dy_n(2)%vf(i)%sf(j - 1, k, l) + & dqR_prim_dy_n(2)%vf(i)%sf(j - 1, k, l)) - dqL_prim_dy_n(1)%vf(i)%sf(j, k, l) = 25d-2* & + dqL_prim_dy_n(1)%vf(i)%sf(j, k, l) = 25e-2_wp* & dqL_prim_dy_n(1)%vf(i)%sf(j, k, l) end do @@ -724,7 +724,7 @@ contains dqL_prim_dy_n(2)%vf(i)%sf(j, k, l) + & dqR_prim_dy_n(2)%vf(i)%sf(j, k, l)) - dqR_prim_dy_n(1)%vf(i)%sf(j, k, l) = 25d-2* & + dqR_prim_dy_n(1)%vf(i)%sf(j, k, l) = 25e-2_wp* & dqR_prim_dy_n(1)%vf(i)%sf(j, k, l) end do @@ -779,7 +779,7 @@ contains dqL_prim_dz_n(3)%vf(i)%sf(j - 1, k, l) + & dqR_prim_dz_n(3)%vf(i)%sf(j - 1, k, l)) - dqL_prim_dz_n(1)%vf(i)%sf(j, k, l) = 25d-2* & + dqL_prim_dz_n(1)%vf(i)%sf(j, k, l) = 25e-2_wp* & dqL_prim_dz_n(1)%vf(i)%sf(j, k, l) end do @@ -800,7 +800,7 @@ contains dqL_prim_dz_n(3)%vf(i)%sf(j, k, l) + & dqR_prim_dz_n(3)%vf(i)%sf(j, k, l)) - dqR_prim_dz_n(1)%vf(i)%sf(j, k, l) = 25d-2* & + dqR_prim_dz_n(1)%vf(i)%sf(j, k, l) = 25e-2_wp* & dqR_prim_dz_n(1)%vf(i)%sf(j, k, l) end do @@ -821,7 +821,7 @@ contains dqL_prim_dz_n(3)%vf(i)%sf(k, j - 1, l) + & dqR_prim_dz_n(3)%vf(i)%sf(k, j - 1, l)) - dqL_prim_dz_n(2)%vf(i)%sf(k, j, l) = 25d-2* & + dqL_prim_dz_n(2)%vf(i)%sf(k, j, l) = 25e-2_wp* & dqL_prim_dz_n(2)%vf(i)%sf(k, j, l) end do @@ -842,7 +842,7 @@ contains dqL_prim_dz_n(3)%vf(i)%sf(k, j, l) + & dqR_prim_dz_n(3)%vf(i)%sf(k, j, l)) - dqR_prim_dz_n(2)%vf(i)%sf(k, j, l) = 25d-2* & + dqR_prim_dz_n(2)%vf(i)%sf(k, j, l) = 25e-2_wp* & dqR_prim_dz_n(2)%vf(i)%sf(k, j, l) end do @@ -863,7 +863,7 @@ contains dqL_prim_dy_n(2)%vf(i)%sf(k, l, j - 1) + & dqR_prim_dy_n(2)%vf(i)%sf(k, l, j - 1)) - dqL_prim_dy_n(3)%vf(i)%sf(k, l, j) = 25d-2* & + dqL_prim_dy_n(3)%vf(i)%sf(k, l, j) = 25e-2_wp* & dqL_prim_dy_n(3)%vf(i)%sf(k, l, j) end do @@ -884,7 +884,7 @@ contains dqL_prim_dy_n(2)%vf(i)%sf(k, l, j) + & dqR_prim_dy_n(2)%vf(i)%sf(k, l, j)) - dqR_prim_dy_n(3)%vf(i)%sf(k, l, j) = 25d-2* & + dqR_prim_dy_n(3)%vf(i)%sf(k, l, j) = 25e-2_wp* & dqR_prim_dy_n(3)%vf(i)%sf(k, l, j) end do @@ -904,7 +904,7 @@ contains dqL_prim_dx_n(1)%vf(i)%sf(k, l, j - 1) + & dqR_prim_dx_n(1)%vf(i)%sf(k, l, j - 1)) - dqL_prim_dx_n(3)%vf(i)%sf(k, l, j) = 25d-2* & + dqL_prim_dx_n(3)%vf(i)%sf(k, l, j) = 25e-2_wp* & dqL_prim_dx_n(3)%vf(i)%sf(k, l, j) end do @@ -923,7 +923,7 @@ contains dqL_prim_dx_n(1)%vf(i)%sf(k, l, j) + & dqR_prim_dx_n(1)%vf(i)%sf(k, l, j)) - dqR_prim_dx_n(3)%vf(i)%sf(k, l, j) = 25d-2* & + dqR_prim_dx_n(3)%vf(i)%sf(k, l, j) = 25e-2_wp* & dqR_prim_dx_n(3)%vf(i)%sf(k, l, j) end do @@ -970,7 +970,7 @@ contains type(scalar_field), dimension(iv%beg:iv%end), intent(in) :: v_vf type(scalar_field), dimension(iv%beg:iv%end), intent(inout) :: vL_prim_vf, vR_prim_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z, vR_x, vR_y, vR_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_x, vL_y, vL_z, vR_x, vR_y, vR_z integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz @@ -1068,7 +1068,7 @@ contains norm_dir, vL_prim_vf, vR_prim_vf, ix, iy, iz) type(scalar_field), dimension(iv%beg:iv%end), intent(in) :: v_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, iv%beg:), intent(inout) :: vL_x, vL_y, vL_z, vR_x, vR_y, vR_z + real(wp), dimension(startx:, starty:, startz:, iv%beg:), intent(inout) :: vL_x, vL_y, vL_z, vR_x, vR_y, vR_z type(scalar_field), dimension(iv%beg:iv%end), intent(inout) :: vL_prim_vf, vR_prim_vf type(int_bounds_info), intent(in) :: ix, iy, iz @@ -1191,7 +1191,7 @@ contains integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz, iv_in integer, intent(in) :: dim, buff_size_in - real(kind(0d0)), dimension(-buff_size_in:dim + buff_size_in), intent(in) :: dL + real(wp), dimension(-buff_size_in:dim + buff_size_in), intent(in) :: dL integer :: i, j, k, l !< Generic loop iterators @@ -1218,7 +1218,7 @@ contains !$acc loop seq do i = iv%beg, iv%end dv_ds_vf(i)%sf(j, k, l) = & - 1d0/((1d0 + wa_flg)*dL(j)) & + 1._wp/((1._wp + wa_flg)*dL(j)) & *(wa_flg*vL_vf(i)%sf(j + 1, k, l) & + vR_vf(i)%sf(j, k, l) & - vL_vf(i)%sf(j, k, l) & @@ -1246,7 +1246,7 @@ contains !$acc loop seq do i = iv%beg, iv%end dv_ds_vf(i)%sf(j, k, l) = & - 1d0/((1d0 + wa_flg)*dL(k)) & + 1._wp/((1._wp + wa_flg)*dL(k)) & *(wa_flg*vL_vf(i)%sf(j, k + 1, l) & + vR_vf(i)%sf(j, k, l) & - vL_vf(i)%sf(j, k, l) & @@ -1274,7 +1274,7 @@ contains !$acc loop seq do i = iv%beg, iv%end dv_ds_vf(i)%sf(j, k, l) = & - 1d0/((1d0 + wa_flg)*dL(l)) & + 1._wp/((1._wp + wa_flg)*dL(l)) & *(wa_flg*vL_vf(i)%sf(j, k, l + 1) & + vR_vf(i)%sf(j, k, l) & - vL_vf(i)%sf(j, k, l) & @@ -1363,10 +1363,10 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end grad_x%sf(idwbuff(1)%beg, k, l) = & - (-3d0*var%sf(idwbuff(1)%beg, k, l) + 4d0*var%sf(idwbuff(1)%beg + 1, k, l) - var%sf(idwbuff(1)%beg + 2, k, l))/ & + (-3._wp*var%sf(idwbuff(1)%beg, k, l) + 4._wp*var%sf(idwbuff(1)%beg + 1, k, l) - var%sf(idwbuff(1)%beg + 2, k, l))/ & (x_cc(idwbuff(1)%beg + 2) - x_cc(idwbuff(1)%beg)) grad_x%sf(idwbuff(1)%end, k, l) = & - (+3d0*var%sf(idwbuff(1)%end, k, l) - 4d0*var%sf(idwbuff(1)%end - 1, k, l) + var%sf(idwbuff(1)%end - 2, k, l))/ & + (+3._wp*var%sf(idwbuff(1)%end, k, l) - 4._wp*var%sf(idwbuff(1)%end - 1, k, l) + var%sf(idwbuff(1)%end - 2, k, l))/ & (x_cc(idwbuff(1)%end) - x_cc(idwbuff(1)%end - 2)) end do end do @@ -1375,10 +1375,10 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_y%sf(j, idwbuff(2)%beg, l) = & - (-3d0*var%sf(j, idwbuff(2)%beg, l) + 4d0*var%sf(j, idwbuff(2)%beg + 1, l) - var%sf(j, idwbuff(2)%beg + 2, l))/ & + (-3._wp*var%sf(j, idwbuff(2)%beg, l) + 4._wp*var%sf(j, idwbuff(2)%beg + 1, l) - var%sf(j, idwbuff(2)%beg + 2, l))/ & (y_cc(idwbuff(2)%beg + 2) - y_cc(idwbuff(2)%beg)) grad_y%sf(j, idwbuff(2)%end, l) = & - (+3d0*var%sf(j, idwbuff(2)%end, l) - 4d0*var%sf(j, idwbuff(2)%end - 1, l) + var%sf(j, idwbuff(2)%end - 2, l))/ & + (+3._wp*var%sf(j, idwbuff(2)%end, l) - 4._wp*var%sf(j, idwbuff(2)%end - 1, l) + var%sf(j, idwbuff(2)%end - 2, l))/ & (y_cc(idwbuff(2)%end) - y_cc(idwbuff(2)%end - 2)) end do end do @@ -1387,10 +1387,10 @@ contains do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, idwbuff(3)%beg) = & - (-3d0*var%sf(j, k, idwbuff(3)%beg) + 4d0*var%sf(j, k, idwbuff(3)%beg + 1) - var%sf(j, k, idwbuff(3)%beg + 2))/ & + (-3._wp*var%sf(j, k, idwbuff(3)%beg) + 4._wp*var%sf(j, k, idwbuff(3)%beg + 1) - var%sf(j, k, idwbuff(3)%beg + 2))/ & (z_cc(idwbuff(3)%beg + 2) - z_cc(is3_viscous%beg)) grad_z%sf(j, k, idwbuff(3)%end) = & - (+3d0*var%sf(j, k, idwbuff(3)%end) - 4d0*var%sf(j, k, idwbuff(3)%end - 1) + var%sf(j, k, idwbuff(3)%end - 2))/ & + (+3._wp*var%sf(j, k, idwbuff(3)%end) - 4._wp*var%sf(j, k, idwbuff(3)%end - 1) + var%sf(j, k, idwbuff(3)%end - 2))/ & (z_cc(idwbuff(3)%end) - z_cc(idwbuff(3)%end - 2)) end do end do @@ -1401,7 +1401,7 @@ contains !$acc parallel loop collapse(2) gang vector default(present) do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end - grad_x%sf(0, k, l) = (-3d0*var%sf(0, k, l) + 4d0*var%sf(1, k, l) - var%sf(2, k, l))/ & + grad_x%sf(0, k, l) = (-3._wp*var%sf(0, k, l) + 4._wp*var%sf(1, k, l) - var%sf(2, k, l))/ & (x_cc(2) - x_cc(0)) end do end do @@ -1410,7 +1410,7 @@ contains !$acc parallel loop collapse(2) gang vector default(present) do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end - grad_x%sf(m, k, l) = (3d0*var%sf(m, k, l) - 4d0*var%sf(m - 1, k, l) + var%sf(m - 2, k, l))/ & + grad_x%sf(m, k, l) = (3._wp*var%sf(m, k, l) - 4._wp*var%sf(m - 1, k, l) + var%sf(m - 2, k, l))/ & (x_cc(m) - x_cc(m - 2)) end do end do @@ -1420,7 +1420,7 @@ contains !$acc parallel loop collapse(2) gang vector default(present) do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end - grad_y%sf(j, 0, l) = (-3d0*var%sf(j, 0, l) + 4d0*var%sf(j, 1, l) - var%sf(j, 2, l))/ & + grad_y%sf(j, 0, l) = (-3._wp*var%sf(j, 0, l) + 4._wp*var%sf(j, 1, l) - var%sf(j, 2, l))/ & (y_cc(2) - y_cc(0)) end do end do @@ -1429,7 +1429,7 @@ contains !$acc parallel loop collapse(2) gang vector default(present) do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end - grad_y%sf(j, n, l) = (3d0*var%sf(j, n, l) - 4d0*var%sf(j, n - 1, l) + var%sf(j, n - 2, l))/ & + grad_y%sf(j, n, l) = (3._wp*var%sf(j, n, l) - 4._wp*var%sf(j, n - 1, l) + var%sf(j, n - 2, l))/ & (y_cc(n) - y_cc(n - 2)) end do end do @@ -1440,7 +1440,7 @@ contains do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, 0) = & - (-3d0*var%sf(j, k, 0) + 4d0*var%sf(j, k, 1) - var%sf(j, k, 2))/ & + (-3._wp*var%sf(j, k, 0) + 4._wp*var%sf(j, k, 1) - var%sf(j, k, 2))/ & (z_cc(2) - z_cc(0)) end do end do @@ -1450,7 +1450,7 @@ contains do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, p) = & - (3d0*var%sf(j, k, p) - 4d0*var%sf(j, k, p - 1) + var%sf(j, k, p - 2))/ & + (3._wp*var%sf(j, k, p) - 4._wp*var%sf(j, k, p - 1) + var%sf(j, k, p - 2))/ & (z_cc(p) - z_cc(p - 2)) end do end do diff --git a/src/simulation/m_weno.fpp b/src/simulation/m_weno.fpp index 38f659a8e..28665db59 100644 --- a/src/simulation/m_weno.fpp +++ b/src/simulation/m_weno.fpp @@ -44,7 +44,7 @@ module m_weno !! stencils (WS) that are annexed to each position of a given scalar field. !> @{ - real(kind(0d0)), allocatable, dimension(:, :, :, :) :: v_rs_ws_x, v_rs_ws_y, v_rs_ws_z + real(wp), allocatable, dimension(:, :, :, :) :: v_rs_ws_x, v_rs_ws_y, v_rs_ws_z !> @} ! WENO Coefficients ======================================================== @@ -55,16 +55,17 @@ module m_weno !! second dimension identifies the position of its coefficients and the last !! dimension denotes the cell-location in the relevant coordinate direction. !> @{ - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_x - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_y - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_z - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_x - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_y - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_z + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_x + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_y + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbL_z - ! real(kind(0d0)), pointer, dimension(:, :, :) :: poly_coef_L => null() - ! real(kind(0d0)), pointer, dimension(:, :, :) :: poly_coef_R => null() + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_x + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_y + real(wp), target, allocatable, dimension(:, :, :) :: poly_coef_cbR_z + + ! real(wp), pointer, dimension(:, :, :) :: poly_coef_L => null() + ! real(wp), pointer, dimension(:, :, :) :: poly_coef_R => null() !> @} !> @name The ideal weights at the left and the right cell-boundaries and at the @@ -72,15 +73,16 @@ module m_weno !! that the first dimension of the array identifies the weight, while the !! last denotes the cell-location in the relevant coordinate direction. !> @{ - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbL_x - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbL_y - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbL_z - - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbR_x - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbR_y - real(kind(0d0)), target, allocatable, dimension(:, :) :: d_cbR_z -! real(kind(0d0)), pointer, dimension(:, :) :: d_L => null() -! real(kind(0d0)), pointer, dimension(:, :) :: d_R => null() + + real(wp), target, allocatable, dimension(:, :) :: d_cbL_x + real(wp), target, allocatable, dimension(:, :) :: d_cbL_y + real(wp), target, allocatable, dimension(:, :) :: d_cbL_z + + real(wp), target, allocatable, dimension(:, :) :: d_cbR_x + real(wp), target, allocatable, dimension(:, :) :: d_cbR_y + real(wp), target, allocatable, dimension(:, :) :: d_cbR_z +! real(wp), pointer, dimension(:, :) :: d_L => null() +! real(wp), pointer, dimension(:, :) :: d_R => null() !> @} !> @name Smoothness indicator coefficients in the x-, y-, and z-directions. Note @@ -88,10 +90,11 @@ module m_weno !! second identifies the position of its coefficients and the last denotes !! the cell-location in the relevant coordinate direction. !> @{ - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: beta_coef_x - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: beta_coef_y - real(kind(0d0)), target, allocatable, dimension(:, :, :) :: beta_coef_z -! real(kind(0d0)), pointer, dimension(:, :, :) :: beta_coef => null() + + real(wp), target, allocatable, dimension(:, :, :) :: beta_coef_x + real(wp), target, allocatable, dimension(:, :, :) :: beta_coef_y + real(wp), target, allocatable, dimension(:, :, :) :: beta_coef_z +! real(wp), pointer, dimension(:, :, :) :: beta_coef => null() !> @} ! END: WENO Coefficients =================================================== @@ -107,7 +110,7 @@ module m_weno ! !> @} - real(kind(0d0)) :: test + real(wp) :: test !$acc declare create(test) !$acc declare create( & @@ -235,15 +238,15 @@ contains type(int_bounds_info), intent(in) :: is integer :: s - real(kind(0d0)), pointer, dimension(:) :: s_cb => null() !< + real(wp), pointer, dimension(:) :: s_cb => null() !< !! Cell-boundary locations in the s-direction type(int_bounds_info) :: bc_s !< Boundary conditions (BC) in the s-direction integer :: i !< Generic loop iterator - real(kind(0d0)) :: w(1:8) ! Intermediate var for ideal weights: s_cb across overall stencil - real(kind(0d0)) :: y(1:4) ! Intermediate var for poly & beta: diff(s_cb) across sub-stencil + real(wp) :: w(1:8) ! Intermediate var for ideal weights: s_cb across overall stencil + real(wp) :: y(1:4) ! Intermediate var for poly & beta: diff(s_cb) across sub-stencil ! Determining the number of cells, the cell-boundary locations and ! the boundary conditions in the coordinate direction selected for @@ -275,13 +278,13 @@ contains d_cbL_${XYZ}$ (0, i + 1) = (s_cb(i - 1) - s_cb(i))/ & (s_cb(i - 1) - s_cb(i + 2)) - d_cbR_${XYZ}$ (1, i + 1) = 1d0 - d_cbR_${XYZ}$ (0, i + 1) - d_cbL_${XYZ}$ (1, i + 1) = 1d0 - d_cbL_${XYZ}$ (0, i + 1) + d_cbR_${XYZ}$ (1, i + 1) = 1._wp - d_cbR_${XYZ}$ (0, i + 1) + d_cbL_${XYZ}$ (1, i + 1) = 1._wp - d_cbL_${XYZ}$ (0, i + 1) - beta_coef_${XYZ}$ (i + 1, 0, 0) = 4d0*(s_cb(i) - s_cb(i + 1))**2d0/ & - (s_cb(i) - s_cb(i + 2))**2d0 - beta_coef_${XYZ}$ (i + 1, 1, 0) = 4d0*(s_cb(i) - s_cb(i + 1))**2d0/ & - (s_cb(i - 1) - s_cb(i + 1))**2d0 + beta_coef_${XYZ}$ (i + 1, 0, 0) = 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp/ & + (s_cb(i) - s_cb(i + 2))**2._wp + beta_coef_${XYZ}$ (i + 1, 1, 0) = 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp/ & + (s_cb(i - 1) - s_cb(i + 1))**2._wp end do @@ -291,13 +294,13 @@ contains ! the WENO reconstruction if (null_weights) then if (bc_s%beg == -4) then - d_cbR_${XYZ}$ (1, 0) = 0d0; d_cbR_${XYZ}$ (0, 0) = 1d0 - d_cbL_${XYZ}$ (1, 0) = 0d0; d_cbL_${XYZ}$ (0, 0) = 1d0 + d_cbR_${XYZ}$ (1, 0) = 0._wp; d_cbR_${XYZ}$ (0, 0) = 1._wp + d_cbL_${XYZ}$ (1, 0) = 0._wp; d_cbL_${XYZ}$ (0, 0) = 1._wp end if if (bc_s%end == -4) then - d_cbR_${XYZ}$ (0, s) = 0d0; d_cbR_${XYZ}$ (1, s) = 1d0 - d_cbL_${XYZ}$ (0, s) = 0d0; d_cbL_${XYZ}$ (1, s) = 1d0 + d_cbR_${XYZ}$ (0, s) = 0._wp; d_cbR_${XYZ}$ (1, s) = 1._wp + d_cbL_${XYZ}$ (0, s) = 0._wp; d_cbL_${XYZ}$ (1, s) = 1._wp end if end if ! END: Computing WENO3 Coefficients ================================ @@ -362,72 +365,72 @@ contains ((s_cb(i) - s_cb(i + 2))*(s_cb(i) - s_cb(i + 3)))/ & ((s_cb(i - 2) - s_cb(i + 2))*(s_cb(i - 2) - s_cb(i + 3))) - d_cbR_${XYZ}$ (1, i + 1) = 1d0 - d_cbR_${XYZ}$ (0, i + 1) - d_cbR_${XYZ}$ (2, i + 1) - d_cbL_${XYZ}$ (1, i + 1) = 1d0 - d_cbL_${XYZ}$ (0, i + 1) - d_cbL_${XYZ}$ (2, i + 1) + d_cbR_${XYZ}$ (1, i + 1) = 1._wp - d_cbR_${XYZ}$ (0, i + 1) - d_cbR_${XYZ}$ (2, i + 1) + d_cbL_${XYZ}$ (1, i + 1) = 1._wp - d_cbL_${XYZ}$ (0, i + 1) - d_cbL_${XYZ}$ (2, i + 1) beta_coef_${XYZ}$ (i + 1, 0, 0) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(10d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + (s_cb(i + 1) - s_cb(i))*(s_cb(i + 2) - & - s_cb(i + 1)) + (s_cb(i + 2) - s_cb(i + 1))**2d0)/((s_cb(i) - & - s_cb(i + 3))**2d0*(s_cb(i + 1) - s_cb(i + 3))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(10._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + (s_cb(i + 1) - s_cb(i))*(s_cb(i + 2) - & + s_cb(i + 1)) + (s_cb(i + 2) - s_cb(i + 1))**2._wp)/((s_cb(i) - & + s_cb(i + 3))**2._wp*(s_cb(i + 1) - s_cb(i + 3))**2._wp) beta_coef_${XYZ}$ (i + 1, 0, 1) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(19d0*(s_cb(i + 1) - & - s_cb(i))**2d0 - (s_cb(i + 1) - s_cb(i))*(s_cb(i + 3) - & - s_cb(i + 1)) + 2d0*(s_cb(i + 2) - s_cb(i))*((s_cb(i + 2) - & - s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1))))/((s_cb(i) - & - s_cb(i + 2))*(s_cb(i) - s_cb(i + 3))**2d0*(s_cb(i + 3) - & - s_cb(i + 1))) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(19._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp - (s_cb(i + 1) - s_cb(i))*(s_cb(i + 3) - & + s_cb(i + 1)) + 2._wp*(s_cb(i + 2) - s_cb(i))*((s_cb(i + 2) - & + s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1))))/((s_cb(i) - & + s_cb(i + 2))*(s_cb(i) - s_cb(i + 3))**2._wp*(s_cb(i + 3) - & + s_cb(i + 1))) beta_coef_${XYZ}$ (i + 1, 0, 2) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(10d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + (s_cb(i + 1) - s_cb(i))*((s_cb(i + 2) - & - s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1))) + ((s_cb(i + 2) - & - s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1)))**2d0)/((s_cb(i) - & - s_cb(i + 2))**2d0*(s_cb(i) - s_cb(i + 3))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(10._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + (s_cb(i + 1) - s_cb(i))*((s_cb(i + 2) - & + s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1))) + ((s_cb(i + 2) - & + s_cb(i)) + (s_cb(i + 3) - s_cb(i + 1)))**2._wp)/((s_cb(i) - & + s_cb(i + 2))**2._wp*(s_cb(i) - s_cb(i + 3))**2._wp) beta_coef_${XYZ}$ (i + 1, 1, 0) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(10d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + (s_cb(i) - s_cb(i - 1))**2d0 + (s_cb(i) - & - s_cb(i - 1))*(s_cb(i + 1) - s_cb(i)))/((s_cb(i - 1) - & - s_cb(i + 2))**2d0*(s_cb(i) - s_cb(i + 2))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(10._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + (s_cb(i) - s_cb(i - 1))**2._wp + (s_cb(i) - & + s_cb(i - 1))*(s_cb(i + 1) - s_cb(i)))/((s_cb(i - 1) - & + s_cb(i + 2))**2._wp*(s_cb(i) - s_cb(i + 2))**2._wp) beta_coef_${XYZ}$ (i + 1, 1, 1) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*((s_cb(i) - & - s_cb(i + 1))*((s_cb(i) - s_cb(i - 1)) + 20d0*(s_cb(i + 1) - & - s_cb(i))) + (2d0*(s_cb(i) - s_cb(i - 1)) + (s_cb(i + 1) - & - s_cb(i)))*(s_cb(i + 2) - s_cb(i)))/((s_cb(i + 1) - & - s_cb(i - 1))*(s_cb(i - 1) - s_cb(i + 2))**2d0*(s_cb(i + 2) - & - s_cb(i))) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*((s_cb(i) - & + s_cb(i + 1))*((s_cb(i) - s_cb(i - 1)) + 20._wp*(s_cb(i + 1) - & + s_cb(i))) + (2._wp*(s_cb(i) - s_cb(i - 1)) + (s_cb(i + 1) - & + s_cb(i)))*(s_cb(i + 2) - s_cb(i)))/((s_cb(i + 1) - & + s_cb(i - 1))*(s_cb(i - 1) - s_cb(i + 2))**2._wp*(s_cb(i + 2) - & + s_cb(i))) beta_coef_${XYZ}$ (i + 1, 1, 2) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(10d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + (s_cb(i + 1) - s_cb(i))*(s_cb(i + 2) - & - s_cb(i + 1)) + (s_cb(i + 2) - s_cb(i + 1))**2d0)/ & - ((s_cb(i - 1) - s_cb(i + 1))**2d0*(s_cb(i - 1) - & - s_cb(i + 2))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(10._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + (s_cb(i + 1) - s_cb(i))*(s_cb(i + 2) - & + s_cb(i + 1)) + (s_cb(i + 2) - s_cb(i + 1))**2._wp)/ & + ((s_cb(i - 1) - s_cb(i + 1))**2._wp*(s_cb(i - 1) - & + s_cb(i + 2))**2._wp) beta_coef_${XYZ}$ (i + 1, 2, 0) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(12d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + ((s_cb(i) - s_cb(i - 2)) + (s_cb(i) - & - s_cb(i - 1)))**2d0 + 3d0*((s_cb(i) - s_cb(i - 2)) + & - (s_cb(i) - s_cb(i - 1)))*(s_cb(i + 1) - s_cb(i)))/ & - ((s_cb(i - 2) - s_cb(i + 1))**2d0*(s_cb(i - 1) - & - s_cb(i + 1))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(12._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + ((s_cb(i) - s_cb(i - 2)) + (s_cb(i) - & + s_cb(i - 1)))**2._wp + 3._wp*((s_cb(i) - s_cb(i - 2)) + & + (s_cb(i) - s_cb(i - 1)))*(s_cb(i + 1) - s_cb(i)))/ & + ((s_cb(i - 2) - s_cb(i + 1))**2._wp*(s_cb(i - 1) - & + s_cb(i + 1))**2._wp) beta_coef_${XYZ}$ (i + 1, 2, 1) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(19d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + ((s_cb(i) - s_cb(i - 2))*(s_cb(i) - & - s_cb(i + 1))) + 2d0*(s_cb(i + 1) - s_cb(i - 1))*((s_cb(i) - & - s_cb(i - 2)) + (s_cb(i + 1) - s_cb(i - 1))))/((s_cb(i - 2) - & - s_cb(i))*(s_cb(i - 2) - s_cb(i + 1))**2d0*(s_cb(i + 1) - & - s_cb(i - 1))) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(19._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + ((s_cb(i) - s_cb(i - 2))*(s_cb(i) - & + s_cb(i + 1))) + 2._wp*(s_cb(i + 1) - s_cb(i - 1))*((s_cb(i) - & + s_cb(i - 2)) + (s_cb(i + 1) - s_cb(i - 1))))/((s_cb(i - 2) - & + s_cb(i))*(s_cb(i - 2) - s_cb(i + 1))**2._wp*(s_cb(i + 1) - & + s_cb(i - 1))) beta_coef_${XYZ}$ (i + 1, 2, 2) = & - 4d0*(s_cb(i) - s_cb(i + 1))**2d0*(10d0*(s_cb(i + 1) - & - s_cb(i))**2d0 + (s_cb(i) - s_cb(i - 1))**2d0 + (s_cb(i) - & - s_cb(i - 1))*(s_cb(i + 1) - s_cb(i)))/((s_cb(i - 2) - & - s_cb(i))**2d0*(s_cb(i - 2) - s_cb(i + 1))**2d0) + 4._wp*(s_cb(i) - s_cb(i + 1))**2._wp*(10._wp*(s_cb(i + 1) - & + s_cb(i))**2._wp + (s_cb(i) - s_cb(i - 1))**2._wp + (s_cb(i) - & + s_cb(i - 1))*(s_cb(i + 1) - s_cb(i)))/((s_cb(i - 2) - & + s_cb(i))**2._wp*(s_cb(i - 2) - s_cb(i + 1))**2._wp) end do @@ -437,17 +440,17 @@ contains ! the WENO reconstruction if (null_weights) then if (bc_s%beg == -4) then - d_cbR_${XYZ}$ (1:2, 0) = 0d0; d_cbR_${XYZ}$ (0, 0) = 1d0 - d_cbL_${XYZ}$ (1:2, 0) = 0d0; d_cbL_${XYZ}$ (0, 0) = 1d0 - d_cbR_${XYZ}$ (2, 1) = 0d0; d_cbR_${XYZ}$ (:, 1) = d_cbR_${XYZ}$ (:, 1)/sum(d_cbR_${XYZ}$ (:, 1)) - d_cbL_${XYZ}$ (2, 1) = 0d0; d_cbL_${XYZ}$ (:, 1) = d_cbL_${XYZ}$ (:, 1)/sum(d_cbL_${XYZ}$ (:, 1)) + d_cbR_${XYZ}$ (1:2, 0) = 0._wp; d_cbR_${XYZ}$ (0, 0) = 1._wp + d_cbL_${XYZ}$ (1:2, 0) = 0._wp; d_cbL_${XYZ}$ (0, 0) = 1._wp + d_cbR_${XYZ}$ (2, 1) = 0._wp; d_cbR_${XYZ}$ (:, 1) = d_cbR_${XYZ}$ (:, 1)/sum(d_cbR_${XYZ}$ (:, 1)) + d_cbL_${XYZ}$ (2, 1) = 0._wp; d_cbL_${XYZ}$ (:, 1) = d_cbL_${XYZ}$ (:, 1)/sum(d_cbL_${XYZ}$ (:, 1)) end if if (bc_s%end == -4) then - d_cbR_${XYZ}$ (0, s - 1) = 0d0; d_cbR_${XYZ}$ (:, s - 1) = d_cbR_${XYZ}$ (:, s - 1)/sum(d_cbR_${XYZ}$ (:, s - 1)) - d_cbL_${XYZ}$ (0, s - 1) = 0d0; d_cbL_${XYZ}$ (:, s - 1) = d_cbL_${XYZ}$ (:, s - 1)/sum(d_cbL_${XYZ}$ (:, s - 1)) - d_cbR_${XYZ}$ (0:1, s) = 0d0; d_cbR_${XYZ}$ (2, s) = 1d0 - d_cbL_${XYZ}$ (0:1, s) = 0d0; d_cbL_${XYZ}$ (2, s) = 1d0 + d_cbR_${XYZ}$ (0, s - 1) = 0._wp; d_cbR_${XYZ}$ (:, s - 1) = d_cbR_${XYZ}$ (:, s - 1)/sum(d_cbR_${XYZ}$ (:, s - 1)) + d_cbL_${XYZ}$ (0, s - 1) = 0._wp; d_cbL_${XYZ}$ (:, s - 1) = d_cbL_${XYZ}$ (:, s - 1)/sum(d_cbL_${XYZ}$ (:, s - 1)) + d_cbR_${XYZ}$ (0:1, s) = 0._wp; d_cbR_${XYZ}$ (2, s) = 1._wp + d_cbL_${XYZ}$ (0:1, s) = 0._wp; d_cbL_${XYZ}$ (2, s) = 1._wp end if end if @@ -624,17 +627,17 @@ contains else ! TENO (only supports uniform grid) ! (Fu, et al., 2016) Table 2 (for right flux) - d_cbL_${XYZ}$ (0, :) = 18d0/35d0 - d_cbL_${XYZ}$ (1, :) = 3d0/35d0 - d_cbL_${XYZ}$ (2, :) = 9d0/35d0 - d_cbL_${XYZ}$ (3, :) = 1d0/35d0 - d_cbL_${XYZ}$ (4, :) = 4d0/35d0 - - d_cbR_${XYZ}$ (0, :) = 18d0/35d0 - d_cbR_${XYZ}$ (1, :) = 9d0/35d0 - d_cbR_${XYZ}$ (2, :) = 3d0/35d0 - d_cbR_${XYZ}$ (3, :) = 4d0/35d0 - d_cbR_${XYZ}$ (4, :) = 1d0/35d0 + d_cbL_${XYZ}$ (0, :) = 18._wp/35._wp + d_cbL_${XYZ}$ (1, :) = 3._wp/35._wp + d_cbL_${XYZ}$ (2, :) = 9._wp/35._wp + d_cbL_${XYZ}$ (3, :) = 1._wp/35._wp + d_cbL_${XYZ}$ (4, :) = 4._wp/35._wp + + d_cbR_${XYZ}$ (0, :) = 18._wp/35._wp + d_cbR_${XYZ}$ (1, :) = 9._wp/35._wp + d_cbR_${XYZ}$ (2, :) = 3._wp/35._wp + d_cbR_${XYZ}$ (3, :) = 4._wp/35._wp + d_cbR_${XYZ}$ (4, :) = 1._wp/35._wp end if end if @@ -662,20 +665,20 @@ contains is1_weno_d, is2_weno_d, is3_weno_d) type(scalar_field), dimension(1:), intent(in) :: v_vf - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_rs_vf_x, vL_rs_vf_y, vL_rs_vf_z - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_rs_vf_x, vR_rs_vf_y, vR_rs_vf_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vL_rs_vf_x, vL_rs_vf_y, vL_rs_vf_z + real(wp), dimension(startx:, starty:, startz:, 1:), intent(inout) :: vR_rs_vf_x, vR_rs_vf_y, vR_rs_vf_z integer, intent(in) :: norm_dir integer, intent(in) :: weno_dir type(int_bounds_info), intent(in) :: is1_weno_d, is2_weno_d, is3_weno_d - real(kind(0d0)), dimension(-weno_polyn:weno_polyn - 1) :: dvd - real(kind(0d0)), dimension(0:weno_num_stencils) :: poly - real(kind(0d0)), dimension(0:weno_num_stencils) :: alpha - real(kind(0d0)), dimension(0:weno_num_stencils) :: omega - real(kind(0d0)), dimension(0:weno_num_stencils) :: beta - real(kind(0d0)), dimension(0:weno_num_stencils) :: delta - real(kind(0d0)), dimension(-3:3) :: v ! temporary field value array for clarity (WENO7 only) - real(kind(0d0)) :: tau + real(wp), dimension(-weno_polyn:weno_polyn - 1) :: dvd + real(wp), dimension(0:weno_num_stencils) :: poly + real(wp), dimension(0:weno_num_stencils) :: alpha + real(wp), dimension(0:weno_num_stencils) :: omega + real(wp), dimension(0:weno_num_stencils) :: beta + real(wp), dimension(0:weno_num_stencils) :: delta + real(wp), dimension(-3:3) :: v ! temporary field value array for clarity (WENO7 only) + real(wp) :: tau integer :: i, j, k, l @@ -762,13 +765,14 @@ contains elseif (mapped_weno) then alpha = d_cbL_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbL_${XYZ}$ (:, j)*(1d0 + d_cbL_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbL_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbL_${XYZ}$ (:, j)))) + alpha = (d_cbL_${XYZ}$ (:, j)*(1._wp + d_cbL_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbL_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbL_${XYZ}$ (:, j)))) elseif (wenoz) then ! Borges, et al. (2008) + tau = abs(beta(1) - beta(0)) - alpha = d_cbL_${XYZ}$ (:, j)*(1d0 + tau/beta) + alpha = d_cbL_${XYZ}$ (:, j)*(1._wp + tau/beta) end if @@ -789,11 +793,12 @@ contains elseif (mapped_weno) then alpha = d_cbR_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbR_${XYZ}$ (:, j)*(1d0 + d_cbR_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbR_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbR_${XYZ}$ (:, j)))) + alpha = (d_cbR_${XYZ}$ (:, j)*(1._wp + d_cbR_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbR_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbR_${XYZ}$ (:, j)))) elseif (wenoz) then - alpha = d_cbR_${XYZ}$ (:, j)*(1d0 + tau/beta) + + alpha = d_cbR_${XYZ}$ (:, j)*(1._wp + tau/beta) end if @@ -857,21 +862,22 @@ contains elseif (mapped_weno) then alpha = d_cbL_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbL_${XYZ}$ (:, j)*(1d0 + d_cbL_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbL_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbL_${XYZ}$ (:, j)))) + alpha = (d_cbL_${XYZ}$ (:, j)*(1._wp + d_cbL_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbL_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbL_${XYZ}$ (:, j)))) elseif (wenoz) then ! Borges, et al. (2008) + tau = abs(beta(2) - beta(0)) ! Equation 25 - alpha = d_cbL_${XYZ}$ (:, j)*(1d0 + tau/beta) ! Equation 28 (note: weno_eps was already added to beta) + alpha = d_cbL_${XYZ}$ (:, j)*(1._wp + tau/beta) ! Equation 28 (note: weno_eps was already added to beta) elseif (teno) then ! Fu, et al. (2016) ! Fu''s code: https://dx.doi.org/10.13140/RG.2.2.36250.34247 tau = abs(beta(2) - beta(0)) - alpha = (1d0 + tau/beta)**6d0 ! Equation 22 (reuse alpha as gamma; pick C=1 & q=6) + alpha = (1._wp + tau/beta)**6._wp ! Equation 22 (reuse alpha as gamma; pick C=1 & q=6) omega = alpha/sum(alpha) ! Equation 25 (reuse omega as xi) - delta = merge(0d0, 1d0, omega < teno_CT) ! Equation 26 + delta = merge(0._wp, 1._wp, omega < teno_CT) ! Equation 26 alpha = delta*d_cbL_${XYZ}$ (:, j) ! Equation 27 end if @@ -898,11 +904,12 @@ contains elseif (mapped_weno) then alpha = d_cbR_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbR_${XYZ}$ (:, j)*(1d0 + d_cbR_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbR_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbR_${XYZ}$ (:, j)))) + alpha = (d_cbR_${XYZ}$ (:, j)*(1._wp + d_cbR_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbR_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbR_${XYZ}$ (:, j)))) elseif (wenoz) then - alpha = d_cbR_${XYZ}$ (:, j)*(1d0 + tau/beta) + + alpha = d_cbR_${XYZ}$ (:, j)*(1._wp + tau/beta) elseif (teno) then alpha = delta*d_cbR_${XYZ}$ (:, j) @@ -974,14 +981,15 @@ contains ! See Figure 2 (right) for right-sided flux (at i+1/2) ! Here we need the left-sided flux, so we flip the weights with respect to the x=i point ! But we need to keep the stencil order to reuse the beta coefficients - poly(0) = ( 2d0*v(-1) + 5d0*v( 0) - 1d0*v( 1)) / 6d0 !& - poly(1) = (11d0*v( 0) - 7d0*v( 1) + 2d0*v( 2)) / 6d0 !& - poly(2) = (-1d0*v(-2) + 5d0*v(-1) + 2d0*v( 0)) / 6d0 !& - poly(3) = (25d0*v( 0) - 23d0*v( 1) + 13d0*v( 2) - 3d0*v( 3)) / 12d0 !& - poly(4) = ( 1d0*v(-3) - 5d0*v(-2) + 13d0*v(-1) + 3d0*v( 0)) / 12d0 !& + poly(0) = ( 2._wp*v(-1) + 5._wp*v( 0) - 1._wp*v( 1)) / 6._wp !& + poly(1) = (11._wp*v( 0) - 7._wp*v( 1) + 2._wp*v( 2)) / 6._wp !& + poly(2) = (-1._wp*v(-2) + 5._wp*v(-1) + 2._wp*v( 0)) / 6._wp !& + poly(3) = (25._wp*v( 0) - 23._wp*v( 1) + 13._wp*v( 2) - 3._wp*v( 3)) / 12._wp !& + poly(4) = ( 1._wp*v(-3) - 5._wp*v(-2) + 13._wp*v(-1) + 3._wp*v( 0)) / 12._wp !& end if if (.not. teno) then + beta(3) = beta_coef_${XYZ}$ (j, 0, 0)*dvd(2)*dvd(2) & + beta_coef_${XYZ}$ (j, 0, 1)*dvd(2)*dvd(1) & + beta_coef_${XYZ}$ (j, 0, 2)*dvd(2)*dvd(0) & @@ -1016,20 +1024,20 @@ contains else ! TENO ! High-Order Low-Dissipation Targeted ENO Schemes for Ideal Magnetohydrodynamics (Fu & Tang, 2019) Section 3.2 - beta(0) = 13d0/12d0*(v(-1) - 2d0*v( 0) + v( 1))**2d0 + (( v(-1) - v( 1))**2d0)/4d0 + weno_eps !& - beta(1) = 13d0/12d0*(v( 0) - 2d0*v( 1) + v( 2))**2d0 + ((3d0*v( 0) - 4d0*v( 1) + v( 2))**2d0)/4d0 + weno_eps !& - beta(2) = 13d0/12d0*(v(-2) - 2d0*v(-1) + v( 0))**2d0 + (( v(-2) - 4d0*v(-1) + 3d0*v( 0))**2d0)/4d0 + weno_eps !& - - beta(3) = ( v( 0)*(2107d0*v( 0) - 9402d0*v( 1) + 7042d0*v( 2) - 1854d0*v( 3)) & !& - + v( 1)*( 11003d0*v( 1) - 17246d0*v( 2) + 4642d0*v( 3)) & !& - + v( 2)*( 7043d0*v( 2) - 3882d0*v( 3)) & !& - + v( 3)*( 547d0*v( 3)) ) / 240d0 & !& + beta(0) = 13._wp/12._wp*(v(-1) - 2._wp*v( 0) + v( 1))**2._wp + (( v(-1) - v( 1))**2._wp)/4._wp + weno_eps !& + beta(1) = 13._wp/12._wp*(v( 0) - 2._wp*v( 1) + v( 2))**2._wp + ((3._wp*v( 0) - 4._wp*v( 1) + v( 2))**2._wp)/4._wp + weno_eps !& + beta(2) = 13._wp/12._wp*(v(-2) - 2._wp*v(-1) + v( 0))**2._wp + (( v(-2) - 4._wp*v(-1) + 3._wp*v( 0))**2._wp)/4._wp + weno_eps !& + + beta(3) = ( v( 0)*(2107._wp*v( 0) - 9402._wp*v( 1) + 7042._wp*v( 2) - 1854._wp*v( 3)) & !& + + v( 1)*( 11003._wp*v( 1) - 17246._wp*v( 2) + 4642._wp*v( 3)) & !& + + v( 2)*( 7043._wp*v( 2) - 3882._wp*v( 3)) & !& + + v( 3)*( 547._wp*v( 3)) ) / 240._wp & !& + weno_eps !& - beta(4) = ( v(-3)*(547d0*v(-3) - 3882d0*v(-2) + 4642d0*v(-1) - 1854d0*v( 0)) & !& - + v(-2)*( 7043d0*v(-2) - 17246d0*v(-1) + 7042d0*v( 0)) & !& - + v(-1)*( 11003d0*v(-1) - 9402d0*v( 0)) & !& - + v( 0)*( 2107d0*v( 0)) ) / 240d0 & !& + beta(4) = ( v(-3)*(547._wp*v(-3) - 3882._wp*v(-2) + 4642._wp*v(-1) - 1854._wp*v( 0)) & !& + + v(-2)*( 7043._wp*v(-2) - 17246._wp*v(-1) + 7042._wp*v( 0)) & !& + + v(-1)*( 11003._wp*v(-1) - 9402._wp*v( 0)) & !& + + v( 0)*( 2107._wp*v( 0)) ) / 240._wp & !& + weno_eps !& end if @@ -1039,20 +1047,20 @@ contains elseif (mapped_weno) then alpha = d_cbL_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbL_${XYZ}$ (:, j)*(1d0 + d_cbL_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbL_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbL_${XYZ}$ (:, j)))) + alpha = (d_cbL_${XYZ}$ (:, j)*(1._wp + d_cbL_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbL_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbL_${XYZ}$ (:, j)))) elseif (wenoz) then ! Castro, et al. (2010) ! Don & Borges (2013) also helps tau = abs(beta(3) - beta(0)) ! Equation 50 - alpha = d_cbL_${XYZ}$ (:, j)*(1d0 + (tau/beta)**wenoz_q) ! q = 2,3,4 for stability + alpha = d_cbL_${XYZ}$ (:, j)*(1._wp + (tau/beta)**wenoz_q) ! q = 2,3,4 for stability elseif (teno) then tau = abs(beta(4) - beta(3)) ! Note the reordering of stencils - alpha = (1d0 + tau/beta)**6d0 + alpha = (1._wp + tau/beta)**6._wp omega = alpha/sum(alpha) - delta = merge(0d0, 1d0, omega < teno_CT) + delta = merge(0._wp, 1._wp, omega < teno_CT) alpha = delta*d_cbL_${XYZ}$ (:, j) end if @@ -1079,11 +1087,11 @@ contains + poly_coef_cbR_${XYZ}$ (j, 3, 1)*dvd(-2) & + poly_coef_cbR_${XYZ}$ (j, 3, 2)*dvd(-3) else - poly(0) = (-1d0*v(-1) + 5d0*v( 0) + 2d0*v( 1)) / 6d0 !& - poly(1) = ( 2d0*v( 0) + 5d0*v( 1) - 1d0*v( 2)) / 6d0 !& - poly(2) = ( 2d0*v(-2) - 7d0*v(-1) + 11d0*v( 0)) / 6d0 !& - poly(3) = ( 3d0*v( 0) + 13d0*v( 1) - 5d0*v( 2) + 1d0*v( 3)) / 12d0 !& - poly(4) = (-3d0*v(-3) + 13d0*v(-2) - 23d0*v(-1) + 25d0*v( 0)) / 12d0 !& + poly(0) = (-1._wp*v(-1) + 5._wp*v( 0) + 2._wp*v( 1)) / 6._wp !& + poly(1) = ( 2._wp*v( 0) + 5._wp*v( 1) - 1._wp*v( 2)) / 6._wp !& + poly(2) = ( 2._wp*v(-2) - 7._wp*v(-1) + 11._wp*v( 0)) / 6._wp !& + poly(3) = ( 3._wp*v( 0) + 13._wp*v( 1) - 5._wp*v( 2) + 1._wp*v( 3)) / 12._wp !& + poly(4) = (-3._wp*v(-3) + 13._wp*v(-2) - 23._wp*v(-1) + 25._wp*v( 0)) / 12._wp !& end if if (wenojs) then @@ -1092,11 +1100,11 @@ contains elseif (mapped_weno) then alpha = d_cbR_${XYZ}$ (:, j)/(beta*beta) omega = alpha/sum(alpha) - alpha = (d_cbR_${XYZ}$ (:, j)*(1d0 + d_cbR_${XYZ}$ (:, j) - 3d0*omega) + omega**2d0) & - *(omega/(d_cbR_${XYZ}$ (:, j)**2d0 + omega*(1d0 - 2d0*d_cbR_${XYZ}$ (:, j)))) + alpha = (d_cbR_${XYZ}$ (:, j)*(1._wp + d_cbR_${XYZ}$ (:, j) - 3._wp*omega) + omega**2._wp) & + *(omega/(d_cbR_${XYZ}$ (:, j)**2._wp + omega*(1._wp - 2._wp*d_cbR_${XYZ}$ (:, j)))) elseif (wenoz) then - alpha = d_cbR_${XYZ}$ (:, j)*(1d0 + (tau/beta)**wenoz_q) + alpha = d_cbR_${XYZ}$ (:, j)*(1._wp + (tau/beta)**wenoz_q) elseif (teno) then alpha = delta*d_cbR_${XYZ}$ (:, j) @@ -1250,41 +1258,41 @@ contains !! stencil. !! @param i Equation number !! @param j First-coordinate cell index - !! @param k Second-coordinate cell index - !! @param l Third-coordinate cell index + !! @param k Secone-coordinate cell index + !! @param l Thire-coordinate cell index subroutine s_preserve_monotonicity(v_rs_ws, vL_rs_vf, vR_rs_vf) - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(IN) :: v_rs_ws - real(kind(0d0)), dimension(startx:, starty:, startz:, 1:), intent(INOUT) :: vL_rs_vf, vR_rs_vf + real(wp), dimension(startx:, starty:, startz:, 1:), intent(IN) :: v_rs_ws + real(wp), dimension(startx:, starty:, startz:, 1:), intent(INOUT) :: vL_rs_vf, vR_rs_vf integer :: i, j, k, l - real(kind(0d0)), dimension(-1:1) :: d !< Curvature measures at the zone centers + real(wp), dimension(-1:1) :: d !< Curvature measures at the zone centers - real(kind(0d0)) :: d_MD, d_LC !< + real(wp) :: d_MD, d_LC !< !! Median (md) curvature and large curvature (LC) measures ! The left and right upper bounds (UL), medians, large curvatures, ! minima, and maxima of the WENO-reconstructed values of the cell- ! average variables. - real(kind(0d0)) :: vL_UL, vR_UL - real(kind(0d0)) :: vL_MD, vR_MD - real(kind(0d0)) :: vL_LC, vR_LC - real(kind(0d0)) :: vL_min, vR_min - real(kind(0d0)) :: vL_max, vR_max + real(wp) :: vL_UL, vR_UL + real(wp) :: vL_MD, vR_MD + real(wp) :: vL_LC, vR_LC + real(wp) :: vL_min, vR_min + real(wp) :: vL_max, vR_max - real(kind(0d0)), parameter :: alpha = 2d0 !> + real(wp), parameter :: alpha = 2._wp !> !! Determines the maximum Courant–Friedrichs–Lewy (CFL) number that !! may be utilized with the scheme. In theory, for stability, a CFL !! number less than 1/(1+alpha) is necessary. The default value for !! alpha is 2. - real(kind(0d0)), parameter :: beta = 4d0/3d0 !< + real(wp), parameter :: beta = 4._wp/3._wp !< !! Determines the amount of freedom available from utilizing a large !! value for the local curvature. The default value for beta is 4/3. - real(kind(0d0)), parameter :: alpha_mp = 2d0 - real(kind(0d0)), parameter :: beta_mp = 4d0/3d0 + real(wp), parameter :: alpha_mp = 2._wp + real(wp), parameter :: beta_mp = 4._wp/3._wp !$acc parallel loop gang vector collapse (4) default(present) private(d) do l = is3_weno%beg, is3_weno%end @@ -1294,27 +1302,27 @@ contains d(-1) = v_rs_ws(j, k, l, i) & + v_rs_ws(j - 2, k, l, i) & - v_rs_ws(j - 1, k, l, i) & - *2d0 + *2._wp d(0) = v_rs_ws(j + 1, k, l, i) & + v_rs_ws(j - 1, k, l, i) & - v_rs_ws(j, k, l, i) & - *2d0 + *2._wp d(1) = v_rs_ws(j + 2, k, l, i) & + v_rs_ws(j, k, l, i) & - v_rs_ws(j + 1, k, l, i) & - *2d0 + *2._wp - d_MD = (sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, 4d0*d(0) - d(-1))) & - *abs((sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, d(-1))) & - *(sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, d(0)))) & - *min(abs(4d0*d(-1) - d(0)), abs(d(-1)), & - abs(4d0*d(0) - d(-1)), abs(d(0)))/8d0 + d_MD = (sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, 4._wp*d(0) - d(-1))) & + *abs((sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, d(-1))) & + *(sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, d(0)))) & + *min(abs(4._wp*d(-1) - d(0)), abs(d(-1)), & + abs(4._wp*d(0) - d(-1)), abs(d(0)))/8._wp - d_LC = (sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, 4d0*d(1) - d(0))) & - *abs((sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, d(0))) & - *(sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, d(1)))) & - *min(abs(4d0*d(0) - d(1)), abs(d(0)), & - abs(4d0*d(1) - d(0)), abs(d(1)))/8d0 + d_LC = (sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, 4._wp*d(1) - d(0))) & + *abs((sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, d(0))) & + *(sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, d(1)))) & + *min(abs(4._wp*d(0) - d(1)), abs(d(0)), & + abs(4._wp*d(1) - d(0)), abs(d(1)))/8._wp vL_UL = v_rs_ws(j, k, l, i) & - (v_rs_ws(j + 1, k, l, i) & @@ -1322,11 +1330,11 @@ contains vL_MD = (v_rs_ws(j, k, l, i) & + v_rs_ws(j - 1, k, l, i) & - - d_MD)*5d-1 + - d_MD)*5e-1_wp vL_LC = v_rs_ws(j, k, l, i) & - (v_rs_ws(j + 1, k, l, i) & - - v_rs_ws(j, k, l, i))*5d-1 + beta_mp*d_LC + - v_rs_ws(j, k, l, i))*5e-1_wp + beta_mp*d_LC vL_min = max(min(v_rs_ws(j, k, l, i), & v_rs_ws(j - 1, k, l, i), & @@ -1343,8 +1351,8 @@ contains vL_LC)) vL_rs_vf(j, k, l, i) = vL_rs_vf(j, k, l, i) & - + (sign(5d-1, vL_min - vL_rs_vf(j, k, l, i)) & - + sign(5d-1, vL_max - vL_rs_vf(j, k, l, i))) & + + (sign(5e-1_wp, vL_min - vL_rs_vf(j, k, l, i)) & + + sign(5e-1_wp, vL_max - vL_rs_vf(j, k, l, i))) & *min(abs(vL_min - vL_rs_vf(j, k, l, i)), & abs(vL_max - vL_rs_vf(j, k, l, i))) ! END: Left Monotonicity Preserving Bound ========================== @@ -1353,27 +1361,27 @@ contains d(-1) = v_rs_ws(j, k, l, i) & + v_rs_ws(j - 2, k, l, i) & - v_rs_ws(j - 1, k, l, i) & - *2d0 + *2._wp d(0) = v_rs_ws(j + 1, k, l, i) & + v_rs_ws(j - 1, k, l, i) & - v_rs_ws(j, k, l, i) & - *2d0 + *2._wp d(1) = v_rs_ws(j + 2, k, l, i) & + v_rs_ws(j, k, l, i) & - v_rs_ws(j + 1, k, l, i) & - *2d0 + *2._wp - d_MD = (sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, 4d0*d(1) - d(0))) & - *abs((sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, d(0))) & - *(sign(1d0, 4d0*d(0) - d(1)) + sign(1d0, d(1)))) & - *min(abs(4d0*d(0) - d(1)), abs(d(0)), & - abs(4d0*d(1) - d(0)), abs(d(1)))/8d0 + d_MD = (sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, 4._wp*d(1) - d(0))) & + *abs((sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, d(0))) & + *(sign(1._wp, 4._wp*d(0) - d(1)) + sign(1._wp, d(1)))) & + *min(abs(4._wp*d(0) - d(1)), abs(d(0)), & + abs(4._wp*d(1) - d(0)), abs(d(1)))/8._wp - d_LC = (sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, 4d0*d(0) - d(-1))) & - *abs((sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, d(-1))) & - *(sign(1d0, 4d0*d(-1) - d(0)) + sign(1d0, d(0)))) & - *min(abs(4d0*d(-1) - d(0)), abs(d(-1)), & - abs(4d0*d(0) - d(-1)), abs(d(0)))/8d0 + d_LC = (sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, 4._wp*d(0) - d(-1))) & + *abs((sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, d(-1))) & + *(sign(1._wp, 4._wp*d(-1) - d(0)) + sign(1._wp, d(0)))) & + *min(abs(4._wp*d(-1) - d(0)), abs(d(-1)), & + abs(4._wp*d(0) - d(-1)), abs(d(0)))/8._wp vR_UL = v_rs_ws(j, k, l, i) & + (v_rs_ws(j, k, l, i) & @@ -1381,11 +1389,11 @@ contains vR_MD = (v_rs_ws(j, k, l, i) & + v_rs_ws(j + 1, k, l, i) & - - d_MD)*5d-1 + - d_MD)*5e-1_wp vR_LC = v_rs_ws(j, k, l, i) & + (v_rs_ws(j, k, l, i) & - - v_rs_ws(j - 1, k, l, i))*5d-1 + beta_mp*d_LC + - v_rs_ws(j - 1, k, l, i))*5e-1_wp + beta_mp*d_LC vR_min = max(min(v_rs_ws(j, k, l, i), & v_rs_ws(j + 1, k, l, i), & @@ -1402,8 +1410,8 @@ contains vR_LC)) vR_rs_vf(j, k, l, i) = vR_rs_vf(j, k, l, i) & - + (sign(5d-1, vR_min - vR_rs_vf(j, k, l, i)) & - + sign(5d-1, vR_max - vR_rs_vf(j, k, l, i))) & + + (sign(5e-1_wp, vR_min - vR_rs_vf(j, k, l, i)) & + + sign(5e-1_wp, vR_max - vR_rs_vf(j, k, l, i))) & *min(abs(vR_min - vR_rs_vf(j, k, l, i)), & abs(vR_max - vR_rs_vf(j, k, l, i))) ! END: Right Monotonicity Preserving Bound ========================= diff --git a/src/simulation/p_main.fpp b/src/simulation/p_main.fpp index 18bab5a30..052695cc2 100644 --- a/src/simulation/p_main.fpp +++ b/src/simulation/p_main.fpp @@ -28,12 +28,12 @@ program p_main implicit none integer :: t_step !< Iterator for the time-stepping loop - real(kind(0d0)) :: time_avg, time_final - real(kind(0d0)) :: io_time_avg, io_time_final - real(kind(0d0)), allocatable, dimension(:) :: proc_time - real(kind(0d0)), allocatable, dimension(:) :: io_proc_time + real(wp) :: time_avg, time_final + real(wp) :: io_time_avg, io_time_final + real(wp), allocatable, dimension(:) :: proc_time + real(wp), allocatable, dimension(:) :: io_proc_time logical :: file_exists - real(kind(0d0)) :: start, finish + real(wp) :: start, finish integer :: nt call system_clock(COUNT=cpu_start, COUNT_RATE=cpu_rate) @@ -64,7 +64,7 @@ program p_main else t_step = t_step_start if (t_step == 0) then - mytime = 0d0 + mytime = 0._wp else mytime = t_step*dt end if diff --git a/src/syscheck/syscheck.fpp b/src/syscheck/syscheck.fpp index de613a6f8..ca2641057 100644 --- a/src/syscheck/syscheck.fpp +++ b/src/syscheck/syscheck.fpp @@ -53,7 +53,7 @@ program syscheck @:ACC(integer(acc_device_kind) :: devtype) @:ACC(integer :: i, num_devices) - @:ACC(real(kind(0d0)), allocatable, dimension(:) :: arr) + @:ACC(real(8), allocatable, dimension(:) :: arr) @:ACC(integer, parameter :: N = 100) @:MPIC(call mpi_init(ierr)) diff --git a/toolchain/mfc/build.py b/toolchain/mfc/build.py index 156842a91..2de738986 100644 --- a/toolchain/mfc/build.py +++ b/toolchain/mfc/build.py @@ -133,6 +133,7 @@ def configure(self, case: Case): # Location prefix to install bin/, lib/, include/, etc. # See: https://cmake.org/cmake/help/latest/command/install.html. f"-DCMAKE_INSTALL_PREFIX={install_dirpath}", + f"-DMFC_SINGLE_PRECISION={'ON' if ARG('single') else 'OFF'}" ] if ARG("verbose"): diff --git a/toolchain/mfc/run/input.py b/toolchain/mfc/run/input.py index de8303643..126fb032b 100644 --- a/toolchain/mfc/run/input.py +++ b/toolchain/mfc/run/input.py @@ -5,7 +5,7 @@ from ..printer import cons from .. import common, build -from ..state import ARGS +from ..state import ARGS, ARG from ..case import Case @dataclasses.dataclass(init=False) @@ -69,17 +69,24 @@ def generate_fpp(self, target) -> None: # (Thermo)Chemistry source file modules_dir = os.path.join(target.get_staging_dirpath(self), "modules", target.name) common.create_directory(modules_dir) + + # Determine the real type based on the single precision flag + real_type = 'real(sp)' if ARG('single') else 'real(dp)' + + # Write the generated Fortran code to the m_thermochem.f90 file with the chosen precision common.file_write( os.path.join(modules_dir, "m_thermochem.f90"), pyro.codegen.fortran90.gen_thermochem_code( self.get_cantera_solution(), - module_name="m_thermochem" + module_name="m_thermochem", + real_type=real_type ), True ) cons.unindent() + # Generate case.fpp & [target.name].inp def generate(self, target) -> None: self.generate_inp(target) diff --git a/toolchain/mfc/state.py b/toolchain/mfc/state.py index 7c21408a2..fa7d438e7 100644 --- a/toolchain/mfc/state.py +++ b/toolchain/mfc/state.py @@ -8,6 +8,7 @@ class MFCConfig: debug: bool = False gcov: bool = False unified: bool = False + single: bool = False @staticmethod def from_dict(d: dict): diff --git a/toolchain/mfc/test/case.py b/toolchain/mfc/test/case.py index 2961d9798..55cc73ec9 100644 --- a/toolchain/mfc/test/case.py +++ b/toolchain/mfc/test/case.py @@ -227,22 +227,28 @@ def compute_tolerance(self) -> float: if self.override_tol: return self.override_tol - tolerance = 1e-12 # Default + tolerance = 1e-12 # Default + single = ARG("single") + if "Example" in self.trace.split(" -> "): tolerance = 1e-3 elif self.params.get("hypoelasticity", 'F') == 'T': tolerance = 1e-7 + elif self.params.get("mixlayer_perturb", 'F') == 'T': + tolerance = 1e-7 elif any(self.params.get(key, 'F') == 'T' for key in ['relax', 'ib', 'qbmm', 'bubbles']): tolerance = 1e-10 elif self.params.get("low_Mach") in [1, 2]: tolerance = 1e-10 elif self.params.get("acoustic_source", 'F') == 'T': if self.params.get("acoustic(1)%pulse") == 3: # Square wave - tolerance = 1e-5 - else: - tolerance = 3e-12 + return 1e-1 if single else 1e-5 + tolerance = 3e-12 + elif self.params.get("weno_order") == 7: + tolerance = 1e-9 + + return 1e8 * tolerance if single else tolerance - return tolerance @dataclasses.dataclass diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index 8d78af9f2..60829af0b 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -532,8 +532,8 @@ def alter_hypoelasticity(dimInfo): 'patch_icpp(1)%pres': 1.E+06, 'patch_icpp(1)%alpha_rho(1)': 1000.E+00, 'patch_icpp(2)%pres': 1.E+05, 'patch_icpp(2)%alpha_rho(1)': 1000.E+00, 'patch_icpp(3)%pres': 5.E+05, 'patch_icpp(3)%alpha_rho(1)': 1000.E+00, - 'patch_icpp(1)%tau_e(1)': 0.E+00, 'patch_icpp(2)%tau_e(1)': 0.E+00, - 'patch_icpp(3)%tau_e(1)': 0.E+00, 'fluid_pp(1)%G': 1.E+05, + 'patch_icpp(1)%tau_e(1)': 0.E-00, 'patch_icpp(2)%tau_e(1)': 0.E-00, + 'patch_icpp(3)%tau_e(1)': 0.E-00, 'fluid_pp(1)%G': 1.E+05, }) if num_fluids == 2: diff --git a/toolchain/mfc/test/test.py b/toolchain/mfc/test/test.py index 9dfaab3e8..248bf4b5a 100644 --- a/toolchain/mfc/test/test.py +++ b/toolchain/mfc/test/test.py @@ -21,6 +21,7 @@ nSKIP = 0 errors = [] +# pylint: disable=too-many-branches, trailing-whitespace def __filter(cases_) -> typing.List[TestCase]: cases = cases_[:] selected_cases = [] @@ -55,6 +56,14 @@ def __filter(cases_) -> typing.List[TestCase]: if case.ppn > 1 and not ARG("mpi"): cases.remove(case) skipped_cases.append(case) + + for case in cases[:]: + if ARG("single"): + skip = ['low_Mach', 'Hypoelasticity', 'teno', 'Chemistry', 'Phase Change model 6' + ,'Axisymmetric', 'Transducer', 'Transducer Array', 'Cylindrical', 'Example'] + if any(label in case.trace for label in skip): + cases.remove(case) + if ARG("no_examples"): cases = [case for case in cases if not "Example" in case.trace] @@ -156,14 +165,14 @@ def test(): exit(nFAIL) -# pylint: disable=too-many-locals, too-many-branches, too-many-statements +# pylint: disable=too-many-locals, too-many-branches, too-many-statements, trailing-whitespace def _handle_case(case: TestCase, devices: typing.Set[int]): + # pylint: disable=global-statement, global-variable-not-assigned start_time = time.time() tol = case.compute_tolerance() case.delete_output() case.create_directory() - cmd = case.run([PRE_PROCESS, SIMULATION], gpus=devices) out_filepath = os.path.join(case.get_dirpath(), "out_pre_sim.txt") @@ -242,6 +251,10 @@ def handle_case(case: TestCase, devices: typing.Set[int]): global errors nAttempts = 0 + if ARG('single'): + max_attempts = max(ARG('max_attempts'), 3) + else: + max_attempts = ARG('max_attempts') while True: nAttempts += 1 @@ -250,9 +263,7 @@ def handle_case(case: TestCase, devices: typing.Set[int]): _handle_case(case, devices) nPASS += 1 except Exception as exc: - if nAttempts < ARG("max_attempts"): - cons.print(f"[bold yellow] Attempt {nAttempts}: Failed test {case.get_uuid()}. Retrying...[/bold yellow]") - errors.append(f"[bold yellow] Attempt {nAttempts}: Failed test {case.get_uuid()}. Retrying...[/bold yellow]") + if nAttempts < max_attempts: continue nFAIL += 1 cons.print(f"[bold red]Failed test {case} after {nAttempts} attempt(s).[/bold red]")