Dymola 求解 Media-Model 的平稳方程组 [英] Dymola solving stationary equation systems for Media-Model

查看:72
本文介绍了Dymola 求解 Media-Model 的平稳方程组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Dymola 中构建一个类似于 Helmholtz-Media 的媒体库,但用于氨 + 水的混合物.你会得到很多不能明确求解的方程.

I'm building a Media-Library in Dymola similar to Helmholtz-Media but for Ammonia+Water, a mixture. You get a lot of not explicitly solvable equations.

由于 Modelica 中媒体和流体库的结构,我需要能够从 p、h 和 x 获得我的热力学状态.状态向量由 d、T 和 x 组成.

Because of the structure of the Media and Fluid libraries in Modelica I need to be able to get my thermodynamic state from p, h and x. The state-vector consists of d, T, and x.

这是一个如何获取状态向量的简单示例:

This is a simple example how to get the state-vector:

model getState_phX
  parameter AbsolutePressure p = 500000 "pressure";
  parameter SpecificEnthalpy h = 2500000 "enthalpy";
  parameter SI.MassFraction x = 0.7 "mole fraction of amonia";
  parameter Real[2] start = getStart_Td_phx(p,h,xL);
  output ThermodynamicState state(d(start=start[2]),T(start=start[1]),X={(1 - xL),xL});
  DerivateFull f = Derivates(state);   
equation 
  p = (1 + f.delta*f.phirdelta)*R*state.T*state.d/molarMass(state);
  h = state.T*R*(1 + f.delta*f.phirdelta + f.tau*f.phirtau + f.tau0*f.phi0tau0)/molarMass(state);
end getState_phX;

请不要介意方程的各个部分.它们由依赖于状态向量的许多部分(和和对数)组成.这是由 Dymola 中的求解器以良好的起始值解决的.但我并不真正需要 Dassl 的所有时间相关"求解能力.

Please don't mind the parts of the equations. They consist of many parts (sums and log) dependent on the state-vector. This is solved by the solver in Dymola with good start values. But I don't really need all of the 'time-dependent' solving capabilities of Dassl.

是否有内置的库可以在没有求解器的情况下求解此类固定方程组?是否可以使用这些从这个模型中创建一个函数?

Are there build in libraries for solving such stationary equation systems without the solver? Is it possible to make a Function out of this Model using these?

我知道我可以手动编写一个简单的求解器,但对于媒体模型 (VLE) 的其他部分,我也需要高度可靠的平稳求解器(但有 4 个非线性独立方程)

I know I could write a simple solver by hand but for other parts of the Media-Model (VLE) I need highly reliable stationary solver too (but with 4 nonlinear independent equations)

如果我没有解释清楚,请告诉我.谢谢你的帮助.

Please tell me if I didn't explain myself clearly. Thank you for the help.

推荐答案

流体属性库的基础是前向部分,即实际的亥姆霍兹能量状态方程 (EoS).它以 d,T,X 作为输入.这部分或多或少可以直接实施.
如果你想用 p,h,X 指定热力学状态,或者如果你想找到多相之间的平衡,你通常会建立一个残差函数系统,并试图找到你的方程组使用一些迭代程序.Span (2000) 写道

The basis of your fluid properties library is a forward part, that is the actual Helmholtz energy equation of state (EoS). It takes d,T,X as input. That part is more or less straigthforward to implement.
If you want to specify the thermodynamic state using p,h,X or if you want to find the equilibrium between multiple phases, you will usually set up a system of resdiual functions and try to find the root of your system of equations using some iterative procedures. Span (2000) writes

"可靠迭代程序的制定[求根]通常是设置程序包时最关键的问题状态方程的求值".

"the formulation of reliable iterative procedures [for root finding] is often the most crucial problem when setting up program packages for the evaluation of equations of state".

重用现有的求解器有利也有弊,它们通常经过很好的测试,编写它们需要付出很多努力,但是如果您编写自己的求解器,则可以更好地控制它的作用.据我所知,Dassl 的实力是多种多样的,但解决那种方程并不是它的初衷.Olson、Tummescheit 和 Elmqvist (2005) 尝试使用 Dymola 求解器找到 VLE,请参阅链接 pdf 的第 3.2 节.听起来它有效,但不是很可靠.
MSL 已经包含一个基于 Brent 算法的非线性求解器,该算法仅适用于一个未知数,请参阅 Modelica.Math.Nolinear.solveOneNonlinearEquation.如果需要,您可以添加其他通用求解器.

Re-using existing solvers has advantages and disadvantages, they are usually very well tested, writing them takes a lot of effort, but if you write your own solver, you have more control about what it does. As far as I know, Dassl has various strength, but solving that kind of equations is not its original objective. Olson, Tummescheit and Elmqvist (2005) tried to use the Dymola solver to find the VLE, see section 3.2 of the linked pdf. Sounds like it works, but not very reliable.
The MSL already includes a non-linear solver, based on the Brent algorithm, which works with one unknown only, see Modelica.Math.Nolinear.solveOneNonlinearEquation. You could, if you want, add additional generic solvers.

在编写自己的求解器之前,您应该与 Modelica.Media 接口的开发人员取得联系(它将在 MSL 的未来版本中扩展以包括多组件、多阶段混合物),并考虑重新使用现有的流体属性库,例如 RefProp、CoolProp、FluidProp 或 MultiFlash,仅举几例.

Before writing your own solver, you should get in touch with the developers of the Modelica.Media interface (it will be extended in future versions of the MSL to include multi-component, multi-phase mixtures) and also consider re-using existing fluid properties libraries like RefProp, CoolProp, FluidProp or MultiFlash, to name just a few.

这篇关于Dymola 求解 Media-Model 的平稳方程组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆