surface pressure load tet4 + test

This commit is contained in:
Jukka Aho
2016-05-31 00:31:43 +03:00
parent 977e795bef
commit f5e2b6f1d5
4 changed files with 106 additions and 34 deletions
+33
View File
@@ -0,0 +1,33 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
Calculate field values to nodal points from Gauss points using least-squares fitting.
"""
function calc_nodal_values!(elements, field_name, field_dim, time)
A = SparseMatrixCOO()
b = SparseMatrixCOO()
for element in elements
gdofs = get_connectivity(element)
for ip in get_integration_points(element)
detJ = element(ip, time, Val{:detJ})
w = ip.weight*detJ
f = ip(field_name, time)
N = element(ip, time)
add!(A, gdofs, gdofs, w*kron(N', N))
for dim=1:field_dim
add!(b, gdofs, w*f[dim]*N, dim)
end
end
end
A = sparse(A)
b = sparse(b)
nz = get_nonzero_rows(A)
x = zeros(size(b)...)
x[nz, :] = A[nz,nz] \ b[nz, :]
nodal_values = Dict()
for i=1:size(x,1)
nodal_values[i] = vec(x[i,:])
end
update!(elements, field_name, nodal_values)
end