| 1 | loadString("
|
|---|
| 2 | model Test
|
|---|
| 3 | parameter Integer N = 100;
|
|---|
| 4 | parameter Real k_min = 1;
|
|---|
| 5 | parameter Real k_max = 2;
|
|---|
| 6 | parameter Real d_0_a = 0.5;
|
|---|
| 7 | parameter Real d_0_b = 3;
|
|---|
| 8 | parameter Real d_tot = 1;
|
|---|
| 9 | final parameter Real s_0_a = d_0_a/N;
|
|---|
| 10 | final parameter Real s_0_b = d_0_b/N;
|
|---|
| 11 | Real d[N+1];
|
|---|
| 12 | Real s[N];
|
|---|
| 13 | Real F_a[N];
|
|---|
| 14 | Real F_b[N];
|
|---|
| 15 | Real k[N];
|
|---|
| 16 | equation
|
|---|
| 17 | d[1] = 0;
|
|---|
| 18 | for i in 1:N loop
|
|---|
| 19 | d[i+1] = d[i] + s[i];
|
|---|
| 20 | s[i]*(1 + abs(s[i])/s_0_a)*k[i]*N = F_a[i];
|
|---|
| 21 | s[i]*(1 + abs(s[i])/s_0_b)*k[i]*N = F_b[i];
|
|---|
| 22 | k[i] = k_min + (k_max-k_min)/(N-1)*(i-1);
|
|---|
| 23 | end for;
|
|---|
| 24 | for i in 1:N-1 loop
|
|---|
| 25 | F_a[i] + F_b[i] = F_a[i+1] + F_b[i+1];
|
|---|
| 26 | end for;
|
|---|
| 27 | d[end] = d_tot;
|
|---|
| 28 | end Test;
|
|---|
| 29 | ");getErrorString();
|
|---|
| 30 |
|
|---|
| 31 | loadString("
|
|---|
| 32 | // Well-scaled models
|
|---|
| 33 | model TestW1 \"Base case\"
|
|---|
| 34 | extends Test;
|
|---|
| 35 | end TestW1;
|
|---|
| 36 |
|
|---|
| 37 | model TestW2 \"Less variables\"
|
|---|
| 38 | extends TestW1(N = 10);
|
|---|
| 39 | end TestW2;
|
|---|
| 40 |
|
|---|
| 41 | model TestW3 \"More variables\"
|
|---|
| 42 | extends TestW1(N = 1000);
|
|---|
| 43 | end TestW3;
|
|---|
| 44 |
|
|---|
| 45 | model TestW4 \"More strongly nonlinear\"
|
|---|
| 46 | extends TestW1(d_0_a = 0.1, d_0_b = 1);
|
|---|
| 47 | end TestW4;
|
|---|
| 48 |
|
|---|
| 49 | // Badly-scaled models
|
|---|
| 50 | model TestB1 \"Base case\"
|
|---|
| 51 | extends Test(k_min = 1e9, k_max = 2e9,
|
|---|
| 52 | F_a(each nominal = 1e9), F_b(each nominal = 1e9));
|
|---|
| 53 | end TestB1;
|
|---|
| 54 |
|
|---|
| 55 | model TestB2 \"Less variables\"
|
|---|
| 56 | extends TestB1(N = 10);
|
|---|
| 57 | end TestB2;
|
|---|
| 58 |
|
|---|
| 59 | model TestB3 \"More variables\"
|
|---|
| 60 | extends TestB1(N = 1000);
|
|---|
| 61 | end TestB3;
|
|---|
| 62 |
|
|---|
| 63 | model TestB4 \"More strongly nonlinear\"
|
|---|
| 64 | extends TestB1(d_0_a = 0.1, d_0_b = 1);
|
|---|
| 65 | end TestB4;
|
|---|
| 66 |
|
|---|
| 67 | model TestB5 \"Less badly scaled\"
|
|---|
| 68 | extends TestB1(k_min = 1e6, k_max = 2e6,
|
|---|
| 69 | F_a(each nominal = 1e6), F_b(each nominal = 1e6));
|
|---|
| 70 | end TestB5;
|
|---|
| 71 |
|
|---|
| 72 | model TestB6 \"More badly scaled\"
|
|---|
| 73 | extends TestB1(k_min = 1e12, k_max = 2e12,
|
|---|
| 74 | F_a(each nominal = 1e12), F_b(each nominal = 1e12));
|
|---|
| 75 | end TestB6;
|
|---|
| 76 |
|
|---|
| 77 | model TestB7 \"Nominal values off by 3 o.d.g.\"
|
|---|
| 78 | extends TestB1(F_a(each nominal = 1e6), F_b(each nominal = 1e6));
|
|---|
| 79 | end TestB7;
|
|---|
| 80 |
|
|---|
| 81 | model TestB8 \"Nominal values off by 5 o.d.g.\"
|
|---|
| 82 | extends TestB1(F_a(each nominal = 1e4), F_b(each nominal = 1e4));
|
|---|
| 83 | end TestB8;
|
|---|
| 84 |
|
|---|
| 85 | model TestB9 \"Nominal values off by 7 o.d.g.\"
|
|---|
| 86 | extends TestB1(F_a(each nominal = 1e2), F_b(each nominal = 1e2));
|
|---|
| 87 | end TestB9;
|
|---|
| 88 |
|
|---|
| 89 | model TestB10 \"Nominal values off by 9 o.d.g.\"
|
|---|
| 90 | extends TestB1(F_a(each nominal = 1e0), F_b(each nominal = 1e0));
|
|---|
| 91 | end TestB10;
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | ");getErrorString();
|
|---|
| 95 |
|
|---|
| 96 | setCommandLineOptions("--maxSizeNonlinearTearing=0");getErrorString();
|
|---|
| 97 | setCommandLineOptions("--preOptModules-=removeSimpleEquations");getErrorString();
|
|---|
| 98 | setCommandLineOptions("--postOptModules-=removeSimpleEquations");getErrorString();
|
|---|
| 99 | setCommandLineOptions("--maxSizeNonlinearTearing=0");getErrorString();
|
|---|
| 100 |
|
|---|
| 101 | //simulate(TestW1, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 102 | //simulate(TestW2, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 103 | //simulate(TestW3, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 104 | //simulate(TestW4, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 105 |
|
|---|
| 106 | //simulate(TestB1, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 107 | //simulate(TestB2, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 108 | //simulate(TestB3, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 109 | //simulate(TestB4, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 110 | //simulate(TestB5, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 111 | //simulate(TestB6, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 112 | //simulate(TestB7, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 113 | //simulate(TestB8, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 114 | //simulate(TestB9, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 115 | //simulate(TestB10, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler");getErrorString();
|
|---|
| 116 |
|
|---|
| 117 | //simulate(TestB1, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|
| 118 | //simulate(TestB2, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|
| 119 | //simulate(TestB3, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|
| 120 | //simulate(TestB4, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|
| 121 | simulate(TestB5, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|
| 122 | simulate(TestB6, numberOfIntervals = 0, simflags="-lv=LOG_NLS_V -nls=kinsol -s=euler -noScaling");getErrorString();
|
|---|