SDT-base
Contents  
Functions  
 ![]() ![]() |
Purpose
Mesh utilities for shape optimization. This function is provided as is, and only supported under direct contracts with SDToools.
Description
This function aims at providing efficient mesh topology variations for parameterized design.
Given a deformation MAP defined over all nodes of the model (see the Build command), the Adjust command moves nodes. In a call of the form
model_new=fe_shapeoptim('adjust',model,'MapName');
MapName can be omitted if the name is Adjust. Accepted options are
The Build command takes displacement fields defined on parts of the model and rebuilds the internal displacement fields needed to properly deform the mesh. This field is built to avoid excessive mesh distortion typically obtained when only skin nodes are moved. As a result, much larger deformations are acceptable before remeshing is needed. The general format for calls is
model=fe_shapeoptim('Build',model,MAP);
To keep certain nodes fixed a null displacement vector must be specified in the MAP. Otherwise they are included in the list of dependent nodes whose position is controlled during the shape optimization procedure.
The BuildFromSel command generates a volume deformation MAP from the displacement of an edge. The general format call is
model=fe_shapeoptim('BuildFromSel',model,opt);
opt is a structure with fields
With this information, the command first applies an edge deformation on the surfaces connected to the edge, then computes a deformation on the full face model from the local edge deformation and eventually computes the corresponding volume deformation. This aims at improving edge movement avoiding surface/volume effects which can yield unregular deformations.
The following example shows the modification of a cube height by elongation along vector z. The modification has to be compared with a bold displacement of the top face nodes of the cubes only. Here the elongation is evenly distributed from the top elements to be moved to the bottom elements that must not.
model=femesh('testhexa8b divide 5 5 5'); % basic cube model % see base model: cf=feplot(model); % define z=1 cube side elongation along z vector: % find NodeId with z==1 (top of the cube) i1=feutil('findnode z==1',model); % define the MAP, with displacement vector [0 0 1] for each node MAP=struct('ID',i1,... 'normal',repmat([0 0 1],length(i1),1)); % fix the bottom side of the cube MAP=fe_shapeoptim('MapFixed',model,'z==0',MAP) % Obtain model with deformation field in Stack model=fe_shapeoptim('Build',model,MAP); % apply the deformation to the cube model=fe_shapeoptim('Adjust',model); cf=feplot(model); axis on;% see the new model (with z in [0 2])
The Following example shows the modification of the height of one of the edges of a cube, with and without releasing the opposite edge.
model=femesh('testhexa8b divide 5 5 5');% a basic cube model % Generate the face set with connectivity model=feutilb('SurfaceAsQuad group 20 -set"face"',model); % Define Edge to move opt=struct('EdgeSel',[28;100],... 'EdgeDir',[0 0 1],... 'FaceSel','face'); % Compute first model=fe_shapeoptim('buildfromsel -cf 2',model,opt); % Release an edge with other corners : node 6 7 opt.ReleaseSel=[6 7]; model=fe_shapeoptim('buildfromsel name "Adj" -cf2',model,opt); % Compare original and with released edge deformation MAP cf=feplot(2);cf.def(1)=cf.Stack{'Adjust'};cf.def(2)=cf.Stack{'Adj'}; fecom(cf,'Show2def');fecom(cf,'scc1') % See the nodes chosen for the edge detection fecom(cf,'shownodemark',opt.EdgeSel,'marker','o','color','r') % See the node chose to release one edge fecom(cf,'shownodemark-noclear',opt.ReleaseSel,'marker','o','color','k')
model_new=fe_shapeoptim('deform -safe i',model,MAP)
Builds the adjustment field and adjusts the geometry. Accepted options are
MAP handling utilities.
MAP=fe_shapeoptim('MapFixed',mo1,data,MAP) appends fixed nodes to a MAP. data can be a list of nodes or a FindNode string.
Mesh utility performing a 3x3x3 hierarchical mesh refinement of hexaedron elements. When partial refinement is performed the elements at the selection interface are refined with RefineHexaSurf to keep mesh compatibility. An option to generate MPC coupling is available. As hierarchical refinement requires a coherent topology, mesh compatibility at the interface is studied so that interface elements sharing several faces with the interface will also be refined with the 3x3x3 rule, this inclusion of new elements in the original selection is iterative until no such case happens. The refine mesh part can thus significantly increase depending on the mesh configuration. This command exploits feutil RefineCell command, all sub-options are available.
A typical syntax will be model=fe_shapeoptim('RefineHexaMesh',model);.
By default the whole surface is selected through a FindElt eltname hexa command. It is also possible to provide in second argument either a FindElt string providing an element selection or a set data structure (see feutil AddSetEltId).
Iterative refinement is possible with a target characteristic length using command option -lc detailed below.
The following command options are available
Command RefineHexaMesh-divlcvalc will perform a uniform NxNxN refinement to obtain a characteristic length of valc from the original. In this mode, no compatible layer is supported. option -InterMPC can be used to get a coupling MPC between the refined part and the rest of the mesh. This command exploits feutil RefineCell command, all sub-options are available.
Sample refinement calls are presented below
% Refine hexaedron elements with interface compatibility % Generate a test model based on a hexahedron model=femesh('TestHexa8 -divide 4 4 4'); % Clean element identifiers [eltid,model.Elt]=feutil('EltIdFix;',model); % Refine the top layer with compatibility mo3=fe_shapeoptim('RefineHexaMesh',model,'withnode{z==1}') cf=feplot(mo3); fecom(cf,'colordatagroup') % Variant calls on the same base model model=femesh('TestHexa8 -divide 4 4 4'); [eltid,model.Elt]=feutil('EltIdFix;',model); % Refine a top edge layer mo3=fe_shapeoptim('RefineHexaMesh',model,'withnode{z==1&y==0}') cf=feplot(mo3); fecom(cf,'colordatagroup') % do same refinement but with MPC for coupling mo4=fe_shapeoptim('RefineHexaMesh-InterMPC',model,'withnode{z==1&y==0}') cf=feplot(mo4); fecom(cf,';colorfacealpha.1;coloredgealpha.1;colordatagroup;') fecom(cf,';CurTab:Cases;proviewon;') % do same refinement with compatibility and get mesh projection MPC mo5=fe_shapeoptim('RefineHexaMesh-mpcALL',model,'withnode{z==1&y==0}') cf=feplot(mo5); fecom(cf,';colorfacealpha.1;coloredgealpha.1;colordatagroup;') sdth.urn('Tab(Cases,MPCrefine){Proview,on}',cf); % Perform refinement sequence mo3=fe_shapeoptim('RefineHexaMesh',model,'withnode{z==1&y==0}|withnode{z==1}') mo3=fe_shapeoptim('RefineHexaMesh',mo3,'withnode{z==1&y==0}') mo3=fe_shapeoptim('RefineHexaMesh',mo3,'withnode{z==1&y==1&x==0}') cf=feplot(mo3); fecom(cf,'colordatagroup') % Refine a top edge layer, iterate to reach a characteristic length of 0.02 mo3=fe_shapeoptim('RefineHexaMesh -lc.02',model,'withnode{z==1&y==0}') cf=feplot(mo3); fecom(cf,'colordatagroup') % Refine a top edge layer, iterate to reach a characteristic length of 0.02 % but control mesh size by limiting the characteristic length over 0.01 mo3=fe_shapeoptim('RefineHexaMesh -lc.02 -lcmin.01',model,'withnode{z==1&y==0}') cf=feplot(mo3); fecom(cf,'colordatagroup') % Now do a uniform N-refinement with target lc mo4=fe_shapeoptim('RefineHexaMesh-divlc.05 -InterMPC keepEP',model,'withnode{z==1&y==0}') cf=feplot(mo4); fecom(cf,';colorfacealpha.1;coloredgealpha.1;colordatagroup;') fecom(cf,';CurTab:Cases;proviewon;')
Meshing utility allowing the hierarchical refinement of a structured hexahedral mesh surface (divide characteristic length by 3) without refining element layers underneath while keeping a conform mesh. Side interfaces compatibility is handled by default using a conforming mesh. Command option -InterMPC allows generating a MPC to enforce continuity at side faces without remeshing adjacent elements if needed. This command exploits feutil RefineCell command, all sub-options are available.
A typical syntax will be model=fe_shapeoptim('RefineHexaSurf',model);.
By default the whole surface is selected through a FindElt SelFace command. It is also possible to provide in second argument either a FindElt string providing a face selection or a FaceId set data structure (see feutil AddSetFaceId).
The following command options are available
Sample refinement calls are presented below
% Refine hexahedral surfaces of structured meshes % Generate a test model based on a hexahedron model=femesh('TestHexa8'); % Refine it to get 4 hexa model=feutil('RefineToQuad',model); % Clean element identifiers [eltid,model.Elt]=feutil('EltIdFix;',model); % Refine the top surface mo1=fe_shapeoptim('RefineHexaSurf',model,'selface & innode{z==1}') % Visualize the generated mesh cf=feplot(mo1); fecom(cf,'ShowPatch') % Now only refine half of the top surface % with an MPC to keep displacement continuity mo2=fe_shapeoptim('RefineHexaSurf-InterMPC',model,... 'selface & innode{z==1 & y>=.5}'); % Display the model cf=feplot(mo2); % Activate interactive model data visualization fecom(cf,';ShowPatch;ProModelInit;ProViewOn;') % Setup transparancy to analyse MPC fecom(cf,'SetProp sel(1).fsProp','FaceAlpha',0.1,'EdgeAlpha',0.1); % Display generated MPC in feplot fecom(cf,'CurTabCases',{'MPCedge','MPCface'}) % Now refine only one element mo3=fe_shapeoptim('RefineHexaSurf',model,... 'selface & innode{z==1 & y>=.5 & x>=.5}'); cf=feplot(mo3); fecom(cf,'ShowPatch') % Final case with two surfaces on a bigger model model=d_mesh('meshblade') [u1,model.Elt]=feutil('eltidfix;',model); mo1=fe_shapeoptim('RefineHexaSurf',model,'selface & withnode 50 87 89 51 '); cf=feplot(mo1); fecom(cf,'ColorDataGroup');
Meshing utility allowing the refinement of a structured quad mesh edges (divide characteristic length by 3) without refining element layers outside selection while keeping a conform mesh. This command exploits feutil RefineCell command, all sub-options are available.
A typical syntax will be model=fe_shapeoptim('RefineQuadEdge',model);.
By default the whole contour is selected through a FindElt SelEdge command. It is also possible to provide in second argument either a FindElt string providing an edge selection or a EdgeId set data structure (see feutil AddSetEdgeId.
The following command options are available
Sample refinement calls are presented below, each example illustrates different configurations
% Refine quad edges of structured meshes % Generate a test model based on a quad model=femesh('TestQuad4 -divide 4 5'); % Clean element identifiers [eltid,model.Elt]=feutil('EltIdFix;',model); % Refine the full external contour mo1=fe_shapeoptim('RefineQuadEdge',model); cf=feplot(mo1); fecom(cf,'colordatagroup'); % Refine one side of the contour % with an MPC to keep displacement continuity mo2=fe_shapeoptim('RefineQuadEdge',model,... 'seledge & innode{x==0}'); cf=feplot(mo2); fecom(cf,'colordatagroup'); % Refine two sides of the contour mo3=fe_shapeoptim('RefineQuadEdge',model,... 'seledge & innode{x==0|y==0}'); cf=feplot(mo3); fecom(cf,'colordatagroup'); % Refine two sides and part of the third section mo4=fe_shapeoptim('RefineQuadEdge',model,... 'seledge & innode{x==0} | innode{x<.5|y==0}'); cf=feplot(mo4); fecom(cf,'colordatagroup'); % Refine around a line in the interior mo5=fe_shapeoptim('RefineQuadEdge',model,... 'withnode{nodeid 23} & seledge-nouni'); cf=feplot(mo5); fecom(cf,'colordatagroup'); % Refine a surface in the interior mo6=fe_shapeoptim('RefineQuadEdge',model,... 'withnode{nodeid 23} & seledgeall-nouni'); cf=feplot(mo6); fecom(cf,'colordatagroup'); % Refine all part of a model mo7=fe_shapeoptim('RefineQuadEdge',model,... 'withnode{x<.6} & seledgeall-nouni'); cf=feplot(mo7); fecom(cf,'colordatagroup'); % Mesh compatibility is handled if tria elements are present: % regenerate a model with some quads model=femesh('TestQuad4 -divide 4 5'); % Clean element identifiers [eltid,model.Elt]=feutil('EltIdFix;',model); [model.Elt,elt]=feutil('removeelt innode{X>.3&x<1&y>.3&y<3}',model); mo1=model; mo1.Elt=elt; mo1=feutil('quad2tria',mo1); model=feutil('addelt-newid',model,mo1.Elt); % Refine two sides and part of the third section mo4=fe_shapeoptim('RefineQuadEdge',model,... 'seledge & innode{x==0} | innode{x<.5|y==0}'); cf=feplot(mo4); fecom(cf,'colordatagroup');
Meshing utility allowing the refinement of triangle elements without altering the specified contour. The strategy is adapted not to generate too flat elements and accepts a characteristic length for refinement target. As such selected tria3 elements are refined into three elements by the addition of a central node. Edges whose size remains over tolerance outside the contour are eliminated by triangle merge to form elements that will be split into four tria3 elements. This command exploits feutil RefineCell command, all sub-options are available.
A typical syntax is model=fe_shapeoptim('RefineTriaSurfmodel,sel);.
model is a model with tria3 elements. If sel is omitted, the all tria3 based surfaces are selected.
The following command options are available:
% generate basic tria mesh model=femesh('testquad4 -divide3 3 '); model=feutil('quad2tria',model); % refine with target size mo1=fe_shapeoptim('RefineTriaSurf-tol.25',model) cf=feplot(mo1); fecom(cf,'colordatagroup'); % lower tolerance and do loops mo1=fe_shapeoptim('RefineTriaSurf-tol0.05 -loop4',model)
Supports interpolation of fields between different meshes. Typical uses are extraction of press-forming or composite draping results to generate material orientation to be written in the info,EltOrient case entry and decomposition of variable thickness to generate multiple zones.
See also
femesh, feutil, fe_fmesh, nl_mesh