30typedef Cabinet<Sim1D> Sim1DCabinet;
31template<> Sim1DCabinet* Sim1DCabinet::s_storage = 0;
33typedef Cabinet<Domain1D> Domain1DCabinet;
34template<> Domain1DCabinet* Domain1DCabinet::s_storage;
44 vector<shared_ptr<Domain1D>> domains_;
45 for (
int i = 0; i < domainsLen; i++) {
46 domains_.push_back(Domain1DCabinet::at(domains[i]));
48 return Sim1DCabinet::add(
newSim1D(domains_));
54 int32_t
sim1D_setValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint,
double value)
58 Sim1DCabinet::at(handle)->setValue(dom, comp, localPoint, value);
65 int32_t
sim1D_setProfile(int32_t handle, int32_t dom, int32_t comp, int32_t posLen,
const double* pos, int32_t valuesLen,
const double* values)
69 const vector<double> pos_(pos, pos + posLen);
70 const vector<double> values_(values, values + valuesLen);
71 Sim1DCabinet::at(handle)->setProfile(dom, comp, pos_, values_);
82 Sim1DCabinet::at(handle)->setFlatProfile(dom, comp, v);
89 int32_t
sim1D_setInitialGuess(int32_t handle,
const char* component, int32_t locsLen,
double* locs, int32_t valsLen,
double* vals)
93 vector<double> locs_(locs, locs + locsLen);
94 vector<double> vals_(vals, vals + valsLen);
95 Sim1DCabinet::at(handle)->setInitialGuess(component, locs_, vals_);
106 Sim1DCabinet::at(handle)->show();
113 int32_t
sim1D_setTimeStep(int32_t handle,
double stepsize, int32_t n, int32_t tstepsLen,
const int32_t* tsteps)
117 Sim1DCabinet::as<SteadyStateSystem>(handle)->setTimeStep(stepsize, n, tsteps);
128 Sim1DCabinet::at(handle)->getInitialSoln();
135 int32_t
sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid)
139 bool refine_grid_ = (refine_grid != 0);
140 Sim1DCabinet::at(handle)->solve(loglevel, refine_grid_);
151 return Sim1DCabinet::at(handle)->refine(loglevel);
161 Sim1DCabinet::at(handle)->setRefineCriteria(dom, ratio, slope, curve, prune);
172 Sim1DCabinet::at(handle)->setGridMin(dom, gridmin);
179 int32_t
sim1D_save(int32_t handle,
const char* fname,
const char* name,
const char* desc)
183 Sim1DCabinet::at(handle)->save(fname, name, desc);
194 Sim1DCabinet::as<OneDim>(handle)->writeStats(printTime);
205 return Sim1DCabinet::as<OneDim>(handle)->domainIndex(name);
211 double sim1D_value(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint)
215 return Sim1DCabinet::at(handle)->value(dom, comp, localPoint);
225 return Sim1DCabinet::at(handle)->workValue(dom, comp, localPoint);
231 int32_t
sim1D_eval(int32_t handle, int32_t xLen,
double* x, int32_t rLen,
double* r,
double rdt, int32_t count)
235 Sim1DCabinet::at(handle)->eval(x, r, rdt, count);
246 Sim1DCabinet::as<SteadyStateSystem>(handle)->setJacAge(ss_age, ts_age);
257 return Sim1DCabinet::at(handle)->setFixedTemperature(t);
267 Sim1DCabinet::del(handle);
279 return Sim1DCabinet::size();
291 return Sim1DCabinet::parent(handle);
int32_t sim1D_setValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint, double value)
Set a single value in the solution vector.
int32_t sim1D_getInitialSoln(int32_t handle)
Get the initial value of the system state from each domain in the simulation.
int32_t sim1D_writeStats(int32_t handle, int32_t printTime)
Write statistics about the number of iterations and Jacobians at each grid level.
int32_t sim1D_del(int32_t handle)
Delete Sim1D object.
double sim1D_workValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint)
Get an entry in the work vector, which may contain either a new system state or the current residual ...
int32_t sim1D_cabinetSize()
Return size of Sim1D storage.
int32_t sim1D_setInitialGuess(int32_t handle, const char *component, int32_t locsLen, double *locs, int32_t valsLen, double *vals)
Set initial guess for one component for all domains.
int32_t sim1D_save(int32_t handle, const char *fname, const char *name, const char *desc)
Save current simulation data to a container file or CSV format.
int32_t sim1D_parentHandle(int32_t handle)
Return handle to parent of Sim1D object.
int32_t sim1D_eval(int32_t handle, int32_t xLen, double *x, int32_t rLen, double *r, double rdt, int32_t count)
Evaluate the residual function.
int32_t sim1D_setProfile(int32_t handle, int32_t dom, int32_t comp, int32_t posLen, const double *pos, int32_t valuesLen, const double *values)
Specify a profile for one component of one domain.
int32_t sim1D_setRefineCriteria(int32_t handle, int32_t dom, double ratio, double slope, double curve, double prune)
Set grid refinement criteria.
int32_t sim1D_show(int32_t handle)
Show logging information on current solution for all domains.
int32_t sim1D_setGridMin(int32_t handle, int32_t dom, double gridmin)
Set the minimum grid spacing in the specified domain(s).
int32_t sim1D_refine(int32_t handle, int32_t loglevel)
Refine the grid in all domains.
int32_t sim1D_setFixedTemperature(int32_t handle, double t)
Add node for fixed temperature point of freely propagating flame.
int32_t sim1D_newSim1D(int32_t domainsLen, int32_t *domains)
Create a Sim1D object with a list of domains.
double sim1D_value(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint)
Get one entry in the solution vector.
int32_t sim1D_setFlatProfile(int32_t handle, int32_t dom, int32_t comp, double v)
Set component 'comp' of domain 'dom' to value 'v' at all points.
int32_t sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid)
Performs the hybrid Newton steady/time-stepping solution.
int32_t sim1D_setTimeStep(int32_t handle, double stepsize, int32_t n, int32_t tstepsLen, const int32_t *tsteps)
Set the number of time steps to try when the steady Newton solver is unsuccessful.
int32_t sim1D_domainIndex(int32_t handle, const char *name)
Get the index of the domain named.
int32_t sim1D_setMaxJacAge(int32_t handle, int32_t ss_age, int32_t ts_age)
Set the maximum number of steps that can be taken using the same Jacobian before it must be re-evalua...
CTONEDIM - Generated CLib Cantera interface library.
Namespace for the Cantera kernel.
shared_ptr< Sim1D > newSim1D(vector< shared_ptr< Domain1D > > &domains)
Create a Sim1D object with a list of domains.
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.