addConstraintsLevel_FEB

Below is a demonstration of the features of the addConstraintsLevel_FEB function

Contents

clear; close all; clc;

Syntax

[domNode]=addConstraintsLevel_FEB(domNode,FEB_struct);

Description

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

Examples

Example: Defining fix/prescribed constraint for a rigid body

%Example data
bcPrescribeMagnitudes=[pi 1 -5]; %example prescribed displacement magnitudes
rigidMaterialId=2; %Example material Id for rigid body material

%Constraint section
FEB_struct.Constraints{1}.RigidId=rigidMaterialId;

FEB_struct.Constraints{1}.Prescribe{1}.bc='x';
FEB_struct.Constraints{1}.Prescribe{1}.Scale=bcPrescribeMagnitudes(1);
FEB_struct.Constraints{1}.Prescribe{1}.lc=1;

FEB_struct.Constraints{1}.Prescribe{2}.bc='y';
FEB_struct.Constraints{1}.Prescribe{2}.Scale=bcPrescribeMagnitudes(2);
FEB_struct.Constraints{1}.Prescribe{2}.lc=1;

FEB_struct.Constraints{1}.Prescribe{3}.bc='z';
FEB_struct.Constraints{1}.Prescribe{3}.Scale=bcPrescribeMagnitudes(3);
FEB_struct.Constraints{1}.Prescribe{3}.lc=1;

FEB_struct.Constraints{1}.Fix{1}.bc='Rx';
FEB_struct.Constraints{1}.Fix{2}.bc='Ry';
FEB_struct.Constraints{1}.Fix{3}.bc='Rz';

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

%Add boundary condition information
domNode=addConstraintsLevel_FEB(domNode,FEB_struct);
Adding Constraints level
View example XML string
XML_str = xmlwrite(domNode);
disp(XML_str);
<?xml version="1.0" encoding="utf-8"?>
<febio_spec>
   <Constraints>
      <rigid_body mat="2">
         <fixed bc="Rx"/>
         <fixed bc="Ry"/>
         <fixed bc="Rz"/>
         <prescribed bc="x" lc="1">3.1415927e+00</prescribed>
         <prescribed bc="y" lc="1">1.0000000e+00</prescribed>
         <prescribed bc="z" lc="1">-5.0000000e+00</prescribed>
      </rigid_body>
   </Constraints>
</febio_spec>

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]