Overview
Comment:New update methods
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6f4b578e7c4765fdae3ec4da556f8f823091afb4254faa3d296165732dda0505
User & Date: gawthrop@users.sourceforge.net on 1998-08-15 13:48:35
Other Links: branch diff | manifest | tags
Context
1998-08-15
13:49:19
iters now passed as an argument. check-in: 049b8fa9a9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
13:48:35
New update methods check-in: 6f4b578e7c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
13:48:11
New way of computing Euler check-in: 76bdb5bcaa user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/p/mtt_update.p from [6fcd662042] to [69e39a967e].

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





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
51
52
53
54
55
56
57
-
-
-
-
-
+
+
+
+
+
+
+
-







+
+
+







-
-
-
+
+
+





+

+
+
-
-
-
-
+
+
+
+

-
+

-
+





-
+







PROCEDURE mtt_update(VAR xnew	: StateVector;
			 dx,x	: StateVector;
			 DT	: REAL;
			 Nx	: INTEGER;
			 METHOD	: IntegrationMethod;
PROCEDURE mtt_update(VAR xnew	    : StateVector;
		         dx,x,AAx   : StateVector;
		     VAR AA	    : StateMatrix;
			 DT	    : REAL;
			 STEPFACTOR : INTEGER;
			 Nx	    : INTEGER;
			 METHOD	    : IntegrationMethod);
			 AA	: StateMatrix );

{
 ###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/08/14 10:54:58  peterg
## Use sparse computation where possible
##
###############################################################
}

CONST
   Small = 0.000001;
   
VAR
   i,j	 : INTEGER;
   BB,Ax : StateVector;
   rsq	 : REAL;
   i,j : INTEGER;
   BB  : StateVector;
   DDT : REAL;
   
(*$I mtt_solve.p *)
(*$I mtt_sparse.p *)
   
BEGIN{mtt_update}
   
   IF Method=1 THEN {Euler}
   BEGIN{Euler}
      DDT := DT/STEPFACTOR;
      FOR i := 1 TO  Nx DO
	 xnew[i] := xnew[i] + dx[i]*DT
	 
      ELSE IF (Method=2) OR (METHOD=3) OR (METHOD=4) THEN {Implicit}
	 FOR i := 1 TO  Nx DO
	    xnew[i] := xnew[i] + dx[i]*DDT;
   END {Euler}
   ELSE IF (Method=2) OR (METHOD=3) OR (METHOD=4) THEN {Implicit}
      BEGIN {Implicit methods}
	 mtt_asub(x,Ax,Nx); {Sparse computation of (1-A*dt)*x}
	 
	 FOR i := 1 TO  Nx DO {BB is (1-A*dt)*x +dx*dt}
	    BB[i] := Ax[i]+ DT*dx[i];
	    BB[i] := AAx[i] + DT*dx[i];

	 {Solve the equation AAx = B}
	 IF (Method=2) OR (METHOD=3) THEN {Use SVD}
	    mtt_solve(xnew,AA,BB,Nx,Small)
	 ELSE {Sparse CG solution}
	    mtt_sparse(BB,Nx,xnew,rsq);
	    mtt_sparse(BB,Nx,STEPFACTOR,xnew);
      END{Implicit methods}
      ELSE
	 Writeln("Method >4 is not defined");
   
END{mtt_update};



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