Opened 12 years ago

Closed 12 years ago

#1968 closed defect (worksforme)

Modelica.Media.Examples.Tests.MediaTestModels.Water.WaterIF97OnePhase_ph.mos fails on Linux

Reported by: Jens Frenkel Owned by: Willi Braun
Priority: high Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: Cc: Adrian Pop

Description

The Model Modelica.Media.Examples.Tests.MediaTestModels.Water.WaterIF97OnePhase_ph.mos works in Windows but fails with Division by Zero on Linux.

division by zero in partial equation: (-volume.medium.p) / volume.medium.d because volume.medium.d == 0: File: D:/Programming/OPENMODELICA/OpenModelica/build/lib/omlibrary/Modelica 3.2.1/Media/Water/package.mo Line: 223
stdout        | warning | at Time=0.000000
stdout        | warning | [line] 2101 | [file] Modelica.Media.Examples.Tests.MediaTestModels.Water.WaterIF97OnePhase_ph.c
              | assert  | division by zero

The only difference I could found is that the variables of a nonlinear systems are switch in windows an linux

c Code Linux:

  $P$DER$Pvolume$Pmedium$Ph = data->simulationInfo.nonlinearSystemData[2].nlsx[0];
  $P$DER$Pvolume$Pmedium$Pp = data->simulationInfo.nonlinearSystemData[2].nlsx[1];

c Code Win:

  $P$DER$Pvolume$Pmedium$Pp = data->simulationInfo.nonlinearSystemData[2].nlsx[0];
  $P$DER$Pvolume$Pmedium$Ph = data->simulationInfo.nonlinearSystemData[2].nlsx[1];

Change History (2)

comment:1 by Adrian Pop, 12 years ago

Hi,

It seems that somewhere SimCode.SES_NONLINEAR.crefs are getting a different order in Linux vs. Windows.
As far as I can tell SimCode.SES_NONLINEAR.crefs are created from:

  • BackendVariable.getAllCrefFromVariables
  • BackendVariable.getVarAt(vars,varNum)
  • List.map1r(tearingVars, BackendVariable.getVarAt, vars);
  • crefs = List.map(inVars,BackendVariable.varCref);

So these inputs are also switched in this case.
I'll look into it more to see why.

Cheers,
Adrian Pop/

comment:2 by Martin Sjölund, 12 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.