# source:trunk/sample/miscellaneous/ocfem/OCM-ss_lag.mso@976

Last change on this file since 976 was 976, checked in by Argimiro Resende Secchi, 6 years ago

Examples for polynomial approximation.

File size: 2.1 KB
RevLine
[976]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.
11*
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
22FlowSheet 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
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
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;
89end
Note: See TracBrowser for help on using the repository browser.