Cantera  3.3.0a1
Loading...
Searching...
No Matches
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 * Show logging information on current solution for all domains.
64 *
65 * Wraps C++ method: `void Sim1D::show()`
66 *
67 * @param handle Handle to queried Sim1D object.
68 */
69 int32_t sim1D_show(int32_t handle);
70
71 /**
72 * Set the number of time steps to try when the steady Newton solver is unsuccessful.
73 *
74 * Wraps C++ method: `void SteadyStateSystem::setTimeStep(double, const vector<int>&)`
75 *
76 * @param handle Handle to queried SteadyStateSystem object.
77 * @param stepSize Initial time step size [s]
78 * @param[in] tStepsLen Length of vector reserved for tSteps.
79 * @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.
80 */
81 int32_t sim1D_setTimeStep(int32_t handle, double stepSize, int32_t tStepsLen, const int32_t* tSteps);
82
83 /**
84 * Get the initial value of the system state from each domain in the simulation.
85 *
86 * Wraps C++ method: `void Sim1D::getInitialSoln()`
87 *
88 * @param handle Handle to queried Sim1D object.
89 */
90 int32_t sim1D_getInitialSoln(int32_t handle);
91
92 /**
93 * Performs the hybrid Newton steady/time-stepping solution.
94 *
95 * Wraps C++ method: `void Sim1D::solve(int, bool)`
96 *
97 * @param handle Handle to queried Sim1D object.
98 * @param loglevel Controls the amount of diagnostic output.
99 * @param refine_grid If `true`, the grid will be refined
100 */
101 int32_t sim1D_solve(int32_t handle, int32_t loglevel, int32_t refine_grid);
102
103 /**
104 * Refine the grid in all domains.
105 *
106 * Wraps C++ method: `int Sim1D::refine(int)`
107 *
108 * @param handle Handle to queried Sim1D object.
109 * @param loglevel Undocumented.
110 */
111 int32_t sim1D_refine(int32_t handle, int32_t loglevel);
112
113 /**
114 * Set grid refinement criteria.
115 *
116 * Wraps C++ method: `void Sim1D::setRefineCriteria(int, double, double, double, double)`
117 *
118 * @param handle Handle to queried Sim1D object.
119 * @param dom Undocumented.
120 * @param ratio Undocumented.
121 * @param slope Undocumented.
122 * @param curve Undocumented.
123 * @param prune Undocumented.
124 */
125 int32_t sim1D_setRefineCriteria(int32_t handle, int32_t dom, double ratio, double slope, double curve, double prune);
126
127 /**
128 * Set the minimum grid spacing in the specified domain(s).
129 *
130 * Wraps C++ method: `void Sim1D::setGridMin(int, double)`
131 *
132 * @param handle Handle to queried Sim1D object.
133 * @param dom Domain index. If dom == -1, the specified spacing is applied to all domains.
134 * @param gridmin The minimum allowable grid spacing [m]
135 */
136 int32_t sim1D_setGridMin(int32_t handle, int32_t dom, double gridmin);
137
138 /**
139 * Save current simulation data to a container file or CSV format.
140 *
141 * Wraps C++ method: `void Sim1D::save(const string&, const string&, const string&, bool)`
142 *
143 * @param handle Handle to queried Sim1D object.
144 * @param fname Name of output file (CSV, YAML or HDF)
145 * @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)
146 * @param desc Custom comment describing the dataset to be stored (YAML/HDF only)
147 * @param overwrite Force overwrite if file/name exists; optional (default=false)
148 */
149 int32_t sim1D_save(int32_t handle, const char* fname, const char* name, const char* desc, int32_t overwrite);
150
151 /**
152 * Retrieve data from a previously saved simulation.
153 *
154 * Wraps C++ method: `void Sim1D::_restore(const string&, const string&)`
155 *
156 * @param handle Handle to queried Sim1D object.
157 * @param fname Name of container file (YAML or HDF)
158 * @param name Identifier of location within the container file; this node/group contains header information and subgroups with domain-specific SolutionArray data
159 */
160 int32_t sim1D_restore(int32_t handle, const char* fname, const char* name);
161
162 /**
163 * Write statistics about the number of iterations and Jacobians at each grid level.
164 *
165 * Wraps C++ setter: `void OneDim::writeStats(int)`
166 *
167 * @param handle Handle to queried OneDim object.
168 * @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
169 */
170 int32_t sim1D_writeStats(int32_t handle, int32_t printTime);
171
172 /**
173 * Get the index of the domain named `name`.
174 *
175 * Wraps C++ method: `size_t OneDim::domainIndex(const string&)`
176 *
177 * @param handle Handle to queried OneDim object.
178 * @param name Undocumented.
179 */
180 int32_t sim1D_domainIndex(int32_t handle, const char* name);
181
182 /**
183 * Evaluate the residual function.
184 *
185 * Wraps C++ method: `void Sim1D::eval(double*, double*, double, int)`
186 *
187 * @param handle Handle to queried Sim1D object.
188 * @param[in] xLen Length of array reserved for x.
189 * @param[in] x State vector
190 * @param[in] rLen Length of array reserved for r.
191 * @param[out] r On return, contains the residual vector
192 * @param rdt Reciprocal of the time step. if omitted, then the internally stored value (accessible using the rdt() method) is used.
193 * @param count Set to zero to omit this call from the statistics
194 */
195 int32_t sim1D_eval(int32_t handle, int32_t xLen, double* x, int32_t rLen, double* r, double rdt, int32_t count);
196
197 /**
198 * Set the maximum number of steps that can be taken using the same Jacobian before it must be re-evaluated.
199 *
200 * Wraps C++ method: `void SteadyStateSystem::setJacAge(int, int)`
201 *
202 * @param handle Handle to queried SteadyStateSystem object.
203 * @param ss_age Age limit during steady-state mode
204 * @param ts_age Age limit during time stepping mode. If not specified, the steady-state age is also used during time stepping.
205 */
206 int32_t sim1D_setMaxJacAge(int32_t handle, int32_t ss_age, int32_t ts_age);
207
208 /**
209 * Add node for fixed temperature point of freely propagating flame.
210 *
211 * Wraps C++ method: `int Sim1D::setFixedTemperature(double)`
212 *
213 * @param handle Handle to queried Sim1D object.
214 * @param t Undocumented.
215 */
216 int32_t sim1D_setFixedTemperature(int32_t handle, double t);
217
218 /**
219 * Delete Sim1D object.
220 *
221 * Wraps C++ destructor: `undefined`
222 *
223 * @param handle Handle to Sim1D object.
224 * @returns Zero for success and -1 for exception handling.
225 */
226 int32_t sim1D_del(int32_t handle);
227
228 /**
229 * Return size of Sim1D storage.
230 *
231 * Wraps C++ reserved CLib function: `custom code`
232 *
233 * @returns Size or -1 for exception handling.
234 */
235 int32_t sim1D_cabinetSize();
236
237 /**
238 * @}
239 */
240
241#ifdef __cplusplus
242}
243#endif
244
245#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:65
int32_t sim1D_restore(int32_t handle, const char *fname, const char *name)
Retrieve data from a previously saved simulation.
Definition ctonedim.cpp:144
int32_t sim1D_getInitialSoln(int32_t handle)
Get the initial value of the system state from each domain in the simulation.
Definition ctonedim.cpp:77
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:155
int32_t sim1D_del(int32_t handle)
Delete Sim1D object.
Definition ctonedim.cpp:208
int32_t sim1D_cabinetSize()
Return size of Sim1D storage.
Definition ctonedim.cpp:219
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:132
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:176
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:110
int32_t sim1D_show(int32_t handle)
Show logging information on current solution for all domains.
Definition ctonedim.cpp:54
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:121
int32_t sim1D_refine(int32_t handle, int32_t loglevel)
Refine the grid in all domains.
Definition ctonedim.cpp:100
int32_t sim1D_setFixedTemperature(int32_t handle, double t)
Add node for fixed temperature point of freely propagating flame.
Definition ctonedim.cpp:198
int32_t sim1D_newSim1D(int32_t domainsLen, int32_t *domains)
Create a Sim1D object with a list of domains.
Definition ctonedim.cpp:40
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:88
int32_t sim1D_domainIndex(int32_t handle, const char *name)
Get the index of the domain named name.
Definition ctonedim.cpp:166
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:187