addGeometryLevel_FEB

Below is a demonstration of the features of the addGeometryLevel_FEB function

Contents

clear; close all; clc;

Syntax

[domNode]=addGeometryLevel_FEB(domNode,FEB_struct);

Description

This function adds the geometry information to the input XML data (domNode) based on the input febio structure (FEB_struct).

Examples

Example: Defining geometry section

%Example data
F1=[1 2 3]; %A surface
V=rand(8,3); %Nodes (vertices)
E_hex=[1 2 3 4 5 6 7 8]; %hex8 elements
E_tet=[1 2 3 4]; %tet4 elements
E_quad=[1 2 3 4]; %quad4 elements
elementMaterialIndices=[1]; %material indices for the elements
V_fib=[0 0 1]; %Fibre directions for each element
nodeList=[1 5 7]; %List of nodes, e.g. for boundary conditions specification

%Geometry section
FEB_struct.Geometry.Nodes=V;
FEB_struct.Geometry.Elements={E_hex,E_tet,E_quad}; %The element sets
FEB_struct.Geometry.ElementType={'hex8','tet4','quad4'}; %The element types
FEB_struct.Geometry.ElementMat={elementMaterialIndices,elementMaterialIndices,elementMaterialIndices};
FEB_struct.Geometry.ElementsPartName={'Block','tet','surf'};

%Adding fibre direction, construct local orthonormal basis vectors
[a,d]=vectorOrthogonalPair(V_fib);

VF_E=zeros(size(V_fib,1),size(V_fib,2),2);
VF_E(:,:,1)=a; %a1 ~ e1 ~ X or first direction
VF_E(:,:,2)=d; %a2 ~ e2 ~ Y or second direction
%Vf_E %a3 ~ e3 ~ Z, third direction, or fibre direction

%ElementData
FEB_struct.Geometry.ElementData.MatAxis.ElementIndices=1:1:size(E_hex,1);
FEB_struct.Geometry.ElementData.MatAxis.Basis=VF_E;

%Defining node sets
FEB_struct.Geometry.NodeSet{1}.Set=nodeList;

%Defining surfaces
FEB_struct.Geometry.Surface{1}.Set=F1;
FEB_struct.Geometry.Surface{1}.Type='tri3';
FEB_struct.Geometry.Surface{1}.Name='Contact_master_indentor';


%Initialize docNode object
domNode = com.mathworks.xml.XMLUtils.createDocument('febio_spec');

%Add boundary condition information
domNode=addGeometryLevel_FEB(domNode,FEB_struct);
Adding Geometry level
----> Adding node field
----> Adding element field
----> Adding hex8 element entries....
----> Adding tet4 element entries....
----> Adding quad4 element entries....
----> Creating MatAxis entries
----> Adding surface field
----> Adding NodeSet field
View example XML string
XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Geometry>
      <Nodes>
         <node id="1">8.4071726e-01, 6.1604468e-01, 7.5720023e-01</node>
         <node id="2">2.5428218e-01, 4.7328885e-01, 7.5372909e-01</node>
         <node id="3">8.1428483e-01, 3.5165951e-01, 3.8044585e-01</node>
         <node id="4">2.4352497e-01, 8.3082863e-01, 5.6782164e-01</node>
         <node id="5">9.2926362e-01, 5.8526409e-01, 7.5854290e-02</node>
         <node id="6">3.4998377e-01, 5.4972361e-01, 5.3950119e-02</node>
         <node id="7">1.9659525e-01, 9.1719366e-01, 5.3079755e-01</node>
         <node id="8">2.5108386e-01, 2.8583902e-01, 7.7916723e-01</node>
      </Nodes>
      <Elements mat="1" name="Block" type="hex8">
         <elem id="1">   1,   2,   3,   4,   5,   6,   7,   8</elem>
      </Elements>
      <Elements mat="1" name="tet" type="tet4">
         <elem id="2">   1,   2,   3,   4</elem>
      </Elements>
      <Elements mat="1" name="surf" type="quad4">
         <elem id="3">   1,   2,   3,   4</elem>
      </Elements>
      <ElementData>
         <element id="1">
            <mat_axis>
               <a>1.0000000e+00, 0.0000000e+00, -0.0000000e+00</a>
               <d>-0.0000000e+00, 1.0000000e+00, 0.0000000e+00</d>
            </mat_axis>
         </element>
      </ElementData>
      <Surface name="Contact_master_indentor">
         <tri3 id="1">   1,   2,   3</tri3>
      </Surface>
      <NodeSet name="NodeSet_1">
         <node id="1"/>
         <node id="2"/>
         <node id="3"/>
      </NodeSet>
   </Geometry>
</febio_spec>

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]

GIBBON footer text

License: https://github.com/gibbonCode/GIBBON/blob/master/LICENSE

GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.

Copyright (C) 2018 Kevin Mattheus Moerman

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.