Cantera  3.2.0a2
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#ifdef __cplusplus
28extern "C" {
29#endif
30
31 /**
32 * @defgroup CAPIctonedim ctonedim Library
33 * Generated CLib API for %Cantera's Sim1D class.
34 *
35 * @warning This library is an experimental part of the %Cantera API and
36 * may be changed or removed without notice.
37 *
38 * @ingroup CAPIindex
39 */
40
41 /**
42 * @addtogroup CAPIctonedim
43 * @{
44 */
45
46 /**
47 * Create a Sim1D object with a list of domains.
48 *
49 * Wraps C++ constructor: `shared_ptr<Sim1D> newSim1D(vector<shared_ptr<Domain1D>>&)`
50 *
51 * Uses:
52 * - `Domain1D& OneDim::domain(size_t)`
53 *
54 * @param[in] domainsLen Length of array reserved for domains.
55 * @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
56 * @returns Handle to stored Sim1D object or -1 for exception handling.
57 */
58 int32_t sim1D_newSim1D(int32_t domainsLen, int32_t* domains);
59
60 /**
61 * Set a single value in the solution vector.
62 *
63 * Wraps C++ method: `void Sim1D::setValue(size_t, size_t, size_t, double)`
64 *
65 * @param handle Handle to queried Sim1D object.
66 * @param dom domain number, beginning with 0 for the leftmost domain.
67 * @param comp component number
68 * @param localPoint grid point within the domain, beginning with 0 for the leftmost grid point in the domain.
69 * @param value the value.
70 */
71 int32_t sim1D_setValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint, double value);
72
73 /**
74 * Specify a profile for one component of one domain.
75 *
76 * Wraps C++ method: `void Sim1D::setProfile(size_t, size_t, const vector<double>&, const vector<double>&)`
77 *
78 * @param handle Handle to queried Sim1D object.
79 * @param dom domain number, beginning with 0 for the leftmost domain.
80 * @param comp component number
81 * @param[in] posLen Length of vector reserved for pos.
82 * @param pos 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.
83 * @param[in] valuesLen Length of vector reserved for values.
84 * @param values A vector of values corresponding to the relative position locations.
85 */
86 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);
87
88 /**
89 * Set component 'comp' of domain 'dom' to value 'v' at all points.
90 *
91 * Wraps C++ method: `void Sim1D::setFlatProfile(size_t, size_t, double)`
92 *
93 * @param handle Handle to queried Sim1D object.
94 * @param dom Undocumented.
95 * @param comp Undocumented.
96 * @param v Undocumented.
97 */
98 int32_t sim1D_setFlatProfile(int32_t handle, int32_t dom, int32_t comp, double v);
99
100 /**
101 * Set initial guess for one component for all domains.
102 *
103 * Wraps C++ method: `void Sim1D::setInitialGuess(const string&, vector<double>&, vector<double>&)`
104 *
105 * @param handle Handle to queried Sim1D object.
106 * @param component component name
107 * @param[in] locsLen Length of vector reserved for locs.
108 * @param 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.
109 * @param[in] valsLen Length of vector reserved for vals.
110 * @param vals A vector of values corresponding to the relative position locations.
111 */
112 int32_t sim1D_setInitialGuess(int32_t handle, const char* component, int32_t locsLen, double* locs, int32_t valsLen, double* vals);
113
114 /**
115 * Show logging information on current solution for all domains.
116 *
117 * Wraps C++ method: `void Sim1D::show()`
118 *
119 * @param handle Handle to queried Sim1D object.
120 */
121 int32_t sim1D_show(int32_t handle);
122
123 /**
124 * Set the number of time steps to try when the steady Newton solver is unsuccessful.
125 *
126 * Wraps C++ method: `void SteadyStateSystem::setTimeStep(double, size_t, const int*)`
127 *
128 * @param handle Handle to queried SteadyStateSystem object.
129 * @param stepsize Initial time step size [s]
130 * @param n Length of
131 * @param[in] tstepsLen Length of array reserved for tsteps.
132 * @param tsteps A sequence of time step counts to take after subsequent failures of the steady-state solver. The last value in
133 */
134 int32_t sim1D_setTimeStep(int32_t handle, double stepsize, int32_t n, int32_t tstepsLen, const int32_t* tsteps);
135
136 /**
137 * Get the initial value of the system state from each domain in the simulation.
138 *
139 * Wraps C++ method: `void Sim1D::getInitialSoln()`
140 *
141 * @param handle Handle to queried Sim1D object.
142 */
143 int32_t sim1D_getInitialSoln(int32_t handle);
144
145 /**
146 * Performs the hybrid Newton steady/time-stepping solution.
147 *
148 * Wraps C++ method: `void Sim1D::solve(int, bool)`
149 *
150 * @param handle Handle to queried Sim1D object.
151 * @param loglevel Controls the amount of diagnostic output.
152 * @param refine_grid If
153 */
154 int32_t sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid);
155
156 /**
157 * Refine the grid in all domains.
158 *
159 * Wraps C++ method: `int Sim1D::refine(int)`
160 *
161 * @param handle Handle to queried Sim1D object.
162 * @param loglevel Undocumented.
163 */
164 int32_t sim1D_refine(int32_t handle, int32_t loglevel);
165
166 /**
167 * Set grid refinement criteria.
168 *
169 * Wraps C++ method: `void Sim1D::setRefineCriteria(int, double, double, double, double)`
170 *
171 * @param handle Handle to queried Sim1D object.
172 * @param dom Undocumented.
173 * @param ratio Undocumented.
174 * @param slope Undocumented.
175 * @param curve Undocumented.
176 * @param prune Undocumented.
177 */
178 int32_t sim1D_setRefineCriteria(int32_t handle, int32_t dom, double ratio, double slope, double curve, double prune);
179
180 /**
181 * Set the minimum grid spacing in the specified domain(s).
182 *
183 * Wraps C++ method: `void Sim1D::setGridMin(int, double)`
184 *
185 * @param handle Handle to queried Sim1D object.
186 * @param dom Domain index. If dom == -1, the specified spacing is applied to all domains.
187 * @param gridmin The minimum allowable grid spacing [m]
188 */
189 int32_t sim1D_setGridMin(int32_t handle, int32_t dom, double gridmin);
190
191 /**
192 * Save current simulation data to a container file or CSV format.
193 *
194 * Wraps C++ method: `void Sim1D::save(const string&, const string&, const string&)`
195 *
196 * @param handle Handle to queried Sim1D object.
197 * @param fname Name of output file (CSV, YAML or HDF)
198 * @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)
199 * @param desc Custom comment describing the dataset to be stored (YAML/HDF only)
200 */
201 int32_t sim1D_save(int32_t handle, const char* fname, const char* name, const char* desc);
202
203 /**
204 * Write statistics about the number of iterations and Jacobians at each grid level.
205 *
206 * Wraps C++ setter: `void OneDim::writeStats(int)`
207 *
208 * @param handle Handle to queried OneDim object.
209 * @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
210 */
211 int32_t sim1D_writeStats(int32_t handle, int32_t printTime);
212
213 /**
214 * Get the index of the domain named
215 *
216 * Wraps C++ method: `size_t OneDim::domainIndex(const string&)`
217 *
218 * @param handle Handle to queried OneDim object.
219 * @param name Undocumented.
220 */
221 int32_t sim1D_domainIndex(int32_t handle, const char* name);
222
223 /**
224 * Get one entry in the solution vector.
225 *
226 * Wraps C++ method: `double Sim1D::value(size_t, size_t, size_t)`
227 *
228 * @param handle Handle to queried Sim1D object.
229 * @param dom domain number, beginning with 0 for the leftmost domain.
230 * @param comp component number
231 * @param localPoint grid point within the domain, beginning with 0 for the leftmost grid point in the domain.
232 */
233 double sim1D_value(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint);
234
235 /**
236 * Get an entry in the work vector, which may contain either a new system state or the current residual of the system.
237 *
238 * Wraps C++ method: `double Sim1D::workValue(size_t, size_t, size_t)`
239 *
240 * @param handle Handle to queried Sim1D object.
241 * @param dom domain index
242 * @param comp component index
243 * @param localPoint grid point within the domain
244 */
245 double sim1D_workValue(int32_t handle, int32_t dom, int32_t comp, int32_t localPoint);
246
247 /**
248 * Evaluate the residual function.
249 *
250 * Wraps C++ method: `void Sim1D::eval(double*, double*, double, int)`
251 *
252 * @param handle Handle to queried Sim1D object.
253 * @param[in] xLen Length of array reserved for x.
254 * @param[in] x State vector
255 * @param[in] rLen Length of array reserved for r.
256 * @param[out] r On return, contains the residual vector
257 * @param rdt Reciprocal of the time step. if omitted, then the internally stored value (accessible using the rdt() method) is used.
258 * @param count Set to zero to omit this call from the statistics
259 */
260 int32_t sim1D_eval(int32_t handle, int32_t xLen, double* x, int32_t rLen, double* r, double rdt, int32_t count);
261
262 /**
263 * Set the maximum number of steps that can be taken using the same Jacobian before it must be re-evaluated.
264 *
265 * Wraps C++ method: `void SteadyStateSystem::setJacAge(int, int)`
266 *
267 * @param handle Handle to queried SteadyStateSystem object.
268 * @param ss_age Age limit during steady-state mode
269 * @param ts_age Age limit during time stepping mode. If not specified, the steady-state age is also used during time stepping.
270 */
271 int32_t sim1D_setMaxJacAge(int32_t handle, int32_t ss_age, int32_t ts_age);
272
273 /**
274 * Add node for fixed temperature point of freely propagating flame.
275 *
276 * Wraps C++ method: `int Sim1D::setFixedTemperature(double)`
277 *
278 * @param handle Handle to queried Sim1D object.
279 * @param t Undocumented.
280 */
281 int32_t sim1D_setFixedTemperature(int32_t handle, double t);
282
283 /**
284 * Delete Sim1D object.
285 *
286 * Wraps C++ destructor: `undefined`
287 *
288 * @param handle Handle to Sim1D object.
289 * @returns Zero for success and -1 for exception handling.
290 */
291 int32_t sim1D_del(int32_t handle);
292
293 /**
294 * Return size of Sim1D storage.
295 *
296 * Wraps C++ reserved CLib function: `custom code`
297 *
298 * @returns Size or -1 for exception handling.
299 */
300 int32_t sim1D_cabinetSize();
301
302 /**
303 * Return handle to parent of Sim1D object.
304 *
305 * Wraps C++ reserved CLib function: `custom code`
306 *
307 * @param handle Handle to queried Sim1D object.
308 * @returns Parent handle or -1 for exception handling.
309 */
310 int32_t sim1D_parentHandle(int32_t handle);
311
312 /**
313 * @}
314 */
315
316#ifdef __cplusplus
317}
318#endif
319
320#endif // CTONEDIM_H
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:124
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:190
int32_t sim1D_del(int32_t handle)
Delete Sim1D object.
Definition ctonedim.cpp:263
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:221
int32_t sim1D_cabinetSize()
Return size of Sim1D storage.
Definition ctonedim.cpp:274
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_save(int32_t handle, const char *fname, const char *name, const char *desc)
Save current simulation data to a container file or CSV format.
Definition ctonedim.cpp:179
int32_t sim1D_parentHandle(int32_t handle)
Return handle to parent of Sim1D object.
Definition ctonedim.cpp:286
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:231
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:157
int32_t sim1D_show(int32_t handle)
Show logging information on current solution for all domains.
Definition ctonedim.cpp:102
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:168
int32_t sim1D_refine(int32_t handle, int32_t loglevel)
Refine the grid in all domains.
Definition ctonedim.cpp:147
int32_t sim1D_setFixedTemperature(int32_t handle, double t)
Add node for fixed temperature point of freely propagating flame.
Definition ctonedim.cpp:253
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:211
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:135
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.
Definition ctonedim.cpp:113
int32_t sim1D_domainIndex(int32_t handle, const char *name)
Get the index of the domain named.
Definition ctonedim.cpp:201
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:242