From 881bdbdeea1b959aa7c2bcf5c01c938be5e7cc11 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Wed, 14 Aug 2024 12:48:37 -0500 Subject: [PATCH] [clib] Remove obsolete oneD constructors --- include/cantera/clib/ctonedim.h | 11 ---- .../OneDim/ReactingSurface.m | 2 - src/clib/ctonedim.cpp | 65 ------------------- test/clib/test_ctonedim.cpp | 33 +++++----- 4 files changed, 17 insertions(+), 94 deletions(-) diff --git a/include/cantera/clib/ctonedim.h b/include/cantera/clib/ctonedim.h index e7c284f32ef..8ae5e529040 100644 --- a/include/cantera/clib/ctonedim.h +++ b/include/cantera/clib/ctonedim.h @@ -49,19 +49,8 @@ extern "C" { CANTERA_CAPI double bdry_massFraction(int i, int k); CANTERA_CAPI double bdry_mdot(int i); - CANTERA_CAPI int reactingsurf_setkineticsmgr(int i, int j); CANTERA_CAPI int reactingsurf_enableCoverageEqs(int i, int onoff); - CANTERA_CAPI int inlet_new(); - CANTERA_CAPI int outlet_new(); - CANTERA_CAPI int outletres_new(); - CANTERA_CAPI int symm_new(); - CANTERA_CAPI int surf_new(); - CANTERA_CAPI int reactingsurf_new(); - - CANTERA_CAPI int inlet_setSpreadRate(int i, double v); - - CANTERA_CAPI int flow1D_new(int iph, int ikin, int itr, int itype); CANTERA_CAPI int flow1D_setTransport(int i, int itr); CANTERA_CAPI int flow1D_enableSoret(int i, int iSoret); CANTERA_CAPI int flow1D_setPressure(int i, double p); diff --git a/interfaces/matlab_experimental/OneDim/ReactingSurface.m b/interfaces/matlab_experimental/OneDim/ReactingSurface.m index 9d361c58039..32a3b5b0cd8 100644 --- a/interfaces/matlab_experimental/OneDim/ReactingSurface.m +++ b/interfaces/matlab_experimental/OneDim/ReactingSurface.m @@ -38,8 +38,6 @@ end s@Boundary1D('reacting-surface', surface_mech, id); - - ctFunc('reactingsurf_setkineticsmgr', s.domainID, surface_mech.kinID); s.coverageEnabled = false; end diff --git a/src/clib/ctonedim.cpp b/src/clib/ctonedim.cpp index a751ef160c5..0038280aa3d 100644 --- a/src/clib/ctonedim.cpp +++ b/src/clib/ctonedim.cpp @@ -237,60 +237,6 @@ extern "C" { } } - int inlet_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - - int surf_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - - int reactingsurf_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - - int symm_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - - int outlet_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - - int outletres_new() - { - try { - return DomainCabinet::add(make_shared()); - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - int bdry_setMdot(int i, double mdot) { try { @@ -367,17 +313,6 @@ extern "C" { } } - int reactingsurf_setkineticsmgr(int i, int j) - { - try { - auto k = KineticsCabinet::at(j); - DomainCabinet::get(i).setKinetics(k); - return 0; - } catch (...) { - return handleAllExceptions(-1, ERR); - } - } - int reactingsurf_enableCoverageEqs(int i, int onoff) { try { diff --git a/test/clib/test_ctonedim.cpp b/test/clib/test_ctonedim.cpp index 5134d17da09..ed9fe819b8e 100644 --- a/test/clib/test_ctonedim.cpp +++ b/test/clib/test_ctonedim.cpp @@ -55,10 +55,8 @@ TEST(ctonedim, freeflow_from_parts) thermo_setTemperature(ph, T); thermo_setPressure(ph, P); - int itype = 2; // free flow - int flow = flow1D_new(ph, kin, tr, itype); + int flow = domain_new("free-flow", sol, "flow"); ASSERT_GE(flow, 0); - domain_setID(flow, "flow"); ASSERT_NEAR(flow1D_pressure(flow), P, 1e-5); int buflen = domain_type(flow, 0, 0); @@ -71,7 +69,8 @@ TEST(ctonedim, freeflow_from_parts) TEST(ctonedim, inlet) { - int inlet = inlet_new(); + int sol = soln_newSolution("h2o2.yaml", "ohmech", "default"); + int inlet = domain_new("inlet", sol, ""); ASSERT_GE(inlet, 0); int buflen = domain_type(inlet, 0, 0); @@ -84,14 +83,21 @@ TEST(ctonedim, inlet) TEST(ctonedim, outlet) { - int index = outlet_new(); - ASSERT_GE(index, 0); + int sol = soln_newSolution("h2o2.yaml", "ohmech", "default"); + int outlet = domain_new("outlet", sol, ""); + ASSERT_GE(outlet, 0); + + int buflen = domain_type(outlet, 0, 0); + char* buf = new char[buflen]; + domain_type(outlet, buflen, buf); + string domName = buf; + ASSERT_EQ(domName, "outlet"); + delete[] buf; } TEST(ctonedim, reacting_surface) { int interface = soln_newInterface("ptcombust.yaml", "Pt_surf", 0, 0); - int surf = domain_new("reacting-surface", interface, ""); ASSERT_GE(surf, 0); @@ -125,15 +131,13 @@ TEST(ctonedim, catcomb) ASSERT_GE(dom, 0); } -TEST(ctonedim, freeflame_from_parts) +TEST(ctonedim, freeflame) { ct_resetStorage(); auto gas = newThermo("h2o2.yaml", "ohmech"); int sol = soln_newSolution("h2o2.yaml", "ohmech", "default"); int ph = soln_thermo(sol); - int kin = soln_kinetics(sol); - int tr = soln_transport(sol); size_t nsp = thermo_nSpecies(ph); // reactants @@ -157,8 +161,7 @@ TEST(ctonedim, freeflame_from_parts) thermo_getMassFractions(ph, nsp, yout.data()); // flow - int itype = 2; // free flow - int flow = flow1D_new(ph, kin, tr, itype); + int flow = domain_new("free-flow", sol, "flow"); domain_setID(flow, "flow"); // grid @@ -173,15 +176,13 @@ TEST(ctonedim, freeflame_from_parts) domain_setupGrid(flow, nz, z.data()); // inlet - int reac = inlet_new(); - domain_setID(reac, "inlet"); + int reac = domain_new("inlet", sol, "inlet"); bdry_setMoleFractions(reac, X.c_str()); bdry_setMdot(reac, uin * rho_in); bdry_setTemperature(reac, T); // outlet - int prod = outlet_new(); - domain_setID(prod, "outlet"); + int prod = domain_new("outlet", sol, "outlet"); double uout = bdry_mdot(reac) / rho_out; // set up stack