From b1eb27750f4218d2aad83f24ea0466fced4605c8 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Wed, 20 Nov 2024 15:05:46 -0700 Subject: [PATCH 01/11] run isothermal Soret channel as a test --- Exec/RegTests/CMakeLists.txt | 1 + Tests/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/Exec/RegTests/CMakeLists.txt b/Exec/RegTests/CMakeLists.txt index 88474eff..85d73eee 100644 --- a/Exec/RegTests/CMakeLists.txt +++ b/Exec/RegTests/CMakeLists.txt @@ -21,6 +21,7 @@ else() endif() if(PELE_DIM EQUAL 2) add_subdirectory(TripleFlame) + add_subdirectory(IsothermalSoretChannel) endif() if(PELE_DIM EQUAL 3) add_subdirectory(TurbInflow) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 21fa5e81..a42d1347 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -236,6 +236,7 @@ if(NOT PELE_ENABLE_EB) endif() if(PELE_DIM EQUAL 2) add_test_r(tripleflame-${PELE_DIM}d TripleFlame) + add_test_rv(input IsothermalSoretChannel) endif() if(PELE_DIM EQUAL 3) add_test_r(hit-${PELE_DIM}d HITDecay) From 9488262ddfa9e2fa96c98e36908d2c18538ed81e Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Wed, 20 Nov 2024 16:29:24 -0700 Subject: [PATCH 02/11] fix warns --- Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.H | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.H b/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.H index 33c12a84..f824e29d 100644 --- a/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.H +++ b/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.H @@ -59,11 +59,8 @@ pelelmex_initdata( const amrex::Real* prob_hi = geomdata.ProbHi(); const amrex::Real* dx = geomdata.CellSize(); - const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0]; const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1]; const amrex::Real y_low = prob_lo[1]; - - const amrex::Real Lx = prob_hi[0] - prob_lo[0]; const amrex::Real Ly = prob_hi[1] - prob_lo[1]; auto eos = pele::physics::PhysicsType::eos(); @@ -98,19 +95,16 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void bcnormal( - const amrex::Real x[AMREX_SPACEDIM], + const amrex::Real* /*x[AMREX_SPACEDIM]*/, const int /*m_nAux*/, amrex::Real s_ext[NVAR], const int /*idir*/, const int sgn, - const amrex::Real time, + const amrex::Real /*time*/, amrex::GeometryData const& /*geomdata*/, ProbParm const& prob_parm, pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/) { - auto eos = pele::physics::PhysicsType::eos(); - amrex::Real massfrac[NUM_SPECIES] = {0.0}; - if (sgn == 1) { s_ext[TEMP] = prob_parm.Tlow; } else if (sgn == -1) { From 8823cbbae75af998384abf818d108adb7e16149b Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Mon, 2 Dec 2024 15:24:08 -0700 Subject: [PATCH 03/11] remove unused input from isothermal soret --- .../{input.inp => isothermal-soret.inp} | 4 ++-- Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.cpp | 1 + Tests/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) rename Exec/RegTests/IsothermalSoretChannel/{input.inp => isothermal-soret.inp} (99%) diff --git a/Exec/RegTests/IsothermalSoretChannel/input.inp b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp similarity index 99% rename from Exec/RegTests/IsothermalSoretChannel/input.inp rename to Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp index d7360016..6441b65c 100644 --- a/Exec/RegTests/IsothermalSoretChannel/input.inp +++ b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp @@ -25,7 +25,7 @@ prob.P_mean = 101325.0 prob.Vin = 10.0 prob.Tlow = 400.0 prob.Thigh = 800.0 -prob.phi = 0.5 +prob.phi = 1.0 #---------------------- Transport -------------------------------- transport.use_soret = 1 @@ -46,7 +46,7 @@ peleLM.do_species_balance = 1 # Compute species balance amr.max_step = 2000 # Maximum number of time steps amr.stop_time = 4.00 # final simulation physical time [s] amr.max_wall_time = 1 # Maximum simulation run time [h] -amr.cfl = 0.5 # CFL number for hyperbolic system +amr.cfl = 0.5 # CFL number for hyperbolic system amr.dt_shrink = 0.01 # Scale back initial timestep amr.dt_change_max = 1.1 # Maximum dt increase btw successive steps diff --git a/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.cpp b/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.cpp index 53c005d5..d454a284 100644 --- a/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.cpp +++ b/Exec/RegTests/IsothermalSoretChannel/pelelmex_prob.cpp @@ -10,6 +10,7 @@ PeleLM::readProbParm() pp.query("Vin", PeleLM::prob_parm->Vin); pp.query("Thigh", PeleLM::prob_parm->Thigh); pp.query("Tlow", PeleLM::prob_parm->Tlow); + pp.query("phi", PeleLM::prob_parm->phi); PeleLM::prob_parm->bathID = N2_ID; PeleLM::prob_parm->oxidID = O2_ID; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index a42d1347..7e42d225 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -236,7 +236,7 @@ if(NOT PELE_ENABLE_EB) endif() if(PELE_DIM EQUAL 2) add_test_r(tripleflame-${PELE_DIM}d TripleFlame) - add_test_rv(input IsothermalSoretChannel) + add_test_rv(isothermal-soret IsothermalSoretChannel) endif() if(PELE_DIM EQUAL 3) add_test_r(hit-${PELE_DIM}d HITDecay) From db25cf274496cf245079f4dc5218f32a69d4ce22 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Mon, 2 Dec 2024 16:36:36 -0700 Subject: [PATCH 04/11] remove more unused --- Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp index 6441b65c..16a75794 100644 --- a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp +++ b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp @@ -86,6 +86,6 @@ amr.gradT.adjacent_difference_greater = 200 amr.gradT.field_name = temp #---------------------- Debug/HPC CONTROL------------------------- -amrex.fpe_trap_invalid = 1 -amrex.fpe_trap_zero = 1 -amrex.fpe_trap_overflow = 1 +#amrex.fpe_trap_invalid = 1 +#amrex.fpe_trap_zero = 1 +#amrex.fpe_trap_overflow = 1 From 3c97f7668b32217a6849bc036de25541b4d2bb22 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Mon, 30 Dec 2024 13:49:39 -0700 Subject: [PATCH 05/11] add python test to verify species conservation --- Exec/RegTests/IsothermalSoretChannel/test.py | 32 ++++++++++++++++++++ Tests/CMakeLists.txt | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Exec/RegTests/IsothermalSoretChannel/test.py diff --git a/Exec/RegTests/IsothermalSoretChannel/test.py b/Exec/RegTests/IsothermalSoretChannel/test.py new file mode 100644 index 00000000..e2c9b310 --- /dev/null +++ b/Exec/RegTests/IsothermalSoretChannel/test.py @@ -0,0 +1,32 @@ +import os +import re +import numpy.testing as npt +import pandas as pd +import unittest + +class SpeciesBalTestCase(unittest.TestCase): + """Test composition of species with external sources""" + + def test_composition(self): + """Verify species conservation""" + + # Load the data + fdir = os.path.abspath(".") + fname = os.path.join(fdir, "temporals/tempSpecies") + df = pd.read_csv(fname) + print(df) + for col in df.columns: + if col.startswith('rhoYnew'): + init_value = df[col][0] + if init_value != 0.0: + print('testing (relative)', col) + npt.assert_allclose(df[col], init_value, rtol=1e-13) + else: + print('testing (absolute)', col) + npt.assert_allclose(df[col], init_value, atol=1e-13) + if col.startswith('netFlux'): + print('testing (absolute)', col) + npt.assert_allclose(df[col], 0.0, atol=1e-13) + +if __name__ == "__main__": + unittest.main() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7e42d225..c478e57b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -236,7 +236,7 @@ if(NOT PELE_ENABLE_EB) endif() if(PELE_DIM EQUAL 2) add_test_r(tripleflame-${PELE_DIM}d TripleFlame) - add_test_rv(isothermal-soret IsothermalSoretChannel) + add_test_rt(isothermal-soret IsothermalSoretChannel) endif() if(PELE_DIM EQUAL 3) add_test_r(hit-${PELE_DIM}d HITDecay) From 14fadeeaa54771dc1bd03440ab6de81bedb65e4f Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Mon, 30 Dec 2024 14:04:33 -0700 Subject: [PATCH 06/11] add a bit of documentation on Soret + isothermal --- Docs/sphinx/manual/LMeXControls.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Docs/sphinx/manual/LMeXControls.rst b/Docs/sphinx/manual/LMeXControls.rst index bb3e757e..652736b9 100644 --- a/Docs/sphinx/manual/LMeXControls.rst +++ b/Docs/sphinx/manual/LMeXControls.rst @@ -271,8 +271,8 @@ PeleLMeX algorithm peleLM.spark1.time = 1e-2 # [OPT] Time when spark starts [s] peleLM.user_defined_ext_sources = 0 # [OPT, DEF=0] Enable user defined source terms. Requires local ProblemSpecificFunctions.cpp. - - + + Transport coefficients and LES ------------------------------ @@ -291,6 +291,13 @@ Transport coefficients and LES peleLM.les_cs_sigma = 1.35 # [OPT, DEF=1.35] If using Sigma LES model, provides model coefficient peleLM.les_v = 0 # [OPT, DEF=0] Verbosity level for LES model peleLM.plot_les = 0 # [OPT, DEF=0] If doing LES, whether to plot the turbulent viscosity + transport.use_soret = 0 # [OPT, DEF=0] Computute diffusion includsing the Soret effect (note, this option is inherited from PelePhysics) + +.. note:: + When using the Soret effect, boundary condition corrections are needed at isothermal boundaries, + which are not fully supported. Currently a correction for all terms except the wbar term + is applied at isothermal domain boundaries (this is likely sufficient), while no corrections are applied + at isothemral embedded boundaries (so use caution for isothermal EBs with Soret diffusion active). Chemistry integrator -------------------- From febc3e78b1291bcf5fbf75f920e920bdc17c68a8 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Tue, 31 Dec 2024 11:10:10 -0700 Subject: [PATCH 07/11] fix typos in docs --- Docs/sphinx/manual/LMeXControls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/sphinx/manual/LMeXControls.rst b/Docs/sphinx/manual/LMeXControls.rst index 652736b9..6acd4cab 100644 --- a/Docs/sphinx/manual/LMeXControls.rst +++ b/Docs/sphinx/manual/LMeXControls.rst @@ -291,7 +291,7 @@ Transport coefficients and LES peleLM.les_cs_sigma = 1.35 # [OPT, DEF=1.35] If using Sigma LES model, provides model coefficient peleLM.les_v = 0 # [OPT, DEF=0] Verbosity level for LES model peleLM.plot_les = 0 # [OPT, DEF=0] If doing LES, whether to plot the turbulent viscosity - transport.use_soret = 0 # [OPT, DEF=0] Computute diffusion includsing the Soret effect (note, this option is inherited from PelePhysics) + transport.use_soret = 0 # [OPT, DEF=0] Compute diffusion including the Soret effect (note, this option is inherited from PelePhysics) .. note:: When using the Soret effect, boundary condition corrections are needed at isothermal boundaries, From 8ac8003945f3c92b02c339110d2fbc8b50915414 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Tue, 31 Dec 2024 11:10:53 -0700 Subject: [PATCH 08/11] fix up copy/paste stuff in python test --- Exec/RegTests/IsothermalSoretChannel/test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Exec/RegTests/IsothermalSoretChannel/test.py b/Exec/RegTests/IsothermalSoretChannel/test.py index e2c9b310..26545ec8 100644 --- a/Exec/RegTests/IsothermalSoretChannel/test.py +++ b/Exec/RegTests/IsothermalSoretChannel/test.py @@ -1,11 +1,10 @@ import os -import re import numpy.testing as npt import pandas as pd import unittest class SpeciesBalTestCase(unittest.TestCase): - """Test composition of species with external sources""" + """Test species balance with isothermal walls and soret""" def test_composition(self): """Verify species conservation""" From bae3cbbe8303f06e93d6d829721d5f44e0a77320 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Tue, 31 Dec 2024 11:12:29 -0700 Subject: [PATCH 09/11] uncomment fpe trapping --- Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp index 16a75794..6441b65c 100644 --- a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp +++ b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp @@ -86,6 +86,6 @@ amr.gradT.adjacent_difference_greater = 200 amr.gradT.field_name = temp #---------------------- Debug/HPC CONTROL------------------------- -#amrex.fpe_trap_invalid = 1 -#amrex.fpe_trap_zero = 1 -#amrex.fpe_trap_overflow = 1 +amrex.fpe_trap_invalid = 1 +amrex.fpe_trap_zero = 1 +amrex.fpe_trap_overflow = 1 From 721b8ce975abb0cfe1f83f37533df147c1c6b29f Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Tue, 31 Dec 2024 14:04:23 -0700 Subject: [PATCH 10/11] re-comment out some FPE trapping stuff --- Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp index 6441b65c..16a75794 100644 --- a/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp +++ b/Exec/RegTests/IsothermalSoretChannel/isothermal-soret.inp @@ -86,6 +86,6 @@ amr.gradT.adjacent_difference_greater = 200 amr.gradT.field_name = temp #---------------------- Debug/HPC CONTROL------------------------- -amrex.fpe_trap_invalid = 1 -amrex.fpe_trap_zero = 1 -amrex.fpe_trap_overflow = 1 +#amrex.fpe_trap_invalid = 1 +#amrex.fpe_trap_zero = 1 +#amrex.fpe_trap_overflow = 1 From 6b5236fa9f940f271d114cd6c1a27b5c7d3ba7e8 Mon Sep 17 00:00:00 2001 From: Bruce Perry Date: Fri, 3 Jan 2025 13:46:11 -0700 Subject: [PATCH 11/11] fix another typo in docs --- Docs/sphinx/manual/LMeXControls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/sphinx/manual/LMeXControls.rst b/Docs/sphinx/manual/LMeXControls.rst index 6acd4cab..b0987349 100644 --- a/Docs/sphinx/manual/LMeXControls.rst +++ b/Docs/sphinx/manual/LMeXControls.rst @@ -297,7 +297,7 @@ Transport coefficients and LES When using the Soret effect, boundary condition corrections are needed at isothermal boundaries, which are not fully supported. Currently a correction for all terms except the wbar term is applied at isothermal domain boundaries (this is likely sufficient), while no corrections are applied - at isothemral embedded boundaries (so use caution for isothermal EBs with Soret diffusion active). + at isothermal embedded boundaries (so use caution for isothermal EBs with Soret diffusion active). Chemistry integrator --------------------