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

model.cpl()
Add component couplings.
Syntax
model.cpl().create(<tag>,type,<gtag>);
model.cpl(<tag>).set(property,<value>);
model.cpl(<tag>).set("opname",<opname>)
model.cpl(<tag>).selection(property).named(<seltag>);
model.cpl(<tag>).selection(property).set(...);
model.cpl(<tag>).create(<subtag>,subtype);
model.cpl(<tag>).feature(<subtag>).getAllowedPropertyValues(property);
model.cpl(<tag>).feature(<subtag>).set(property,<value>);
 
model.cpl(<tag>).getType(property,<value>);
model.cpl(<tag>).feature(<subtag>).properties();
model.cpl(<tag>).feature(<subtag>).getType(property,<value>);
model.cpl(<tag>).hasProperty(String pname);
 
model.cpl(<tag>).set(String pname, int value);
model.cpl(<tag>).set(String pname, int pos, int value);
model.cpl(<tag>).set(String pname, int pos, int[] value);
model.cpl(<tag>).set(String pname, int pos1, int pos2, int value);
model.cpl(<tag>).setIndex(String name, String value, int index);
model.cpl(<tag>).setIndex(String name, String value, int firstIndex, int secondIndex);
model.cpl(<tag>).setIndex(String name, String[] value, int index);
model.cpl(<tag>).setIndex(String name, double value, int index);
model.cpl(<tag>).setIndex(String name, double value, int firstIndex, int secondIndex);
model.cpl(<tag>).setIndex(String name, double[] value, int index);
model.cpl(<tag>).setIndex(String name, int value, int index);
model.cpl(<tag>).setIndex(String name, String value, int index);
model.cpl(<tag>).setIndex(String name, String value, int index);
model.cpl(<tag>).setIndex(String name, int value, int firstIndex, int secondIndex);
model.cpl(<tag>).setIndex(String name, int[] value, int index);
 
The set() methods index/position arguments are 1-based. The setIndex() methods index/position arguments are 0-based.
Description
model.cpl().create(<tag>,type,<gtag>) creates a component coupling of type type on the geometry <gtag>. The supported types are GeneralExtrusion, LinearExtrusion, BoundarySimilarity, IdentityMapping, GeneralProjection, LinearProjection, Integration, Average, Maximum, and Minimum. The component coupling operators provide coupling of values, typically from a source to a destination between or within model components.
model.cpl(<tag>).selection().named(<seltag>) assigns the component coupling’s source to the named selection <seltag>. model.cpl(<tag>).selection().set(...) defines a local selection that assigns the component coupling’s source to geometric entities. For a complete list of methods available under selection(), see Selections.
model.cpl(<tag>).set(property,<value>) specifies properties relevant for the selected component coupling type, see below.
model.cpl(<tag>).set("opname",<opname>) sets the operator name of the component coupling. The default component coupling operator name is <tag>.
  model.cpl(<tag>).selection(property).named(<seltag>) assigns the component coupling’s selection property to the named selection <seltag>. model.cpl(<tag>).selection(property).set(...) defines a local selection that assigns the component coupling’s selection property to geometric entities. For a complete list of methods available under selection(), see model.selection().
model.cpl(<tag>).create(<subtag>,subtype) creates a subfeature of type subtype. This can only be done when the component coupling type is BoundarySimilarity. The supported values of subtype are OnePointMap, TwoPointMap, and EdgeMap.
model.cpl(<tag>).selection().named() returns the named source selection of the coupling.
model.cpl(<tag>).selection().getType(...) queries the source selection.
model.cpl(<tag>).properties() returns the list of assigned properties as a string array.
model.cpl(<tag>).getType(property) returns the value of a specified property.
model.cpl(<tag>).selection(property).named() returns the named selection tag of the selection property.
model.cpl(<tag>).selection(property).getType(...) queries a selection property.
model.cpl(<tag>).feature(<subtag>)).
getAllowedPropertyValues(property)
returns the set of allowed values for a property if the set is a finite set of strings; otherwise, it returns null.
Notation: srcedim = dimension of source selection; srcsdim = space dimension of source geometry.
Extrusion Couplings
An extrusion coupling operator oper maps an expression e defined on (a part of) the source selection to an expression oper(e) that can be evaluated on (a part of) the destination geometries. For each point ps in the source selection, there can be zero, one or several corresponding points pd in the destination. The inverse mapping ps = m(pd) is always one-to-one. The value of oper(e) at the point pd is defined as the value of e at the point ps.
The inverse mapping m is specified as the composition of a destination map md and the inverse of a source map ms: ps = m(pd) = ms1(md(pd)). In other words, ms(ps) = md(pd) — both the destination map and the source map into the same intermediate space. For all operator types except GeneralExtrusion, the intermediate space coincides with the source geometry. The source map is always one-to-one. By default, the source map is the identity.
The operator type determines the type of destination map:
For most of these coupling types, a source map described by (possibly nonlinear) expressions can be used.
usetol | closest
on | off
If method=usetol, oper(e) is defined when the source point ps is within the source selection, or if it is slightly outside. The tolerance is given in the property exttol, which is a distance in mesh element local coordinates; that is, it is a measure relative to the mesh element size. If oper(e) is not defined, an error message is given (if usenan=off), or the value NaN is returned (if usenan=on).
If method=closest, a brute force search method is used, which makes oper(e) defined everywhere (the nearest point to ps in the source selection is used).
Depending on the coupling type, additional properties are available (see below).
GeneralExtrusion
A general extrusion coupling operator maps an expression defined on a source to an expression that can be evaluated on any destination geometry where the destination map expressions are valid.
mesh | material | spatial
on | off
Trailing empty expressions in the properties dstmap and srcmap are ignored. The remaining expressions must be equal in number, and this determines the dimension idim of the intermediate space. Requirement: srcedim <= idim <= srcsdim. Changing the source selection has the side effect of changing dstmap and srcmap so that this requirement is satisfied. By default, idim=srcsdim.
The source mesh is viewed in the frame srcframe. The source mapping is taken to be linear within each source mesh element.
If usesrcmap=off, the srcmap property is not used. In this case, dstmap is a mapping from the destination to the source (viewed in the frame srcframe), and idim=srcsdim.
LinearExtrusion
A linear extrusion coupling operator linearly maps an expression defined on a source to an expression that can be evaluated in the destination.
mesh | material | spatial
mesh | material | spatial
on | off
The number of selections srcvertexN and dstvertexN is 4. These are used only for 1<=N<=dim+1, where dim is a number less than or equal to min(srcsdim,dstsdim). The remaining 4-dim selections should be empty.
The destination map is the following linear (affine) map from the destination geometry to the source geometry:
1
First, if dim<dstsdim, an orthogonal projection onto the affine space spanned by the destination vertices. The number of destination vertices is dim+1. Thus, dim=2 gives a plane, and dim=1 gives a line.
2
BoundarySimilarity (3D)
A boundary similarity coupling operator maps an expression defined on a part of a boundary to another part of a boundary with the same shape.
on | off
The destination transformation is a similarity transformation that maps a destination face (destination) onto a set of source faces (the source selection). The mesh is always viewed in the mesh frame.
By default, the algorithm automatically chooses a transformation when symmetries make several transformations possible. To control this choice, one of the following subfeatures can be added in 3D.
Table 2-34: SubFeature types
EdgeMap
An edge map specifies that a certain destination edge should be mapped onto a certain source edge. Their relative direction is given by the property direction. The edges must be adjacent to the given faces.
auto | same | opposite
OnePointMap
A one-point map specifies that a certain destination vertex should be mapped onto a certain source vertex.
TwoPointMap
A two-point map specifies that two destination vertices should be mapped onto two source vertices.
BoundarySimilarity (2D)
auto | same | opposite
on | off
The destination transformation is a similarity transformation that maps a destination edge (destination) onto a set of source edges (the source selection). Their relative direction is given by the property direction. The mesh is always viewed in the mesh frame.
IdentityMapping
An identity mapping coupling operator maps between geometric entities that overlap, possibly when viewed in different frames. The destination transformation is an identity mapping between the given frames.
mesh | material | spatial
mesh | material | spatial
Projection Couplings
A projection coupling operator oper maps an expression e defined on (a part of) the source selection to an expression oper(e) that can be evaluated on (a part of) the destination geometries. It does so by performing integration along curves in the source selection. These curves correspond to lines in an intermediate space, whose dimension is equal to srcedim. There is a source map ms mapping the source selection into the intermediate space, and a destination map md mapping the destination geometries into the subspace of intermediate space where the last coordinate is zero. The source map is always one-to-one. The value of oper(e) at a destination point pd is defined as follows:
1
2
3
Integrate the expression e over this curve.
This implies that the value of oper(e) at the destination point pd is the integral of e along a curve through the source point ps = ms1(md(pd)).
The coupling type determines the type of the maps:
Additional properties are available depending on the coupling type, see below.
GeneralProjection
Use a general projection component coupling to define integration along curves.
mesh | material | spatial
LinearProjection
A linear projection coupling operator defines a mapping between destination and source that is given by a linear map defined by vertices. Let v be the vector from the first source vertex to the last source vertex. The value of oper(e) at a point pd is equal to the integral of e over the line through the point ps=ms-1(md(pd)) with direction vector v.
mesh | material | spatial
mesh | material | spatial
The number of selections srcvertexN is 4. These are used only for 1<=N<=srcedim+1. The remaining selections should be empty. The number of source vertices is srcedim+1. The source map is a linear (affine) map that maps the source vertices onto the points 0, e1, e2,..., esrcedim in the intermediate space, where ei is the ith unit vector.
The number of selections dstvertexN is 4. These are used only for 1<=N<=srcedim. The remaining selections should be empty. The number of destination vertices is srcedim. The destination map is the following linear (affine) map from the destination geometry to the intermediate space:
1
First, if srcedim-1<dstsdim, an orthogonal projection onto the affine space spanned by the destination vertices. Thus, srcedim=3 gives a plane, and srcedim=2 gives a line.
2
Then, a linear (affine) map mapping the destination vertices onto the points 0, e1, e2,..., esrcedim-1 in the intermediate space, where ei is the ith unit vector.
Integration Couplings
Integration
By default, an integration coupling operator oper integrates an expression e over the source selection. The resulting value oper(e) can be used anywhere. If method=summation, the expression is instead summed over the nodes in the source selection.
mesh | material | spatial
integration | summation
Average
An average coupling operator oper integrates an expression e over the source selection and divides with the measure of the source selection. The resulting value oper(e) can be used anywhere.
mesh | material | spatial
Maximum/Minimum
A maximum or minimum coupling operator oper finds the maximum or minimum of an expression e over the source selection. The resulting value oper(e) can be used anywhere. An optional second argument is evaluated at the point where the first argument has its maximum or minimum. Use x, y, or z, for example, to get the coordinate location of the maximum or minimum.
node | integration | lagrange
The maximum/minimum is approximated by evaluating the expression in the specified points.