mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-21 10:23:37 +00:00
updated.
This commit is contained in:
@@ -8,7 +8,9 @@ using Logging
|
||||
|
||||
VERSION < v"0.4-" && using Docile
|
||||
|
||||
eldims = Dict({"C3D10" => 10})
|
||||
eldims = Dict(
|
||||
"C3D10" => 10,
|
||||
"C3D4" => 4)
|
||||
global handlers = Dict()
|
||||
|
||||
|
||||
@@ -29,7 +31,7 @@ end
|
||||
function parse_header(header_line)
|
||||
args = map(s -> strip(s), split(header_line, ","))
|
||||
args[1] = strip(args[1], '*')
|
||||
d = Dict({"section" => args[1]})
|
||||
d = Dict("section" => args[1])
|
||||
options = Dict()
|
||||
for k in args[2:end]
|
||||
args2 = split(k, "=")
|
||||
|
||||
+12
-18
@@ -73,9 +73,9 @@ end
|
||||
"""
|
||||
Return partial derivatives of shape functions w.r.t X using chain rule.
|
||||
"""
|
||||
function get_dbasisdX(el::Element, xi)
|
||||
J = interpolate(el, "coordinates", xi; derivative=true)
|
||||
dbasisdX = el.dbasis(xi)*inv(J')
|
||||
function get_dbasisdX(el::Element, ip)
|
||||
J = interpolate(el, "coordinates", ip.xi; derivative=true)
|
||||
dbasisdX = el.dbasis(ip.xi)*inv(J')
|
||||
return dbasisdX
|
||||
end
|
||||
|
||||
@@ -156,11 +156,9 @@ f::Function
|
||||
"""
|
||||
function integrate(f::Function, el::JuliaFEM.Element)
|
||||
target = []
|
||||
for m = 1:length(el.iweights)
|
||||
w = el.iweights[m]
|
||||
xi = el.ipoints[:, m]
|
||||
J = JuliaFEM.interpolate(el, "coordinates", xi; derivative=true)
|
||||
push!(target, w*f(el, xi)*det(J))
|
||||
for ip in el.integration_points
|
||||
J = JuliaFEM.interpolate(el, "coordinates", ip.xi; derivative=true)
|
||||
push!(target, ip.weight*f(el, ip)*det(J))
|
||||
end
|
||||
return sum(target)
|
||||
end
|
||||
@@ -171,11 +169,9 @@ This version returns a function which must be operated with element e
|
||||
function integrate(f::Function)
|
||||
function integrate(el::JuliaFEM.Element)
|
||||
target = []
|
||||
for m = 1:length(el.iweights)
|
||||
w = el.iweights[m]
|
||||
xi = el.ipoints[:, m]
|
||||
J = JuliaFEM.interpolate(el, "coordinates", xi; derivative=true)
|
||||
push!(target, w*f(el, xi)*det(J))
|
||||
for ip in el.integration_points
|
||||
J = JuliaFEM.interpolate(el, "coordinates", ip.xi; derivative=true)
|
||||
push!(target, ip.weight*f(el, ip)*det(J))
|
||||
end
|
||||
return sum(target)
|
||||
end
|
||||
@@ -188,10 +184,8 @@ This version saves results inplace to target, garbage collection free
|
||||
function integrate!(f::Function, el::JuliaFEM.Element, target)
|
||||
# set target to zero
|
||||
el.attributes[target][:] = 0.0
|
||||
for m = 1:length(el.iweights)
|
||||
w = el.iweights[m]
|
||||
xi = el.ipoints[:, m]
|
||||
J = JuliaFEM.interpolate(el, "coordinates", xi; derivative=true)
|
||||
el.attributes[target][:,:] += w*f(el, xi)*det(J)
|
||||
for ip in el.integration_points
|
||||
J = JuliaFEM.interpolate(el, "coordinates", ip.xi; derivative=true)
|
||||
el.attributes[target][:,:] += ip.weight*f(el, ip)*det(J)
|
||||
end
|
||||
end
|
||||
|
||||
+19
-2
@@ -1,6 +1,22 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
"""
|
||||
Integration point
|
||||
|
||||
xi :: Array{Float64, 1}
|
||||
(dimensionless) coordinates of integration point
|
||||
weight :: Float64
|
||||
Integration weight
|
||||
attributes :: Dict{ASCIIString, Any}
|
||||
This is used to save internal variables of IP needed e.g. for incremental
|
||||
material models.
|
||||
"""
|
||||
type IntegrationPoint
|
||||
xi :: Array{Float64, 1}
|
||||
weight :: Float64
|
||||
attributes :: Dict{ASCIIString, Any}
|
||||
end
|
||||
|
||||
type Element
|
||||
id :: Int
|
||||
@@ -8,9 +24,10 @@ type Element
|
||||
node_ids :: Array{Int, 1}
|
||||
basis :: Function
|
||||
dbasis :: Function
|
||||
integration_points :: Array{IntegrationPoint, 1}
|
||||
attributes :: Dict{ASCIIString, Any}
|
||||
ipoints :: Array{Float64, 2}
|
||||
iweights :: Array{Float64, 1}
|
||||
# ipoints :: Array{Float64, 2}
|
||||
# iweights :: Array{Float64, 1}
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user