fixed problems with surface loads. det(element, ip, time) should be avoided.

This commit is contained in:
Jukka Aho
2015-12-13 13:47:45 +02:00
parent 3242241cd4
commit ccf32d5b76
10 changed files with 102 additions and 63 deletions
+15 -14
View File
@@ -70,20 +70,20 @@ https://en.wikipedia.org/wiki/Hooke's_law
"""
function get_residual_vector{P<:ElasticityProblem}(problem::Problem{P}, element::Element, ip::IntegrationPoint, time::Number; variation=nothing)
# u = element("displacement", ip, time, variation)
r = zeros(Float64, problem.dim, length(element))
J = get_jacobian(element, ip, time)
# internal forces
if haskey(element, "youngs modulus") && haskey(element, "poissons ratio")
u = element("displacement", time, variation)
grad = element(ip, time, Val{:grad})
gradu = grad*u
F = I + gradu # deformation gradient
# info("gradu = \n$(ForwardDiff.get_value(gradu))")
# deformation gradient
F = I + gradu
# material
young = element("youngs modulus", ip, time)
poisson = element("poissons ratio", ip, time)
mu = young/(2*(1+poisson))
@@ -91,29 +91,30 @@ function get_residual_vector{P<:ElasticityProblem}(problem::Problem{P}, element:
if P == PlaneStressElasticityProblem
lambda = 2*lambda*mu/(lambda + 2*mu) # <- correction for 2d problems
end
E = 1/2*(F'*F - I) # strain
# strain
E = 1/2*(F'*F - I)
# stress
S = lambda*trace(E)*I + 2*mu*E
#J = det(element, ip, time)
#T = J^-1*F*S*F'
#ip["cauchy stress"] = T
#ip["gl strain"] = E
r += F*S*grad
r += F*S*grad*det(J)
end
# external forces - volume load
if haskey(element, "displacement load")
basis = element(ip, time)
b = element("displacement load", ip, time)
r -= b*basis
r -= b*basis*det(J)
end
# external forces - surface traction force
if haskey(element, "displacement traction force")
basis = element(ip, time)
T = element("displacement traction force", ip, time)
r -= T*basis
JT = transpose(J)
s = size(JT, 2) == 1 ? JT : cross(JT[:,1], JT[:,2])
r -= T*basis*norm(s)
end
return vec(r)