@@ -49,57 +49,17 @@ module m_variables_conversion
4949#endif
5050 s_finalize_variables_conversion_module
5151
52- !> Abstract interface to two subroutines designed for the transfer/ conversion
53- !! of the mixture/ species variables to the mixture variables
54-
55- abstract interface ! =======================================================
56-
57- !> Structure of the s_convert_mixture_to_mixture_variables
58- !! and s_convert_species_to_mixture_variables subroutines
59- !! @param q_vf Conservative or primitive variables
60- !! @param i First- coordinate cell index
61- !! @param j First- coordinate cell index
62- !! @param k First- coordinate cell index
63- !! @param rho Density
64- !! @param gamma Specific heat ratio function
65- !! @param pi_inf Liquid stiffness function
66- !! @param qv Fluid reference energy
67- subroutine s_convert_xxxxx_to_mixture_variables (q_vf , i , j , k , &
68- rho , gamma , pi_inf , qv , Re_K , G_K , G )
69-
70- ! Importing the derived type scalar_field from m_derived_types.f90
71- ! and global variable sys_size, from m_global_variables.f90, as
72- ! the abstract interface does not inherently have access to them
73- import :: scalar_field, sys_size, num_fluids
74-
75- type(scalar_field), dimension (sys_size), intent (in ) :: q_vf
76- integer , intent (in ) :: i, j, k
77- real (kind (0d0 )), intent (out ), target :: rho, gamma, pi_inf, qv
78- real (kind (0d0 )), optional, dimension (2 ), intent (out ) :: Re_K
79- real (kind (0d0 )), optional, intent (out ) :: G_K
80- real (kind (0d0 )), optional, dimension (num_fluids), intent (in ) :: G
81-
82- end subroutine s_convert_xxxxx_to_mixture_variables
83-
84- end interface ! ============================================================
85-
8652 !! In simulation, gammas, pi_infs, and qvs are already declared in m_global_variables
8753#ifndef MFC_SIMULATION
8854 real (kind (0d0 )), allocatable, public, dimension (:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps
8955 !$acc declare create(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps)
9056#endif
9157
92- #ifdef CRAY_ACC_WAR
93- @:CRAY_DECLARE_GLOBAL(real (kind (0d0 )), dimension (:), Gs)
94- @:CRAY_DECLARE_GLOBAL(integer , dimension (:), bubrs)
95- @:CRAY_DECLARE_GLOBAL(real (kind (0d0 )), dimension (:, :), Res)
96- !$acc declare link(bubrs, Gs, Res)
97- #else
9858 real (kind (0d0 )), allocatable, dimension (:) :: Gs
9959 integer , allocatable, dimension (:) :: bubrs
10060 real (kind (0d0 )), allocatable, dimension (:, :) :: Res
10161 !$acc declare create(bubrs, Gs, Res)
102- # endif
62+
10363 integer :: is1b, is2b, is3b, is1e, is2e, is3e
10464 !$acc declare create(is1b, is2b, is3b, is1e, is2e, is3e)
10565
@@ -108,13 +68,44 @@ module m_variables_conversion
10868 real (kind (0d0 )), allocatable, dimension (:, :, :), public :: pi_inf_sf !< Scalar liquid stiffness function
10969 real (kind (0d0 )), allocatable, dimension (:, :, :), public :: qv_sf !< Scalar liquid energy reference function
11070
111- procedure(s_convert_xxxxx_to_mixture_variables), &
112- pointer :: s_convert_to_mixture_variables = > null() !<
113- !! Pointer referencing the subroutine s_convert_mixture_to_mixture_variables
114- !! or s_convert_species_to_mixture_variables, based on model equations choice
115-
11671contains
11772
73+ !> Dispatch to the s_convert_mixture_to_mixture_variables
74+ !! and s_convert_species_to_mixture_variables subroutines.
75+ !! Replaces a procedure pointer.
76+ !! @param q_vf Conservative or primitive variables
77+ !! @param i First- coordinate cell index
78+ !! @param j First- coordinate cell index
79+ !! @param k First- coordinate cell index
80+ !! @param rho Density
81+ !! @param gamma Specific heat ratio function
82+ !! @param pi_inf Liquid stiffness function
83+ !! @param qv Fluid reference energy
84+ subroutine s_convert_to_mixture_variables (q_vf , i , j , k , &
85+ rho , gamma , pi_inf , qv , Re_K , G_K , G )
86+
87+ type(scalar_field), dimension (sys_size), intent (in ) :: q_vf
88+ integer , intent (in ) :: i, j, k
89+ real (kind (0d0 )), intent (out ), target :: rho, gamma, pi_inf, qv
90+ real (kind (0d0 )), optional, dimension (2 ), intent (out ) :: Re_K
91+ real (kind (0d0 )), optional, intent (out ) :: G_K
92+ real (kind (0d0 )), optional, dimension (num_fluids), intent (in ) :: G
93+
94+ if (model_eqns == 1 ) then ! Gamma/ pi_inf model
95+ call s_convert_mixture_to_mixture_variables(q_vf, i, j, k, &
96+ rho, gamma, pi_inf, qv, Re_K, G_K, G)
97+
98+ else if (bubbles) then
99+ call s_convert_species_to_mixture_variables_bubbles(q_vf, i, j, k, &
100+ rho, gamma, pi_inf, qv, Re_K, G_K, G)
101+ else
102+ ! Volume fraction model
103+ call s_convert_species_to_mixture_variables(q_vf, i, j, k, &
104+ rho, gamma, pi_inf, qv, Re_K, G_K, G)
105+ end if
106+
107+ end subroutine s_convert_to_mixture_variables
108+
118109 !> This procedure conditionally calculates the appropriate pressure
119110 !! @param energy Energy
120111 !! @param alf Void Fraction
@@ -128,7 +119,7 @@ contains
128119 !! @param mom Momentum
129120 subroutine s_compute_pressure (energy , alf , dyn_p , pi_inf , gamma , rho , qv , rhoYks , pres , T , stress , mom , G )
130121
131- #ifdef CRAY_ACC_WAR
122+ #ifdef _CRAYFTN
132123 !DIR$ INLINEALWAYS s_compute_pressure
133124#else
134125 !$acc routine seq
@@ -473,7 +464,7 @@ contains
473464 gamma_K , pi_inf_K , qv_K , &
474465 alpha_K , alpha_rho_K , Re_K , k , l , r , &
475466 G_K , G )
476- #ifdef CRAY_ACC_WAR
467+ #ifdef _CRAYFTN
477468 !DIR$ INLINEALWAYS s_convert_species_to_mixture_variables_acc
478469#else
479470 !$acc routine seq
@@ -555,7 +546,7 @@ contains
555546 subroutine s_convert_species_to_mixture_variables_bubbles_acc (rho_K , &
556547 gamma_K , pi_inf_K , qv_K , &
557548 alpha_K , alpha_rho_K , Re_K , k , l , r )
558- #ifdef CRAY_ACC_WAR
549+ #ifdef _CRAYFTN
559550 !DIR$ INLINEALWAYS s_convert_species_to_mixture_variables_bubbles_acc
560551#else
561552 !$acc routine seq
@@ -748,18 +739,6 @@ contains
748739 end if
749740#endif
750741
751- if (model_eqns == 1 ) then ! Gamma/ pi_inf model
752- s_convert_to_mixture_variables = > &
753- s_convert_mixture_to_mixture_variables
754-
755- else if (bubbles) then
756- s_convert_to_mixture_variables = > &
757- s_convert_species_to_mixture_variables_bubbles
758- else
759- ! Volume fraction model
760- s_convert_to_mixture_variables = > &
761- s_convert_species_to_mixture_variables
762- end if
763742 end subroutine s_initialize_variables_conversion_module
764743
765744 !Initialize mv at the quadrature nodes based on the initialized moments and sigma
@@ -1393,15 +1372,11 @@ contains
13931372 end if
13941373#endif
13951374
1396- ! Nullifying the procedure pointer to the subroutine transferring/
1397- ! computing the mixture/ species variables to the mixture variables
1398- s_convert_to_mixture_variables = > null()
1399-
14001375 end subroutine s_finalize_variables_conversion_module
14011376
14021377#ifndef MFC_PRE_PROCESS
1403- subroutine s_compute_speed_of_sound (pres , rho , gamma , pi_inf , H , adv , vel_sum , c_c , c )
1404- #ifdef CRAY_ACC_WAR
1378+ pure subroutine s_compute_speed_of_sound (pres , rho , gamma , pi_inf , H , adv , vel_sum , c_c , c )
1379+ #ifdef _CRAYFTN
14051380 !DIR$ INLINEALWAYS s_compute_speed_of_sound
14061381#else
14071382 !$acc routine seq
0 commit comments