Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Name, title of the presentation Canonical Thermodynamics & Modelling Tore Haug-Warberg Bjørn Tore Løvfall Olaf Trygve Berglihn Cybernetica 21 June 2006.

Similar presentations


Presentation on theme: "1 Name, title of the presentation Canonical Thermodynamics & Modelling Tore Haug-Warberg Bjørn Tore Løvfall Olaf Trygve Berglihn Cybernetica 21 June 2006."— Presentation transcript:

1 1 Name, title of the presentation Canonical Thermodynamics & Modelling Tore Haug-Warberg Bjørn Tore Løvfall Olaf Trygve Berglihn Cybernetica 21 June 2006

2 2 Programme 1.Executive summary (THW) 2.Symbolic differentiation (BTL) 3.Thermodynamic algebra (THW) 4.Dynamic simulation (OTB) Name, title of the presentation

3 3 What is thermodynamic modelling? Thermodynamic modelling is about physical state models. In the current context only simple systems shall be considered. Thus, the models assume uniform states (no gradients), and they are insensitive to geometry, to external fields, and to the previous history. In practice f (x) can be G(T, p, n), A(T, V, n) or (T, V, µ ). Name, title of the presentation

4 4 When is it important? Thermodynamic modelling is important when there is a significant coupling between two or more of the system variables. This includes unit operations such as: Valves, compressors, expanders, reactors and separation units. Specialized units like hydraulic networks or heat exchanger networks are on the side-line of what we shall talk about. Name, title of the presentation

5 5 Why bother? If done awkwardly, thermodynamic calculations require a lot of man-power and occupy excess CPU-time. One of the most difficult questions to ask is about standard states. As soon as two or more engineers are playing around with different simulators the result is quite often a big mess. Controlling the thermodynamic calculations means better modularity, increased re-usability and reduced maintenance costs. Name, title of the presentation

6 6 Where does it fit in? Good question, and this is why we are here to listen to your problems. For many people in industry it is tempting to claim that ”the proof of the pudding lies in its eating”. However, we are talking about new technology and new thinking patterns here, and the biggest obstacle is maybe that people will not even taste the pudding because they do not recognize it as proper food. Name, title of the presentation

7 7 Thermodynamic formalism Name, title of the presentation

8 8 Newton-Raphson Name, title of the presentation

9 9 Newton-Lagrange-Euler Name, title of the presentation

10 10 Additional constraints Name, title of the presentation

11 11 Canonical block structure (reactive flash) Name, title of the presentation

12 12 Name, title of the presentation

13 13 Conclusions Canonical representation implies a highly structured equation system. Intensive and extensive variables are solved simultanously. The updated state is solved for explicitly. Equilibrium and balance equations are solved only once (linear functional) while iterating the transport equations many times. Name, title of the presentation

14 14 Symbolic differentiation Traditional coding requires that all functions derivatives are implemented by hand. By collecting the function in a computer graph symbolic operations are possible. The derivatives can then be calculated by automatic procedures and exported to e.g. C. Higher order (>2) derivatives are feasible. Name, title of the presentation

15 15 Declarations d1= Dim.new t= Variable.new(’T’) dg= Parameter.new(’deltag’, d1, d1) nrtl = Model.new(’nrtl’, t, n, r, dg, al) Name, title of the presentation

16 16 Modelling sumn = nrtl.expr(’sumn’, n).sum x = nrtl.expr(’x’, n,sumn[nil]){|q,w| q/w} etc. (5 more lines) dgex = nrtl.expr(’DeltaGex’,r[nil,nil],t[nil,nil], x[nil,d1],x[d1,nil], tmp3){|q,w,e,y,u| e*y*u*q*w}.sum Name, title of the presentation

17 17 Ruby vs Matlab tmp1 = nrtl.expr(’tmp1’,x[nil,d1], expG,x[d1,nil]){|q,w,e| q + w*e} The same code written in MATLAB is: tmp1 = repmat(x,1,3) + expg.*repmat(x’,3,1); Name, title of the presentation

18 18 [x11, x21][nil,d1], [[G11, G12], [G21, G22]], [x12, x22][d1,nil] [x11, x21][d1], [G11, G12], [x12][nil] [x11, x21][d1], [G21, G22], [x22][nil] [[ (x11, G11, x12), (x21, G12, x12)], [ (x11, G21, x22), (x21, G22, x22)]] Name, title of the presentation

19 19 Instantiation d1.init(3) r.init([8.314]) dg.init([[0,-105.43,285.39], [-36.852,0,-2.3302], [754.56,11.362,0]]) al.init([[0, 0.2, 0.2],[0.2, 0, 0.2],[0.2, 0.2, 0]]) Name, title of the presentation

20 20 API Require ´rbct´ c,d = SRKmodule::init([0,0,1]) SRKmodule::set(d,SRKmodule::N,[4.3]) SRKmodule::set(d,SRKmodule::T,[298.15]) SRKmodule::set(d,SRKmodule::V,[5.0e-4]) SRKmodule::srk(c,d) Name, title of the presentation

21 21 Name, title of the presentation

22 22 Name, title of the presentation

23 23 Name, title of the presentation

24 24 Name, title of the presentation

25 25 Thermodynamic frameworks Thermodynamic process models consist of several sub-models (heat capacity, ideal gas, equation of state, etc.). Different frameworks are needed for metallurgy, oil & gas, polymers, etc. It would be great to represent all frameworks into one generic structure rather than programming several chains of explicit function calls. Name, title of the presentation

26 26 Text book example Name, title of the presentation

27 27 Ruby interface n = [’nitrogen’,’methane’,’ethane’, ’propane’,’n-butane’] A = Surface * Helmholtz * StandardState * [ MuTcp.extend(:poly3) * MuThs.fun(:h0) + MuThs.extend(:s0).mix(n)] + EquationOfState * [ ModTVNideal.extend(:idealgas).mix(n) ] + EquationOfState * [ ModTVN.extend(:srk).mix(n) ] Name, title of the presentation

28 28 Conclusions Thermodynamic frameworks can be captured in computer graphs using simple algebra. The graph acts as a wrapper and exports the entire model framework into C. Symbolic differentiation (gradients) is available to arbitrary order. Automatic documentation eliminates a common source of error. Name, title of the presentation

29 29 Dynamic simulation using YASIM One-step solver with steplength control. Newton-Lagrange-Euler formulation. Thermodynamic state-estimator Modularized, flexible interface. Aggregation of simple units into complex units. Export to simplified/linearlized models in Taylor- expansion manifold for process control analysis. Plug-flow and transport delay Name, title of the presentation

30 30 Canonical representation A full thermodynamic problem is always stated. Solve for both intensive and extensive variables. Additional constraints are implemented as lambda functions: Analytical inverse is possible for the thermo- dynamic coefficient matrix (at fixed topology). Name, title of the presentation

31 31 Dynamic 2-phase flash Name, title of the presentation

32 32 Name, title of the presentation

33 33 Simulation factory Node factory. Thermo surface import. Thermo model propagator (graph coloring algorithm). Species propagator (graph coloring algorithm). Node aggregator. Injects flowsheet constitutive equations (flow relations) and handles DOF- assignment. Name, title of the presentation

34 34 Name, title of the presentation

35 35 Executive conclusions Name, title of the presentation YASIM ≠ ASPEN (simulation vs design) DASIM = YASIM + PFR + CSTR

36 36 High priority development Name, title of the presentation Transport delay (PFR) Dynamic reactive flash (multiphase reactor) Stirred tank (CSTR) Electrolyte handling ATLAS-binding in Ruby Simulation API Automatic documentation


Download ppt "1 Name, title of the presentation Canonical Thermodynamics & Modelling Tore Haug-Warberg Bjørn Tore Løvfall Olaf Trygve Berglihn Cybernetica 21 June 2006."

Similar presentations


Ads by Google