mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-29 04:56:15 +00:00
fixed a lot of deprectionwarning issues with 0.5
This commit is contained in:
+2
-4
@@ -12,8 +12,6 @@ include("fields.jl")
|
||||
export Field, DCTI, DVTI, DCTV, DVTV, CCTI, CVTI, CCTV, CVTV
|
||||
include("types.jl") # data types: Point, IntegrationPoint, ...
|
||||
export AbstractPoint, Point, IntegrationPoint, IP, Node
|
||||
#include("basis.jl") # interpolation of discrete fields
|
||||
#include("symbolic.jl") # a thin symbolic layer for fields
|
||||
|
||||
### ELEMENTS ###
|
||||
include("elements.jl") # common element routines
|
||||
@@ -114,11 +112,11 @@ export aster_create_elements, parse_aster_med_file, is_aster_mail_keyword,
|
||||
filter_by_element_set, filter_by_element_id, MEDFile
|
||||
end
|
||||
|
||||
function get_mesh(mesh_name::ASCIIString, args...; kwargs...)
|
||||
function get_mesh(mesh_name::String, args...; kwargs...)
|
||||
return get_mesh(Val{Symbol(mesh_name)}, args...; kwargs...)
|
||||
end
|
||||
|
||||
function get_model(model_name::ASCIIString, args...; kwargs...)
|
||||
function get_model(model_name::String, args...; kwargs...)
|
||||
return get_model(Val{Symbol(model_name)}, args...; kwargs...)
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ end
|
||||
"""
|
||||
Add node to model and renumber for output
|
||||
"""
|
||||
function add_node!(model::Model, index::Union{Int64, ASCIIString},
|
||||
function add_node!(model::Model, index::Union{Int64, String},
|
||||
coords::Vector{Float64})
|
||||
node = Node(index, coords)
|
||||
model.nodes[index] = node
|
||||
@@ -25,7 +25,7 @@ function add_solver!(case::Simulation, solver)
|
||||
case.solver = solver
|
||||
end
|
||||
|
||||
function add_material!(model::Model, set_name::ASCIIString, material::Material)
|
||||
function add_material!(model::Model, set_name::String, material::Material)
|
||||
element_set = model.elsets[set_name]
|
||||
set_ids = element_set.elements
|
||||
for each in set_ids
|
||||
@@ -35,7 +35,7 @@ function add_material!(model::Model, set_name::ASCIIString, material::Material)
|
||||
element_set.material = material
|
||||
end
|
||||
|
||||
function add_element!(model::Model, idx::Union{Int64, ASCIIString},
|
||||
function add_element!(model::Model, idx::Union{Int64, String},
|
||||
eltype::Symbol, node_ids::Vector{Int64})
|
||||
|
||||
element = Element(idx, node_ids, eltype)
|
||||
@@ -47,27 +47,27 @@ function add_element_set!(model::Model, elset::ElementSet)
|
||||
model.elsets[name] = elset
|
||||
end
|
||||
|
||||
function add_element_set!(model::Model, name::ASCIIString, ids::Vector{Int64})
|
||||
function add_element_set!(model::Model, name::String, ids::Vector{Int64})
|
||||
elset = ElementSet(name, ids)
|
||||
model.elsets[name] = elset
|
||||
end
|
||||
|
||||
function add_node_set!(model::Model, name::ASCIIString, ids::Vector{Int64})
|
||||
function add_node_set!(model::Model, name::String, ids::Vector{Int64})
|
||||
nset = NodeSet(name, ids)
|
||||
model.nsets[name] = nset
|
||||
end
|
||||
|
||||
function add_element_set!(model::Model, name::ASCIIString,
|
||||
function add_element_set!(model::Model, name::String,
|
||||
elements::Vector{Element})
|
||||
elset = ElementSet(name, elements)
|
||||
model.elsets[name] = elset
|
||||
end
|
||||
|
||||
function add_element_set!(case::Simulation, name::ASCIIString)
|
||||
function add_element_set!(case::Simulation, name::String)
|
||||
push!(case.sets, name)
|
||||
end
|
||||
|
||||
function add_simulation!(model::Model, name::ASCIIString, case::Simulation)
|
||||
function add_simulation!(model::Model, name::String, case::Simulation)
|
||||
model.load_cases[name] = case
|
||||
end
|
||||
#function Base.convert{T<:AbstractFloat}(::Type{Node}, data::Vector{T})
|
||||
@@ -80,7 +80,7 @@ end
|
||||
#end
|
||||
#
|
||||
#
|
||||
#function get_element_set(model::Model, set_name::ASCIIString)
|
||||
#function get_element_set(model::Model, set_name::String)
|
||||
# get_set = model.sets[set_name]
|
||||
# isa(get_set, ElementSet) ? get_set : err("Found set $(set_name)
|
||||
# but it is not a ElementSet. Check if you have used
|
||||
|
||||
+32
-32
@@ -3,12 +3,12 @@
|
||||
|
||||
|
||||
type NeumannBC
|
||||
set_name :: ASCIIString
|
||||
set_name :: String
|
||||
value :: Any
|
||||
end
|
||||
|
||||
type DirichletBC
|
||||
set_name :: ASCIIString
|
||||
set_name :: String
|
||||
value :: Any
|
||||
end
|
||||
|
||||
@@ -21,13 +21,13 @@ typealias HeatFluxBC NeumannBC
|
||||
"""
|
||||
"""
|
||||
type Material
|
||||
name :: ASCIIString
|
||||
scalar_data :: Dict{ASCIIString, Any}
|
||||
name :: String
|
||||
scalar_data :: Dict{String, Any}
|
||||
end
|
||||
|
||||
#Material(name, data) = Material(name, Dict(data))
|
||||
Material(name) = Material(name, Dict{ASCIIString, Any}())
|
||||
Material() = Material("", Dict{ASCIIString, Any}())
|
||||
Material(name) = Material(name, Dict{String, Any}())
|
||||
Material() = Material("", Dict{String, Any}())
|
||||
|
||||
function Base.setindex!{T <: AbstractString }(material::Material, val, name::T)
|
||||
material.scalar_data[name] = val
|
||||
@@ -35,12 +35,12 @@ end
|
||||
|
||||
|
||||
type Node
|
||||
id :: Union{Integer, ASCIIString}
|
||||
id :: Union{Integer, String}
|
||||
coords :: Array{Float64, 1}
|
||||
end
|
||||
|
||||
type Element
|
||||
id :: Union{Integer, ASCIIString, Void}
|
||||
id :: Union{Integer, String, Void}
|
||||
connectivity :: Vector{Int64}
|
||||
element_type :: Symbol
|
||||
results :: Any # Dict{}
|
||||
@@ -50,22 +50,22 @@ end
|
||||
Element(a, b, c) = Element(a, b, c, nothing, Material())
|
||||
|
||||
type NodeSet
|
||||
name :: ASCIIString
|
||||
name :: String
|
||||
nodes :: Vector{Int64}
|
||||
end
|
||||
|
||||
"""
|
||||
"""
|
||||
type ElementSet
|
||||
name :: ASCIIString
|
||||
elements :: Vector{Union{Int64, ASCIIString}}
|
||||
name :: String
|
||||
elements :: Vector{Union{Int64, String}}
|
||||
material :: Material
|
||||
end
|
||||
|
||||
ElementSet(name::ASCIIString, elements::Vector{Element}) =
|
||||
ElementSet(name::String, elements::Vector{Element}) =
|
||||
ElementSet(name, map(x-> x.id, elements), Material())
|
||||
|
||||
ElementSet(name::ASCIIString, ids::Vector{Int64}) =
|
||||
ElementSet(name::String, ids::Vector{Int64}) =
|
||||
ElementSet(name, ids, Material())
|
||||
|
||||
"""
|
||||
@@ -76,10 +76,10 @@ type Simulation
|
||||
neumann_boundary_conditions :: Vector{NeumannBC}
|
||||
dirichlet_boundary_conditions :: Vector{DirichletBC}
|
||||
solver
|
||||
sets :: Vector{ASCIIString}
|
||||
sets :: Vector{String}
|
||||
end
|
||||
|
||||
Simulation(a) = Simulation(a, NeumannBC[], DirichletBC[], nothing, ASCIIString[])
|
||||
Simulation(a) = Simulation(a, NeumannBC[], DirichletBC[], nothing, String[])
|
||||
|
||||
|
||||
"""
|
||||
@@ -88,17 +88,17 @@ Model type
|
||||
Used for constructing the calculation model
|
||||
"""
|
||||
type Model
|
||||
name :: ASCIIString
|
||||
nodes :: Dict{Union{Int64, ASCIIString}}
|
||||
elements :: Dict{Union{ASCIIString, Int64}, Element}
|
||||
elsets :: Dict{ASCIIString, ElementSet}
|
||||
nsets :: Dict{ASCIIString, NodeSet}
|
||||
load_cases :: Dict{ASCIIString, Simulation}
|
||||
renum_nodes :: Dict{Union{Int64, ASCIIString}, Int64}
|
||||
name :: String
|
||||
nodes :: Dict{Union{Int64, String}}
|
||||
elements :: Dict{Union{String, Int64}, Element}
|
||||
elsets :: Dict{String, ElementSet}
|
||||
nsets :: Dict{String, NodeSet}
|
||||
load_cases :: Dict{String, Simulation}
|
||||
renum_nodes :: Dict{Union{Int64, String}, Int64}
|
||||
#settings :: Dict{AbstractString, Real}
|
||||
end
|
||||
|
||||
function Model(name::ASCIIString, abq_input::Dict)
|
||||
function Model(name::String, abq_input::Dict)
|
||||
model = Model(name)
|
||||
nodes = abq_input["nodes"]
|
||||
elements = abq_input["elements"]
|
||||
@@ -129,18 +129,18 @@ function Model(name::ASCIIString, abq_input::Dict)
|
||||
model
|
||||
end
|
||||
|
||||
Model(name::ASCIIString) = Model(
|
||||
Model(name::String) = Model(
|
||||
name,
|
||||
Dict{Union{Int64, ASCIIString}, Node}(),
|
||||
Dict{Union{Int64, ASCIIString}, Element}(),
|
||||
Dict{ASCIIString, NodeSet}(),
|
||||
Dict{ASCIIString, ElementSet}(),
|
||||
Dict{ASCIIString, Simulation}(),
|
||||
Dict{Union{Int64, ASCIIString}, Int64}()
|
||||
Dict{Union{Int64, String}, Node}(),
|
||||
Dict{Union{Int64, String}, Element}(),
|
||||
Dict{String, NodeSet}(),
|
||||
Dict{String, ElementSet}(),
|
||||
Dict{String, Simulation}(),
|
||||
Dict{Union{Int64, String}, Int64}()
|
||||
)
|
||||
|
||||
function Base.setindex!(dict::Dict{Union{ASCIIString, Int64}, Node},
|
||||
vals::Vector{Float64}, idx::Union{ASCIIString, Int64})
|
||||
function Base.setindex!(dict::Dict{Union{String, Int64}, Node},
|
||||
vals::Vector{Float64}, idx::Union{String, Int64})
|
||||
dict[idx] = Node(idx, vals)
|
||||
end
|
||||
|
||||
|
||||
+36
-36
@@ -7,7 +7,7 @@ type Element{E<:AbstractElement}
|
||||
id :: Int
|
||||
connectivity :: Vector{Int}
|
||||
integration_points :: Vector{IP}
|
||||
fields :: Dict{ASCIIString, Field}
|
||||
fields :: Dict{String, Field}
|
||||
properties :: E
|
||||
end
|
||||
|
||||
@@ -17,27 +17,27 @@ function Element{E<:AbstractElement}(::Type{E}, connectivity=[], integration_poi
|
||||
return element
|
||||
end
|
||||
|
||||
function getindex(element::Element, field_name::ASCIIString)
|
||||
function getindex(element::Element, field_name::String)
|
||||
return element.fields[field_name]
|
||||
end
|
||||
|
||||
function setindex!(element::Element, data::Field, field_name::ASCIIString)
|
||||
function setindex!(element::Element, data::Field, field_name::String)
|
||||
element.fields[field_name] = data
|
||||
end
|
||||
|
||||
function setindex!(element::Element, data, field_name::ASCIIString)
|
||||
function setindex!(element::Element, data, field_name::String)
|
||||
element.fields[field_name] = Field(data)
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString)
|
||||
function call(element::Element, field_name::String)
|
||||
return element[field_name]
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, time)
|
||||
function call(element::Element, field_name::String, time)
|
||||
return element[field_name](time)
|
||||
end
|
||||
|
||||
function last(element::Element, field_name::ASCIIString)
|
||||
function last(element::Element, field_name::String)
|
||||
return last(element[field_name])
|
||||
end
|
||||
|
||||
@@ -71,7 +71,7 @@ function call(element::Element, ip, time, ::Type{Val{:Grad}})
|
||||
return inv(J)*get_dbasis(element, ip, time)
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, ip, time, ::Type{Val{:Grad}})
|
||||
function call(element::Element, field_name::String, ip, time, ::Type{Val{:Grad}})
|
||||
return element(ip, time, Val{:Grad})*element[field_name](time)
|
||||
end
|
||||
|
||||
@@ -83,14 +83,14 @@ function call(element::Element, field::DCTI, time)
|
||||
return field.data
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, time)
|
||||
function call(element::Element, field_name::String, time)
|
||||
field = element[field_name]
|
||||
return call(element, field, time)
|
||||
return element(field, time)
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, ip, time::Float64)
|
||||
function call(element::Element, field_name::String, ip, time::Float64)
|
||||
field = element[field_name]
|
||||
return call(element, field, ip, time)
|
||||
return element(field, ip, time)
|
||||
end
|
||||
|
||||
function call(element::Element, field::DCTI, ip, time::Float64)
|
||||
@@ -131,17 +131,17 @@ julia> update!(element, "geometry", data)
|
||||
As a result element now have time invariant (variable) vector field "geometry" with data ([0.0, 0.0], [1.0, 2.0]).
|
||||
|
||||
"""
|
||||
function update!(element::Element, field_name::ASCIIString, data::Dict)
|
||||
function update!(element::Element, field_name::String, data::Dict)
|
||||
element[field_name] = [data[i] for i in get_connectivity(element)]
|
||||
end
|
||||
|
||||
function update!{K,V}(element::Element, field_name::ASCIIString, data::Pair{Float64, Dict{K, V}})
|
||||
function update!{K,V}(element::Element, field_name::String, data::Pair{Float64, Dict{K, V}})
|
||||
time, field_data = data
|
||||
element_data = V[field_data[i] for i in get_connectivity(element)]
|
||||
update!(element, field_name, time => element_data)
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, datas::Union{Real, Vector, Pair{Float64, Union{Float64, Real, Vector{Any}}}}...)
|
||||
function update!(element::Element, field_name::String, datas::Union{Real, Vector, Pair{Float64, Union{Float64, Real, Vector{Any}}}}...)
|
||||
for data in datas
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
@@ -155,13 +155,13 @@ function update!(element::Element, field_name::ASCIIString, datas::Union{Real, V
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, datas::Pair...)
|
||||
function update!(element::Element, field_name::String, datas::Pair...)
|
||||
for data in datas
|
||||
update!(element, field_name, data)
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Pair{Float64, Vector{Any}})
|
||||
function update!(element::Element, field_name::String, data::Pair{Float64, Vector{Any}})
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
else
|
||||
@@ -169,7 +169,7 @@ function update!(element::Element, field_name::ASCIIString, data::Pair{Float64,
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Pair{Float64, Vector{Int64}})
|
||||
function update!(element::Element, field_name::String, data::Pair{Float64, Vector{Int64}})
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
else
|
||||
@@ -177,7 +177,7 @@ function update!(element::Element, field_name::ASCIIString, data::Pair{Float64,
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Pair{Float64, Vector{Vector{Float64}}})
|
||||
function update!(element::Element, field_name::String, data::Pair{Float64, Vector{Vector{Float64}}})
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
else
|
||||
@@ -185,7 +185,7 @@ function update!(element::Element, field_name::ASCIIString, data::Pair{Float64,
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Pair{Float64, Float64})
|
||||
function update!(element::Element, field_name::String, data::Pair{Float64, Float64})
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
else
|
||||
@@ -193,7 +193,7 @@ function update!(element::Element, field_name::ASCIIString, data::Pair{Float64,
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Union{Float64, Vector})
|
||||
function update!(element::Element, field_name::String, data::Union{Float64, Vector})
|
||||
if haskey(element, field_name)
|
||||
update!(element[field_name], data)
|
||||
else
|
||||
@@ -215,15 +215,15 @@ function update!(element::Element, datas::Pair...)
|
||||
end
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, data::Function)
|
||||
function update!(element::Element, field_name::String, data::Function)
|
||||
element[field_name] = data
|
||||
end
|
||||
|
||||
function update!(element::Element, field_name::ASCIIString, field::Field)
|
||||
function update!(element::Element, field_name::String, field::Field)
|
||||
element[field_name] = field
|
||||
end
|
||||
|
||||
function update!(elements::Vector, field_name::ASCIIString, data)
|
||||
function update!(elements::Vector, field_name::String, data)
|
||||
for element in elements
|
||||
update!(element, field_name, data)
|
||||
end
|
||||
@@ -290,7 +290,7 @@ end
|
||||
|
||||
type Element{E}
|
||||
connectivity :: Vector{Int}
|
||||
fields :: Dict{ASCIIString, Field}
|
||||
fields :: Dict{String, Field}
|
||||
# matrices to construct dual basis
|
||||
D :: Matrix{Float64}
|
||||
M :: Matrix{Float64}
|
||||
@@ -344,31 +344,31 @@ Examples
|
||||
>>> element["temperature"] = (0.0, [0, 0, 0, 0]), (1.0, [1, 2, 3, 4])
|
||||
>>> element["temperature"] = (0.0 => [0, 0, 0, 0], 1.0 => [1, 2, 3, 4])
|
||||
"""
|
||||
function Base.setindex!(element::Element, data, name::ASCIIString)
|
||||
function Base.setindex!(element::Element, data, name::String)
|
||||
element.fields[name] = Field(data)
|
||||
end
|
||||
function Base.setindex!(element::Element, field::Field, name::ASCIIString)
|
||||
function Base.setindex!(element::Element, field::Field, name::String)
|
||||
element.fields[name] = field
|
||||
end
|
||||
function Base.setindex!(element::Element, data::Tuple, name::ASCIIString)
|
||||
function Base.setindex!(element::Element, data::Tuple, name::String)
|
||||
element.fields[name] = Field(data...)
|
||||
end
|
||||
|
||||
|
||||
typealias VecOrIP Union{Vector, IntegrationPoint}
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, time::Real, variation=nothing)
|
||||
function call(element::Element, field_name::String, time::Real, variation=nothing)
|
||||
return isa(variation, Void) ? element[field_name](time) : variation
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, xi::VecOrIP, time::Number, variation=nothing)
|
||||
function call(element::Element, field_name::String, xi::VecOrIP, time::Number, variation=nothing)
|
||||
field = element(field_name, time, variation)
|
||||
# field = isa(variation, Void) ? element[field_name](time) : variation
|
||||
basis = get_basis(element)
|
||||
return basis(field, xi)
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, xi::VecOrIP, time::Number, ::Type{Val{:grad}}, variation=nothing)
|
||||
function call(element::Element, field_name::String, xi::VecOrIP, time::Number, ::Type{Val{:grad}}, variation=nothing)
|
||||
# field = isa(variation, Void) ? element[field_name](time) : variation
|
||||
field = element(field_name, time, variation)
|
||||
basis = get_basis(element)
|
||||
@@ -376,20 +376,20 @@ function call(element::Element, field_name::ASCIIString, xi::VecOrIP, time::Numb
|
||||
return basis(geom, field, xi, Val{:grad})
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, xi::VecOrIP)
|
||||
function call(element::Element, field_name::String, xi::VecOrIP)
|
||||
field = element[field_name]
|
||||
basis = get_basis(element)
|
||||
return basis(element[field_name], xi)
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, xi::VecOrIP, ::Type{Val{:grad}})
|
||||
function call(element::Element, field_name::String, xi::VecOrIP, ::Type{Val{:grad}})
|
||||
field = element[field_name]
|
||||
geom = element["geometry"]
|
||||
basis = get_basis(element)
|
||||
return basis(geom, field, xi, Val{:grad})
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString, time::Number)
|
||||
function call(element::Element, field_name::String, time::Number)
|
||||
return element[field_name](time)
|
||||
end
|
||||
|
||||
@@ -462,7 +462,7 @@ function call{E}(element::Element{E}, xi::VecOrIP, time::Float64, ::Type{Val{:gr
|
||||
return basis(element["geometry"](time), xi, Val{:grad})
|
||||
end
|
||||
|
||||
function call(element::Element, field_name::ASCIIString)
|
||||
function call(element::Element, field_name::String)
|
||||
return element[field_name]
|
||||
end
|
||||
|
||||
@@ -630,7 +630,7 @@ end
|
||||
|
||||
""" Update values for several elements at once. """
|
||||
# FIXME: with or without {T} ?
|
||||
function update!{T}(elements::Vector{Element{T}}, field_name::ASCIIString, data...)
|
||||
function update!{T}(elements::Vector{Element{T}}, field_name::String, data...)
|
||||
for element in elements
|
||||
update!(element, field_name, data...)
|
||||
end
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ type Field{A<:Union{Discrete,Continuous}, B<:Union{Constant,Variable}, C<:Union{
|
||||
data
|
||||
end
|
||||
|
||||
typealias FieldSet Dict{ASCIIString, Field}
|
||||
typealias FieldSet Dict{String, Field}
|
||||
|
||||
### Basic data structure for discrete field
|
||||
|
||||
@@ -396,14 +396,14 @@ function call(basis::CVTI, geometry::DVTI, xi::Vector, ::Type{Val{:grad}})
|
||||
end
|
||||
|
||||
function call(basis::CVTI, geometry::DVTI, values::DVTI, xi::Vector, ::Type{Val{:grad}})
|
||||
grad = call(basis, geometry, xi, Val{:grad})
|
||||
grad = basis(geometry, xi, Val{:grad})
|
||||
# gradf = sum([grad[:,i]*values[i]' for i=1:length(geometry)])'
|
||||
gradf = sum([kron(grad[:,i], values[i]') for i=1:length(values)])'
|
||||
return length(gradf) == 1 ? gradf[1] : gradf
|
||||
end
|
||||
|
||||
function call(basis::CVTI, xi::Vector, time::Number)
|
||||
call(basis, xi)
|
||||
basis(xi)
|
||||
end
|
||||
|
||||
function Base.(:*)(grad::Matrix, field::DVTI)
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ using JuliaFEM.API: Model
|
||||
Function for creating solver and all the necessary components
|
||||
for the calculation
|
||||
"""
|
||||
function get_solver(model::Model, case_name::ASCIIString)
|
||||
function get_solver(model::Model, case_name::String)
|
||||
case = model.load_cases[case_name]
|
||||
|
||||
# Create core elements
|
||||
@@ -118,7 +118,7 @@ end
|
||||
|
||||
"""
|
||||
"""
|
||||
function solve!(model::Model, case_name::ASCIIString, time::Float64)
|
||||
function solve!(model::Model, case_name::String, time::Float64)
|
||||
# Create solver
|
||||
solver = get_solver(model, case_name)
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ function xdmf_new_result!(xdmf::XDMF, elements::Vector, time)
|
||||
set_attribute(dataitem, "DataType", "Float")
|
||||
set_attribute(dataitem, "Format", "XML")
|
||||
#set_attribute(dataitem, "Precision", 8)
|
||||
s = ASCIIString[]
|
||||
s = String[]
|
||||
ndim = 0
|
||||
for i in xdmf.permutation
|
||||
ndim += length(X[i])
|
||||
@@ -117,7 +117,7 @@ function xdmf_new_result!(xdmf::XDMF, elements::Vector, time)
|
||||
set_attribute(dataitem, "Format", "XML")
|
||||
set_attribute(dataitem, "DataType", "Int")
|
||||
# set_attribute(dataitem, "Precision", 8)
|
||||
s = ASCIIString[]
|
||||
s = String[]
|
||||
eldim = 0
|
||||
for element in elements
|
||||
eltype = get_xdmf_element_code(element)
|
||||
@@ -167,7 +167,7 @@ function xdmf_save_field!(xdmf, elements::Vector, time, field_name; field_type="
|
||||
#set_attribute(dataitem, "Precision", 8)
|
||||
debug && info("field dim = $field_dim")
|
||||
debug && info(f)
|
||||
s = ASCIIString[]
|
||||
s = String[]
|
||||
dim = 0
|
||||
for i in xdmf.permutation
|
||||
gi = zeros(field_dim)
|
||||
|
||||
+6
-6
@@ -18,10 +18,10 @@ using JuliaFEM
|
||||
|
||||
type Mesh
|
||||
nodes :: Dict{Int64, Vector{Float64}}
|
||||
node_sets :: Dict{ASCIIString, Set{Int64}}
|
||||
node_sets :: Dict{String, Set{Int64}}
|
||||
elements :: Dict{Int64, Vector{Int64}}
|
||||
element_types :: Dict{Int64, Symbol}
|
||||
element_sets :: Dict{ASCIIString, Set{Int64}}
|
||||
element_sets :: Dict{String, Set{Int64}}
|
||||
end
|
||||
|
||||
function Mesh()
|
||||
@@ -38,7 +38,7 @@ function add_nodes!(mesh::Mesh, nodes::Dict{Int64, Vector{Float64}})
|
||||
end
|
||||
end
|
||||
|
||||
function add_node_to_node_set!(mesh::Mesh, set_name::ASCIIString, nids...)
|
||||
function add_node_to_node_set!(mesh::Mesh, set_name::String, nids...)
|
||||
if !haskey(mesh.node_sets, set_name)
|
||||
mesh.node_sets[set_name] = Set{Int64}()
|
||||
end
|
||||
@@ -56,7 +56,7 @@ function add_elements!(mesh::Mesh, elements::Dict{Int64, Tuple{Symbol, Vector{In
|
||||
end
|
||||
end
|
||||
|
||||
function add_element_to_element_set!(mesh::Mesh, set_name::ASCIIString, elids...)
|
||||
function add_element_to_element_set!(mesh::Mesh, set_name::String, elids...)
|
||||
if !haskey(mesh.element_sets, set_name)
|
||||
mesh.element_sets[set_name] = Set{Int64}()
|
||||
end
|
||||
@@ -84,7 +84,7 @@ function filter_by_element_id(mesh::Mesh, element_ids::Vector{Int64})
|
||||
return mesh2
|
||||
end
|
||||
|
||||
function filter_by_element_set(mesh::Mesh, set_name::ASCIIString)
|
||||
function filter_by_element_set(mesh::Mesh, set_name::String)
|
||||
filter_by_element_id(mesh::Mesh, collect(mesh.element_sets[set_name]))
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ function create_elements(mesh::Mesh)
|
||||
return elements
|
||||
end
|
||||
|
||||
function create_elements(mesh::Mesh, element_sets::ASCIIString...)
|
||||
function create_elements(mesh::Mesh, element_sets::String...)
|
||||
elements = Element[]
|
||||
for element_set in element_sets
|
||||
new_elements = create_elements(filter_by_element_set(mesh, element_set))
|
||||
|
||||
@@ -81,7 +81,7 @@ Parse elements from input.
|
||||
function parse_section(model, lines, key, idx_start, idx_end, ::Type{Val{:ELEMENT}})
|
||||
definition = uppercase(lines[idx_start])
|
||||
element_type = regex_match(r"TYPE=([\w\-\_]+)", definition, 1)
|
||||
eltype_sym = symbol(element_type)
|
||||
eltype_sym = Symbol(element_type)
|
||||
eltype_nodes = element_has_nodes(Val{eltype_sym})
|
||||
element_type = element_has_type(Val{eltype_sym})
|
||||
info("Parsing elements. Type: $(element_type)")
|
||||
@@ -195,13 +195,13 @@ function parse_abaqus(fid::IOStream)
|
||||
parser::Function = x->()
|
||||
model = Dict{AbstractString, Any}()
|
||||
model["nodes"] = Dict{Int64, Vector{Float64}}()
|
||||
model["nsets"] = Dict{ASCIIString, Vector{Int64}}()
|
||||
model["elsets"] = Dict{ASCIIString, Vector{Int64}}()
|
||||
model["nsets"] = Dict{String, Vector{Int64}}()
|
||||
model["elsets"] = Dict{String, Vector{Int64}}()
|
||||
model["elements"] = Dict{Integer, Any}()
|
||||
for idx_end in keyword_indexes[2:end]
|
||||
keyword_line = uppercase(lines[idx_start])
|
||||
keyword = regex_match(r"\s*(\w+)", keyword_line, 1)
|
||||
k_sym = symbol(keyword)
|
||||
k_sym = Symbol(keyword)
|
||||
if method_exists(parse_section, Tuple{Dict, Array{Integer, 1}, Symbol,
|
||||
Integer, Integer, Type{Val{k_sym}}})
|
||||
parse_section(model, lines, k_sym, idx_start, idx_end-1, Val{k_sym})
|
||||
|
||||
@@ -100,7 +100,7 @@ function parse_abaqus(fid::IOStream)
|
||||
model = Dict()
|
||||
section = nothing
|
||||
header = nothing
|
||||
data = ASCIIString[]
|
||||
data = String[]
|
||||
info("Registered handlers: $(keys(handlers))")
|
||||
|
||||
function process_section(section)
|
||||
|
||||
@@ -39,7 +39,7 @@ function aster_create_elements(mesh, element_set, element_type=nothing; reverse_
|
||||
end
|
||||
|
||||
|
||||
function aster_parse_nodes(section::ASCIIString; strip_characters=true)
|
||||
function aster_parse_nodes(section::String; strip_characters=true)
|
||||
nodes = Dict{Any, Vector{Float64}}()
|
||||
has_started = false
|
||||
for line in split(section, '\n')
|
||||
@@ -68,10 +68,10 @@ function aster_parse_nodes(section::ASCIIString; strip_characters=true)
|
||||
return nodes
|
||||
end
|
||||
|
||||
function parse(mesh::ASCIIString, ::Type{Val{:CODE_ASTER_MAIL}})
|
||||
model = Dict{ASCIIString, Any}()
|
||||
function parse(mesh::String, ::Type{Val{:CODE_ASTER_MAIL}})
|
||||
model = Dict{String, Any}()
|
||||
header = nothing
|
||||
data = ASCIIString[]
|
||||
data = String[]
|
||||
for line in split(mesh, '\n')
|
||||
length(line) != 0 || continue
|
||||
info("line: $line")
|
||||
@@ -242,7 +242,7 @@ type MEDFile
|
||||
data :: Dict
|
||||
end
|
||||
|
||||
function MEDFile(fn::ASCIIString)
|
||||
function MEDFile(fn::String)
|
||||
MEDFile(h5read(fn, "/"))
|
||||
end
|
||||
|
||||
@@ -334,9 +334,9 @@ end
|
||||
|
||||
Paramters
|
||||
---------
|
||||
fn :: ASCIIString
|
||||
fn :: String
|
||||
file name to parse
|
||||
mesh_name :: ASCIIString, optional
|
||||
mesh_name :: String, optional
|
||||
mesh name, if several meshes in one file
|
||||
|
||||
Returns
|
||||
@@ -344,7 +344,7 @@ Returns
|
||||
Dict containing fields "nodes" and "connectivity".
|
||||
|
||||
"""
|
||||
function parse_aster_med_file(fn::ASCIIString, mesh_name=nothing; debug=false)
|
||||
function parse_aster_med_file(fn::String, mesh_name=nothing; debug=false)
|
||||
med = MEDFile(fn)
|
||||
if isa(mesh_name, Void)
|
||||
mesh_names = get_mesh_names(med::MEDFile)
|
||||
@@ -362,7 +362,7 @@ function parse_aster_med_file(fn::ASCIIString, mesh_name=nothing; debug=false)
|
||||
end
|
||||
nodes = get_nodes(med, nsets, mesh_name)
|
||||
conn = get_connectivity(med, elsets, mesh_name)
|
||||
result = Dict{ASCIIString, Any}()
|
||||
result = Dict{String, Any}()
|
||||
result["nodes"] = nodes
|
||||
result["connectivity"] = conn
|
||||
return result
|
||||
@@ -417,7 +417,7 @@ global const mapping = Dict(
|
||||
|
||||
)
|
||||
|
||||
function aster_read_mesh(fn::ASCIIString, mesh_name=nothing; reorder_element_connectivity=true)
|
||||
function aster_read_mesh(fn::String, mesh_name=nothing; reorder_element_connectivity=true)
|
||||
result = parse_aster_med_file(fn, mesh_name)
|
||||
mesh = Mesh()
|
||||
for (nid, (nset, ncoords)) in result["nodes"]
|
||||
|
||||
+4
-4
@@ -84,9 +84,9 @@ function get_dofs(assembly::Assembly)
|
||||
end
|
||||
|
||||
type Problem{P<:AbstractProblem}
|
||||
name :: ASCIIString # descriptive name for problem
|
||||
name :: String # descriptive name for problem
|
||||
dimension :: Int # degrees of freedom per node
|
||||
parent_field_name :: ASCIIString # (optional) name of parent field e.g. "displacement"
|
||||
parent_field_name :: String # (optional) name of parent field e.g. "displacement"
|
||||
elements :: Vector{Element}
|
||||
dofmap :: Dict{Element, Vector{Int64}} # connects element local dofs to global dofs
|
||||
assembly :: Assembly
|
||||
@@ -103,7 +103,7 @@ julia> prob1 = Problem(Elasticity, "this is my problem", 3)
|
||||
julia> prob2 = Problem(Elasticity, 3)
|
||||
|
||||
"""
|
||||
function Problem{P<:FieldProblem}(::Type{P}, name::ASCIIString, dimension::Int64)
|
||||
function Problem{P<:FieldProblem}(::Type{P}, name::String, dimension::Int64)
|
||||
Problem{P}(name, dimension, "none", [], Dict(), Assembly(), P())
|
||||
end
|
||||
function Problem{P<:FieldProblem}(::Type{P}, dimension::Int64)
|
||||
@@ -280,7 +280,7 @@ function length(problem::Problem)
|
||||
return length(problem.elements)
|
||||
end
|
||||
|
||||
function update!(problem::Problem, field_name::ASCIIString, field)
|
||||
function update!(problem::Problem, field_name::String, field)
|
||||
update!(problem.elements, field_name, field)
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ type Contact <: BoundaryProblem
|
||||
use_forwarddiff :: Bool
|
||||
minimum_active_set_size :: Int
|
||||
distval :: Float64
|
||||
store_fields :: Vector{ASCIIString}
|
||||
store_fields :: Vector{String}
|
||||
end
|
||||
|
||||
function Contact()
|
||||
|
||||
@@ -38,7 +38,7 @@ type Elasticity <: FieldProblem
|
||||
formulation :: Symbol
|
||||
finite_strain :: Bool
|
||||
geometric_stiffness :: Bool
|
||||
store_fields :: Vector{ASCIIString}
|
||||
store_fields :: Vector{String}
|
||||
end
|
||||
function Elasticity()
|
||||
# formulations: plane_stress, plane_strain, continuum
|
||||
|
||||
@@ -44,8 +44,8 @@ https://en.wikipedia.org/wiki/Thermal_diffusivity
|
||||
https://en.wikipedia.org/wiki/Volumetric_heat_capacity
|
||||
"""
|
||||
type Heat <: FieldProblem
|
||||
formulation :: ASCIIString
|
||||
store_fields :: Vector{ASCIIString}
|
||||
formulation :: String
|
||||
store_fields :: Vector{String}
|
||||
end
|
||||
|
||||
function Heat()
|
||||
|
||||
@@ -8,7 +8,7 @@ type Mortar <: BoundaryProblem
|
||||
dual_basis :: Bool
|
||||
use_forwarddiff :: Bool
|
||||
distval :: Float64
|
||||
store_fields :: Vector{ASCIIString}
|
||||
store_fields :: Vector{String}
|
||||
end
|
||||
|
||||
function Mortar()
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
abstract AbstractSolver
|
||||
|
||||
type Solver{S<:AbstractSolver}
|
||||
name :: ASCIIString # some descriptive name for problem
|
||||
name :: String # some descriptive name for problem
|
||||
time :: Real # current time
|
||||
problems :: Vector{Problem}
|
||||
norms :: Vector{Tuple} # solution norms for convergence studies
|
||||
@@ -27,7 +27,7 @@ function push!(solver::Solver, problem)
|
||||
push!(solver.problems, problem)
|
||||
end
|
||||
|
||||
function getindex(solver::Solver, problem_name::ASCIIString)
|
||||
function getindex(solver::Solver, problem_name::String)
|
||||
for problem in get_problems(solver)
|
||||
if problem.name == problem_name
|
||||
return problem
|
||||
@@ -461,7 +461,7 @@ function NonlinearSolver(problems...)
|
||||
end
|
||||
return solver
|
||||
end
|
||||
function NonlinearSolver(name::ASCIIString, problems::Problem...)
|
||||
function NonlinearSolver(name::String, problems::Problem...)
|
||||
solver = NonlinearSolver(problems...)
|
||||
solver.name = name
|
||||
return solver
|
||||
@@ -526,7 +526,7 @@ function LinearSolver(problems::Problem...)
|
||||
end
|
||||
return solver
|
||||
end
|
||||
function LinearSolver(name::ASCIIString, problems::Problem...)
|
||||
function LinearSolver(name::String, problems::Problem...)
|
||||
solver = LinearSolver(problems...)
|
||||
solver.name = name
|
||||
return solver
|
||||
@@ -591,7 +591,7 @@ function Postprocessor(problems::Problem...)
|
||||
return solver
|
||||
end
|
||||
|
||||
function Postprocessor(name::ASCIIString, problems::Problem...)
|
||||
function Postprocessor(name::String, problems::Problem...)
|
||||
solver = Postprocessor(problems...)
|
||||
solver.name = name
|
||||
return solver
|
||||
|
||||
@@ -8,7 +8,7 @@ Examples
|
||||
julia> problems = get_problems()
|
||||
julia> solver = Solver(Modal)
|
||||
julia> push!(solver, problems...)
|
||||
julia> call(solver)
|
||||
julia> solver()
|
||||
|
||||
"""
|
||||
type Modal <: AbstractSolver
|
||||
|
||||
+5
-5
@@ -9,15 +9,15 @@ type Point{P<:AbstractPoint}
|
||||
id :: Int
|
||||
weight :: Float64
|
||||
coords :: Vector{Float64}
|
||||
fields :: Dict{ASCIIString, Field}
|
||||
fields :: Dict{String, Field}
|
||||
properties :: P
|
||||
end
|
||||
|
||||
function setindex!{T}(point::Point, val::Pair{Float64, T}, field_name::ASCIIString)
|
||||
function setindex!{T}(point::Point, val::Pair{Float64, T}, field_name::String)
|
||||
point.fields[field_name] = Field(val)
|
||||
end
|
||||
|
||||
function getindex(point::Point, field_name::ASCIIString)
|
||||
function getindex(point::Point, field_name::String)
|
||||
return point.fields[field_name]
|
||||
end
|
||||
|
||||
@@ -25,11 +25,11 @@ function getindex(point::Point, idx::Int)
|
||||
return point.coords[idx]
|
||||
end
|
||||
|
||||
function haskey(point::Point, field_name::ASCIIString)
|
||||
function haskey(point::Point, field_name::String)
|
||||
return haskey(point.fields, field_name)
|
||||
end
|
||||
|
||||
function call(point::Point, field_name::ASCIIString, time::Float64=0.0)
|
||||
function call(point::Point, field_name::String, time::Float64=0.0)
|
||||
point.fields[field_name](time).data
|
||||
end
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ end
|
||||
@testset "test all nodes in contact" begin
|
||||
# FIXME: needs verification of some other fem software
|
||||
solver = get_model("curved 2d contact small sliding")
|
||||
call(solver)
|
||||
solver()
|
||||
upper, lower, bc_upper, bc_lower, interface = solver.problems
|
||||
@test isapprox(norm(interface.assembly.u), 0.49563347601324315)
|
||||
end
|
||||
@@ -119,7 +119,7 @@ end
|
||||
|
||||
@testset "test frictionless hertz contact, 2d plane strain" begin
|
||||
solver = get_model("hertz contact, full 2d model")
|
||||
call(solver)
|
||||
solver()
|
||||
upper, lower, bc_fixed, bc_sym_23, load, contact = solver.problems
|
||||
slaves = get_slave_elements(contact)
|
||||
node_ids, la = get_nodal_vector(slaves, "reaction force", 0.0)
|
||||
|
||||
@@ -45,7 +45,7 @@ using JuliaFEM.Test
|
||||
solver = Solver(Nonlinear)
|
||||
push!(solver, upper, lower, bc_upper, bc_lower, contact)
|
||||
|
||||
call(solver)
|
||||
solver()
|
||||
for element in get_slave_elements(contact)
|
||||
normal = element("normal", [1/3, 1/3], solver.time)
|
||||
@test isapprox(normal, [0.0, 0.0, 1.0])
|
||||
|
||||
@@ -122,7 +122,7 @@ end
|
||||
update!(element, "geometry", X)
|
||||
update!(element, "displacement 1", 0.0)
|
||||
f(xi, time) = begin
|
||||
info("function call at xi = $xi, time = $time")
|
||||
info("function called at xi = $xi, time = $time")
|
||||
X = element("geometry", xi, time)
|
||||
info("geometry at xi, X = $X")
|
||||
val = X[1]*time
|
||||
|
||||
@@ -44,7 +44,7 @@ end
|
||||
|
||||
solver = get_model("test 2d linear elasticity with surface + volume load")
|
||||
block, bc_sym = solver.problems
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
f = 288.0
|
||||
g = 576.0
|
||||
@@ -86,7 +86,7 @@ end
|
||||
solver = get_model("test 2d linear elasticity with surface + volume load")
|
||||
save("/tmp/model.jld", "linear_model", solver)
|
||||
solver2 = load("/tmp/model.jld")["linear_model"]
|
||||
call(solver2)
|
||||
solver2()
|
||||
save("/tmp/model.jld", "results", solver2)
|
||||
solver3 = load("/tmp/model.jld")["results"]
|
||||
block = solver3["BLOCK"]
|
||||
|
||||
@@ -38,7 +38,7 @@ using JuliaFEM.Test
|
||||
|
||||
solver = NonlinearSolver("solve block problem")
|
||||
push!(solver, block, bc)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
# from code aster
|
||||
eps_expected = [-2.08333312468287E-01, 6.25000000000000E-01, 0.0]
|
||||
|
||||
@@ -34,7 +34,7 @@ using JuliaFEM.Test
|
||||
|
||||
solver = NonlinearSolver("solve block problem")
|
||||
push!(solver, block, bc_sym)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
# from code aster
|
||||
u3_expected = [-4.92316106779943E-01, 7.96321884292103E-01]
|
||||
|
||||
@@ -40,7 +40,7 @@ using JuliaFEM.Test
|
||||
push!(boundary_problem, symxy, symxz, symyz)
|
||||
|
||||
solver = LinearSolver(elasticity_problem, boundary_problem)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
disp = element1("displacement", [1.0, 1.0, 1.0], 0.0)
|
||||
info("displacement at tip: $disp")
|
||||
@@ -70,7 +70,7 @@ function solve_rod_model_elasticity(eltype)
|
||||
update!(p4, "displacement 2", 0.0)
|
||||
update!(p5, "displacement 3", 0.0)
|
||||
solver = LinearSolver(p1, p2, p3, p4, p5)
|
||||
call(solver)
|
||||
solver()
|
||||
u_max = maximum(p1.assembly.u)
|
||||
info("$eltype, u_max = $u_max")
|
||||
return u_max
|
||||
|
||||
@@ -41,7 +41,7 @@ using JuliaFEM.Test
|
||||
solver = NonlinearSolver("solve 3d block")
|
||||
push!(solver, elasticity_problem)
|
||||
push!(solver, boundary_problem)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
disp = element1("displacement", [1.0, 1.0, 1.0], 0.0)
|
||||
info("displacement at tip: $disp")
|
||||
|
||||
@@ -35,7 +35,7 @@ function calc_model(mesh_name; with_volume_load=false, debug_print=false)
|
||||
|
||||
solver = LinearSolver("Solver block problem")
|
||||
push!(solver, block, traction, bc)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
max_u = maximum(block.assembly.u)
|
||||
nu = round(Int, length(block.assembly.u)/3)
|
||||
|
||||
@@ -41,7 +41,7 @@ using JuliaFEM.Test
|
||||
|
||||
solver = Solver()
|
||||
push!(solver, body, bc)
|
||||
call(solver)
|
||||
solver()
|
||||
disp = element("displacement", [1.0, 1.0], 0.0)
|
||||
info("displacement at tip: $disp")
|
||||
# verified using Code Aster, verification/2015-10-22-plane-stress/cplan_grot_gdep_volume_force.resu
|
||||
|
||||
@@ -26,7 +26,7 @@ using JuliaFEM.Test
|
||||
push!(p2, e2)
|
||||
s = Solver(Linear)
|
||||
push!(s, p1, p2)
|
||||
call(s)
|
||||
s()
|
||||
u_4 = p1.assembly.u[10:end]
|
||||
u_expected = [-3.0/220.0, -9.0/220.0, 1.0/10.0]
|
||||
@test isapprox(u_4, u_expected)
|
||||
@@ -56,7 +56,7 @@ end
|
||||
push!(p2, e2)
|
||||
s = Solver(Linear)
|
||||
push!(s, p1, p2)
|
||||
call(s)
|
||||
s()
|
||||
u_4 = p1.assembly.u[10:end]
|
||||
u_expected = [-17.0/14.0, -27.0/14.0, 1.0]
|
||||
info("u_4 = $(u_4)")
|
||||
|
||||
+8
-8
@@ -22,7 +22,7 @@ using JuliaFEM.Postprocess
|
||||
info("# of elements in fixed set: $(length(fixed))")
|
||||
update!(fixed, "temperature 1", 0.0)
|
||||
solver = LinearSolver(prob, face, fixed)
|
||||
call(solver)
|
||||
solver()
|
||||
T = prob.assembly.u
|
||||
info("Solution: $T")
|
||||
T_expected = [ # using code aster
|
||||
@@ -94,7 +94,7 @@ end
|
||||
# T=1 on free boundary, u(x,y) = -1/6*(1/2*f*x^2 - f*x)
|
||||
# when boundary flux not active (at t=0)
|
||||
solver.time = 0.0
|
||||
call(solver)
|
||||
solver()
|
||||
# interpolate temperature at middle of element 2 (flux boundary) at time t=0:
|
||||
T = el2("temperature", [0.0], 0.0)
|
||||
@test isapprox(T[1], 1.0)
|
||||
@@ -103,7 +103,7 @@ end
|
||||
# u(x,y) = x which equals T=1 on boundary.
|
||||
# at time t=1.0 all loads should be on.
|
||||
solver.time = 1.0
|
||||
call(solver)
|
||||
solver()
|
||||
T = el2("temperature", [0.0], 1.0)
|
||||
@test isapprox(T[1], 2.0)
|
||||
end
|
||||
@@ -152,7 +152,7 @@ end
|
||||
push!(p2, e3)
|
||||
|
||||
solver = LinearSolver(p1, p2)
|
||||
call(solver)
|
||||
solver()
|
||||
T_min = minimum(p1.assembly.u)
|
||||
@test isapprox(T_max, T_acc(0.2); rtol=4.5e-2)
|
||||
end
|
||||
@@ -189,7 +189,7 @@ end
|
||||
update!(p2, "temperature 1", 100.0)
|
||||
|
||||
solver = LinearSolver(p1, p2)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
# fields extracted from Code Aster .resu file
|
||||
TEMP = Dict{Int64, Float64}(
|
||||
@@ -221,7 +221,7 @@ end
|
||||
8 => [1.74447696000717E+04, -4.72904678032179E+02, -1.75280965396335E+02])
|
||||
|
||||
postprocessor = Postprocessor(p1)
|
||||
flux = full(call(postprocessor))
|
||||
flux = full(postprocessor())
|
||||
fluxd = Dict{Int64, Vector{Float64}}()
|
||||
for j=1:8
|
||||
fluxd[j] = vec(flux[j,:])
|
||||
@@ -269,7 +269,7 @@ end
|
||||
update!(p1, "temperature heat transfer coefficient", 1000.0)
|
||||
update!(p2, "temperature 1", 100.0)
|
||||
solver = LinearSolver(p1, p2)
|
||||
call(solver)
|
||||
solver()
|
||||
T_min = minimum(p1.assembly.u)
|
||||
return T_min
|
||||
end
|
||||
@@ -317,7 +317,7 @@ end
|
||||
p2.elements = create_elements(mesh, "FACE1")
|
||||
update!(p2, "temperature 1", 100.0)
|
||||
solver = LinearSolver(p1, p2)
|
||||
call(solver)
|
||||
solver()
|
||||
return p1.assembly.u
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ using JuliaFEM.Test
|
||||
s1.properties.which = :LM
|
||||
push!(s1, p1, p2)
|
||||
|
||||
call(s1; debug=true)
|
||||
s1(; debug=true)
|
||||
@test isapprox(s1.properties.eigvals, [4/3, 1/3])
|
||||
|
||||
empty!(p1)
|
||||
@@ -44,7 +44,7 @@ using JuliaFEM.Test
|
||||
# p1.properties.finite_strain = true
|
||||
p1.properties.geometric_stiffness = true
|
||||
s1.properties.geometric_stiffness = true
|
||||
call(s1; debug=true)
|
||||
s1(; debug=true)
|
||||
@test isapprox(s1.properties.eigvals, [5/3, 2/3])
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ end
|
||||
|
||||
solver = Solver(Modal)
|
||||
push!(solver, p1, p2)
|
||||
call(solver)
|
||||
solver()
|
||||
@test isapprox(solver.properties.eigvals[1], 1.0)
|
||||
end
|
||||
|
||||
@@ -124,7 +124,7 @@ end
|
||||
push!(p4, el5, el6)
|
||||
solver = Solver(Modal)
|
||||
push!(solver, p1, p2, p3, p4)
|
||||
call(solver)
|
||||
solver()
|
||||
@test isapprox(solver.properties.eigvals[1], 1.0)
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -372,7 +372,7 @@ function test_3d_problem()
|
||||
push!(solver, tie)
|
||||
solver.nonlinear_problem = false
|
||||
solver.method = :UMFPACK
|
||||
call(solver, 0.0)
|
||||
solver()
|
||||
X = el2("geometry", [1.0, 1.0, 1.0], 0.0)
|
||||
u = el2("displacement", [1.0, 1.0, 1.0], 0.0)
|
||||
info("displacement at $X = $u")
|
||||
|
||||
@@ -100,7 +100,7 @@ end
|
||||
push!(bc3, sel1, mel1)
|
||||
|
||||
solver = LinearSolver(body1, body2, bc1, bc2, bc3)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
u = e2("displacement", [1.0, 1.0], 0.0)
|
||||
u_expected = [-1/3, 1.0]
|
||||
|
||||
@@ -73,7 +73,7 @@ end
|
||||
|
||||
@testset "test simple two element contact" begin
|
||||
solver = get_model("two element contact")
|
||||
call(solver)
|
||||
solver()
|
||||
contact = solver["LOWER_TO_UPPER"]
|
||||
master = first(contact.elements)
|
||||
slave = last(contact.elements)
|
||||
|
||||
@@ -49,7 +49,7 @@ end
|
||||
p4.properties.rotate_normals = false
|
||||
solver = Solver(Linear)
|
||||
push!(solver, p1, p2, p3, p4)
|
||||
call(solver)
|
||||
solver()
|
||||
el5 = p4.elements[1]
|
||||
u = el5("displacement", [0.0], 0.0)
|
||||
info("u = $u")
|
||||
@@ -86,7 +86,7 @@ end
|
||||
|
||||
solver = Solver(Linear)
|
||||
push!(solver, upper, lower, bc_upper, bc_lower, interface)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
interface_norm = norm(interface.assembly)
|
||||
# for bi-orthogonal:
|
||||
@@ -123,7 +123,7 @@ end
|
||||
solver = Solver(Nonlinear)
|
||||
solver.properties.linear_system_solver = :DirectLinearSolver_UMFPACK
|
||||
push!(solver, p1, p2, p3, p4)
|
||||
call(solver)
|
||||
solver()
|
||||
el5 = p4.elements[1]
|
||||
u = el5("displacement", [0.0], 0.0)
|
||||
info("u = $u")
|
||||
@@ -183,7 +183,7 @@ end
|
||||
@testset "test mesh tie with splitted block and plane stress elasticity" begin
|
||||
solver = get_model("splitted block, plane stress elasticity and mesh tie")
|
||||
upper, lower, bc_upper, bc_lower, interface = solver.problems
|
||||
call(solver)
|
||||
solver()
|
||||
slave_elements = get_slave_elements(interface)
|
||||
node_ids, la = get_nodal_vector(slave_elements, "reaction force", 0.0)
|
||||
for lai in la
|
||||
@@ -250,7 +250,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=0.0, rotate_normals=true,
|
||||
dual_basis=false)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test isapprox(norm(interface.assembly.u), 0.11339715157447851)
|
||||
end
|
||||
@@ -260,7 +260,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=0.0, rotate_normals=true,
|
||||
dual_basis=true)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test isapprox(norm(interface.assembly.u), 0.11660422877751599)
|
||||
end
|
||||
@@ -270,7 +270,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=-0.1, rotate_normals=true,
|
||||
dual_basis=false)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test isapprox(norm(interface.assembly.u), 0.34230262165505887)
|
||||
end
|
||||
@@ -280,7 +280,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=-0.1, rotate_normals=true,
|
||||
dual_basis=true)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test isapprox(norm(interface.assembly.u), 0.34318800698017704)
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ end
|
||||
adjust=false, tolerance=10, dy=-0.1, rotate_normals=true,
|
||||
dual_basis=true, use_forwarddiff=true, finite_strain=false,
|
||||
geometric_stiffness=false)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test isapprox(norm(interface.assembly.u), 0.11339715157447851)
|
||||
end
|
||||
@@ -86,7 +86,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=0.0, rotate_normals=true,
|
||||
dual_basis=true, use_forwarddiff=true)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test solver.properties.iteration == 2
|
||||
# differs -- why?
|
||||
@@ -98,7 +98,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=-0.1, rotate_normals=true,
|
||||
dual_basis=false, use_forwarddiff=true)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test solver.properties.iteration == 2
|
||||
@test isapprox(norm(interface.assembly.u), 0.34230262165505887)
|
||||
@@ -109,7 +109,7 @@ end
|
||||
solver = get_model("mesh tie with curved 2d block";
|
||||
adjust=true, tolerance=10, dy=-0.1, rotate_normals=true,
|
||||
dual_basis=true, use_forwarddiff=true)
|
||||
call(solver)
|
||||
solver()
|
||||
interface = solver["interface between upper and lower block"]
|
||||
@test solver.properties.iteration == 2
|
||||
@test isapprox(norm(interface.assembly.u), 0.34318800698017704)
|
||||
|
||||
@@ -32,7 +32,7 @@ using JuliaFEM.Test
|
||||
interface.elements = [interface_master_elements; interface_slave_elements]
|
||||
|
||||
solver = LinearSolver(upper, lower, bc_upper, bc_lower, interface)
|
||||
call(solver)
|
||||
solver()
|
||||
|
||||
node_ids, temperature = get_nodal_vector(interface.elements, "temperature", 0.0)
|
||||
T = [t[1] for t in temperature]
|
||||
|
||||
@@ -54,7 +54,7 @@ end
|
||||
update!(nodal_bc, "displacement 1", 0.5)
|
||||
update!(nodal_bc, "displacement 2", 0.0)
|
||||
push!(solver, nodal_bc)
|
||||
call(solver)
|
||||
solver()
|
||||
pel = nodal_bc.elements[1]
|
||||
la = pel("reaction force", [0.0], 0.0)
|
||||
info("reaction force: $la")
|
||||
@@ -76,7 +76,7 @@ end
|
||||
update!(point_load, "displacement traction force 1", 72.0)
|
||||
update!(point_load, "displacement traction force 2", 27.0)
|
||||
push!(solver["body"], point_load)
|
||||
call(solver)
|
||||
solver()
|
||||
@test isapprox(point_load("displacement", [], 0.0), [0.5, 0.0])
|
||||
end
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ end
|
||||
|
||||
@testset "test combining meshes" begin
|
||||
|
||||
mesh1 = Dict{ASCIIString, Any}(
|
||||
mesh1 = Dict{String, Any}(
|
||||
"nodes" => Dict{Int64, Vector{Float64}}(
|
||||
1 => [1.0, 2.0],
|
||||
2 => [2.0, 3.0]
|
||||
@@ -76,7 +76,7 @@ end
|
||||
),
|
||||
)
|
||||
|
||||
mesh2 = Dict{ASCIIString, Any}(
|
||||
mesh2 = Dict{String, Any}(
|
||||
"nodes" => Dict{Int64, Vector{Float64}}(
|
||||
1 => [3.0, 4.0],
|
||||
2 => [4.0, 5.0]
|
||||
|
||||
Reference in New Issue
Block a user