General Commands > About General Commands > model.pair()

model.pair()
Create and define identity pairs and contact pairs.
Syntax
model.pair().create(<tag>,type,<gtag>);
model.pair(<tag>).type(type);
model.pair(<tag>).type();
model.pair(<tag>).pairName(<pname>);
model.pair(<tag>).pairName();
model.pair(<tag>).source().selMethod;
model.pair(<tag>).source().named(<seltag>);
model.pair(<tag>).source().named();
model.pair(<tag>).destination().selMethod;
model.pair(<tag>).destination().named(<seltag>);
model.pair(<tag>).destination().named();
model.pair(<tag>).swap();
model.pair(<tag>).srcFrame(<frame>);
model.pair(<tag>).srcFrame();
model.pair(<tag>).dstFrame(<frame>);
model.pair(<tag>).dstFrame();
model.pair(<tag>).hasAutoSelection();
model.pair(<tag>).manualSelection(manual);
model.pair(<tag>).manualSelection();
model.pair(<tag>).searchMethod(method);
model.pair(<tag>).searchMethod();
model.pair(<tag>).manualDist(manual);
model.pair(<tag>).manualDist();
model.pair(<tag>).searchDist(<dist>);
model.pair(<tag>).searchDist();
model.pair(<tag>).opName(src2dst);
model.pair(<tag>).mphOpName(src2dst);
model.pair(<tag>).gapName(src2dst);
model.pair(<tag>).active(boolean);
model.pair(<tag>).isActive();
model.pair().remove(<tag>);
Description
model.pair().create(<tag>,type,<gtag>) creates a pair with tag <tag> in the geometry with tag <gtag>. The type type is either Contact or Identity.  model.pair(<tag>).type() returns the pair type as a string. model.pair(<tag>).type(type) changes the pair type.
model.pair(<tag>).pairName(<pname>) sets the pair name, which is used as a suffix in operator names and variable names. By default, the pair name is the same as the tag. model.pair(<tag>).pairName() returns the pair name.
model.pair(<tag>).source().named(<seltag>) assigns the source boundaries to the named selection <seltag>.
model.pair(<tag>).source().set(...) defines a local selection that assigns the source boundaries to geometric entities. For a complete list of methods available under model.pair(<tag>).source(), see model.selection().
model.pair(<tag>).destination().named(<seltag>) assigns the destination boundaries to the named selection <seltag>.
model.pair(<tag>).destination().set(...) defines a local selection that assigns the destination boundaries to geometric entities. For a complete list of methods available under model.pair(<tag>).destination(), see model.selection().
model.pair(<tag>).swap() swaps the source and destination selections.
model.pair(<tag>).srcFrame(<frame>) and model.pair(<tag>).dstFrame(<frame>) sets the source and destination frames for the identity mapping. The argument <frame> can have the values spatial, material, or mesh. The default is spatial. These frames are only used for identity pairs. model.pair(<tag>).srcFrame() and model.pair(<tag>).dstFrame() returns the frame tags.
model.pair(<tag>).hasAutoSelection() returns true if the contact pair was created automatically, using the create pairs check box in the finalize geometry node.
model.pair(<tag>).manualSelection(manual) enables or disables manual control of the selections for a pair that was created automatically. model.pair(<tag>).manualSelection() returns true if manual control of selections is enabled, and false otherwise.
model.pair(<tag>).searchMethod(method) sets the search method for a contact pair. The argument method can be fast or direct. The default is fast. model.pair(<tag>).searchMethod() returns the search method
model.pair(<tag>).manualDist(manual) enables or disables manual control of the search distance for a contact pair. The argument manual is Boolean. The default value false means that the search distance is automatically computed based on the size of the geometry. model.pair(<tag>).manualDist() returns true if manual control of search distance is enabled, and false otherwise.
model.pair(<tag>).searchDist(<dist>) sets the search distance for a contact pair, when manual control of the search distance is enabled. The argument <dist> is a string whose default unit is the geometry’s length unit. The default is 1e-2. model.pair(<tag>).searchDist() returns the search distance as a string.
model.pair(<tag>).opName(src2dst) returns the name of the operator transferring an expression from source to destination (if src2dst=true) or from destination to source (if src2dst=false).
model.pair(<tag>).mphOpName(src2dst) returns the name of the multiphysics operator transferring an expression from source to destination (if src2dst=true) or from destination to source (if src2dst=false). When the test operator is applied on this operator, it does not give any contribution (reaction force) for the structural mechanics interfaces’ degrees of freedom due to the variable point mapping. These operators are available only for contact pairs.
model.pair(<tag>).gapName(src2dst) returns the name of the geometric gap variable seen from the destination (if src2dst=true) or seen from the source (if src2dst=false). These variables are available only for contact pairs.
model.pair(<tag>).active(boolean) enables or disables the pair.
boolean enabled = model.pair(<tag>).isActive() returns true if the pair is enabled, and false otherwise.
model.pair().remove(<tag>) deletes the pair.
Example
Create a contact pair in the geometry geom1 with source boundaries 4 and 6 and destination boundaries 10 and 12.
Code for use with Java
Model model = ModelUtil.create("Model");
GeomSequence g = model.geom().create("geom1", 3);
g.create("blk1", "Block");
g.create("blk2", "Block");
g.feature("blk2").set("pos", new String[]{"0.5", "0.5", "1"});
g.feature("fin").name("Form Assembly");
g.feature("fin").set("action", "assembly");
g.feature("fin").set("imprint", true);
g.feature("fin").set("createpairs", false);
g.run();
model.pair().create("p1", "Contact", "geom1");
model.pair("p1").source().set(new int[]{4, 6});
model.pair("p1").destination().set(new int[]{10, 12});
Code for use with MATLAB
model = ModelUtil.create('Model');
g = model.geom().create('geom1', 3);
g.create('blk1', 'Block');
g.create('blk2', 'Block');
g.feature('blk2').set('pos', {'0.5', '0.5', '1'});
g.feature('fin').name('Form Assembly');
g.feature('fin').set('action', 'assembly');
g.feature('fin').set('imprint', true);
g.feature('fin').set('createpairs', false);
g.run;
model.pair.create('p1', 'Contact', 'geom1');
model.pair('p1').source().set([4, 6]);
model.pair('p1').destination.set([10, 12]);