DEMO_febio_0057_diamon_lattice_compression_01

Below is a demonstration for:

Contents

Keywords

clear; close all; clc;

Plot settings

fontSize=15;
faceAlpha1=0.8;
faceAlpha2=1;
edgeColor=0.25*ones(1,3);
edgeWidth=1.5;
markerSize=25;
markerSize2=10;
cMap=gjet(4);

Control parameters

% Path names
defaultFolder = fileparts(fileparts(mfilename('fullpath')));
savePath=fullfile(defaultFolder,'data','temp');

% Defining file names
febioFebFileNamePart='tempModel';
febioFebFileName=fullfile(savePath,[febioFebFileNamePart,'.feb']); %FEB file name
febioLogFileName=fullfile(savePath,[febioFebFileNamePart,'.txt']); %FEBio log file name
febioLogFileName_disp=[febioFebFileNamePart,'_disp_out.txt']; %Log file name for exporting displacement
febioLogFileName_force=[febioFebFileNamePart,'_force_out.txt']; %Log file name for exporting force
febioLogFileName_stress=[febioFebFileNamePart,'_stress_out.txt']; %Log file name for exporting stress
febioLogFileName_stiffness=[febioFebFileNamePart,'_stiffness_out.txt']; %Log file name for exporting stiffness

%Latticeparameters
nRepeat=3; %Number of repetitions of the lattice pattern
sampleSize=30;
nSubPenta=2;
strutThickness=1; %Set the strut thickness

%Define applied displacement
appliedStrain=0.3; %Linear strain (Only used to compute applied stretch)
loadingOption=1; % 1=compression, 2=tension
switch loadingOption
    case 1 %compression
        stretchLoad=1-appliedStrain; %The applied stretch for uniaxial loading
    case 2 % tension
        stretchLoad=1+appliedStrain; %The applied stretch for uniaxial loading
end
displacementMagnitude=(stretchLoad*sampleSize)-sampleSize; %The displacement magnitude

%Material parameter set
c1=1; %Shear-modulus-like parameter
m1=2;
k=50*c1;

% FEA control settings
numTimeSteps=10; %Number of time steps desired
max_refs=50; %Max reforms
max_ups=0; %Set to zero to use full-Newton iterations
opt_iter=10; %Optimum number of iterations
max_retries=5; %Maximum number of retires
dtmin=(1/numTimeSteps)/100; %Minimum time step size
dtmax=(1/numTimeSteps); %Maximum time step size
min_residual=1e-20;
symmetric_stiffness=0;
runMode='internal'; %'internal' or 'external'

Create diamond lattice

[Ep,Et,VT,Ct]=diamondLattice(sampleSize,nRepeat,strutThickness,0);
[Ep,VT]=subPenta(Ep,VT,nSubPenta,3); %Sub-divide pentahedra
% strutThicknessCheck=mean(patchEdgeLengths(Fp{1},VT));

%Get element faces for visualization
Fp=element2patch(Ep,[],'penta6');
Ft=element2patch(Et,[],'tet4');
cFigure; hold on;
hpl=gpatch(Fp,VT,'rw','r',0.5);
hpl(end+1)=gpatch(Ft,VT,'gw','g',0.5);
legend(hpl,{'Pentahedral triangles','Pentahedra quads','Tetrahedral triangles'});
axisGeom;
camlight headlight;
drawnow;

DEFINE BC's

Z=VT(:,3);
logicTop=Z>=(max(Z(:))-eps(max(Z(:))));
logicBottom=Z<min(Z(:))+eps(min(Z(:)));

bcPrescribeList=find(logicTop);
bcSupportList=find(logicBottom);
cFigure; hold on;
gpatch(Fp,VT,'w','none',0.25);
gpatch(Ft,VT,'w','none',0.25);
hl2(1)=plotV(VT(bcPrescribeList,:),'r.','MarkerSize',markerSize);
hl2(2)=plotV(VT(bcSupportList,:),'k.','MarkerSize',markerSize);
legend(hl2,{'BC prescribe','BC support'});
axisGeom;
camlight headlight;
drawnow;

Defining the FEBio input structure

See also febioStructTemplate and febioStruct2xml and the FEBio user manual.

%Get a template with default settings
[febio_spec]=febioStructTemplate;

%febio_spec version
febio_spec.ATTR.version='2.5';

%Module section
febio_spec.Module.ATTR.type='solid';

%Control section
febio_spec.Control.analysis.ATTR.type='static';
febio_spec.Control.title='Lattice analysis';
febio_spec.Control.time_steps=numTimeSteps;
febio_spec.Control.step_size=1/numTimeSteps;
febio_spec.Control.time_stepper.dtmin=dtmin;
febio_spec.Control.time_stepper.dtmax=dtmax;
febio_spec.Control.time_stepper.max_retries=max_retries;
febio_spec.Control.time_stepper.opt_iter=opt_iter;
febio_spec.Control.max_refs=max_refs;
febio_spec.Control.max_ups=max_ups;
febio_spec.Control.symmetric_stiffness=symmetric_stiffness;
febio_spec.Control.min_residual=min_residual;

%Material section
febio_spec.Material.material{1}.ATTR.type='Ogden';
febio_spec.Material.material{1}.ATTR.id=1;
febio_spec.Material.material{1}.c1=c1;
febio_spec.Material.material{1}.m1=m1;
febio_spec.Material.material{1}.c2=c1;
febio_spec.Material.material{1}.m2=-m1;
febio_spec.Material.material{1}.k=k;

%Geometry section
% -> Nodes
febio_spec.Geometry.Nodes{1}.ATTR.name='nodeSet_all'; %The node set name
febio_spec.Geometry.Nodes{1}.node.ATTR.id=(1:size(VT,1))'; %The node id's
febio_spec.Geometry.Nodes{1}.node.VAL=VT; %The nodel coordinates

% -> Elements
febio_spec.Geometry.Elements{1}.ATTR.type='penta6'; %Element type of this set
febio_spec.Geometry.Elements{1}.ATTR.mat=1; %material index for this set
febio_spec.Geometry.Elements{1}.ATTR.name='Pentahedra'; %Name of the element set
febio_spec.Geometry.Elements{1}.elem.ATTR.id=(1:1:size(Ep,1))'; %Element id's
febio_spec.Geometry.Elements{1}.elem.VAL=Ep;

febio_spec.Geometry.Elements{2}.ATTR.type='tet4'; %Element type of this set
febio_spec.Geometry.Elements{2}.ATTR.mat=1; %material index for this set
febio_spec.Geometry.Elements{2}.ATTR.name='Tetrahedra'; %Name of the element set
febio_spec.Geometry.Elements{2}.elem.ATTR.id=size(Ep,1)+(1:1:size(Et,1))'; %Element id's
febio_spec.Geometry.Elements{2}.elem.VAL=Et;

% -> NodeSets
febio_spec.Geometry.NodeSet{1}.ATTR.name='bcSupportList';
febio_spec.Geometry.NodeSet{1}.node.ATTR.id=bcSupportList(:);

febio_spec.Geometry.NodeSet{2}.ATTR.name='bcPrescribeList';
febio_spec.Geometry.NodeSet{2}.node.ATTR.id=bcPrescribeList(:);

%Boundary condition section
% -> Fix boundary conditions
febio_spec.Boundary.fix{1}.ATTR.bc='x';
febio_spec.Boundary.fix{1}.ATTR.node_set=febio_spec.Geometry.NodeSet{1}.ATTR.name;
febio_spec.Boundary.fix{2}.ATTR.bc='y';
febio_spec.Boundary.fix{2}.ATTR.node_set=febio_spec.Geometry.NodeSet{1}.ATTR.name;
febio_spec.Boundary.fix{3}.ATTR.bc='z';
febio_spec.Boundary.fix{3}.ATTR.node_set=febio_spec.Geometry.NodeSet{1}.ATTR.name;

febio_spec.Boundary.fix{4}.ATTR.bc='x';
febio_spec.Boundary.fix{4}.ATTR.node_set=febio_spec.Geometry.NodeSet{2}.ATTR.name;
febio_spec.Boundary.fix{5}.ATTR.bc='y';
febio_spec.Boundary.fix{5}.ATTR.node_set=febio_spec.Geometry.NodeSet{2}.ATTR.name;

% -> Prescribed boundary conditions
febio_spec.Boundary.prescribe{1}.ATTR.bc='z';
febio_spec.Boundary.prescribe{1}.ATTR.node_set=febio_spec.Geometry.NodeSet{2}.ATTR.name;
febio_spec.Boundary.prescribe{1}.scale.ATTR.lc=1;
febio_spec.Boundary.prescribe{1}.scale.VAL=1;
febio_spec.Boundary.prescribe{1}.relative=1;
febio_spec.Boundary.prescribe{1}.value=displacementMagnitude;

%Output section
% -> log file
febio_spec.Output.logfile.ATTR.file=febioLogFileName;
febio_spec.Output.logfile.node_data{1}.ATTR.file=febioLogFileName_disp;
febio_spec.Output.logfile.node_data{1}.ATTR.data='ux;uy;uz';
febio_spec.Output.logfile.node_data{1}.ATTR.delim=',';
febio_spec.Output.logfile.node_data{1}.VAL=1:size(VT,1);

febio_spec.Output.logfile.node_data{2}.ATTR.file=febioLogFileName_force;
febio_spec.Output.logfile.node_data{2}.ATTR.data='Rx;Ry;Rz';
febio_spec.Output.logfile.node_data{2}.ATTR.delim=',';
febio_spec.Output.logfile.node_data{2}.VAL=1:size(VT,1);

Quick viewing of the FEBio input file structure

The febView function can be used to view the xml structure in a MATLAB figure window.

febView(febio_spec); %Viewing the febio file

Exporting the FEBio input file

Exporting the febio_spec structure to an FEBio input file is done using the febioStruct2xml function.

febioStruct2xml(febio_spec,febioFebFileName); %Exporting to file and domNode

Running the FEBio analysis

To run the analysis defined by the created FEBio input file the runMonitorFEBio function is used. The input for this function is a structure defining job settings e.g. the FEBio input file name. The optional output runFlag informs the user if the analysis was run succesfully.

febioAnalysis.run_filename=febioFebFileName; %The input file name
febioAnalysis.run_logname=febioLogFileName; %The name for the log file
febioAnalysis.disp_on=1; %Display information on the command window
febioAnalysis.disp_log_on=1; %Display convergence information in the command window
febioAnalysis.runMode=runMode; %Run in external or in matlab terminal
febioAnalysis.t_check=0.25; %Time for checking log file (dont set too small)
febioAnalysis.maxtpi=1e99; %Max analysis time
febioAnalysis.maxLogCheckTime=10; %Max log file checking time

[runFlag]=runMonitorFEBio(febioAnalysis);%START FEBio NOW!!!!!!!!
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- STARTING FEBIO JOB --- 12-Mar-2020 12:11:55
===========================================================================
         ________    _________   _________     __     _________            
        |        |\ |        |\ |        |\   |  |\  /         \\          
        |    ____|| |    ____|| |    __  ||   |__|| |    ___    ||         
        |   |\___\| |   |\___\| |   |\_| ||    \_\| |   //  \   ||         
        |   ||      |   ||      |   || | ||    __   |  ||    |  ||         
        |   ||__    |   ||__    |   ||_| ||   |  |\ |  ||    |  ||         
        |       |\  |       |\  |         \\  |  || |  ||    |  ||         
        |    ___||  |    ___||  |    ___   || |  || |  ||    |  ||         
        |   |\__\|  |   |\__\|  |   |\__|  || |  || |  ||    |  ||         
        |   ||      |   ||      |   ||  |  || |  || |  ||    |  ||         
        |   ||      |   ||___   |   ||__|  || |  || |   \\__/   ||         
        |   ||      |        |\ |          || |  || |           ||         
        |___||      |________|| |__________|| |__||  \_________//          
                                                                           
      F I N I T E   E L E M E N T S   F O R   B I O M E C H A N I C S      
                                                                           
                 --- v e r s i o n - 2 . 9 . 1 ---                 
                                                                           
                                                                           
  http://febio.org                                                         
  FEBio is a registered trademark.                                         
  copyright (c) 2006-2019 - All rights reserved                            
                                                                           
===========================================================================


Reading file /mnt/data/MATLAB/GIBBON/data/temp/tempModel.feb ...SUCCESS!
 ]0;(0%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 1 : 0.1 =====
Reforming stiffness matrix: reformation #1

===== reforming stiffness matrix:
	Nr of equations ........................... : 28537
	Nr of nonzeroes in stiffness matrix ....... : 830119

 1
 Nonlinear solution status: time= 0.1
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.102684e+04    9.915145e+00    0.000000e+00 
	   energy              1.303861e+03    3.566331e-01    1.303861e+01 
	   displacement        3.102098e+03    3.102098e+03    3.102098e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.1
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.102684e+04    3.512081e-05    0.000000e+00 
	   energy              1.303861e+03    2.268895e-04    1.303861e+01 
	   displacement        3.102098e+03    2.741958e-01    3.083775e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.1
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.102684e+04    6.813665e-08    0.000000e+00 
	   energy              1.303861e+03    2.582763e-08    1.303861e+01 
	   displacement        3.102098e+03    6.638144e-03    3.081069e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.1
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.102684e+04    9.946021e-17    0.000000e+00 
	   energy              1.303861e+03    2.417094e-14    1.303861e+01 
	   displacement        3.102098e+03    3.622083e-08    3.081070e-03 

------- converged at time : 0.1

 ]0;(10%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 2 : 0.2 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.2
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.098615e+04    9.007485e+00    0.000000e+00 
	   energy              1.303958e+03    3.282138e-01    1.303958e+01 
	   displacement        3.060495e+03    3.060495e+03    3.060495e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.2
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.098615e+04    3.003503e-05    0.000000e+00 
	   energy              1.303958e+03    1.965619e-04    1.303958e+01 
	   displacement        3.060495e+03    2.691494e-01    3.042913e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.2
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.098615e+04    6.086583e-08    0.000000e+00 
	   energy              1.303958e+03    2.042037e-08    1.303958e+01 
	   displacement        3.060495e+03    6.521498e-03    3.040337e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.2
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.098615e+04    1.059677e-16    0.000000e+00 
	   energy              1.303958e+03    1.779471e-14    1.303958e+01 
	   displacement        3.060495e+03    3.012234e-08    3.040337e-03 

------- converged at time : 0.2

 ]0;(20%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 3 : 0.3 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.3
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.094474e+04    8.207170e+00    0.000000e+00 
	   energy              1.303775e+03    3.027621e-01    1.303775e+01 
	   displacement        3.020741e+03    3.020741e+03    3.020741e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.3
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.094474e+04    2.601810e-05    0.000000e+00 
	   energy              1.303775e+03    1.723053e-04    1.303775e+01 
	   displacement        3.020741e+03    2.586053e-01    3.004152e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.3
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.094474e+04    5.800418e-08    0.000000e+00 
	   energy              1.303775e+03    1.655336e-08    1.303775e+01 
	   displacement        3.020741e+03    6.692526e-03    3.001703e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.3
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.094474e+04    1.153316e-16    0.000000e+00 
	   energy              1.303775e+03    1.563403e-14    1.303775e+01 
	   displacement        3.020741e+03    2.622231e-08    3.001703e-03 

------- converged at time : 0.3

 ]0;(30%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 4 : 0.4 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.4
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.090288e+04    7.518722e+00    0.000000e+00 
	   energy              1.303339e+03    2.808290e-01    1.303339e+01 
	   displacement        2.983247e+03    2.983247e+03    2.983247e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.4
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.090288e+04    2.292263e-05    0.000000e+00 
	   energy              1.303339e+03    1.531945e-04    1.303339e+01 
	   displacement        2.983247e+03    2.451746e-01    2.967736e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.4
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.090288e+04    6.059009e-08    0.000000e+00 
	   energy              1.303339e+03    1.417042e-08    1.303339e+01 
	   displacement        2.983247e+03    7.188070e-03    2.965368e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.4
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.090288e+04    1.197546e-16    0.000000e+00 
	   energy              1.303339e+03    1.621429e-14    1.303339e+01 
	   displacement        2.983247e+03    2.406598e-08    2.965368e-03 

------- converged at time : 0.4

 ]0;(40%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 5 : 0.5 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.5
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.086065e+04    6.936543e+00    0.000000e+00 
	   energy              1.302668e+03    2.624755e-01    1.302668e+01 
	   displacement        2.948046e+03    2.948046e+03    2.948046e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.5
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.086065e+04    2.056884e-05    0.000000e+00 
	   energy              1.302668e+03    1.381612e-04    1.302668e+01 
	   displacement        2.948046e+03    2.305891e-01    2.933599e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.5
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.086065e+04    6.911163e-08    0.000000e+00 
	   energy              1.302668e+03    1.296207e-08    1.302668e+01 
	   displacement        2.948046e+03    7.971067e-03    2.931259e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.5
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.086065e+04    1.119720e-16    0.000000e+00 
	   energy              1.302668e+03    1.782926e-14    1.302668e+01 
	   displacement        2.948046e+03    2.301484e-08    2.931260e-03 

------- converged at time : 0.5

 ]0;(50%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 6 : 0.6 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.6
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.081803e+04    6.451299e+00    0.000000e+00 
	   energy              1.301778e+03    2.475212e-01    1.301778e+01 
	   displacement        2.914986e+03    2.914986e+03    2.914986e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.6
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.081803e+04    1.878602e-05    0.000000e+00 
	   energy              1.301778e+03    1.262584e-04    1.301778e+01 
	   displacement        2.914986e+03    2.159087e-01    2.901537e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.6
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.081803e+04    8.361671e-08    0.000000e+00 
	   energy              1.301778e+03    1.257456e-08    1.301778e+01 
	   displacement        2.914986e+03    8.950611e-03    2.899184e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.6
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.081803e+04    8.930103e-17    0.000000e+00 
	   energy              1.301778e+03    1.889318e-14    1.301778e+01 
	   displacement        2.914986e+03    2.236978e-08    2.899185e-03 

------- converged at time : 0.6

 ]0;(60%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 7 : 0.7 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.7
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.077490e+04    6.053211e+00    0.000000e+00 
	   energy              1.300674e+03    2.356924e-01    1.300674e+01 
	   displacement        2.883849e+03    2.883849e+03    2.883849e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.7
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.077490e+04    1.742297e-05    0.000000e+00 
	   energy              1.300674e+03    1.167217e-04    1.300674e+01 
	   displacement        2.883849e+03    2.017416e-01    2.871311e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.7
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.077490e+04    1.035530e-07    0.000000e+00 
	   energy              1.300674e+03    1.275319e-08    1.300674e+01 
	   displacement        2.883849e+03    9.997253e-03    2.868922e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.7
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.077490e+04    5.764120e-17    0.000000e+00 
	   energy              1.300674e+03    1.863669e-14    1.300674e+01 
	   displacement        2.883849e+03    2.157742e-08    2.868924e-03 

------- converged at time : 0.7

 ]0;(70%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 8 : 0.8 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.8
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.073115e+04    5.733600e+00    0.000000e+00 
	   energy              1.299359e+03    2.267152e-01    1.299359e+01 
	   displacement        2.854421e+03    2.854421e+03    2.854421e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.8
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.073115e+04    1.634845e-05    0.000000e+00 
	   energy              1.299359e+03    1.089646e-04    1.299359e+01 
	   displacement        2.854421e+03    1.884197e-01    2.842703e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.8
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.073115e+04    1.279712e-07    0.000000e+00 
	   energy              1.299359e+03    1.346483e-08    1.299359e+01 
	   displacement        2.854421e+03    1.097025e-02    2.840277e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.8
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.073115e+04    2.925716e-17    0.000000e+00 
	   energy              1.299359e+03    1.802365e-14    1.299359e+01 
	   displacement        2.854421e+03    2.059644e-08    2.840279e-03 

------- converged at time : 0.8

 ]0;(80%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 9 : 0.9 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 0.9
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.068659e+04    5.485663e+00    0.000000e+00 
	   energy              1.297830e+03    2.203820e-01    1.297830e+01 
	   displacement        2.826525e+03    2.826525e+03    2.826525e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 0.9
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.068659e+04    1.545428e-05    0.000000e+00 
	   energy              1.297830e+03    1.025774e-04    1.297830e+01 
	   displacement        2.826525e+03    1.761185e-01    2.815540e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 0.9
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.068659e+04    1.564254e-07    0.000000e+00 
	   energy              1.297830e+03    1.498320e-08    1.297830e+01 
	   displacement        2.826525e+03    1.176350e-02    2.813087e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 0.9
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.068659e+04    1.350460e-17    0.000000e+00 
	   energy              1.297830e+03    2.010888e-14    1.297830e+01 
	   displacement        2.826525e+03    2.023501e-08    2.813089e-03 

------- converged at time : 0.9

 ]0;(90%) tempModel.feb - FEBio 2.9.1.0  
===== beginning time step 10 : 1 =====
Reforming stiffness matrix: reformation #1

 1
 Nonlinear solution status: time= 1
	stiffness updates             = 0
	right hand side evaluations   = 2
	stiffness matrix reformations = 1
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.064103e+04    5.305082e+00    0.000000e+00 
	   energy              1.296081e+03    2.166141e-01    1.296081e+01 
	   displacement        2.800011e+03    2.800011e+03    2.800011e-03 
Reforming stiffness matrix: reformation #2

 2
 Nonlinear solution status: time= 1
	stiffness updates             = 0
	right hand side evaluations   = 3
	stiffness matrix reformations = 2
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.064103e+04    1.466825e-05    0.000000e+00 
	   energy              1.296081e+03    9.735027e-05    1.296081e+01 
	   displacement        2.800011e+03    1.649296e-01    2.789677e-03 
Reforming stiffness matrix: reformation #3

 3
 Nonlinear solution status: time= 1
	stiffness updates             = 0
	right hand side evaluations   = 4
	stiffness matrix reformations = 3
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.064103e+04    1.901054e-07    0.000000e+00 
	   energy              1.296081e+03    1.789336e-08    1.296081e+01 
	   displacement        2.800011e+03    1.235520e-02    2.787210e-03 
Reforming stiffness matrix: reformation #4

 4
 Nonlinear solution status: time= 1
	stiffness updates             = 0
	right hand side evaluations   = 5
	stiffness matrix reformations = 4
	step from line search         = 1.000000
	convergence norms :     INITIAL         CURRENT         REQUIRED
	   residual            5.064103e+04    1.230094e-17    0.000000e+00 
	   energy              1.296081e+03    3.005262e-14    1.296081e+01 
	   displacement        2.800011e+03    2.223543e-08    2.787212e-03 

------- converged at time : 1

 ]0;(100%) tempModel.feb - FEBio 2.9.1.0  

N O N L I N E A R   I T E R A T I O N   I N F O R M A T I O N

	Number of time steps completed .................... : 10

	Total number of equilibrium iterations ............ : 40

	Average number of equilibrium iterations .......... : 4

	Total number of right hand evaluations ............ : 50

	Total number of stiffness reformations ............ : 40

	Time in linear solver: 0:00:02


 Elapsed time : 0:00:06


 N O R M A L   T E R M I N A T I O N

Waiting for log file...
Proceeding to check log file...12-Mar-2020 12:12:02
------- converged at time : 0.1
------- converged at time : 0.2
------- converged at time : 0.3
------- converged at time : 0.4
------- converged at time : 0.5
------- converged at time : 0.6
------- converged at time : 0.7
------- converged at time : 0.8
------- converged at time : 0.9
------- converged at time : 1
--- Done --- 12-Mar-2020 12:12:03

Import FEBio results

if runFlag==1 %i.e. a succesful run
    % Importing nodal displacements from a log file
    [time_mat, N_disp_mat,~]=importFEBio_logfile(fullfile(savePath,febioLogFileName_disp)); %Nodal displacements
    time_mat=[0; time_mat(:)]; %Time

    N_disp_mat=N_disp_mat(:,2:end,:);
    sizImport=size(N_disp_mat);
    sizImport(3)=sizImport(3)+1;
    N_disp_mat_n=zeros(sizImport);
    N_disp_mat_n(:,:,2:end)=N_disp_mat;
    N_disp_mat=N_disp_mat_n;
    DN=N_disp_mat(:,:,end);
    DN_magnitude=sqrt(sum(DN(:,3).^2,2));
    VT_def=VT+DN;

Importing nodal forces from a log file

    [~, N_force_mat,~]=importFEBio_logfile(fullfile(savePath,febioLogFileName_force)); %Nodal forces

    N_force_mat=N_force_mat(:,2:end,:);
    sizImport=size(N_force_mat);
    sizImport(3)=sizImport(3)+1;
    N_force_mat_n=zeros(sizImport);
    N_force_mat_n(:,:,2:end)=N_force_mat;
    N_force_mat=N_force_mat_n;

    f_sum_z=squeeze(sum(N_force_mat(bcPrescribeList,3,:),1));

Visualize force data

    displacementApplied=time_mat.*displacementMagnitude;
    lambdaApplied=(sampleSize+displacementApplied)./sampleSize;

    cFigure; hold on;
    xlabel('$\lambda$ [.]','Interpreter','Latex');
    ylabel('$F_z$','Interpreter','Latex');
    hp=plot(lambdaApplied(:),f_sum_z(:),'b-','LineWidth',3);
    grid on; box on; axis square; axis tight;
    set(gca,'FontSize',fontSize);
    drawnow;

Plotting the simulated results using anim8 to visualize and animate deformations

    % Create basic view and store graphics handle to initiate animation
    hf=cFigure; %Open figure
    gtitle([febioFebFileNamePart,': Press play to animate']);
    hp1=gpatch(Ft,VT_def,DN_magnitude,'k',1);
    hp1.FaceColor='interp';
    hp2=gpatch(Fp{1},VT_def,DN_magnitude,'k',1);
    hp2.FaceColor='interp';
    hp3=gpatch(Fp{2},VT_def,DN_magnitude,'k',1);
    hp3.FaceColor='interp';

    axisGeom(gca,fontSize);
    colormap(gjet(250)); colorbar;
    caxis([0 max(DN_magnitude)]);
    axis([min([VT_def(:,1);VT(:,1)]) max([VT_def(:,1);VT(:,1)])...
        min([VT_def(:,2);VT(:,2)]) max([VT_def(:,2);VT(:,2)])...
        min([VT_def(:,3);VT(:,3)]) max([VT_def(:,3);VT(:,3)]) ]); %Set axis limits statically
    %     view(130,25); %Set view direction
    camlight headlight;

    % Set up animation features
    animStruct.Time=time_mat; %The time vector
    for qt=1:1:size(N_disp_mat,3) %Loop over time increments
        DN=N_disp_mat(:,:,qt); %Current displacement
        DN_magnitude=sqrt(sum(DN.^2,2)); %Current displacement magnitude
        VT_def=VT+DN; %Current nodal coordinates

        %Set entries in animation structure
        animStruct.Handles{qt}=[hp1 hp1 hp2 hp2 hp3 hp3]; %Handles of objects to animate
        animStruct.Props{qt}={'Vertices','CData','Vertices','CData','Vertices','CData'}; %Properties of objects to animate
        animStruct.Set{qt}={VT_def,DN_magnitude,VT_def,DN_magnitude,VT_def,DN_magnitude}; %Property values for to set in order to animate
    end
    anim8(hf,animStruct); %Initiate animation feature
    drawnow;
end

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) 2019 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/.