mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-17 01:02:13 +00:00
changed LoadCase => Simulation
This commit is contained in:
@@ -47,6 +47,7 @@ function parse_section(model, lines, key::Symbol, idx_start,
|
||||
has_set_def = match(r"NSET=([\w\_\-]+)", definition)
|
||||
if has_set_def != nothing
|
||||
set_name = has_set_def[1]
|
||||
info("Creating nset $set_name")
|
||||
model["nsets"][set_name] = ids
|
||||
end
|
||||
end
|
||||
@@ -109,6 +110,7 @@ function parse_section(model, lines, key, idx_start, idx_end, ::Type{Val{:ELEMEN
|
||||
has_set_def = match(r"ELSET=([\w\_\-]+)", definition)
|
||||
if has_set_def != nothing
|
||||
set_name = has_set_def[1]
|
||||
info("Creating elset $set_name")
|
||||
model["elsets"][set_name] = ids
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
function add_boundary_condition!(case::LoadCase, bc::NeumannBC)
|
||||
function add_boundary_condition!(case::Simulation, bc::NeumannBC)
|
||||
push!(case.neumann_boundary_conditions, bc)
|
||||
end
|
||||
|
||||
@@ -12,11 +12,11 @@ function add_node!(model::Model, index::Union{Int64, ASCIIString},
|
||||
end
|
||||
|
||||
|
||||
function add_boundary_condition!(case::LoadCase, bc::DirichletBC)
|
||||
function add_boundary_condition!(case::Simulation, bc::DirichletBC)
|
||||
push!(case.dirichlet_boundary_conditions, bc)
|
||||
end
|
||||
|
||||
function add_solver!(case::LoadCase, solver)
|
||||
function add_solver!(case::Simulation, solver)
|
||||
case.solver = solver
|
||||
end
|
||||
|
||||
@@ -58,11 +58,11 @@ function add_element_set!(model::Model, name::ASCIIString,
|
||||
model.elsets[name] = elset
|
||||
end
|
||||
|
||||
function add_element_set!(case::LoadCase, name::ASCIIString)
|
||||
function add_element_set!(case::Simulation, name::ASCIIString)
|
||||
push!(case.sets, name)
|
||||
end
|
||||
|
||||
function add_load_case!(model::Model, name::ASCIIString, case::LoadCase)
|
||||
function add_simulation!(model::Model, name::ASCIIString, case::Simulation)
|
||||
model.load_cases[name] = case
|
||||
end
|
||||
#function Base.convert{T<:AbstractFloat}(::Type{Node}, data::Vector{T})
|
||||
@@ -82,19 +82,19 @@ end
|
||||
# dublicate set names.")
|
||||
#end
|
||||
#
|
||||
#function add_boundary_condition!{B <: BoundaryCondition}(case::LoadCase, bc::B)
|
||||
#function add_boundary_condition!{B <: BoundaryCondition}(case::Simulation, bc::B)
|
||||
# push!(case.boundary_conditions, bc)
|
||||
#end
|
||||
#
|
||||
#function add_boundary_condition!{B <: BoundaryCondition}(case::LoadCase, bc::Vector{B})
|
||||
#function add_boundary_condition!{B <: BoundaryCondition}(case::Simulation, bc::Vector{B})
|
||||
# map(x-> push!(case.boundary_conditions, x), bc)
|
||||
#end
|
||||
#
|
||||
#function add_loadcase!(model::Model, case::LoadCase)
|
||||
#function add_loadcase!(model::Model, case::Simulation)
|
||||
# push!(model.load_cases, case)
|
||||
#end
|
||||
#
|
||||
#function add_loadcase!{T<:LoadCase}(model::Model, case::Vector{T})
|
||||
#function add_loadcase!{T<:Simulation}(model::Model, case::Vector{T})
|
||||
# map(x-> push!(model.load_cases, x), case)
|
||||
#end
|
||||
#
|
||||
|
||||
+5
-5
@@ -68,9 +68,9 @@ ElementSet(name::ASCIIString, ids::Vector{Int64}) =
|
||||
ElementSet(name, ids, Material())
|
||||
|
||||
"""
|
||||
LoadCase
|
||||
Simulation
|
||||
"""
|
||||
type LoadCase
|
||||
type Simulation
|
||||
problem :: Symbol
|
||||
neumann_boundary_conditions :: Vector{NeumannBC}
|
||||
dirichlet_boundary_conditions :: Vector{DirichletBC}
|
||||
@@ -78,7 +78,7 @@ type LoadCase
|
||||
sets :: Vector{ASCIIString}
|
||||
end
|
||||
|
||||
LoadCase(a) = LoadCase(a, NeumannBC[], DirichletBC[], nothing, ASCIIString[])
|
||||
Simulation(a) = Simulation(a, NeumannBC[], DirichletBC[], nothing, ASCIIString[])
|
||||
|
||||
|
||||
"""
|
||||
@@ -92,7 +92,7 @@ type Model
|
||||
elements :: Dict{Union{ASCIIString, Int64}, Element}
|
||||
elsets :: Dict{ASCIIString, ElementSet}
|
||||
nsets :: Dict{ASCIIString, NodeSet}
|
||||
load_cases :: Dict{ASCIIString, LoadCase}
|
||||
load_cases :: Dict{ASCIIString, Simulation}
|
||||
#settings :: Dict{AbstractString, Real}
|
||||
end
|
||||
|
||||
@@ -133,7 +133,7 @@ Model(name::ASCIIString) = Model(
|
||||
Dict{Union{Int64, ASCIIString}, Element}(),
|
||||
Dict{ASCIIString, NodeSet}(),
|
||||
Dict{ASCIIString, ElementSet}(),
|
||||
Dict{ASCIIString, LoadCase}(),
|
||||
Dict{ASCIIString, Simulation}(),
|
||||
)
|
||||
|
||||
function Base.setindex!(dict::Dict{Union{ASCIIString, Int64}, Node},
|
||||
|
||||
+9
-6
@@ -71,12 +71,15 @@ function get_solver(model::Model, case_name::ASCIIString, time::Float64)
|
||||
end
|
||||
|
||||
# Creating the solver
|
||||
#solver = JuliaFEM.Core.(case.solver)(field_problem, dirile_arr...)
|
||||
solver = JuliaFEM.Core.(case.solver)()
|
||||
push!(solver, field_problem)
|
||||
for d in dirile_arr
|
||||
push!(solver, d)
|
||||
end
|
||||
if case.solver == :LinearSolver
|
||||
solver = JuliaFEM.Core.(case.solver)(field_problem, dirile_arr...)
|
||||
else
|
||||
solver = JuliaFEM.Core.(case.solver)()
|
||||
push!(solver, field_problem)
|
||||
for d in dirile_arr
|
||||
push!(solver, d)
|
||||
end
|
||||
end
|
||||
return solver
|
||||
end
|
||||
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ module APITests
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM.Preprocess: parse_abaqus
|
||||
using JuliaFEM.API: Model, Element, ElementSet, Material, LoadCase,
|
||||
using JuliaFEM.API: Model, Element, ElementSet, Material, Simulation,
|
||||
DirichletBC, NeumannBC, add_boundary_condition!, add_solver!, add_material!,
|
||||
add_node!, add_element!, add_element_set!, add_load_case!
|
||||
using JuliaFEM.Interfaces: solve!
|
||||
@@ -45,7 +45,7 @@ function test_basic()
|
||||
add_material!(model, "set_material", material)
|
||||
|
||||
# Create problem
|
||||
field_problem = LoadCase(:HeatProblem)
|
||||
field_problem = Simulation(:HeatProblem)
|
||||
add_element_set!(field_problem, "body") # is this necessary?
|
||||
|
||||
# boundary conditions
|
||||
@@ -93,6 +93,6 @@ end
|
||||
# @test length(keys(model.nodes)) == 107168
|
||||
#end
|
||||
|
||||
#test_piston_107168()
|
||||
test_basic()
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user