mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-11 06:08:07 +00:00
Drop Logging.jl (#205)
Julia 0.7 is having improved logging capabilities, we can drop Logging.jl.
This commit is contained in:
@@ -4,7 +4,6 @@ ForwardDiff
|
||||
LightXML 0.4
|
||||
HDF5 0.7
|
||||
Formatting
|
||||
Logging
|
||||
TimerOutputs
|
||||
AbaqusReader
|
||||
AsterReader
|
||||
|
||||
@@ -15,11 +15,8 @@ import FEMBase: get_unknown_field_name, get_unknown_field_dimension,
|
||||
assemble!, update!, initialize!
|
||||
using FEMBase: get_problems
|
||||
|
||||
# from other packages TimerOutputs.jl and Logging.jl
|
||||
using TimerOutputs
|
||||
export @timeit, print_timer
|
||||
using Logging
|
||||
export info, debug
|
||||
|
||||
import Base: getindex, setindex!, convert, length, size, isapprox,
|
||||
similar, start, first, next, done, last, endof, vec,
|
||||
|
||||
@@ -77,7 +77,6 @@ function get_temporal_collection(xdmf::Xdmf)
|
||||
domain = find_element(xdmf.xml, "Domain")
|
||||
grid = nothing
|
||||
if domain == nothing
|
||||
debug("Xdmf: creating new temporal collection")
|
||||
domain = new_child(xdmf.xml, "Domain")
|
||||
grid = new_child(domain, "Grid")
|
||||
set_attribute(grid, "CollectionType", "Temporal")
|
||||
@@ -299,13 +298,11 @@ function new_dataitem{T,N}(xdmf::Xdmf, data::Array{T,N})
|
||||
# Path can be whatever as XML format does not store to HDF at all
|
||||
return new_dataitem(xdmf, "/whatever", data)
|
||||
else
|
||||
debug("Determining path for HDF file automatically.")
|
||||
path = "/DataItem_$(xdmf.hdf_counter)"
|
||||
while exists(xdmf.hdf, path)
|
||||
xdmf.hdf_counter += 1
|
||||
path = "/DataItem_$(xdmf.hdf_counter)"
|
||||
end
|
||||
debug("HDF path automatically determined to be $path")
|
||||
return new_dataitem(xdmf, path, data)
|
||||
end
|
||||
end
|
||||
@@ -348,8 +345,6 @@ function update_xdmf!(xdmf::Xdmf, problem::Problem, time::Float64, fields::Vecto
|
||||
if domain == nothing
|
||||
info("Xdmf: Domain not found, creating.")
|
||||
domain = new_child(xml, "Domain")
|
||||
else
|
||||
debug("Xdmf: Domain already defined, skipping.")
|
||||
end
|
||||
|
||||
# 2. find for TemporalCollection
|
||||
@@ -360,8 +355,6 @@ function update_xdmf!(xdmf::Xdmf, problem::Problem, time::Float64, fields::Vecto
|
||||
set_attribute(temporal_collection, "GridType", "Collection")
|
||||
set_attribute(temporal_collection, "Name", "Time")
|
||||
set_attribute(temporal_collection, "CollectionType", "Temporal")
|
||||
else
|
||||
debug("Xdmf: Temporal collection found, skipping.")
|
||||
end
|
||||
|
||||
# 2.1 make sure that Grid element we found really is TemporalCollection
|
||||
|
||||
@@ -61,8 +61,6 @@ end
|
||||
function assemble!(problem::Problem{Contact}, time::Real)
|
||||
if problem.properties.dimension == -1
|
||||
problem.properties.dimension = dim = size(first(problem.elements), 1)
|
||||
debug("assuming dimension of mesh tie surface is $dim")
|
||||
debug("if this is wrong set is manually using problem.properties.dimension")
|
||||
end
|
||||
dimension = Val{problem.properties.dimension}
|
||||
finite_sliding = Val{problem.properties.finite_sliding}
|
||||
|
||||
@@ -164,7 +164,6 @@ function assemble!(problem::Problem{Contact}, slave_element::Element{Tri3}, time
|
||||
|
||||
Ae = De*inv(Me)
|
||||
|
||||
debug("Dual basis coeffients = $Ae")
|
||||
end
|
||||
|
||||
# loop all polygons
|
||||
@@ -344,7 +343,6 @@ function assemble!(problem::Problem{Contact}, slave_element::Element{Tri6}, time
|
||||
|
||||
Ae = De*inv(Me)
|
||||
|
||||
debug("Dual basis coeffients = $Ae")
|
||||
end
|
||||
|
||||
# split slave element to linear sub-elements and loop
|
||||
@@ -520,8 +518,6 @@ function assemble!(problem::Problem{Contact}, time::Float64, ::Type{Val{2}}, ::T
|
||||
|
||||
maxdim = maximum(size(C1))
|
||||
if problem.properties.alpha != 0.0
|
||||
debug("mortar_3d: size C1 = ", size(C1), " max dim = $maxdim")
|
||||
debug("alpha != 0.0, applying transformation D = Dh*T^-1")
|
||||
alp = problem.properties.alpha
|
||||
Te = [
|
||||
1.0 0.0 0.0 0.0 0.0 0.0
|
||||
@@ -566,7 +562,6 @@ function assemble!(problem::Problem{Contact}, time::Float64, ::Type{Val{2}}, ::T
|
||||
end
|
||||
|
||||
tol = problem.properties.drop_tolerance
|
||||
debug("Dropping small values from C1 & C2, tolerace = $tol")
|
||||
SparseArrays.droptol!(C1, tol)
|
||||
SparseArrays.droptol!(C2, tol)
|
||||
|
||||
@@ -650,7 +645,6 @@ function assemble!(problem::Problem{Contact}, time::Float64, ::Type{Val{2}}, ::T
|
||||
for j in S
|
||||
dofs = [3*(j-1)+1, 3*(j-1)+2, 3*(j-1)+3]
|
||||
if is_inactive[j] == 1
|
||||
debug("$j is inactive, removing dofs $dofs")
|
||||
C1[dofs,:] = 0.0
|
||||
C2[dofs,:] = 0.0
|
||||
D[dofs,:] = 0.0
|
||||
@@ -663,7 +657,6 @@ function assemble!(problem::Problem{Contact}, time::Float64, ::Type{Val{2}}, ::T
|
||||
dofs = [3*(j-1)+1, 3*(j-1)+2, 3*(j-1)+3]
|
||||
tdofs = dofs[[2,3]]
|
||||
if (is_active[j] == 1) && (is_slip[j] == 1)
|
||||
debug("$j is in active/slip, removing tangential constraints $tdofs")
|
||||
C2[tdofs,:] = 0.0
|
||||
g[tdofs] = 0.0
|
||||
normal = normals[j]
|
||||
|
||||
@@ -442,7 +442,6 @@ function lsq_fit(problem, elements, field, time)
|
||||
volume += w
|
||||
end
|
||||
end
|
||||
debug("Mass matrix for least-squares fit is assembled. Total volume to fit: $volume")
|
||||
A = sparse(A)
|
||||
b = sparse(b)
|
||||
A = 1/2*(A + A')
|
||||
|
||||
@@ -112,7 +112,6 @@ function get_polygon_clip{T}(xs::Vector{T}, xm::Vector{T}, n::T)
|
||||
# 1. test is master point inside slave, if yes, add to clip
|
||||
for i=1:nm
|
||||
if vertex_inside_polygon(xm[i], xs)
|
||||
# debug("1. $(xm[i]) inside S -> push")
|
||||
push!(P, xm[i])
|
||||
end
|
||||
end
|
||||
@@ -121,7 +120,6 @@ function get_polygon_clip{T}(xs::Vector{T}, xm::Vector{T}, n::T)
|
||||
for i=1:ns
|
||||
if vertex_inside_polygon(xs[i], xm)
|
||||
approx_in(xs[i], P) && continue
|
||||
# debug("2. $(xs[i]) inside M -> push")
|
||||
push!(P, xs[i])
|
||||
end
|
||||
end
|
||||
@@ -144,7 +142,6 @@ function get_polygon_clip{T}(xs::Vector{T}, xm::Vector{T}, n::T)
|
||||
#info("t=$t, q=$q, q ∈ xm ? $(vertex_inside_polygon(q, xm))")
|
||||
if vertex_inside_polygon(q, xm)
|
||||
approx_in(q, P) && continue
|
||||
# debug("3. $q inside M -> push")
|
||||
push!(P, q)
|
||||
end
|
||||
end
|
||||
@@ -269,7 +266,6 @@ function check_orientation!(P, n)
|
||||
np = length(P)
|
||||
s = [dot(n, cross(P[i]-C, P[mod(i+1,np)+1]-C)) for i=1:np]
|
||||
all(s .< 0) && return
|
||||
# debug("polygon not in ccw order, fixing")
|
||||
# project points to new orthogonal basis Q and sort there
|
||||
t1 = (P[1]-C)/norm(P[1]-C)
|
||||
t2 = cross(n, t1)
|
||||
@@ -378,7 +374,6 @@ function assemble!{E<:Union{Tri3, Quad4}}(problem::Problem{Mortar}, slave_elemen
|
||||
|
||||
# project slave nodes to auxiliary plane (x0, Q)
|
||||
xi = get_mean_xi(slave_element)
|
||||
first_slave_element && debug("midpoint xi = $xi")
|
||||
N = vec(get_basis(slave_element, xi, time))
|
||||
x0 = interpolate(N, X1)
|
||||
n0 = interpolate(N, n1)
|
||||
@@ -388,8 +383,6 @@ function assemble!{E<:Union{Tri3, Quad4}}(problem::Problem{Mortar}, slave_elemen
|
||||
|
||||
if props.dual_basis
|
||||
|
||||
debug("Creating dual basis for element $(slave_element.id)")
|
||||
|
||||
De = zeros(nsl, nsl)
|
||||
Me = zeros(nsl, nsl)
|
||||
|
||||
@@ -461,15 +454,6 @@ function assemble!{E<:Union{Tri3, Quad4}}(problem::Problem{Mortar}, slave_elemen
|
||||
N_P = length(P)
|
||||
P_area = sum([norm(1/2*cross(P[i]-P[1], P[mod(i,N_P)+1]-P[1])) for i=2:N_P])
|
||||
|
||||
if first_slave_element
|
||||
debug("Polygon clip info for first slave element:")
|
||||
debug("S = $S")
|
||||
debug("M = $M")
|
||||
debug("P = $P")
|
||||
debug("N_P = $N_P")
|
||||
debug("P_area = $P_area")
|
||||
end
|
||||
|
||||
if isapprox(P_area, 0.0)
|
||||
info("Polygon P has zero area: $P_area")
|
||||
continue
|
||||
@@ -600,7 +584,6 @@ function assemble!{E<:Union{Tri6}}(problem::Problem{Mortar}, slave_element::Elem
|
||||
|
||||
# create auxiliary plane
|
||||
xi = get_mean_xi(sub_slave_element)
|
||||
first_slave_element && debug("midpoint xi = $xi")
|
||||
N = vec(get_basis(sub_slave_element, xi, time))
|
||||
x0 = interpolate(N, X1)
|
||||
n0 = interpolate(N, n1)
|
||||
@@ -683,7 +666,6 @@ function assemble!{E<:Union{Tri6}}(problem::Problem{Mortar}, slave_element::Elem
|
||||
|
||||
# create auxiliary plane
|
||||
xi = get_mean_xi(sub_slave_element)
|
||||
first_slave_element && debug("midpoint xi = $xi")
|
||||
N = vec(get_basis(sub_slave_element, xi, time))
|
||||
x0 = interpolate(N, X1)
|
||||
n0 = interpolate(N, n1)
|
||||
@@ -719,15 +701,6 @@ function assemble!{E<:Union{Tri6}}(problem::Problem{Mortar}, slave_element::Elem
|
||||
N_P = length(P)
|
||||
P_area = sum([norm(1/2*cross(P[i]-P[1], P[mod(i,N_P)+1]-P[1])) for i=2:N_P])
|
||||
|
||||
if first_slave_element
|
||||
debug("Polygon clip info for first slave element:")
|
||||
debug("S = $S")
|
||||
debug("M = $M")
|
||||
debug("P = $P")
|
||||
debug("N_P = $N_P")
|
||||
debug("P_area = $P_area")
|
||||
end
|
||||
|
||||
if isapprox(P_area, 0.0)
|
||||
warn("Polygon P has zero area: $P_area")
|
||||
continue
|
||||
@@ -838,8 +811,6 @@ function assemble!(problem::Problem{Mortar}, time::Real, ::Type{Val{2}}, ::Type{
|
||||
|
||||
maxdim = maximum(size(C1))
|
||||
if problem.properties.alpha != 0.0
|
||||
debug("mortar_3d: size C1 = ", size(C1), " max dim = $maxdim")
|
||||
debug("alpha != 0.0, applying transformation D = Dh*T^-1")
|
||||
alp = problem.properties.alpha
|
||||
Te = [
|
||||
1.0 0.0 0.0 0.0 0.0 0.0
|
||||
@@ -884,14 +855,11 @@ function assemble!(problem::Problem{Mortar}, time::Real, ::Type{Val{2}}, ::Type{
|
||||
end
|
||||
|
||||
tol = problem.properties.drop_tolerance
|
||||
debug("Dropping small values from C1 & C2, tolerace = $tol")
|
||||
SparseArrays.droptol!(C1, tol)
|
||||
SparseArrays.droptol!(C2, tol)
|
||||
|
||||
problem.assembly.C1 = C1
|
||||
problem.assembly.C2 = C2
|
||||
|
||||
debug("area of interface: $area")
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -193,10 +193,6 @@ function solve!(solver::Solver, K, C1, C2, D, f, g, u, la, ::Type{Val{1}})
|
||||
B == B2 || return false
|
||||
I = setdiff(A, B)
|
||||
|
||||
debug("# A = $(length(A))")
|
||||
debug("# B = $(length(B))")
|
||||
debug("# I = $(length(I))")
|
||||
|
||||
if length(B) == 0
|
||||
warn("No rows in C2, forget to set Dirichlet boundary conditions to model?")
|
||||
else
|
||||
@@ -307,7 +303,6 @@ function solve!(solver::Solver; empty_assemblies_before_solution=true, symmetric
|
||||
if length(fint) > 1
|
||||
# kick in generalized alpha rule for time integration
|
||||
alpha = solver.alpha
|
||||
debug("Using generalized-α time integration, α=$alpha")
|
||||
K = (1-alpha)*K
|
||||
C1 = (1-alpha)*C1
|
||||
f = (1-alpha)*f + alpha*fint.data[end-1].second
|
||||
@@ -571,10 +566,6 @@ function has_converged(solver::Solver{Nonlinear})
|
||||
# trivial solution
|
||||
has_converged = true
|
||||
end
|
||||
debug("Details for problem $(problem.name)")
|
||||
debug("Norm: $(norm(problem.assembly.u))")
|
||||
debug("Norm change: $(problem.assembly.u_norm_change)")
|
||||
debug("Has converged? $(has_converged)")
|
||||
converged &= has_converged
|
||||
end
|
||||
return converged
|
||||
|
||||
@@ -5,9 +5,6 @@ using JuliaFEM
|
||||
using JuliaFEM.Preprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
using Logging
|
||||
Logging.configure(level=DEBUG)
|
||||
|
||||
mesh = Mesh()
|
||||
add_node!(mesh, 1, [0.0, 0.0])
|
||||
add_node!(mesh, 2, [1.0, 0.0])
|
||||
|
||||
@@ -46,7 +46,6 @@ using JuliaFEM.Testing
|
||||
a = geom[i]
|
||||
b = strain[i]
|
||||
c = stress[i]
|
||||
debug("$a -> $b -> $c")
|
||||
@test isapprox(b, [-1/3, -1/3, 1.0, 0.0, 0.0, 0.0])
|
||||
@test isapprox(c, [0.0, 0.0, 288.0, 0.0, 0.0, 0.0])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user