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

model.shape()
Create and define shape functions for the field variables’ elements.
Syntax
model.shape().create(<tag>,<frame>);
model.shape(<tag>).elementSet(<condition>);
model.shape(<tag>).frame(<ftag>);
model.shape(<tag>).create(<ftag>,<func>);
model.shape(<tag>).feature(<ftag>).set(property,<value>);
model.shape(<tag>).slits().named(<seltag>);
model.shape(<tag>).slits().set(...);
model.shape(<tag>).upFlux(<varName>);
model.shape(<tag>).downFlux(<varName>);
model.shape(<tag>).domainFlux(<expressions>,<frame>);
 
model.shape(<tag>).elementSet();
model.shape(<tag>).frame();
model.shape(<tag>).feature(<ftag>).shape();
model.shape(<tag>).feature(<ftag>).getType(<property>);
model.shape(<tag>).feature(<ftag>).properties;
model.shape(<tag>).fieldVariable();
model.shape(<tag>).slits().named();
model.shape(<tag>).slits().getType();
model.shape(<tag>).upFlux();
model.shape(<tag>).downFlux();
Description
model.shape(<tag>) returns a shape function.
model.shape().create(<tag>,<frame>) creates a shape function with tag <tag> and assigns the frame <frame> to it.
model.shape(<tag>).frame(<ftag>) assigns frame <ftag> to the shape function. See model.frame() for a discussion on the default frame.
model.shape(<tag>).create(<ftag>,<func>) creates a shape feature with the shape function expression func. func can be a shape function name (shlag, for example) or a shape function with arguments (shlag(2,u), for example). The latter is interpreted as an assignment of some property values.
  model.shape(<tag>).feature(<ftag>).set(property,<value>) sets a property for the shape function. Of the data types listed in Table 2-2, the ones supported are those for integers, strings, and string arrays. Which ones are applicable differs for each property.
model.shape(<tag>).selection().named(<seltag>) assigns the shape function to the named selection <seltag>.
model.shape(<tag>).selection().set(...) defines a local selection that assigns the shape function to geometric entities. For a complete list of methods available under selection(), see Selections.
model.shape(<tag>).upFlux(<varName>) and model.shape(<tag>).downFlux(<varName>) set the names of the up and down boundary flux variables. model.shape(<tag>).domainFlux(<expressions>,<frame>) sets expressions for the domain flux in a given frame. This is required to make the boundary flux variables produce accurate results. Only Lagrange shape functions support boundary flux variables.
model.shape(<tag>).frame() returns the frame tag as a string.
  model.shape(<tag>).feature(<ftag>).shape() returns the shape function expression as a string.
model.shape(<tag>).feature(<ftag>).getType(property) returns a property value. For available data types, see get* and Selection Access Methods.
model.shape(<tag>).feature(<ftag>).properties() returns the names of the properties as a string array.
model.shape(<tag>).fieldVariable() returns the field variables which the shape functions define.
model.shape(<tag>).selection().named() returns the selection tag as a string.
model.shape(<tag>).elementSet(<condition>) sets the element set condition to the given string. The condition should be an expression containing element set variables (defined in model.elementSet()) and the logical operators &&, ||, and !. The shape function is defined only on the mesh elements for which the condition is true (nonzero).
model.shape(<tag>).elementSet() returns the element set condition. An empty string means no condition.
model.shape(<tag>).selection().getType() returns domain information. For available methods, see model.selection().
model.shape(<tag>).slits() returns a selection used to generate a slit on the shape. Works exactly as selections.
model.shape(<tag>).upFlux() and model.shape(<tag>).downFlux() return the names of the up and down flux variables (an empty string if the variable names have not been set.)
Example
Define the shape function shlag(2,"u"):
Code for use with Java
model.shape().create("shu","f");
model.shape("shu").create("f1","shlag");
model.shape("shu").feature("f1").set("order",2);
model.shape("shu").feature("f1").set("basename","u");
model.shape("shu").selection().named("equ1");
Code for use with MATLAB
model.shape.create('shu','f');
model.shape('shu').create('f1','shlag');
model.shape('shu').feature('f1').set('order',2);
model.shape('shu').feature('f1').set('basename','u');
model.shape('shu').selection.named('equ1');
See also Shape Functions and Element Types for information and syntax examples for all shape functions (element types).
See Also
model.coeff(), model.intRule(), model.weak() and the Elements and Shape Functions chapter.