PCL Examples > Introduction > Supporting Files
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Supporting Files
The spool.ses file is a session file that is used by many of the examples in this book. To use this file, hold down the control key and the right mouse button, highlight the text and paste it into a text file named spool.ses. Start Patran and go to File/Session/Play to run the session file.
  
spool.ses
()
#
#  Purpose      : This file will generate a PATRAN database
#                 "spool.db" which consists of a free standing
#                 aluminum spool, wound with a wire which results
#                 in a compressive pressure on the spool's core
#                 and flanges.
#
#                 This file can be run by starting a session of
#                 Patran, and running this session file
#                 through the "File","Session","Play" pulldown
#                 menus on the menu bar.
#
#  Model        : The spool is 8 units tall with a core diameter of
#                 2 units, a flange diameter of 8 units. Fillet
#                 radius is 1 unit. The spool is made of aluminum,
#                 0.075 units thick.
#
#                 The model consists of
#                 * +400 psi compressive pressure on spool core
#                 * +20  psi compressive pressure on the top and
#                   bottom flanges
#                 * +400  to +20 psi compressive pressure varying
#                   over the top and bottom flanges
#
#   Analysis &    After running this session file, analysis can be
#   Results:      done by following these steps.
#                 1. Choose "MSC.Nastran" from "Preferences",
#                    "Analysis..." pulldown menus on the menu bar.
#                 2. Select "Analysis" switch and from the form
#                    displayed, select the "Subcase Select" menu
#                    button from the "The Subcases For Solution Sequence: 101"
#                    select both default and spool_loads from the List box
#                    and it will be added the selected subcases list box.
#                    Enter OK. This will generate Subcase 1 (Default subcase)
#                 3. Select the  "Translation Parameters..."
#                    button. From the "OUTPUT2 Fomat" Option Menu
#                    select option "Text". Press "OK".
#                 4. Press "Apply" on "Analysis" window.
#                    If MSC.Nastran is available this will create
#                    a file "spool.op2"
#                 5. From the "Analysis" window, from "Action"
#                    Option Menu, select "Read Output2" option.
#                 6. Click on the "Select Results File.." Button
#                    and select "spool.op2". Press "Apply".
#                 7. The results will be read, and a file
#                    "spool.jbr" is created.
#---------------------------------------------------------------------
#
#  Create a new database and set the preferences
uil_file_new.go("", "./spool.db")
$? YES  36000002
 
ga_viewport_size_set( "default_viewport", 3.5, 3.5, 1 )
ga_viewport_location_set( "default_viewport", 0.0, 5.0, 1 )
 
db_set_pref( 303, 3, 0, FALSE, 0.0040000002, "" )
#---------------------------------------------------------------------
#  Construct two curves for the bottom flange and core
STRING asm_create_line_xyz_created_ids[VIRTUAL]
asm_const_line_xyz( "1", "<3 0 0>", "[0 0 0]", "Coord 0",           @
   asm_create_line_xyz_created_ids )
asm_const_line_xyz( "2", "<0 4 0>", "[0 0 0]", "Coord 0",           @
   asm_create_line_xyz_created_ids )
#---------------------------------------------------------------------
#  Create a fillet between the flange and the core curves
STRING asm_create_line_fil_created_ids[VIRTUAL]
asm_const_line_fillet( "3", 1, 1., 0.0040000002, TRUE,              @
   "Construct PointCurveUOnCurve (Evaluate Geometry"//              @
   "(Point 1 )) (Evaluate Geometry (Curve 1 ))",                    @
   "Construct PointCurveUOnCurve (Evaluate Geometry"//              @
   "(Point 1 )) (Evaluate Geometry (Curve 2 ))",                    @
   asm_create_line_fil_created_ids )
$# Do you wish to trim the original curves?
$? YESFORALL 1000047
#---------------------------------------------------------------------
#  Create spool surface using Create's Revolve method
STRING sgm_sweep_surface_r_created_ids[VIRTUAL]
sgm_const_surface_revolve( "1", "{[-1 0 0][-1 1 0]}", 360.,         @
   0.,"Coord 0","Curve 1 3 2", sgm_sweep_surface_r_created_ids )
ga_view_aa_set( 30., 60., 0. )
ga_display_lines_set( "general", 2 )
#---------------------------------------------------------------------
#  Create the surfaces for the top half of the spool using
#  Mirror method
STRING sgm_transform_surf__created_ids[VIRTUAL]
sgm_transform_mirror( "4", "surface", "{[0 4 0][0 5 0]}",           @
   0., TRUE, FALSE, "Surface 1:3 ", sgm_transform_surf__created_ids )
#---------------------------------------------------------------------
#  Set the positive surface normal vectors
STRING sgm_edit_surface_r_reversed_ids[VIRTUAL]
sgm_edit_surface_reverse( TRUE, "Surface 1:6",                      @
   sgm_edit_surface_r_reversed_ids )
sgm_edit_surface_reverse( TRUE, "Surface 1:6",                      @
   sgm_edit_surface_r_reversed_ids )
#---------------------------------------------------------------------
# Create a local cylindrical coordinate frame
STRING asm_create_cord_3po_created_ids[VIRTUAL]
asm_const_coord_3point( "1", "Coord 0", 2, "[-1 0 0]", "[-1 1 0]",  @
   "[1 0 0]", asm_create_cord_3po_created_ids )
#---------------------------------------------------------------------
#   Create a pressure field 400_20_psi_transition
fields_create( "400_20_psi_transition", "Spatial", 1, "Scalar",     @
   "Real", "Coord 1", "", "Function", 1, "R", "", "",               @
   "780-380*'R", "", "", FALSE, [0.], [0.], [0.], [[[0.]]] )
#---------------------------------------------------------------------
#  Apply a pressure varying from 400 to 20 psi on the fillet
loadsbcs_create( "fillet_pressure", "Pressure", "Element Uniform",  @
   "2D", "Static", ["Surface 2 5"], "Geometry", "", 1., ["",        @
   "f:400_20_psi_transition", ""], ["", "", ""] )
#  Apply a pressure of 400 psi on the core
loadsbcs_create( "400_psi", "Pressure", "Element Uniform", "2D",    @
   "Static", ["Surface 3 6"], "Geometry", "", 1., ["", "400",       @
   ""], ["", "", ""] )
#  Apply a pressure of 20 psi on the top and bottom flanges
loadsbcs_create( "20_psi", "Pressure", "Element Uniform", "2D",     @
   "Static", ["Surface 1 4"], "Geometry", "", 1., ["", "20", ""],   @
   ["", "", ""] )
#---------------------------------------------------------------------
#  Apply displacement constraint at the centre of the spool
loadsbcs_create( "TZ_fixed", "Displacement", "Nodal", "", "Static", @
   ["Point 7"], "Geometry", "Coord 1", 1., ["<0,0,0>", "<0,0,0 >"   @
   ], ["", ""] )
#---------------------------------------------------------------------
#  Create a new group called "fem_model" and make it current
sys_poll_option( 2 )
ga_group_create( "fem_model" )
ga_group_current_set( "fem_model" )
$# Group "fem_model" created.
sys_poll_option( 0 )
#---------------------------------------------------------------------
#  Define mesh seeds for the flanges, core and fillets
ui_exec_function( "mesh_seed_display_mgr", "init" )
mesh_seed_create( "Curve 1 3 2 Surface 6.1 5.1 4.1 ", 1, 4, 0.,     @
   0., 0.)
mesh_seed_create( "Surface 1.1 4.4 ", 1, 24, 0., 0., 0. )
mesh_seed_display_mgr.erase(  )
#---------------------------------------------------------------------
#  Create the finite element mesh
INTEGER fem_create_mesh_surfa_num_nodes
INTEGER fem_create_mesh_surfa_num_elems
STRING fem_create_mesh_s_nodes_created[VIRTUAL]
STRING fem_create_mesh_s_elems_created[VIRTUAL]
fem_create_mesh_surf_2( "IsoMesh", 0, "Surface 1:6 ", 1, [0.1],     @
   "Quad4", "1", "1", "Coord 0", "Coord 0",                         @
   fem_create_mesh_surfa_num_nodes,                                 @
   fem_create_mesh_surfa_num_elems,                                 @
   fem_create_mesh_s_nodes_created,                                 @
   fem_create_mesh_s_elems_created )
#---------------------------------------------------------------------
#  Equivalence the coincident nodes
REAL fem_equiv_all_x_equivtol
INTEGER fem_equiv_all_x_segment
fem_equiv_all_group3( [" "], 0, "", 1, 0.0040000002, FALSE,         @
   fem_equiv_all_x_equivtol, fem_equiv_all_x_segment )
#---------------------------------------------------------------------
#  Optimise the model
INTEGER fem_optimize_iband(4)
INTEGER fem_optimize_iprof(4)
INTEGER fem_optimize_maxwf(4)
REAL fem_optimize_avgwf(4)
REAL fem_optimize_rmswf(4)
fem_optimize( "Nodes", "Both", "Profile", 1, fem_optimize_iband,    @
   fem_optimize_iprof, fem_optimize_maxwf, fem_optimize_avgwf,      @
   fem_optimize_rmswf )
#---------------------------------------------------------------------
#  Define material properties for Aluminum
material.create( "Analysis code ID", 1, "Analysis type ID", 1,      @
   "aluminum", 0, "Date: 14-May-97           Time: 13:49:55",       @
   "Isotropic", 1, "Directionality", 1, "Linearity", 1,             @
   "Homogeneous", 0, "Linear Elastic", 1, "Model Options & IDs",    @
   ["", "", "", "", ""], [0, 0, 0, 0, 0], "Active Flag", 1,         @
   "Create", 10, "External Flag", FALSE, "Property IDs",            @
   ["Elastic Modulus", "Poisson Ratio", "Density"], [2, 5, 16, 0],  @
   "Property Values", ["10.1e6", "0.33", "0.1", ""] )
#---------------------------------------------------------------------
#  Create and assign element properties
elementprops_create( "const_thick_spool", 51, 25, 35, 1, 1, 20,     @
   [13, 20, 36, 4037, 4111, 4118, 4119], [5, 9, 1, 1, 1, 1, 1],     @
   ["m:aluminum", "", "0.075", "", "", "", ""], "Surface 1:6" )
#---------------------------------------------------------------------
#  Create a load case consisting the pressures and displacement
#  constraint
loadcase_create2( "spool_loads", "Static", "", 1., ["TZ_fixed",     @
   "20_psi", "400_psi", "fillet_pressure"], [0, 0, 0, 0], [1., 1.,  @
   1., 1.], "", 0., TRUE )
sys_poll_option( 2 )
#---------------------------------------------------------------------
pref_fa_set([FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,@
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, @
   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@
   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,@
   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE,  @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,  @
   FALSE, FALSE, FALSE, FALSE, FALSE], [6, 3, 1, 1, 5, 7, 2, 2, 8,1,@
   2, 3, 3, 5, 2, 1, 3, 4, 5, 3, 3, 2, 2, 2, 2, 6, 6, 6, 3, 6, 15,5,@
   5, 5, 5, 6, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE,    @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,   @
   FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE], [3, 4, 5, 6, 1,@
   1, 7, 8, 9, 10], [FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,@
   TRUE, TRUE, TRUE], FALSE )
display_fa_vectors( TRUE )
sys_poll_option( 0 )
#---------------------------------------------------------------------
#  End of File.