mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-10 13:17:42 +00:00
Use @__DIR__ instead of Pkg.dir
this allows installing and loading the package from elsewhere
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
using Base.Test
|
||||
using TimerOutputs
|
||||
|
||||
pkg_dir = Pkg.dir("JuliaFEM")
|
||||
pkg_dir = dirname(@__DIR__)
|
||||
maybe_test_files = readdir(joinpath(pkg_dir, "test"))
|
||||
is_test_file(fn) = startswith(fn, "test_") & endswith(fn, ".jl")
|
||||
test_files = filter(is_test_file, maybe_test_files)
|
||||
|
||||
@@ -7,7 +7,7 @@ using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "2d curved block with frictionless finite sliding contact using forwarddiff" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/block_2d_curved.med"
|
||||
meshfile = @__DIR__() * "/testdata/block_2d_curved.med"
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(Elasticity, "upper", 2)
|
||||
|
||||
@@ -13,7 +13,7 @@ using JuliaFEM.Testing
|
||||
=#
|
||||
@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)
|
||||
mesh = aster_read_mesh(dirname(@__DIR__)*meshfile)
|
||||
|
||||
# field problem
|
||||
block = Problem(Elasticity, "BLOCK", 2)
|
||||
|
||||
@@ -7,7 +7,7 @@ using JuliaFEM.Testing
|
||||
|
||||
@testset "test 2d nonlinear elasticity with surface load" begin
|
||||
meshfile = "/geometry/2d_block/BLOCK_1elem.med"
|
||||
mesh = aster_read_mesh(Pkg.dir("JuliaFEM")*meshfile)
|
||||
mesh = aster_read_mesh(dirname(@__DIR__)*meshfile)
|
||||
|
||||
# field problem
|
||||
block = Problem(Elasticity, "BLOCK", 2)
|
||||
|
||||
@@ -49,7 +49,7 @@ using JuliaFEM.Testing
|
||||
end
|
||||
|
||||
function solve_rod_model_elasticity(eltype)
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rod_short.med"
|
||||
fn = @__DIR__() * "/testdata/rod_short.med"
|
||||
mesh = aster_read_mesh(fn, eltype)
|
||||
element_sets = join(keys(mesh.element_sets), ", ")
|
||||
info("element sets: $element_sets")
|
||||
|
||||
@@ -7,7 +7,7 @@ using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
function calc_model(mesh_name; with_volume_load=false, debug_print=false)
|
||||
meshfile = Pkg.dir("JuliaFEM")*"/test/testdata/3d_block.med"
|
||||
meshfile = @__DIR__()*"/testdata/3d_block.med"
|
||||
mesh = aster_read_mesh(meshfile, mesh_name)
|
||||
|
||||
block = Problem(Elasticity, "BLOCK", 3)
|
||||
|
||||
@@ -88,7 +88,7 @@ if a=0.9, b=1.0, ν=1/3, E = 24580 and p = 7317 equation yields
|
||||
http://mms2.ensmp.fr/emms_paris/plasticite3D/exercices/eSpherePress.pdf
|
||||
=#
|
||||
function test_wedge_sphere(model, u_CA, S_CA)
|
||||
mesh_file = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, model)
|
||||
body = Problem(Elasticity, "hollow sphere 1/8 model", 3)
|
||||
body.elements = create_elements(mesh, "HOLLOWSPHERE8")
|
||||
|
||||
@@ -6,7 +6,7 @@ using JuliaFEM.Preprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "test Pyr5 elasticity with point load" begin
|
||||
fn = Pkg.dir("JuliaFEM") * "/geometry/3d_pyr/Pyr5.med"
|
||||
fn = dirname(@__DIR__) * "/geometry/3d_pyr/Pyr5.med"
|
||||
mesh = aster_read_mesh(fn)
|
||||
element_sets = join(keys(mesh.element_sets), ", ")
|
||||
info("element sets: $element_sets")
|
||||
|
||||
@@ -8,7 +8,7 @@ using JuliaFEM.Testing
|
||||
|
||||
@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)
|
||||
mesh = aster_read_mesh(dirname(@__DIR__)*meshfile)
|
||||
|
||||
# field problem
|
||||
block = Problem(Elasticity, "BLOCK", 2)
|
||||
|
||||
@@ -62,7 +62,7 @@ using JuliaFEM.Testing
|
||||
#end
|
||||
|
||||
# function solve_rod_model_elasticity(eltype)
|
||||
# fn = Pkg.dir("JuliaFEM") * "/test/testdata/rod_short.med"
|
||||
# fn = @__DIR__() * "/testdata/rod_short.med"
|
||||
# mesh = aster_read_mesh(fn, eltype)
|
||||
# element_sets = join(keys(mesh.element_sets), ", ")
|
||||
# info("element sets: $element_sets")
|
||||
|
||||
+4
-4
@@ -8,7 +8,7 @@ using JuliaFEM.Postprocess
|
||||
|
||||
@testset "Tet10 + convection" begin
|
||||
# For some reason Tet10 fails, maybe because of convection.
|
||||
mesh_file = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, "TETRA_TET10_1")
|
||||
prob = Problem(Heat, "tet", 1)
|
||||
face = Problem(Heat, "face 4", 1)
|
||||
@@ -146,7 +146,7 @@ end
|
||||
=#
|
||||
|
||||
@testset "compare simple 3d heat problem to code aster solution" begin
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rod_short.med"
|
||||
fn = @__DIR__() * "/testdata/rod_short.med"
|
||||
mesh = aster_read_mesh(fn, "Hex8")
|
||||
element_sets = join(keys(mesh.element_sets), ", ")
|
||||
info("element sets: $element_sets")
|
||||
@@ -221,7 +221,7 @@ end
|
||||
|
||||
@testset "compare simple 3d heat problem to analytical solution" begin
|
||||
function calc_3d_heat_model(mesh_name)
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rod_short.med"
|
||||
fn = @__DIR__() * "/testdata/rod_short.med"
|
||||
mesh = aster_read_mesh(fn, mesh_name)
|
||||
p1 = Problem(Heat, "rod", 1)
|
||||
p2 = Problem(Dirichlet, "left support T=100", 1, "temperature")
|
||||
@@ -248,7 +248,7 @@ end
|
||||
@testset "compare simple 3d heat problem to code aster solution" begin
|
||||
|
||||
function calc_3d_heat_model(mesh_name)
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rod_short.med"
|
||||
fn = @__DIR__() * "/testdata/rod_short.med"
|
||||
mesh = aster_read_mesh(fn, mesh_name)
|
||||
element_sets = join(keys(mesh.element_sets), ", ")
|
||||
info("element sets: $element_sets")
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "3d rod" begin
|
||||
mesh = aster_read_mesh(Pkg.dir("JuliaFEM")*"/test/testdata/primitives.med", "CYLINDER_20_TET4")
|
||||
mesh = aster_read_mesh(@__DIR__()*"/testdata/primitives.med", "CYLINDER_20_TET4")
|
||||
problem = Problem(Heat, "rod of length 20", 1)
|
||||
problem.elements = create_elements(mesh, "CYLINDER")
|
||||
update!(problem, "temperature thermal conductivity", 200.0)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ using JuliaFEM.Testing
|
||||
# from FENiCS tutorial, u(x,y) = 1 + x² + 2y² on [0x1]×[0,1]
|
||||
# and u₀(x,y) = 1 + x² + 2y², f(x,y) = -6
|
||||
|
||||
mesh_file = Pkg.dir("JuliaFEM")*"/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__()*"/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, "UNITSQUARE_6X4")
|
||||
|
||||
field = Problem(Heat, "unit square, 6x4 triangular mesh", 1)
|
||||
|
||||
@@ -13,7 +13,7 @@ inner ring and T=2.0 for outer ring, measure temperature from middle of ring.
|
||||
Results are calculated using Code Aster for comparison.
|
||||
=#
|
||||
@testset "test 3d heat, two rings, and compare to CA solution" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "RINGS_UNION")
|
||||
|
||||
rings = Problem(Heat, "RINGS", 1)
|
||||
@@ -33,7 +33,7 @@ Results are calculated using Code Aster for comparison.
|
||||
|
||||
temp_jf = rings("temperature", 0.0)
|
||||
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rings.rmed"
|
||||
fn = @__DIR__() * "/testdata/rings.rmed"
|
||||
results = RMEDFile(fn)
|
||||
nodes = aster_read_nodes(results)
|
||||
temp_ca = aster_read_data(results, "TEMP")
|
||||
|
||||
@@ -8,7 +8,7 @@ using JuliaFEM.Testing
|
||||
|
||||
#= this has nothing to do here
|
||||
@testset "calculate cross-sectional properties" begin
|
||||
mesh_file = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, "CYLINDER_20_TET4")
|
||||
# calculate cross-sectional properties A and Iₓ
|
||||
fixed1 = Problem(Dirichlet, "left support", 3, "displacement")
|
||||
@@ -65,7 +65,7 @@ numéro fréquence (HZ) norme d'erreur
|
||||
=#
|
||||
|
||||
@testset "long rod natural frequencies" begin
|
||||
mesh_file = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, "CYLINDER_20_TET10")
|
||||
# for (id, coords) in mesh.nodes
|
||||
# mesh.nodes[id][1] *= 5.0
|
||||
@@ -179,7 +179,7 @@ numéro fréquence (HZ) norme d'erreur
|
||||
end
|
||||
|
||||
@testset "eigenvalues of cube (tet4)" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "CUBE_TET4")
|
||||
cube = Problem(mesh, Elasticity, "CUBE", 3)
|
||||
update!(cube.elements, "youngs modulus", 10000.0)
|
||||
|
||||
@@ -7,7 +7,7 @@ using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "eigenvalues of CYLINDER1" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "CYLINDER_1_TET4")
|
||||
cylinder = Problem(mesh, Elasticity, "CYLINDER", 3)
|
||||
update!(cylinder.elements, "youngs modulus", 10000.0)
|
||||
@@ -35,7 +35,7 @@ using JuliaFEM.Testing
|
||||
end
|
||||
|
||||
@testset "eigenvalues of CYLINDER20" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "CYLINDER_20_TET4")
|
||||
cylinder = Problem(mesh, Elasticity, "CYLINDER", 3)
|
||||
#update!(cylinder.elements, "youngs modulus", 10.0e6)
|
||||
|
||||
@@ -7,7 +7,7 @@ using JuliaFEM.Postprocess
|
||||
using JuliaFEM.Testing
|
||||
|
||||
@testset "zero eigenmode model" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "TETRA_TET10_1")
|
||||
model = Problem(mesh, Elasticity, "TET", 3)
|
||||
update!(model.elements, "youngs modulus", 10.0)
|
||||
|
||||
@@ -57,7 +57,7 @@ end
|
||||
end
|
||||
|
||||
@testset "test that interface transfers constant field without error" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/block_2d.med"
|
||||
meshfile = @__DIR__() * "/testdata/block_2d.med"
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(Heat, "upper", 1)
|
||||
@@ -132,7 +132,7 @@ end
|
||||
=#
|
||||
|
||||
@testset "test mesh tie with splitted block and plane stress elasticity" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/block_2d.med"
|
||||
meshfile = @__DIR__() * "/testdata/block_2d.med"
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(Elasticity, "upper", 2)
|
||||
|
||||
@@ -11,7 +11,7 @@ function get_model(::Type{Val{Symbol("mesh tie with curved 2d block")}};
|
||||
dual_basis=false, use_forwarddiff=true, finite_strain=false,
|
||||
geometric_stiffness=false)
|
||||
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/block_2d_curved.med"
|
||||
meshfile = @__DIR__() * "/testdata/block_2d_curved.med"
|
||||
mesh = aster_read_mesh(meshfile)
|
||||
|
||||
upper = Problem(Elasticity, "upper", 2)
|
||||
|
||||
@@ -122,7 +122,7 @@ FIN()
|
||||
|
||||
@testset "splitted rod with tie contact" begin
|
||||
# CYLINDER_20_1_FACE1 -- CYLINDER_20_1_FACE2 -- CYLINDER_20_2_FACE_1 -- CYLINDER_20_2_FACE_2
|
||||
mesh_file = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
mesh_file = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(mesh_file, "CYLINDER_20_SPLITTED")
|
||||
body1 = Problem(mesh, Elasticity, "CYLINDER_20_1", 3)
|
||||
body2 = Problem(mesh, Elasticity, "CYLINDER_20_2", 3)
|
||||
|
||||
@@ -16,7 +16,7 @@ surface of outer ring. We should expect constant temperature in contact surface.
|
||||
This is conforming mesh so result should match to the conforming situation.
|
||||
=#
|
||||
@testset "test that curved interface transfers constant field without error, two rings problem" begin
|
||||
meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med"
|
||||
meshfile = @__DIR__() * "/testdata/primitives.med"
|
||||
mesh = aster_read_mesh(meshfile, "RINGS")
|
||||
|
||||
ring1 = Problem(Heat, "RING1", 1)
|
||||
@@ -44,7 +44,7 @@ This is conforming mesh so result should match to the conforming situation.
|
||||
solver = LinearSolver(ring1, ring2, bc_inner, bc_outer, interface)
|
||||
solver()
|
||||
|
||||
fn = Pkg.dir("JuliaFEM") * "/test/testdata/rings.rmed"
|
||||
fn = @__DIR__() * "/testdata/rings.rmed"
|
||||
results = RMEDFile(fn)
|
||||
nodes = aster_read_nodes(results)
|
||||
temp_ca = aster_read_data(results, "TEMP")
|
||||
|
||||
Reference in New Issue
Block a user