/[ascend]/trunk/doc/howto-model1.lyx
ViewVC logotype

Contents of /trunk/doc/howto-model1.lyx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2785 - (show annotations) (download) (as text)
Mon Jun 23 08:17:49 2014 UTC (10 years, 4 months ago) by jpye
File MIME type: application/x-lyx
File size: 90577 byte(s)
updating RPM spec for Fed20
1 #LyX 2.1 created this file. For more info see http://www.lyx.org/
2 \lyxformat 474
3 \begin_document
4 \begin_header
5 \textclass book
6 \begin_preamble
7 \usepackage[bookmarks,bookmarksnumbered=true]{hyperref}
8 \usepackage{lmodern}
9 \usepackage{color}
10 \definecolor{darkred}{rgb}{0.55,0,0}
11 \definecolor{darkgreen}{rgb}{0,0.55,0}
12
13 \usepackage{listings}
14
15 \lstdefinelanguage{ascend}{
16 morekeywords=[1]{
17 REQUIRE,IMPORT,NOTES,
18 ATOM,MODEL,METHOD,METHODS,
19 UNIVERSAL,CONSTANT,DIMENSION,DEFAULT,
20 END,FOR,CREATE,DO,EXTERNAL,
21 CONDITIONAL,SATISFIED,WHEN,CASE,OTHERWISE,TRUE,
22 FALSE,SELF,
23 },
24 morekeywords=[2]{
25 REFINES,IS_A,WILL_BE,ALIASES,INPUT,OUTPUT,DATA,
26 FIX,FREE,RUN,ARE_THE_SAME
27 },
28 morekeywords=[3]{
29 solver_var,integer_constant
30 },
31 sensitive=true,
32 morecomment=[s][\color{blue}]{(*}{*)},
33 morestring=[b][\color{darkgreen}]',
34 morestring=[b][\color{darkgreen}]",
35 morecomment=[s][\color{darkgreen}]{\{}{\}},
36 }
37
38 \lstnewenvironment{ascend}
39 {\lstset{basicstyle=\ttfamily\small, keywordstyle=\color{darkred}}}
40 {}
41
42 \lstdefinestyle{ascendlisting}{
43 style=ascendlisting,
44 basicstyle=\small\ttfamily,
45 numbers=left,
46 numbersep=5pt,
47 numberstyle=\tiny,
48 escapeinside={(*@}{@*)}
49 backgroundcolor=\color{lightgrey}
50 }
51 \end_preamble
52 \use_default_options false
53 \maintain_unincluded_children false
54 \language english
55 \language_package default
56 \inputencoding auto
57 \fontencoding global
58 \font_roman default
59 \font_sans default
60 \font_typewriter default
61 \font_math auto
62 \font_default_family default
63 \use_non_tex_fonts false
64 \font_sc false
65 \font_osf false
66 \font_sf_scale 100
67 \font_tt_scale 100
68 \graphics default
69 \default_output_format default
70 \output_sync 0
71 \bibtex_command default
72 \index_command default
73 \paperfontsize default
74 \spacing single
75 \use_hyperref false
76 \papersize a4paper
77 \use_geometry false
78 \use_package amsmath 2
79 \use_package amssymb 2
80 \use_package cancel 1
81 \use_package esint 0
82 \use_package mathdots 0
83 \use_package mathtools 1
84 \use_package mhchem 0
85 \use_package stackrel 1
86 \use_package stmaryrd 1
87 \use_package undertilde 1
88 \cite_engine basic
89 \cite_engine_type default
90 \biblio_style plain
91 \use_bibtopic false
92 \use_indices false
93 \paperorientation portrait
94 \suppress_date false
95 \justification true
96 \use_refstyle 0
97 \index Index
98 \shortcut idx
99 \color #008000
100 \end_index
101 \secnumdepth 3
102 \tocdepth 3
103 \paragraph_separation indent
104 \paragraph_indentation default
105 \quotes_language english
106 \papercolumns 1
107 \papersides 2
108 \paperpagestyle default
109 \tracking_changes false
110 \output_changes false
111 \html_math_output 0
112 \html_css_as_file 0
113 \html_be_strict false
114 \end_header
115
116 \begin_body
117
118 \begin_layout Chapter
119 Vessel Model for Beginners
120 \begin_inset CommandInset label
121 LatexCommand label
122 name "cha:model1"
123
124 \end_inset
125
126
127 \end_layout
128
129 \begin_layout Standard
130 You read our propaganda about the ASCEND system in which we said it was
131 to help technical people create hard models.
132 We said you can tackle really large models -- 100,000 equations, compiling
133 and solving them in minutes on a PC.
134 We also pointed out that you can readily solve the small problems many
135 currently solve using a spreadsheet, only once posed you can solve them
136 inside out, upside down and backwards.
137
138 \end_layout
139
140 \begin_layout Standard
141 This sounded intriguing so you downloaded the system and installed it.
142 Hopefully, this proved quite straight forward.
143 You double-clicked the ASCEND icon on your desktop and started it up for
144 the first time.
145 Four windows opened up.
146 You panicked.
147
148 \end_layout
149
150 \begin_layout Standard
151 Who wouldn't?
152 \end_layout
153
154 \begin_layout Standard
155 To use this system properly requires that you learn how to use it.
156 If you pay the price to do so - and we hope it is not a large price, then
157 we believe you will find the tools we have provided to help you create
158 and debug models will pay you back handsomely.
159
160 \end_layout
161
162 \begin_layout Standard
163 This chapter
164 \noun off
165 and the next two chapters (
166 \noun default
167 Chapter
168 \noun off
169
170 \begin_inset CommandInset ref
171 LatexCommand ref
172 reference "cha:model2"
173
174 \end_inset
175
176 and
177 \noun default
178 Chapter
179 \noun off
180
181 \begin_inset CommandInset ref
182 LatexCommand ref
183 reference "cha:model3"
184
185 \end_inset
186
187 )
188 \noun default
189
190 \noun off
191 are meant to be a good first step along the path to learning how to use
192 ASCEND.
193 We
194 \noun default
195 will
196 \noun off
197 lead you through the steps for creating and testing a simple model.
198 You will also learn how to improve this model so it may be more readily
199 shared with others.
200 We will present our reasons for the steps we take.
201 We
202 \noun default
203 will
204 \noun off
205 show you all the buttons you should push as you proceed.
206 \end_layout
207
208 \begin_layout Standard
209 We strongly suggest you put time aside and go through all three of these
210 early chapters to introduce yourself to ASCEND.
211 It should take you about two to three hours.
212 The second chapter is particularly important if you wish to understand
213 our approach to good modeling practices.
214 \end_layout
215
216 \begin_layout Standard
217 \begin_inset Marginal
218 status collapsed
219
220 \begin_layout Plain Layout
221 the problem
222 \end_layout
223
224 \end_inset
225
226 Step 1:
227 \emph on
228 We are going to create and test an ASCEND model to compute, the mass of
229 the metal in the sides and ends of the thin-walled cylindrical vessel
230 \emph default
231
232 \begin_inset Index idx
233 status collapsed
234
235 \begin_layout Plain Layout
236 vessel
237 \end_layout
238
239 \end_inset
240
241
242 \emph on
243 shown in Figure
244 \begin_inset CommandInset ref
245 LatexCommand ref
246 reference "fig:model1.thinWalledVessel"
247
248 \end_inset
249
250 .
251
252 \end_layout
253
254 \begin_layout Standard
255 \begin_inset Float figure
256 wide false
257 sideways false
258 status open
259
260 \begin_layout Plain Layout
261
262 \noun off
263 \begin_inset space ~
264 \end_inset
265
266
267 \begin_inset space ~
268 \end_inset
269
270
271 \begin_inset space ~
272 \end_inset
273
274
275 \begin_inset space ~
276 \end_inset
277
278
279 \begin_inset space ~
280 \end_inset
281
282
283 \begin_inset space ~
284 \end_inset
285
286
287 \begin_inset space ~
288 \end_inset
289
290
291 \begin_inset space ~
292 \end_inset
293
294
295 \begin_inset space ~
296 \end_inset
297
298
299 \begin_inset space ~
300 \end_inset
301
302
303 \begin_inset space ~
304 \end_inset
305
306
307 \begin_inset space ~
308 \end_inset
309
310
311 \begin_inset space ~
312 \end_inset
313
314
315 \begin_inset space ~
316 \end_inset
317
318
319 \begin_inset space ~
320 \end_inset
321
322
323 \begin_inset space ~
324 \end_inset
325
326
327 \begin_inset space ~
328 \end_inset
329
330
331 \begin_inset space ~
332 \end_inset
333
334
335 \begin_inset space ~
336 \end_inset
337
338
339 \begin_inset space ~
340 \end_inset
341
342
343 \begin_inset space ~
344 \end_inset
345
346
347 \begin_inset space ~
348 \end_inset
349
350
351 \begin_inset space ~
352 \end_inset
353
354
355 \begin_inset space ~
356 \end_inset
357
358
359 \begin_inset space ~
360 \end_inset
361
362
363 \begin_inset space ~
364 \end_inset
365
366
367 \begin_inset space ~
368 \end_inset
369
370
371 \begin_inset space ~
372 \end_inset
373
374
375 \begin_inset space ~
376 \end_inset
377
378
379 \begin_inset space ~
380 \end_inset
381
382
383 \begin_inset space ~
384 \end_inset
385
386
387 \begin_inset space ~
388 \end_inset
389
390
391 \begin_inset Graphics
392 filename howto-model1Fig1.eps
393 BoundingBox 0bp 0bp 280bp 260bp
394
395 \end_inset
396
397
398 \end_layout
399
400 \begin_layout Plain Layout
401 \begin_inset Caption Standard
402
403 \begin_layout Plain Layout
404 A thin-walled cylindrical vessel with flat ends
405 \begin_inset CommandInset label
406 LatexCommand label
407 name "fig:model1.thinWalledVessel"
408
409 \end_inset
410
411
412 \end_layout
413
414 \end_inset
415
416
417 \end_layout
418
419 \end_inset
420
421
422 \end_layout
423
424 \begin_layout Standard
425 Step 2:
426 \emph on
427 This model is to become a part of a library of models which others can use
428 in the future.
429 You must document it.
430 You must add methods to it to make it easy for others to make it well-posed.
431 You should probably parameterize it, and finally you must create a script
432 which anyone can easily run that solves an example problem to illustrate
433 its use.
434 \end_layout
435
436 \begin_layout Standard
437 \begin_inset Marginal
438 status collapsed
439
440 \begin_layout Plain Layout
441 topics covered
442 \end_layout
443
444 \end_inset
445
446 Topics covered in this and the following two chapters are:
447 \end_layout
448
449 \begin_layout Itemize
450 \begin_inset Marginal
451 status collapsed
452
453 \begin_layout Plain Layout
454 T
455 \noun off
456 his chapter)
457 \end_layout
458
459 \end_inset
460
461 Converting the word description to an ASCEND model.
462 \end_layout
463
464 \begin_layout Itemize
465 Loading the model into ASCEND, dealing with the error messages.
466 \end_layout
467
468 \begin_layout Itemize
469 Compiling the model.
470 \end_layout
471
472 \begin_layout Itemize
473 Browsing the model to see if it looks right
474 \end_layout
475
476 \begin_layout Itemize
477 Solving the model.
478 \end_layout
479
480 \begin_layout Itemize
481 Examining the results.
482 \end_layout
483
484 \begin_layout Itemize
485 More thoroughly testing the model.
486 \end_layout
487
488 \begin_layout Itemize
489 \begin_inset Marginal
490 status collapsed
491
492 \begin_layout Plain Layout
493 Chapter
494 \begin_inset space ~
495 \end_inset
496
497
498 \begin_inset CommandInset ref
499 LatexCommand vref
500 reference "cha:model2"
501
502 \end_inset
503
504
505 \end_layout
506
507 \end_inset
508
509 Converting the model to a more reusable form by adding methods to it and
510 by parameterizing it.
511 \end_layout
512
513 \begin_layout Itemize
514 Creating a script to load and execute an instance of the model.
515 \end_layout
516
517 \begin_layout Itemize
518 \begin_inset Marginal
519 status collapsed
520
521 \begin_layout Plain Layout
522 Chapter
523 \begin_inset space ~
524 \end_inset
525
526
527 \begin_inset CommandInset ref
528 LatexCommand vref
529 reference "cha:model3"
530
531 \end_inset
532
533
534 \end_layout
535
536 \end_inset
537
538 Creating an array of models.
539 \end_layout
540
541 \begin_layout Itemize
542 Using an existing library model for plotting.
543 \end_layout
544
545 \begin_layout Itemize
546 Creating a case study using the model.
547 \end_layout
548
549 \begin_layout Standard
550 We shall introduce many of the features of the modeling language as well
551 as the use of the interactive interface you use when compiling, debugging,
552 solving and exploring your model.
553 Language features include units conversion, arrays and sets.
554 \end_layout
555
556 \begin_layout Section
557 Converting the word description into an ASCEND model
558 \begin_inset CommandInset label
559 LatexCommand label
560 name "sec:model1.converting-the-word"
561
562 \end_inset
563
564
565 \end_layout
566
567 \begin_layout Standard
568 \begin_inset Marginal
569 status collapsed
570
571 \begin_layout Plain Layout
572 an ASCEND model is a type
573 \begin_inset Index idx
574 status collapsed
575
576 \begin_layout Plain Layout
577 type
578 \end_layout
579
580 \end_inset
581
582 definition
583 \end_layout
584
585 \end_inset
586
587 Every ASCEND model is, in fact, a type definition.
588 To "solve a model," we make an instance
589 \begin_inset Index idx
590 status collapsed
591
592 \begin_layout Plain Layout
593 instance
594 \end_layout
595
596 \end_inset
597
598 of a type and solve the instance.
599 So we shall start by creating a vessel type definition.
600 We will have to create our type definition as a text file using a text
601 editor.
602 (Some simple text editors
603 \begin_inset Index idx
604 status collapsed
605
606 \begin_layout Plain Layout
607 text editors
608 \end_layout
609
610 \end_inset
611
612 include
613 \family typewriter
614 emacs
615 \family default
616
617 \begin_inset Index idx
618 status collapsed
619
620 \begin_layout Plain Layout
621 emacs
622 \end_layout
623
624 \end_inset
625
626 and
627 \family typewriter
628 gedit
629 \begin_inset Index idx
630 status collapsed
631
632 \begin_layout Plain Layout
633 gedit
634 \end_layout
635
636 \end_inset
637
638
639 \family default
640 on Linux, and Notepad
641 \begin_inset Index idx
642 status collapsed
643
644 \begin_layout Plain Layout
645 Notepad
646 \end_layout
647
648 \end_inset
649
650 and TextPad
651 \begin_inset Index idx
652 status collapsed
653
654 \begin_layout Plain Layout
655 TextPad
656 \end_layout
657
658 \end_inset
659
660 on Windows.
661 We shall discuss editors shortly.)
662 \end_layout
663
664 \begin_layout Standard
665 We need first to decide the parts to our model.
666 In this case we know that we need the variables
667 \begin_inset Index idx
668 status collapsed
669
670 \begin_layout Plain Layout
671 variables, vessel
672 \end_layout
673
674 \end_inset
675
676 listed in Table
677 \begin_inset CommandInset ref
678 LatexCommand ref
679 reference "tab:model1.variablesVesselModel"
680
681 \end_inset
682
683
684 \noun off
685 .
686 We readily fill in the first three columns in this table.
687 We shall discuss the entry in the last column in a moment.
688 \end_layout
689
690 \begin_layout Standard
691 \begin_inset Float table
692 wide false
693 sideways false
694 status open
695
696 \begin_layout Plain Layout
697 \begin_inset Caption Standard
698
699 \begin_layout Plain Layout
700 Variables required for model
701 \begin_inset CommandInset label
702 LatexCommand label
703 name "tab:model1.variablesVesselModel"
704
705 \end_inset
706
707
708 \end_layout
709
710 \end_inset
711
712
713 \end_layout
714
715 \begin_layout Plain Layout
716 \begin_inset Tabular
717 <lyxtabular version="3" rows="5" columns="4">
718 <features rotate="0" tabularvalignment="middle">
719 <column alignment="center" valignment="top">
720 <column alignment="center" valignment="top">
721 <column alignment="center" valignment="top">
722 <column alignment="center" valignment="top" width="1in">
723 <row>
724 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
725 \begin_inset Text
726
727 \begin_layout Plain Layout
728 Symbol
729 \end_layout
730
731 \end_inset
732 </cell>
733 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
734 \begin_inset Text
735
736 \begin_layout Plain Layout
737 Meaning
738 \end_layout
739
740 \end_inset
741 </cell>
742 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
743 \begin_inset Text
744
745 \begin_layout Plain Layout
746 Typical Units
747 \end_layout
748
749 \end_inset
750 </cell>
751 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
752 \begin_inset Text
753
754 \begin_layout Plain Layout
755 ASCEND variable type
756 \end_layout
757
758 \end_inset
759 </cell>
760 </row>
761 <row>
762 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
763 \begin_inset Text
764
765 \begin_layout Plain Layout
766
767 \family typewriter
768 D
769 \end_layout
770
771 \end_inset
772 </cell>
773 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
774 \begin_inset Text
775
776 \begin_layout Plain Layout
777 vessel diameter
778 \end_layout
779
780 \end_inset
781 </cell>
782 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
783 \begin_inset Text
784
785 \begin_layout Plain Layout
786 m, ft
787 \end_layout
788
789 \end_inset
790 </cell>
791 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
792 \begin_inset Text
793
794 \begin_layout Plain Layout
795
796 \family typewriter
797 length
798 \end_layout
799
800 \end_inset
801 </cell>
802 </row>
803 <row>
804 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
805 \begin_inset Text
806
807 \begin_layout Plain Layout
808
809 \family typewriter
810 H
811 \end_layout
812
813 \end_inset
814 </cell>
815 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
816 \begin_inset Text
817
818 \begin_layout Plain Layout
819 vessel height
820 \end_layout
821
822 \end_inset
823 </cell>
824 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
825 \begin_inset Text
826
827 \begin_layout Plain Layout
828 m, ft
829 \end_layout
830
831 \end_inset
832 </cell>
833 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
834 \begin_inset Text
835
836 \begin_layout Plain Layout
837
838 \family typewriter
839 length
840 \end_layout
841
842 \end_inset
843 </cell>
844 </row>
845 <row>
846 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
847 \begin_inset Text
848
849 \begin_layout Plain Layout
850
851 \family typewriter
852 wall_thickness
853 \end_layout
854
855 \end_inset
856 </cell>
857 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
858 \begin_inset Text
859
860 \begin_layout Plain Layout
861 wall thickness
862 \end_layout
863
864 \end_inset
865 </cell>
866 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
867 \begin_inset Text
868
869 \begin_layout Plain Layout
870 mm, in
871 \end_layout
872
873 \end_inset
874 </cell>
875 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
876 \begin_inset Text
877
878 \begin_layout Plain Layout
879
880 \family typewriter
881 length
882 \end_layout
883
884 \end_inset
885 </cell>
886 </row>
887 <row>
888 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
889 \begin_inset Text
890
891 \begin_layout Plain Layout
892
893 \family typewriter
894 metal_density
895 \end_layout
896
897 \end_inset
898 </cell>
899 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
900 \begin_inset Text
901
902 \begin_layout Plain Layout
903 metal density
904 \end_layout
905
906 \end_inset
907 </cell>
908 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
909 \begin_inset Text
910
911 \begin_layout Plain Layout
912 kg/m
913 \begin_inset Formula $^{\textrm{3}}$
914 \end_inset
915
916 , lbm/ft
917 \begin_inset Formula $^{\textrm{3}}$
918 \end_inset
919
920
921 \end_layout
922
923 \end_inset
924 </cell>
925 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
926 \begin_inset Text
927
928 \begin_layout Plain Layout
929
930 \family typewriter
931 mass_density
932 \end_layout
933
934 \end_inset
935 </cell>
936 </row>
937 </lyxtabular>
938
939 \end_inset
940
941
942 \end_layout
943
944 \end_inset
945
946
947 \end_layout
948
949 \begin_layout Standard
950 We will be computing the masses for the metal in the side wall and in the
951 ends for this vessel.
952 As this is a thin-walled vessel, we shall compute the volume of metal as
953 the area of the walls times the wall thickness.
954 The following equations allow us to compute the required areas
955 \end_layout
956
957 \begin_layout Standard
958 \begin_inset Formula
959 \begin{equation}
960 \mathrm{side\, wall\, area}=\pi DH\label{eq:model1.side-wall-area}
961 \end{equation}
962
963 \end_inset
964
965
966 \end_layout
967
968 \begin_layout Standard
969 \begin_inset Formula
970 \begin{equation}
971 \mathrm{single\, end\, area}=\frac{\pi D^{2}}{4}\label{eq:model1.single-end-area}
972 \end{equation}
973
974 \end_inset
975
976
977 \end_layout
978
979 \begin_layout Standard
980 We should be interested in the volume of the vessel, which we compute as:
981 \end_layout
982
983 \begin_layout Standard
984 \begin_inset Formula
985 \begin{equation}
986 \mathrm{vessel\, volume}=\mathrm{single\, end\, area}\times H\label{eq:model1.vessel-volume}
987 \end{equation}
988
989 \end_inset
990
991
992 \end_layout
993
994 \begin_layout Standard
995 We add the variables in Table
996 \begin_inset CommandInset ref
997 LatexCommand ref
998 reference "tab:model1.moreVariablesVessel"
999
1000 \end_inset
1001
1002
1003 \noun off
1004 to our list.
1005 \end_layout
1006
1007 \begin_layout Standard
1008 \begin_inset Float table
1009 wide false
1010 sideways false
1011 status open
1012
1013 \begin_layout Plain Layout
1014 \begin_inset Caption Standard
1015
1016 \begin_layout Plain Layout
1017 Some more variables
1018 \begin_inset Index idx
1019 status collapsed
1020
1021 \begin_layout Plain Layout
1022 variables, vessel
1023 \end_layout
1024
1025 \end_inset
1026
1027 required for vessel model
1028 \begin_inset CommandInset label
1029 LatexCommand label
1030 name "tab:model1.moreVariablesVessel"
1031
1032 \end_inset
1033
1034
1035 \end_layout
1036
1037 \end_inset
1038
1039
1040 \end_layout
1041
1042 \begin_layout Plain Layout
1043 \begin_inset Tabular
1044 <lyxtabular version="3" rows="6" columns="4">
1045 <features rotate="0" tabularvalignment="middle">
1046 <column alignment="center" valignment="top">
1047 <column alignment="center" valignment="top" width="1.5in">
1048 <column alignment="center" valignment="top">
1049 <column alignment="center" valignment="top" width="1in">
1050 <row>
1051 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1052 \begin_inset Text
1053
1054 \begin_layout Plain Layout
1055 Symbol
1056 \end_layout
1057
1058 \end_inset
1059 </cell>
1060 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1061 \begin_inset Text
1062
1063 \begin_layout Plain Layout
1064 Meaning
1065 \end_layout
1066
1067 \end_inset
1068 </cell>
1069 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1070 \begin_inset Text
1071
1072 \begin_layout Plain Layout
1073 Typical Units
1074 \end_layout
1075
1076 \end_inset
1077 </cell>
1078 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1079 \begin_inset Text
1080
1081 \begin_layout Plain Layout
1082 ASCEND variable type
1083 \end_layout
1084
1085 \end_inset
1086 </cell>
1087 </row>
1088 <row>
1089 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1090 \begin_inset Text
1091
1092 \begin_layout Plain Layout
1093
1094 \family typewriter
1095 side_area
1096 \end_layout
1097
1098 \end_inset
1099 </cell>
1100 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1101 \begin_inset Text
1102
1103 \begin_layout Plain Layout
1104 area in the sidewall of the vessel
1105 \end_layout
1106
1107 \end_inset
1108 </cell>
1109 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1110 \begin_inset Text
1111
1112 \begin_layout Plain Layout
1113 m
1114 \begin_inset Formula $^{\textrm{2}}$
1115 \end_inset
1116
1117 , ft
1118 \begin_inset Formula $^{\textrm{2}}$
1119 \end_inset
1120
1121
1122 \end_layout
1123
1124 \end_inset
1125 </cell>
1126 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1127 \begin_inset Text
1128
1129 \begin_layout Plain Layout
1130
1131 \family typewriter
1132 area
1133 \end_layout
1134
1135 \end_inset
1136 </cell>
1137 </row>
1138 <row>
1139 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1140 \begin_inset Text
1141
1142 \begin_layout Plain Layout
1143
1144 \family typewriter
1145 end_area
1146 \end_layout
1147
1148 \end_inset
1149 </cell>
1150 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1151 \begin_inset Text
1152
1153 \begin_layout Plain Layout
1154 total area iin the ends of the vessel
1155 \end_layout
1156
1157 \end_inset
1158 </cell>
1159 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1160 \begin_inset Text
1161
1162 \begin_layout Plain Layout
1163 m
1164 \begin_inset Formula $^{\textrm{2}}$
1165 \end_inset
1166
1167 , ft
1168 \begin_inset Formula $^{\textrm{2}}$
1169 \end_inset
1170
1171
1172 \end_layout
1173
1174 \end_inset
1175 </cell>
1176 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1177 \begin_inset Text
1178
1179 \begin_layout Plain Layout
1180
1181 \family typewriter
1182 area
1183 \end_layout
1184
1185 \end_inset
1186 </cell>
1187 </row>
1188 <row>
1189 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1190 \begin_inset Text
1191
1192 \begin_layout Plain Layout
1193
1194 \family typewriter
1195 vessel_volume
1196 \end_layout
1197
1198 \end_inset
1199 </cell>
1200 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1201 \begin_inset Text
1202
1203 \begin_layout Plain Layout
1204 volume of the vessel
1205 \end_layout
1206
1207 \end_inset
1208 </cell>
1209 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1210 \begin_inset Text
1211
1212 \begin_layout Plain Layout
1213 m
1214 \begin_inset Formula $^{3}$
1215 \end_inset
1216
1217 , ft
1218 \begin_inset Formula $^{\textrm{3}}$
1219 \end_inset
1220
1221
1222 \end_layout
1223
1224 \end_inset
1225 </cell>
1226 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1227 \begin_inset Text
1228
1229 \begin_layout Plain Layout
1230
1231 \family typewriter
1232 volume
1233 \end_layout
1234
1235 \end_inset
1236 </cell>
1237 </row>
1238 <row>
1239 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1240 \begin_inset Text
1241
1242 \begin_layout Plain Layout
1243
1244 \family typewriter
1245 metal_volume
1246 \end_layout
1247
1248 \end_inset
1249 </cell>
1250 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1251 \begin_inset Text
1252
1253 \begin_layout Plain Layout
1254 total volume of metal in the walls
1255 \end_layout
1256
1257 \end_inset
1258 </cell>
1259 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1260 \begin_inset Text
1261
1262 \begin_layout Plain Layout
1263 m
1264 \begin_inset Formula $^{3}$
1265 \end_inset
1266
1267 , ft
1268 \begin_inset Formula $^{\textrm{3}}$
1269 \end_inset
1270
1271
1272 \end_layout
1273
1274 \end_inset
1275 </cell>
1276 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1277 \begin_inset Text
1278
1279 \begin_layout Plain Layout
1280
1281 \family typewriter
1282 volume
1283 \end_layout
1284
1285 \end_inset
1286 </cell>
1287 </row>
1288 <row>
1289 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1290 \begin_inset Text
1291
1292 \begin_layout Plain Layout
1293
1294 \family typewriter
1295 metal_mass
1296 \end_layout
1297
1298 \end_inset
1299 </cell>
1300 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1301 \begin_inset Text
1302
1303 \begin_layout Plain Layout
1304 total mass of the metal in the walls of the vessel
1305 \end_layout
1306
1307 \end_inset
1308 </cell>
1309 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1310 \begin_inset Text
1311
1312 \begin_layout Plain Layout
1313 kg, lbm
1314 \end_layout
1315
1316 \end_inset
1317 </cell>
1318 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1319 \begin_inset Text
1320
1321 \begin_layout Plain Layout
1322
1323 \family typewriter
1324 mass
1325 \end_layout
1326
1327 \end_inset
1328 </cell>
1329 </row>
1330 </lyxtabular>
1331
1332 \end_inset
1333
1334
1335 \end_layout
1336
1337 \end_inset
1338
1339
1340 \end_layout
1341
1342 \begin_layout Standard
1343 We believe that no one should create a model of any consequence without
1344 worrying about the units for expressing the variables within it.
1345 We consider that to be a commandment handed down from somewhere on high;
1346 however, we know that others do not believe as we do.
1347 Grant us our beliefs.
1348 We have created in the ASCEND system a library of variable and constant
1349 types called atoms.a4l
1350 \begin_inset Index idx
1351 status collapsed
1352
1353 \begin_layout Plain Layout
1354 atoms.a4l
1355 \end_layout
1356
1357 \end_inset
1358
1359 .
1360 \end_layout
1361
1362 \begin_layout Standard
1363 The file type "
1364 \family typewriter
1365 .a4l
1366 \begin_inset Index idx
1367 status collapsed
1368
1369 \begin_layout Plain Layout
1370 a4l
1371 \end_layout
1372
1373 \end_inset
1374
1375
1376 \family default
1377 " designates it to be an ASCEND IV library file
1378 \begin_inset Index idx
1379 status collapsed
1380
1381 \begin_layout Plain Layout
1382 library file
1383 \end_layout
1384
1385 \end_inset
1386
1387 .
1388 Double-click on this link to see the approximately 150 different types
1389 ranging from universal constants
1390 \begin_inset Index idx
1391 status collapsed
1392
1393 \begin_layout Plain Layout
1394 universal constants
1395 \end_layout
1396
1397 \end_inset
1398
1399 such as
1400 \begin_inset Formula $\pi$
1401 \end_inset
1402
1403 (=3.14159...) and
1404 \begin_inset Formula $e$
1405 \end_inset
1406
1407 (=2.718...) to
1408 \family typewriter
1409 length
1410 \family default
1411 ,
1412 \family typewriter
1413 mass
1414 \family default
1415 and
1416 \family typewriter
1417 angle
1418 \family default
1419 .
1420 If we have not created one that you need, you can use this library of types
1421 to see how to construct one for yourself and add it to your file of type
1422 definitions.
1423 You will find detailed instructions for how to make your own variable type
1424 library in Chapter
1425 \begin_inset space ~
1426 \end_inset
1427
1428
1429 \begin_inset CommandInset ref
1430 LatexCommand vref
1431 reference "cha:atoms"
1432
1433 \end_inset
1434
1435 .
1436 \end_layout
1437
1438 \begin_layout Standard
1439 \begin_inset Marginal
1440 status collapsed
1441
1442 \begin_layout Plain Layout
1443 type definition library for variables and constants
1444 \end_layout
1445
1446 \end_inset
1447
1448 ASCEND considers variable and constant types to be elementary or "atomic"
1449 to the system.
1450 These type definitions can contain only attributes for variables and constants.
1451 They cannot contain equations, for example.
1452 Thus ASCEND calls such a type definition an atom rather than a model.
1453 Figure
1454 \begin_inset CommandInset ref
1455 LatexCommand ref
1456 reference "fig:model1.atomVolume"
1457
1458 \end_inset
1459
1460
1461 \noun off
1462 illustrates the definition for the type volume.
1463
1464 \end_layout
1465
1466 \begin_layout Standard
1467 \begin_inset Float figure
1468 wide false
1469 sideways false
1470 status open
1471
1472 \begin_layout Plain Layout
1473 \begin_inset Index idx
1474 status collapsed
1475
1476 \begin_layout Plain Layout
1477 ATOM
1478 \end_layout
1479
1480 \end_inset
1481
1482
1483 \begin_inset ERT
1484 status open
1485
1486 \begin_layout Plain Layout
1487
1488
1489 \backslash
1490 lstset{language=ASCEND}
1491 \end_layout
1492
1493 \begin_layout Plain Layout
1494
1495
1496 \backslash
1497 begin{lstlisting}
1498 \end_layout
1499
1500 \begin_layout Plain Layout
1501
1502 ATOM volume REFINES solver_var
1503 \end_layout
1504
1505 \begin_layout Plain Layout
1506
1507 DIMENSION L^3
1508 \end_layout
1509
1510 \begin_layout Plain Layout
1511
1512 DEFAULT 100.0{ft^3};
1513 \end_layout
1514
1515 \begin_layout Plain Layout
1516
1517 lower_bound := 0.0{ft^3};
1518 \end_layout
1519
1520 \begin_layout Plain Layout
1521
1522 upper_bound := 1e50{ft^3};
1523 \end_layout
1524
1525 \begin_layout Plain Layout
1526
1527 nominal := 100.0{ft^3};
1528 \end_layout
1529
1530 \begin_layout Plain Layout
1531
1532 END volume;
1533 \end_layout
1534
1535 \begin_layout Plain Layout
1536
1537
1538 \backslash
1539 end{lstlisting}
1540 \end_layout
1541
1542 \begin_layout Plain Layout
1543
1544 \end_layout
1545
1546 \end_inset
1547
1548
1549 \end_layout
1550
1551 \begin_layout Plain Layout
1552 \begin_inset Caption Standard
1553
1554 \begin_layout Plain Layout
1555 A typical type definition, called an atom, used to define variable and constant
1556 types
1557 \begin_inset CommandInset label
1558 LatexCommand label
1559 name "fig:model1.atomVolume"
1560
1561 \end_inset
1562
1563
1564 \end_layout
1565
1566 \end_inset
1567
1568
1569 \end_layout
1570
1571 \end_inset
1572
1573
1574 \end_layout
1575
1576 \begin_layout Standard
1577 The definition starts by stating that volume is a specialization of
1578 \begin_inset Index idx
1579 status collapsed
1580
1581 \begin_layout Plain Layout
1582 solver
1583 \begin_inset ERT
1584 status collapsed
1585
1586 \begin_layout Plain Layout
1587
1588
1589 \backslash
1590 _
1591 \end_layout
1592
1593 \end_inset
1594
1595 var
1596 \end_layout
1597
1598 \end_inset
1599
1600
1601 \family typewriter
1602 solver_var
1603 \family default
1604 .
1605 The type
1606 \family typewriter
1607 solver_var
1608 \family default
1609 refines a base type in the system known as
1610 \family typewriter
1611 real
1612 \family default
1613
1614 \begin_inset Index idx
1615 status collapsed
1616
1617 \begin_layout Plain Layout
1618 real
1619 \end_layout
1620
1621 \end_inset
1622
1623 and adds several attributes to it that a nonlinear equation solver may
1624 need, such as a lower and upper bounds, a 'fixed' flag, and so forth.
1625
1626 \end_layout
1627
1628 \begin_layout Standard
1629 \begin_inset Marginal
1630 status collapsed
1631
1632 \begin_layout Plain Layout
1633 dimensions
1634 \begin_inset Index idx
1635 status collapsed
1636
1637 \begin_layout Plain Layout
1638 dimensions
1639 \end_layout
1640
1641 \end_inset
1642
1643 and units
1644 \begin_inset Index idx
1645 status collapsed
1646
1647 \begin_layout Plain Layout
1648 units
1649 \end_layout
1650
1651 \end_inset
1652
1653 in ASCEND.
1654
1655 \end_layout
1656
1657 \end_inset
1658
1659 The type definition for volume states that volume has dimensionality of
1660 length to the power 3 (
1661 \family typewriter
1662 L^3
1663 \family default
1664 ) where L is one of the 10 dimensions supported by ASCEND (see
1665 \noun off
1666 in ASCEND Syntax document for the 10 dimensions defined within the ASCEND
1667 language).
1668 \end_layout
1669
1670 \begin_layout Standard
1671 One may express the value for a volume using any units which are consistent
1672 with the dimensionality of
1673 \family typewriter
1674 L^3
1675 \family default
1676 , such as
1677 \family typewriter
1678 {ft^3}
1679 \family default
1680 ,
1681 \family typewriter
1682 {m^3}
1683 \family default
1684 ,
1685 \family typewriter
1686 {gal}
1687 \family default
1688 , or even
1689 \family typewriter
1690 {mile^4/mm}
1691 \family default
1692 .
1693 Setting the lower bound to
1694 \family typewriter
1695 0 {ft^3}
1696 \family default
1697 says volume must be a nonnegative number.
1698 ASCEND used the nominal value for scaling a variable of type volume when
1699 solving, here
1700 \begin_inset Formula $100\,\mathrm{ft}^{3}$
1701 \end_inset
1702
1703 .
1704 \end_layout
1705
1706 \begin_layout Standard
1707 One may change the values for the bounds, default and nominal values at
1708 any time.
1709 \end_layout
1710
1711 \begin_layout Standard
1712 We now can understand the last column in Table
1713 \begin_inset CommandInset ref
1714 LatexCommand ref
1715 reference "tab:model1.variablesVesselModel"
1716
1717 \end_inset
1718
1719
1720 \noun off
1721 and
1722 \noun default
1723 Table
1724 \noun off
1725
1726 \begin_inset CommandInset ref
1727 LatexCommand ref
1728 reference "tab:model1.moreVariablesVessel"
1729
1730 \end_inset
1731
1732 .
1733 For each variable or constant in the system, we have identified its type
1734 in the file
1735 \family typewriter
1736 \noun default
1737 atoms.a4l
1738 \family default
1739 \noun off
1740 .
1741 That is, we looked in this file for the type definition that corresponded
1742 to the variable we were defining and listed that type here.
1743 This task is not as onerous as it seems.
1744 As we shall see later, we provide a tool to find for you all atom types
1745 that correspond to a particular set of units, e.g,
1746 \family typewriter
1747 \noun default
1748 ft^3
1749 \family default
1750 \noun off
1751 -- i.e., the computer will do the searching for you.
1752 \end_layout
1753
1754 \begin_layout Standard
1755 In Figure
1756 \begin_inset CommandInset ref
1757 LatexCommand ref
1758 reference "fig:model1.universalConstant"
1759
1760 \end_inset
1761
1762
1763 \noun off
1764 we see the definition of one of the universal constants contained in
1765 \family typewriter
1766 \noun default
1767 atoms.a4l
1768 \family default
1769 \noun off
1770 .
1771 This definition is very short; it gives the name of the type
1772 \family typewriter
1773 \noun default
1774 circle_constant
1775 \family default
1776 \noun off
1777
1778 \begin_inset Index idx
1779 status collapsed
1780
1781 \begin_layout Plain Layout
1782 circle
1783 \begin_inset ERT
1784 status collapsed
1785
1786 \begin_layout Plain Layout
1787
1788
1789 \backslash
1790 _
1791 \end_layout
1792
1793 \end_inset
1794
1795 constant
1796 \end_layout
1797
1798 \end_inset
1799
1800 , that it refines
1801 \family typewriter
1802 \noun default
1803 real_constant
1804 \family default
1805 \noun off
1806
1807 \begin_inset Index idx
1808 status collapsed
1809
1810 \begin_layout Plain Layout
1811 real
1812 \begin_inset ERT
1813 status collapsed
1814
1815 \begin_layout Plain Layout
1816
1817
1818 \backslash
1819 _
1820 \end_layout
1821
1822 \end_inset
1823
1824 constant
1825 \end_layout
1826
1827 \end_inset
1828
1829 and that it has the value
1830 \family typewriter
1831 \noun default
1832 1 {PI
1833 \begin_inset Index idx
1834 status collapsed
1835
1836 \begin_layout Plain Layout
1837 PI
1838 \end_layout
1839
1840 \end_inset
1841
1842 }
1843 \family default
1844 \noun off
1845
1846 \begin_inset Index idx
1847 status collapsed
1848
1849 \begin_layout Plain Layout
1850 \begin_inset ERT
1851 status collapsed
1852
1853 \begin_layout Plain Layout
1854
1855
1856 \backslash
1857 {
1858 \end_layout
1859
1860 \end_inset
1861
1862 PI
1863 \begin_inset ERT
1864 status collapsed
1865
1866 \begin_layout Plain Layout
1867
1868
1869 \backslash
1870 }
1871 \end_layout
1872
1873 \end_inset
1874
1875
1876 \end_layout
1877
1878 \end_inset
1879
1880 where the internal conversion needed for
1881 \family typewriter
1882 \noun default
1883 {PI}
1884 \family default
1885 \noun off
1886 is defined in the file defining the built-in units in ASCEND.
1887 One can add more units if desired at any time to ASCEND by defining one
1888 or more personal units files (
1889 \noun default
1890 Chapter
1891 \noun off
1892
1893 \begin_inset CommandInset ref
1894 LatexCommand vref
1895 reference "cha:units"
1896
1897 \end_inset
1898
1899
1900 \noun default
1901
1902 \noun off
1903 tells you how to do this).
1904 \end_layout
1905
1906 \begin_layout Standard
1907 \begin_inset Marginal
1908 status collapsed
1909
1910 \begin_layout Plain Layout
1911 universal constant
1912 \begin_inset Index idx
1913 status collapsed
1914
1915 \begin_layout Plain Layout
1916 universal constant
1917 \end_layout
1918
1919 \end_inset
1920
1921 definition
1922 \end_layout
1923
1924 \end_inset
1925
1926
1927 \begin_inset Float figure
1928 wide false
1929 sideways false
1930 status open
1931
1932 \begin_layout LyX-Code
1933 \begin_inset ERT
1934 status open
1935
1936 \begin_layout Plain Layout
1937
1938
1939 \backslash
1940 begin{ascend}
1941 \end_layout
1942
1943 \begin_layout Plain Layout
1944
1945 UNIVERSAL CONSTANT circle_constant
1946 \end_layout
1947
1948 \begin_layout Plain Layout
1949
1950 REFINES real_constant :== 1{PI};
1951 \end_layout
1952
1953 \begin_layout Plain Layout
1954
1955
1956 \backslash
1957 end{ascend}
1958 \end_layout
1959
1960 \end_inset
1961
1962
1963 \end_layout
1964
1965 \begin_layout Plain Layout
1966 \begin_inset Caption Standard
1967
1968 \begin_layout Plain Layout
1969 \begin_inset CommandInset label
1970 LatexCommand label
1971 name "fig:model1.universalConstant"
1972
1973 \end_inset
1974
1975 Type definition for
1976 \family typewriter
1977 circle_constant;
1978 \family default
1979 has value of
1980 \family typewriter
1981 1 {PI}
1982 \family default
1983 or 3.1415927
1984 \end_layout
1985
1986 \end_inset
1987
1988
1989 \end_layout
1990
1991 \end_inset
1992
1993
1994 \end_layout
1995
1996 \begin_layout Standard
1997 We shall in fact find this constant useful in our program, and we can either
1998 introduce a constant with this value or simply use the value
1999 \family typewriter
2000 1{PI}
2001 \family default
2002 in our program.
2003 We shall choose to do the latter.
2004 \end_layout
2005
2006 \begin_layout Standard
2007 It is time to write our first version for the model, which we do in Figure
2008
2009 \begin_inset CommandInset ref
2010 LatexCommand ref
2011 reference "fig:model1.modelVessel"
2012
2013 \end_inset
2014
2015
2016 \noun off
2017 (
2018 \noun default
2019 available as
2020 \begin_inset Index idx
2021 status collapsed
2022
2023 \begin_layout Plain Layout
2024 vesselPlain.a4c
2025 \end_layout
2026
2027 \end_inset
2028
2029
2030 \family typewriter
2031 vesselPlain.a4c
2032 \family default
2033 in the ASCEND model library).
2034
2035 \noun off
2036 We first list any other files containing type definitions which this model
2037 will use; here we list
2038 \family typewriter
2039 \noun default
2040 "atoms.a4l"
2041 \family default
2042 \noun off
2043 following the keyword
2044 \family typewriter
2045 \noun default
2046 REQUIRE
2047 \family default
2048 \noun off
2049
2050 \begin_inset Index idx
2051 status collapsed
2052
2053 \begin_layout Plain Layout
2054 REQUIRE
2055 \end_layout
2056
2057 \end_inset
2058
2059 .
2060 ASCEND is sensitive to case so pay attention to where we use and do not
2061 use capital letters.
2062 Keywords are always capitalized.
2063 Often for clarification we use capital letters in a name we use for a variable
2064 or label (e.g., we use
2065 \family typewriter
2066 \noun default
2067 D
2068 \family default
2069 \noun off
2070 for diameter rather than
2071 \family typewriter
2072 \noun default
2073 d
2074 \family default
2075 \noun off
2076 ).
2077 Note that all ASCEND statements end with a semicolon (i.e., with
2078 \noun default
2079 '
2080 \family typewriter
2081 ;
2082 \family default
2083 '
2084 \noun off
2085 ) and not at the end of a line and that blank lines have no impact.
2086 Comments are between opening and closing parenthesis/asterisk pairs, i.e.,
2087 '
2088 \family typewriter
2089 \noun default
2090 (*
2091 \family default
2092 \noun off
2093 ' and '
2094 \family typewriter
2095 \noun default
2096 *)
2097 \family default
2098 \noun off
2099 '.
2100 \end_layout
2101
2102 \begin_layout Standard
2103 \begin_inset Marginal
2104 status collapsed
2105
2106 \begin_layout Plain Layout
2107 the first version of the code for vessel
2108 \end_layout
2109
2110 \end_inset
2111
2112
2113 \begin_inset Float figure
2114 wide false
2115 sideways false
2116 status open
2117
2118 \begin_layout LyX-Code
2119 \begin_inset ERT
2120 status open
2121
2122 \begin_layout Plain Layout
2123
2124
2125 \backslash
2126 begin{ascend}
2127 \end_layout
2128
2129 \begin_layout Plain Layout
2130
2131 REQUIRE "atoms.a4l";
2132 \end_layout
2133
2134 \begin_layout Plain Layout
2135
2136 MODEL vessel;
2137 \end_layout
2138
2139 \begin_layout Plain Layout
2140
2141 (* variables *)
2142 \end_layout
2143
2144 \begin_layout Plain Layout
2145
2146 side_area, end_area IS_A area;
2147 \end_layout
2148
2149 \begin_layout Plain Layout
2150
2151 vessel_vol, wall_vol IS_A volume;
2152 \end_layout
2153
2154 \begin_layout Plain Layout
2155
2156 wall_thickness, H, D IS_A distance;
2157 \end_layout
2158
2159 \begin_layout Plain Layout
2160
2161 H_to_D_ratio IS_A factor;
2162 \end_layout
2163
2164 \begin_layout Plain Layout
2165
2166 metal_density IS_A mass_density;
2167 \end_layout
2168
2169 \begin_layout Plain Layout
2170
2171 metal_mass IS_A mass;
2172 \end_layout
2173
2174 \begin_layout Plain Layout
2175
2176 \end_layout
2177
2178 \begin_layout Plain Layout
2179
2180 (* equations *)
2181 \end_layout
2182
2183 \begin_layout Plain Layout
2184
2185 FlatEnds:end_area = 1{PI} * D^2 / 4;
2186 \end_layout
2187
2188 \begin_layout Plain Layout
2189
2190 Sides:side_area = 1{PI} * D * H;
2191 \end_layout
2192
2193 \begin_layout Plain Layout
2194
2195 Cylinder:vessel_vol = end_area * H;
2196 \end_layout
2197
2198 \begin_layout Plain Layout
2199
2200 Metal_volume:(side_area + 2 * end_area) *
2201 \end_layout
2202
2203 \begin_layout Plain Layout
2204
2205 wall_thickness = wall_vol;
2206 \end_layout
2207
2208 \begin_layout Plain Layout
2209
2210 HD_definition:D * H_to_D_ratio = H;
2211 \end_layout
2212
2213 \begin_layout Plain Layout
2214
2215 VesselMass:metal_mass = metal_density * wall_vol;
2216 \end_layout
2217
2218 \begin_layout Plain Layout
2219
2220 END vessel;
2221 \end_layout
2222
2223 \begin_layout Plain Layout
2224
2225
2226 \backslash
2227 end{ascend}
2228 \end_layout
2229
2230 \end_inset
2231
2232
2233 \end_layout
2234
2235 \begin_layout Plain Layout
2236 \begin_inset Caption Standard
2237
2238 \begin_layout Plain Layout
2239 \begin_inset CommandInset label
2240 LatexCommand label
2241 name "fig:model1.modelVessel"
2242
2243 \end_inset
2244
2245 First version of the type definition for
2246 \family typewriter
2247 vessel
2248 \family default
2249 .
2250
2251 \end_layout
2252
2253 \end_inset
2254
2255
2256 \end_layout
2257
2258 \end_inset
2259
2260
2261 \end_layout
2262
2263 \begin_layout Standard
2264 Our model definition has the following structure for it so far:
2265 \end_layout
2266
2267 \begin_layout Itemize
2268
2269 \family typewriter
2270 MODEL
2271 \family default
2272
2273 \begin_inset Index idx
2274 status collapsed
2275
2276 \begin_layout Plain Layout
2277 MODEL
2278 \end_layout
2279
2280 \end_inset
2281
2282 statement
2283 \end_layout
2284
2285 \begin_layout Itemize
2286 list of variable we intend to use in the type definition
2287 \end_layout
2288
2289 \begin_layout Itemize
2290 equations
2291 \end_layout
2292
2293 \begin_layout Itemize
2294
2295 \family typewriter
2296 END
2297 \family default
2298
2299 \begin_inset Index idx
2300 status collapsed
2301
2302 \begin_layout Plain Layout
2303 END
2304 \end_layout
2305
2306 \end_inset
2307
2308 statement
2309 \end_layout
2310
2311 \begin_layout Standard
2312 While we have put the statements in this order, we could mix up and intermix
2313 the middle two types of statements, even going to the extreme of defining
2314 the variables after we first use them.
2315 The
2316 \family typewriter
2317 MODEL
2318 \family default
2319 and
2320 \family typewriter
2321 END
2322 \family default
2323 statements begin and end the type definition.
2324 \end_layout
2325
2326 \begin_layout Standard
2327 You should see little that surprises you in the syntax here.
2328 However, you may have noted that we have created a definition that says
2329 absolutely nothing about how to use the variables and equations listed.
2330 There is no solution procedure buried in this type definition.
2331 In ASCEND the idea of solving is separate from saying what we intend to
2332 solve.
2333 Also note that we have not said anything about the values for any of the
2334 variables nor what we intend to calculate and what variables we intend
2335 to treat as fixed input.
2336 \end_layout
2337
2338 \begin_layout Section
2339 Editing, compiling and browsing an ASCEND model
2340 \end_layout
2341
2342 \begin_layout Standard
2343 Could we compile an instance of a vessel given this definition? If there
2344 had been some arrays in our definition for which we did not say how many
2345 items were in the arrays, we could not.
2346 However, here we could compile an instance, putting aside storage space
2347 for each of the variables and somehow capturing the equations relating
2348 them.
2349 \end_layout
2350
2351 \begin_layout Standard
2352 \begin_inset Marginal
2353 status open
2354
2355 \begin_layout Plain Layout
2356 Do not alter the models subdirectory
2357 \end_layout
2358
2359 \end_inset
2360
2361 When we compile new models, we need a place to store them.
2362 One possibility would be to put them into the
2363 \family typewriter
2364 models
2365 \family default
2366
2367 \begin_inset Index idx
2368 status collapsed
2369
2370 \begin_layout Plain Layout
2371 models
2372 \end_layout
2373
2374 \end_inset
2375
2376 subdirectory of the ASCEND installation
2377 \begin_inset Foot
2378 status collapsed
2379
2380 \begin_layout Plain Layout
2381 On windows this might be
2382 \family typewriter
2383 c:
2384 \backslash
2385 Program File
2386 \backslash
2387 ASCEND
2388 \backslash
2389 models
2390 \family default
2391 .
2392 On Linux, this might be
2393 \family typewriter
2394 /usr/share/ascend/models
2395 \family default
2396 .
2397 The location can vary depending on how you went about installing ASCEND.
2398 \end_layout
2399
2400 \end_inset
2401
2402 .
2403 However, you really should leave the contents of this subdirectory untouched
2404 -- always.
2405 Hopefully the files will be read-only from your user account.
2406 We count on being able to replace the model library totally every time
2407 you install a new version of ASCEND.
2408 Whenever we add new model libraries or corrected versions of previously
2409 existing model libraries, we put them in this subdirectory.
2410 This subdirectory belongs to us (the developers of the system): hands off,
2411 please.
2412 \end_layout
2413
2414 \begin_layout Standard
2415 \begin_inset Marginal
2416 status open
2417
2418 \begin_layout Plain Layout
2419 rather put your things into the ascdata
2420 \begin_inset Index idx
2421 status collapsed
2422
2423 \begin_layout Plain Layout
2424 ascdata
2425 \end_layout
2426
2427 \end_inset
2428
2429 subdirectory (you own it)
2430 \end_layout
2431
2432 \end_inset
2433
2434 To avoid this problem, ASCEND also creates a subdirectory called
2435 \family typewriter
2436 ascdata
2437 \family default
2438 that it will not touch when you install a new version of ASCEND.
2439 It will look in this subdirectory first when looking for a file to load
2440 when you have not given a full path name for finding that file.
2441 The install process for ASCEND will place
2442 \family typewriter
2443 ascdata
2444 \family default
2445 into your home directory
2446 \begin_inset CommandInset ref
2447 LatexCommand ref
2448 reference "id:#id(pgfId-1007944)"
2449
2450 \end_inset
2451
2452
2453 \begin_inset Foot
2454 status collapsed
2455
2456 \begin_layout Plain Layout
2457 On Windows, your home directory will normally be the My Documents folder.
2458 On Linux, it will normally be
2459 \family typewriter
2460 /home/
2461 \emph on
2462 username
2463 \family default
2464 \emph default
2465 .
2466 Note that in both systems, you can set an
2467 \begin_inset Quotes eld
2468 \end_inset
2469
2470 environment
2471 \begin_inset Quotes erd
2472 \end_inset
2473
2474 variable to designate your home directory.
2475 \end_layout
2476
2477 \end_inset
2478
2479
2480 \noun off
2481 .
2482 ASCEND tells you where it has placed this subdirectory when you install
2483 it.
2484 However, if you did not note where that was, then you will have to search
2485 for it (using a tool like "FIND file or folder").
2486 \end_layout
2487
2488 \begin_layout Standard
2489 It is within the folder
2490 \family typewriter
2491 ascdata
2492 \family default
2493 that you should place any ASCEND models you create.
2494 When running a script (which we shall talk about later), ASCEND first looks
2495 in this subdirectory for files, and then it looks in the models subdirectory.
2496 It stops looking when it finds the first available version of the file.
2497 \end_layout
2498
2499 \begin_layout Standard
2500 \begin_inset Marginal
2501 status collapsed
2502
2503 \begin_layout Plain Layout
2504 create a text file containing the model definition
2505 \end_layout
2506
2507 \end_inset
2508
2509 Next open an editor
2510 \begin_inset Index idx
2511 status collapsed
2512
2513 \begin_layout Plain Layout
2514 text editors
2515 \end_layout
2516
2517 \end_inset
2518
2519 , such as
2520 \family typewriter
2521 emacs
2522 \family default
2523
2524 \begin_inset Index idx
2525 status collapsed
2526
2527 \begin_layout Plain Layout
2528 emacs
2529 \end_layout
2530
2531 \end_inset
2532
2533 ,
2534 \family typewriter
2535 gedit
2536 \family default
2537
2538 \begin_inset Index idx
2539 status collapsed
2540
2541 \begin_layout Plain Layout
2542 gedit
2543 \end_layout
2544
2545 \end_inset
2546
2547 ,
2548 \family typewriter
2549 vi
2550 \family default
2551
2552 \begin_inset Index idx
2553 status collapsed
2554
2555 \begin_layout Plain Layout
2556 vi
2557 \end_layout
2558
2559 \end_inset
2560
2561 ,
2562 \family typewriter
2563 vim
2564 \family default
2565
2566 \begin_inset Index idx
2567 status collapsed
2568
2569 \begin_layout Plain Layout
2570 vim
2571 \end_layout
2572
2573 \end_inset
2574
2575 , Notepad
2576 \begin_inset Index idx
2577 status collapsed
2578
2579 \begin_layout Plain Layout
2580 Notepad
2581 \end_layout
2582
2583 \end_inset
2584
2585 or TextPad
2586 \begin_inset Index idx
2587 status collapsed
2588
2589 \begin_layout Plain Layout
2590 TextPad
2591 \end_layout
2592
2593 \end_inset
2594
2595 .
2596 Now type in or, better yet, cut-and-paste the statements in Figure
2597 \begin_inset CommandInset ref
2598 LatexCommand ref
2599 reference "fig:model1.modelVessel"
2600
2601 \end_inset
2602
2603
2604 \noun off
2605 .
2606 Be very careful to match the use of capital and small letters.
2607 Do not worry about blanks between symbols but do not embed blanks within
2608 symbols.
2609 In other words, do not put a blank in the middle of the symbol
2610 \family typewriter
2611 \noun default
2612 side_wall
2613 \family default
2614 \noun off
2615 but do not worry about putting zero or more blanks between
2616 \family typewriter
2617 \noun default
2618 side_wall
2619 \family default
2620 \noun off
2621 and
2622 \family typewriter
2623 \noun default
2624 =
2625 \family default
2626 \noun off
2627 in an equation.
2628 \end_layout
2629
2630 \begin_layout Standard
2631 When you are finished, be sure to save the file as a text file.
2632 Call it
2633 \family typewriter
2634 vesselPlain.a4c
2635 \family default
2636 .
2637 The "
2638 \family typewriter
2639 .a4c
2640 \family default
2641 " stands for "ASCEND 4 Code".
2642 Many Windows editors will append "
2643 \family typewriter
2644 .txt
2645 \family default
2646 " to the file name.
2647 Remove the
2648 \family typewriter
2649 .txt
2650 \family default
2651 ending off the file name -- do not let Microsoft bully you into thinking
2652 you should not -- and change it to "
2653 \family typewriter
2654 .a4c
2655 \begin_inset Index idx
2656 status collapsed
2657
2658 \begin_layout Plain Layout
2659 a4c
2660 \end_layout
2661
2662 \end_inset
2663
2664
2665 \family default
2666 ".
2667
2668 \end_layout
2669
2670 \begin_layout Standard
2671 (This model is also available as
2672 \family typewriter
2673 vesselPlain.a4c
2674 \family default
2675 in the ASCEND models library, but we suggest it would be better for you
2676 to go through the exercise of creating your own version here.
2677 At the least copy the library file to your ASCEND space so you can play
2678 with your own version at this time.)
2679 \end_layout
2680
2681 \begin_layout Standard
2682 When you are done, you should have a text file called
2683 \family typewriter
2684 vesselPlain.a4c
2685 \family default
2686 stored in your ASCEND/models/vessel subdirectory.
2687 It should contain precisely the statements in Figure
2688 \begin_inset CommandInset ref
2689 LatexCommand ref
2690 reference "fig:model1.modelVessel"
2691
2692 \end_inset
2693
2694
2695 \noun off
2696 with care having been taken to match capital and lower case letters as
2697 shown there.
2698 \end_layout
2699
2700 \begin_layout Standard
2701 \begin_inset Marginal
2702 status collapsed
2703
2704 \begin_layout Plain Layout
2705 start the ASCEND system.
2706 Move and resize the windows to make yourself comfortable.
2707 \end_layout
2708
2709 \end_inset
2710
2711 Start the ASCEND system by double clicking on the ASCEND icon if you are
2712 on Windows or typing
2713 \family typewriter
2714 ascend
2715 \family default
2716 at the command line if you are using a Linux machine
2717 \begin_inset Foot
2718 status collapsed
2719
2720 \begin_layout Plain Layout
2721 Depending on the Linux version you have installed, you might find that the
2722 command is
2723 \family typewriter
2724 ascend4
2725 \family default
2726 or that you have an ASCEND option in your GNOME 'Applications' menu.
2727 \end_layout
2728
2729 \end_inset
2730
2731 .
2732 Four windows will appear, three smaller ones and one larger one that will,
2733 if left unattended, disappear by itself in a few seconds.
2734 Move the three smaller ones around on your screen so they do not overlap
2735 or so they overlap very little.
2736 Resize them if you want to.
2737 You might start by putting the one called Script
2738 \begin_inset Index idx
2739 status collapsed
2740
2741 \begin_layout Plain Layout
2742 Script window
2743 \end_layout
2744
2745 \end_inset
2746
2747 in the upper left, the one called Library
2748 \begin_inset Index idx
2749 status collapsed
2750
2751 \begin_layout Plain Layout
2752 Library window
2753 \end_layout
2754
2755 \end_inset
2756
2757 in the upper right and the one called Console
2758 \begin_inset Index idx
2759 status collapsed
2760
2761 \begin_layout Plain Layout
2762 Console
2763 \end_layout
2764
2765 \end_inset
2766
2767 in the lower right.
2768 We shall assume you have placed them in these positions in the following
2769 so, even if that is not your favorite placement, it might be useful to
2770 use it for now.
2771 \end_layout
2772
2773 \begin_layout Standard
2774 \begin_inset Marginal
2775 status collapsed
2776
2777 \begin_layout Plain Layout
2778 note that each window by itself looks pretty nonthreatening
2779 \end_layout
2780
2781 \end_inset
2782
2783 As you can see, each window by itself looks like a pretty normal window.
2784 Each has buttons across the top under which one will find different tools
2785 to run.
2786 Each also has one to three sub-windows for displaying things.
2787 Each has a Help button that you can push at any time that you want to read
2788 all kinds of detailed things about the window
2789 \begin_inset Foot
2790 status collapsed
2791
2792 \begin_layout Plain Layout
2793 assuming you have got the help files installed on your system, which you
2794 may not find you have.
2795 \end_layout
2796
2797 \end_inset
2798
2799 .
2800 For the moment we will provide you with the "just-in-time" details here
2801 so you do not need to be sidetracked just yet by pushing these Help buttons.
2802 \end_layout
2803
2804 \begin_layout Standard
2805 \begin_inset Marginal
2806 status collapsed
2807
2808 \begin_layout Plain Layout
2809 hey, where did that window go? I want it back NOW!
2810 \end_layout
2811
2812 \end_inset
2813
2814 If you ever lose a window, open the Script window and under the Tools
2815 \begin_inset Index idx
2816 status collapsed
2817
2818 \begin_layout Plain Layout
2819 Tools
2820 \end_layout
2821
2822 \end_inset
2823
2824 button, select the window you wish to open.
2825 You cannot lose the Script window unless you shut down ASCEND.
2826 For other windows in ASCEND, you can close them and re-open them as required.
2827 Any window that you closed can usually be restored by going back to the
2828 Script window and selected it from the Tools menu there.
2829 \end_layout
2830
2831 \begin_layout Standard
2832 \begin_inset Marginal
2833 status collapsed
2834
2835 \begin_layout Plain Layout
2836 How do I quit
2837 \begin_inset Index idx
2838 status collapsed
2839
2840 \begin_layout Plain Layout
2841 quit ASCEND
2842 \end_layout
2843
2844 \end_inset
2845
2846 ASCEND?
2847 \end_layout
2848
2849 \end_inset
2850
2851 To exit
2852 \begin_inset Index idx
2853 status collapsed
2854
2855 \begin_layout Plain Layout
2856 exit ASCEND
2857 \end_layout
2858
2859 \end_inset
2860
2861 ASCEND, close the Script window.
2862 You will be asked to confirm that you want to exit ASCEND.
2863 If you have simulations in memory this will stop you from losing your results.
2864 \end_layout
2865
2866 \begin_layout Standard
2867 \begin_inset Marginal
2868 status collapsed
2869
2870 \begin_layout Plain Layout
2871 saving
2872 \begin_inset Index idx
2873 status collapsed
2874
2875 \begin_layout Plain Layout
2876 saving window position
2877 \end_layout
2878
2879 \end_inset
2880
2881 window positions
2882 \begin_inset Index idx
2883 status collapsed
2884
2885 \begin_layout Plain Layout
2886 window position
2887 \end_layout
2888
2889 \end_inset
2890
2891
2892 \end_layout
2893
2894 \end_inset
2895
2896 ASCEND will not remember your window locations automatically.
2897 If you like where you have placed the windows for ASCEND on your display,
2898 go to the Script window and select 'Save all appearances
2899 \begin_inset Index idx
2900 status collapsed
2901
2902 \begin_layout Plain Layout
2903 window locations, save
2904 \end_layout
2905
2906 \end_inset
2907
2908
2909 \begin_inset Index idx
2910 status collapsed
2911
2912 \begin_layout Plain Layout
2913 appearances, save all
2914 \end_layout
2915
2916 \end_inset
2917
2918 ' under the View
2919 \begin_inset Index idx
2920 status collapsed
2921
2922 \begin_layout Plain Layout
2923 View
2924 \end_layout
2925
2926 \end_inset
2927
2928 menu.
2929 A similar tool exists for each window for saving only its position.
2930 \end_layout
2931
2932 \begin_layout Standard
2933 \begin_inset Marginal
2934 status collapsed
2935
2936 \begin_layout Plain Layout
2937 start by loading and compiling using tools in the Library window
2938 \end_layout
2939
2940 \end_inset
2941
2942 We shall start with the Library window in the upper right.
2943 This window provides you with the tools to load and compile files containing
2944 type definitions.
2945 You can also display
2946 \begin_inset Index idx
2947 status collapsed
2948
2949 \begin_layout Plain Layout
2950 display
2951 \end_layout
2952
2953 \end_inset
2954
2955 the code for the different types you have loaded.
2956 \end_layout
2957
2958 \begin_layout Standard
2959 \begin_inset Marginal
2960 status collapsed
2961
2962 \begin_layout Plain Layout
2963 use the left mouse button unless we tell you otherwise (however, on you
2964 own explore using the right mouse button in any of the windows)
2965 \end_layout
2966
2967 \end_inset
2968
2969 Let's load your file.
2970 Under the File button select the 'Read types from File
2971 \begin_inset Index idx
2972 status collapsed
2973
2974 \begin_layout Plain Layout
2975 Read Types from File
2976 \end_layout
2977
2978 \end_inset
2979
2980 ' tool.
2981 You select this tool by clicking on it using the left mouse button - i.e.,
2982 the button you should have expected to use.
2983 A window will appear asking you to find the file you want to read into
2984 ASCEND.
2985 Navigate to where you stored
2986 \family typewriter
2987 vesselPlain.a4c
2988 \family default
2989 (in the subdirectory
2990 \family typewriter
2991 ascdata
2992 \family default
2993 ) and select that file.
2994 If you have the wrong ending on the file (you left
2995 \family typewriter
2996 .txt
2997 \family default
2998 or you forgot to put
2999 \family typewriter
3000 .a4c
3001 \family default
3002 as the ending), tell the system to list all files and pick the one you
3003 want.
3004 The
3005 \family typewriter
3006 .a4c
3007 \family default
3008 is used by the system to list only the files it thinks you might want to
3009 load, but ASCEND isn't fussy.
3010 It will attempt to load any file you pick.
3011 \end_layout
3012
3013 \begin_layout Standard
3014 Look in the Console window at the lower right, and, if the file loads without
3015 any errors being listed there, you can skip past the next bit to where
3016 you should start to compile an instance.
3017 The next bit has some useful hints on how to debug your models.
3018 If you want some debugging experience, put a known error into your
3019 \family typewriter
3020 vesselPlain.a4c
3021 \family default
3022 file and see what happens.
3023 This move will give you a reason to read the following section.
3024 \end_layout
3025
3026 \begin_layout Standard
3027 \begin_inset Marginal
3028 status open
3029
3030 \begin_layout Plain Layout
3031 Do not ignore the diagnostics
3032 \begin_inset Index idx
3033 status collapsed
3034
3035 \begin_layout Plain Layout
3036 diagnostics
3037 \end_layout
3038
3039 \end_inset
3040
3041 that might appear in the Console window
3042 \end_layout
3043
3044 \end_inset
3045
3046 If the Console window in the lower right starts filling with several tens
3047 of lines of diagnostics, look to see if you included the
3048 \family typewriter
3049 REQUIRE
3050 \family default
3051
3052 \begin_inset Index idx
3053 status collapsed
3054
3055 \begin_layout Plain Layout
3056 REQUIRE
3057 \end_layout
3058
3059 \end_inset
3060
3061 statement at the beginning of your model file.
3062 Without that statement, ASCEND is missing all the definitions for the types
3063 of variables in your model, and it will go wild telling you so
3064 \begin_inset Foot
3065 status collapsed
3066
3067 \begin_layout Plain Layout
3068 It might also be choking on a Word document because you forgot to save
3069 it as a text file.
3070 \end_layout
3071
3072 \end_inset
3073
3074 .
3075 \end_layout
3076
3077 \begin_layout Standard
3078 While loading the files containing these types, ASCEND will look very closely
3079 at the syntax and will give you all kinds of diagnostic messages in the
3080 Console window (lower right) if you have done something wrong.
3081 It will also at times spew out some warning messages
3082 \begin_inset Index idx
3083 status collapsed
3084
3085 \begin_layout Plain Layout
3086 warning messages
3087 \end_layout
3088
3089 \end_inset
3090
3091 if you have done something thought to be poor modeling style.
3092 You must heed the error messages as the file will not load if there are
3093 any.
3094 ASCEND will tell you if it did not load the file.
3095
3096 \end_layout
3097
3098 \begin_layout Standard
3099 You should consider heeding the warnings if you get any.
3100 If you ignore them now, they may come back and haunt you later.
3101 However, there are times when we issue a warning but everything will work,
3102 and you will think we were not too clever.
3103 Our response: better modeling style
3104 \begin_inset Index idx
3105 status collapsed
3106
3107 \begin_layout Plain Layout
3108 modeling style
3109 \end_layout
3110
3111 \end_inset
3112
3113 can eliminate these warnings.
3114 (It's been our system so we get to have the last word.)
3115 \end_layout
3116
3117 \begin_layout Standard
3118 \begin_inset Marginal
3119 status collapsed
3120
3121 \begin_layout Plain Layout
3122 how do I jump
3123 \begin_inset Index idx
3124 status collapsed
3125
3126 \begin_layout Plain Layout
3127 jump to line
3128 \end_layout
3129
3130 \end_inset
3131
3132
3133 \begin_inset Index idx
3134 status collapsed
3135
3136 \begin_layout Plain Layout
3137 line numbers
3138 \end_layout
3139
3140 \end_inset
3141
3142 to line 100 of a file when using some of the standard editors?
3143 \end_layout
3144
3145 \end_inset
3146
3147 The error and warning messages will contain a line number in the file where
3148 the error has occurred.
3149 This will be the line number as counted by an editor with the first line
3150 being line 1 in the file.
3151 Editors always provide you with a means to get directly to a line number
3152 in a file.
3153 Find out how to do that or you will not be too happy with debugging a large
3154 file.
3155 \end_layout
3156
3157 \begin_layout Standard
3158 You will be in the debug mode for a new system so do not expect it to be
3159 totally obvious the first few times you make an error.
3160 We have tried to use language that should be meaningful, but we may have
3161 failed or the error may be pretty subtle and not possible for us to anticipate
3162 how to describe it in your terms.
3163 (Send us a bug report if you have any good ideas on language.)
3164 \end_layout
3165
3166 \begin_layout Standard
3167 \begin_inset Marginal
3168 status collapsed
3169
3170 \begin_layout Plain Layout
3171 reloading a file
3172 \begin_inset Index idx
3173 status collapsed
3174
3175 \begin_layout Plain Layout
3176 reloading a file
3177 \end_layout
3178
3179 \end_inset
3180
3181
3182 \begin_inset Index idx
3183 status collapsed
3184
3185 \begin_layout Plain Layout
3186 file, reloading
3187 \end_layout
3188
3189 \end_inset
3190
3191 overwrites the previous version
3192 \end_layout
3193
3194 \end_inset
3195
3196 You can reload any file your have corrected using the Read types from file
3197 tool under the File menu.
3198 It will overwrite the previous version of the file only if the file has
3199 changed since it was last loaded (note that we do not reload those big
3200 files unless you make a change even if you tell us to).
3201 \end_layout
3202
3203 \begin_layout Standard
3204 \begin_inset Marginal
3205 status collapsed
3206
3207 \begin_layout Plain Layout
3208 displaying the code
3209 \end_layout
3210
3211 \end_inset
3212
3213 You can display the code you have written.
3214 Select the model vessel in the right window of the Library.
3215 Then under the Display
3216 \begin_inset Index idx
3217 status collapsed
3218
3219 \begin_layout Plain Layout
3220 Display window
3221 \end_layout
3222
3223 \end_inset
3224
3225 menu at the top, select the tool Code.
3226 The Display window will open displaying the code for this model.
3227 \end_layout
3228
3229 \begin_layout Standard
3230 \begin_inset Marginal
3231 status collapsed
3232
3233 \begin_layout Plain Layout
3234 now compile as "
3235 \family typewriter
3236 v
3237 \family default
3238 "
3239 \end_layout
3240
3241 \end_inset
3242
3243 Okay, you have your file loaded without getting any diagnostics.
3244 You are ready to compile
3245 \begin_inset Index idx
3246 status collapsed
3247
3248 \begin_layout Plain Layout
3249 compile
3250 \end_layout
3251
3252 \end_inset
3253
3254 .
3255 In the Library window, look in the left window and select the file
3256 \family typewriter
3257 vesselPlain.a4c
3258 \family default
3259 .
3260 It contains the type definition you wish to compile.
3261 You should see the type vessel appear in the right window.
3262 Select vessel.
3263 Under the Edit button, select Create simulation.
3264 A small window opens and asks you to name the simulation.
3265 Call it
3266 \family typewriter
3267 v
3268 \family default
3269 -- yes, just the letter "v", and select "OK".
3270 Short names for instances often seem to be preferable.
3271
3272 \end_layout
3273
3274 \begin_layout Standard
3275 Look again in the Console window for diagnostics.
3276 If everything worked without error, you will see some statistics telling
3277 you how many models, relations and so forth you have created during the
3278 compile step.
3279 \end_layout
3280
3281 \begin_layout Standard
3282 \begin_inset Marginal
3283 status collapsed
3284
3285 \begin_layout Plain Layout
3286 and pass the instance
3287 \begin_inset Index idx
3288 status collapsed
3289
3290 \begin_layout Plain Layout
3291 instance
3292 \end_layout
3293
3294 \end_inset
3295
3296 to the Browser
3297 \begin_inset Index idx
3298 status collapsed
3299
3300 \begin_layout Plain Layout
3301 Browser
3302 \end_layout
3303
3304 \end_inset
3305
3306
3307 \end_layout
3308
3309 \end_inset
3310
3311 Select
3312 \family typewriter
3313 v IS A vessel
3314 \family default
3315 in the bottom of the Library window.
3316 Then under the Export
3317 \begin_inset Index idx
3318 status collapsed
3319
3320 \begin_layout Plain Layout
3321 Export
3322 \end_layout
3323
3324 \end_inset
3325
3326 button, select 'Simulation to Browser
3327 \begin_inset Index idx
3328 status collapsed
3329
3330 \begin_layout Plain Layout
3331 Export Simulation to Browser
3332 \end_layout
3333
3334 \end_inset
3335
3336 ' to export
3337 \family typewriter
3338 v
3339 \family default
3340 to the Browser tool set.
3341 The Browser window will open and contain
3342 \family typewriter
3343 v
3344 \family default
3345 .
3346 It might be useful to enlarge this window and move it down a bit, placing
3347 it a bit to the right of the center of your screen.
3348 (Remember you can save this positioning and sizing of the Browser window
3349 by going under the View menu and picking 'Save appearance'.)
3350 \end_layout
3351
3352 \begin_layout Standard
3353 \begin_inset Marginal
3354 status collapsed
3355
3356 \begin_layout Plain Layout
3357 examine
3358 \family typewriter
3359 v
3360 \family default
3361 by playing with it in the Browser
3362 \end_layout
3363
3364 \end_inset
3365
3366 In the left upper window of the Browser, you will find
3367 \family typewriter
3368 v
3369 \family default
3370 to be the current object.
3371 Listed in the right window are all the parts of the current object.
3372 You will see the variables listed here along with an indication of their
3373 type.
3374 For example, you will find
3375 \family typewriter
3376 Cylinder IS A relation
3377 \family default
3378 and
3379 \family typewriter
3380 D IS A distance
3381 \family default
3382 listed, among many others.
3383
3384 \family typewriter
3385 Cylinder
3386 \family default
3387 is one of the equations you wrote describing the model while
3388 \family typewriter
3389 D
3390 \family default
3391 was the diameter of the vessel.
3392
3393 \end_layout
3394
3395 \begin_layout Standard
3396 \begin_inset Marginal
3397 status collapsed
3398
3399 \begin_layout Plain Layout
3400 included flags
3401 \begin_inset Index idx
3402 status collapsed
3403
3404 \begin_layout Plain Layout
3405 included flags
3406 \end_layout
3407
3408 \end_inset
3409
3410
3411 \begin_inset Index idx
3412 status collapsed
3413
3414 \begin_layout Plain Layout
3415 flag, included
3416 \end_layout
3417
3418 \end_inset
3419
3420 for relations
3421 \end_layout
3422
3423 \end_inset
3424
3425 If you pick any of the parts in the right or bottom windows, it becomes
3426 the current object; its parts then show in the right window.
3427 For example, a relation has a boolean part (a flag that takes the value
3428
3429 \family typewriter
3430 TRUE
3431 \family default
3432 or
3433 \family typewriter
3434 FALSE
3435 \family default
3436 ) indicating whether or not it is to be included when ASCEND solves the
3437 equations you defined for the model.
3438 \end_layout
3439
3440 \begin_layout Standard
3441 If you wish to display the current value for this flag, pick 'Display Atom
3442 Values
3443 \begin_inset Index idx
3444 status collapsed
3445
3446 \begin_layout Plain Layout
3447 Display Atom Values
3448 \end_layout
3449
3450 \end_inset
3451
3452 ' under the View menu.
3453 This tool toggles a switch that causes either the value or the type to
3454 show for a variable, a constant or a relation in the upper right window
3455 of the Browser.
3456 Try toggling it back and forth and looking at different things in the Browser.
3457 \end_layout
3458
3459 \begin_layout Standard
3460 Pick each of the tools under View and note what happens to the displaying
3461 of things in the Browser.
3462 \end_layout
3463
3464 \begin_layout Standard
3465 Across the bottom of the Browser window note the buttons you can select
3466 labeled
3467 \family typewriter
3468 RV
3469 \family default
3470 ,
3471 \family typewriter
3472 DV
3473 \family default
3474 and so forth.
3475 If you have made the Browser window large enough, you will see to the right
3476 of these buttons the type of objects whose value you want to appear or
3477 not in the lower Browser window as you toggle each button.
3478 Toggle each of these buttons and see if the lower display changes.
3479 If it does not, then this type of part is not in the current object.
3480 \end_layout
3481
3482 \begin_layout Section
3483 Solving
3484 \begin_inset Index idx
3485 status collapsed
3486
3487 \begin_layout Plain Layout
3488 Solving
3489 \end_layout
3490
3491 \end_inset
3492
3493 an ASCEND instance
3494 \end_layout
3495
3496 \begin_layout Standard
3497 Well, you have been patient.
3498 While there are lots of interesting tools left to explore in the Browser,
3499 perhaps it is time to try to solve this model.
3500 To solve
3501 \family typewriter
3502 v
3503 \family default
3504 , make it the current object (it alone should be listed in the upper left
3505 window of the Browser).
3506 Then, under the Export
3507 \begin_inset Index idx
3508 status collapsed
3509
3510 \begin_layout Plain Layout
3511 Export to Solver
3512 \end_layout
3513
3514 \end_inset
3515
3516 menu, select 'to Solver'.
3517 The Solver window will open, along with a smaller window labeled Eligible
3518 \begin_inset Index idx
3519 status collapsed
3520
3521 \begin_layout Plain Layout
3522 window, Eligible
3523 \end_layout
3524
3525 \end_inset
3526
3527
3528 \begin_inset Index idx
3529 status collapsed
3530
3531 \begin_layout Plain Layout
3532 Eligible window
3533 \end_layout
3534
3535 \end_inset
3536
3537 .
3538 Move the Eligible window up a bit so it does not cover any or very little
3539 of the Solver window.
3540 Move the Solver window to the lower left and enlarge it so you can see
3541 all of its contents.
3542
3543 \end_layout
3544
3545 \begin_layout Standard
3546 \begin_inset Marginal
3547 status collapsed
3548
3549 \begin_layout Plain Layout
3550 if ASCEND stops responding
3551 \begin_inset Index idx
3552 status collapsed
3553
3554 \begin_layout Plain Layout
3555 responding, ASCEND stops
3556 \end_layout
3557
3558 \end_inset
3559
3560 , hunt down one of those "nasty" windows with a "yellow lock
3561 \begin_inset Index idx
3562 status collapsed
3563
3564 \begin_layout Plain Layout
3565 yellow lock
3566 \end_layout
3567
3568 \end_inset
3569
3570 " and close it properly
3571 \end_layout
3572
3573 \end_inset
3574
3575 This Eligible window is 'modal': if it is open and you do not do something
3576 to make it happy and go away, it will stop you from doing anything else
3577 in the ASCEND system.
3578 Such windows appear with a black lock icon in a yellow field -- we shall
3579 call it a "yellow lock." They demand you attend to them
3580 \emph on
3581 now
3582 \emph default
3583 .
3584 A good solution would be for such a window to stay open and on top of all
3585 the other open windows.
3586 Unfortunately we have not been able under all window managers to stop it
3587 from ducking under another window.
3588 If you ever find ASCEND unwilling to respond, iconify the other windows
3589 to get them out of the way, until you find one of these windows.
3590 On the PC you can go to the icon bar at the bottom of your screen and,
3591 by clicking on the window, bring it to the top.
3592 Then do whatever it takes to make it happy and close properly -- such as
3593 cancel it.
3594 If you are not careful here, for example, this window will hide under the
3595 Solver window before you are through with it.
3596 \end_layout
3597
3598 \begin_layout Standard
3599 \begin_inset Marginal
3600 status open
3601
3602 \begin_layout Plain Layout
3603 is our problem well-posed
3604 \begin_inset Index idx
3605 status collapsed
3606
3607 \begin_layout Plain Layout
3608 well-posed
3609 \end_layout
3610
3611 \end_inset
3612
3613 ?
3614 \end_layout
3615
3616 \end_inset
3617
3618 The Solver window contains the information we need to see to explain why
3619 the Eligible window opened in the first place.
3620 Examine the information the Solver displays.
3621 It tells you that
3622 \family typewriter
3623 v
3624 \family default
3625 has 6 relations defining it and that all are equalities and included.
3626 It has no inequalities.
3627 On the right side we see there are 10 variables and all are 'free
3628 \begin_inset Index idx
3629 status collapsed
3630
3631 \begin_layout Plain Layout
3632 free variables
3633 \end_layout
3634
3635 \end_inset
3636
3637 .' A free variable is one for which you want the system to compute a value.
3638 Hmm, 6 equations in 10 variables.
3639 Something is wrong here.
3640 For a well-posed problem, you want 6 equations in 6 variables (i.e., square
3641 \begin_inset Index idx
3642 status collapsed
3643
3644 \begin_layout Plain Layout
3645 square
3646 \end_layout
3647
3648 \end_inset
3649
3650 ).
3651 ASCEND reports that the system is underspecified
3652 \begin_inset Index idx
3653 status collapsed
3654
3655 \begin_layout Plain Layout
3656 underspecified
3657 \end_layout
3658
3659 \end_inset
3660
3661 by 4.
3662 This means you need to pick four of the variables and declare them to be
3663 fixed
3664 \begin_inset Index idx
3665 status collapsed
3666
3667 \begin_layout Plain Layout
3668 fixed
3669 \end_layout
3670
3671 \end_inset
3672
3673 .
3674 You will also have to pick values for these fixed variables before you
3675 can solve for the remaining 6.
3676 For such a small problem as this one, this task is not formidable.
3677 For a model with 50,000 equations and 60,000 variables, one would quit
3678 and go home.
3679 We have exposed a need here.
3680 We certainly would like ASCEND to help us here for this small problem.
3681 But we insist that it help us in major ways to make the 50,000 equation,
3682 60,000 variable problem possible.
3683 \end_layout
3684
3685 \begin_layout Standard
3686 \begin_inset Marginal
3687 status collapsed
3688
3689 \begin_layout Plain Layout
3690 picking variables we are going to fix
3691 \end_layout
3692
3693 \end_inset
3694
3695 Okay, the small help such as needed here is why the Eligible window opened.
3696 Let's return to it.
3697 It lists all the variables of those not yet fixed that are eligible to
3698 be fixed and still leave us a calculation that has a chance to solve.
3699 The algorithm to find eligible variables does an quick analysis of the
3700 structure of the equations.
3701 The variables it lists are those that can be fixed
3702 \emph on
3703 without
3704 \emph default
3705 the system becoming numerically singular.
3706 So any variables that are not shown
3707 \emph on
3708 cannot possibly
3709 \emph default
3710 help you.
3711 \end_layout
3712
3713 \begin_layout Standard
3714 So look at the list and decide what you would like to fix for your first
3715 calculation with this model.
3716 Diameter (
3717 \family typewriter
3718 v.D
3719 \family default
3720 ) seems a good choice.
3721 Now you can see why we called the instance just plain old
3722 \family typewriter
3723 v
3724 \family default
3725 .
3726 A longer name would get tiring here.
3727 Anyway, pick
3728 \family typewriter
3729 v.D
3730 \family default
3731 .
3732 Immediately the list reappears with
3733 \family typewriter
3734 v.D
3735 \family default
3736 no longer on it.
3737 ASCEND has just repeated the eligibility analysis, and found that more
3738 variables still need to be fixed.
3739 \end_layout
3740
3741 \begin_layout Standard
3742 We have three more to pick.
3743 On the list are both vessel height,
3744 \family typewriter
3745 v.H
3746 \family default
3747 , and
3748 \family typewriter
3749 v.H_to_D_ratio
3750 \family default
3751 .
3752 We certainly cannot pick both of these.
3753 One implies the other if we know a value for
3754 \family typewriter
3755 v.D
3756 \family default
3757 .
3758 Pick
3759 \family typewriter
3760 v.H_to_D_ratio
3761 \family default
3762 .
3763 Note that
3764 \family typewriter
3765 v.H
3766 \family default
3767 is no longer eligible.
3768 Good.
3769 We would be worried if it were still there.
3770 \end_layout
3771
3772 \begin_layout Standard
3773 We see
3774 \family typewriter
3775 v.metal_density
3776 \emph on
3777 .
3778
3779 \family default
3780 \emph default
3781 Pick it.
3782 Strange.
3783 Metal mass and volume stayed eligible.
3784 Why? If we pick metal mass, wall thickness is implied, and the same is
3785 true if we were to pick metal volume.
3786 However, as it seems much more natural to pick
3787 \family typewriter
3788 wall_thickness
3789 \family default
3790 , make that the last variable you choose.
3791 The Solver window now says this problem is square (i.e., it has 6 equations
3792 in the same number of unknowns).
3793 Table
3794 \begin_inset CommandInset ref
3795 LatexCommand ref
3796 reference "tab:model1.variableFixed"
3797
3798 \end_inset
3799
3800
3801 \noun off
3802 summarizes the four variables we have elected here to fix.
3803 \end_layout
3804
3805 \begin_layout Standard
3806 \begin_inset Float table
3807 wide false
3808 sideways false
3809 status open
3810
3811 \begin_layout Plain Layout
3812 \begin_inset Caption Standard
3813
3814 \begin_layout Plain Layout
3815 \begin_inset CommandInset label
3816 LatexCommand label
3817 name "tab:model1.variableFixed"
3818
3819 \end_inset
3820
3821 Variables we have fixed
3822 \begin_inset Index idx
3823 status collapsed
3824
3825 \begin_layout Plain Layout
3826 fixed variables
3827 \end_layout
3828
3829 \end_inset
3830
3831
3832 \end_layout
3833
3834 \end_inset
3835
3836
3837 \end_layout
3838
3839 \begin_layout Plain Layout
3840 \begin_inset Tabular
3841 <lyxtabular version="3" rows="5" columns="1">
3842 <features rotate="0" tabularvalignment="middle">
3843 <column alignment="center" valignment="top">
3844 <row>
3845 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
3846 \begin_inset Text
3847
3848 \begin_layout Plain Layout
3849 variable
3850 \end_layout
3851
3852 \end_inset
3853 </cell>
3854 </row>
3855 <row>
3856 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3857 \begin_inset Text
3858
3859 \begin_layout Plain Layout
3860
3861 \family typewriter
3862 D
3863 \end_layout
3864
3865 \end_inset
3866 </cell>
3867 </row>
3868 <row>
3869 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3870 \begin_inset Text
3871
3872 \begin_layout Plain Layout
3873
3874 \family typewriter
3875 H_to_D_ratio
3876 \end_layout
3877
3878 \end_inset
3879 </cell>
3880 </row>
3881 <row>
3882 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3883 \begin_inset Text
3884
3885 \begin_layout Plain Layout
3886
3887 \family typewriter
3888 meta_density
3889 \end_layout
3890
3891 \end_inset
3892 </cell>
3893 </row>
3894 <row>
3895 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
3896 \begin_inset Text
3897
3898 \begin_layout Plain Layout
3899
3900 \family typewriter
3901 wall_thickness
3902 \end_layout
3903
3904 \end_inset
3905 </cell>
3906 </row>
3907 </lyxtabular>
3908
3909 \end_inset
3910
3911
3912 \end_layout
3913
3914 \end_inset
3915
3916
3917 \end_layout
3918
3919 \begin_layout Standard
3920 \begin_inset Marginal
3921 status collapsed
3922
3923 \begin_layout Plain Layout
3924 ASCEND partitions the problem into smaller problems for solving
3925 \end_layout
3926
3927 \end_inset
3928
3929 Toward the bottom right of the
3930 \series bold
3931 Solver
3932 \series default
3933 window, we see there are 6 "blocks
3934 \begin_inset Index idx
3935 status collapsed
3936
3937 \begin_layout Plain Layout
3938 blocks
3939 \end_layout
3940
3941 \end_inset
3942
3943 ." What are blocks? ASCEND has examined the equations and, in this case,
3944 has discovered that not all the equations have to be solved simultaneously.
3945 There are 6 blocks of equations which it can solve in sequence.
3946 6 blocks and 6 equations means that ASCEND has found a way to solve the
3947 model by solving 6 individual equations in sequence -- i.e., one at a time.
3948 This is a good thing: it usually means that the solver will have less problems
3949 with locating the overall solution.
3950 \end_layout
3951
3952 \begin_layout Standard
3953 As well as breaking down the system into blocks, ASCEND has the ability
3954 to rearrange some simple algebraic equations so that unknown variables
3955 can be evaluated directly from the known values, with no need for iterative
3956 numerical methods.
3957 This is only possible if there is just one equation in the block.
3958 In fact, this problem, with the 4 variables we selected to be fixed, can
3959 be solved entirely without iteration.
3960 \end_layout
3961
3962 \begin_layout Standard
3963 \begin_inset Marginal
3964 status open
3965
3966 \begin_layout Plain Layout
3967 displaying the incidence matrix
3968 \begin_inset Index idx
3969 status collapsed
3970
3971 \begin_layout Plain Layout
3972 incidence matrix
3973 \end_layout
3974
3975 \end_inset
3976
3977
3978 \end_layout
3979
3980 \end_inset
3981
3982 Can we see what ASCEND has just discovered? It turns out we can (we would
3983 not have asked if we could not).
3984 Under the Display menu on the Solver, select the 'Incidence matrix tool
3985 \begin_inset Index idx
3986 status collapsed
3987
3988 \begin_layout Plain Layout
3989 incidence matrix tool
3990 \end_layout
3991
3992 \end_inset
3993
3994 '.
3995 A window pops open showing us the incidence of variables in the equations
3996 and display them in the order that ASCEND has found to solve them, also
3997 known as a sparsity matrix
3998 \begin_inset Index idx
3999 status collapsed
4000
4001 \begin_layout Plain Layout
4002 sparsity matrix
4003 \end_layout
4004
4005 \end_inset
4006
4007 or sparsity pattern
4008 \begin_inset Index idx
4009 status collapsed
4010
4011 \begin_layout Plain Layout
4012 sparsity pattern
4013 \end_layout
4014
4015 \end_inset
4016
4017 .
4018 The dark squares are incidences under the variables for which we are solving;
4019 the lighter looking 'X' symbols to the right side are incidences for the
4020 fixed (known) variables.
4021 Click on the incidence in the upper left corner.
4022 ASCEND immediately identifies it for us as the
4023 \family typewriter
4024 end_area
4025 \family default
4026 .
4027 It identifies the equation as the one we labeled
4028 \family typewriter
4029 FlatEnds
4030 \family default
4031 .
4032 We can go back to our model and find the equation ASCEND will solve first.
4033 The other variable in this equation is in the set we fixed; pick it and
4034 discover it is
4035 \family typewriter
4036 D
4037 \family default
4038 , the vessel diameter.
4039 Of course we can compute the area of the ends given the diameter.
4040 The
4041 \emph on
4042 end_area
4043 \emph default
4044 is
4045 \begin_inset Formula $\pi D^{2}/4$
4046 \end_inset
4047
4048 .
4049 \end_layout
4050
4051 \begin_layout Standard
4052 Play with the other incidences here.
4053 See what the other equations are and the order ASCEND will use to solve
4054 them.
4055 \end_layout
4056
4057 \begin_layout Standard
4058 Okay, we return to our task of solving.
4059 We need next to supply values for the variables we have selected to be
4060 fixed.
4061 Again, the approach we are going to take is acceptable for this small problem,
4062 but we would not want to have to do what we are about to do for a large
4063 problem.
4064 Fortunately, we really have thought about these issues and have some nice
4065 approaches that work even for extremely large problem -- like 100,000 equations.
4066 \end_layout
4067
4068 \begin_layout Standard
4069 \begin_inset Marginal
4070 status collapsed
4071
4072 \begin_layout Plain Layout
4073 which variables are currently fixed for this problem?
4074 \end_layout
4075
4076 \end_inset
4077
4078 Let's see.
4079 Do you remember the variables we fixed? What if you do not? Well, we go
4080 back to the Browser.
4081 Be sure
4082 \family typewriter
4083 v
4084 \family default
4085 remains the current object (it alone is in the upper left window).
4086 Under the Find menu select 'by Type
4087 \begin_inset Index idx
4088 status collapsed
4089
4090 \begin_layout Plain Layout
4091 Find by Type
4092 \end_layout
4093
4094 \end_inset
4095
4096 .' A small window opens with default information in it saying it will find
4097 for us all objects contained in the current object
4098 \family typewriter
4099 v
4100 \family default
4101 of type
4102 \family typewriter
4103 solver_var
4104 \family default
4105 whose
4106 \family typewriter
4107 fixed
4108 \family default
4109 flags are set to
4110 \family typewriter
4111 TRUE
4112 \family default
4113 .
4114 These are precisely the attributes for the variables we have fixed.
4115 Select OK and a list of the four variables we fixed earlier appears.
4116 \end_layout
4117
4118 \begin_layout Standard
4119 \begin_inset Marginal
4120 status collapsed
4121
4122 \begin_layout Plain Layout
4123 specifying values for the fixed variables - this approach is useful for
4124 small problems
4125 \end_layout
4126
4127 \end_inset
4128
4129 For each variable on this list, we should supply a value.
4130 Select
4131 \family typewriter
4132 D
4133 \family default
4134 in the lower window of the Browser using the right (the right, not the
4135 left -- make
4136 \family typewriter
4137 v
4138 \family default
4139 the current object and do it again) mouse button.
4140 A window opens in which we input a value for
4141 \family typewriter
4142 D
4143 \family default
4144 .
4145 Put in the value 4 in the left window and ft in the right.
4146 Continue by putting in the values for the variables as listed in Table
4147
4148 \begin_inset CommandInset ref
4149 LatexCommand ref
4150 reference "tab:model1.valuesFixedVars"
4151
4152 \end_inset
4153
4154
4155 \noun off
4156 .
4157 These values immediately appear in the Browser window as you enter them.
4158 If you did not fully appreciate the proper handling of dimension and units
4159 before, you just got a taste of its advantages.
4160
4161 \noun default
4162 You
4163 \noun off
4164 did not have to worry about specifying these things in consistent preselected
4165 units
4166 \noun default
4167 -- ASCEND did this for you.
4168 \end_layout
4169
4170 \begin_layout Standard
4171 \begin_inset Float table
4172 wide false
4173 sideways false
4174 status open
4175
4176 \begin_layout Plain Layout
4177 \begin_inset Caption Standard
4178
4179 \begin_layout Plain Layout
4180 \begin_inset CommandInset label
4181 LatexCommand label
4182 name "tab:model1.valuesFixedVars"
4183
4184 \end_inset
4185
4186 Values to use for fixed variables
4187 \end_layout
4188
4189 \end_inset
4190
4191
4192 \end_layout
4193
4194 \begin_layout Plain Layout
4195 \begin_inset Tabular
4196 <lyxtabular version="3" rows="5" columns="3">
4197 <features rotate="0" tabularvalignment="middle">
4198 <column alignment="center" valignment="top">
4199 <column alignment="center" valignment="top">
4200 <column alignment="center" valignment="top">
4201 <row>
4202 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
4203 \begin_inset Text
4204
4205 \begin_layout Plain Layout
4206 variable
4207 \end_layout
4208
4209 \end_inset
4210 </cell>
4211 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
4212 \begin_inset Text
4213
4214 \begin_layout Plain Layout
4215 value
4216 \end_layout
4217
4218 \end_inset
4219 </cell>
4220 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
4221 \begin_inset Text
4222
4223 \begin_layout Plain Layout
4224 units
4225 \end_layout
4226
4227 \end_inset
4228 </cell>
4229 </row>
4230 <row>
4231 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4232 \begin_inset Text
4233
4234 \begin_layout Plain Layout
4235
4236 \family typewriter
4237 D
4238 \end_layout
4239
4240 \end_inset
4241 </cell>
4242 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4243 \begin_inset Text
4244
4245 \begin_layout Plain Layout
4246 4
4247 \end_layout
4248
4249 \end_inset
4250 </cell>
4251 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4252 \begin_inset Text
4253
4254 \begin_layout Plain Layout
4255
4256 \family typewriter
4257 ft
4258 \end_layout
4259
4260 \end_inset
4261 </cell>
4262 </row>
4263 <row>
4264 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4265 \begin_inset Text
4266
4267 \begin_layout Plain Layout
4268
4269 \family typewriter
4270 H_to_D_ratio
4271 \end_layout
4272
4273 \end_inset
4274 </cell>
4275 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4276 \begin_inset Text
4277
4278 \begin_layout Plain Layout
4279 3
4280 \end_layout
4281
4282 \end_inset
4283 </cell>
4284 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4285 \begin_inset Text
4286
4287 \begin_layout Plain Layout
4288
4289 \end_layout
4290
4291 \end_inset
4292 </cell>
4293 </row>
4294 <row>
4295 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4296 \begin_inset Text
4297
4298 \begin_layout Plain Layout
4299
4300 \family typewriter
4301 meta_density
4302 \end_layout
4303
4304 \end_inset
4305 </cell>
4306 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4307 \begin_inset Text
4308
4309 \begin_layout Plain Layout
4310 5000
4311 \end_layout
4312
4313 \end_inset
4314 </cell>
4315 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4316 \begin_inset Text
4317
4318 \begin_layout Plain Layout
4319
4320 \family typewriter
4321 kg/m^3
4322 \end_layout
4323
4324 \end_inset
4325 </cell>
4326 </row>
4327 <row>
4328 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
4329 \begin_inset Text
4330
4331 \begin_layout Plain Layout
4332
4333 \family typewriter
4334 wall_thickness
4335 \end_layout
4336
4337 \end_inset
4338 </cell>
4339 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
4340 \begin_inset Text
4341
4342 \begin_layout Plain Layout
4343 5
4344 \end_layout
4345
4346 \end_inset
4347 </cell>
4348 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
4349 \begin_inset Text
4350
4351 \begin_layout Plain Layout
4352
4353 \family typewriter
4354 mm
4355 \end_layout
4356
4357 \end_inset
4358 </cell>
4359 </row>
4360 </lyxtabular>
4361
4362 \end_inset
4363
4364
4365 \end_layout
4366
4367 \end_inset
4368
4369
4370 \end_layout
4371
4372 \begin_layout Standard
4373 You can now solve this model.
4374 Go the Solver window and, under the Execute menu, select Solve.
4375 You will get a message telling you the model solved.
4376 Dismiss that message and return to the Browser window to examine the results.
4377 You should see the following results:
4378 \end_layout
4379
4380 \begin_layout LyX-Code
4381 \begin_inset ERT
4382 status open
4383
4384 \begin_layout Plain Layout
4385
4386
4387 \backslash
4388 begin{ascend}
4389 \end_layout
4390
4391 \begin_layout Plain Layout
4392
4393 D = 1.21922 meter
4394 \end_layout
4395
4396 \begin_layout Plain Layout
4397
4398 H = 3.65765 meter
4399 \end_layout
4400
4401 \begin_layout Plain Layout
4402
4403 H_to_D_ratio = 3
4404 \end_layout
4405
4406 \begin_layout Plain Layout
4407
4408 end_area = 1.16748 meter^2
4409 \end_layout
4410
4411 \begin_layout Plain Layout
4412
4413 metal_density = 5000 kilogram/meter^3
4414 \end_layout
4415
4416 \begin_layout Plain Layout
4417
4418 metal_mass = 408.62 kilogram
4419 \end_layout
4420
4421 \begin_layout Plain Layout
4422
4423 side_area = 14.0098 meter^2
4424 \end_layout
4425
4426 \begin_layout Plain Layout
4427
4428 vessel_vol = 4.27025 meter^3
4429 \end_layout
4430
4431 \begin_layout Plain Layout
4432
4433 wall_thickness = 0.005 meter
4434 \end_layout
4435
4436 \begin_layout Plain Layout
4437
4438 wall_vol = 0.0817239 meter^3
4439 \end_layout
4440
4441 \begin_layout Plain Layout
4442
4443
4444 \backslash
4445 end{ascend}
4446 \end_layout
4447
4448 \end_inset
4449
4450
4451 \end_layout
4452
4453 \begin_layout LyX-Code
4454
4455 \end_layout
4456
4457 \begin_layout Standard
4458 \begin_inset Note Note
4459 status collapsed
4460
4461 \begin_layout Plain Layout
4462 Some of this stuff appears to have changed in the PDF....
4463 \end_layout
4464
4465 \end_inset
4466
4467
4468 \end_layout
4469
4470 \begin_layout Standard
4471 \begin_inset Marginal
4472 status collapsed
4473
4474 \begin_layout Plain Layout
4475 alter the units used for displaying values
4476 \end_layout
4477
4478 \end_inset
4479
4480 You may wish to alter the units used to display these results.
4481 For example, you enter the diameter
4482 \emph on
4483 D
4484 \emph default
4485 in ft.
4486 You may wish to reassure yourself the
4487 \family typewriter
4488 1.21922 meter
4489 \family default
4490 is 4 ft.
4491 Go to the Script window and under the Tools menu select
4492 \emph on
4493 '
4494 \emph default
4495 Measuring units'.
4496 The
4497 \series bold
4498 Units
4499 \series default
4500 window
4501 \begin_inset Index idx
4502 status collapsed
4503
4504 \begin_layout Plain Layout
4505 Units window
4506 \end_layout
4507
4508 \end_inset
4509
4510
4511 \begin_inset Index idx
4512 status collapsed
4513
4514 \begin_layout Plain Layout
4515 window, Units
4516 \end_layout
4517
4518 \end_inset
4519
4520 will open.
4521 Enlarge it appropriately and then place it to the top and far right of
4522 your display.
4523 \end_layout
4524
4525 \begin_layout Standard
4526 There are two ways you can reset the units for displaying length.
4527 \end_layout
4528
4529 \begin_layout Enumerate
4530 Length is a basic dimension in ASCEND so under the
4531 \emph on
4532 Display
4533 \emph default
4534 button select Length.
4535 A side window will open with all the alternate units supported in ASCEND
4536 for length.
4537 Select ft.
4538 \end_layout
4539
4540 \begin_layout Enumerate
4541 Or, in the lower part of the Units window is a frame labeled 'Set units'.
4542 Clear and then type
4543 \family typewriter
4544 ft
4545 \family default
4546 then hit Enter.
4547 \end_layout
4548
4549 \begin_layout Standard
4550 In either way, the units for all length variables will switch to ft.
4551 Look at the values in the Browser window.
4552 \end_layout
4553
4554 \begin_layout Standard
4555 The left upper window of the Units window contains many variable types that
4556 have composite dimensions.
4557 For example, you will find volume there.
4558 Pick it and the right window fills with all the alternative units in which
4559 you can express volume.
4560 \end_layout
4561
4562 \begin_layout Standard
4563 Play with changing the units for displaying the various variables in the
4564 vessel instance v.
4565
4566 \end_layout
4567
4568 \begin_layout Standard
4569 One point - the left window displaying types having composite dimensions
4570 will display only one type for each composite dimension.
4571 If the atom types you have loaded were to include volume_difference as
4572 well as volume, then only one of the two types, volume or volume_difference,
4573 will be listed here.
4574 Changing the units to express either changes the units for both.
4575 \end_layout
4576
4577 \begin_layout Standard
4578 \begin_inset Marginal
4579 status collapsed
4580
4581 \begin_layout Plain Layout
4582 returning to a consistent set of units
4583 \end_layout
4584
4585 \end_inset
4586
4587 When you are done, you may wish to return to a consistent set, such as SI
4588 \begin_inset Index idx
4589 status collapsed
4590
4591 \begin_layout Plain Layout
4592 SI
4593 \end_layout
4594
4595 \end_inset
4596
4597 .
4598 Under the Display button are different sets; pick
4599 \emph on
4600 SI (MKS) set
4601 \emph default
4602 .
4603 \end_layout
4604
4605 \begin_layout Standard
4606 \begin_inset Marginal
4607 status collapsed
4608
4609 \begin_layout Plain Layout
4610 now we can solve the model in other ways
4611 \end_layout
4612
4613 \end_inset
4614
4615 We can now resolve our vessel instance in any number of different ways.
4616 For example we can ask what the diameter would be if we had a volume of
4617
4618 \emph on
4619 250 ft3
4620 \emph default
4621 .
4622 To accomplish this calculation, we need first to make
4623 \emph on
4624 vessel_volume
4625 \emph default
4626 a variable whose value we wish to fix.
4627 When we do this the model will be overspecified.
4628 ASCEND will indicate this problem to us and offer us a list of variables
4629 - including the vessel diameter
4630 \emph on
4631 D
4632 \emph default
4633 , one of which we will have to "unfix
4634 \begin_inset Index idx
4635 status collapsed
4636
4637 \begin_layout Plain Layout
4638 unfix
4639 \end_layout
4640
4641 \end_inset
4642
4643 ." Finally we need to alter the value of
4644 \emph on
4645 vessel_volume
4646 \emph default
4647 to the desired value and solve.
4648 Explicit instructions to accomplish these steps are as follows.
4649 \end_layout
4650
4651 \begin_layout Itemize
4652 In the
4653 \series bold
4654 Browser
4655 \series default
4656 window, make
4657 \emph on
4658 vessel_volume
4659 \emph default
4660 the current object (select it using the left mouse button).
4661 The right window of the
4662 \series bold
4663 Browser
4664 \series default
4665 display the parts of the
4666 \emph on
4667 vessel_volume
4668 \emph default
4669 , among them is the fixed flag with a value of
4670 \emph on
4671 FALSE
4672 \emph default
4673 .
4674
4675 \end_layout
4676
4677 \begin_layout Itemize
4678 (If you do not see the value for fixed but rather its type as a boolean,
4679 under the
4680 \emph on
4681 View
4682 \emph default
4683 button at the top, select
4684 \emph on
4685 Display Atom Values.
4686 \emph default
4687 )
4688 \end_layout
4689
4690 \begin_layout Itemize
4691 Pick fixed with the right mouse button, and, in the small window that opens,
4692 delete the value
4693 \emph on
4694 FALSE
4695 \emph default
4696 , enter the value
4697 \emph on
4698 TRUE
4699 \emph default
4700 and select
4701 \emph on
4702 OK
4703 \emph default
4704 .
4705 \end_layout
4706
4707 \begin_layout Itemize
4708 Now make v the current object by picking it in the left window of the
4709 \series bold
4710 Browser
4711 \series default
4712 .
4713 \end_layout
4714
4715 \begin_layout Itemize
4716 Export v to the Solver again by selecting to Solver under the Export button.
4717 A window entitled Overspecified
4718 \begin_inset Index idx
4719 status collapsed
4720
4721 \begin_layout Plain Layout
4722 Overspecified
4723 \end_layout
4724
4725 \end_inset
4726
4727 will appear listing the variables v.D, v.H_to_D_ratio and v.vessel_volume.
4728 Pick v.D and hit the OK button; ASCEND will reset its fixed flag to FALSE.
4729 \end_layout
4730
4731 \begin_layout Itemize
4732 Finally, return to the
4733 \series bold
4734 Browser
4735 \series default
4736 window and select
4737 \emph on
4738 vessel_volume
4739 \emph default
4740 with the right mouse button.
4741 In the small window that appears type
4742 \emph on
4743 250
4744 \emph default
4745 in the left window,
4746 \emph on
4747 ft^3
4748 \emph default
4749 in the right, and hit the
4750 \emph on
4751 OK
4752 \emph default
4753 button.
4754 \end_layout
4755
4756 \begin_layout Itemize
4757 Under the
4758 \emph on
4759 Execute
4760 \emph default
4761 button in the
4762 \series bold
4763 Solver
4764 \series default
4765 window, select
4766 \emph on
4767 Solve
4768 \emph default
4769 .
4770 \end_layout
4771
4772 \begin_layout Standard
4773 Note the
4774 \series bold
4775 Solver
4776 \series default
4777 reports only 4 blocks for 6 equations.
4778 This time it has to solve some equations simultaneously.
4779 In the
4780 \series bold
4781 Solver
4782 \series default
4783 window, under the
4784 \emph on
4785 Display
4786 \emph default
4787 button, select the
4788 \emph on
4789 Incidence matrix
4790 \emph default
4791 tool.
4792 You will see that the first three equations must be solved together as
4793 a single block of equations.
4794 \end_layout
4795
4796 \begin_layout Standard
4797 \begin_inset Marginal
4798 status collapsed
4799
4800 \begin_layout Plain Layout
4801 clearing all the fixed flags
4802 \end_layout
4803
4804 \end_inset
4805
4806 For a more complicated model you may wish to start over on the process of
4807 selecting which variables are fixed.
4808 You can set the fixed flags for all the variables in a problem to FALSE
4809 all at once -- without knowing which are currently set to TRUE.
4810 In the Browser window, under the Edit button, select the Run method tool.
4811 A window will open that displays a list of default methods that are automatical
4812 ly attached to every model in ASCEND.
4813 One is called ClearAll.
4814 Pick it and hit OK.
4815 All the fixed flags for the entire model will now be reset to FALSE.
4816 Can you think of a way to check if this is true? (Do you remember how to
4817 check which variables are currently fixed? Repeat that check and you should
4818 find no variables are on the list.)
4819 \end_layout
4820
4821 \begin_layout Standard
4822 You might now want to play by changing what you calculate and fix.
4823 \end_layout
4824
4825 \begin_layout Section
4826 Discussion
4827 \end_layout
4828
4829 \begin_layout Standard
4830 You have just completed the creation and solving of a very small model in
4831 ASCEND.
4832 In doing so, you have been exposed to some interesting issues.
4833 How can we separate the concept of the model from how we intend to solve
4834 it? How do we make a model to be well-posed -- i.e., a model involving n
4835 equations in n unknowns -- so we can solve it? How should one handle the
4836 units for the variables in a modeling system? What we have shown you here
4837 is for a small model.
4838 We still need to show you how one can make a large model well-posed, for
4839 example.
4840 You will start to understand how one can do this in the next chapter.
4841 \end_layout
4842
4843 \begin_layout Standard
4844 The next chapter is crucial for you to understand if you want to begin to
4845 understand how we approach good modeling practice.
4846 Please do continue with it.
4847 As it uses the vessel model, it would, of course, be best to continue with
4848 that chapter now.
4849 \end_layout
4850
4851 \end_body
4852 \end_document

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