(* ASCEND modelling environment
Copyright (C) 1998, 2007 Carnegie Mellon University
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*)
(*
Use of this module is demonstrated by the associated script file
vesselTabulated.a4s.
by Arthur W. Westerberg
THIS FILE IS AUTO-IMPORTED INTO THE ASCEND MANUAL! BE CAREFUL WITH EDITS.
*)
REQUIRE "atoms.a4l";
PROVIDE "vesselTabulated.a4c";
MODEL vessel(
vessel_vol "the volume contained within the cylindrical vessel"
WILL_BE volume;
wall_thickness "the thickness of all of the vessel walls"
WILL_BE distance;
metal_density "density of the metal from which the vessel
is constructed"
WILL_BE mass_density;
H_to_D_ratio "the ratio of vessel height to diameter"
WILL_BE factor;
metal_mass "the mass of the metal in the walls of the vessel"
WILL_BE mass;
);
NOTES
'author' SELF {Arthur W. Westerberg}
'creation date' SELF {May, 1998}
END NOTES;
(* variables *)
side_area "the area of the cylindrical side wall of the vessel",
end_area "the area of the flat ends of the vessel"
IS_A area;
wall_vol "the volume of the walls for the vessel"
IS_A volume;
H "the vessel height (of the cylindrical side walls)",
D "the vessel diameter"
IS_A distance;
(* equations *)
FlatEnds: end_area = 1{PI} * D^2 / 4;
Sides: side_area = 1{PI} * D * H;
Cylinder: vessel_vol = end_area * H;
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol;
HD_definition: D * H_to_D_ratio = H;
VesselMass: metal_mass = metal_density * wall_vol;
METHODS
METHOD specify;
NOTES
'purpose' SELF {to fix four variables and make the problem well-posed}
END NOTES;
FIX vessel_vol;
FIX H_to_D_ratio;
FIX wall_thickness;
FIX metal_density;
END specify;
METHOD values;
NOTES
'purpose' SELF {to set the values for the fixed variables}
END NOTES;
H_to_D_ratio := 2;
vessel_vol := 250 {ft^3};
wall_thickness := 5 {mm};
metal_density := 5000 {kg/m^3};
END values;
METHOD bound_self;
END bound_self;
METHOD bound_all;
RUN bound_self;
END bound_all;
METHOD scale_self;
END scale_self;
METHOD scale_all;
RUN scale_self;
END scale_all;
METHOD default_self;
D := 1 {m};
H := 1 {m};
END default_self;
METHOD default_all;
RUN default_self;
vessel_vol := 1 {m^3};
wall_thickness := 5 {mm};
metal_density := 5000 {kg/m^3};
H_to_D_ratio := 1;
END default_all;
END vessel;
ADD NOTES IN vessel;
'description' SELF {This model relates the dimensions of a
cylindrical vessel -- e.g., diameter, height and wall thickness
to the volume of metal in the walls. It uses a thin wall
assumption -- i.e., that the volume of metal is the area of
the vessel times the wall thickness.}
'purpose' SELF {to illustrate the insertion of notes into a model}
END NOTES;
MODEL tabulated_vessel_values;
vessel_volume "volume of all the tabulated vessels"
IS_A volume;
wall_thickness "thickness of all the walls for all the vessels"
IS_A distance;
metal_density "density of metal used for all vessels"
IS_A mass_density;
n_entries "number of vessels to simulate"
IS_A integer_constant;
n_entries :== 20;
H_to_D_ratio[1..n_entries] "set of H to D ratios for which we are
computing metal mass"
IS_A factor;
metal_mass[1..n_entries] "mass of metal in walls of vessels"
IS_A mass;
FOR i IN [1..n_entries] CREATE
v[i] "the i-th vessel model"
IS_A vessel(vessel_volume, wall_thickness,
metal_density, H_to_D_ratio[i], metal_mass[i]);
END FOR;
METHODS
METHOD default_self;
END default_self;
METHOD specify;
RUN v[1..n_entries].specify;
END specify;
METHOD values;
NOTES 'purpose' SELF {to set up 20 vessel models having H to D ratios
ranging from 0.1 to 2.}
END NOTES;
vessel_volume := 250 {ft^3};
wall_thickness := 5 {mm};
metal_density := 5000 {kg/m^3};
FOR i IN [1..n_entries] DO
H_to_D_ratio[i] := i/10.0;
END FOR;
END values;
METHOD scale_self;
END scale_self;
END tabulated_vessel_values;
ADD NOTES IN tabulated_vessel_values;
'description' SELF {This model sets up an array of vessels to
compute a range of metal_mass values for different values
of H_to_D_ratio.}
'purpose' SELF {to illustrate the use of arrays in ASCEND}
END NOTES;