diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index a9beef0b5..47bbd71d1 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -9,7 +9,7 @@ module m_chemistry use m_thermochem, only: & - num_species, mol_weights, get_temperature, get_net_production_rates + num_species, molecular_weights, get_temperature, get_net_production_rates use m_global_parameters @@ -91,7 +91,7 @@ contains !$acc loop seq do eqn = chemxb, chemxe - omega_m = mol_weights(eqn - chemxb + 1)*omega(eqn - chemxb + 1) + omega_m = molecular_weights(eqn - chemxb + 1)*omega(eqn - chemxb + 1) rhs_vf(eqn)%sf(x, y, z) = rhs_vf(eqn)%sf(x, y, z) + omega_m diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index 8fc70bfe7..05e7befd5 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -165,7 +165,7 @@ contains & 'alt_soundspeed', 'hypoelasticity', 'mhd', 'parallel_io', & & 'rho_wrt', 'E_wrt', 'pres_wrt', 'gamma_wrt', 'sim_data', & & 'heat_ratio_wrt', 'pi_inf_wrt', 'pres_inf_wrt', 'cons_vars_wrt', & - & 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt', & + & 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt','chem_wrt_T', & & 'bubbles_euler', 'qbmm', 'polytropic', 'polydisperse', & & 'file_per_process', 'relax', 'cf_wrt', & & 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', & diff --git a/src/pre_process/m_mpi_proxy.fpp b/src/pre_process/m_mpi_proxy.fpp index a0bea3cae..3aba6f6cd 100644 --- a/src/pre_process/m_mpi_proxy.fpp +++ b/src/pre_process/m_mpi_proxy.fpp @@ -128,6 +128,9 @@ contains call MPI_BCAST(patch_icpp(i)%model_spc, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (chemistry) then + call MPI_BCAST(patch_icpp(i)%Y, size(patch_icpp(i)%Y), mpi_p, 0, MPI_COMM_WORLD, ierr) + end if ! Broadcast IB variables call MPI_BCAST(patch_ib(i)%geometry, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) call MPI_BCAST(patch_ib(i)%model_filepath, len(patch_ib(i)%model_filepath), MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) diff --git a/src/simulation/include/inline_riemann.fpp b/src/simulation/include/inline_riemann.fpp index 68918e513..78ccebd78 100644 --- a/src/simulation/include/inline_riemann.fpp +++ b/src/simulation/include/inline_riemann.fpp @@ -37,8 +37,8 @@ call get_species_enthalpies_rt(T_L, h_iL) call get_species_enthalpies_rt(T_R, h_iR) - h_iL = h_iL*gas_constant/mol_weights*T_L - h_iR = h_iR*gas_constant/mol_weights*T_R + h_iL = h_iL*gas_constant/molecular_weights*T_L + h_iR = h_iR*gas_constant/molecular_weights*T_R call get_species_specific_heats_r(T_L, Cp_iL) call get_species_specific_heats_r(T_R, Cp_iR) @@ -48,17 +48,17 @@ if (abs(T_L - T_R) < eps) then ! Case when T_L and T_R are very close - 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(:))) + Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:)) + Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) - gas_constant/molecular_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)) - Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/mol_weights(:))) + Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights(:))) end if gamma_avg = Cp_avg/Cv_avg - Phi_avg(:) = (gamma_avg - 1._wp)*(vel_avg_rms/2.0_wp - 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/molecular_weights(:)*T_avg c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:)) end if diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index fa1b18713..2892fc5c0 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -510,8 +510,8 @@ contains call get_mixture_molecular_weight(Ys_L, MW_L) call get_mixture_molecular_weight(Ys_R, MW_R) - Xs_L(:) = Ys_L(:)*MW_L/mol_weights(:) - Xs_R(:) = Ys_R(:)*MW_R/mol_weights(:) + Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:) + Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:) R_gas_L = gas_constant/MW_L R_gas_R = gas_constant/MW_R @@ -1015,8 +1015,8 @@ 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) = (s_M*Y_R*rho_R*vel_R(dir_idx(norm_dir)) & - - s_P*Y_L*rho_L*vel_L(dir_idx(norm_dir)) & + flux_rs${XYZ}$_vf(j, k, l, i) = (s_M*Y_R*rho_R*vel_R(dir_idx(1)) & + - 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) = 0._wp @@ -2540,8 +2540,8 @@ contains call get_mixture_molecular_weight(Ys_L, MW_L) call get_mixture_molecular_weight(Ys_R, MW_R) - Xs_L(:) = Ys_L(:)*MW_L/mol_weights(:) - Xs_R(:) = Ys_R(:)*MW_R/mol_weights(:) + Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:) + Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:) R_gas_L = gas_constant/MW_L R_gas_R = gas_constant/MW_R diff --git a/toolchain/mfc/run/input.py b/toolchain/mfc/run/input.py index 126fb032b..1b4ea004d 100644 --- a/toolchain/mfc/run/input.py +++ b/toolchain/mfc/run/input.py @@ -76,10 +76,10 @@ def generate_fpp(self, target) -> None: # 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( + pyro.FortranCodeGenerator().generate( + "m_thermochem", self.get_cantera_solution(), - module_name="m_thermochem", - real_type=real_type + pyro.CodeGenerationOptions(scalar_type = real_type) ), True ) diff --git a/toolchain/pyproject.toml b/toolchain/pyproject.toml index 4af041224..da88e94f6 100644 --- a/toolchain/pyproject.toml +++ b/toolchain/pyproject.toml @@ -38,8 +38,8 @@ dependencies = [ "matplotlib", # Chemistry - "cantera==3.0.1", - "pyrometheus==1.0.2" + "cantera==3.1.0", + "pyrometheus@git+https://github.com/DimAdam-01/pyrometheus.git@main" ] [tool.hatch.metadata]