Example 5j5: Using line search with contact mechanics

This example demonstrates how line search can be used when solving a contact mechanics problem. A subroutine has been created at the top of the COM file where the projection commands are saved. This routine is called multiple times (from CMISS) during line search iterations to calculate the updated contact pressure. The name of the COM file is specified in the IRSOLV file.


The comfile run by this example is as follows:

#################################################################
# Set echo on so that commands do not get output to the terminal,
# especially when the projection commands are called multiple
# times from CMISS when doing line search.
#################################################################
set echo on;

# If the example path is not set, default to current directory
if (!defined $example) {
    $example = "./";
}
# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
    $example .= $chopped;
}

### Subroutine for projection
sub project{

    # update XP from YP
    FEM up geom from sol to 1..3 reg 1,2

    fem def xi;c contact_point faces SLAVE_FACE points 4 reg 1

    # Define data at xi positions, calculates xi 
    fem def data;c from_xi

    # Update slave info, Z_CONT & Z_CONT_LIST
    fem update data field to slave

    # Project onto target face (Region 2)
    fem def xi;c closest_face faces MASTER_FACE external region 2
 
    # store projection gap in data fields, calculates gap
    fem update data field from gap region 2  
 
    # Update master info, Z_CONT & Z_CONT_LIST
    fem update data field to master 

    # Place initial geometry YP(ny,3) into XP
    fem up geom from sol YP_index 3 to 1..3 reg 1,2

}

if ($LINESEARCH==1){

  #################################################################
  # Set echo on so that commands do not get output to the terminal,
  # especially when the projection commands are called multiple
  # times from CMISS when doing line search.
  #################################################################
  set echo on;
  &project;

} else {

  #################################################################
  # Set echo on so that commands do not get output to the terminal,
  # especially when the projection commands are called multiple
  # times from CMISS when doing line search.
  #################################################################
  set echo on;

  fem def para;r;contact;example
  fem def coor 3,1
  fem def regi;r;regi;example

  fem def base;r;tricubic;example

  fem define node;r;block1;example reg 1
  fem define elem;r;block1;example reg 1
  fem def fibre;r;block1;example reg 1
  fem def elem;r;block1;example fibre reg 1

  #fem expor node;slave as slave reg 1
  #fem expor elem;slave as slave reg 1

  fem define node;r;block2;example reg 2
  fem define elem;r;block2;example reg 2
  fem def fibre;r;block2;example reg 2
  fem def elem;r;block2;example fibre reg 2

  #fem expor node;master as master reg 2
  #fem expor elem;master as master reg 2

  fem group face 12 as MASTER_FACE reg 2
  fem group face 5 as SLAVE_FACE reg 1

  fem group node 13..16 as FIXED_MASTER reg 2
  fem group node 5..8 as FIXED_SLAVE reg 1

  fem def equa;r;mechanics;example reg 1
  fem def mat;r;mr_slave;example reg 1
  fem def init;r;block1;example reg 1

  fem def equa;r;mechanics;example reg 2
  fem def mat;r;mr_master;example reg 2
  fem def init;r;block2;example reg 2

  fem def solve;r;contact;example coupled reg 1,2

  # Define contact parameters
  fem def contact;r;contact;example

  $CONVERGED=0;
  while ($CONVERGED == 0){

    ### Projection
    &project;

    #################################################################
    # Set $LINESEARCH to 1 so that when line search routines
    # are called inside CMISS, fortran will only read the line search 
    # commands at the beginning of the COM file, and skip the rest.
    #################################################################
    $LINESEARCH=1;

    ### Mechanics problem
    fem solve coupled reg 1,2   

                  } #CONVERGED

  fem def init;w;conv_soln reg 1

} # else $LINESEARCH

Files used by this example are:

Name              Modified     Size

example_5j5.com 30-Aug-2010 3.6k block1.ipelem 25-Aug-2010 544 block1.ipelfb 25-Aug-2010 389 block1.ipfibr 25-Aug-2010 2.1k block1.ipinit 25-Aug-2010 2.8k block1.ipnode 25-Aug-2010 14k block2.ipelem 25-Aug-2010 541 block2.ipelfb 25-Aug-2010 358 block2.ipfibr 25-Aug-2010 2.1k block2.ipinit 25-Aug-2010 2.8k block2.ipnode 25-Aug-2010 14k contact.ipcont 25-Aug-2010 627 contact.ippara 31-Aug-2010 5.9k contact.irsolv 27-Aug-2010 2.6k conv_soln.ipinit 25-Aug-2010 42k mechanics.ipequa 25-Aug-2010 2.2k mr_master.ipmate 25-Aug-2010 2.8k mr_slave.ipmate 25-Aug-2010 2.8k regi.ipregi 25-Aug-2010 93 tricubic.ipbase 25-Aug-2010 6.6k

Download the entire example:

Name                      Modified     Size

examples_5_5j_5j5.tar.gz 01-Sep-2010 15k

Testing status by version:

StatusTestedReal time (s)
x86_64-linux
cmSuccessSun Mar 6 00:01:10 20162
cm-debugSuccessSat Mar 5 00:02:54 201611

Testing status by file:


Html last generated: Sun Mar 6 05:50:29 2016

Input last modified: Tue Aug 31 13:19:30 2010


CMISS Help / Examples / 5 / 5j / 5j5