LoginSignup
1
0

More than 5 years have passed since last update.

OpenModelicaで伝熱流動 redeclare packageの件

Last updated at Posted at 2018-12-09

前回と前々回に試してみたSimpleFrictionを使ったIsolatedPipeの圧力損失評価モデルが私的にいま一つだったので、Modelica.Fluid.Pipes.StaticPipeを試してみました。
static_pipe.png
Examplesを参考に上図のような構成に。
systemが必須かどうかは不明ですが、役に立ちそうなので入れてみました。
以下のように、流体をMediumで定義したみたところ、 Variable Medium not found in scope flow_test_old.のエラーでコンパイルできません。
model flow_test_old
replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater;
Modelica.Fluid.Sources.MassFlowSource_T boundary(T = 320, m_flow = 1, nPorts = 1,Medium = Medium)
(後略)

流体の定義がまずいようなので、いろいろと試行錯誤してみたところ、今度は以下のようなエラーが。
component boundary contains the definition of a partial class Medium.
Please redeclare it to any package compatible with Modelica.Media.Interfaces.PartialMedium.
どうやらModelica.Media.Interfaces.PartialMediumを使えというエラーのよう。
そこで、さらに他のExamplesを参考に以下のように定義してみました。
model flow_test
replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase constrainedby Modelica.Media.Interfaces.PartialMedium;
Modelica.Fluid.Sources.MassFlowSource_T boundary(redeclare package Medium = Medium, T = 310, m_flow = 1, nPorts = 1)
(後略)

これで実行可能になりました。
モデルによっては、使えるMediumに制限があるのでしょうか。
Fortran77な私なので、redeclare packageが一般的なのかもわかりませんが、とにもかくにも動くようにはなりました。

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0