mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-21 18:33:36 +00:00
postprocessing
This commit is contained in:
@@ -6,43 +6,42 @@ using JuliaFEM.Preprocess
|
||||
using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
function JuliaFEM.get_model(::Type{Val{Symbol("test 2d linear elasticity with surface + volume load")}})
|
||||
#=
|
||||
- solve 2d plane stress problem with known solution
|
||||
- test postprocessing of nodal fields: (geometry, displacement
|
||||
reaction force, concentrated force)
|
||||
=#
|
||||
@testset "test 2d linear elasticity with surface + volume load" begin
|
||||
meshfile = "/geometry/2d_block/BLOCK_1elem.med"
|
||||
mesh = aster_read_mesh(Pkg.dir("JuliaFEM")*meshfile)
|
||||
|
||||
# field problem
|
||||
block = Problem(Elasticity, "BLOCK", 2)
|
||||
block.properties.store_fields = ["stress", "strain"]
|
||||
block.properties.formulation = :plane_stress
|
||||
block.properties.finite_strain = false
|
||||
block.properties.geometric_stiffness = false
|
||||
|
||||
block.elements = create_elements(mesh, "BLOCK")
|
||||
update!(block.elements, "youngs modulus", 288.0)
|
||||
update!(block.elements, "poissons ratio", 1/3)
|
||||
update!(block.elements, "displacement load 2", 576.0)
|
||||
|
||||
traction = create_elements(mesh, "TOP")
|
||||
# traction
|
||||
traction = Problem(Elasticity, "BLOCK", 2)
|
||||
traction.properties.formulation = :plane_stress
|
||||
traction.properties.finite_strain = false
|
||||
traction.properties.geometric_stiffness = false
|
||||
traction.elements = create_elements(mesh, "TOP")
|
||||
update!(traction, "displacement traction force 2", 288.0)
|
||||
push!(block, traction...)
|
||||
|
||||
# boundary conditions
|
||||
bc_sym = Problem(Dirichlet, "symmetry bc", 2, "displacement")
|
||||
bc_elements_left = create_elements(mesh, "LEFT")
|
||||
bc_elements_bottom = create_elements(mesh, "BOTTOM")
|
||||
update!(bc_elements_left, "displacement 1", 0.0)
|
||||
update!(bc_elements_bottom, "displacement 2", 0.0)
|
||||
push!(bc_sym, bc_elements_left..., bc_elements_bottom...)
|
||||
bc_sym_23 = Problem(Dirichlet, "symmetry bc 23", 2, "displacement")
|
||||
bc_sym_23.elements = create_elements(mesh, "LEFT")
|
||||
update!(bc_sym_23, "displacement 1", 0.0)
|
||||
bc_sym_13 = Problem(Dirichlet, "symmetry bc 13", 2, "displacement")
|
||||
bc_sym_13.elements = create_elements(mesh, "BOTTOM")
|
||||
update!(bc_sym_13, "displacement 2", 0.0)
|
||||
|
||||
solver = LinearSolver("solve block problem")
|
||||
push!(solver, block, bc_sym)
|
||||
return solver
|
||||
end
|
||||
|
||||
@testset "test 2d linear elasticity with surface + volume load" begin
|
||||
|
||||
solver = get_model("test 2d linear elasticity with surface + volume load")
|
||||
block, bc_sym = solver.problems
|
||||
solver = LinearSolver(block, traction, bc_sym_23, bc_sym_13)
|
||||
solver()
|
||||
|
||||
f = 288.0
|
||||
@@ -51,11 +50,13 @@ end
|
||||
nu = 1/3
|
||||
u3_expected = f/E*[-nu, 1] + g/(2*E)*[-nu, 1]
|
||||
|
||||
results = block(DataFrame, "displacement", :U, 0.0)
|
||||
# fetch nodal results X + u and join them into one table using DataFrames
|
||||
X = block(DataFrame, "geometry", :COOR, 0.0)
|
||||
u = block(DataFrame, "displacement", :U, 0.0)
|
||||
results = join(X, u, on=:id, kind=:outer)
|
||||
println(results)
|
||||
|
||||
u3 = results[:N3, [:U1, :U2]]
|
||||
info("(u1,u2) at node 3")
|
||||
info(u3)
|
||||
@test isapprox(u3, u3_expected)
|
||||
|
||||
#=
|
||||
|
||||
Reference in New Issue
Block a user