Cantera  3.2.0a5
Loading...
Searching...
No Matches
interfaces/clib/include/cantera_clib/ctonedim.h
Go to the documentation of this file.
1/**
2 * CTONEDIM - Generated CLib %Cantera interface library.
3 *
4 * @file ctonedim.h
5 *
6 * Generated CLib API for %Cantera's Sim1D class.
7 *
8 * This library of functions is designed to encapsulate %Cantera functionality
9 * and make it available for use in languages and applications other than C++.
10 * A set of library functions is provided that are declared "extern C". All
11 * %Cantera objects are stored and referenced by integers - no pointers are
12 * passed to or from the calling application.
13 *
14 * This file was generated by sourcegen. It will be re-generated by the
15 * %Cantera build process. Do not manually edit.
16 *
17 * @warning This library is an experimental part of the %Cantera API and
18 * may be changed without notice.
19 */
20
21// This file is part of Cantera. See License.txt in the top-level directory or
22// at https://cantera.org/license.txt for license and copyright information.
23
24#ifndef CTONEDIM_H
25#define CTONEDIM_H
26
27#include <stdint.h> // for 32-bit int32_t / 64-bit int64_t
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33 /**
34 * @defgroup CAPIctonedim ctonedim Library
35 * Generated CLib API for %Cantera's Sim1D class.
36 *
37 * @warning This library is an experimental part of the %Cantera API and
38 * may be changed or removed without notice.
39 *
40 * @ingroup CAPIindex
41 */
42
43 /**
44 * @addtogroup CAPIctonedim
45 * @{
46 */
47
48 /**
49 * Create a Sim1D object with a list of domains.
50 *
51 * Wraps C++ constructor: `shared_ptr<Sim1D> newSim1D(vector<shared_ptr<Domain1D>>&)`
52 *
53 * Uses:
54 * - `Domain1D& OneDim::domain(size_t)`
55 *
56 * @param[in] domainsLen Length of array reserved for domains.
57 * @param domains Memory holding Domain1D objects. A vector of shared pointers to the domains to be linked together. The domain pointers must be entered in left-to-right order
58 * @returns Handle to stored Sim1D object or -1 for exception handling.
59 */
60 int32_t sim1D_newSim1D(int32_t domainsLen, int32_t* domains);
61
62 /**
63 * Set a single value in the solution vector.
64 *
65 * Wraps C++ method: `void Sim1D::setValue(size_t, size_t, size_t, double)`
66 *
67 * @param handle Handle to queried Sim1D object.
68 * @param dom domain number, beginning with 0 for the leftmost domain.
69 * @param comp component number
70 * @param localPoint grid point within the domain, beginning with 0 for the leftmost grid point in the domain.
71 * @param value the value.
72 *
73 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::setValue()
74 */
75 int32_t sim1D_setValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint, double value);
76
77 /**
78 * Specify a profile for one component of one domain.
79 *
80 * Wraps C++ method: `void Sim1D::setProfile(size_t, size_t, const vector<double>&, const vector<double>&)`
81 *
82 * @param handle Handle to queried Sim1D object.
83 * @param dom Undocumented.
84 * @param comp Undocumented.
85 * @param[in] posLen Length of vector reserved for pos.
86 * @param pos Undocumented.
87 * @param[in] valuesLen Length of vector reserved for values.
88 * @param values Undocumented.
89 *
90 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::setProfile.
91 */
92 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);
93
94 /**
95 * Set component 'comp' of domain 'dom' to value 'v' at all points.
96 *
97 * Wraps C++ method: `void Sim1D::setFlatProfile(size_t, size_t, double)`
98 *
99 * @param handle Handle to queried Sim1D object.
100 * @param dom Undocumented.
101 * @param comp Undocumented.
102 * @param v Undocumented.
103 *
104 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::setProfile.
105 */
106 int32_t sim1D_setFlatProfile(int32_t handle, int32_t dom, int32_t comp, double v);
107
108 /**
109 * Set initial guess for one component for all domains.
110 *
111 * Wraps C++ method: `void Sim1D::setInitialGuess(const string&, vector<double>&, vector<double>&)`
112 *
113 * @param handle Handle to queried Sim1D object.
114 * @param component component name
115 * @param[in] locsLen Length of vector reserved for locs.
116 * @param[in] locs A vector of relative positions, beginning with 0.0 at the left of the domain, and ending with 1.0 at the right of the domain.
117 * @param[in] valsLen Length of vector reserved for vals.
118 * @param[in] vals A vector of values corresponding to the relative position locations.
119 *
120 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::setProfile.
121 */
122 int32_t sim1D_setInitialGuess(int32_t handle, const char* component, int32_t locsLen, double* locs, int32_t valsLen, double* vals);
123
124 /**
125 * Show logging information on current solution for all domains.
126 *
127 * Wraps C++ method: `void Sim1D::show()`
128 *
129 * @param handle Handle to queried Sim1D object.
130 */
131 int32_t sim1D_show(int32_t handle);
132
133 /**
134 * Set the number of time steps to try when the steady Newton solver is unsuccessful.
135 *
136 * Wraps C++ method: `void SteadyStateSystem::setTimeStep(double, const vector<int>&)`
137 *
138 * @param handle Handle to queried SteadyStateSystem object.
139 * @param stepSize Initial time step size [s]
140 * @param[in] tStepsLen Length of vector reserved for tSteps.
141 * @param tSteps A sequence of time step counts to take after subsequent failures of the steady-state solver. The last value in `tsteps` will be used again after further unsuccessful solution attempts.
142 */
143 int32_t sim1D_setTimeStep(int32_t handle, double stepSize, int32_t tStepsLen, const int32_t* tSteps);
144
145 /**
146 * Get the initial value of the system state from each domain in the simulation.
147 *
148 * Wraps C++ method: `void Sim1D::getInitialSoln()`
149 *
150 * @param handle Handle to queried Sim1D object.
151 */
152 int32_t sim1D_getInitialSoln(int32_t handle);
153
154 /**
155 * Performs the hybrid Newton steady/time-stepping solution.
156 *
157 * Wraps C++ method: `void Sim1D::solve(int, bool)`
158 *
159 * @param handle Handle to queried Sim1D object.
160 * @param loglevel Controls the amount of diagnostic output.
161 * @param refine_grid If `true`, the grid will be refined
162 */
163 int32_t sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid);
164
165 /**
166 * Refine the grid in all domains.
167 *
168 * Wraps C++ method: `int Sim1D::refine(int)`
169 *
170 * @param handle Handle to queried Sim1D object.
171 * @param loglevel Undocumented.
172 */
173 int32_t sim1D_refine(int32_t handle, int32_t loglevel);
174
175 /**
176 * Set grid refinement criteria.
177 *
178 * Wraps C++ method: `void Sim1D::setRefineCriteria(int, double, double, double, double)`
179 *
180 * @param handle Handle to queried Sim1D object.
181 * @param dom Undocumented.
182 * @param ratio Undocumented.
183 * @param slope Undocumented.
184 * @param curve Undocumented.
185 * @param prune Undocumented.
186 */
187 int32_t sim1D_setRefineCriteria(int32_t handle, int32_t dom, double ratio, double slope, double curve, double prune);
188
189 /**
190 * Set the minimum grid spacing in the specified domain(s).
191 *
192 * Wraps C++ method: `void Sim1D::setGridMin(int, double)`
193 *
194 * @param handle Handle to queried Sim1D object.
195 * @param dom Domain index. If dom == -1, the specified spacing is applied to all domains.
196 * @param gridmin The minimum allowable grid spacing [m]
197 */
198 int32_t sim1D_setGridMin(int32_t handle, int32_t dom, double gridmin);
199
200 /**
201 * Save current simulation data to a container file or CSV format.
202 *
203 * Wraps C++ method: `void Sim1D::save(const string&, const string&, const string&, bool)`
204 *
205 * @param handle Handle to queried Sim1D object.
206 * @param fname Name of output file (CSV, YAML or HDF)
207 * @param name Identifier of storage location within the container file; this node/group contains header information and multiple subgroups holding domain-specific SolutionArray data (YAML/HDF only)
208 * @param desc Custom comment describing the dataset to be stored (YAML/HDF only)
209 * @param overwrite Force overwrite if file/name exists; optional (default=false)
210 */
211 int32_t sim1D_save(int32_t handle, const char* fname, const char* name, const char* desc, int32_t overwrite);
212
213 /**
214 * Retrieve data from a previously saved simulation.
215 *
216 * Wraps C++ method: `void Sim1D::_restore(const string&, const string&)`
217 *
218 * @param handle Handle to queried Sim1D object.
219 * @param fname Name of container file (YAML or HDF)
220 * @param name Identifier of location within the container file; this node/group contains header information and subgroups with domain-specific SolutionArray data
221 */
222 int32_t sim1D_restore(int32_t handle, const char* fname, const char* name);
223
224 /**
225 * Write statistics about the number of iterations and Jacobians at each grid level.
226 *
227 * Wraps C++ setter: `void OneDim::writeStats(int)`
228 *
229 * @param handle Handle to queried OneDim object.
230 * @param printTime Boolean that indicates whether time should be printed out The default is true. It's turned off for test problems where we don't want to print any times
231 */
232 int32_t sim1D_writeStats(int32_t handle, int32_t printTime);
233
234 /**
235 * Get the index of the domain named `name`.
236 *
237 * Wraps C++ method: `size_t OneDim::domainIndex(const string&)`
238 *
239 * @param handle Handle to queried OneDim object.
240 * @param name Undocumented.
241 */
242 int32_t sim1D_domainIndex(int32_t handle, const char* name);
243
244 /**
245 * Get one entry in the solution vector.
246 *
247 * Wraps C++ method: `double Sim1D::value(size_t, size_t, size_t)`
248 *
249 * @param handle Handle to queried Sim1D object.
250 * @param dom domain number, beginning with 0 for the leftmost domain.
251 * @param comp component number
252 * @param localPoint grid point within the domain, beginning with 0 for the leftmost grid point in the domain.
253 *
254 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::value()
255 */
256 double sim1D_value(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint);
257
258 /**
259 * Get an entry in the work vector, which may contain either a new system state or the current residual of the system.
260 *
261 * Wraps C++ method: `double Sim1D::workValue(size_t, size_t, size_t)`
262 *
263 * @param handle Handle to queried Sim1D object.
264 * @param dom domain index
265 * @param comp component index
266 * @param localPoint grid point within the domain
267 *
268 * @deprecated Per C++ annotation: To be removed after Cantera 3.2. Replaceable by Domain1D::getResiduals()
269 */
270 double sim1D_workValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint);
271
272 /**
273 * Evaluate the residual function.
274 *
275 * Wraps C++ method: `void Sim1D::eval(double*, double*, double, int)`
276 *
277 * @param handle Handle to queried Sim1D object.
278 * @param[in] xLen Length of array reserved for x.
279 * @param[in] x State vector
280 * @param[in] rLen Length of array reserved for r.
281 * @param[out] r On return, contains the residual vector
282 * @param rdt Reciprocal of the time step. if omitted, then the internally stored value (accessible using the rdt() method) is used.
283 * @param count Set to zero to omit this call from the statistics
284 */
285 int32_t sim1D_eval(int32_t handle, int32_t xLen, double* x, int32_t rLen, double* r, double rdt, int32_t count);
286
287 /**
288 * Set the maximum number of steps that can be taken using the same Jacobian before it must be re-evaluated.
289 *
290 * Wraps C++ method: `void SteadyStateSystem::setJacAge(int, int)`
291 *
292 * @param handle Handle to queried SteadyStateSystem object.
293 * @param ss_age Age limit during steady-state mode
294 * @param ts_age Age limit during time stepping mode. If not specified, the steady-state age is also used during time stepping.
295 */
296 int32_t sim1D_setMaxJacAge(int32_t handle, int32_t ss_age, int32_t ts_age);
297
298 /**
299 * Add node for fixed temperature point of freely propagating flame.
300 *
301 * Wraps C++ method: `int Sim1D::setFixedTemperature(double)`
302 *
303 * @param handle Handle to queried Sim1D object.
304 * @param t Undocumented.
305 */
306 int32_t sim1D_setFixedTemperature(int32_t handle, double t);
307
308 /**
309 * Delete Sim1D object.
310 *
311 * Wraps C++ destructor: `undefined`
312 *
313 * @param handle Handle to Sim1D object.
314 * @returns Zero for success and -1 for exception handling.
315 */
316 int32_t sim1D_del(int32_t handle);
317
318 /**
319 * Return size of Sim1D storage.
320 *
321 * Wraps C++ reserved CLib function: `custom code`
322 *
323 * @returns Size or -1 for exception handling.
324 */
325 int32_t sim1D_cabinetSize();
326
327 /**
328 * @}
329 */
330
331#ifdef __cplusplus
332}
333#endif
334
335#endif // CTONEDIM_H
int32_t sim1D_setTimeStep(int32_t handle, double stepSize, int32_t tStepsLen, const int32_t *tSteps)
Set the number of time steps to try when the steady Newton solver is unsuccessful.
Definition ctonedim.cpp:115
int32_t sim1D_restore(int32_t handle, const char *fname, const char *name)
Retrieve data from a previously saved simulation.
Definition ctonedim.cpp:194
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.
Definition ctonedim.cpp:54
int32_t sim1D_getInitialSoln(int32_t handle)
Get the initial value of the system state from each domain in the simulation.
Definition ctonedim.cpp:127
int32_t sim1D_writeStats(int32_t handle, int32_t printTime)
Write statistics about the number of iterations and Jacobians at each grid level.
Definition ctonedim.cpp:205
int32_t sim1D_del(int32_t handle)
Delete Sim1D object.
Definition ctonedim.cpp:278
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 ...
Definition ctonedim.cpp:236
int32_t sim1D_cabinetSize()
Return size of Sim1D storage.
Definition ctonedim.cpp:289
int32_t sim1D_save(int32_t handle, const char *fname, const char *name, const char *desc, int32_t overwrite)
Save current simulation data to a container file or CSV format.
Definition ctonedim.cpp:182
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.
Definition ctonedim.cpp:89
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.
Definition ctonedim.cpp:246
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.
Definition ctonedim.cpp:65
int32_t sim1D_setRefineCriteria(int32_t handle, int32_t dom, double ratio, double slope, double curve, double prune)
Set grid refinement criteria.
Definition ctonedim.cpp:160
int32_t sim1D_show(int32_t handle)
Show logging information on current solution for all domains.
Definition ctonedim.cpp:104
int32_t sim1D_setGridMin(int32_t handle, int32_t dom, double gridmin)
Set the minimum grid spacing in the specified domain(s).
Definition ctonedim.cpp:171
int32_t sim1D_refine(int32_t handle, int32_t loglevel)
Refine the grid in all domains.
Definition ctonedim.cpp:150
int32_t sim1D_setFixedTemperature(int32_t handle, double t)
Add node for fixed temperature point of freely propagating flame.
Definition ctonedim.cpp:268
int32_t sim1D_newSim1D(int32_t domainsLen, int32_t *domains)
Create a Sim1D object with a list of domains.
Definition ctonedim.cpp:40
double sim1D_value(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint)
Get one entry in the solution vector.
Definition ctonedim.cpp:226
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.
Definition ctonedim.cpp:78
int32_t sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid)
Performs the hybrid Newton steady/time-stepping solution.
Definition ctonedim.cpp:138
int32_t sim1D_domainIndex(int32_t handle, const char *name)
Get the index of the domain named name.
Definition ctonedim.cpp:216
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...
Definition ctonedim.cpp:257