PCL Examples > Finite Element Functions > Optimize Action
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Optimize Action
This section contains examples of some of the functions used to optimize entities in a finite element model.
  
()
#
#  Purpose          :  This file provides an example of a call to the
#                      function fem_optimize()
#
#                      This session file creates a new database by the
#                      name new.db. A surface is created and meshed.
#                      This function is then called to renumber the
#                      nodes so as to minimize the time required to
#                      find a finite element solution.
#
#                      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.
#
#  The function fem_optimize()
#  has the following arguments:
#
#  fem_optimize
#     (  object,
#        method,
#        criterion,
#        starting_id,
#        bandwidth,
#        profile,
#        maximum_wavefront,
#        average_wavefront,
#        rms_wavefront )
#
#---------------------------------------------------------------------
#  Variable Declarations
STRING   s_object[8]
STRING   s_method[32]
STRING   s_criterion[32]
INTEGER  i_starting_id
INTEGER  ia_bandwidth(4)
INTEGER  ia_profile(4)
INTEGER  ia_maximum_wavefront(4)
REAL     ra_average_wavefront(4)
REAL     ra_rms_wavefront(4)
INTEGER  i_num_fem_nodes
INTEGER  i_num_fem_elements
STRING   sv_fem_nodes_created[VIRTUAL]
STRING   sv_fem_elements_created[VIRTUAL]
STRING   sv_created_ids[VIRTUAL]
INTEGER  i_return_value
 
#---------------------------------------------------------------------
#  Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
 
#---------------------------------------------------------------------
#  Create a surface
 
i_return_value =                                 @
   asm_const_patch_xyz                           @
      (  "1", "<1 1 0>", "[0 0 0]", "Coord 0",   @
         sv_created_ids) 
dump i_return_value
 
#---------------------------------------------------------------------
#  Mesh the surface
 
i_return_value =                                 @
   fem_create_mesh_surf_2                        @
      (  "IsoMesh", 0, "Surface 1", 1, [0.2],    @
         "Quad4", "1", "1", "Coord 0", "Coord 0",@
         i_num_fem_nodes, i_num_fem_elements,    @
         sv_fem_nodes_created, sv_fem_elements_created)
dump i_return_value
 
node_label( TRUE )
 
#---------------------------------------------------------------------
#  Session file paused. Press "Resume" to continue.
sf_pause()
 
#---------------------------------------------------------------------
#  Optimize nodes in the model
#
s_object      = "Nodes"
s_method      = "Both"
s_criterion   = "RMS Wavefront"
i_starting_id = 1
 
i_return_value =                                 @
   fem_optimize                                  @
      (  s_object,                               @
         s_method,                               @
         s_criterion,                            @
         i_starting_id,                          @
         ia_bandwidth,                           @
         ia_profile,                             @
         ia_maximum_wavefront,                   @
         ra_average_wavefront,                   @
         ra_rms_wavefront )
dump i_return_value
dump ia_bandwidth
dump ia_profile
dump ia_maximum_wavefront
dump ra_average_wavefront
dump ra_rms_wavefront
 
sys_free_string(sv_fem_nodes_created)
sys_free_string(sv_fem_elements_created)
sys_free_string(sv_created_ids)
 
#---------------------------------------------------------------------