Joffra
Civil/Environmental
- Mar 29, 2019
- 1
I am trying to code a simple FEM problem. A bar is fixed at the bottom edge, and the top is pulled by an applied displacement. I want to apply the displacement gradually , so I have divided it into a number of steps. A rough outline of the code looks like this
%********************************************************* %
> Newton-Raphson Control parameters
> %*********************************************************
>
> uload=5; % the total displacement
numu=10; % number of steps
du=uload/numu; % step size
tu=0; %initial value
> tol=1e-2;
niter=10;
> for ii=1:numu
>
> iter=0;
> tu=tu+du; %increment displacement at each step
>
> Ru = sparse(sdof,1); %Initialize residual force vector
> Ku=sparse(sdof,sdof); %Initialize stiffness matrix
> [Ku] = Kmat(Ku); %Create stiffness matrix
> for error=1:niter %Iteration
>
> [Ku,Ru] = applyBC(Ku,Ru); %Apply BCs
> delu = sparse(sdof,1) ; %Initialize solution vector
> delu = Ku\Ru ; % Calculate displacement
u=u+delu; % %Increase displacement value
> error=norm(Ru) %Calculate Error
> if(error<=tol) %Check tolerance; leave iteration loop, go to next step if condition satisfied
> break;
> end
>
>
> [Ru] = RvecDispESFEM(Ru,u); %Calculate residual force vector
> end %iteraion
> end %step
This algorithm, works fine if I only have a few elements(suppose 100) defined. If I decrease the mesh size, the solutions tend to diverge, the error keeps on increasing. I figure that is probably because the way I calculate the error is not useful for this simple case.
Now my question is what can be the best convergence criterion for this problem? Since the problem is simple linear elastic, no non-linearity involved, I think the values calculated in the first iteration is correct, so no need for iteration. But later I would like to extend this code to perform non-linear static analysis, so is there an convergence criterion that can be used for both? If not, then what can be used for each case and will the application of boundary condition differ in the non-linear case?
%********************************************************* %
> Newton-Raphson Control parameters
> %*********************************************************
>
> uload=5; % the total displacement
numu=10; % number of steps
du=uload/numu; % step size
tu=0; %initial value
> tol=1e-2;
niter=10;
> for ii=1:numu
>
> iter=0;
> tu=tu+du; %increment displacement at each step
>
> Ru = sparse(sdof,1); %Initialize residual force vector
> Ku=sparse(sdof,sdof); %Initialize stiffness matrix
> [Ku] = Kmat(Ku); %Create stiffness matrix
> for error=1:niter %Iteration
>
> [Ku,Ru] = applyBC(Ku,Ru); %Apply BCs
> delu = sparse(sdof,1) ; %Initialize solution vector
> delu = Ku\Ru ; % Calculate displacement
u=u+delu; % %Increase displacement value
> error=norm(Ru) %Calculate Error
> if(error<=tol) %Check tolerance; leave iteration loop, go to next step if condition satisfied
> break;
> end
>
>
> [Ru] = RvecDispESFEM(Ru,u); %Calculate residual force vector
> end %iteraion
> end %step
This algorithm, works fine if I only have a few elements(suppose 100) defined. If I decrease the mesh size, the solutions tend to diverge, the error keeps on increasing. I figure that is probably because the way I calculate the error is not useful for this simple case.
Now my question is what can be the best convergence criterion for this problem? Since the problem is simple linear elastic, no non-linearity involved, I think the values calculated in the first iteration is correct, so no need for iteration. But later I would like to extend this code to perform non-linear static analysis, so is there an convergence criterion that can be used for both? If not, then what can be used for each case and will the application of boundary condition differ in the non-linear case?