DMSolver 5.3 (Dynamic Modular Solver) provides a programming language and algorithm for solving large (or small!) sparse systems of nonlinear simultaneous equations. As such, it provides a "solver engine" for the simulation of complex (or simple!) systems, generally of the continuous type. It operates in the Windows 32-bit environment and guides the user in preparing input, but allows for large or complex mathematical models. For simple problems a new-for-V5.3 methodology may let the user avoid programming in DMSolver's native language, Pascal, entirely, whereas for more complex problems the user has to fill in the programming framework provided.
You can now try a downloaded DMSolver package free for 60 days.
"Modular" refers to the ability of the user to predefine a "module", a block of equations and variables, and link each instance of the module into the model with a single line of code. For some applications a user may link a vector of modules into the problem with a single statement.
Steady state ("static") problems are modelled by sets of simultaneous algebraic equations, although an "equation" can optionally be a whole procedure (i.e. subroutine) with few limits to its complexity. Dynamic problem code is that which contains calls to the DMSolver integrator procedure, and so dynamic models contain ODE's.
"Add-ins" are available to extend the use of DMSolver for least-squares estimation of model parameters and constrained optimization of some objective function which the user defines. Within some limitations the user can program his/her own "add-in".
At various times trial investigations have been made for:
** "Plug flow" (or equivalently, batch) chemical reactors --- multiple components, multiple reactions, dynamics over reaction time, estimation of parameters.
** Systems of stirred-tank chemical reactors --- multiple components and reactions --- including heat transfer and product separation, steady state or dynamic with attached feedback control, estimation of parameters.
** A biologist's model for intracellular reaction and mass transport, leading to an oscillatory result resembling circadian rhythm.
** Distillation modelled as a series of many equilibrium (or non-equilibrium) stages -- (a) Steady state (the "Distillation Guide" software) or (b) non-steady state (an unpublished test program)
** Compression, expansion, and separation of light hydrocarbons.
** The steady-state process plant model for dealkylation of toluene to produce benzene, as described in a number of chemical engineering books and papers.
** Models of economic behavior where production and consumption of various commodities and growth of production capacities are assumed to depend on current and past commodity prices and states of the economy.
** The BOAT3D equations for planing boat motion --- 3-degrees-of-freedom rigid-body 2-dimensional motion with added mass analysis over 40 boat segments in series (see our technical paper on BOAT3D)
** 6-degrees-of-freedom motion of a rigid body in 3-dimensional space with driving forces expressed in body coordinates
** A model of a vibrating guitar string represented by a chain of elastic segments.
** Interacting electronic components connected in circuits.
Only some of these types of problems have actually been refined and received practical use, but we hope this gives the reader some idea of what DMSolver can do.
By "large" we mean that DMSolver can routinely handle problems with several thousand variables, and arrays within it are dimensioned to hold up to 10,000 variables.
To test modifications of the least-squares estimation add-ins, the four test cases in chemical kinetics analysis from the EUROKIN Consortium were used. These show the utility of DMSolver in chemical kinetics and reactor design modelling. Case 1 includes batch reactors and CSTR with the same reactions. Case 2 has a plug flow fixed bed reactor and uses a mass-transfer-limited, heterogeneous catalytic liquid-phase reaction model. In Case 3, 20 rate equations are being screened to see which one is most appropriate. Case 4 concerns a tubular reactor with axial heat and mass dispersion. In Case 1 the DMSolver simultaneous problem has 8 (batch) or 6 (CSTR) simultaneous variables, in Case 2 there are 10, in Case 3 there is 1k and in Case 4 there are 794.
DMSolver Steady-State Flowsheet Toolkit (FT) is a set of tools working with DMSolver (previously PMSolver) to simulate steady-state chemical engineering systems. Modules for flash, distillation, heat exchange, and other operations are provided, along with physical property routines. FT automatically generates source code for a system containing these standard modules after the user has used appropriate specification menus. The user may write special-purpose modules, such as reactor modules, for the system.
Distillation Guide (Self-Contained) and BOAT3D are programs which incorporate DMSolver technology adapted for special-case use where the user normally does not have to concern themselves with Solver details or source code.
Form of Equations:
The normal form of Solver equations is
Xi = fi(Xj1, Xj2, ....)
i.e. Variable Xi is a function of a set of other simultaneous variables (and not itself). The function fi is implemented in a procedure (i.e. subroutine) which computes Xi from Xj1, Xj2, etc. Any set of computational steps can be used as long as the result Xi is continuous and continuous in first derivatives with respect to the Xj1, Xj2, etc., so we are actually not talking about an "equation" in the narrow sense of something that can be written down in one line. In some cases it is awkward to put all equations in the above form, so a usable alternate form which involves some extra overhead is
Ci = fi(Xj1, Xj2, ....)
where Ci is a user-specified constant.
For static problems all the functions fi are defined in the problem source code, but dynamic problems can make use of several built into the system, including an integrator with respect to time. Solutions of a set of ordinary differential equations can be integrated with respect to time from an initial state by using calls to these built-in procedures and other time-related features of DMSolver.
Solver Source Code
DMSolver provides a convenient editor window for the source code. If the user starts out to define a completely new problem, a "skeleton" source code file is supplied to which the user needs to add details. Our original software for static problems only was called PMSolver --- Pascal-based Modular Solver. When PMSolver and DMSolver were designed Pascal was the best computer language to use. This is still true even though there are more options now. We feel that anyone who has worked with Basic, Fortran, or C can easily learn the subset of Pascal features used in basic DMSolver language, which is plain Pascal except for certain special keywords indicating simultaneous system structure. Pascal is "free-format" as far as the arrangement of statements goes, and there is a mix of features which variously have parallels in Basic, Fortran, and C.
Before 2005 the DMSolver user had to own a (sometimes very expensive) license to the Borland Delphi Pascal compiler, but now we can supply the user with a professional-grade compiler from the open-source Free Pascal project started by Florian Klaempfl in Europe.
Using the Solver:
When the user clicks on the appropriate buttons the source code for the problem is preprocessed and compiled, resulting in the Solver program .EXE file and what we call a "problem" (.PRB) file. A PRB file contains a list of variable names with the current value of each variable and other information. If variables are expected to have widely differing magnitudes, the user must enter scale factors for the variables and these are also contained in the PRB file. The Solver uses a Newton-type algorithm, so most nonlinear problems require some type of initial estimate of variable values. For dynamic problems initial conditions are specified at this time. There is a standard-style "Display/edit" window with numerous menu commands to select categories of variables or constant problem parameters and view and change their values.
When the Newton's algorithm is activated it attempts to reduce the equation errors (which also appear in the Display/edit window) to zero.
For dynamic problems the initial solution obtained by the first application of Newton's algorithm becomes the initial condition point for integration with respect to time. As integration proceeds, DMSolver writes solution variables as functions of time to a file (with extension TTR). These can be examined and plotted on the screen as functions of time using a utility program, TTRView. (With Windows multitasking, you can be examining a section of solution while DMSolver is continuing to add to the file.) When a dynamic solution is complete, selected portions of it can be converted to EDTECH database (DSF) format for presentation-grade plotting with EDTECH.
Topics seldom mentioned in discussions of simulation are that it is very easy to accidently devise a problem which has no solution, and that, even if the problem formulation is correct, on the way to a solution the current estimate of the solution point X may wander into forbidden territory, e.g. where the calculations include taking the logarithm of a negative number, dividing by a value too close to zero, etc.
In the ~20+ year development history of the Solvers strategies have been developed for coping with these problems. Basically, the approach is to avoid total collapse of the program by special ways of avoiding taking the log of a negative, etc., and then letting the user have the ability to fully examine the unconverged problem values in an attempt to diagnose difficulties.
DMSolver has an automatic adaptive method for coping with "stiff" dynamic problems.
Additional Solver Information:
Maximum Problem Size:
Additional Software Requirements:
System & RAM, etc.
These have been adapted to Versions 5.2+ Also, users can create their own add-ins through the add-in "User Batch Procedure" which lets you proceed through a complex sequence of steps automatically.
*** Static nonlinear least-squares add-in allows the estimation of system parameters by fitting static Solver solution output to data.
*** Dynamic nonlinear least-squares does the same for dynamic solutions.
*** The static constrained optimization add-in adjusts several problem parameters, searching for a minimum or maximum value of an objective function which you specify. The values of the adjustable (i.e. decision) parameters are constrainable between lower and upper bounds, and optionally, you may specify several other functions which are constrained to be either less than or greater than specified constants.