Overview
Comment:_input called in outer loop only.
time updated in outer loop only.
Integer time (itime) introduced and updated in outer loop - maybe
useful for discrete events.
Integer time (itime) passed to _input.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d0b7cce5eb1e01d851f1d71db88bca98f02185612e246dac78da6ca1994c617d
User & Date: gawthrop@users.sourceforge.net on 1997-05-10 07:01:15
Other Links: branch diff | manifest | tags
Context
1997-05-10
08:12:23
Put second argument into _input. check-in: f4367ddc0c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
07:01:15
_input called in outer loop only.
time updated in outer loop only.
Integer time (itime) introduced and updated in outer loop - maybe
useful for discrete events.
Integer time (itime) passed to _input.
check-in: d0b7cce5eb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1997-05-09
14:21:35
Default to flow,component_name check-in: 4c5c40d895 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/ode2odes_r2c from [1103182db7] to [f12be2131c].

16
17
18
19
20
21
22



23
24
25
26
27
28
29
# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



# Revision 1.5  1997/05/01  13:50:11  peterg
# Replaced float by double.
#
# Revision 1.4  1997/05/01  13:43:44  peterg
# Changed double to float.
#
# Revision 1.3  1997/05/01  11:15:33  peterg







>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1997/05/06 13:53:32  peterg
## Now uses the preprocessor to declare sizes -- MTTNX etc
##
# Revision 1.5  1997/05/01  13:50:11  peterg
# Replaced float by double.
#
# Revision 1.4  1997/05/01  13:43:44  peterg
# Changed double to float.
#
# Revision 1.3  1997/05/01  11:15:33  peterg
111
112
113
114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
write "  "$
write "{"$



write "/* Counters etc*/ "$
write "  double time;"$

write "  double dt;"$
write "  int i;"$
write "  int k;"$

write "/*functions */ "$
write "  extern  $1_numpar();"$

%Open the output files
write "/* %Open the output file */"$
write "fps = fopen(""$1_odes.m"", ""w"");  "$
write "fpso = fopen(""$1_odeso.m"", ""w"");  "$

%Set up user-defined constants
write "/* Set up user-defined constants */"$
write "  $1_numpar();"$

%Initialise main (Euler) integration loop
write "/* Initialise main (Euler) integration loop */"$
write "  time = 0;"$

write "  dt = DT/STEPFACTOR;"$
write "  for (i=1; i<=MTTNX; i++)"$
write "      x[i] = 0.0;"$

%Set up system inputs
write "/* Set up system inputs */"$
write "  for (i=1; i<=", MTTNu, "; i++)"$







>


















|
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
write "  "$
write "{"$



write "/* Counters etc*/ "$
write "  double time;"$
write "  int itime;"$
write "  double dt;"$
write "  int i;"$
write "  int k;"$

write "/*functions */ "$
write "  extern  $1_numpar();"$

%Open the output files
write "/* %Open the output file */"$
write "fps = fopen(""$1_odes.m"", ""w"");  "$
write "fpso = fopen(""$1_odeso.m"", ""w"");  "$

%Set up user-defined constants
write "/* Set up user-defined constants */"$
write "  $1_numpar();"$

%Initialise main (Euler) integration loop
write "/* Initialise main (Euler) integration loop */"$
write "  time = 0.0;"$
write "  itime = 0;"$
write "  dt = DT/STEPFACTOR;"$
write "  for (i=1; i<=MTTNX; i++)"$
write "      x[i] = 0.0;"$

%Set up system inputs
write "/* Set up system inputs */"$
write "  for (i=1; i<=", MTTNu, "; i++)"$
170
171
172
173
174
175
176


177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
%Write to state to file
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$



% Inner integration loop
write "/* Inner integration loop */"$
write "    for (k=1; k<=STEPFACTOR; k++)"$
write "    {"$
%Set up system inputs
write "      /* Set up system inputs */"$
write "      $1_input(time);"$
write "      for (i=1; i<=MTTNX; i++)"$
write "        x[i] = x[i] + dx[i]*dt;"$
write "      $1_ode();"$
write "      time = time + dt;"$

write "    }"$

write "  }"$

%Write to files
%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$







>
>
|



<
<
<



|

|
|







175
176
177
178
179
180
181
182
183
184
185
186
187



188
189
190
191
192
193
194
195
196
197
198
199
200
201
%Write to state to file
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$

write "    /* Set up system inputs */"$
write "    $1_input(time);"$

write "/* Inner integration loop */"$
write "    for (k=1; k<=STEPFACTOR; k++)"$
write "    {"$



write "      for (i=1; i<=MTTNX; i++)"$
write "        x[i] = x[i] + dx[i]*dt;"$
write "      $1_ode();"$
write "    }"$

write "      time = time + DT;"$
write "      itime = itime + 1;"$
write "  }"$

%Write to files
%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219


write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$


write "  fprintf(fps, ""];\n"");"$
write "  fprintf(fpso, ""];\n"");"$


write "}"$


SHUT "$1_odes.c";


EOF










>








>
>
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$


write "  fprintf(fps, ""];\n"");"$
write "  fprintf(fpso, ""];\n"");"$

write "  return 0;"$
write "}"$


SHUT "$1_odes.c";


EOF




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