mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-21 18:33:36 +00:00
new style concrete problem
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM.Core: Node, update!, Quad4, Seg2, PlaneStressLinearElasticityProblem,
|
||||
assemble, FieldProblem, BoundaryProblem, DirichletProblem,
|
||||
DirectSolver, DualBasis
|
||||
using JuliaFEM.Core: Node, update!, Quad4, Seg2, assemble, BoundaryProblem,
|
||||
Problem, Elasticity, Solver, Dirichlet
|
||||
|
||||
@testset "test 2d linear elasticity with surface load." begin
|
||||
|
||||
@@ -27,7 +26,8 @@ using JuliaFEM.Core: Node, update!, Quad4, Seg2, PlaneStressLinearElasticityProb
|
||||
update!(element1, "poissons ratio", nu)
|
||||
# update!(element2, "displacement traction force", [0.0, f])
|
||||
update!(element2, "displacement traction force", Vector{Float64}[[0.0, f], [0.0, f]])
|
||||
elasticity_problem = FieldProblem(PlaneStressLinearElasticityProblem, "block", 2)
|
||||
elasticity_problem = Problem(Elasticity, "block", 2)
|
||||
elasticity_problem.properties.plane_stress = true
|
||||
push!(elasticity_problem, element1, element2)
|
||||
|
||||
# dirichlet boundary condition, symmetry
|
||||
@@ -36,37 +36,15 @@ using JuliaFEM.Core: Node, update!, Quad4, Seg2, PlaneStressLinearElasticityProb
|
||||
update!([sym13, sym23], "geometry", nodes)
|
||||
update!(sym13, "displacement 2", 0.0)
|
||||
update!(sym23, "displacement 1", 0.0)
|
||||
#sym23["displacement 1"] = 0.0
|
||||
#sym13["displacement 2"] = 0.0
|
||||
# name, unknown field, unknown field dimension
|
||||
boundary_problem = BoundaryProblem(DirichletProblem, "symmetry boundaries", "displacement", 2)
|
||||
boundary_problem = BoundaryProblem(Dirichlet, "symmetry boundaries", "displacement", 2)
|
||||
push!(boundary_problem, sym13, sym23)
|
||||
|
||||
solver = DirectSolver("solve block problem")
|
||||
solver.solve_residual = false
|
||||
solver = Solver("solve block problem")
|
||||
push!(solver, elasticity_problem)
|
||||
push!(solver, boundary_problem)
|
||||
|
||||
#=
|
||||
add_linear_system_solver_posthook!(solver,
|
||||
function (solver)
|
||||
info("solution vector")
|
||||
dump(solver.x)
|
||||
end)
|
||||
=#
|
||||
|
||||
call(solver, 0.0)
|
||||
|
||||
#=
|
||||
free_dofs = Int64[3, 5, 6, 8]
|
||||
ass = assemble(problem, 0.0)
|
||||
f = full(ass.force_vector)
|
||||
K = full(ass.stiffness_matrix)
|
||||
u = zeros(2, 4)
|
||||
u[free_dofs] = K[free_dofs, free_dofs] \ f[free_dofs]
|
||||
info("result vector")
|
||||
dump(u)
|
||||
=#
|
||||
call(solver)
|
||||
|
||||
u_disp = element1("displacement", [1.0, 1.0], 0.0)
|
||||
info("Displacement = $u_disp")
|
||||
|
||||
Reference in New Issue
Block a user