1 | #*--------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2016 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2016 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *---------------------------------------------------------------------- |
---|
16 | * Author: Argimiro R. Secchi |
---|
17 | * COPPE/UFRJ - Group of Modeling, Simulation, Control, |
---|
18 | * and Optimization of Processes |
---|
19 | * $Id$ |
---|
20 | *--------------------------------------------------------------------*# |
---|
21 | |
---|
22 | FlowSheet OCM_ss |
---|
23 | |
---|
24 | PARAMETERS |
---|
25 | MCO as Plugin(Type="OCFEM",Boundary="BOTH", |
---|
26 | InternalPoints=3, |
---|
27 | alfa=1, beta=1); |
---|
28 | np as Integer; |
---|
29 | nd as Integer; |
---|
30 | N as Integer; |
---|
31 | ni as Integer; |
---|
32 | A(N) as Real(Brief="recebe valores de do vetor A"); |
---|
33 | B(N) as Real(Brief="recebe valores de do vetor B"); |
---|
34 | r(np) as Real(Brief="raizes de jacob"); |
---|
35 | x(ni) as Real; |
---|
36 | |
---|
37 | Da as Real; |
---|
38 | Pe as Real; |
---|
39 | m as Real; |
---|
40 | |
---|
41 | SET |
---|
42 | np= MCO.NodalPoints; |
---|
43 | N= MCO.NodalPoints * MCO.NodalPoints; |
---|
44 | A = MCO.matrixA; |
---|
45 | B = MCO.matrixB; |
---|
46 | r = MCO.roots; |
---|
47 | ni = 20; |
---|
48 | x = [1:ni]/ni; |
---|
49 | |
---|
50 | Da = 5; |
---|
51 | m = 1; |
---|
52 | Pe = 2; |
---|
53 | |
---|
54 | VARIABLES |
---|
55 | y(np) as Real(Brief="variavel dependente"); |
---|
56 | |
---|
57 | mA(np,np) as Real(Brief="cria matriz A"); |
---|
58 | mB(np,np) as Real(Brief="cria matriz B"); |
---|
59 | |
---|
60 | dif1x(np) as Real(Brief="calcula 1derivada"); |
---|
61 | dif2x(np) as Real(Brief="calcula 2derivada"); |
---|
62 | |
---|
63 | yi(ni) as Real; |
---|
64 | |
---|
65 | EQUATIONS |
---|
66 | #comando para criar as matrizes |
---|
67 | for j in [1:np] do |
---|
68 | mA(:,j) = A((j-1)*np+[1:np]); |
---|
69 | mB(:,j) = B((j-1)*np+[1:np]); |
---|
70 | end |
---|
71 | |
---|
72 | #calculando as derivadas |
---|
73 | dif1x = sumt(mA*y); |
---|
74 | dif2x = sumt(mB*y); |
---|
75 | |
---|
76 | (1/Pe) * dif2x(2:np-1) - dif1x(2:np-1) - Da*y(2:np-1)^m = 0; |
---|
77 | |
---|
78 | -1/Pe * dif1x(1) = 1 - y(1); |
---|
79 | # y(1)=1; |
---|
80 | |
---|
81 | dif1x(np)=0; |
---|
82 | |
---|
83 | for i in [1:ni] do |
---|
84 | yi(i) = sum(MCO.Lagrange(i/ni)*y); |
---|
85 | end |
---|
86 | |
---|
87 | OPTIONS |
---|
88 | Dynamic = false; |
---|
89 | end |
---|