Overview
Comment:Added implicit method
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c97c09e8d0cdc1e1e0695aa77fa89ff9fe70e7737780b1a2241376e12d021205
User & Date: gawthrop@users.sourceforge.net on 1998-08-13 08:52:33
Other Links: branch diff | manifest | tags
Context
1998-08-13
09:03:35
*** empty log message *** check-in: a6fb222402 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:52:33
Added implicit method check-in: c97c09e8d0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:51:57
Initial revision check-in: 451efc65f5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/p/mtt_update.p from [c735b97393] to [03c4ae37e1].

1
2
3
4
5

6



7
8


9


10

11
12















13











14
15
PROCEDURE mtt_update(VAR xnew	: StateVector;
			 dx,x	: StateVector;
			 DT	: REAL;
			 Nx	: INTEGER;
			 METHOD	: IntegrationMethod);





VAR
i : INTEGER;


   


BEGIN

   FOR i := 1 TO  Nx DO
      xnew[i] := xnew[i] + dx[i]*DT;















END;

















|
>

>
>
>

|
>
>

>
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
PROCEDURE mtt_update(VAR xnew	: StateVector;
			 dx,x	: StateVector;
			 DT	: REAL;
			 Nx	: INTEGER;
			 METHOD	: IntegrationMethod;
		     VAR A	: StateMatrix);

CONST
   Small = 0.000001;
   
VAR
   i,j	 : INTEGER;
   AA	 : StateMatrix;
   BB,Ax : StateVector;
   
(*$I mtt_solve.p *)
   
BEGIN{mtt_update}
   IF Method=1 THEN {Euler}
      FOR i := 1 TO  Nx DO
	 xnew[i] := xnew[i] + dx[i]*DT
      ELSE IF (Method=2) OR (METHOD=3) THEN {Implicit}
      BEGIN
	 {Set up the solution matrices:
	  AA = eye(Nx)-A*dt
	  BB = x + dt*(dx - A*x)}
	 FOR i := 1 TO  Nx DO
	 BEGIN
	    Ax[i] := 0.0;
	    FOR j := 1 TO  Nx DO
	    BEGIN
	       AA[i,j] := -A[i,j]*DT;
	       Ax[i] := Ax[i] + A[i,j]*x[j];
	       IF i=j THEN
		  AA[i,j] := AA[i,j] + 1.0;
	    END
	 END;
	 
	 FOR i := 1 TO  Nx DO
	    BB[i] := x[i] + DT*(dx[i]-Ax[i]);

	 {Solve the equation AAx = B}
	 mtt_solve(xnew,AA,BB,Nx,Small);
      END
      ELSE
	 Writeln("Method >2 is not defined");
   
END{mtt_update};



MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]