Contents     Functions              PDF Index

## 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

### gen

Level-set computation.

rect(lx,ly,xc,yc,alpha); circ(rc,xc,yc); box(lx,ly,lz,xc,yc,zc,nx,ny,nz); sphere(rc,xc,yc,zc)); cyl(xc,yc,zc,nx,ny,nz,rc,z0,z1);

### cut

Accepted options are

• .doCut start by dividing elements
• .tolE fractional distance to edge end considered used to enforce node motion.
• .Fixed nodes that should not be moved.

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
RO.doSplit=1; 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,'doSplit',1);
[model,li]=ofdemos('LS3d',RO);li{1} % Spherical cut
mo3=lsutil('cut -dosplit',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
```