*** empty log message ***
This commit is contained in:
parent
a5ade5036f
commit
77a3fdbd56
6 changed files with 3961 additions and 4523 deletions
|
|
@ -60,86 +60,86 @@ endif
|
|||
rm -f setup.m
|
||||
|
||||
install:
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera-demos
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@ThermoPhase/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Mixture/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Kinetics/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Transport/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Interface/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Solution
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@XML_Node/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Reactor/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@ReactorNet/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Wall/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@FlowDevice/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Func/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Domain1D/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Stack/private
|
||||
cd cantera; @INSTALL@ *.m *.@mex_ext@ @prefix@/matlab/toolbox/cantera/cantera
|
||||
cd cantera/private; @INSTALL@ *.m \
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera-demos
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@ThermoPhase/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Mixture/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Kinetics/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Transport/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Interface/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Solution
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@XML_Node/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Reactor/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@ReactorNet/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Wall/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@FlowDevice/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/@Func/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/1D
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Domain1D/private
|
||||
@INSTALL_abs@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Stack/private
|
||||
cd cantera; @INSTALL_abs@ *.m *.@mex_ext@ @prefix@/matlab/toolbox/cantera/cantera
|
||||
cd cantera/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/private
|
||||
cd cantera/examples; @INSTALL@ *.m @prefix@/matlab/toolbox/cantera/cantera-demos
|
||||
cd cantera/@ThermoPhase; @INSTALL@ \
|
||||
cd cantera/examples; @INSTALL_abs@ *.m @prefix@/matlab/toolbox/cantera/cantera-demos
|
||||
cd cantera/@ThermoPhase; @INSTALL_abs@ \
|
||||
*.m @prefix@/matlab/toolbox/cantera/cantera/@ThermoPhase
|
||||
cd cantera/@ThermoPhase/private; @INSTALL@ *.m \
|
||||
cd cantera/@ThermoPhase/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@ThermoPhase/private
|
||||
cd cantera/@Kinetics; @INSTALL@ *.m \
|
||||
cd cantera/@Kinetics; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Kinetics
|
||||
cd cantera/@Kinetics/private; @INSTALL@ *.m \
|
||||
cd cantera/@Kinetics/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Kinetics/private
|
||||
cd cantera/@Solution; @INSTALL@ *.m \
|
||||
cd cantera/@Solution; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Solution
|
||||
cd cantera/@Transport; @INSTALL@ *.m \
|
||||
cd cantera/@Transport; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Transport
|
||||
cd cantera/@Transport/private; @INSTALL@ *.m \
|
||||
cd cantera/@Transport/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Transport/private
|
||||
cd cantera/@Interface; @INSTALL@ \
|
||||
cd cantera/@Interface; @INSTALL_abs@ \
|
||||
*.m @prefix@/matlab/toolbox/cantera/cantera/@Interface
|
||||
cd cantera/@Interface/private; @INSTALL@ *.m \
|
||||
cd cantera/@Interface/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Interface/private
|
||||
cd cantera/@Mixture; @INSTALL@ \
|
||||
cd cantera/@Mixture; @INSTALL_abs@ \
|
||||
*.m @prefix@/matlab/toolbox/cantera/cantera/@Mixture
|
||||
cd cantera/@Mixture/private; @INSTALL@ *.m \
|
||||
cd cantera/@Mixture/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Mixture/private
|
||||
cd cantera/@XML_Node; @INSTALL@ *.m \
|
||||
cd cantera/@XML_Node; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@XML_Node
|
||||
cd cantera/@Reactor; @INSTALL@ *.m \
|
||||
cd cantera/@Reactor; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Reactor
|
||||
cd cantera/@Reactor/private; @INSTALL@ *.m \
|
||||
cd cantera/@Reactor/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Reactor/private
|
||||
cd cantera/@ReactorNet; @INSTALL@ *.m \
|
||||
cd cantera/@ReactorNet; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@ReactorNet
|
||||
cd cantera/@ReactorNet/private; @INSTALL@ *.m \
|
||||
cd cantera/@ReactorNet/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@ReactorNet/private
|
||||
cd cantera/@Wall; @INSTALL@ *.m \
|
||||
cd cantera/@Wall; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Wall
|
||||
cd cantera/@Wall/private; @INSTALL@ *.m \
|
||||
cd cantera/@Wall/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Wall/private
|
||||
cd cantera/@FlowDevice; @INSTALL@ *.m \
|
||||
cd cantera/@FlowDevice; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@FlowDevice
|
||||
cd cantera/@FlowDevice/private; @INSTALL@ *.m \
|
||||
cd cantera/@FlowDevice/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@FlowDevice/private
|
||||
cd cantera/@Func; @INSTALL@ *.m \
|
||||
cd cantera/@Func; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Func
|
||||
cd cantera/@Func/private; @INSTALL@ *.m \
|
||||
cd cantera/@Func/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Func/private
|
||||
cd cantera/1D; @INSTALL@ *.m \
|
||||
cd cantera/1D; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D
|
||||
cd cantera/1D/@Domain1D; @INSTALL@ *.m \
|
||||
cd cantera/1D/@Domain1D; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D/@Domain1D
|
||||
cd cantera/1D/@Domain1D/private; @INSTALL@ *.m \
|
||||
cd cantera/1D/@Domain1D/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D/@Domain1D/private
|
||||
cd cantera/1D/@Stack; @INSTALL@ *.m \
|
||||
cd cantera/1D/@Stack; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D/@Stack
|
||||
cd cantera/1D/@Stack/private; @INSTALL@ *.m \
|
||||
cd cantera/1D/@Stack/private; @INSTALL_abs@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D/@Stack/private
|
||||
@INSTALL@ -d @ct_demodir@/matlab
|
||||
@INSTALL@ cantera/examples/*.m @ct_demodir@/matlab
|
||||
@INSTALL@ -d @ct_tutdir@/matlab
|
||||
@INSTALL@ cantera/tutorial/*.m @ct_tutdir@/matlab
|
||||
@INSTALL_abs@ -d @ct_demodir@/matlab
|
||||
@INSTALL_abs@ cantera/examples/*.m @ct_demodir@/matlab
|
||||
@INSTALL_abs@ -d @ct_tutdir@/matlab
|
||||
@INSTALL_abs@ cantera/tutorial/*.m @ct_tutdir@/matlab
|
||||
chown -R @username@ @ct_demodir@/matlab
|
||||
chown -R @username@ @ct_tutdir@/matlab
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace Cantera {
|
|||
* Evaluate the Jacobian at x0. The array of residual values at x0
|
||||
* is supplied as an input.
|
||||
*/
|
||||
void MultiJac::eval(doublereal* x0, doublereal* resid0, doublereal rdt)
|
||||
void MultiJac::eval(doublereal* x0, doublereal* resid0, doublereal rdt)
|
||||
{
|
||||
m_nevals++;
|
||||
clock_t t0 = clock();
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@ namespace CanteraZeroD {
|
|||
FlowDevice& inlet(int n = 0);
|
||||
FlowDevice& outlet(int n = 0);
|
||||
|
||||
int nInlets() { return m_inlet.size(); }
|
||||
int nOutlets() { return m_outlet.size(); }
|
||||
int nWalls() { return m_wall.size(); }
|
||||
|
||||
void addWall(Wall& w, int lr);
|
||||
Wall& wall(int n);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "ReactorNet.h"
|
||||
#include "Integrator.h"
|
||||
#include "FlowDevice.h"
|
||||
#include "Wall.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -48,6 +50,7 @@ namespace CanteraZeroD {
|
|||
m_ntotpar += r->nSensParams();
|
||||
m_nv += nv;
|
||||
m_nreactors++;
|
||||
|
||||
if (m_verbose) {
|
||||
sprintf(buf,"Reactor %d: %d variables.\n",n,nv);
|
||||
writelog(buf);
|
||||
|
|
@ -62,6 +65,35 @@ namespace CanteraZeroD {
|
|||
}
|
||||
}
|
||||
|
||||
m_connect.resize(m_nr*m_nr,0);
|
||||
m_ydot.resize(m_nv,0.0);
|
||||
int i, j, nin, nout, nw;
|
||||
ReactorBase *r, *rj;
|
||||
for (i = 0; i < m_nr; i++) {
|
||||
r = m_reactors[i];
|
||||
for (j = 0; j < m_nr; j++) {
|
||||
if (i == j) connect(i,j);
|
||||
else {
|
||||
rj = m_reactors[j];
|
||||
nin = rj->nInlets();
|
||||
for (n = 0; n < nin; n++) {
|
||||
if (&rj->inlet(n).out() == r) connect(i,j);
|
||||
}
|
||||
nout = rj->nOutlets();
|
||||
for (n = 0; n < nout; n++) {
|
||||
if (&rj->outlet(n).in() == r) connect(i,j);
|
||||
}
|
||||
nw = rj->nWalls();
|
||||
for (n = 0; n < nw; n++) {
|
||||
if (&rj->wall(n).left() == rj
|
||||
&& &rj->wall(n).right() == r) connect(i,j);
|
||||
else if (&rj->wall(n).left() == r
|
||||
&& &rj->wall(n).right() == rj) connect(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_atol.resize(neq());
|
||||
fill(m_atol.begin(), m_atol.end(), m_atols);
|
||||
m_integ->setTolerances(m_rtol, neq(), DATA_PTR(m_atol));
|
||||
|
|
@ -114,6 +146,7 @@ namespace CanteraZeroD {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
void ReactorNet::eval(doublereal t, doublereal* y,
|
||||
doublereal* ydot, doublereal* p) {
|
||||
|
|
@ -137,6 +170,43 @@ namespace CanteraZeroD {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReactorNet::evalJacobian(doublereal t, doublereal* y,
|
||||
doublereal* ydot, doublereal* p, Array2D* j) {
|
||||
int n, m;
|
||||
doublereal ysave, dy;
|
||||
Array2D& jac = *j;
|
||||
|
||||
// use a try... catch block, since exceptions are not passed
|
||||
// through CVODE, since it is C code
|
||||
try {
|
||||
//evaluate the unperturbed ydot
|
||||
eval(t, y, ydot, p);
|
||||
for (n = 0; n < m_nv; n++) {
|
||||
|
||||
// perturb x(n)
|
||||
ysave = y[n];
|
||||
dy = m_atol[n] + fabs(ysave)*m_rtol;
|
||||
y[n] = ysave + dy;
|
||||
dy = y[n] - ysave;
|
||||
|
||||
// calculate perturbed residual
|
||||
eval(t, y, DATA_PTR(m_ydot), p);
|
||||
|
||||
// compute nth column of Jacobian
|
||||
for (m = 0; m < m_nv; m++) {
|
||||
jac(m,n) = (m_ydot[m] - ydot[m])/dy;
|
||||
}
|
||||
y[n] = ysave;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
showErrors();
|
||||
error("Terminating execution.");
|
||||
}
|
||||
}
|
||||
|
||||
void ReactorNet::updateState(doublereal* y) {
|
||||
int n;
|
||||
int start = 0;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Reactor.h"
|
||||
#include "FuncEval.h"
|
||||
#include "Integrator.h"
|
||||
#include "Array.h"
|
||||
|
||||
namespace CanteraZeroD {
|
||||
|
||||
|
|
@ -124,6 +125,9 @@ namespace CanteraZeroD {
|
|||
return sensitivity(k, p);
|
||||
}
|
||||
|
||||
void evalJacobian(doublereal t, doublereal* y,
|
||||
doublereal* ydot, doublereal* p, Array2D* j);
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
// overloaded methods of class FuncEval
|
||||
|
|
@ -136,6 +140,15 @@ namespace CanteraZeroD {
|
|||
|
||||
int globalComponentIndex(std::string species, int reactor=0);
|
||||
|
||||
void connect(int i, int j) {
|
||||
m_connect[j*m_nr + i] = 1;
|
||||
m_connect[i*m_nr + j] = 1;
|
||||
}
|
||||
|
||||
bool connected(int i, int j) {
|
||||
return (m_connect[m_nr*i + j] == 1);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<ReactorBase*> m_r;
|
||||
|
|
@ -154,6 +167,8 @@ namespace CanteraZeroD {
|
|||
bool m_verbose;
|
||||
int m_ntotpar;
|
||||
vector_int m_nparams;
|
||||
vector_int m_connect;
|
||||
vector_fp m_ydot;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue