%--------------------------------------------------------------------------
% PURPOSE
% Non linear analysis - Mazars's model - 1D bar under tension
% Indirect control by nodal displacement increment (CNDI)
%--------------------------------------------------------------------------
% REFERENCES
% Francesco RICCARDI
% 29-08-2017
%--------------------------------------------------------------------------
% 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
fclose all;
clear all;
close all;
clc;
%% Declaration de variables global
global options ME TP;
%% Loading of the input datafile
FILE = '70.mail';
ME = INPUT.ACQU(FILE,'MAIL');
%% Definition of the model
MO1 = MODEL('L1','MECHANICS','ELASTICITY','ISOTROPIC','DAMAGE','MAZARS','TRUSS');
MO2 = MODEL('L2','MECHANICS','ELASTICITY','ISOTROPIC','TRUSS');
MOT = [MO1 MO2];
%% Topology
TP = TOPOLOGY(MOT);
%% Definition of the material
MA1 = CHAMELEM.MATE(MO1,'youn',30e9,'nu',0.2,'rho',0,'at',1,'bt',10000,...
'ac',0,'bc',0,'k0',1.0e-4,'sect',0.01);
MA2 = CHAMELEM.MATE(MO2,'youn',30e9,'nu',0.2,'sect',0.01);
MAT = [MA1 MA2];
%% Boundary conditions
% Line L1 fixed
CL1 = MATRICE('DIRI','P1',1);
CL2 = MATRICE('DIRI','P3',1);
CL3 = MATRICE('DIRI','LT',2);
CLT = [CL1 [CL2 CL3]];
% Definition of a prescribed displacement
FO1 = CHPOINT.DEPI(CL2,1);
%% Loading
EV1 = EVOL([0 1],[0 6e-5],'Time','Displacement (m)');
CHT = TIMELOAD(FO1,EV1,'DIRI');
%% Path-following technique
% linear combination of dofs: 1*ux(P2)+0*ux(P1)
co_pilo = COMB('LINEAR',0,'P1',1,1,'P2',1);
control_method.label='CNDI';
control_method.dof_select=co_pilo;
%% Static analysis (creation of the Pasapas table)
% set (...'indirect_control',1) for indirect computation of the load
% parameter
PB1 = PROBLEM('model',MOT,'mater',MAT,'diric',CLT,'loadt',CHT,'comp_time',0:0.04:1,...
'solve_type','SECANT_NEWTON','indirect_control',1,'indirect_option',control_method,'stif_update',1);
% The control parameter Delta_Tau for path-following methods is computed as:
% (EV1.ordo(2)*time_step). The number of steps is: final_time/Delta_tau
SOL = SOLVE(PB1);
%% Post-treatment
% On the abscissas ux(P3)
EV_OUT = EVOL.REAC(SOL,CL2,EV1,1,'P3');
plot(EV_OUT);
close all
%% Non regression test
if abs(EV_OUT.ordo(end) - 3.221391151280729e+03)/3.221391151280729e+03 > 1.0e-4
error('TEST IS NOT SUCCESSFUL')
else
disp('---------------------------------')
disp('070_1D_TRUSS_MAZARS_CNDI')
disp('TEST IS SUCCESSFUL')
disp('---------------------------------')
end