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 authored and speth committed Aug 18, 2024
1 parent 1d24e69 commit 4db66c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 132 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
77 changes: 23 additions & 54 deletions test/clib/test_ctonedim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,83 +23,58 @@ TEST(ctonedim, freeflow)
thermo_setTemperature(ph, T);
thermo_setPressure(ph, P);

int flow = domain_new("free-flow", sol, "flow");
int flow = domain_new("free-flow", sol, "");
ASSERT_GE(flow, 0);
domain_setID(flow, "flow");
ASSERT_NEAR(flow1D_pressure(flow), P, 1e-5);

int buflen = domain_type(flow, 0, 0);
char* buf = new char[buflen];
domain_type(flow, buflen, buf);
string domName = buf;
ASSERT_EQ(domName, "free-flow");
delete[] buf;
}

TEST(ctonedim, freeflow_from_parts)
{
ct_resetStorage();

int sol = soln_newSolution("h2o2.yaml", "ohmech", "default");
int ph = soln_thermo(sol);
ASSERT_GE(ph, 0);
int kin = soln_kinetics(sol);
ASSERT_GE(kin, 0);
int tr = soln_transport(sol);
ASSERT_GE(tr, 0);

double T = 1050;
double P = 5 * 101325;
string X = "CH4:1.0, O2:2.0, N2:7.52";
thermo_setMoleFractionsByName(ph, X.c_str());
thermo_setTemperature(ph, T);
thermo_setPressure(ph, P);

int itype = 2; // free flow
int flow = flow1D_new(ph, kin, tr, itype);
ASSERT_GE(flow, 0);
domain_setID(flow, "flow");
ASSERT_NEAR(flow1D_pressure(flow), P, 1e-5);

int buflen = domain_type(flow, 0, 0);
char* buf = new char[buflen];
domain_type(flow, buflen, buf);
string domName = buf;
ASSERT_EQ(domName, "free-flow");
string domType = buf;
ASSERT_EQ(domType, "free-flow");
delete[] buf;
}

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);
char* buf = new char[buflen];
domain_type(inlet, buflen, buf);
string domName = buf;
ASSERT_EQ(domName, "inlet");
string domType = buf;
ASSERT_EQ(domType, "inlet");
delete[] buf;
}

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 domType = buf;
ASSERT_EQ(domType, "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);

int buflen = domain_type(surf, 0, 0);
char* buf = new char[buflen];
domain_type(surf, buflen, buf);
string domName = buf;
ASSERT_EQ(domName, "reacting-surface");
string domType = buf;
ASSERT_EQ(domType, "reacting-surface");
delete[] buf;
}

Expand All @@ -125,15 +100,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,9 +130,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);
domain_setID(flow, "flow");
int flow = domain_new("free-flow", sol, "flow");

// grid
int nz = 21;
Expand All @@ -173,15 +144,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 4db66c3

Please sign in to comment.