source: trunk/sample/miscellaneous/ocfem/OCM-ss.mso

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

Examples for polynomial approximation.

File size: 2.0 KB
Line 
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
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        A(N) as Real(Brief="recebe valores de do vetor A");
32        B(N) as Real(Brief="recebe valores de do vetor B");
33        r(np) as Real(Brief="raizes de jacobi");
34       
35        Da as Real;
36        Pe as Real;
37        m as Real;
38       
39        SET
40        np= MCO.NodalPoints;
41        N= MCO.NodalPoints * MCO.NodalPoints;
42        A = MCO.matrixA;       
43        B = MCO.matrixB;
44        r = MCO.roots;
45       
46        Da = 5;
47        m = 1;
48        Pe = 2;
49       
50        VARIABLES
51        y(np) as Real(Brief="variavel dependente");
52       
53        mA(np,np) as Real(Brief="cria matriz A");
54        mB(np,np) as Real(Brief="cria matriz B");
55       
56        dif1x(np) as Real(Brief="calcula 1derivada");
57        dif2x(np) as Real(Brief="calcula 2derivada");
58       
59        EQUATIONS
60        #comando para criar as matrizes
61        for j in [1:np] do
62                mA(:,j) = A((j-1)*np+[1:np]);
63                mB(:,j) = B((j-1)*np+[1:np]);
64        end
65       
66        #calculando as derivadas
67        dif1x = sumt(mA*y);
68        dif2x = sumt(mB*y);     
69
70        (1/Pe) * dif2x(2:np-1) - dif1x(2:np-1) - Da*y(2:np-1)^m = 0;
71
72        -1/Pe * dif1x(1) = 1 - y(1);
73#       y(1)=1;
74
75        dif1x(np)=0;
76
77        OPTIONS
78        Dynamic = false;
79end
Note: See TracBrowser for help on using the repository browser.