%--------------------------------------------------------------------------
% PURPOSE
% FLI_Multifiber - incremental solving - DYSBAC
%
%--------------------------------------------------------------------------
% REFERENCES
% Chaymaa LEJOUAD
% 15-02-2018
%--------------------------------------------------------------------------
% COMMENTS
%
%
%
%--------------------------------------------------------------------------
% MIT License
%
% Copyright (c) 2018 Benjamin Richard
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software
% "), to deal in the Software without restriction, including without
% limitation the rights to use, copy, modify, merge, publish, distribute,
% sublicense, and/or sell copies of the Software, and to permit persons
% to whom the Software is furnished to do so, subject to the following
% conditions:
%
% The above copyright notice and this permission notice shall be included
% in all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
% IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
% CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
% TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
% SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%--------------------------------------------------------------------------
%% Clearing off
%% Global variables
global ME TP
%% Definition of the section
FILE = '93_1.mail';
ME = INPUT.ACQU(FILE,'MAIL');
%% Definition of the model
MO1 = MODEL('SBET' ,'MECHANICS','ELASTICITY','ISOTROPIC','QUAS');
MO2 = MODEL('SAINF','MECHANICS','ELASTICITY','ISOTROPIC','POJS');
MO3 = MODEL('SASUP','MECHANICS','ELASTICITY','ISOTROPIC','POJS');
MOT = [MO1 [MO2 MO3]];
%% Definition of the material
MA1 = CHAMELEM.MATE(MO1,'youn',36000e6,'nu',0.2,'rho',...
2500,'ay',0.83);
MA2 = CHAMELEM.MATE(MO2,'youn',210000e6,'nu',0.3,'rho',...
2500,'sect',pi*0.012^2/4);
MA3 = CHAMELEM.MATE(MO3,'youn',210000e6,'nu',0.3,'rho',...
2500,'sect',pi*0.012^2/4);
MAT = [MA1 [MA2 MA3]];
%% Definition of the beam
FILE = '93_2.mail';
ME = INPUT.ACQU(FILE,'MAIL');
%% Definition of the model
MOB1 = MODEL('LPOUTRE','MECHANICS','ELASTICITY','SECTION','PLASTICITY',...
'SECTION','FLI');
MOBT = MOB1;
%% Topology
TP = TOPOLOGY(MOBT);
%% Definition of the material
MAB1 = CHAMELEM.MATE(MOB1,'mods',MOT,'mats',MAT);
MABT = MAB1;
%% Stiffness matrix
RIG1 = MATRICE('STIFF',MOB1,MAB1);
%% Boundary conditions
CL1 = MATRICE('DIRI','P1G',1,2);
CL2 = MATRICE('DIRI','P1D',2);
CL3= MATRICE('DIRI','PVERIN1',2);
CL4= MATRICE('DIRI','PVERIN2',2);
CLT=[CL1 [CL4 [CL2 CL3]]];
%% Loadings
FO1 = CHPOINT.DEPI(CL3,1);
EV1 = EVOL([0 1],[0 1],'Time','Displacement (m)');
CHT1 = TIMELOAD(FO1,EV1,'DIRI');
FO2 = CHPOINT.DEPI(CL4,1);
EV2 = EVOL([0 1],[0 1],'Time','Displacement (m)');
CHT2 = TIMELOAD(FO2,EV2,'DIRI');
CHT = [CHT1 CHT2];
%% Incremental
PB1 = PROBLEM('model',MOBT,'mater',MABT,'diric',CLT,'loadt',CHT,'comp_time',0:0.01:1,...
'solve_type','QUASI_NEWTON');
SOL = SOLVE(PB1);
%% Reaction curve
% Results from CastLab
EV_OUT = EVOL.REAC(SOL,CL2,EV1,2,'P0');
plot(EV_OUT);
close all
%% Non regression test
if abs(abs(EV_OUT.ordo(end)) - 6.53054E+06)/(6.53054E+06) > 1.0e-3
error('TEST IS NOT SUCCESSFUL')
else
disp('---------------------------------')
disp('093_Linear_FLI_Multifiber')
disp('TEST IS SUCCESSFUL')
disp('---------------------------------')
end