addBoundaryLevel_FEB

Below is a demonstration of the features of the addBoundaryLevel_FEB function

Contents

clear; close all; clc;

Syntax

[domNode]=addBoundaryLevel_FEB(domNode,FEB_struct);

Description

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

Examples

Example: Prescribed dislacement using node list

This method of defining a boundary conditions allows one to vary the nodeScale of each member of the set list

%Prescribed displacement in x direction
FEB_struct.Boundary.Prescribe{1}.Set=[1:10]';
FEB_struct.Boundary.Prescribe{1}.bc='x';
FEB_struct.Boundary.Prescribe{1}.lc=1;
FEB_struct.Boundary.Prescribe{1}.nodeScale=rand(10,1);

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

%Add boundary condition information
domNode=addBoundaryLevel_FEB(domNode,FEB_struct);
Adding Boundary level
----> Defining prescribe type boundary conditions
View example XML string
XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Boundary>
      <prescribe bc="x" lc="1">
         <node id="1">7.9428454e-01</node>
         <node id="2">3.1121504e-01</node>
         <node id="3">5.2853314e-01</node>
         <node id="4">1.6564873e-01</node>
         <node id="5">6.0198194e-01</node>
         <node id="6">2.6297128e-01</node>
         <node id="7">6.5407910e-01</node>
         <node id="8">6.8921450e-01</node>
         <node id="9">7.4815159e-01</node>
         <node id="10">4.5054160e-01</node>
      </prescribe>
   </Boundary>
</febio_spec>

Example: Prescribed dislacement using NodeSet

This method of defining a boundary conditions will set a same scale for all members of NodeSet

clear FEB_struct; %Clear variable from last example

%Defining node set
FEB_struct.Geometry.NodeSet{1}.Set=11:20;
FEB_struct.Geometry.NodeSet{1}.Name='bcPrescribeList';

%Prescribed displacement in x direction
FEB_struct.Boundary.Prescribe{1}.SetName=FEB_struct.Geometry.NodeSet{1}.Name;
FEB_struct.Boundary.Prescribe{1}.bc='x';
FEB_struct.Boundary.Prescribe{1}.lc=1;
FEB_struct.Boundary.Prescribe{1}.Scale=0.5;

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

% %Add geometry information (NodeSet)
% domNode=addGeometryLevel_FEB(domNode,FEB_struct);

%Add boundary condition information
domNode=addBoundaryLevel_FEB(domNode,FEB_struct);
Adding Boundary level
----> Defining prescribe type boundary conditions
View example XML string
XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Boundary>
      <prescribe bc="x" lc="1" scale="5.000000e-01" set="bcPrescribeList"/>
   </Boundary>
</febio_spec>

Example: Fixed conditions using list

clear FEB_struct; %Clear variable from last example

FEB_struct.Boundary.Fix{1}.bc='x';
FEB_struct.Boundary.Fix{1}.Set=1:10;

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

%Add boundary condition information
domNode=addBoundaryLevel_FEB(domNode,FEB_struct);
Adding Boundary level
----> Defining fix type boundary conditions

View example XML string

XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Boundary>
      <fix bc="x">
         <node id="1"/>
         <node id="2"/>
         <node id="3"/>
         <node id="4"/>
         <node id="5"/>
         <node id="6"/>
         <node id="7"/>
         <node id="8"/>
         <node id="9"/>
         <node id="10"/>
      </fix>
   </Boundary>
</febio_spec>

Example: Fixed conditions using NodeSet

clear FEB_struct; %Clear variable from last example

%Defining node set
FEB_struct.Geometry.NodeSet{1}.Set=11:20;
FEB_struct.Geometry.NodeSet{1}.Name='bcFixList';

FEB_struct.Boundary.Fix{1}.bc='x';
FEB_struct.Boundary.Fix{1}.SetName=FEB_struct.Geometry.NodeSet{1}.Name;

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

% %Add geometry information (NodeSet)
% domNode=addGeometryLevel_FEB(domNode,FEB_struct);

%Add boundary condition information
domNode=addBoundaryLevel_FEB(domNode,FEB_struct);
Adding Boundary level
----> Defining fix type boundary conditions

View example XML string

XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Boundary>
      <fix bc="x" set="bcFixList"/>
   </Boundary>
</febio_spec>

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]