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.3821378e-02, 4.4267827e-01, 3.9978265e-01</node>
         <node id="2">2.2897697e-01, 1.0665277e-01, 2.5987040e-01</node>
         <node id="3">9.1333736e-01, 9.6189808e-01, 8.0006848e-01</node>
         <node id="4">1.5237802e-01, 4.6342241e-03, 4.3141383e-01</node>
         <node id="5">8.2581698e-01, 7.7491046e-01, 9.1064759e-01</node>
         <node id="6">5.3834244e-01, 8.1730322e-01, 1.8184703e-01</node>
         <node id="7">9.9613472e-01, 8.6869471e-01, 2.6380292e-01</node>
         <node id="8">7.8175529e-02, 8.4435846e-02, 1.4553898e-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>0.0000000e+00, 1.0000000e+00, -0.0000000e+00</a>
               <d>-1.0000000e+00, 0.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]