34template<> Domain1DCabinet* Domain1DCabinet::s_storage = 0;
37template<> Boundary1DCabinet* Boundary1DCabinet::s_storage;
40template<> Flow1DCabinet* Flow1DCabinet::s_storage;
43template<> SolutionCabinet* SolutionCabinet::s_storage;
53 return Domain1DCabinet::add(
newFlow1D(domainType, SolutionCabinet::at(solution),
id));
63 return Domain1DCabinet::add(
newBoundary1D(domainType, SolutionCabinet::at(solution),
id));
73 string out = Domain1DCabinet::at(handle)->domainType();
75 return int(out.size()) + 1;
85 return static_cast<int32_t
>(Domain1DCabinet::at(handle)->domainIndex());
95 return static_cast<int32_t
>(Domain1DCabinet::at(handle)->index(n, j));
105 return static_cast<int32_t
>(Domain1DCabinet::at(handle)->nComponents());
115 return static_cast<int32_t
>(Domain1DCabinet::at(handle)->nPoints());
125 string out = Domain1DCabinet::at(handle)->componentName(n);
127 return int(out.size()) + 1;
137 return static_cast<int32_t
>(Domain1DCabinet::at(handle)->componentIndex(name));
147 return SolutionCabinet::add(Domain1DCabinet::at(handle)->phase());
157 Domain1DCabinet::at(handle)->updateState(loc);
168 return Domain1DCabinet::at(handle)->value(component);
178 Domain1DCabinet::at(handle)->setValue(component, value);
185 int32_t
domain_values(int32_t handle,
const char* component, int32_t bufLen,
double* buf)
189 vector<double> out = Domain1DCabinet::at(handle)->values(component);
190 std::copy(out.begin(), out.end(), buf);
191 return int(out.size());
197 int32_t
domain_getValues(int32_t handle,
const char* component, int32_t valuesLen,
double* values)
201 span<double> values_(values, valuesLen);
202 Domain1DCabinet::at(handle)->getValues(component, values_);
209 int32_t
domain_setValues(int32_t handle,
const char* component, int32_t valuesLen,
const double* values)
213 span<const double> values_(values, valuesLen);
214 Domain1DCabinet::at(handle)->setValues(component, values_);
221 int32_t
domain_residuals(int32_t handle,
const char* component, int32_t bufLen,
double* buf)
225 vector<double> out = Domain1DCabinet::at(handle)->residuals(component);
226 std::copy(out.begin(), out.end(), buf);
227 return int(out.size());
233 int32_t
domain_setProfile(int32_t handle,
const char* component, int32_t posLen,
const double* pos, int32_t valuesLen,
const double* values)
237 span<const double> pos_(pos, posLen);
238 span<const double> values_(values, valuesLen);
239 Domain1DCabinet::at(handle)->setProfile(component, pos_, values_);
250 Domain1DCabinet::at(handle)->setFlatProfile(component, value);
261 Domain1DCabinet::at(handle)->setBounds(n, lower, upper);
272 return Domain1DCabinet::at(handle)->lowerBound(n);
282 return Domain1DCabinet::at(handle)->upperBound(n);
292 Domain1DCabinet::at(handle)->setSteadyTolerances(rtol, atol, n);
303 Domain1DCabinet::at(handle)->setTransientTolerances(rtol, atol, n);
314 return Domain1DCabinet::at(handle)->rtol(n);
324 return Domain1DCabinet::at(handle)->atol(n);
334 span<const double> z_(z, zLen);
335 Domain1DCabinet::at(handle)->setupGrid(z_);
346 Domain1DCabinet::at(handle)->setupUniformGrid(points, length, start);
357 Domain1DCabinet::at(handle)->setID(s);
368 auto& obj = Domain1DCabinet::at(handle);
370 span<double> out = obj->grid();
371 std::copy(out.begin(), out.end(), buf);
372 return int(out.size());
382 Domain1DCabinet::as<Boundary1D>(handle)->setMdot(mdot);
393 Domain1DCabinet::as<Boundary1D>(handle)->setTemperature(t);
404 Domain1DCabinet::as<Boundary1D>(handle)->setSpreadRate(V0);
415 Domain1DCabinet::as<Boundary1D>(handle)->setMoleFractions(xin);
426 span<const double> xin_(xin, xinLen);
427 Domain1DCabinet::as<Boundary1D>(handle)->setMoleFractions(xin_);
438 return Domain1DCabinet::as<Boundary1D>(handle)->mdot();
448 return Domain1DCabinet::as<Boundary1D>(handle)->temperature();
458 return Domain1DCabinet::as<Boundary1D>(handle)->spreadRate();
468 return Domain1DCabinet::as<Boundary1D>(handle)->massFraction(k);
478 string out = Domain1DCabinet::as<Flow1D>(handle)->transportModel();
480 return int(out.size()) + 1;
490 Domain1DCabinet::at(handle)->setTransportModel(model);
501 bool withSoret_ = (withSoret != 0);
502 Domain1DCabinet::as<Flow1D>(handle)->enableSoret(withSoret_);
513 Domain1DCabinet::as<Flow1D>(handle)->setPressure(p);
524 return Domain1DCabinet::as<Flow1D>(handle)->pressure();
534 span<const double> zfixed_(zfixed, zfixedLen);
535 span<const double> tfixed_(tfixed, tfixedLen);
536 Domain1DCabinet::as<Flow1D>(handle)->setFixedTempProfile(zfixed_, tfixed_);
547 Domain1DCabinet::as<Flow1D>(handle)->solveEnergyEqn(j);
558 bool out = Domain1DCabinet::as<Flow1D>(handle)->allOfEnergyEnabled();
569 bool out = Domain1DCabinet::as<Flow1D>(handle)->noneOfEnergyEnabled();
580 bool flag_ = (flag != 0);
581 Domain1DCabinet::as<Flow1D>(handle)->setEnergyEnabled(flag_);
592 bool docov_ = (docov != 0);
593 Domain1DCabinet::as<ReactingSurf1D>(handle)->enableCoverageEquations(docov_);
604 auto& obj = Domain1DCabinet::at(handle);
606 vector<double> out = obj->getRefineCriteria();
607 std::copy(out.begin(), out.end(), buf);
608 return int(out.size());
618 Domain1DCabinet::at(handle)->setRefineCriteria(ratio, slope, curve, prune);
625 int32_t
domain_info(int32_t handle, int32_t rows, int32_t width, int32_t bufLen,
char* buf)
629 string out = Domain1DCabinet::at(handle)->_info(rows, width);
631 return int(out.size()) + 1;
641 Domain1DCabinet::del(handle);
653 return Domain1DCabinet::size();
Boundary objects for one-dimensional simulations.
Template for classes to hold pointers to objects.
CTDOMAIN - Generated CLib Cantera interface library.
int32_t domain_cabinetSize()
Return size of Domain1D storage.
double bdry_spreadRate(int32_t handle)
Tangential velocity gradient [1/s] at this boundary.
double domain_rtol(int32_t handle, int32_t n)
Relative tolerance of the nth component.
int32_t domain_setTransportModel(int32_t handle, const char *model)
Set transport model by name.
double domain_atol(int32_t handle, int32_t n)
Absolute tolerance of the nth component.
int32_t domain_setupUniformGrid(int32_t handle, int32_t points, double length, double start)
Set up uniform grid.
double bdry_temperature(int32_t handle)
Temperature [K].
int32_t domain_grid(int32_t handle, int32_t bufLen, double *buf)
Access the array of grid coordinates [m].
int32_t domain_phase(int32_t handle)
Return thermo/kinetics/transport manager used in the domain.
int32_t domain_componentName(int32_t handle, int32_t n, int32_t bufLen, char *buf)
Name of component n.
int32_t domain_setProfile(int32_t handle, const char *component, int32_t posLen, const double *pos, int32_t valuesLen, const double *values)
Specify a profile for a component.
int32_t domain_updateState(int32_t handle, int32_t loc)
Update state at given location to state of associated Solution object.
int32_t flow_enableSoret(int32_t handle, int32_t withSoret)
Enable thermal diffusion, also known as Soret diffusion.
double domain_value(int32_t handle, const char *component)
Set a single component value at a boundary.
int32_t flow_solveEnergyEqn(int32_t handle, int32_t j)
Specify that the energy equation should be solved at point j.
int32_t flow_setEnergyEnabled(int32_t handle, int32_t flag)
Set energy enabled flag for entire domain.
int32_t domain_getValues(int32_t handle, const char *component, int32_t valuesLen, double *values)
Retrieve component values.
int32_t domain_setID(int32_t handle, const char *s)
Specify an identifying tag for this domain.
int32_t domain_nPoints(int32_t handle)
Number of grid points in this domain.
double domain_upperBound(int32_t handle, int32_t n)
Upper bound on the nth component.
int32_t domain_setTransientTolerances(int32_t handle, double rtol, double atol, int32_t n)
Set tolerances for time-stepping mode.
int32_t domain_setValues(int32_t handle, const char *component, int32_t valuesLen, const double *values)
Specify component values.
int32_t bdry_setSpreadRate(int32_t handle, double V0)
Set tangential velocity gradient [1/s] at this boundary.
int32_t domain_setRefineCriteria(int32_t handle, double ratio, double slope, double curve, double prune)
Set grid refinement criteria.
int32_t domain_getRefineCriteria(int32_t handle, int32_t bufLen, double *buf)
Get the grid refinement criteria.
int32_t domain_residuals(int32_t handle, const char *component, int32_t bufLen, double *buf)
Retrieve internal work array values for a component.
int32_t flow_noneOfEnergyEnabled(int32_t handle)
Check if energy is disabled for entire domain.
int32_t flow_setFixedTempProfile(int32_t handle, int32_t zfixedLen, const double *zfixed, int32_t tfixedLen, const double *tfixed)
Set fixed temperature profile.
double bdry_mdot(int32_t handle)
The total mass flow rate [kg/m2/s].
int32_t flow_allOfEnergyEnabled(int32_t handle)
Check if energy is enabled for entire domain.
int32_t domain_del(int32_t handle)
Delete Domain1D object.
int32_t domain_setValue(int32_t handle, const char *component, double value)
Set a single component value in a flow domain or at a boundary.
int32_t domain_newBoundary1D(const char *domainType, int32_t solution, const char *id)
Create a Boundary1D object of the specified type.
int32_t domain_nComponents(int32_t handle)
Number of components at each grid point.
double bdry_massFraction(int32_t handle, int32_t k)
Mass fraction of species k.
int32_t reactingsurf_enableCoverageEquations(int32_t handle, int32_t docov)
Set whether to solve the equations for the surface species coverages.
int32_t domain_setupGrid(int32_t handle, int32_t zLen, const double *z)
Set up initial grid.
int32_t domain_index(int32_t handle, int32_t n, int32_t j)
Returns the index of the solution vector, which corresponds to component n at grid point j.
int32_t flow_transportModel(int32_t handle, int32_t bufLen, char *buf)
Retrieve transport model.
int32_t bdry_setTemperature(int32_t handle, double t)
Set the temperature.
int32_t bdry_setMoleFractions(int32_t handle, int32_t xinLen, const double *xin)
Set the mole fractions by specifying an array.
int32_t bdry_setMoleFractionsByName(int32_t handle, const char *xin)
Set the mole fractions by specifying a string.
double domain_lowerBound(int32_t handle, int32_t n)
Lower bound on the nth component.
int32_t domain_domainType(int32_t handle, int32_t bufLen, char *buf)
Domain type flag.
int32_t domain_values(int32_t handle, const char *component, int32_t bufLen, double *buf)
Retrieve component values.
int32_t flow_setPressure(int32_t handle, double p)
Set the pressure.
int32_t domain_newFlow1D(const char *domainType, int32_t solution, const char *id)
Create a Flow1D object of the specified type.
int32_t domain_setSteadyTolerances(int32_t handle, double rtol, double atol, int32_t n)
Set tolerances for steady-state mode.
double flow_pressure(int32_t handle)
The current pressure [Pa].
int32_t domain_info(int32_t handle, int32_t rows, int32_t width, int32_t bufLen, char *buf)
Return a concise summary of a Domain.
int32_t bdry_setMdot(int32_t handle, double mdot)
Set the total mass flow rate [kg/m²/s].
int32_t domain_domainIndex(int32_t handle)
The left-to-right location of this domain.
int32_t domain_componentIndex(int32_t handle, const char *name)
Index of component with name name.
int32_t domain_setFlatProfile(int32_t handle, const char *component, double value)
Specify a flat profile for a component.
int32_t domain_setBounds(int32_t handle, int32_t n, double lower, double upper)
Set the upper and lower bounds for a solution component, n.
size_t copyString(const string &source, char *dest, size_t length)
Copy the contents of a string into a char array of a given length.
shared_ptr< Flow1D > newFlow1D(const string &domainType, shared_ptr< Solution > solution, const string &id)
Create a Flow1D object of the specified type.
shared_ptr< Boundary1D > newBoundary1D(const string &domainType, shared_ptr< Solution > solution, const string &id)
Create a Boundary1D object of the specified type.
Namespace for the Cantera kernel.
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.
Contains declarations for string manipulation functions within Cantera.