Skip to content

Commit 9aa8157

Browse files
Andreas Heuermannadrpo
authored andcommitted
Updated NPendulum test to work on Windows
1 parent 1775817 commit 9aa8157

File tree

1 file changed

+62
-27
lines changed

1 file changed

+62
-27
lines changed
Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,100 @@
11
// name: NPendulum10
22
// keywords: arrays
33
// status: correct
4+
// teardown_command: rm -f simcall_*.log NPendulum.pendulum*
5+
//
6+
// Simulate NPendulum with N=10 with different linear solvers
47
//
58

69
loadFile("NPendulum.mo");
710
getErrorString();
811

12+
13+
// Enable linear tearing
914
setCommandLineOptions("--maxSizeLinearTearing=4000"); getErrorString();
1015
buildModel(NPendulum.pendulum); getErrorString();
11-
system("./NPendulum.pendulum -ls totalpivot");
16+
17+
system(realpath(".") + "/NPendulum.pendulum -ls totalpivot", "simcall_totalpivot.log");
18+
readFile("simcall_totalpivot.log"); remove("simcall_totalpivot.log");
1219
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
1320
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
1421
"NPendulum_diff.csv",0.01,0.0001,
1522
{"phi[10]"});
1623

17-
system("./NPendulum.pendulum -ls lapack");
24+
system(realpath(".") + "/NPendulum.pendulum -ls lapack", "simcall_lapack.log");
25+
readFile("simcall_lapack.log"); remove("simcall_lapack.log");
1826
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
1927
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
2028
"NPendulum_diff.csv",0.01,0.0001,
2129
{"phi[10]"});
2230

23-
system("./NPendulum.pendulum -ls umfpack");
31+
system(realpath(".") + "/NPendulum.pendulum -ls umfpack", "simcall_umfpack.log");
32+
readFile("simcall_umfpack.log"); remove("simcall_umfpack.log");
2433
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
2534
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
2635
"NPendulum_diff.csv",0.01,0.0001,
2736
{"phi[10]"});
2837

2938
/*
3039
Lis solver doesn't work here
31-
system("./NPendulum.pendulum -ls lis");
40+
system(realpath(".") + "/NPendulum.pendulum -ls lis", "simcall_lis.log");
41+
readFile("simcall_lis.log"); remove("simcall_lis.log");
3242
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
3343
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
3444
"NPendulum_diff.csv",0.01,0.0001,
3545
{"phi[10]"});
3646
*/
37-
system("./NPendulum.pendulum -ls klu");
47+
48+
system(realpath(".") + "/NPendulum.pendulum -ls klu", "simcall_klu.log");
49+
readFile("simcall_klu.log"); remove("simcall_klu.log");
3850
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
3951
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
4052
"NPendulum_diff.csv",0.01,0.0001,
4153
{"phi[10]"});
4254

43-
55+
// Disable linear tearing
4456
setCommandLineOptions("--maxSizeLinearTearing=0"); getErrorString();
4557
buildModel(NPendulum.pendulum); getErrorString();
4658

47-
system("./NPendulum.pendulum -ls totalpivot -lssMinSize=4001");
59+
system(realpath(".") + "/NPendulum.pendulum -ls totalpivot -lssMinSize=4001", "simcall_totalpivot.log");
60+
readFile("simcall_totalpivot.log"); remove("simcall_totalpivot.log");
4861
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
4962
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
5063
"NPendulum_diff.csv",0.01,0.01,
5164
{"phi[10]"});
5265

53-
system("./NPendulum.pendulum -ls lapack -lssMinSize=4001");
66+
system(realpath(".") + "/NPendulum.pendulum -ls lapack -lssMinSize=4001", "simcall_lapack.log");
67+
readFile("simcall_lapack.log"); remove("simcall_lapack.log");
5468
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
5569
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
5670
"NPendulum_diff.csv",0.01,0.01,
5771
{"phi[10]"});
58-
system("./NPendulum.pendulum -ls umfpack -lssMinSize=4001");
72+
73+
system(realpath(".") + "/NPendulum.pendulum -ls umfpack -lssMinSize=4001", "simcall_umfpack.log");
74+
readFile("simcall_umfpack.log"); remove("simcall_umfpack.log");
5975
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
6076
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
6177
"NPendulum_diff.csv",0.01,0.01,
6278
{"phi[10]"});
6379

6480
/*
6581
Lis solver doesn't work here
66-
system("./NPendulum.pendulum -ls lis");
82+
system(realpath(".") + "/NPendulum.pendulum -ls lis", "simcall_lis.log");
83+
readFile("simcall_lis.log"); remove("simcall_lis.log");
6784
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
6885
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
6986
"NPendulum_diff.csv",0.01,0.01,
7087
{"phi[10]"});
7188
*/
7289

73-
system("./NPendulum.pendulum -ls klu -lssMinSize=4001");
90+
system(realpath(".") + "/NPendulum.pendulum -ls klu -lssMinSize=4001", "simcall_klu.log");
91+
readFile("simcall_klu.log"); remove("simcall_klu.log");
7492
res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.mat",
7593
getEnvironmentVar("REFERENCEFILES")+"/linear_system/NPendulum_10.mat",
7694
"NPendulum_diff.csv",0.01,0.01,
7795
{"phi[10]"});
7896

97+
7998
// Result:
8099
// true
81100
// "Notification: Automatically loaded package Modelica 3.2.1 due to uses annotation.
@@ -86,21 +105,29 @@ res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.m
86105
// ""
87106
// {"NPendulum.pendulum","NPendulum.pendulum_init.xml"}
88107
// ""
89-
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
90-
// LOG_SUCCESS | info | The simulation finished successfully.
91108
// 0
92-
// {"Files Equal!"}
93-
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
109+
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
94110
// LOG_SUCCESS | info | The simulation finished successfully.
95-
// 0
111+
// "
112+
// true
96113
// {"Files Equal!"}
97-
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
98-
// LOG_SUCCESS | info | The simulation finished successfully.
99114
// 0
115+
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
116+
// LOG_SUCCESS | info | The simulation finished successfully.
117+
// "
118+
// true
100119
// {"Files Equal!"}
101-
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
120+
// 0
121+
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
102122
// LOG_SUCCESS | info | The simulation finished successfully.
123+
// "
124+
// true
125+
// {"Files Equal!"}
103126
// 0
127+
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
128+
// LOG_SUCCESS | info | The simulation finished successfully.
129+
// "
130+
// true
104131
// {"Files Equal!"}
105132
// true
106133
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
@@ -111,24 +138,32 @@ res := OpenModelica.Scripting.compareSimulationResults("NPendulum.pendulum_res.m
111138
// Notification: Tearing is skipped for strong component 2 because system size of 275 exceeds maximum system size for tearing of linear systems (0).
112139
// To adjust the maximum system size for tearing use --maxSizeLinearTearing=<size> and --maxSizeNonlinearTearing=<size>.
113140
// "
114-
// stdout | info | Maximum system size for using linear sparse solver changed to 4001
141+
// 0
142+
// "stdout | info | Maximum system size for using linear sparse solver changed to 4001
115143
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
116144
// LOG_SUCCESS | info | The simulation finished successfully.
117-
// 0
145+
// "
146+
// true
118147
// {"Files Equal!"}
119-
// stdout | info | Maximum system size for using linear sparse solver changed to 4001
148+
// 0
149+
// "stdout | info | Maximum system size for using linear sparse solver changed to 4001
120150
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
121151
// LOG_SUCCESS | info | The simulation finished successfully.
122-
// 0
152+
// "
153+
// true
123154
// {"Files Equal!"}
124-
// stdout | info | Maximum system size for using linear sparse solver changed to 4001
155+
// 0
156+
// "stdout | info | Maximum system size for using linear sparse solver changed to 4001
125157
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
126158
// LOG_SUCCESS | info | The simulation finished successfully.
127-
// 0
159+
// "
160+
// true
128161
// {"Files Equal!"}
129-
// stdout | info | Maximum system size for using linear sparse solver changed to 4001
162+
// 0
163+
// "stdout | info | Maximum system size for using linear sparse solver changed to 4001
130164
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
131165
// LOG_SUCCESS | info | The simulation finished successfully.
132-
// 0
166+
// "
167+
// true
133168
// {"Files Equal!"}
134169
// endResult

0 commit comments

Comments
 (0)