%--------------------------------------------------------------------------
% PURPOSE
% Dynamic analysis of a column meshed with QUA4
%--------------------------------------------------------------------------
% REFERENCES
% Benjamin RICHARD
% 06-12-2016
%--------------------------------------------------------------------------
% 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
close all
%% Declaration de variables global
global options ME TP;
%% Definition des options
options.mode = 'PLANE_STRESS';
%% Loading of the input datafile
FILE = '63.mail';
ME = INPUT.ACQU(FILE,'MAIL');
%% Definition of the model
MO1 = MODEL('ST','MECHANICS','ELASTICITY','ISOTROPIC');
MOT = MO1;
%% Topology
TP = TOPOLOGY(MOT);
%% Definition of the material
MA1 = CHAMELEM.MATE(MO1,'youn',36e9,'nu',0.20,'rho',0);
MAT = MA1;
%% Boundary conditions
% Line L1 fixed
CL1 = MATRICE('DIRI','L1',1,2);
CLT = CL1;
% Definition of a prescribed displacement
FOU = CHPOINT('LABEL','ST',1,-1);
% Computation of the mass matrix
MAD1 = MATRICE('MADD','L3',1,10e3);
MAS = MAD1;
% Equivalent force field
FO1 = MAS * FOU;
%% Loading
EV1 = EVOL([0 0.1 0.2 100],[0 0.1 0 0],'Time','Displacement (m)');
CHT = TIMELOAD(FO1,EV1,'MECA');
%% Static analysis
PB1 = PROBLEM('model',MOT,'mater',MAT,'diric',CLT,'loadt',CHT,'comp_time',0:0.01:20,...
'solve_type','DYNAMIC','lumped_mass',MAD1);
SOL = SOLVE(PB1);
%% Post-treatment
% Displacement, velocity and acceleration at point P3 in direction X
EV_OUT_D = EVOL.TIME(SOL,'displacement','P3',1);
EV_OUT_V = EVOL.TIME(SOL,'velocity','P3',1);
EV_OUT_A = EVOL.TIME(SOL,'acceleration','P3',1);
plot(EV_OUT_D);
plot(EV_OUT_V);
plot(EV_OUT_A);
close all
%% Non regression test
if abs(max(EV_OUT_D.ordo) - 2.236328801674683e-04) > 1.0e-4 || ...
abs(max(EV_OUT_V.ordo) - 0.005659927010383) > 1.0e-4 || ...
abs(max(EV_OUT_A.ordo) - 0.143248318177273) > 1.0e-4
error('TEST IS NOT SUCCESSFUL')
else
disp('---------------------------------')
disp('063_DYN_2D_QUA4_LUMPED_MASS')
disp('TEST IS SUCCESSFUL')
disp('---------------------------------')
end