CNS Solver: Pivot Too Small

Solver related questions
Post Reply
woodson_0325
User
User
Posts: 1
Joined: 1 month ago

CNS Solver: Pivot Too Small

Post by woodson_0325 »

Hi, I have been attempting to solve a non-linear algebraic equations for a steady-state reactor using CNS solver, but I keep getting error of 'pivot too small' for a few of my variables, I wonder how can I get around with this issue. Below is the error code I get.

GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


1 SETS
2 i components /n, h, a/;
3
4 PARAMETERS
5 Cpf heat capacity of feed gas
6 Cpg heat capacity of reacting gas
7 f catalyst activity
8 dH heat of reaction
9 R ideal gas constant
10 S1 surface are of catalyst tubes per unit length of reactor
11 S2 cross sectional area of catalyst zone
12 u overall heat transfer coefficient
13 W total mass flowrate;
14
15 Cpf = 0.707;
16 Cpg = 0.719;
17 f = 1;
18 dH = 26000;
19 R = 1.987;
20 S1 = 10;
21 S2 = 0.78;
22 u = 500;
23 W = 264000;
24
25
26 Positive Variables
27 N molar flow rate of N2 per area catalyst
28 p(i) partial pressure
29 Tf temmperature of feed gas
30 Tg temperature of reacting gas
31 phi phi
32 k1 k1 constant
33 k2 k2 constant;
34
35 Equations
36 eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9;
37
38 eq1.. 0 =e= -((u*S1)/(W*Cpf))*(Tg-Tf);
39 eq2.. 0 =e= -((u*S1)/(W*Cpg))*(Tg-Tf) + ((-dH)*S2)/(W*Cpg)*phi;
40 eq3.. 0 =e= -phi;
41 eq4.. phi*p('a')*(p('h')**1.5) =e= f*((k1*(p('n')*p('h')**3))-k2*p('a')**2
);
42 eq5.. k1 =e= 1.78954*(10**4)*exp(-20800/R*Tg);
43 eq6.. k2 =e= 2.5714*(10**16)*exp(-47400/R*Tg);
44 eq7.. p('n')*(2.598*701.2+2*N) =e= (286*N);
45 eq8.. p('h') =e= 3*p('n');
46 eq9.. p('a')*(2.598*701.2+2*N) =e= 286*(2.23*701.2-2*N);
47
48 Model reactor /all/;
49
50
51 k1.L = 7;
52 k2.L = 10;
53 Tg.L = 605;
54 Tf.L = 600
55
56 Solve reactor using CNS;
57
58 Display N.L, Tg.L, Tf.L;


COMPILATION TIME = 0.000 SECONDS 3 MB 45.6.0 2eadeefd WEX-WEI
GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Equation Listing SOLVE reactor Using CNS From line 56


---- eq1 =E=

eq1.. - 0.0267883931250268*Tf + 0.0267883931250268*Tg =E= 0 ;

(LHS = 0.133941965625134, INFES = 0.133941965625134 ****)


---- eq2 =E=

eq2.. - 0.0263412989421334*Tf + 0.0263412989421334*Tg + 0.106840308509293*phi
=E= 0 ; (LHS = 0.131706494710667, INFES = 0.131706494710667 ****)


---- eq3 =E=

eq3.. phi =E= 0 ; (LHS = 0)


---- eq4 =E=

eq4.. (0)*p(n) + (0)*p(h) + (0)*p(a) + (0)*phi + (0)*k1 + (0)*k2 =E= 0 ;

(LHS = 0)


---- eq5 =E=

eq5.. (0)*Tg + k1 =E= 0 ; (LHS = 7, INFES = 7 ****)


---- eq6 =E=

eq6.. (0)*Tg + k2 =E= 0 ; (LHS = 10, INFES = 10 ****)


---- eq7 =E=

eq7.. - (286)*N + (1821.7176)*p(n) =E= 0 ; (LHS = 0)


---- eq8 =E=

eq8.. - 3*p(n) + p(h) =E= 0 ; (LHS = 0)


---- eq9 =E=

eq9.. (572)*N + (1821.7176)*p(a) =E= 447211.336 ;

(LHS = 0, INFES = 447211.336 ****)

GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 3
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Column Listing SOLVE reactor Using CNS From line 56


---- N molar flow rate of N2 per area catalyst

N
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
(-286) eq7
(572) eq9


---- p partial pressure

p(n)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
(0) eq4
(1821.7176) eq7
-3 eq8

p(h)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
(0) eq4
1 eq8

p(a)
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
(0) eq4
(1821.7176) eq9


---- Tf temmperature of feed gas

Tf
(.LO, .L, .UP, .M = 0, 600, +INF, 0)
-0.0268 eq1
-0.0263 eq2


---- Tg temperature of reacting gas

Tg
(.LO, .L, .UP, .M = 0, 605, +INF, 0)
0.0268 eq1
0.0263 eq2
(0) eq5
(0) eq6


---- phi phi

phi
(.LO, .L, .UP, .M = 0, 0, +INF, 0)
0.1068 eq2
1 eq3
(0) eq4


---- k1 k1 constant

k1
(.LO, .L, .UP, .M = 0, 7, +INF, 0)
(0) eq4
1 eq5


---- k2 k2 constant

k2
(.LO, .L, .UP, .M = 0, 10, +INF, 0)
(0) eq4
1 eq6

GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 4
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Range Statistics SOLVE reactor Using CNS From line 56


RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES)

RHS [min, max] : [ 4.472E+05, 4.472E+05] - Zero values observed as well
Bound [min, max] : [ NA, NA] - Zero values observed as well
Matrix [min, max] : [ 2.634E-02, 1.822E+03] - Zero values observed as well

GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 5
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Model Statistics SOLVE reactor Using CNS From line 56


MODEL STATISTICS

BLOCKS OF EQUATIONS 9 SINGLE EQUATIONS 9
BLOCKS OF VARIABLES 7 SINGLE VARIABLES 9
NON ZERO ELEMENTS 22 NON LINEAR N-Z 12
CODE LENGTH 52 CONSTANT POOL 24
SINGLE =E|X= EQUS 9 SINGLE UNFIXED VARS 9


GENERATION TIME = 0.000 SECONDS 4 MB 45.6.0 2eadeefd WEX-WEI
GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 6
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Solution Report SOLVE reactor Using CNS From line 56


S O L V E S U M M A R Y

MODEL reactor
TYPE CNS
SOLVER CONOPT FROM LINE 56

**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 5 Locally Infeasible

RESOURCE USAGE, LIMIT 0.015 10000000000.000
ITERATION COUNT, LIMIT 1 2147483647
EVALUATION ERRORS 0 0
--- *** This solver runs with a demo license. No commercial use.


C O N O P T 3 version 3.17O
Copyright (C) ARKI Consulting and Development A/S
Bagsvaerdvej 246 A
DK-2880 Bagsvaerd, Denmark


** Warning ** The value of LFITER is out of range.
LFITER is decreased from 2147483647 to 1000000000.

Pre-triangular equations: 1
Post-triangular equations: 0


** Error in Square System: Pivot too small.


CONOPT time Total 0.000 seconds
of which: Function evaluations 0.000 = 0.0%
1st Derivative evaluations 0.000 = 0.0%


**** ERRORS/WARNINGS IN EQUATION eq1
1 error(s): Pivot too small.

**** ERRORS/WARNINGS IN VARIABLE Tf
1 error(s): Pivot too small.

LOWER LEVEL UPPER

---- EQU eq1 . 0.134 . DEPND
---- EQU eq2 . 0.132 . INFES
---- EQU eq3 . . .
---- EQU eq4 . . .
---- EQU eq5 . 7.000 . INFES
---- EQU eq6 . 10.000 . INFES
---- EQU eq7 . . .
---- EQU eq8 . . .
---- EQU eq9 4.4721E+5 . 4.4721E+5 INFES

LOWER LEVEL UPPER

---- VAR N . . +INF

N molar flow rate of N2 per area catalyst

---- VAR p partial pressure

LOWER LEVEL UPPER

n . . +INF
h . . +INF
a . . +INF

LOWER LEVEL UPPER

---- VAR Tf . 600.000 +INF DEPND
---- VAR Tg . 605.000 +INF
---- VAR phi . . +INF
---- VAR k1 . 7.000 +INF
---- VAR k2 . 10.000 +INF

Tf temmperature of feed gas
Tg temperature of reacting gas
phi phi
k1 k1 constant
k2 k2 constant


**** REPORT SUMMARY : 4 INFEASIBLE (INFES)
SUM 4.4723E+5
MAX 4.4721E+5
MEAN 1.1181E+5
1 DEPENDENT (DEPND)
2 ERRORS ( ****)
GAMS 45.6.0 2eadeefd Jan 4, 2024 WEX-WEI x86 64bit/MS Windows - 03/09/24 01:33:46 Page 7
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
E x e c u t i o n


---- 58 VARIABLE N.L = 0.000 molar flow rate of N2
per area catalyst
VARIABLE Tg.L = 605.000 temperature of reacti
ng gas
VARIABLE Tf.L = 600.000 temmperature of feed
gas


EXECUTION TIME = 0.031 SECONDS 4 MB 45.6.0 2eadeefd WEX-WEI


USER: GAMS Demo, for EULA and demo limitations see G230930/0001CB-GEN
https://www.gams.com/latest/docs/UG%5FLicense.html DC0000


**** FILE SUMMARY
Rodrigue
User
User
Posts: 36
Joined: 6 years ago

Re: CNS Solver: Pivot Too Small

Post by Rodrigue »

You had better send the code as attached file.
Note that many equations do not solve either because they are not correctly written or the initialisation of variables is wrong.
Rodrigue,

Cheers
Post Reply