mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-20 18:18:31 +00:00
2d mortar
This commit is contained in:
+17
-18
@@ -1,9 +1,11 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
# test SimpleSolver
|
||||
module SolverTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM
|
||||
|
||||
using FactCheck
|
||||
using JuliaFEM: DirichletProblem, Seg2, PlaneHeatProblem, Quad4, SimpleSolver, get_element, get_basis
|
||||
|
||||
""" Define Problem 1:
|
||||
@@ -13,25 +15,16 @@ using JuliaFEM: DirichletProblem, Seg2, PlaneHeatProblem, Quad4, SimpleSolver, g
|
||||
"""
|
||||
function get_heatproblem()
|
||||
el1 = Quad4([1, 2, 3, 4])
|
||||
# these might look like normal values but believe me, they
|
||||
# are fields with temporal and spatial dimension
|
||||
el1["geometry"] = Vector[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
|
||||
el1["temperature thermal conductivity"] = 6.0
|
||||
el1["density"] = 36.0
|
||||
|
||||
el2 = Seg2([1, 2])
|
||||
el2["geometry"] = Vector[[0.0, 0.0], [1.0, 0.0]]
|
||||
# Boundary load, linear ramp 0 -> 600 at time 0 -> 1
|
||||
# yet another simplification, if field is given as a tuple,
|
||||
# multiple fields are created. there is 1 second time step between
|
||||
# each field. So the following is basically same as
|
||||
# fieldset = FieldSet("temperature flux")
|
||||
# field1 = Field(0.0, 0.0)
|
||||
# field2 = Field(1.0, 600.0)
|
||||
# push!(fieldset, field1)
|
||||
# push!(fieldset, field2)
|
||||
# element["temperature flux"] = fieldset
|
||||
el2["temperature flux"] = (0.0, 600.0)
|
||||
el2["temperature flux"] = (
|
||||
(0.0 => 0.0),
|
||||
(1.0 => 600.0)
|
||||
)
|
||||
|
||||
problem1 = PlaneHeatProblem()
|
||||
push!(problem1, el1)
|
||||
@@ -50,13 +43,17 @@ function get_boundaryproblem()
|
||||
return problem2
|
||||
end
|
||||
|
||||
facts("test simplesolver") do
|
||||
function test_simplesolver()
|
||||
info("construct heat problem")
|
||||
problem1 = get_heatproblem()
|
||||
info("construct boundary problem")
|
||||
problem2 = get_boundaryproblem()
|
||||
# Create a solver for a set of problems
|
||||
info("create SimpleSolver with problems.")
|
||||
solver = SimpleSolver()
|
||||
push!(solver, problem1)
|
||||
push!(solver, problem2)
|
||||
info("solve!")
|
||||
# Solve problem at time t=1.0 and update fields
|
||||
call(solver, 1.0)
|
||||
# Postprocess.
|
||||
@@ -66,6 +63,8 @@ facts("test simplesolver") do
|
||||
basis = get_basis(el2)
|
||||
X = basis("geometry", xi, 1.0)
|
||||
T = basis("temperature", xi, 1.0)
|
||||
Logging.info("Temperature at point X = $X is T = $T")
|
||||
@fact T --> roughly(100.0)
|
||||
info("Temperature at point X = $X is T = $T")
|
||||
@test isapprox(mean(T), 100.0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user