Вы находитесь на странице: 1из 2

function [u, udot, u2dot] =

newmark_int_nlin(t,p,u0,udot0,m,k,c,gamma,beta,Werkstoffmodell,Solver)
%Newmark's Method for nonlinear systems
%--------------------------------------------------------------------------
% Integrates a nonlinear 1-DOF system with mass "m", spring stiffness "k", damping
% coeffiecient "c" and nonlinear force "fs", when subjected to an external load
P(t).
% Returns the displacement, velocity and acceleration of the system with
% respect to an inertial frame of reference.
%
% SYNTAX
% [u, udot, u2dot] =
newmark_int_nlin(t,p,u0,udot0,m,k,c,gamma,beta,Werkstoffmodell,Solver)
%
% INPUT
% [t] : Time Vector [n,1]
% [p] : Externally Applied Load [n,1]
% [u0]: Initial Position [1,1]
% [udot0]: Initial Velocity [1,1]
% [m]: System Mass [1,1]
% [k]: System Stiffness [1,1]
% [c]: System Damping [1,1]
% [gamma]: Newmark coefficient [1,1]
% [beta]: Newmark coefficient [1,1]
% [Werkstoffmodell]: material model parameters
% [Solver]: solver parameters
%
% OUTPUT
% [u]: Displacemente Response [n,1]
% [udot]: Velocity [n,1]
% [u2dot]: Acceleration [n,1]
%
% N = number of time steps
%
% The options include changing the value of the "gamma" and "beta"
% coefficient which appear in the formulation of the method. By default
% these values are set to gamma = 1/2 and alpha = 1/4.
%%
dt = t(2) - t(1); %timestep
a = m/(beta*dt) + gamma*c/beta; %newmark coefficient
b = 0.5*m/beta + dt*(0.5*gamma/beta - 1)*c; %newmark coefficient
TOL = 1e-6; %Tolerance
j_max = 100; %max iterations
dp = diff(p); %external force
u = zeros(length(t),1); udot = u; u2dot = u;
u(1,1) = u0; %initial condition
udot(1,1) = udot0;%initial condition
u2dot(1,1) = 1/m*(p(1)-k*u0-c*udot0-Fresfun(u(1,1),t(1),Werkstoffmodell,Solver));
%initial condition
% u2dot(1) = 1/m*(p(1)-k*u0-c*udot0);
for i = 1:(length(t)-1) %for each timestep
dp_dach = dp(i) + a*udot(i,1) + b*u2dot(i,1);
% ki = (Fresfun(u(i+1,1),t(i),Werkstoffmodell,Solver)-
Fresfun(u(i,1),t(i),Werkstoffmodell,Solver))/(u(i+1,1)-u(i,1));%tangent stiffness
ki = k;
ki_dach = ki + gamma/(beta*dt)*c + m/(beta*dt^2); %tangent stiffness
% modified Newton Raphson iterative procedure
% initialize data
j = 2;
u(i+1,1) = u(i,1);
fs(i,1) = Fresfun(u(i,1),t(i),Werkstoffmodell,Solver);
dR(1) = 0;
dR(2) = dp_dach;
kT = ki_dach;
% calculation for each iteration
while j < j_max
du(j) = (dR(j))/kT;
u(i+1,j) = u(i+1,j-1)+du(j);
fs(i,j) = Fresfun(u(i,j),t(i),Werkstoffmodell,Solver); %compute fs(j)
df(i,j) = fs(i,j)-fs(i,j-1)+(kT-k)*du(j);
dR(j+1) = dR(j)-df(i,j);
du_sum = sum(u,2);
if du(j)/du_sum(j) < TOL % repetition for next iteration
break;
end
j = j+1;
end
du(i) = du_sum(j);
dudot_i = gamma/(beta*dt)*du(i) - gamma/beta*udot(i) + dt*(1-
0.5*gamma/beta)*u2dot(i);
du2dot_i = 1/(beta*dt^2)*du(i) - 1/(beta*dt)*udot(i) - 0.5/beta*u2dot(i);
u(i+1) = du(i) + u(i);
udot(i+1) = dudot_i + udot(i);
u2dot(i+1) = du2dot_i + u2dot(i);
Werkstoffmodell.fnUpdateStateVariables;
end

Вам также может понравиться