Compile large array in Dymola

后端 未结 3 1352
南笙
南笙 2021-01-14 05:15

Please consider the following small Modelica model and function:

model VectorizeDemo
  parameter Integer na=5;
  final parameter Integer nb=2*na;
  final par         


        
相关标签:
3条回答
  • 2021-01-14 05:36

    IIRC, some parts of the Modelica specification are written in a way that requires scalarization of all variables. That is not necessary for many cases, but simpler for some common cases in index reduction. It seems particularly unnecessary for some cases of discretized PDE.

    0 讨论(0)
  • 2021-01-14 05:42

    By default all Modelica Compilers will expand all arrays (there are some exceptions like arrays in records in functions) into scalars. OpenModelica started some work on non-expanding arrays in the front-end and back-end. See: http://www.ep.liu.se/ecp/157/071/ecp19157071.pdf

    0 讨论(0)
  • 2021-01-14 05:49

    Yes, at least the compilation issue can preliminarily be avoided as follows in Dymola 2020 (and possibly earlier versions):

    Real d[na,nb] annotation(__Dymola_HideArray=true);
    

    However, there might be other possibilities as well - and the example doesn't fully clarify how it is intended be used. In particular I noted that 'd' can be evaluated and isn't used at all.

    0 讨论(0)
提交回复
热议问题