-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGeneralOneBodyProblem.m
More file actions
98 lines (80 loc) · 3.6 KB
/
GeneralOneBodyProblem.m
File metadata and controls
98 lines (80 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
clc,clear,close all;
format long
addpath(genpath(pwd));
Body.Name = "Body";
% ########### Problem data ################################################
Body = DefineElement(Body,"Beam","ANCF",3333,"None"); % 1 - BodyName, 2 - type (beam, plate, etc.), 3 - element name, 4 - modification name (None, EDG, etc.)
% ANCF Beam: 3243, 3333, 3343, 3353, 3363, 34X3 (34103)
% Itegration Scheme: Poigen, Standard
Body = Geometry(Body,'Rectangular',"Standard", "Gauss"); % Cross Sections: Rectangular, Oval, C, Tendon
% Integration points of generating line: Gauss, Lobatto
Body = Materials(Body,'Neo'); % Material models: Gas.-Ogd.-Hol. (GOH), Neo-Hookean (Neo), 2- and 5- constant Mooney-Rivlin (Mooney2, Mooney5), Kirhhoff-Saint-Venant (KS).
% ########### Complicate geometry #########################################
% Shift
Body.Shift.X = 0;
Body.Shift.Y = 0;
Body.Shift.Z = 0;
Body.Twist.angle = 0;
Body.Twist.initial_rot = 0;
Body1.Twist.ro = 0;
% Rotation (in degrees)
Body.Rotation.X = 0;
Body.Rotation.Y = 0;
Body.Rotation.Z = 0;
% Twist
Body.Twist.angle = 45; % in degrees
Body.Twist.ro = 0;
% ########## Create FE Model ##############################################
ElementNumber = 10;
Body = CreateFEM(Body,ElementNumber);
% ########## Calculation adjustments ######################################
Body.FiniteDiference= "AceGen"; % Calculation of FD: Matlab, AceGen
Body.SolutionBase = "Position"; % Solution-based calculation: Position, Displacement
Body.DeformationType = "Finite"; % Deformation type: Finite, Small
Body = AddTensors(Body);
%% TODO: rebuild CreateMex, it addresses the wrong folder
Body.mex = false;
% ########## Boundary Conditions ##########################################
% Force
Force.Maginutude.X = 1e5; % Elongation
Force.Maginutude.Y = 0;
Force.Maginutude.Z = 0;
% Positioning applied locally to the Undefomred configuration
% Shift and curvature are accounted automaticaly)
Force.Position.X = Body.Length.X;
Force.Position.Y = 0;
Force.Position.Z = 0;
% Boundaries (applied locally, shift and curvature are accounted automaticaly)
Boundary.Position.X = 0;
Boundary.Position.Y = 0;
Boundary.Position.Z = 0;
Boundary.Type = "full"; % there are several types: full, reduced, positions, none
Body = CreateBC(Body, Force, Boundary); % Application of Boundary conditions
% ####################### Solving ########################################
steps = 50; % sub-loading steps
titertot=0;
Re=10^(-5); % Stopping criterion for residual
imax=20; % Maximum number of iterations for Newton's method
%START NEWTON'S METHOD
for i=1:steps
% Update forces, supported loading types: linear, exponential, quadratic, cubic;
Body = SubLoading(Body, i, steps, "linear");
Fext = Body.Fext;
for ii=1:imax
tic;
[u_bc,deltaf] = Newton_full(Body,Fext);
Body.u(Body.bc) = Body.u(Body.bc)+u_bc; % Add displacement to previous one
Body.q(Body.bc) = Body.q(Body.bc)+u_bc; % change the global positions
titer=toc;
titertot=titertot+titer;
if printStatus(deltaf, u_bc, Re, i, ii, imax, steps, titertot)
break;
end
end
Body = SaveResults(Body,i, "last"); % options: "all", "last", each by (number)
end
% POST PROCESSING ###############################################
visDeformed = true;
visInitial = true;
PostProcessing(Body,visDeformed,visInitial)
CleanTemp(Body, true)