api tests

This commit is contained in:
Jukka Aho
2015-11-30 19:11:00 +02:00
parent 6b507c878a
commit f2325c25ab
+43
View File
@@ -0,0 +1,43 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
module APITests
using JuliaFEM
using JuliaFEM.Test
function test_basic()
# basic workflow, copied from test_solver.jl
model = Model("my calculation model")
# create nodes
n1 = Node(1, [0.0, 0.0])
n2 = Node(2, [1.0, 0.0])
n3 = Node(3, [1.0, 1.0])
n4 = Node(4, [0.0, 1.0])
# create elements
e1 = Element{Quad4}([n1, n2, n3, n4])
e2 = Element{Seg2}([n1, n2])
# material properties
material = Material("my material")
material["temperature thermal conductivity"] = 6.0
material["density"] = 36.0
# create element set body
body = ElementSet("body")
push!(body, e1, e2)
# add element set to model
add_element_set(model, body)
# assign material to elements in element set body
set_material(model, material, body)
# boundary conditions
end
end