source: trunk/sample/miscellaneous/ocfem/OCM-din.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.
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_din
23               
24        PARAMETERS
25        MCO as Plugin(Type="OCFEM",Boundary="BOTH",
26                                        InternalPoints=5,
27                                        alfa=1, beta=1);
28
29        np as Integer;
30        nd as Integer;
31        N 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       
36        Da as Real;
37        Pe as Real;
38        m as Real;
39       
40        SET
41        np= MCO.NodalPoints;
42        N= MCO.NodalPoints * MCO.NodalPoints;
43        A = MCO.matrixA;       
44        B = MCO.matrixB;
45        r = MCO.roots;
46       
47        Da = 5;
48        m = 1;
49        Pe = 2;
50       
51        VARIABLES
52        y(np) as Real(Brief="variavel dependente");
53       
54        mA(np,np) as Real(Brief="cria matriz A");
55        mB(np,np) as Real(Brief="cria matriz B");
56       
57        dif1x(np) as Real(Brief="calcula 1derivada");
58        dif2x(np) as Real(Brief="calcula 2derivada");
59       
60        EQUATIONS
61        #comando para criar as matrizes
62        for j in [1:np] do
63                mA(:,j) = A((j-1)*np+[1:np]);
64                mB(:,j) = B((j-1)*np+[1:np]);
65        end
66       
67        #calculando as derivadas
68        dif1x = sumt(mA*y);
69        dif2x = sumt(mB*y);     
70
71        diff(y(2:np-1))*'s' + dif1x(2:np-1) = 1/Pe * dif2x(2:np-1) - Da*y(2:np-1)^m;
72       
73        -1/Pe * dif1x(1) = 1 - y(1);
74#       y(1) = 1;
75       
76        dif1x(np) = 0;
77
78        INITIAL
79        y(2:np-1) = 0;
80
81        OPTIONS
82        TimeStep = 0.01;
83        TimeEnd = 0.2;
84        TimeUnit = 's';
85        Dynamic = true;
86end
Note: See TracBrowser for help on using the repository browser.