Skip to content

Commit

Permalink
[clib] Remove obsolete oneD constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Aug 14, 2024
1 parent fdb6cd8 commit 881bdbd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 94 deletions.
11 changes: 0 additions & 11 deletions include/cantera/clib/ctonedim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions interfaces/matlab_experimental/OneDim/ReactingSurface.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
end

s@Boundary1D('reacting-surface', surface_mech, id);

ctFunc('reactingsurf_setkineticsmgr', s.domainID, surface_mech.kinID);
s.coverageEnabled = false;
end

Expand Down
65 changes: 0 additions & 65 deletions src/clib/ctonedim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,60 +237,6 @@ extern "C" {
}
}

int inlet_new()
{
try {
return DomainCabinet::add(make_shared<Inlet1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int surf_new()
{
try {
return DomainCabinet::add(make_shared<Surf1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int reactingsurf_new()
{
try {
return DomainCabinet::add(make_shared<ReactingSurf1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int symm_new()
{
try {
return DomainCabinet::add(make_shared<Symm1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int outlet_new()
{
try {
return DomainCabinet::add(make_shared<Outlet1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int outletres_new()
{
try {
return DomainCabinet::add(make_shared<OutletRes1D>());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int bdry_setMdot(int i, double mdot)
{
try {
Expand Down Expand Up @@ -367,17 +313,6 @@ extern "C" {
}
}

int reactingsurf_setkineticsmgr(int i, int j)
{
try {
auto k = KineticsCabinet::at(j);
DomainCabinet::get<ReactingSurf1D>(i).setKinetics(k);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

int reactingsurf_enableCoverageEqs(int i, int onoff)
{
try {
Expand Down
33 changes: 17 additions & 16 deletions test/clib/test_ctonedim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 881bdbd

Please sign in to comment.