lsutil#
Purpose
Level set utilities.
Syntax
model=lsutil('cut',model,li,RO) def=lsutil('gen',model,li) lsutil('ViewLs',model,li)
Description
lsutil provides a number of tools for level-set creation and manipulation.
Some commands return the model structure while others return the value of the level-set. Plot outputs are also available.
Available lsutil commands are
edge[cut, sellevellines, self2, gensel]#
eltset#
gen[-max]#
Level-set computation. This call takes 2 arguments: model a standard model and li data to build LS functions. li can be a structure or a cellarray containing structures. Required field in each structure is .shape, a string defining the form of the LS. Accepted shapes are
- "rect": additional required fields are .lx, .ly, .xc, .yc and .alpha;
- "box": additional required fields are .lx, .ly, .lz, .xc, .yc, .zc, .nx, .ny and .nz;
- "circ": additional required fields are .xc, .yc and .rc;
- "sphere": additional required fields are .xc, .yc, .zc and .rc;
- "cyl": additional required fields are .xc, .yc, .zc, .rc, .nx, .ny, .nz, .z0 and .z1.
Optional field is .toAxis. - "cyla": additional required fields are .xc, .yc, .zc, .rc, .nx, .ny and .nz.
- "toseg": additional required fields are .orig, .normal, .z0 and .z1. Optional field is .rc.
- "toplane": additional required fields are .xc, .yc, .zc, .nx, .ny and .nz.
Optional field is .lc. - "tes": additional required field is .distInt.
- "cnem": additional required fields are .xyz and .val. Optional field is .box.
- "interp": additional required field is .distInt. Optional field is .box.
- "distFcn": additional required field is .distInt.
Instead of using coordinates (.xc, .yc, .zc) to define center of those shapes, user can provide a nodeId in the field .idc. Other optional fields are accepted, namely .rsc to scale LS values, .LevelList to fixed target levels.
cut[,face2tria]#
Accepted options are
- .tolE fractional distance to edge end considered used to enforce node motion.
- .Fixed nodes that should not be moved.
- .keepOrigMPID not to alter elements MPID. By default added elements inherits the original element property.
- .keepSets to update EltId sets present in model so that added elements are also added in EltId sets to which original elements belonged.
Here a first example with placement of circular piezo elements
RO=struct('dim',[400 300 8],'tolE',.3); [mdl,li]=ofdemos('LS2d',RO);lsutil('ViewLs',mdl,li); li{1} % Specification of a circular level set mo3=lsutil('cut',mdl,li,RO); lsutil('ViewLs',mo3,li); % display the level set fecom('ShowFiPro') % Show element properties
Now a volume example
RO=struct('dim',[10 10 40],'tolE',.1); [model,li]=ofdemos('LS3d',RO);li{1} % Spherical cut mo3=lsutil('cut',model,li,RO); cf=feplot(mo3);feplot('ShowFiMat')% Now do a cylinder cut li={struct('shape','cyl','xc',.5,'yc',.5,'zc',1,'nx',0,'ny',0,'nz',-1, ... 'rc',.2,'z0',-.4,'z1',.4,'mpid',[200 300])}; mo3=lsutil('cut',model,li,RO);feplot(mo3); cf.sel={'innode {x>=.5}','colordatamat -edgealpha.1'} fecom('ShowFiPro') % Show element properties
Command CutFace2Tria transforms faces of selected elements into a triangular mesh. Combination with the cut command, it ensures that the cut interface only features triangular elements. This can be useful to perform tet remeshing of one of the cut volumes while ensuring mesh compatibility at the interface.
Syntax is model=lsutil('CutFace2Tria',model,sel); with model a standard model, and sel either
- A cell-array of level sets that was used to cut the model. Element selection is peformed using mpid command.
- An EltId or FaceId set structure.
- An element matrix.
- A FindElt string
- A list of EltId or FaceId
% Generate a cube model RO=struct('dim',[10 10 40],'tolE',.1); [model]=ofdemos('LS3d',RO); model=stack_rm(model,'info','EltOrient'); % Transform one face to use triangles model=lsutil('CutFace2Tria',model,'selface & innode{x==0}');
mpid#
Command MPID assigns MatId and ProId provided in the level set data structure, or by default as indices of level sets to which they belong.
RO=struct('dim',[10 10 40],'tolE',.1); [model,li]=ofdemos('LS3d',RO);li{1} % Spherical cut % li{1} features MatId 200 and ProId 300 % assign these properties to elements in level set model=lsutil('mpid',model,li); feplot(model) fecom('ShowFiPro');
surf[,stream,frompoly,remesh,fromrectmesh]#
See also