mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[clib] Retain stflow_ routines but throw error
This commit is contained in:
parent
37ad4e93d6
commit
ded4513c8b
@ -68,6 +68,16 @@ extern "C" {
|
||||
size_t m, const double* temp);
|
||||
CANTERA_CAPI int flow1D_solveEnergyEqn(int i, int flag);
|
||||
|
||||
//! @todo: Remove all functions with `stflow` prefix after Cantera 3.1
|
||||
CANTERA_CAPI int stflow_new(int iph, int ikin, int itr, int itype);
|
||||
CANTERA_CAPI int stflow_setTransport(int i, int itr);
|
||||
CANTERA_CAPI int stflow_enableSoret(int i, int iSoret);
|
||||
CANTERA_CAPI int stflow_setPressure(int i, double p);
|
||||
CANTERA_CAPI double stflow_pressure(int i);
|
||||
CANTERA_CAPI int stflow_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
size_t m, const double* temp);
|
||||
CANTERA_CAPI int stflow_solveEnergyEqn(int i, int flag);
|
||||
|
||||
CANTERA_CAPI int sim1D_new(size_t nd, const int* domains);
|
||||
CANTERA_CAPI int sim1D_del(int i);
|
||||
CANTERA_CAPI int sim1D_setValue(int i, int dom, int comp, int localPoint, double value);
|
||||
|
@ -398,7 +398,7 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
//------------------ stagnation flow domains --------------------
|
||||
//------------------ flow domains --------------------
|
||||
|
||||
int flow1D_new(int iph, int ikin, int itr, int itype)
|
||||
{
|
||||
@ -490,6 +490,77 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_new(int iph, int ikin, int itr, int itype)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_new",
|
||||
"Function replaced by 'flow1D_new'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setTransport(int i, int itr)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_setTransport",
|
||||
"Function replaced by 'flow1D_setTransport'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_enableSoret(int i, int iSoret)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_enableSoret",
|
||||
"Function replaced by 'flow1D_enableSoret'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setPressure(int i, double p)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_setPressure",
|
||||
"Function replaced by 'flow1D_setPressure'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
double stflow_pressure(int i)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_pressure",
|
||||
"Function replaced by 'flow1D_pressure'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(DERR, DERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_setFixedTempProfile(int i, size_t n, const double* pos,
|
||||
size_t m, const double* temp)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_setFixedTempProfile",
|
||||
"Function replaced by 'flow1D_setFixedTempProfile'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int stflow_solveEnergyEqn(int i, int flag)
|
||||
{
|
||||
try {
|
||||
throw NotImplementedError("stflow_solveEnergyEqn",
|
||||
"Function replaced by 'flow1D_solveEnergyEqn'.");
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------- Sim1D --------------------------------------
|
||||
|
||||
int sim1D_new(size_t nd, const int* domains)
|
||||
|
@ -254,3 +254,25 @@ TEST(ctonedim, freeflame_from_parts)
|
||||
Tprev = T;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ctonedim, stflow_tests)
|
||||
{
|
||||
//! @todo: To be removed after Cantera 3.1
|
||||
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);
|
||||
|
||||
// spot check some errors
|
||||
int itype = 2; // free flow
|
||||
int ret = stflow_new(ph, kin, tr, itype);
|
||||
ASSERT_EQ(ret, -1); // -1 is an error code
|
||||
|
||||
int flow = flow1D_new(ph, kin, tr, itype);
|
||||
ASSERT_EQ(stflow_setTransport(flow, tr), -1);
|
||||
ASSERT_EQ(stflow_pressure(flow), DERR); // DERR is an error code
|
||||
ASSERT_EQ(stflow_setPressure(flow, OneAtm), -1);
|
||||
}
|
||||
|
0
test/clib/utils.h
Normal file
0
test/clib/utils.h
Normal file
Loading…
Reference in New Issue
Block a user