Structurally Consistent Dynamic Process Models

Structurally Consistent Dynamic Process Models
© 28 July 2013 by Mathieu Westerweele

blog 08 - Roadmap

In this month’s blog I will attempt to present a “roadmap” for constructing structurally consistent and solvable dynamic process models. I tried to keep it short and simple, but I soon realised that this was nearly impossible, since leaving out certain details would make it difficult for a reader to grasp the complete picture.

 

So, this blog is a bit longer than usual. But if you take the time to consume it, you will certainly get more insight in how to properly set up a correct, structurally solvable dynamic process model (using any equation based solver).

A more thorough discussion on this subject is given in the document “Concepts and Modelling Methodology”. Just click on the link to download a copy.

 

Balance Equations

In order to characterize the behaviour of a process, information is needed about the natural state of this process (at a given time) and about the change of this state with time. The natural state of a process can be described by the values of a set of fundamental extensive quantities, while the change of state is given by the balance equations of those fundamental variables.

 

The fundamental extensive variables represent the ”extent” of the process c.q. the quantities being conserved in the process. In other words: they represent quantities for which the conservation principle and consequently also the superposition principle applies. So, for these variables, the balance equations are valid. In most chemical processes, the fundamental variables are: component mass, total energy and (sometimes) momentum.

 

The dynamic behaviour of a system can be modelled by applying the conservation principles to the fundamental extensive quantities of the system. The principle of conservation of any extensive quantity (x) of a system states that what gets transferred into the system must either leave again or is transformed into another extensive quantity or must accumulate in the system (In other words: no extensive quantity is lost).

 

In my PhD thesis I showed that the dynamic part (i.e. the differential equations) of physical-chemical-biological processes can be represented in a concise, abstract canonical form, which can be isolated from the static part (i.e. the algebraic equations). This canonical form, which is the smallest representation possible, incorporates very visibly the structure of the process model as it was defined by the person who modelled the process: The system decomposition (physical topology) and the species distribution (species topology) are very visible in the model definition. The transport (z) and production (r) rates always appear linearly in the balance equations, when presented in this form:

         

          dx/dt = A z + B r

         

in which

     x :: Fundamental state vector (Primary State vector)

     z :: Flow of extensive quantities (Transport rates)

     r :: Kinetics of extensive quantity conversion (Reaction rates)

     A:: Interconnection matrix

     B:: Stoichiometric coefficient matrix

 

The classification of variables that is presented here is, in the first place, based on the structural elements of the modelling approach (namely systems and connections).

 

The matrices A and B are completely defined by the model designer’s definition of the physical and species topology of the process under investigation. Therefore these matrices are trivial to setup (and are actually automatically constructed by Mobatec Modeller). The only things a model designer has to do to complete the model are:

  • Provide a link between the transport and reaction rate vectors and the primary state vector. Each element in the transport and reaction rate vectors has to be (directly or indirectly) linked to the primary state vector. This “linking” is done with one or more algebraic equations. If certain elements of the rate vectors are not defined in the algebraic equations, the mathematical system will have too many unknowns and can consequently not be solved.
  • Give a mapping which maps the primary state of each system in a secondary state. This mapping is necessary because usually transport and reaction rates are defined as functions of secondary state variables (a heat flow can, for example, be expressed as a function of temperature difference).

 

Algebraic Equations

So, in addition to the balance equations, we need other relationships to express thermodynamic equilibria, reaction rates, transport rates for heat, mass, momentum, and so on. Such additional relationships are needed to complete the mathematical modelling of the process. A model designer should be allowed to choose a particular relationship from a set of alternatives and to connect the selected relationship to a balance equation or to another defined relationship. The algebraic equations are divided into three main classes, namely system equations, connection equations and reaction equations.

 

System Equations

For each system that is defined within the physical topology of a process, a mapping is needed which maps the primary state variables (x) into a set of “secondary state” variables (y = f(x)). The primary states of a system are fundamental quantities for describing the behaviour of the system. The fundamental state is defined intrinsically through the fundamental behaviour equations. The application of fundamental equations of component mass and energy balances intrinsically defines component mass and energy as the fundamental state variables. Alternative state variables are required for the determination of the transfer rate of extensive quantities and their production/consumption rate.

 

The equations that define secondary state variables do not have to be written in explicit form, by the way, but it has to be possible to solve the equations (either algebraically or numerically) such that the primary state can be mapped into the secondary state. This means that each defined equation has to define a new variable. Equations that link previously defined variables together are not allowed, since the number of equation would then exceed the number of variables and the set of equations of this system would thus be over-determined.

 

Connection Equations

The flow rates (z), which emerge in the balance equations of a system, represent the transfer of extensive quantities to and from adjacent systems. These flow rates can be specified or linked to transfer laws, which are usually empirical or semi-empirical relationships. These relationships are usually functions of the states, and the physical and geometrical properties of the two connected systems. For example, the rate of conductive heat transfer Q through a surface A between two objects with different temperatures can be given by:

 

          Q = U * A * (Tor – Ttar)

 

This relationship depends on the temperatures Tor and Ttar of the origin and target object respectively. Temperature is of course a (secondary) state variable. The rate of heat transfer also depends on the overall heat transfer coefficient U, which is a physical property of the common boundary segment between the two systems, and on the total area of heat transfer A, which is a geometrical property.

 

A transfer law thus describes the transfer of an extensive quantity between two adjacent systems (z = f(yor, ytar)). The transfer rate usually depends on the state of the two connected systems and the properties of the boundary in between.

 

Reaction Equations

Depending on the time scale of interest, we can divide reactions into three groups:

  • Very slow reactions (slow in the measure of the considered range of time scales). These reactions do not appreciably occur and may be simply ignored.
  • Reactions that occur in the time-scale of interest. For these reactions kinetic rate laws can be used.
  • Very fast reactions (relative to the considered time scale), for which is assumed that the equilibrium is reached instantaneously.

 

As the non-reactive parts do not further contribute to the discussion, they are left out in the sequel. The fast (equilibrium) reactions go beyond the scope of this blog and are therefore also not discussed.

For the “normal” reactions the reaction rates of the reactions in the relevant times scale must be defined by kinetic rate equations. The production terms are linked to kinetic laws, which are empirical equations. They are usually written as a function of a set of intensive quantities, such as concentrations, temperature and pressure (r = f(ysys)). For example, the reaction rate r of a first-order reaction taking place in a lump is given by:

 

          r = V * k0 * EXP(-E/(R * T)) * cA

 

where

     r :: Reaction rate of a first-order reaction

     V :: Volume of the system

     k0 :: Pre-exponential kinetic constant

     E :: Activation energy for the reaction

     R :: Ideal gas constant

     T :: Temperature of the reacting system

     cA :: Concentration of component A in the system

 

Temperature and concentration(s) of the reactive component(s) are state variables (y) of the reactive system. Reaction constants and their associated parameter such as activation energy and pre-exponential factors are physical properties. In some cases, also geometrical properties of the system are part of the definition of the kinetic law, such as the porosity or other surface characterizing quantities.

 

Conclusions

blog 07 - information flow

 

When a dynamic process model is formulated and proper initial conditions have been defined, then the information flow of a simulation can be depicted as in the above figure. Starting from the initial conditions x0, the secondary state variables y of all the systems can be calculated (via the System Equations y=f(x)). Subsequently, the flow rates z of all the defined connections and the reaction rates r of all the defined reactions can be calculated (z = f(yor, ytar); r = f(ysys)). These rates are the inputs of the balance equations, so now the integrator can compute values for the primary state variables x on the next time step. With these variables, the secondary state y can be calculated again and the loop continues until the defined end time is reached.

 

To put it in other words: A model designer should only be concerned with the algebraic equations (the right hand side of the figure), which means that the primary state variables x of each system can be considered as “known”. Systems are only interacting with each other through connections and therefore the calculation of the secondary variables of each system can be done completely independent of other systems.

 

The system equations map the primary state x into a secondary state y for each individual system, and each defined equation has to define a (secondary) variable. In some cases two or more equations may introduce two or more new variables, such that these equations have to be solved simultaneously in order to get a value for the variables.

 

For connection and reaction equations a similar conclusion can be drawn. For these equations the secondary variables of the systems (y) can be considered as “known”.

 

Looking at modelling like this, makes it a lot easier than trying to understand/debug the complete model of a process. Just divide your model into systems and connections, assign equations to those objects (typically not more than 10) and solve any problem that arises per object. Resolving a problem (or even several) of about 10 equations is a lot easier than when hundreds or more are considered at the same time!

 

Do you have experience with making (large) dynamic process models?

 

I invite to post your experiences, insights and/or suggestions in the comment box below, such that we can all learn something from it.

 

To your success!

Mathieu.

 

 

 

———————————————–

Blog Posts
Subscribe to our mailing list

* indicates required

3 thoughts on “Structurally Consistent Dynamic Process Models

  1. A very interesting article and methodology.

    Choosing an initial condition for a dynamic model can sometimes be an issue. In most cases when this challenge arises, the model designer may have chosen an initial condition that is “very far” from the global optimum. Hence, making it quite difficult for the numerical solvers built into the modelling software to converge.

    From my little experience in building process models, I have come to learn that a proper initial condition for a relatively complex dynamic model can be obtained by building and solving the (dynamic) model at steady state and then using the steady-state solution as initial conditions for the dynamic model.

    1. Thanks for your remarks, Victor.

      Getting correct initial conditions can indeed be quite a headache when a model grows relatively large. By adhering to the proposed methodology, however, you will notice that in most cases you only have to determine correct initial conditions for each modelling object (so for each system and each connection). Since each object only has a relatively low number of equations, this typically is not much of a problem. In this manner you can find a good starting point for your dynamic simulation with much less effort than when considering the whole model to find a good initial condition.

      Above all, our modelling tool (Mobatec Modeller) supports the selection and compilation of any sub section (i.e. small part) of your model. All objects outside of the selection will be handled as “Battery Limits” and will not be part of the dynamic model. So, you can first initialise, test and tune small selections. The results can be imported back into the complete model. Then you can gradually make your selection bigger. This feature is very handy when building a very large model of an entire processing plant.

  2. Good point there, Victor. I have experience with both steady-state and dynamic models convergence problems, and I have used intensively many different widespread software. They all have one same characteristics when it comes to dynamic models (even complex steady state models) convergence. If the model is just a bit more complex and I am talking about one unit models, not the whole process model, it would normally be (very) hard for model to converge, if you choose a specific initial conditions. There are multiple strategies of how you can try to handle this problems, but they all comedown on obtaining a good starting point. So, one of possible strategies (medicines) to help the solver to get to a good starting point is to get the model convergence of it steady-state and then use that variable values as a starting point for a dynamic model run. However, this approach will give (if it gives) very narrow “solution window” as you will not be able to start the dynamic run successfully from the “point” that you are most interested in, so your conclusions will come out of the second best thing – observing a simulation run results starting from a steady-state point always.

    Mobatec Modeller, as Mathieu already explained it very well, has much less number of equations per system, due its equation topology methodology, and it assists the user to get a consistent set of initial conditions per each model object, for any initial conditions that user what to set every time. So you are able to start the dynamic run from any “point-state” of your model and observe the results. This way the solution window is always exactly where you want it to be! And when it comes to a whole process models, as Mathieu also explained, a partial model compilation and run (any part of the model can run separately) eliminates a model convergence problems very fast and brings the user a valuable insights. This is only a characteristic of Mobatec Modeller and that is why the dynamic modelling is made easy with it!

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 6 = 13

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>