mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-06 04:21:33 +00:00
1c67f1c1f8
* refactored code for solvers. * Added elementary tests for least-squares fitting of strain and stress fields * A more realistic postprocess + Xdmf writing test * removed debug keyword argument from test * Rewrite update_xdmf! New function to update Xdmf file no longer takes Solver object but xdmf, problem, time and fields to write, for example julia> update_xdmf!(xdmf, problem, 0.0, ["displacement", "temperature"]) All problems are written separately and put together into one SpatialCollection, allowing to have more structured Xdmf and making it easier to write complicated field configurations. Support for Xdmf API 3.0 added. * Support for Tensor6 field writing * moved update_xdmf! to io.jl * Removed some empty files * Not use old Postprocessor, obsolete code. * Not use old XDMF (obsolete code). Fixed test. * removed some postprocessing to pass test, maybe we should drop abaqus.jl from code as obsolete * add function get_temporal_collection back, it's used by update_xdmf of modal solver * postprocess of boundary problems also * added test for contact pressure. dl+quad test output was written in wrong file, fixed. * postprocess for contact pressure * contact pressure postprocess * with boundary problems always store also the primary unknown field * Change "reaction force" -> "lambda" * testing postprocess of reaction force also * sign convention
90 lines
2.9 KiB
Julia
90 lines
2.9 KiB
Julia
# This file is a part of JuliaFEM.
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
using JuliaFEM
|
|
using JuliaFEM.Testing
|
|
|
|
function get_model()
|
|
|
|
X = Dict{Int, Vector{Float64}}(
|
|
1 => [0.0, 0.0],
|
|
2 => [1.0, 0.0],
|
|
3 => [1.0, 1.0],
|
|
4 => [0.0, 1.0])
|
|
|
|
body = Problem(Elasticity, "body", 2)
|
|
body.properties.formulation = :plane_stress
|
|
body.elements = [Element(Quad4, [1, 2, 3, 4])]
|
|
update!(body.elements, "geometry", X)
|
|
update!(body.elements, "youngs modulus", 288.0)
|
|
update!(body.elements, "poissons ratio", 1/3)
|
|
|
|
# boundary conditions
|
|
bc_13 = Problem(Dirichlet, "symmetry 13", 2, "displacement")
|
|
bc_13.properties.dual_basis = true
|
|
bc_13.elements = [Element(Seg2, [1, 2])]
|
|
update!(bc_13.elements, "geometry", X)
|
|
update!(bc_13.elements, "displacement 2", 0.0)
|
|
|
|
bc_23 = Problem(Dirichlet, "symmetry 23", 2, "displacement")
|
|
bc_23.properties.dual_basis = true
|
|
bc_23.elements = [Element(Seg2, [4, 1])]
|
|
update!(bc_23.elements, "geometry", X)
|
|
update!(bc_23, "displacement 1", 0.0)
|
|
|
|
push!(bc_13.assembly.removed_dofs, 1, 2)
|
|
|
|
solver = Solver(Nonlinear, "1x1 plane stress quad4 block")
|
|
push!(solver, body, bc_13, bc_23)
|
|
|
|
return solver
|
|
end
|
|
|
|
@testset "test dirichlet spc in point" begin
|
|
X = Dict{Int, Vector{Float64}}(
|
|
1 => [0.0, 0.0],
|
|
2 => [1.0, 0.0],
|
|
3 => [1.0, 1.0],
|
|
4 => [0.0, 1.0])
|
|
solver = get_model()
|
|
update!(solver["symmetry 13"], "displacement 1", 0.0)
|
|
update!(solver["symmetry 23"], "displacement 2", 0.0)
|
|
nodal_bc = Problem(Dirichlet, "dx=0.5", 2, "displacement")
|
|
nodal_bc.elements = [Element(Poi1, [3])]
|
|
update!(nodal_bc, "geometry", X)
|
|
update!(nodal_bc, "displacement 1", 0.5)
|
|
update!(nodal_bc, "displacement 2", 0.0)
|
|
push!(solver, nodal_bc)
|
|
initialize!(solver["symmetry 13"])
|
|
initialize!(solver["symmetry 23"])
|
|
assemble!(solver["symmetry 13"])
|
|
assemble!(solver["symmetry 23"])
|
|
println(sparse(solver["symmetry 13"].assembly.C2))
|
|
println(sparse(solver["symmetry 23"].assembly.C2))
|
|
solver()
|
|
pel = nodal_bc.elements[1]
|
|
la = pel("lambda", [0.0], 0.0)
|
|
info("lambda: $la")
|
|
info(solver["body"].assembly.u)
|
|
@test isapprox(pel("displacement", [], 0.0), [0.5, 0.0])
|
|
end
|
|
|
|
@testset "test nodal point force" begin
|
|
X = Dict{Int, Vector{Float64}}(
|
|
1 => [0.0, 0.0],
|
|
2 => [1.0, 0.0],
|
|
3 => [1.0, 1.0],
|
|
4 => [0.0, 1.0])
|
|
solver = get_model()
|
|
update!(solver["symmetry 13"], "displacement 1", 0.0)
|
|
update!(solver["symmetry 23"], "displacement 2", 0.0)
|
|
point_load = Element(Poi1, [3])
|
|
update!(point_load, "geometry", X)
|
|
update!(point_load, "displacement traction force 1", 72.0)
|
|
update!(point_load, "displacement traction force 2", 27.0)
|
|
push!(solver["body"], point_load)
|
|
solver()
|
|
@test isapprox(point_load("displacement", [], 0.0), [0.5, 0.0])
|
|
end
|
|
|