added variable la,mu parameters

This commit is contained in:
Jukka Aho
2015-06-23 21:36:04 +03:00
parent 8ec056ec62
commit 6f66810ea3
2 changed files with 26 additions and 17 deletions
+11 -8
View File
@@ -26,8 +26,8 @@ end
@doc """
Calculate local tangent stiffness matrix and residual force vector R = T - F
""" ->
function calc_local_matrices!(X, u, R, Kt, dNdξ, λ, μ, ipoints, iweights)
dim, N = size(X)
function calc_local_matrices!(X, u, R, Kt, N, dNdξ, λ_, μ_, ipoints, iweights)
dim, nnodes = size(X)
I = eye(dim)
R[:,:] = 0.0
Kt[:,:] = 0.0
@@ -35,8 +35,11 @@ function calc_local_matrices!(X, u, R, Kt, dNdξ, λ, μ, ipoints, iweights)
dF = zeros(dim, dim)
for m = 1:length(iweights)
w = iweights[m]
ξ = ipoints[m, :]
w = iweights[m]
ξ = ipoints[m, :]
# interpolate material parameters from element node fields
λ = (λ_*N(ξ))[1]
μ = (μ_*N(ξ))[1]
Jᵀ = X*dNdξ(ξ)
detJ = det(Jᵀ)
∇N = inv(Jᵀ)*dNdξ(ξ)'
@@ -47,14 +50,14 @@ function calc_local_matrices!(X, u, R, Kt, dNdξ, λ, μ, ipoints, iweights)
P = F*S # PK1 stress tensor
R[:,:] += w*P*∇N*detJ
for p = 1:N
for p = 1:nnodes
for i = 1:dim
dF[:,:] = 0.0
dF[i,:] = ∇N[:,p]
dE = 1/2*(F'*dF + dF'*F)
dS = λ*trace(dE)*I + 2*μ*dE
dP = dF*S + F*dS
for q = 1:N
for q = 1:nnodes
for j = 1:dim
Kt[dim*(p-1)+i,dim*(q-1)+j] += w*(dP[j,:]*∇N[:,q])[1]*detJ
end
@@ -70,9 +73,9 @@ end
Solve one increment of elasticity problem
""" ->
function solve_elasticity_increment!(X, u, du, R, Kt, elmap, nodalloads,
dirichletbc, λ, μ, dNdξ, ipoints,
dirichletbc, λ, μ, N, dNdξ, ipoints,
iweights)
calc_local_matrices!(X, u, R, Kt, dNdξ, λ, μ, ipoints, iweights)
calc_local_matrices!(X, u, R, Kt, N, dNdξ, λ, μ, ipoints, iweights)
# FIXME: boundary conditions
free_dofs = find(isnan(dirichletbc))
R -= nodalloads