Differences From Artifact [03c4ae37e1]:

To Artifact [19c3d6b4db]:


8
9
10
11
12
13
14

15
16

17
18
19
20
21
22
23
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







>


>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
CONST
   Small = 0.000001;
   
VAR
   i,j	 : INTEGER;
   AA	 : StateMatrix;
   BB,Ax : StateVector;
   rsq	 : REAL;
   
(*$I mtt_solve.p *)
(*$I mtt_sparse.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
38
39
40
41
42
43
44








45
46
47
48
49
50


	 
	 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};











>
>
>
>
>
>
>
>
|
|




>
>
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	 
	 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 IF (METHOD=4) THEN {Sparse CG implicit}
      BEGIN
	 mtt_asub(x,Ax,Nx); {Sparse computation of (1-A*dt)*x}
	 FOR i := 1 TO  Nx DO
	    BB[i] := Ax[i]+ DT*dx[i];
	 mtt_sparse(BB,Nx,xnew,rsq); {Sparse CG solution
				  - using prev. xnew as starter}
      END
         ELSE
	 Writeln("Method >4 is not defined");
   
END{mtt_update};





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