2015-10-28 04:29:14 +02:00
|
|
|
|
# This file is a part of JuliaFEM.
|
|
|
|
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
""" Concrete Elasticity type. """
|
|
|
|
|
|
type Elasticity <: FieldProblem
|
|
|
|
|
|
# these are found from problem.properties for type Problem{Elasticity}
|
|
|
|
|
|
formulation :: Symbol
|
|
|
|
|
|
end
|
|
|
|
|
|
function Elasticity()
|
2016-02-11 02:50:43 +02:00
|
|
|
|
# formulations: plane_stress, plane_strain, continuum
|
|
|
|
|
|
return Elasticity(:continuum)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# in case of experimenting new things;
|
|
|
|
|
|
# 1. import JuliaFEM.Core: assemble!
|
|
|
|
|
|
# 2. copy/paste assemble! code to notebook
|
|
|
|
|
|
# 3. change to last argument, i.e. ::Type{Val{:plane_stress}} to ::Type{Val{:my_formulation}}
|
|
|
|
|
|
# 4. when running code: set problem.properties.formulation = :my_formulation
|
|
|
|
|
|
# 5. let multiple dispatch do the magic for you
|
|
|
|
|
|
|
|
|
|
|
|
function get_unknown_field_name(::Type{Elasticity})
|
|
|
|
|
|
return "displacement"
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2016-02-11 02:50:43 +02:00
|
|
|
|
function get_formulation_type(problem::Problem{Elasticity})
|
2016-02-11 12:07:25 +02:00
|
|
|
|
# we are solving residual and add increment to previous solution vector
|
2016-02-11 02:50:43 +02:00
|
|
|
|
return :incremental
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
function assemble!(assembly::Assembly, problem::Problem{Elasticity}, element::Element, time::Real)
|
2016-02-11 02:50:43 +02:00
|
|
|
|
props = problem.properties
|
|
|
|
|
|
if props.formulation == :continuum
|
2016-02-08 02:35:39 +02:00
|
|
|
|
return assemble!(assembly, problem, element, time, Val{:continuum})
|
2016-02-11 02:50:43 +02:00
|
|
|
|
elseif (props.formulation == :plane_stress) || (props.formulation == :plane_strain)
|
|
|
|
|
|
gdofs = get_gdofs(problem, element)
|
|
|
|
|
|
Kt, f = assemble(problem, element, time, Val{:plane})
|
|
|
|
|
|
add!(assembly.K, gdofs, gdofs, Kt)
|
|
|
|
|
|
add!(assembly.f, gdofs, f)
|
2016-02-08 02:35:39 +02:00
|
|
|
|
end
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
""" Elasticity equations for 2d cases. """
|
|
|
|
|
|
function assemble{El<:Union{Tri3,Tri6,Quad4}}(problem::Problem{Elasticity}, element::Element{El}, time::Real, ::Type{Val{:plane}})
|
2016-02-03 06:49:42 +02:00
|
|
|
|
|
2016-02-08 02:35:39 +02:00
|
|
|
|
props = problem.properties
|
2016-02-11 02:50:43 +02:00
|
|
|
|
dim = get_unknown_field_dimension(problem)
|
|
|
|
|
|
nnodes = size(element, 2)
|
|
|
|
|
|
BL = zeros(3, dim*nnodes)
|
|
|
|
|
|
BNL = zeros(4, dim*nnodes)
|
|
|
|
|
|
Kt = zeros(dim*nnodes, dim*nnodes)
|
|
|
|
|
|
f = zeros(dim*nnodes)
|
|
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
for ip in get_integration_points(element)
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
J = get_jacobian(element, ip, time)
|
2016-02-11 02:50:43 +02:00
|
|
|
|
w = ip.weight*det(J)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
N = element(ip, time)
|
2016-02-11 02:50:43 +02:00
|
|
|
|
dN = element(ip, time, Val{:grad})
|
|
|
|
|
|
|
|
|
|
|
|
# kinematics; calculate deformation gradient and strain
|
|
|
|
|
|
F = eye(dim)
|
|
|
|
|
|
if haskey(element, "displacement")
|
|
|
|
|
|
gradu = element("displacement", ip, time, Val{:grad})
|
|
|
|
|
|
F += gradu
|
|
|
|
|
|
end
|
|
|
|
|
|
GL = 1/2*(F'*F - I) # green-lagrange strain
|
|
|
|
|
|
|
|
|
|
|
|
# constitutive equations; material model (isotropic linear material here)
|
|
|
|
|
|
# get_material(problem, element, ...)
|
|
|
|
|
|
E = element("youngs modulus", ip, time)
|
|
|
|
|
|
nu = element("poissons ratio", ip, time)
|
|
|
|
|
|
if props.formulation == :plane_stress
|
|
|
|
|
|
D = E/(1.0 - nu^2) .* [
|
|
|
|
|
|
1.0 nu 0.0
|
|
|
|
|
|
nu 1.0 0.0
|
|
|
|
|
|
0.0 0.0 (1.0-nu)/2.0]
|
|
|
|
|
|
elseif props.formulation == :plane_strain
|
|
|
|
|
|
D = E/((1+nu)*(1-2*nu)) .* [
|
|
|
|
|
|
1-nu nu 0
|
|
|
|
|
|
nu 1-nu 0
|
|
|
|
|
|
0 0 (1-2*nu)/2]
|
|
|
|
|
|
else
|
2016-02-11 12:07:25 +02:00
|
|
|
|
error("unknown 2d formulation: $(props.formulation)")
|
2016-02-11 02:50:43 +02:00
|
|
|
|
end
|
|
|
|
|
|
S = D*[GL[1,1]; GL[2,2]; 2*GL[1,2]] # PK2 stress tensor in voigt notation
|
|
|
|
|
|
|
|
|
|
|
|
# add contributions: material and geometric stiffness + internal forces
|
|
|
|
|
|
fill!(BL, 0.0)
|
|
|
|
|
|
for i=1:size(dN, 2)
|
|
|
|
|
|
BL[1, 2*(i-1)+1] = F[1,1]*dN[1,i]
|
|
|
|
|
|
BL[1, 2*(i-1)+2] = F[2,1]*dN[1,i]
|
|
|
|
|
|
BL[2, 2*(i-1)+1] = F[1,2]*dN[2,i]
|
|
|
|
|
|
BL[2, 2*(i-1)+2] = F[2,2]*dN[2,i]
|
|
|
|
|
|
BL[3, 2*(i-1)+1] = F[1,1]*dN[2,i] + F[1,2]*dN[1,i]
|
|
|
|
|
|
BL[3, 2*(i-1)+2] = F[2,1]*dN[2,i] + F[2,2]*dN[1,i]
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
fill!(BNL, 0.0)
|
|
|
|
|
|
for i=1:size(dN, 2)
|
|
|
|
|
|
BNL[1, 2*(i-1)+1] = dN[1,i]
|
|
|
|
|
|
BNL[2, 2*(i-1)+1] = dN[2,i]
|
|
|
|
|
|
BNL[3, 2*(i-1)+2] = dN[1,i]
|
|
|
|
|
|
BNL[4, 2*(i-1)+2] = dN[2,i]
|
|
|
|
|
|
end
|
|
|
|
|
|
S2 = zeros(2*dim, 2*dim)
|
|
|
|
|
|
S2[1,1] = S[1]
|
|
|
|
|
|
S2[2,2] = S[2]
|
|
|
|
|
|
S2[1,2] = S2[2,1] = S[3]
|
|
|
|
|
|
S2[3:4,3:4] = S2[1:2,1:2]
|
|
|
|
|
|
|
|
|
|
|
|
Kt += w*(BL'*D*BL + BNL'*S2*BNL)
|
|
|
|
|
|
f -= w*BL'*S
|
|
|
|
|
|
|
|
|
|
|
|
# volume load
|
2016-02-03 06:49:42 +02:00
|
|
|
|
if haskey(element, "displacement load")
|
2016-02-11 02:50:43 +02:00
|
|
|
|
T = element("displacement load", ip, time)
|
|
|
|
|
|
f += vec(w*T*N)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return Kt, f
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function assemble{El<:Union{Seg2,Seg3}}(problem::Problem{Elasticity}, element::Element{El}, time::Real, ::Type{Val{:plane}})
|
|
|
|
|
|
|
|
|
|
|
|
props = problem.properties
|
|
|
|
|
|
dim = get_unknown_field_dimension(problem)
|
|
|
|
|
|
nnodes = size(element, 2)
|
|
|
|
|
|
Kt = zeros(dim*nnodes, dim*nnodes)
|
|
|
|
|
|
f = zeros(dim*nnodes)
|
|
|
|
|
|
|
|
|
|
|
|
for ip in get_integration_points(element)
|
|
|
|
|
|
|
|
|
|
|
|
J = get_jacobian(element, ip, time)
|
|
|
|
|
|
N = element(ip, time)
|
|
|
|
|
|
w = ip.weight*norm(J)
|
|
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
if haskey(element, "displacement traction force")
|
|
|
|
|
|
T = element("displacement traction force", ip, time)
|
2016-02-11 02:50:43 +02:00
|
|
|
|
f += vec(w*T*N)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
for i=1:dim
|
|
|
|
|
|
# traction force for ith component
|
|
|
|
|
|
if haskey(element, "displacement traction force $i")
|
|
|
|
|
|
T = element("displacement traction force $i", ip, time)
|
|
|
|
|
|
f[i:dim:end] += vec(w*T*N)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
|
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
if haskey(element, "nt displacement traction force")
|
|
|
|
|
|
# traction force given in normal-tangential direction
|
|
|
|
|
|
T = element("nt displacement traction force", ip, time)
|
|
|
|
|
|
Q = element("normal-tangential coordinates", ip, time)
|
|
|
|
|
|
f += vec(w*Q'*T*N)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
2016-02-11 02:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
return Kt, f
|
2016-02-03 06:49:42 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" Elasticity equations, continuum formulation. """
|
|
|
|
|
|
function assemble!(assembly::Assembly, problem::Problem{Elasticity}, element::Element, time::Real, ::Type{Val{:continuum}})
|
|
|
|
|
|
|
|
|
|
|
|
gdofs = get_gdofs(problem, element)
|
|
|
|
|
|
ndim, nnodes = size(element)
|
|
|
|
|
|
B = zeros(6, 3*nnodes)
|
|
|
|
|
|
for ip in get_integration_points(element)
|
|
|
|
|
|
w = ip.weight
|
|
|
|
|
|
J = get_jacobian(element, ip, time)
|
|
|
|
|
|
N = element(ip, time)
|
|
|
|
|
|
if haskey(element, "youngs modulus") && haskey(element, "poissons ratio")
|
|
|
|
|
|
v = element("poissons ratio", ip, time)
|
|
|
|
|
|
E_ = element("youngs modulus", ip, time)
|
|
|
|
|
|
a = 1 - v
|
|
|
|
|
|
b = 1 - 2*v
|
|
|
|
|
|
c = 1 + v
|
|
|
|
|
|
C = E_/(b*c) .* [
|
|
|
|
|
|
a v v 0 0 0
|
|
|
|
|
|
v a v 0 0 0
|
|
|
|
|
|
v v a 0 0 0
|
|
|
|
|
|
0 0 0 b 0 0
|
|
|
|
|
|
0 0 0 0 b 0
|
|
|
|
|
|
0 0 0 0 0 b]
|
|
|
|
|
|
dN = element(ip, time, Val{:grad})
|
|
|
|
|
|
fill!(B, 0.0)
|
|
|
|
|
|
for i=1:size(dN, 2)
|
|
|
|
|
|
B[1, 3*(i-1)+1] = dN[1,i]
|
|
|
|
|
|
B[2, 3*(i-1)+2] = dN[2,i]
|
|
|
|
|
|
B[3, 3*(i-1)+3] = dN[3,i]
|
|
|
|
|
|
B[4, 3*(i-1)+1] = dN[2,i]
|
|
|
|
|
|
B[4, 3*(i-1)+2] = dN[1,i]
|
|
|
|
|
|
B[5, 3*(i-1)+2] = dN[3,i]
|
|
|
|
|
|
B[5, 3*(i-1)+3] = dN[2,i]
|
|
|
|
|
|
B[6, 3*(i-1)+1] = dN[3,i]
|
|
|
|
|
|
B[6, 3*(i-1)+3] = dN[1,i]
|
|
|
|
|
|
end
|
|
|
|
|
|
# L = b * B'
|
|
|
|
|
|
# D = 0.5 * (L' + L)
|
|
|
|
|
|
# F = ...
|
|
|
|
|
|
# E = 0.5 * (F'*F - I)
|
|
|
|
|
|
# de = E - E_last
|
|
|
|
|
|
# S = vonMisesStress(de, stress)
|
|
|
|
|
|
# K = B' * S * J * w
|
|
|
|
|
|
Kt = w*B'*C*B*det(J)
|
|
|
|
|
|
add!(assembly.K, gdofs, gdofs, Kt)
|
|
|
|
|
|
end
|
|
|
|
|
|
if haskey(element, "displacement load")
|
|
|
|
|
|
b = element("displacement load", ip, time)
|
|
|
|
|
|
add!(assembly.f, gdofs, w*N'*b*det(J))
|
|
|
|
|
|
end
|
|
|
|
|
|
if haskey(element, "displacement traction force")
|
|
|
|
|
|
T = element("displacement traction force", ip, time)
|
|
|
|
|
|
JT = transpose(J)
|
|
|
|
|
|
L = w*T*N*norm(cross(JT[:,1], JT[:,2]))
|
|
|
|
|
|
add!(assembly.f, gdofs, vec(L))
|
|
|
|
|
|
end
|
2016-02-06 15:29:35 +02:00
|
|
|
|
for dim in 1:get_unknown_field_dimension(problem)
|
2016-02-03 06:49:42 +02:00
|
|
|
|
if haskey(element, "displacement traction force $dim")
|
|
|
|
|
|
T = element("displacement traction force $dim", ip, time)
|
2016-02-06 15:29:35 +02:00
|
|
|
|
ldofs = gdofs[dim:unknown_field_dimension(problem):end]
|
2016-02-03 06:49:42 +02:00
|
|
|
|
JT = transpose(J)
|
|
|
|
|
|
L = w*T*N*norm(cross(JT[:,1], JT[:,2]))
|
|
|
|
|
|
add!(assembly.f, ldofs, vec(L))
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
|
# Plastic material #
|
|
|
|
|
|
###############################
|
|
|
|
|
|
#=
|
|
|
|
|
|
include("vonmises.jl")
|
|
|
|
|
|
abstract PlaneStressLinearElasticPlasticProblem <: LinearElasticityProblem
|
|
|
|
|
|
|
|
|
|
|
|
function PlaneStressLinearElasticPlasticProblem(name="plane stress linear elasticity", dim::Int=2, elements=[])
|
|
|
|
|
|
return Problem{PlaneStressLinearElasticPlasticProblem}(name, dim, elements)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
""" Elasticity equations, plane stress. """
|
|
|
|
|
|
function assemble!{E<:CG, P<:PlaneStressLinearElasticPlasticProblem}(assembly::Assembly, problem::Problem{P}, element::Element{E}, time::Real)
|
|
|
|
|
|
|
|
|
|
|
|
gdofs = get_gdofs(element, problem.dim)
|
|
|
|
|
|
ndim, nnodes = size(E)
|
|
|
|
|
|
B = zeros(3, 2*nnodes)
|
|
|
|
|
|
for ip in get_integration_points(element)
|
|
|
|
|
|
w = ip.weight
|
|
|
|
|
|
J = get_jacobian(element, ip, time)
|
|
|
|
|
|
N = element(ip, time)
|
|
|
|
|
|
if haskey(element, "youngs modulus") && haskey(element, "poissons ratio")
|
|
|
|
|
|
nu = element("poissons ratio", ip, time)
|
|
|
|
|
|
E_ = element("youngs modulus", ip, time)
|
|
|
|
|
|
C = E_/(1.0 - nu^2) .* [
|
|
|
|
|
|
1.0 nu 0.0
|
|
|
|
|
|
nu 1.0 0.0
|
|
|
|
|
|
0.0 0.0 (1.0-nu)/2.0]
|
|
|
|
|
|
dN = element(ip, time, Val{:grad})
|
|
|
|
|
|
fill!(B, 0.0)
|
|
|
|
|
|
for i=1:size(dN, 2)
|
|
|
|
|
|
B[1, 2*(i-1)+1] = dN[1,i]
|
|
|
|
|
|
B[2, 2*(i-1)+2] = dN[2,i]
|
|
|
|
|
|
B[3, 2*(i-1)+1] = dN[2,i]
|
|
|
|
|
|
B[3, 2*(i-1)+2] = dN[1,i]
|
|
|
|
|
|
end
|
|
|
|
|
|
add!(assembly.stiffness_matrix, gdofs, gdofs, w*B'*C*B*det(J))
|
|
|
|
|
|
end
|
|
|
|
|
|
if haskey(element, "displacement load")
|
|
|
|
|
|
b = element("displacement load", ip, time)
|
|
|
|
|
|
add!(assembly.force_vector, gdofs, w*N'*b*det(J))
|
|
|
|
|
|
end
|
|
|
|
|
|
if haskey(element, "displacement traction force")
|
|
|
|
|
|
T = element("displacement traction force", ip, time)
|
|
|
|
|
|
L = w*T*N*norm(J)
|
|
|
|
|
|
add!(assembly.force_vector, gdofs, vec(L))
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-17 17:13:23 +02:00
|
|
|
|
include("elasticplastic.jl")
|
2015-12-12 15:22:31 +02:00
|
|
|
|
|
2015-10-28 04:29:14 +02:00
|
|
|
|
# Elasticity problems
|
2015-12-17 17:13:23 +02:00
|
|
|
|
abstract ElasticityProblem <: AbstractProblem
|
|
|
|
|
|
abstract PlaneStressElasticityProblem <: ElasticityProblem
|
2015-10-28 04:29:14 +02:00
|
|
|
|
|
2015-11-27 10:10:00 +02:00
|
|
|
|
function get_unknown_field_name{P<:ElasticityProblem}(::Type{P})
|
|
|
|
|
|
return "displacement"
|
|
|
|
|
|
end
|
2015-10-28 04:29:14 +02:00
|
|
|
|
|
2015-11-27 10:10:00 +02:00
|
|
|
|
function get_unknown_field_type{P<:ElasticityProblem}(::Type{P})
|
|
|
|
|
|
return Vector{Float64}
|
2015-10-28 04:29:14 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
2015-12-17 15:47:36 +02:00
|
|
|
|
|
2015-10-28 04:29:14 +02:00
|
|
|
|
""" Elasticity equations.
|
|
|
|
|
|
|
|
|
|
|
|
Formulation
|
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
|
|
Field equation is:
|
|
|
|
|
|
∂u/∂t = ∇⋅f - b
|
|
|
|
|
|
|
|
|
|
|
|
Weak form is: find u∈U such that ∀v in V
|
|
|
|
|
|
|
|
|
|
|
|
δW := ∫ρ₀∂²u/∂t²⋅δu dV₀ + ∫S:δE dV₀ - ∫b₀⋅δu dV₀ - ∫t₀⋅δu dA₀ = 0
|
|
|
|
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
|
|
|
|
ρ₀ = density
|
|
|
|
|
|
b₀ = displacement load
|
|
|
|
|
|
t₀ = displacement traction
|
|
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Linear_elasticity
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Finite_strain_theory
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Stress_measures
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Mooney%E2%80%93Rivlin_solid
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Strain_energy_density_function
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Plane_stress
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Hooke's_law
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
2015-11-28 14:06:12 +02:00
|
|
|
|
function get_residual_vector{P<:ElasticityProblem}(problem::Problem{P}, element::Element, ip::IntegrationPoint, time::Number; variation=nothing)
|
|
|
|
|
|
r = zeros(Float64, problem.dim, length(element))
|
2015-11-27 10:10:00 +02:00
|
|
|
|
|
2015-12-13 13:47:45 +02:00
|
|
|
|
J = get_jacobian(element, ip, time)
|
|
|
|
|
|
|
2015-11-28 14:06:12 +02:00
|
|
|
|
# internal forces
|
|
|
|
|
|
if haskey(element, "youngs modulus") && haskey(element, "poissons ratio")
|
2015-12-04 07:27:40 +02:00
|
|
|
|
u = element("displacement", time, variation)
|
|
|
|
|
|
grad = element(ip, time, Val{:grad})
|
|
|
|
|
|
gradu = grad*u
|
|
|
|
|
|
|
2015-12-13 13:47:45 +02:00
|
|
|
|
# deformation gradient
|
|
|
|
|
|
F = I + gradu
|
2015-11-28 14:06:12 +02:00
|
|
|
|
|
2015-12-13 13:47:45 +02:00
|
|
|
|
# material
|
2015-11-28 14:06:12 +02:00
|
|
|
|
young = element("youngs modulus", ip, time)
|
|
|
|
|
|
poisson = element("poissons ratio", ip, time)
|
|
|
|
|
|
mu = young/(2*(1+poisson))
|
|
|
|
|
|
lambda = young*poisson/((1+poisson)*(1-2*poisson))
|
2016-02-03 06:49:42 +02:00
|
|
|
|
if problem.properties.formulation == :plane_stress
|
2015-11-28 14:06:12 +02:00
|
|
|
|
lambda = 2*lambda*mu/(lambda + 2*mu) # <- correction for 2d problems
|
|
|
|
|
|
end
|
2015-11-30 16:04:13 +02:00
|
|
|
|
|
2015-12-13 13:47:45 +02:00
|
|
|
|
# strain
|
|
|
|
|
|
E = 1/2*(F'*F - I)
|
|
|
|
|
|
# stress
|
|
|
|
|
|
S = lambda*trace(E)*I + 2*mu*E
|
2015-11-30 16:04:13 +02:00
|
|
|
|
|
2015-12-13 13:47:45 +02:00
|
|
|
|
r += F*S*grad*det(J)
|
2015-11-28 14:06:12 +02:00
|
|
|
|
end
|
2015-10-28 04:29:14 +02:00
|
|
|
|
|
|
|
|
|
|
# external forces - volume load
|
|
|
|
|
|
if haskey(element, "displacement load")
|
2015-12-04 07:27:40 +02:00
|
|
|
|
basis = element(ip, time)
|
2015-11-27 10:10:00 +02:00
|
|
|
|
b = element("displacement load", ip, time)
|
2015-12-13 13:47:45 +02:00
|
|
|
|
r -= b*basis*det(J)
|
2015-10-28 04:29:14 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
2015-11-28 14:06:12 +02:00
|
|
|
|
# external forces - surface traction force
|
2015-11-18 01:19:04 +02:00
|
|
|
|
if haskey(element, "displacement traction force")
|
2015-12-04 07:27:40 +02:00
|
|
|
|
basis = element(ip, time)
|
2015-11-27 10:10:00 +02:00
|
|
|
|
T = element("displacement traction force", ip, time)
|
2015-12-13 13:47:45 +02:00
|
|
|
|
JT = transpose(J)
|
|
|
|
|
|
s = size(JT, 2) == 1 ? JT : cross(JT[:,1], JT[:,2])
|
|
|
|
|
|
r -= T*basis*norm(s)
|
2015-11-18 01:19:04 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return vec(r)
|
|
|
|
|
|
end
|
2016-02-03 06:49:42 +02:00
|
|
|
|
|
|
|
|
|
|
=#
|