/[ascend]/trunk/models/westerberg/ivpNondimensional/ivpNonNew/ivp.a4c
ViewVC logotype

Contents of /trunk/models/westerberg/ivpNondimensional/ivpNonNew/ivp.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 666 - (show annotations) (download) (as text)
Mon Jun 19 18:47:33 2006 UTC (16 years, 3 months ago) by aw0a
File MIME type: text/x-ascend
File size: 4411 byte(s)
saving models for new approach to solve DAE models
1 REQUIRE "atoms.a4l";
2
3 (*
4 * ivp.a4c
5 * by Arthur W. Westerberg
6 * Part of the ASCEND Library
7 * $Date: 06/16/2006 $
8 * $Revision: 1.0 $
9 *
10 * This file is part of the ASCEND Modeling Library.
11 *
12 * Copyright (C) 1994 - 2006 Carnegie Mellon University
13 *
14 * The ASCEND Modeling Library is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
18 *
19 * The ASCEND Modeling Library is distributed in hope that it
20 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
21 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 * See the GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with the program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
27 * the file named COPYING.
28 *)
29
30 (*============================================================================
31
32 I V P . A 4 C
33 -----------------------------
34
35 AUTHOR: Arthur W. Westerberg
36
37 DATES: 06/2006 - Original code (AWW)
38
39 CONTENTS: Models for the numerical integration equations for
40 the two multistep methods: a bdf for stiff problems
41 and the Adams Moulton for non-stiff problems. There
42 is also a framework within which one creates the
43 model for the physical system. These models are for
44 taking one step of the independent variable.
45
46 ============================================================================*)
47
48
49 (* ---------------------------------------------------------- *)
50
51 MODEL ivpBase;
52 END ivpBase;
53
54 (* ---------------------------------------------------------- *)
55
56 MODEL diff(
57 y WILL_BE factor;
58 dydt WILL_BE factor;
59 t WILL_BE factor;
60 ) REFINES ivpBase;
61
62 END diff;
63
64 (* ---------------------------------------------------------- *)
65
66 MODEL diff12Step(
67 y WILL_BE factor;
68 dydt WILL_BE factor;
69 t WILL_BE factor;
70 ) REFINES diff;
71
72
73 a[0..12] IS_A factor;
74 dt[0..12] IS_A factor;
75 yPast[0..12] IS_A factor;
76 dydtPast[0..12] IS_A factor;
77 tPast[0..12] IS_A factor;
78
79 yPast[0] = y;
80 dydtPast[0] = dydt;
81 dt[0] = t;
82
83 FOR i IN 0..12 CREATE
84 dt[i] = tPast[i] - t;
85 valueP[i] IS_A valuePoly(yPast[i], dt[i], a);
86 derivP[i] IS_A derivPoly(dydtPast[i], dt[i], a);
87 END FOR;
88
89 END diff12Step;
90
91 (* ---------------------------------------------------------- *)
92
93 MODEL valuePoly12(
94 y WILL_BE factor;
95 dt WILL_BE factor;
96 a[0..,12] WILL_BE factor;
97 ) REFINES ivpBase;
98
99 (* y is an algebraic variable for which prediction will be done as
100 one marches when solving *)
101
102 (* a[i] in the polynomial as written below approximates the i-th
103 derivative of y wrt t (as in a Taylors Series expansion) *)
104
105 polyValue: y = a[0]
106 + dt*(a[1]
107 + dt*(a[2]/2
108 + dt*(a[3]/6
109 + dt*(a[4]/24
110 + dt*(a[5]/120
111 + dt*(a[6]/720
112 + dt*(a[7]/5040
113 + dt*(a[8]/40320
114 + dt*(a[9]/362880
115 + dt*(a[10]/3628800
116 + dt*(a[11]/39916800
117 + dt*(a[12]/479001600))))))))))));
118
119 END valuePoly12;
120
121 (* ---------------------------------------------------------- *)
122
123 MODEL derivPoly12(
124 dydt WILL_BE factor;
125 y WILL_BE factor;
126 dt WILL_BE factor;
127 a[0..12] WILL_BE factor;
128 ) REFINES ivpBase;
129
130 (* dydt is the derivative of the state variable y with respect to
131 the independent variable dt. dt is the value of t for this
132 point less the current value of t (i.e., we are writing the
133 polynomial in dt where dt = 0 is the current point). *)
134
135 (* a[i] in the polynomial as written below approximates the i-th
136 derivative of y wrt t (as in a Taylors Series expansion) *)
137
138 polyDeriv: dydt = a[1]
139 + dt*(a[2]
140 + dt*(a[3]/2
141 + dt*(a[4]/6
142 + dt*(a[5]/24
143 + dt*(a[6]/120
144 + dt*(a[7]/720
145 + dt*(a[8]/5040
146 + dt*(a[9]/40320
147 + dt*(a[10]/362880
148 + dt*(a[11]/3638800
149 + dt*(a[12]/39916800)))))))))));
150
151 END derivPoly12;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22