From c142fe3c9ba13c57396c9023d1b52d19aee49554 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 00:31:39 -0500 Subject: [PATCH 01/13] Redo the branch --- src/common/m_chemistry.fpp | 321 +++++++++++++++++++++----------- src/common/m_derived_types.fpp | 1 + src/simulation/m_mpi_proxy.fpp | 2 +- toolchain/mfc/run/case_dicts.py | 2 +- 4 files changed, 216 insertions(+), 110 deletions(-) diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index b43905dc7f..7ad5de810f 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -13,7 +13,7 @@ module m_chemistry get_mole_fractions, get_species_binary_mass_diffusivities, & get_species_mass_diffusivities_mixavg, gas_constant, get_mixture_molecular_weight, & get_mixture_energy_mass, get_mixture_thermal_conductivity_mixavg, get_species_enthalpies_rt, & - get_mixture_viscosity_mixavg + get_mixture_viscosity_mixavg, get_mixture_specific_heat_cp_mass, get_mixture_enthalpy_mass use m_global_parameters @@ -174,10 +174,13 @@ contains real(wp), dimension(num_species) :: Xs_L, Xs_R, Xs_cell, Ys_L, Ys_R, Ys_cell real(wp), dimension(num_species) :: mass_diffusivities_mixavg1, mass_diffusivities_mixavg2 real(wp), dimension(num_species) :: mass_diffusivities_mixavg_Cell, dXk_dxi, h_l, h_r, h_k - real(wp), dimension(num_species) :: Mass_Diffu_Flux + real(wp), dimension(num_species) :: Mass_Diffu_Flux, dYk_dxi real(wp) :: Mass_Diffu_Energy real(wp) :: MW_L, MW_R, MW_cell, Rgas_L, Rgas_R, T_L, T_R, P_L, P_R, rho_L, rho_R, rho_cell, rho_Vic real(wp) :: lambda_L, lambda_R, lambda_Cell, dT_dxi, grid_spacing + real(wp) :: Cp_L, Cp_R + real(wp) :: diffusivity_L, diffusivity_R, diffusivity_cell + real(wp) :: hmix_L, hmix_R, dh_dxi integer :: x, y, z, i, n, eqn integer, dimension(3) :: offsets @@ -188,118 +191,220 @@ contains if (chemistry) then ! Set offsets based on direction using array indexing - offsets = 0 - offsets(idir) = 1 - #:block UNDEF_AMD - $:GPU_PARALLEL_LOOP(collapse=3, private='[x,y,z,Ys_L, Ys_R, Ys_cell, Xs_L, Xs_R, mass_diffusivities_mixavg1, mass_diffusivities_mixavg2, mass_diffusivities_mixavg_Cell, h_l, h_r, Xs_cell, h_k, dXk_dxi,Mass_Diffu_Flux, Mass_Diffu_Energy, MW_L, MW_R, MW_cell, Rgas_L, Rgas_R, T_L, T_R, P_L, P_R, rho_L, rho_R, rho_cell, rho_Vic, lambda_L, lambda_R, lambda_Cell, dT_dxi, grid_spacing]', copyin='[offsets]') - do z = isc3%beg, isc3%end - do y = isc2%beg, isc2%end - do x = isc1%beg, isc1%end - ! Calculate grid spacing using direction-based indexing - select case (idir) - case (1) - grid_spacing = x_cc(x + 1) - x_cc(x) - case (2) - grid_spacing = y_cc(y + 1) - y_cc(y) - case (3) - grid_spacing = z_cc(z + 1) - z_cc(z) - end select - - ! Extract species mass fractions - $:GPU_LOOP(parallelism='[seq]') - do i = chemxb, chemxe - Ys_L(i - chemxb + 1) = q_prim_qp(i)%sf(x, y, z) - Ys_R(i - chemxb + 1) = q_prim_qp(i)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) - Ys_cell(i - chemxb + 1) = 0.5_wp*(Ys_L(i - chemxb + 1) + Ys_R(i - chemxb + 1)) - end do - - ! Calculate molecular weights and mole fractions - call get_mixture_molecular_weight(Ys_L, MW_L) - call get_mixture_molecular_weight(Ys_R, MW_R) - MW_cell = 0.5_wp*(MW_L + MW_R) - - call get_mole_fractions(MW_L, Ys_L, Xs_L) - call get_mole_fractions(MW_R, Ys_R, Xs_R) - - ! Calculate gas constants and thermodynamic properties - Rgas_L = gas_constant/MW_L - Rgas_R = gas_constant/MW_R - - P_L = q_prim_qp(E_idx)%sf(x, y, z) - P_R = q_prim_qp(E_idx)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) - - rho_L = q_prim_qp(1)%sf(x, y, z) - rho_R = q_prim_qp(1)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) - - T_L = P_L/rho_L/Rgas_L - T_R = P_R/rho_R/Rgas_R - - rho_cell = 0.5_wp*(rho_L + rho_R) - dT_dxi = (T_R - T_L)/grid_spacing - - ! Get transport properties - call get_species_mass_diffusivities_mixavg(P_L, T_L, Ys_L, mass_diffusivities_mixavg1) - call get_species_mass_diffusivities_mixavg(P_R, T_R, Ys_R, mass_diffusivities_mixavg2) - - call get_mixture_thermal_conductivity_mixavg(T_L, Ys_L, lambda_L) - call get_mixture_thermal_conductivity_mixavg(T_R, Ys_R, lambda_R) - - call get_species_enthalpies_rt(T_L, h_l) - call get_species_enthalpies_rt(T_R, h_r) - - ! Calculate species properties and gradients - $:GPU_LOOP(parallelism='[seq]') - do i = chemxb, chemxe - h_l(i - chemxb + 1) = h_l(i - chemxb + 1)*gas_constant*T_L/molecular_weights(i - chemxb + 1) - h_r(i - chemxb + 1) = h_r(i - chemxb + 1)*gas_constant*T_R/molecular_weights(i - chemxb + 1) - Xs_cell(i - chemxb + 1) = 0.5_wp*(Xs_L(i - chemxb + 1) + Xs_R(i - chemxb + 1)) - h_k(i - chemxb + 1) = 0.5_wp*(h_l(i - chemxb + 1) + h_r(i - chemxb + 1)) - dXk_dxi(i - chemxb + 1) = (Xs_R(i - chemxb + 1) - Xs_L(i - chemxb + 1))/grid_spacing - end do - - ! Calculate mixture-averaged diffusivities - $:GPU_LOOP(parallelism='[seq]') - do i = chemxb, chemxe - mass_diffusivities_mixavg_Cell(i - chemxb + 1) = & - (mass_diffusivities_mixavg2(i - chemxb + 1) + mass_diffusivities_mixavg1(i - chemxb + 1))/2.0_wp - end do - - lambda_Cell = 0.5_wp*(lambda_R + lambda_L) - - ! Calculate mass diffusion fluxes - rho_Vic = 0.0_wp - Mass_Diffu_Energy = 0.0_wp - - $:GPU_LOOP(parallelism='[seq]') - do eqn = chemxb, chemxe - Mass_Diffu_Flux(eqn - chemxb + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn - chemxb + 1)* & - molecular_weights(eqn - chemxb + 1)/MW_cell*dXk_dxi(eqn - chemxb + 1) - rho_Vic = rho_Vic + Mass_Diffu_Flux(eqn - chemxb + 1) - Mass_Diffu_Energy = Mass_Diffu_Energy + h_k(eqn - chemxb + 1)*Mass_Diffu_Flux(eqn - chemxb + 1) - end do - - ! Apply corrections for mass conservation - $:GPU_LOOP(parallelism='[seq]') - do eqn = chemxb, chemxe - Mass_Diffu_Energy = Mass_Diffu_Energy - h_k(eqn - chemxb + 1)*Ys_cell(eqn - chemxb + 1)*rho_Vic - Mass_Diffu_Flux(eqn - chemxb + 1) = Mass_Diffu_Flux(eqn - chemxb + 1) - rho_Vic*Ys_cell(eqn - chemxb + 1) - end do - - ! Add thermal conduction contribution - Mass_Diffu_Energy = lambda_Cell*dT_dxi + Mass_Diffu_Energy - - ! Update flux arrays - flux_src_vf(E_idx)%sf(x, y, z) = flux_src_vf(E_idx)%sf(x, y, z) - Mass_Diffu_Energy - - $:GPU_LOOP(parallelism='[seq]') - do eqn = chemxb, chemxe - flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_diffu_Flux(eqn - chemxb + 1) + ! ========================================== + ! Model 1: Mixture-Average Transport + ! ========================================== + if (chem_params%transport_model == 1) then + #:block UNDEF_AMD + ! Note: Added 'i' and 'eqn' to private list. + $:GPU_PARALLEL_LOOP(collapse=3, private='[x,y,z,i,eqn,Ys_L, Ys_R, Ys_cell, Xs_L, Xs_R, mass_diffusivities_mixavg1, mass_diffusivities_mixavg2, mass_diffusivities_mixavg_Cell, h_l, h_r, Xs_cell, h_k, dXk_dxi,Mass_Diffu_Flux, Mass_Diffu_Energy, MW_L, MW_R, MW_cell, Rgas_L, Rgas_R, T_L, T_R, P_L, P_R, rho_L, rho_R, rho_cell, rho_Vic, lambda_L, lambda_R, lambda_Cell, dT_dxi, grid_spacing]', copyin='[offsets]') + do z = isc3%beg, isc3%end + do y = isc2%beg, isc2%end + do x = isc1%beg, isc1%end + ! Calculate grid spacing using direction-based indexing + select case (idir) + case (1) + grid_spacing = x_cc(x + 1) - x_cc(x) + case (2) + grid_spacing = y_cc(y + 1) - y_cc(y) + case (3) + grid_spacing = z_cc(z + 1) - z_cc(z) + end select + + ! Extract species mass fractions + $:GPU_LOOP(parallelism='[seq]') + do i = chemxb, chemxe + Ys_L(i - chemxb + 1) = q_prim_qp(i)%sf(x, y, z) + Ys_R(i - chemxb + 1) = q_prim_qp(i)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + Ys_cell(i - chemxb + 1) = 0.5_wp*(Ys_L(i - chemxb + 1) + Ys_R(i - chemxb + 1)) + end do + + ! Calculate molecular weights and mole fractions + call get_mixture_molecular_weight(Ys_L, MW_L) + call get_mixture_molecular_weight(Ys_R, MW_R) + MW_cell = 0.5_wp*(MW_L + MW_R) + + call get_mole_fractions(MW_L, Ys_L, Xs_L) + call get_mole_fractions(MW_R, Ys_R, Xs_R) + + ! Calculate gas constants and thermodynamic properties + Rgas_L = gas_constant/MW_L + Rgas_R = gas_constant/MW_R + + P_L = q_prim_qp(E_idx)%sf(x, y, z) + P_R = q_prim_qp(E_idx)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + + rho_L = q_prim_qp(1)%sf(x, y, z) + rho_R = q_prim_qp(1)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + + T_L = P_L/rho_L/Rgas_L + T_R = P_R/rho_R/Rgas_R + + rho_cell = 0.5_wp*(rho_L + rho_R) + dT_dxi = (T_R - T_L)/grid_spacing + + ! Get transport properties + call get_species_mass_diffusivities_mixavg(P_L, T_L, Ys_L, mass_diffusivities_mixavg1) + call get_species_mass_diffusivities_mixavg(P_R, T_R, Ys_R, mass_diffusivities_mixavg2) + + call get_mixture_thermal_conductivity_mixavg(T_L, Ys_L, lambda_L) + call get_mixture_thermal_conductivity_mixavg(T_R, Ys_R, lambda_R) + + call get_species_enthalpies_rt(T_L, h_l) + call get_species_enthalpies_rt(T_R, h_r) + + ! Calculate species properties and gradients + $:GPU_LOOP(parallelism='[seq]') + do i = chemxb, chemxe + h_l(i - chemxb + 1) = h_l(i - chemxb + 1)*gas_constant*T_L/molecular_weights(i - chemxb + 1) + h_r(i - chemxb + 1) = h_r(i - chemxb + 1)*gas_constant*T_R/molecular_weights(i - chemxb + 1) + Xs_cell(i - chemxb + 1) = 0.5_wp*(Xs_L(i - chemxb + 1) + Xs_R(i - chemxb + 1)) + h_k(i - chemxb + 1) = 0.5_wp*(h_l(i - chemxb + 1) + h_r(i - chemxb + 1)) + dXk_dxi(i - chemxb + 1) = (Xs_R(i - chemxb + 1) - Xs_L(i - chemxb + 1))/grid_spacing + end do + + ! Calculate mixture-averaged diffusivities + $:GPU_LOOP(parallelism='[seq]') + do i = chemxb, chemxe + mass_diffusivities_mixavg_Cell(i - chemxb + 1) = & + (mass_diffusivities_mixavg2(i - chemxb + 1) + mass_diffusivities_mixavg1(i - chemxb + 1))/2.0_wp + end do + + lambda_Cell = 0.5_wp*(lambda_R + lambda_L) + + ! Calculate mass diffusion fluxes + rho_Vic = 0.0_wp + Mass_Diffu_Energy = 0.0_wp + + $:GPU_LOOP(parallelism='[seq]') + do eqn = chemxb, chemxe + Mass_Diffu_Flux(eqn - chemxb + 1) = rho_cell*mass_diffusivities_mixavg_Cell(eqn - chemxb + 1)* & + molecular_weights(eqn - chemxb + 1)/MW_cell*dXk_dxi(eqn - chemxb + 1) + rho_Vic = rho_Vic + Mass_Diffu_Flux(eqn - chemxb + 1) + Mass_Diffu_Energy = Mass_Diffu_Energy + h_k(eqn - chemxb + 1)*Mass_Diffu_Flux(eqn - chemxb + 1) + end do + + ! Apply corrections for mass conservation + $:GPU_LOOP(parallelism='[seq]') + do eqn = chemxb, chemxe + Mass_Diffu_Energy = Mass_Diffu_Energy - h_k(eqn - chemxb + 1)*Ys_cell(eqn - chemxb + 1)*rho_Vic + Mass_Diffu_Flux(eqn - chemxb + 1) = Mass_Diffu_Flux(eqn - chemxb + 1) - rho_Vic*Ys_cell(eqn - chemxb + 1) + end do + + ! Add thermal conduction contribution + Mass_Diffu_Energy = lambda_Cell*dT_dxi + Mass_Diffu_Energy + + ! Update flux arrays + flux_src_vf(E_idx)%sf(x, y, z) = flux_src_vf(E_idx)%sf(x, y, z) - Mass_Diffu_Energy + + $:GPU_LOOP(parallelism='[seq]') + do eqn = chemxb, chemxe + flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) + end do + end do + end do + $:END_GPU_PARALLEL_LOOP() + #:endblock UNDEF_AMD + + ! ========================================== + ! Model 2: Unity Lewis Number / Constant + ! ========================================== + else if (chem_params%transport_model == 2) then + #:block UNDEF_AMD + ! Note: Added ALL scalars and 'i'/'eqn' to private list to prevent race conditions. + $:GPU_PARALLEL_LOOP(collapse=3, private='[x,y,z,i,eqn,Ys_L, Ys_R, Ys_cell, dYk_dxi, Mass_Diffu_Flux, grid_spacing, MW_L, MW_R, MW_cell, Rgas_L, Rgas_R, P_L, P_R, rho_L, rho_R, rho_cell, T_L, T_R, Cp_L, Cp_R, hmix_L, hmix_R, dh_dxi, lambda_L, lambda_R, lambda_Cell, diffusivity_L, diffusivity_R, diffusivity_cell, Mass_Diffu_Energy]', copyin='[offsets]') + do z = isc3%beg, isc3%end + do y = isc2%beg, isc2%end + do x = isc1%beg, isc1%end + ! Calculate grid spacing using direction-based indexing + select case (idir) + case (1) + grid_spacing = x_cc(x + 1) - x_cc(x) + case (2) + grid_spacing = y_cc(y + 1) - y_cc(y) + case (3) + grid_spacing = z_cc(z + 1) - z_cc(z) + end select + + ! Extract species mass fractions + $:GPU_LOOP(parallelism='[seq]') + do i = chemxb, chemxe + Ys_L(i - chemxb + 1) = q_prim_qp(i)%sf(x, y, z) + Ys_R(i - chemxb + 1) = q_prim_qp(i)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + Ys_cell(i - chemxb + 1) = 0.5_wp*(Ys_L(i - chemxb + 1) + Ys_R(i - chemxb + 1)) + end do + + ! Calculate molecular weights and mole fractions + call get_mixture_molecular_weight(Ys_L, MW_L) + call get_mixture_molecular_weight(Ys_R, MW_R) + MW_cell = 0.5_wp*(MW_L + MW_R) + + ! Calculate gas constants and thermodynamic properties + Rgas_L = gas_constant/MW_L + Rgas_R = gas_constant/MW_R + + P_L = q_prim_qp(E_idx)%sf(x, y, z) + P_R = q_prim_qp(E_idx)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + + rho_L = q_prim_qp(1)%sf(x, y, z) + rho_R = q_prim_qp(1)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + + T_L = P_L/rho_L/Rgas_L + T_R = P_R/rho_R/Rgas_R + + rho_cell = 0.5_wp*(rho_L + rho_R) + + call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) + call get_mixture_specific_heat_cp_mass(T_R, Ys_R, Cp_R) + call get_mixture_enthalpy_mass(T_L, Ys_L, hmix_L) + call get_mixture_enthalpy_mass(T_R, Ys_R, hmix_R) + dh_dxi = (hmix_R - hmix_L)/grid_spacing + + ! Get transport properties + call get_mixture_thermal_conductivity_mixavg(T_L, Ys_L, lambda_L) + call get_mixture_thermal_conductivity_mixavg(T_R, Ys_R, lambda_R) + + ! Calculate species properties and gradients + $:GPU_LOOP(parallelism='[seq]') + do i = chemxb, chemxe + dYk_dxi(i - chemxb + 1) = (Ys_R(i - chemxb + 1) - & + Ys_L(i - chemxb + 1))/grid_spacing + end do + + ! Calculate mixture-averaged diffusivities + diffusivity_L = lambda_L/rho_L/Cp_L + diffusivity_R = lambda_R/rho_R/Cp_R + + lambda_Cell = 0.5_wp*(lambda_R + lambda_L) + diffusivity_Cell = 0.5_wp*(diffusivity_R + diffusivity_L) + + ! Calculate mass diffusion fluxes + Mass_Diffu_Energy = 0.0_wp + + $:GPU_LOOP(parallelism='[seq]') + do eqn = chemxb, chemxe + Mass_Diffu_Flux(eqn - chemxb + 1) = rho_cell* & + diffusivity_cell* & + dYk_dxi(eqn - chemxb + 1) + end do + Mass_Diffu_Energy = rho_cell*diffusivity_cell*dh_dxi + + ! Update flux arrays + flux_src_vf(E_idx)%sf(x, y, z) = flux_src_vf(E_idx)%sf(x, y, z) - Mass_Diffu_Energy + + $:GPU_LOOP(parallelism='[seq]') + do eqn = chemxb, chemxe + flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) + end do end do end do end do end do $:END_GPU_PARALLEL_LOOP() #:endblock UNDEF_AMD + $:END_GPU_PARALLEL_LOOP() + #:endblock UNDEF_AMD + end if end if end subroutine s_compute_chemistry_diffusion_flux diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 3b4bfcf17e..0a9fbe5f14 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -440,6 +440,7 @@ module m_derived_types !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. integer :: gamma_method + integer :: transport_method end type chemistry_parameters !> Lagrangian bubble parameters diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index 9f19c9f27f..2aa3ecf1b8 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -125,7 +125,7 @@ contains call MPI_BCAST(chem_params%${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr) #:endfor - #:for VAR in [ 'gamma_method' ] + #:for VAR in [ 'gamma_method', 'transport_model' ] call MPI_BCAST(chem_params%${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) #:endfor end if diff --git a/toolchain/mfc/run/case_dicts.py b/toolchain/mfc/run/case_dicts.py index c27632b56a..bead7eae05 100644 --- a/toolchain/mfc/run/case_dicts.py +++ b/toolchain/mfc/run/case_dicts.py @@ -356,7 +356,7 @@ def analytic(self): for var in [ 'diffusion', 'reactions' ]: SIMULATION[f'chem_params%{var}'] = ParamType.LOG -for var in [ 'gamma_method' ]: +for var in [ 'gamma_method', 'transport_model']: SIMULATION[f'chem_params%{var}'] = ParamType.INT for ib_id in range(1, 10+1): From d18106bae0157bd42d58c6df4d82630d41cd0ceb Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 00:34:54 -0500 Subject: [PATCH 02/13] Forgotten stuff --- src/pre_process/m_global_parameters.fpp | 5 ++++- src/simulation/m_global_parameters.fpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index 9845def8d8..993c6b948a 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -217,6 +217,7 @@ module m_global_parameters real(wp) :: rhoref, pref !< Reference parameters for Tait EOS +type(chemistry_parameters) :: chem_params !> @name Bubble modeling !> @{ integer :: nb @@ -568,7 +569,9 @@ contains patch_ib(i)%rotation_matrix(3, 3) = 1._wp patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix end do - + + chem_params%transport_model = 1 + ! Fluids physical parameters do i = 1, num_fluids_max fluid_pp(i)%gamma = dflt_real diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 88e7b4d978..cdd5f6c666 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -646,6 +646,7 @@ contains chem_params%diffusion = .false. chem_params%reactions = .false. chem_params%gamma_method = 1 + chem_params%transport_model = 1 num_bc_patches = 0 bc_io = .false. From 4e5a63f7415e5a37dde62b74e205388dbbb58ac5 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 00:43:27 -0500 Subject: [PATCH 03/13] aaaaaa --- src/common/m_chemistry.fpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index 7ad5de810f..690d02457f 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -301,8 +301,9 @@ contains do eqn = chemxb, chemxe flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) end do - end do + end do end do + end do $:END_GPU_PARALLEL_LOOP() #:endblock UNDEF_AMD @@ -396,14 +397,11 @@ contains do eqn = chemxb, chemxe flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) end do - end do end do end do end do $:END_GPU_PARALLEL_LOOP() #:endblock UNDEF_AMD - $:END_GPU_PARALLEL_LOOP() - #:endblock UNDEF_AMD end if end if From 3ac569055255260b1635f17ffe23d1fd43c2fb18 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 01:11:54 -0500 Subject: [PATCH 04/13] Wrong Syntax --- src/common/m_derived_types.fpp | 2 +- src/post_process/m_global_parameters.fpp | 4 ++++ src/pre_process/m_global_parameters.fpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 0a9fbe5f14..4c475e4196 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -440,7 +440,7 @@ module m_derived_types !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. integer :: gamma_method - integer :: transport_method + integer :: transport_model end type chemistry_parameters !> Lagrangian bubble parameters diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index fbcd42887f..1df57fdc6a 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -300,6 +300,7 @@ module m_global_parameters real(wp) :: rhoref, pref !> @} +type(chemistry_parameters) :: chem_params !> @name Bubble modeling variables and parameters !> @{ integer :: nb @@ -416,6 +417,9 @@ contains #:endfor #:endfor + chem_params%gamma_method = 1 + chem_params%transport_model = 1 + ! Fluids physical parameters do i = 1, num_fluids_max fluid_pp(i)%gamma = dflt_real diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index 993c6b948a..ca8f1796c8 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -570,6 +570,7 @@ contains patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix end do + chem_params%gamma_method = 1 chem_params%transport_model = 1 ! Fluids physical parameters From 7f5bac81239ab9a37d7b998c70bd07096ea165f8 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 01:43:07 -0500 Subject: [PATCH 05/13] Format --- examples/1D_MultiComponent/case.py | 105 ++++++++++++++++++++++ examples/1D_MultiComponent/grigri.yaml | 108 +++++++++++++++++++++++ src/common/m_chemistry.fpp | 15 ++-- src/post_process/m_global_parameters.fpp | 2 +- src/pre_process/m_global_parameters.fpp | 8 +- 5 files changed, 227 insertions(+), 11 deletions(-) create mode 100644 examples/1D_MultiComponent/case.py create mode 100644 examples/1D_MultiComponent/grigri.yaml diff --git a/examples/1D_MultiComponent/case.py b/examples/1D_MultiComponent/case.py new file mode 100644 index 0000000000..129769cf4c --- /dev/null +++ b/examples/1D_MultiComponent/case.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +# References: +# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.3. Multi-component inert shock tube + +import json +import argparse +import math + +import cantera as ct + +parser = argparse.ArgumentParser(prog="nD_inert_shocktube", formatter_class=argparse.ArgumentDefaultsHelpFormatter) + +parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.") +parser.add_argument("--no-chem", dest="chemistry", default=True, action="store_false", help="Disable chemistry.") + +args = parser.parse_args() + +ctfile = "grigri.yaml" +sol_L = ct.Solution(ctfile) +sol_L.TPX = 300, 8000, "O2:2,N2:2,H2O:5" + +L = 0.05 +Nx = 100 +dx = L / Nx +dt = 0.3e-6 +Tend = 0.05 + +NT = int(Tend / dt) +SAVE_COUNT = 2000 +NS = 2000 +case = { + # Logistics ================================================================ + "run_time_info": "T", + # ========================================================================== + # Computational Domain Parameters ========================================== + "x_domain%beg": 0, + "x_domain%end": +L, + "m": Nx, + "n": 0, + "p": 0, + "dt": float(dt), + "t_step_start": 0, + "t_step_stop": NT, + "t_step_save": NS, + "t_step_print": NS, + "parallel_io": "F", + # ========================================================================== + # Simulation Algorithm Parameters ========================================== + "model_eqns": 2, + "num_fluids": 1, + "num_patches": 1, + "mpp_lim": "F", + "mixture_err": "F", + "time_stepper": 3, + "weno_order": 5, + "weno_eps": 1e-16, + "weno_avg": "F", + "mapped_weno": "T", + "mp_weno": "T", + "riemann_solver": 2, + "wave_speeds": 2, + "avg_state": 1, + "bc_x%beg": -1, + "bc_x%end": -1, + "viscous": "F", + # ========================================================================== + # Chemistry ================================================================ + "chemistry": "T" if not args.chemistry else "T", + "chem_params%diffusion": "T", + "chem_params%reactions": "F", + # ========================================================================== + # Formatted Database Files Structure Parameters ============================ + "format": 1, + "precision": 2, + "prim_vars_wrt": "T", + "chem_wrt_T": "T", + # ========================================================================== + # ========================================================================== + "patch_icpp(1)%geometry": 1, + "patch_icpp(1)%x_centroid": L / 2, + "patch_icpp(1)%length_x": L, + "patch_icpp(1)%vel(1)": "0", + "patch_icpp(1)%pres": 1.01325e5, + "patch_icpp(1)%alpha(1)": 1, + "patch_icpp(1)%Y(1)": "(0.195-0.142)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142", + "patch_icpp(1)%Y(2)": "(0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1", + "patch_icpp(1)%Y(3)": "(0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0", + "patch_icpp(1)%Y(4)": "(0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758", + "patch_icpp(1)%alpha_rho(1)": "1.01325d0*10.0d0**(5.0d0)/(((320.0d0-1350.0d0)*(1.0d0-0.50d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+1350.0d0)*8.3144626d0*1000.0d0*( ((0.195d0-0.142d0)*(1.0d0-0.5d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142d0)/31.998d0 +((0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1)/18.01508d0+ ((0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0)/16.04256 + ((0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758)/28.0134))", + # ========================================================================== + # Fluids Physical Parameters =============================================== + "fluid_pp(1)%gamma": 1.0e00 / (1.9326e00 - 1.0e00), + "fluid_pp(1)%pi_inf": 0, + # 'fluid_pp(1)%Re(1)' : 20000000, + # ========================================================================== + # Chemistry ================================================================ + "cantera_file": ctfile, + # ========================================================================== +} + +if args.chemistry: + for i in range(4): + case[f"chem_wrt_Y({i + 1})"] = "T" +if __name__ == "__main__": + print(json.dumps(case)) diff --git a/examples/1D_MultiComponent/grigri.yaml b/examples/1D_MultiComponent/grigri.yaml new file mode 100644 index 0000000000..fd811075e6 --- /dev/null +++ b/examples/1D_MultiComponent/grigri.yaml @@ -0,0 +1,108 @@ +description: |- + GRI-Mech Version 3.0 7/30/99 CHEMKIN-II format + See README30 file at anonymous FTP site unix.sri.com, directory gri; + WorldWideWeb home page http://www.me.berkeley.edu/gri_mech/ or + through http://www.gri.org , under 'Basic Research', + for additional information, contacts, and disclaimer + + Updated webpage at http://combustion.berkeley.edu/gri-mech/version30/text30.html + +generator: ck2yaml +input-files: [gri30.inp, gri30_thermo.dat, gri30_tran.dat] +cantera-version: 2.5.0 +date: Wed, 11 Dec 2019 16:59:02 -0500 + +units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol} + +phases: +- name: gri30 + thermo: ideal-gas + elements: [O, H, C, N] + species: [O2, H2O, CH4, N2] + kinetics: gas + transport: mixture-averaged + state: {T: 300.0, P: 1 atm} + +species: +- name: O2 + composition: {O: 2} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 3500.0] + data: + - [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12, + -1063.94356, 3.65767573] + - [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14, + -1088.45772, 5.45323129] + note: TPIS89 + transport: + model: gas + geometry: linear + well-depth: 107.4 + diameter: 3.458 + polarizability: 1.6 + rotational-relaxation: 3.8 +- name: H2O + composition: {H: 2, O: 1} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 3500.0] + data: + - [4.19864056, -2.0364341e-03, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12, + -3.02937267e+04, -0.849032208] + - [3.03399249, 2.17691804e-03, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14, + -3.00042971e+04, 4.9667701] + note: L8/89 + transport: + model: gas + geometry: nonlinear + well-depth: 572.4 + diameter: 2.605 + dipole: 1.844 + rotational-relaxation: 4.0 +- name: CH4 + composition: {C: 1, H: 4} + thermo: + model: NASA7 + temperature-ranges: [200.0, 1000.0, 3500.0] + data: + - [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11, + -1.02466476e+04, -4.64130376] + - [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13, + -9468.34459, 18.437318] + note: L8/88 + transport: + model: gas + geometry: nonlinear + well-depth: 141.4 + diameter: 3.746 + polarizability: 2.6 + rotational-relaxation: 13.0 +- name: N2 + composition: {N: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.298677, 1.4082404e-03, -3.963222e-06, 5.641515e-09, -2.444854e-12, + -1020.8999, 3.950372] + - [2.92664, 1.4879768e-03, -5.68476e-07, 1.0097038e-10, -6.753351e-15, + -922.7977, 5.980528] + note: '121286' + transport: + model: gas + geometry: linear + well-depth: 97.53 + diameter: 3.621 + polarizability: 1.76 + rotational-relaxation: 4.0 + +reactions: +- equation: CH4 <=> CH4 # Reaction 1 + rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} +- equation: N2 <=> N2 # Reaction 2 + rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} +- equation: H2O <=> H2O # Reaction 3 + rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} +- equation: O2 <=> O2 # Reaction 4 + rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index 690d02457f..4032087917 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -190,8 +190,10 @@ contains $:GPU_UPDATE(device='[isc1,isc2,isc3]') if (chemistry) then + offsets = 0 + offsets(idir) = 1 ! Set offsets based on direction using array indexing - ! ========================================== + ! ========================================== ! Model 1: Mixture-Average Transport ! ========================================== if (chem_params%transport_model == 1) then @@ -301,9 +303,9 @@ contains do eqn = chemxb, chemxe flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) end do - end do + end do + end do end do - end do $:END_GPU_PARALLEL_LOOP() #:endblock UNDEF_AMD @@ -317,6 +319,7 @@ contains do z = isc3%beg, isc3%end do y = isc2%beg, isc2%end do x = isc1%beg, isc1%end + print *, 'h3h3' ! Calculate grid spacing using direction-based indexing select case (idir) case (1) @@ -397,11 +400,11 @@ contains do eqn = chemxb, chemxe flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, z) - Mass_Diffu_Flux(eqn - chemxb + 1) end do + end do end do end do - end do - $:END_GPU_PARALLEL_LOOP() - #:endblock UNDEF_AMD + $:END_GPU_PARALLEL_LOOP() + #:endblock UNDEF_AMD end if end if diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 1df57fdc6a..22b4824924 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -300,7 +300,7 @@ module m_global_parameters real(wp) :: rhoref, pref !> @} -type(chemistry_parameters) :: chem_params + type(chemistry_parameters) :: chem_params !> @name Bubble modeling variables and parameters !> @{ integer :: nb diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index ca8f1796c8..3d7448a611 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -217,7 +217,7 @@ module m_global_parameters real(wp) :: rhoref, pref !< Reference parameters for Tait EOS -type(chemistry_parameters) :: chem_params + type(chemistry_parameters) :: chem_params !> @name Bubble modeling !> @{ integer :: nb @@ -569,10 +569,10 @@ contains patch_ib(i)%rotation_matrix(3, 3) = 1._wp patch_ib(i)%rotation_matrix_inverse = patch_ib(i)%rotation_matrix end do - - chem_params%gamma_method = 1 + + chem_params%gamma_method = 1 chem_params%transport_model = 1 - + ! Fluids physical parameters do i = 1, num_fluids_max fluid_pp(i)%gamma = dflt_real From a0012916d5f8d371096062d3e9a8b0de7994ec15 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 01:43:33 -0500 Subject: [PATCH 06/13] Format/Lint --- examples/1D_MultiComponent/case.py | 105 ------------------------ examples/1D_MultiComponent/grigri.yaml | 108 ------------------------- 2 files changed, 213 deletions(-) delete mode 100644 examples/1D_MultiComponent/case.py delete mode 100644 examples/1D_MultiComponent/grigri.yaml diff --git a/examples/1D_MultiComponent/case.py b/examples/1D_MultiComponent/case.py deleted file mode 100644 index 129769cf4c..0000000000 --- a/examples/1D_MultiComponent/case.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python3 -# References: -# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.3. Multi-component inert shock tube - -import json -import argparse -import math - -import cantera as ct - -parser = argparse.ArgumentParser(prog="nD_inert_shocktube", formatter_class=argparse.ArgumentDefaultsHelpFormatter) - -parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.") -parser.add_argument("--no-chem", dest="chemistry", default=True, action="store_false", help="Disable chemistry.") - -args = parser.parse_args() - -ctfile = "grigri.yaml" -sol_L = ct.Solution(ctfile) -sol_L.TPX = 300, 8000, "O2:2,N2:2,H2O:5" - -L = 0.05 -Nx = 100 -dx = L / Nx -dt = 0.3e-6 -Tend = 0.05 - -NT = int(Tend / dt) -SAVE_COUNT = 2000 -NS = 2000 -case = { - # Logistics ================================================================ - "run_time_info": "T", - # ========================================================================== - # Computational Domain Parameters ========================================== - "x_domain%beg": 0, - "x_domain%end": +L, - "m": Nx, - "n": 0, - "p": 0, - "dt": float(dt), - "t_step_start": 0, - "t_step_stop": NT, - "t_step_save": NS, - "t_step_print": NS, - "parallel_io": "F", - # ========================================================================== - # Simulation Algorithm Parameters ========================================== - "model_eqns": 2, - "num_fluids": 1, - "num_patches": 1, - "mpp_lim": "F", - "mixture_err": "F", - "time_stepper": 3, - "weno_order": 5, - "weno_eps": 1e-16, - "weno_avg": "F", - "mapped_weno": "T", - "mp_weno": "T", - "riemann_solver": 2, - "wave_speeds": 2, - "avg_state": 1, - "bc_x%beg": -1, - "bc_x%end": -1, - "viscous": "F", - # ========================================================================== - # Chemistry ================================================================ - "chemistry": "T" if not args.chemistry else "T", - "chem_params%diffusion": "T", - "chem_params%reactions": "F", - # ========================================================================== - # Formatted Database Files Structure Parameters ============================ - "format": 1, - "precision": 2, - "prim_vars_wrt": "T", - "chem_wrt_T": "T", - # ========================================================================== - # ========================================================================== - "patch_icpp(1)%geometry": 1, - "patch_icpp(1)%x_centroid": L / 2, - "patch_icpp(1)%length_x": L, - "patch_icpp(1)%vel(1)": "0", - "patch_icpp(1)%pres": 1.01325e5, - "patch_icpp(1)%alpha(1)": 1, - "patch_icpp(1)%Y(1)": "(0.195-0.142)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142", - "patch_icpp(1)%Y(2)": "(0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1", - "patch_icpp(1)%Y(3)": "(0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0", - "patch_icpp(1)%Y(4)": "(0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758", - "patch_icpp(1)%alpha_rho(1)": "1.01325d0*10.0d0**(5.0d0)/(((320.0d0-1350.0d0)*(1.0d0-0.50d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+1350.0d0)*8.3144626d0*1000.0d0*( ((0.195d0-0.142d0)*(1.0d0-0.5d0*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.142d0)/31.998d0 +((0.0-0.1)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.1)/18.01508d0+ ((0.214-0.0)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.0)/16.04256 + ((0.591-0.758)*(1-0.5*exp(-(x-0.05d0/2.0d0)**2/(2.5d0*10.0d0**(-3.0d0))**2))+0.758)/28.0134))", - # ========================================================================== - # Fluids Physical Parameters =============================================== - "fluid_pp(1)%gamma": 1.0e00 / (1.9326e00 - 1.0e00), - "fluid_pp(1)%pi_inf": 0, - # 'fluid_pp(1)%Re(1)' : 20000000, - # ========================================================================== - # Chemistry ================================================================ - "cantera_file": ctfile, - # ========================================================================== -} - -if args.chemistry: - for i in range(4): - case[f"chem_wrt_Y({i + 1})"] = "T" -if __name__ == "__main__": - print(json.dumps(case)) diff --git a/examples/1D_MultiComponent/grigri.yaml b/examples/1D_MultiComponent/grigri.yaml deleted file mode 100644 index fd811075e6..0000000000 --- a/examples/1D_MultiComponent/grigri.yaml +++ /dev/null @@ -1,108 +0,0 @@ -description: |- - GRI-Mech Version 3.0 7/30/99 CHEMKIN-II format - See README30 file at anonymous FTP site unix.sri.com, directory gri; - WorldWideWeb home page http://www.me.berkeley.edu/gri_mech/ or - through http://www.gri.org , under 'Basic Research', - for additional information, contacts, and disclaimer - - Updated webpage at http://combustion.berkeley.edu/gri-mech/version30/text30.html - -generator: ck2yaml -input-files: [gri30.inp, gri30_thermo.dat, gri30_tran.dat] -cantera-version: 2.5.0 -date: Wed, 11 Dec 2019 16:59:02 -0500 - -units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol} - -phases: -- name: gri30 - thermo: ideal-gas - elements: [O, H, C, N] - species: [O2, H2O, CH4, N2] - kinetics: gas - transport: mixture-averaged - state: {T: 300.0, P: 1 atm} - -species: -- name: O2 - composition: {O: 2} - thermo: - model: NASA7 - temperature-ranges: [200.0, 1000.0, 3500.0] - data: - - [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12, - -1063.94356, 3.65767573] - - [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14, - -1088.45772, 5.45323129] - note: TPIS89 - transport: - model: gas - geometry: linear - well-depth: 107.4 - diameter: 3.458 - polarizability: 1.6 - rotational-relaxation: 3.8 -- name: H2O - composition: {H: 2, O: 1} - thermo: - model: NASA7 - temperature-ranges: [200.0, 1000.0, 3500.0] - data: - - [4.19864056, -2.0364341e-03, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12, - -3.02937267e+04, -0.849032208] - - [3.03399249, 2.17691804e-03, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14, - -3.00042971e+04, 4.9667701] - note: L8/89 - transport: - model: gas - geometry: nonlinear - well-depth: 572.4 - diameter: 2.605 - dipole: 1.844 - rotational-relaxation: 4.0 -- name: CH4 - composition: {C: 1, H: 4} - thermo: - model: NASA7 - temperature-ranges: [200.0, 1000.0, 3500.0] - data: - - [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11, - -1.02466476e+04, -4.64130376] - - [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13, - -9468.34459, 18.437318] - note: L8/88 - transport: - model: gas - geometry: nonlinear - well-depth: 141.4 - diameter: 3.746 - polarizability: 2.6 - rotational-relaxation: 13.0 -- name: N2 - composition: {N: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [3.298677, 1.4082404e-03, -3.963222e-06, 5.641515e-09, -2.444854e-12, - -1020.8999, 3.950372] - - [2.92664, 1.4879768e-03, -5.68476e-07, 1.0097038e-10, -6.753351e-15, - -922.7977, 5.980528] - note: '121286' - transport: - model: gas - geometry: linear - well-depth: 97.53 - diameter: 3.621 - polarizability: 1.76 - rotational-relaxation: 4.0 - -reactions: -- equation: CH4 <=> CH4 # Reaction 1 - rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} -- equation: N2 <=> N2 # Reaction 2 - rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} -- equation: H2O <=> H2O # Reaction 3 - rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} -- equation: O2 <=> O2 # Reaction 4 - rate-constant: {A: 1.927e+13, b: -0.32, Ea: 0.0} From 58910dc811a7ccf2eadcc107a124db930783703a Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 02:23:54 -0500 Subject: [PATCH 07/13] Lint v2 --- src/common/include/ExtrusionHardcodedIC.fpp | 4 ++-- src/common/m_chemistry.fpp | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 264b227f21..73849d80ac 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -48,7 +48,7 @@ real(wp), allocatable :: x_coords(:), y_coords(:) logical :: files_loaded = .false. real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend - character(len=*), parameter :: init_dir = "/home/MFC/FilesDirectory" ! For example /home/MFC/examples/1D_Shock/D/ + character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ character(len=20) :: file_num_str ! For storing the file number as a string character(len=20) :: zeros_part ! For the trailing zeros part character(len=6), parameter :: zeros_default = "000000" ! Default zeros (can be changed) @@ -175,7 +175,7 @@ case (1) idx = i + 1 + global_offset_x do f = 1, sys_size - q_prim_vf(f)%sf(i, 0, 0) = stored_values(idx, 1, f) + q_prim_vf(f)%sf(i, 0, 0) = stored_values(i + 1, 1, f) end do case (2) diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index 4032087917..2c8b1f22e5 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -190,12 +190,11 @@ contains $:GPU_UPDATE(device='[isc1,isc2,isc3]') if (chemistry) then + + ! Set offsets based on direction using array indexing offsets = 0 offsets(idir) = 1 - ! Set offsets based on direction using array indexing - ! ========================================== ! Model 1: Mixture-Average Transport - ! ========================================== if (chem_params%transport_model == 1) then #:block UNDEF_AMD ! Note: Added 'i' and 'eqn' to private list. @@ -309,9 +308,7 @@ contains $:END_GPU_PARALLEL_LOOP() #:endblock UNDEF_AMD - ! ========================================== - ! Model 2: Unity Lewis Number / Constant - ! ========================================== + ! Model 2: Unity Lewis Number else if (chem_params%transport_model == 2) then #:block UNDEF_AMD ! Note: Added ALL scalars and 'i'/'eqn' to private list to prevent race conditions. @@ -319,7 +316,6 @@ contains do z = isc3%beg, isc3%end do y = isc2%beg, isc2%end do x = isc1%beg, isc1%end - print *, 'h3h3' ! Calculate grid spacing using direction-based indexing select case (idir) case (1) From 1da8408f47b50026be775a97e98f49792f872787 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Thu, 11 Dec 2025 03:24:51 -0500 Subject: [PATCH 08/13] Small Change --- src/common/include/ExtrusionHardcodedIC.fpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 73849d80ac..53adc2562f 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -48,7 +48,7 @@ real(wp), allocatable :: x_coords(:), y_coords(:) logical :: files_loaded = .false. real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend - character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ + character(len=*), parameter :: init_dir = "/home/MFC/FilesDirectory" ! For example /home/MFC/examples/1D_Shock/D/ character(len=20) :: file_num_str ! For storing the file number as a string character(len=20) :: zeros_part ! For the trailing zeros part character(len=6), parameter :: zeros_default = "000000" ! Default zeros (can be changed) From 72233e0fdfe79c39dbba4cf21b40f9606b5516ce Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Mon, 15 Dec 2025 11:33:40 -0500 Subject: [PATCH 09/13] Doxygen --- examples/1D_Flamelet/case.py | 92 ++++++ examples/1D_Flamelet/sandiego.yaml | 302 ++++++++++++++++++++ src/common/include/ExtrusionHardcodedIC.fpp | 2 +- 3 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 examples/1D_Flamelet/case.py create mode 100644 examples/1D_Flamelet/sandiego.yaml diff --git a/examples/1D_Flamelet/case.py b/examples/1D_Flamelet/case.py new file mode 100644 index 0000000000..862439500d --- /dev/null +++ b/examples/1D_Flamelet/case.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +# References: +# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.3. Multi-component inert shock tube +import json +import argparse +import math +import cantera as ct +parser = argparse.ArgumentParser( + prog="nD_inert_shocktube", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) +parser.add_argument("--mfc", type=json.loads, default='{}', metavar="DICT", + help="MFC's toolchain's internal state.") +parser.add_argument("--no-chem", dest='chemistry', default=True, action="store_false", + help="Disable chemistry.") +args = parser.parse_args() +ctfile = 'sandiego.yaml' +sol_L = ct.Solution(ctfile) +sol_L.TPX = 300, 8000, 'O2:2,N2:2,H2O:5' +L = 0.016 +Nx = 1199 +dx = L / Nx +dt = 1e-8 +Tend = 0.60e-3 +NT = int(Tend / dt) +SAVE_COUNT = 1000 +NS = 1000 +case = { + # Logistics ================================================================ + 'run_time_info' : 'T', + # ========================================================================== + # Computational Domain Parameters ========================================== + 'x_domain%beg' : -L/2, + 'x_domain%end' : +L/2, + 'm' : Nx, + 'n' : 0, + 'p' : 0, + 'dt' : float(dt), + 't_step_start' : 0, + 't_step_stop' : NT, + 't_step_save' : NS, + 't_step_print' : 100, + 'parallel_io' : 'F', + # ========================================================================== + # Simulation Algorithm Parameters ========================================== + 'model_eqns' : 2, + 'num_fluids' : 1, + 'num_patches' : 1, + 'mpp_lim' : 'F', + 'mixture_err' : 'F', + 'time_stepper' : 3, + 'weno_order' : 5, + 'weno_eps' : 1E-16, + 'weno_avg' : 'F', + 'mapped_weno' : 'T', + 'mp_weno' : 'T', + 'riemann_solver' : 2, + 'wave_speeds' : 2, + 'avg_state' : 1, + 'bc_x%beg' :-8, + 'bc_x%end' :-8, + 'viscous' : 'F', + # ========================================================================== + # Chemistry ================================================================ + 'chemistry' : 'T' if not args.chemistry else 'T', + 'chem_params%diffusion' : 'T', + 'chem_params%reactions' : 'T', + # ========================================================================== + # Formatted Database Files Structure Parameters ============================ + 'format' : 1, + 'precision' : 2, + 'prim_vars_wrt' : 'T', + # ========================================================================== + # ========================================================================== + 'patch_icpp(1)%geometry' : 1, + 'patch_icpp(1)%hcid' : 170, + 'patch_icpp(1)%x_centroid' : 0, + 'patch_icpp(1)%length_x' : L, + 'patch_icpp(1)%vel(1)' : '0', + 'patch_icpp(1)%pres' : 1.01325e5, + 'patch_icpp(1)%alpha(1)' : 1, + 'patch_icpp(1)%alpha_rho(1)' : '1', + # Fluids Physical Parameters =============================================== + 'fluid_pp(1)%gamma' : 1.0E+00/(1.5E+00-1.0E+00), + 'fluid_pp(1)%pi_inf' : 0, + # 'fluid_pp(1)%Re(1)' : 20000000, + # ========================================================================== + # Chemistry ================================================================ + 'cantera_file' : ctfile, + # ========================================================================== +} +if __name__ == '__main__': + print(json.dumps(case)) diff --git a/examples/1D_Flamelet/sandiego.yaml b/examples/1D_Flamelet/sandiego.yaml new file mode 100644 index 0000000000..84986f880f --- /dev/null +++ b/examples/1D_Flamelet/sandiego.yaml @@ -0,0 +1,302 @@ +description: |- + units(length='cm', time='s', quantity='mol', act_energy='kJ/mol') +generator: cti2yaml +cantera-version: 2.6.0 +date: Tue, 21 Jun 2022 15:14:08 -0500 +input-files: [sanDiego.cti] + +units: {length: cm, quantity: mol, activation-energy: kJ/mol} + +phases: +- name: gas + thermo: ideal-gas + elements: [H, O, N] + species: [H2, H, O2, O, OH, HO2, H2O2, H2O, N2] + kinetics: gas + reactions: all + transport: mixture-averaged + state: + T: 300.0 + P: 1.01325e+05 + +species: +- name: H2 + composition: {H: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.34433112, 7.98052075e-03, -1.9478151e-05, 2.01572094e-08, -7.37611761e-12, + -917.935173, 0.683010238] + - [3.3372792, -4.94024731e-05, 4.99456778e-07, -1.79566394e-10, 2.00255376e-14, + -950.158922, -3.20502331] + transport: + model: gas + geometry: linear + diameter: 2.92 + well-depth: 38.0 + polarizability: 0.79 + rotational-relaxation: 280.0 + note: '000000' +- name: H + composition: {H: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18, -9.27732332e-22, + 2.54736599e+04, -0.446682853] + - [2.50000001, -2.30842973e-11, 1.61561948e-14, -4.73515235e-18, 4.98197357e-22, + 2.54736599e+04, -0.446682914] + transport: + model: gas + geometry: atom + diameter: 2.05 + well-depth: 145.0 + note: '000000' +- name: O2 + composition: {O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12, + -1063.94356, 3.65767573] + - [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14, + -1088.45772, 5.45323129] + transport: + model: gas + geometry: linear + diameter: 3.458 + well-depth: 107.4 + polarizability: 1.6 + rotational-relaxation: 3.8 + note: '000000' +- name: O + composition: {O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.1682671, -3.27931884e-03, 6.64306396e-06, -6.12806624e-09, 2.11265971e-12, + 2.91222592e+04, 2.05193346] + - [2.56942078, -8.59741137e-05, 4.19484589e-08, -1.00177799e-11, 1.22833691e-15, + 2.92175791e+04, 4.78433864] + transport: + model: gas + geometry: atom + diameter: 2.75 + well-depth: 80.0 + note: '000000' +- name: OH + composition: {H: 1, O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [4.12530561, -3.22544939e-03, 6.52764691e-06, -5.79853643e-09, 2.06237379e-12, + 3381.53812, -0.69043296] + - [2.86472886, 1.05650448e-03, -2.59082758e-07, 3.05218674e-11, -1.33195876e-15, + 3718.85774, 5.70164073] + transport: + model: gas + geometry: linear + diameter: 2.75 + well-depth: 80.0 + note: '000000' +- name: HO2 + composition: {H: 1, O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [4.30179801, -4.74912051e-03, 2.11582891e-05, -2.42763894e-08, 9.29225124e-12, + 294.80804, 3.71666245] + - [4.0172109, 2.23982013e-03, -6.3365815e-07, 1.1424637e-10, -1.07908535e-14, + 111.856713, 3.78510215] + transport: + model: gas + geometry: nonlinear + diameter: 3.458 + well-depth: 107.4 + rotational-relaxation: 1.0 + note: '000000' +- name: H2O2 + composition: {H: 2, O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [4.27611269, -5.42822417e-04, 1.67335701e-05, -2.15770813e-08, 8.62454363e-12, + -1.77025821e+04, 3.43505074] + - [4.16500285, 4.90831694e-03, -1.90139225e-06, 3.71185986e-10, -2.87908305e-14, + -1.78617877e+04, 2.91615662] + transport: + model: gas + geometry: nonlinear + diameter: 3.458 + well-depth: 107.4 + rotational-relaxation: 3.8 + note: '000000' +- name: H2O + composition: {H: 2, O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [4.19864056, -2.0364341e-03, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12, + -3.02937267e+04, -0.849032208] + - [3.03399249, 2.17691804e-03, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14, + -3.00042971e+04, 4.9667701] + transport: + model: gas + geometry: nonlinear + diameter: 2.605 + well-depth: 572.4 + dipole: 1.844 + rotational-relaxation: 4.0 + note: '000000' +- name: CO + composition: {C: 1, O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.57953347, -6.1035368e-04, 1.01681433e-06, 9.07005884e-10, -9.04424499e-13, + -1.4344086e+04, 3.50840928] + - [2.71518561, 2.06252743e-03, -9.98825771e-07, 2.30053008e-10, -2.03647716e-14, + -1.41518724e+04, 7.81868772] + transport: + model: gas + geometry: linear + diameter: 3.65 + well-depth: 98.1 + polarizability: 1.95 + rotational-relaxation: 1.8 + note: '000000' +- name: CO2 + composition: {C: 1, O: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [2.35677352, 8.98459677e-03, -7.12356269e-06, 2.45919022e-09, -1.43699548e-13, + -4.83719697e+04, 9.90105222] + - [3.85746029, 4.41437026e-03, -2.21481404e-06, 5.23490188e-10, -4.72084164e-14, + -4.8759166e+04, 2.27163806] + transport: + model: gas + geometry: linear + diameter: 3.763 + well-depth: 244.0 + polarizability: 2.65 + rotational-relaxation: 2.1 + note: '000000' +- name: HCO + composition: {H: 1, C: 1, O: 1} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [4.22118584, -3.24392532e-03, 1.37799446e-05, -1.33144093e-08, 4.33768865e-12, + 3839.56496, 3.39437243] + - [2.77217438, 4.95695526e-03, -2.48445613e-06, 5.89161778e-10, -5.33508711e-14, + 4011.91815, 9.79834492] + transport: + model: gas + geometry: nonlinear + diameter: 3.59 + well-depth: 498.0 + note: '000000' +- name: N2 + composition: {N: 2} + thermo: + model: NASA7 + temperature-ranges: [300.0, 1000.0, 5000.0] + data: + - [3.298677, 1.4082404e-03, -3.963222e-06, 5.641515e-09, -2.444854e-12, + -1020.8999, 3.950372] + - [2.92664, 1.4879768e-03, -5.68476e-07, 1.0097038e-10, -6.753351e-15, + -922.7977, 5.980528] + transport: + model: gas + geometry: linear + diameter: 3.621 + well-depth: 97.53 + polarizability: 1.76 + rotational-relaxation: 4.0 + note: '000000' + +reactions: +- equation: H + O2 <=> OH + O # Reaction 1 + rate-constant: {A: 3.52e+16, b: -0.7, Ea: 71.42} +- equation: H2 + O <=> OH + H # Reaction 2 + rate-constant: {A: 5.06e+04, b: 2.67, Ea: 26.32} +- equation: H2 + OH <=> H2O + H # Reaction 3 + rate-constant: {A: 1.17e+09, b: 1.3, Ea: 15.21} +- equation: H2O + O <=> 2 OH # Reaction 4 + rate-constant: {A: 7.0e+05, b: 2.33, Ea: 60.87} +- equation: H + H + M <=> H2 + M # Reaction 5 + type: three-body + rate-constant: {A: 1.3e+18, b: -1.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} +- equation: H + OH + M <=> H2O + M # Reaction 6 + type: three-body + rate-constant: {A: 4.0e+22, b: -2.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} +- equation: O + O + M <=> O2 + M # Reaction 7 + type: three-body + rate-constant: {A: 6.17e+15, b: -0.5, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} +- equation: H + O + M <=> OH + M # Reaction 8 + type: three-body + rate-constant: {A: 4.71e+18, b: -1.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} +- equation: O + OH + M <=> HO2 + M # Reaction 9 + type: three-body + rate-constant: {A: 8.0e+15, b: 0.0, Ea: 0.0} + efficiencies: {H2: 2.5, H2O: 12.0} +- equation: H + O2 (+ M) <=> HO2 (+ M) # Reaction 10 + type: falloff + low-P-rate-constant: {A: 5.75e+19, b: -1.4, Ea: 0.0} + high-P-rate-constant: {A: 4.65e+12, b: 0.44, Ea: 0.0} + Troe: {A: 0.5, T3: 1.0e-30, T1: 1.0e+30} + efficiencies: {H2: 2.5, H2O: 16.0} +- equation: HO2 + H <=> 2 OH # Reaction 11 + rate-constant: {A: 7.08e+13, b: 0.0, Ea: 1.234} +- equation: HO2 + H <=> H2 + O2 # Reaction 12 + rate-constant: {A: 1.66e+13, b: 0.0, Ea: 3.443} +- equation: HO2 + H <=> H2O + O # Reaction 13 + rate-constant: {A: 3.1e+13, b: 0.0, Ea: 7.2} +- equation: HO2 + O <=> OH + O2 # Reaction 14 + rate-constant: {A: 2.0e+13, b: 0.0, Ea: 0.0} +- equation: HO2 + OH <=> H2O + O2 # Reaction 15 + rate-constant: {A: 4.5e+14, b: 0.0, Ea: 45.73} + duplicate: true +- equation: HO2 + OH <=> H2O + O2 # Reaction 16 + rate-constant: {A: 2.98e+13, b: 0.0, Ea: -2.08} + duplicate: true +- equation: OH + OH (+ M) <=> H2O2 (+ M) # Reaction 17 + type: falloff + low-P-rate-constant: {A: 2.76e+25, b: -3.2, Ea: 0.0} + high-P-rate-constant: {A: 9.55e+13, b: -0.27, Ea: 0.0} + Troe: {A: 0.57, T3: 1.0e+30, T1: 1.0e-30} + efficiencies: {H2: 2.5, H2O: 6.0} +- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 18 + rate-constant: {A: 1.94e+11, b: 0.0, Ea: -5.895} + duplicate: true +- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 19 + rate-constant: {A: 1.03e+14, b: 0.0, Ea: 46.2} + duplicate: true +- equation: H2O2 + H <=> HO2 + H2 # Reaction 20 + rate-constant: {A: 2.3e+13, b: 0.0, Ea: 33.263} +- equation: H2O2 + H <=> H2O + OH # Reaction 21 + rate-constant: {A: 1.0e+13, b: 0.0, Ea: 15.0} +- equation: H2O2 + OH <=> H2O + HO2 # Reaction 22 + rate-constant: {A: 7.59e+13, b: 0.0, Ea: 30.43} + duplicate: true +- equation: H2O2 + OH <=> H2O + HO2 # Reaction 23 + rate-constant: {A: 1.74e+12, b: 0.0, Ea: 1.33} + duplicate: true +- equation: H2O2 + O <=> HO2 + OH # Reaction 24 + rate-constant: {A: 9.63e+06, b: 2.0, Ea: 16.7} diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 53adc2562f..3a13d06b67 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -48,7 +48,7 @@ real(wp), allocatable :: x_coords(:), y_coords(:) logical :: files_loaded = .false. real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend - character(len=*), parameter :: init_dir = "/home/MFC/FilesDirectory" ! For example /home/MFC/examples/1D_Shock/D/ + character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ character(len=20) :: file_num_str ! For storing the file number as a string character(len=20) :: zeros_part ! For the trailing zeros part character(len=6), parameter :: zeros_default = "000000" ! Default zeros (can be changed) From cb259ecb7b14c9bb1522e4b4feeb2b2f972685a5 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Tue, 23 Dec 2025 00:18:33 -0500 Subject: [PATCH 10/13] Documentation + Example with Diffusion --- docs/documentation/case.md | 16 ++ examples/1D_Flamelet/case.py | 92 ------ examples/1D_Flamelet/sandiego.yaml | 302 -------------------- examples/1D_multispecies_diffusion/case.py | 78 +++++ src/common/include/ExtrusionHardcodedIC.fpp | 2 +- toolchain/mfc/test/cases.py | 2 +- 6 files changed, 96 insertions(+), 396 deletions(-) delete mode 100644 examples/1D_Flamelet/case.py delete mode 100644 examples/1D_Flamelet/sandiego.yaml create mode 100644 examples/1D_multispecies_diffusion/case.py diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 512de0eeb6..8fa1f3cab0 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -993,6 +993,22 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met: - `bc_y%beg = -2` to enable reflective boundary conditions +### 17. Chemistry + +| Parameter | Type | Description | +| ---: | :---: | :--- | +| `chemistry` | Logical | Enable chemistry simulation | +| `chem_params%diffusion` | Logical | Enable multispecies diffusion | +| `chem_params%reactions` | Logical | Enable chemical reactions | +| `chem_params%gamma_method` | Integer | Methodology for calculating the heat capacity ratio | +| `chem_params%transport_model` | Integer | Methodology for calculating the diffusion coeffiecients | +| `cantera_file` | String | Cantera-format mechanism file (e.g., .yaml) | + +- `chem_params%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties,`1` for mixture-average, `2` for Unity-Lewis + +- `cantera_file` specifies the chemical mechanism file. If the file is part of the standard Cantera library, only the filename is required. Otherwise, the file must be located in the same directory as your `case.py` file + + ## Enumerations ### Boundary conditions diff --git a/examples/1D_Flamelet/case.py b/examples/1D_Flamelet/case.py deleted file mode 100644 index 862439500d..0000000000 --- a/examples/1D_Flamelet/case.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 -# References: -# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.3. Multi-component inert shock tube -import json -import argparse -import math -import cantera as ct -parser = argparse.ArgumentParser( - prog="nD_inert_shocktube", - formatter_class=argparse.ArgumentDefaultsHelpFormatter) -parser.add_argument("--mfc", type=json.loads, default='{}', metavar="DICT", - help="MFC's toolchain's internal state.") -parser.add_argument("--no-chem", dest='chemistry', default=True, action="store_false", - help="Disable chemistry.") -args = parser.parse_args() -ctfile = 'sandiego.yaml' -sol_L = ct.Solution(ctfile) -sol_L.TPX = 300, 8000, 'O2:2,N2:2,H2O:5' -L = 0.016 -Nx = 1199 -dx = L / Nx -dt = 1e-8 -Tend = 0.60e-3 -NT = int(Tend / dt) -SAVE_COUNT = 1000 -NS = 1000 -case = { - # Logistics ================================================================ - 'run_time_info' : 'T', - # ========================================================================== - # Computational Domain Parameters ========================================== - 'x_domain%beg' : -L/2, - 'x_domain%end' : +L/2, - 'm' : Nx, - 'n' : 0, - 'p' : 0, - 'dt' : float(dt), - 't_step_start' : 0, - 't_step_stop' : NT, - 't_step_save' : NS, - 't_step_print' : 100, - 'parallel_io' : 'F', - # ========================================================================== - # Simulation Algorithm Parameters ========================================== - 'model_eqns' : 2, - 'num_fluids' : 1, - 'num_patches' : 1, - 'mpp_lim' : 'F', - 'mixture_err' : 'F', - 'time_stepper' : 3, - 'weno_order' : 5, - 'weno_eps' : 1E-16, - 'weno_avg' : 'F', - 'mapped_weno' : 'T', - 'mp_weno' : 'T', - 'riemann_solver' : 2, - 'wave_speeds' : 2, - 'avg_state' : 1, - 'bc_x%beg' :-8, - 'bc_x%end' :-8, - 'viscous' : 'F', - # ========================================================================== - # Chemistry ================================================================ - 'chemistry' : 'T' if not args.chemistry else 'T', - 'chem_params%diffusion' : 'T', - 'chem_params%reactions' : 'T', - # ========================================================================== - # Formatted Database Files Structure Parameters ============================ - 'format' : 1, - 'precision' : 2, - 'prim_vars_wrt' : 'T', - # ========================================================================== - # ========================================================================== - 'patch_icpp(1)%geometry' : 1, - 'patch_icpp(1)%hcid' : 170, - 'patch_icpp(1)%x_centroid' : 0, - 'patch_icpp(1)%length_x' : L, - 'patch_icpp(1)%vel(1)' : '0', - 'patch_icpp(1)%pres' : 1.01325e5, - 'patch_icpp(1)%alpha(1)' : 1, - 'patch_icpp(1)%alpha_rho(1)' : '1', - # Fluids Physical Parameters =============================================== - 'fluid_pp(1)%gamma' : 1.0E+00/(1.5E+00-1.0E+00), - 'fluid_pp(1)%pi_inf' : 0, - # 'fluid_pp(1)%Re(1)' : 20000000, - # ========================================================================== - # Chemistry ================================================================ - 'cantera_file' : ctfile, - # ========================================================================== -} -if __name__ == '__main__': - print(json.dumps(case)) diff --git a/examples/1D_Flamelet/sandiego.yaml b/examples/1D_Flamelet/sandiego.yaml deleted file mode 100644 index 84986f880f..0000000000 --- a/examples/1D_Flamelet/sandiego.yaml +++ /dev/null @@ -1,302 +0,0 @@ -description: |- - units(length='cm', time='s', quantity='mol', act_energy='kJ/mol') -generator: cti2yaml -cantera-version: 2.6.0 -date: Tue, 21 Jun 2022 15:14:08 -0500 -input-files: [sanDiego.cti] - -units: {length: cm, quantity: mol, activation-energy: kJ/mol} - -phases: -- name: gas - thermo: ideal-gas - elements: [H, O, N] - species: [H2, H, O2, O, OH, HO2, H2O2, H2O, N2] - kinetics: gas - reactions: all - transport: mixture-averaged - state: - T: 300.0 - P: 1.01325e+05 - -species: -- name: H2 - composition: {H: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [2.34433112, 7.98052075e-03, -1.9478151e-05, 2.01572094e-08, -7.37611761e-12, - -917.935173, 0.683010238] - - [3.3372792, -4.94024731e-05, 4.99456778e-07, -1.79566394e-10, 2.00255376e-14, - -950.158922, -3.20502331] - transport: - model: gas - geometry: linear - diameter: 2.92 - well-depth: 38.0 - polarizability: 0.79 - rotational-relaxation: 280.0 - note: '000000' -- name: H - composition: {H: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18, -9.27732332e-22, - 2.54736599e+04, -0.446682853] - - [2.50000001, -2.30842973e-11, 1.61561948e-14, -4.73515235e-18, 4.98197357e-22, - 2.54736599e+04, -0.446682914] - transport: - model: gas - geometry: atom - diameter: 2.05 - well-depth: 145.0 - note: '000000' -- name: O2 - composition: {O: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12, - -1063.94356, 3.65767573] - - [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14, - -1088.45772, 5.45323129] - transport: - model: gas - geometry: linear - diameter: 3.458 - well-depth: 107.4 - polarizability: 1.6 - rotational-relaxation: 3.8 - note: '000000' -- name: O - composition: {O: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [3.1682671, -3.27931884e-03, 6.64306396e-06, -6.12806624e-09, 2.11265971e-12, - 2.91222592e+04, 2.05193346] - - [2.56942078, -8.59741137e-05, 4.19484589e-08, -1.00177799e-11, 1.22833691e-15, - 2.92175791e+04, 4.78433864] - transport: - model: gas - geometry: atom - diameter: 2.75 - well-depth: 80.0 - note: '000000' -- name: OH - composition: {H: 1, O: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [4.12530561, -3.22544939e-03, 6.52764691e-06, -5.79853643e-09, 2.06237379e-12, - 3381.53812, -0.69043296] - - [2.86472886, 1.05650448e-03, -2.59082758e-07, 3.05218674e-11, -1.33195876e-15, - 3718.85774, 5.70164073] - transport: - model: gas - geometry: linear - diameter: 2.75 - well-depth: 80.0 - note: '000000' -- name: HO2 - composition: {H: 1, O: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [4.30179801, -4.74912051e-03, 2.11582891e-05, -2.42763894e-08, 9.29225124e-12, - 294.80804, 3.71666245] - - [4.0172109, 2.23982013e-03, -6.3365815e-07, 1.1424637e-10, -1.07908535e-14, - 111.856713, 3.78510215] - transport: - model: gas - geometry: nonlinear - diameter: 3.458 - well-depth: 107.4 - rotational-relaxation: 1.0 - note: '000000' -- name: H2O2 - composition: {H: 2, O: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [4.27611269, -5.42822417e-04, 1.67335701e-05, -2.15770813e-08, 8.62454363e-12, - -1.77025821e+04, 3.43505074] - - [4.16500285, 4.90831694e-03, -1.90139225e-06, 3.71185986e-10, -2.87908305e-14, - -1.78617877e+04, 2.91615662] - transport: - model: gas - geometry: nonlinear - diameter: 3.458 - well-depth: 107.4 - rotational-relaxation: 3.8 - note: '000000' -- name: H2O - composition: {H: 2, O: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [4.19864056, -2.0364341e-03, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12, - -3.02937267e+04, -0.849032208] - - [3.03399249, 2.17691804e-03, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14, - -3.00042971e+04, 4.9667701] - transport: - model: gas - geometry: nonlinear - diameter: 2.605 - well-depth: 572.4 - dipole: 1.844 - rotational-relaxation: 4.0 - note: '000000' -- name: CO - composition: {C: 1, O: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [3.57953347, -6.1035368e-04, 1.01681433e-06, 9.07005884e-10, -9.04424499e-13, - -1.4344086e+04, 3.50840928] - - [2.71518561, 2.06252743e-03, -9.98825771e-07, 2.30053008e-10, -2.03647716e-14, - -1.41518724e+04, 7.81868772] - transport: - model: gas - geometry: linear - diameter: 3.65 - well-depth: 98.1 - polarizability: 1.95 - rotational-relaxation: 1.8 - note: '000000' -- name: CO2 - composition: {C: 1, O: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [2.35677352, 8.98459677e-03, -7.12356269e-06, 2.45919022e-09, -1.43699548e-13, - -4.83719697e+04, 9.90105222] - - [3.85746029, 4.41437026e-03, -2.21481404e-06, 5.23490188e-10, -4.72084164e-14, - -4.8759166e+04, 2.27163806] - transport: - model: gas - geometry: linear - diameter: 3.763 - well-depth: 244.0 - polarizability: 2.65 - rotational-relaxation: 2.1 - note: '000000' -- name: HCO - composition: {H: 1, C: 1, O: 1} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [4.22118584, -3.24392532e-03, 1.37799446e-05, -1.33144093e-08, 4.33768865e-12, - 3839.56496, 3.39437243] - - [2.77217438, 4.95695526e-03, -2.48445613e-06, 5.89161778e-10, -5.33508711e-14, - 4011.91815, 9.79834492] - transport: - model: gas - geometry: nonlinear - diameter: 3.59 - well-depth: 498.0 - note: '000000' -- name: N2 - composition: {N: 2} - thermo: - model: NASA7 - temperature-ranges: [300.0, 1000.0, 5000.0] - data: - - [3.298677, 1.4082404e-03, -3.963222e-06, 5.641515e-09, -2.444854e-12, - -1020.8999, 3.950372] - - [2.92664, 1.4879768e-03, -5.68476e-07, 1.0097038e-10, -6.753351e-15, - -922.7977, 5.980528] - transport: - model: gas - geometry: linear - diameter: 3.621 - well-depth: 97.53 - polarizability: 1.76 - rotational-relaxation: 4.0 - note: '000000' - -reactions: -- equation: H + O2 <=> OH + O # Reaction 1 - rate-constant: {A: 3.52e+16, b: -0.7, Ea: 71.42} -- equation: H2 + O <=> OH + H # Reaction 2 - rate-constant: {A: 5.06e+04, b: 2.67, Ea: 26.32} -- equation: H2 + OH <=> H2O + H # Reaction 3 - rate-constant: {A: 1.17e+09, b: 1.3, Ea: 15.21} -- equation: H2O + O <=> 2 OH # Reaction 4 - rate-constant: {A: 7.0e+05, b: 2.33, Ea: 60.87} -- equation: H + H + M <=> H2 + M # Reaction 5 - type: three-body - rate-constant: {A: 1.3e+18, b: -1.0, Ea: 0.0} - efficiencies: {H2: 2.5, H2O: 12.0} -- equation: H + OH + M <=> H2O + M # Reaction 6 - type: three-body - rate-constant: {A: 4.0e+22, b: -2.0, Ea: 0.0} - efficiencies: {H2: 2.5, H2O: 12.0} -- equation: O + O + M <=> O2 + M # Reaction 7 - type: three-body - rate-constant: {A: 6.17e+15, b: -0.5, Ea: 0.0} - efficiencies: {H2: 2.5, H2O: 12.0} -- equation: H + O + M <=> OH + M # Reaction 8 - type: three-body - rate-constant: {A: 4.71e+18, b: -1.0, Ea: 0.0} - efficiencies: {H2: 2.5, H2O: 12.0} -- equation: O + OH + M <=> HO2 + M # Reaction 9 - type: three-body - rate-constant: {A: 8.0e+15, b: 0.0, Ea: 0.0} - efficiencies: {H2: 2.5, H2O: 12.0} -- equation: H + O2 (+ M) <=> HO2 (+ M) # Reaction 10 - type: falloff - low-P-rate-constant: {A: 5.75e+19, b: -1.4, Ea: 0.0} - high-P-rate-constant: {A: 4.65e+12, b: 0.44, Ea: 0.0} - Troe: {A: 0.5, T3: 1.0e-30, T1: 1.0e+30} - efficiencies: {H2: 2.5, H2O: 16.0} -- equation: HO2 + H <=> 2 OH # Reaction 11 - rate-constant: {A: 7.08e+13, b: 0.0, Ea: 1.234} -- equation: HO2 + H <=> H2 + O2 # Reaction 12 - rate-constant: {A: 1.66e+13, b: 0.0, Ea: 3.443} -- equation: HO2 + H <=> H2O + O # Reaction 13 - rate-constant: {A: 3.1e+13, b: 0.0, Ea: 7.2} -- equation: HO2 + O <=> OH + O2 # Reaction 14 - rate-constant: {A: 2.0e+13, b: 0.0, Ea: 0.0} -- equation: HO2 + OH <=> H2O + O2 # Reaction 15 - rate-constant: {A: 4.5e+14, b: 0.0, Ea: 45.73} - duplicate: true -- equation: HO2 + OH <=> H2O + O2 # Reaction 16 - rate-constant: {A: 2.98e+13, b: 0.0, Ea: -2.08} - duplicate: true -- equation: OH + OH (+ M) <=> H2O2 (+ M) # Reaction 17 - type: falloff - low-P-rate-constant: {A: 2.76e+25, b: -3.2, Ea: 0.0} - high-P-rate-constant: {A: 9.55e+13, b: -0.27, Ea: 0.0} - Troe: {A: 0.57, T3: 1.0e+30, T1: 1.0e-30} - efficiencies: {H2: 2.5, H2O: 6.0} -- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 18 - rate-constant: {A: 1.94e+11, b: 0.0, Ea: -5.895} - duplicate: true -- equation: HO2 + HO2 <=> H2O2 + O2 # Reaction 19 - rate-constant: {A: 1.03e+14, b: 0.0, Ea: 46.2} - duplicate: true -- equation: H2O2 + H <=> HO2 + H2 # Reaction 20 - rate-constant: {A: 2.3e+13, b: 0.0, Ea: 33.263} -- equation: H2O2 + H <=> H2O + OH # Reaction 21 - rate-constant: {A: 1.0e+13, b: 0.0, Ea: 15.0} -- equation: H2O2 + OH <=> H2O + HO2 # Reaction 22 - rate-constant: {A: 7.59e+13, b: 0.0, Ea: 30.43} - duplicate: true -- equation: H2O2 + OH <=> H2O + HO2 # Reaction 23 - rate-constant: {A: 1.74e+12, b: 0.0, Ea: 1.33} - duplicate: true -- equation: H2O2 + O <=> HO2 + OH # Reaction 24 - rate-constant: {A: 9.63e+06, b: 2.0, Ea: 16.7} diff --git a/examples/1D_multispecies_diffusion/case.py b/examples/1D_multispecies_diffusion/case.py new file mode 100644 index 0000000000..3a87ef2392 --- /dev/null +++ b/examples/1D_multispecies_diffusion/case.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# References: +# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.4. Multicomponent diffusion test case + +import json +import argparse +import math +import cantera as ct + +ctfile = "gri30.yaml" +sol_L = ct.Solution(ctfile) +sol_L.TPX = 300, 8000, "O2:2,N2:2,H2O:5" + +L = 0.05 +Nx = 100 +dx = L / Nx +dt = 0.3e-6 +Tend = 0.05 + +NT = int(Tend / dt) +SAVE_COUNT = 2000 +NS = 2000 +case = { + "run_time_info": "T", + "x_domain%beg": 0, + "x_domain%end": +L, + "m": Nx, + "n": 0, + "p": 0, + "dt": float(dt), + "t_step_start": 0, + "t_step_stop": NT, + "t_step_save": NS, + "t_step_print": NS, + "parallel_io": "F", + "model_eqns": 2, + "num_fluids": 1, + "num_patches": 1, + "mpp_lim": "F", + "mixture_err": "F", + "time_stepper": 3, + "weno_order": 5, + "weno_eps": 1e-16, + "weno_avg": "F", + "mapped_weno": "T", + "mp_weno": "T", + "riemann_solver": 2, + "wave_speeds": 2, + "avg_state": 1, + "bc_x%beg": -1, + "bc_x%end": -1, + "viscous": "F", + "chemistry": "T", + "chem_params%diffusion": "T", + "chem_params%reactions": "F", + "chem_params%transport_model": 2, # Mixture-Average + "format": 1, + "precision": 2, + "prim_vars_wrt": "T", + "chem_wrt_T": "T", + "patch_icpp(1)%geometry": 1, + "patch_icpp(1)%hcid": 182, + "patch_icpp(1)%x_centroid": L / 2, + "patch_icpp(1)%length_x": L, + "patch_icpp(1)%vel(1)": "0", + "patch_icpp(1)%pres": 1.01325e5, + "patch_icpp(1)%alpha(1)": 1, + "patch_icpp(1)%alpha_rho(1)": 1, + "fluid_pp(1)%gamma": 1.0e00 / (1.9326e00 - 1.0e00), + "fluid_pp(1)%pi_inf": 0, + "cantera_file": ctfile, +} + +for i in range(len(sol_L.Y)): + case[f"chem_wrt_Y({i + 1})"] = "T" + case[f"patch_icpp(1)%Y({i+1})"] = 0.0 +if __name__ == "__main__": + print(json.dumps(case)) diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 3a13d06b67..73849d80ac 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -48,7 +48,7 @@ real(wp), allocatable :: x_coords(:), y_coords(:) logical :: files_loaded = .false. real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend - character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ + character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ character(len=20) :: file_num_str ! For storing the file number as a string character(len=20) :: zeros_part ! For the trailing zeros part character(len=6), parameter :: zeros_default = "000000" ! Default zeros (can be changed) diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index a297ed181d..445d7bbcb8 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -1030,7 +1030,7 @@ def foreach_example(): "2D_backward_facing_step", "2D_forward_facing_step", "1D_convergence", - "3D_IGR_33jet"] + "3D_IGR_33jet","1D_multispecies_diffusion"] if path in casesToSkip: continue name = f"{path.split('_')[0]} -> Example -> {'_'.join(path.split('_')[1:])}" From 476967a778516ec51ce182517672409e9ff1dd63 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Tue, 23 Dec 2025 00:25:49 -0500 Subject: [PATCH 11/13] Spellig error --- docs/documentation/case.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 8fa1f3cab0..9d3480747e 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -1001,7 +1001,7 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met: | `chem_params%diffusion` | Logical | Enable multispecies diffusion | | `chem_params%reactions` | Logical | Enable chemical reactions | | `chem_params%gamma_method` | Integer | Methodology for calculating the heat capacity ratio | -| `chem_params%transport_model` | Integer | Methodology for calculating the diffusion coeffiecients | +| `chem_params%transport_model` | Integer | Methodology for calculating the diffusion coefficients | | `cantera_file` | String | Cantera-format mechanism file (e.g., .yaml) | - `chem_params%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties,`1` for mixture-average, `2` for Unity-Lewis From 15f126085e2a6198778507626d46a47676d04fc2 Mon Sep 17 00:00:00 2001 From: Dimitrios Adam Date: Tue, 23 Dec 2025 12:09:20 -0500 Subject: [PATCH 12/13] AI suggestions --- examples/1D_multispecies_diffusion/case.py | 2 +- src/common/include/ExtrusionHardcodedIC.fpp | 4 ++-- src/common/m_chemistry.fpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/1D_multispecies_diffusion/case.py b/examples/1D_multispecies_diffusion/case.py index 3a87ef2392..d5abb920fe 100644 --- a/examples/1D_multispecies_diffusion/case.py +++ b/examples/1D_multispecies_diffusion/case.py @@ -53,7 +53,7 @@ "chemistry": "T", "chem_params%diffusion": "T", "chem_params%reactions": "F", - "chem_params%transport_model": 2, # Mixture-Average + "chem_params%transport_model": 1, # Mixture-Average "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 73849d80ac..264b227f21 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -48,7 +48,7 @@ real(wp), allocatable :: x_coords(:), y_coords(:) logical :: files_loaded = .false. real(wp) :: domain_xstart, domain_xend, domain_ystart, domain_yend - character(len=*), parameter :: init_dir = "/Users/dimitriosadam/Desktop/MFC-Adam/examples/" ! For example /home/MFC/examples/1D_Shock/D/ + character(len=*), parameter :: init_dir = "/home/MFC/FilesDirectory" ! For example /home/MFC/examples/1D_Shock/D/ character(len=20) :: file_num_str ! For storing the file number as a string character(len=20) :: zeros_part ! For the trailing zeros part character(len=6), parameter :: zeros_default = "000000" ! Default zeros (can be changed) @@ -175,7 +175,7 @@ case (1) idx = i + 1 + global_offset_x do f = 1, sys_size - q_prim_vf(f)%sf(i, 0, 0) = stored_values(i + 1, 1, f) + q_prim_vf(f)%sf(i, 0, 0) = stored_values(idx, 1, f) end do case (2) diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index 2c8b1f22e5..8339766813 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -376,7 +376,7 @@ contains diffusivity_R = lambda_R/rho_R/Cp_R lambda_Cell = 0.5_wp*(lambda_R + lambda_L) - diffusivity_Cell = 0.5_wp*(diffusivity_R + diffusivity_L) + diffusivity_cell = 0.5_wp*(diffusivity_R + diffusivity_L) ! Calculate mass diffusion fluxes Mass_Diffu_Energy = 0.0_wp From 0e8124fded6839848c551fbdb082d3fbe1e674ca Mon Sep 17 00:00:00 2001 From: Dimitrios Adam <153962156+DimAdam-01@users.noreply.github.com> Date: Wed, 24 Dec 2025 12:42:04 -0500 Subject: [PATCH 13/13] Update examples/1D_multispecies_diffusion/case.py Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com> --- examples/1D_multispecies_diffusion/case.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/1D_multispecies_diffusion/case.py b/examples/1D_multispecies_diffusion/case.py index d5abb920fe..ecacbd965c 100644 --- a/examples/1D_multispecies_diffusion/case.py +++ b/examples/1D_multispecies_diffusion/case.py @@ -53,7 +53,7 @@ "chemistry": "T", "chem_params%diffusion": "T", "chem_params%reactions": "F", - "chem_params%transport_model": 1, # Mixture-Average + "chem_params%transport_model": 2, # Unity-Lewis "format": 1, "precision": 2, "prim_vars_wrt": "T",