Using Class Matrix.Calculation
This class provides the definition of calculation matrices used by the Mixer simulator.
The user needs to make sure that at least three Matrix.Calculation objects are created for a constant matrix, an inverse matrix and a scratch matrix. The names of these matrices are then entered into the Collection.Solver object so that the calculation process can properly refer to and use these matrices. The dimensions of these matrices are determined programmatically by the Mixer simulator according to the number of reactors the user creates; therefore, the user does not have to concern about the numbers of rows, columns, and sheets of the matrices.
Elements in Matrix (dElement): stores the contents of the matrix. To take advantage of multi-dimensional array processing capability in Fortran and MATLAB, we define the matrix class to store data in column-major order. To calculate the linear offset of a cell in the matrix in C/C++, we use a macro MIX_INDEX(R, C, N) in the solver. See Notes for Simulation Developers for more details.
Resize for Initialization (SG_xInitSize): sets the numbers of rows, columns, and sheets (always 1) according to the number of reactors registered in the simulation control object. This routine relies on a feature change since SansGUI version 1.0.1 in that the SG_xInitSize routine of the reactor parts is called before the instances of this object. Therefore, the number of reactors registered in the simulation control object has to be correct before this routine is called. After this function returns, SansGUI will resize the matrix according to the number of rows, columns, and sheets specified.
Pre-Evaluation (SG_xPreEval): simply initializes the matrix to all zeros for loading the constant matrix and solution calculation.
This class also provides a service function, loadMatrixConstant, for the reactors to load the l-h-s constants in the linear equations to the constant matrix.
Mixer Example for SansGUI Version 1.0
Copyright © 2001-2003 ProtoDesign, Inc. All rights reserved.