mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-28 20:46:58 +00:00
separated to submodules
This commit is contained in:
@@ -3,10 +3,9 @@
|
||||
|
||||
module AssemblyTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM: Seg2, Quad4, HeatProblem, DirichletProblem, assemble
|
||||
using JuliaFEM: condensate, reconstruct!
|
||||
using JuliaFEM.Core: Seg2, Quad4, HeatProblem, DirichletProblem, assemble
|
||||
using JuliaFEM.Core: condensate, reconstruct!
|
||||
|
||||
function test_static_condensation()
|
||||
nodes = Vector[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
module AsterReaderTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: parse
|
||||
|
||||
function test_read_mesh()
|
||||
mesh = """
|
||||
COOR_2D
|
||||
N1 0.0 0.0
|
||||
N2 1.0 0.0
|
||||
N3 1.0 1.0
|
||||
N4 0.0 1.0
|
||||
FINSF
|
||||
|
||||
QUAD4
|
||||
E1 N1 N2 N3 N4
|
||||
FINSF
|
||||
|
||||
SEG2
|
||||
E2 N3 N4
|
||||
FINSF
|
||||
|
||||
GROUP_NO NOM=NALL
|
||||
N1 N2
|
||||
FINSF
|
||||
|
||||
GROUP_MA NOM=BODY1
|
||||
E1 E2
|
||||
FINSF
|
||||
|
||||
FIN
|
||||
"""
|
||||
|
||||
m = parse(mesh, Val{:CODE_ASTER_MAIL})
|
||||
@test m["nodes"]["N1"] == [0.0, 0.0]
|
||||
@test m["elements"]["E1"] == ["QUAD4", ["N1", "N2", "N3", "N4"]]
|
||||
@test m["elements"]["E2"] == ["SEG2", ["N3", "N4"]]
|
||||
@test m["elsets"]["BODY1"] == ["E1", "E2"]
|
||||
@test m["nsets"]["NALL"] == ["N1", "N2"]
|
||||
|
||||
end
|
||||
|
||||
test_read_mesh()
|
||||
|
||||
end
|
||||
+2
-5
@@ -4,11 +4,8 @@
|
||||
module BasisTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM: AbstractElement, Element
|
||||
|
||||
import JuliaFEM: get_basis, get_dbasis
|
||||
using JuliaFEM.Core: AbstractElement, Element
|
||||
import JuliaFEM.Core: get_basis, get_dbasis
|
||||
|
||||
abstract TestElement <: AbstractElement
|
||||
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
module DirectSolverTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM
|
||||
|
||||
using JuliaFEM: Seg2, Quad4
|
||||
using JuliaFEM: PlaneStressElasticityProblem, DirichletProblem
|
||||
using JuliaFEM: DirectSolver
|
||||
using JuliaFEM.Core: Seg2, Quad4
|
||||
using JuliaFEM.Core: PlaneStressElasticityProblem, DirichletProblem
|
||||
using JuliaFEM.Core: DirectSolver
|
||||
|
||||
function test_solver_multiple_dirichlet_bc()
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
module TestDirichletBoundaryCondition
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM
|
||||
using JuliaFEM: Seg2, DirichletProblem, Assembly, assemble
|
||||
using JuliaFEM.Core: Seg2, DirichletProblem, Assembly, assemble
|
||||
|
||||
function test_dirichlet_problem_1_dim()
|
||||
element = Seg2([1, 2])
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
module ElasticityTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM: Seg2, Quad4, PlaneStressElasticityProblem, solve!
|
||||
using JuliaFEM.Core: Seg2, Quad4, PlaneStressElasticityProblem, solve!
|
||||
|
||||
function test_elasticity_volume_load()
|
||||
element = Quad4([1, 2, 3, 4])
|
||||
|
||||
@@ -5,8 +5,8 @@ module ElementTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: AbstractElement, Element, Field, FieldSet, test_element
|
||||
import JuliaFEM: get_basis, get_dbasis
|
||||
using JuliaFEM.Core: AbstractElement, Element, Field, FieldSet, test_element
|
||||
import JuliaFEM.Core: get_basis, get_dbasis
|
||||
import Base: size
|
||||
|
||||
""" Prototype element
|
||||
|
||||
+1
-2
@@ -4,10 +4,9 @@
|
||||
|
||||
module FieldTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: Field
|
||||
using JuliaFEM.Core: Field
|
||||
|
||||
function test_create_field()
|
||||
f = Field(1.0)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
module AssemblyTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM: Quad4, Seg2, FieldSet, Field, HeatProblem
|
||||
using JuliaFEM: Assembly, assemble!
|
||||
using JuliaFEM.Core: Quad4, Seg2, FieldSet, Field, HeatProblem
|
||||
using JuliaFEM.Core: Assembly, assemble!
|
||||
|
||||
"""assemble a simple two element problem and solve"""
|
||||
function test_assembly()
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ module HeatTests # always wrap tests to module ending with "Tests"
|
||||
|
||||
using JuliaFEM.Test # always use JuliaFEM.Test, not Base.Test
|
||||
|
||||
using JuliaFEM: Seg2, Quad4, HeatProblem, assemble
|
||||
using JuliaFEM.Core: Seg2, Quad4, HeatProblem, assemble
|
||||
|
||||
function test_one_element() # always start test function with name test_
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
using FactCheck
|
||||
using Logging
|
||||
@Logging.configure(level=DEBUG)
|
||||
module InterfaceTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
|
||||
function test_foo()
|
||||
@test 1+2 == 3
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
module MathTests
|
||||
using JuliaFEM.Test
|
||||
|
||||
function test_math()
|
||||
@test 1+1 == 2
|
||||
end
|
||||
|
||||
#using JuliaFEM: interpolate
|
||||
#=
|
||||
facts("test interpolation of different field variables") do
|
||||
N(xi) = [
|
||||
(1-xi[1])*(1-xi[2])/4
|
||||
(1+xi[1])*(1-xi[2])/4
|
||||
(1+xi[1])*(1+xi[2])/4
|
||||
(1-xi[1])*(1+xi[2])/4
|
||||
]
|
||||
dNdξ(ξ) = [-(1-ξ[2])/4.0 -(1-ξ[1])/4.0
|
||||
(1-ξ[2])/4.0 -(1+ξ[1])/4.0
|
||||
(1+ξ[2])/4.0 (1+ξ[1])/4.0
|
||||
-(1+ξ[2])/4.0 (1-ξ[1])/4.0]
|
||||
F1 = [36.0, 36.0, 36.0, 36.0]
|
||||
F2 = [36.0 36.0 36.0 36.0]
|
||||
F3 = F2'
|
||||
F4 = [0.0 0.0; 10.0 0.0; 10.0 1.0; 0.0 1.0]'
|
||||
F5 = F4'
|
||||
F6 = [36, 36, 36, 36]
|
||||
|
||||
@fact interpolate(F1, N, [0.0, 0.0]) --> 36.0
|
||||
@fact interpolate(F2, N, [0.0, 0.0]) --> 36.0
|
||||
@fact interpolate(F3, N, [0.0, 0.0]) --> 36.0
|
||||
@fact interpolate(F4, N, [0.0, 0.0]) --> [5.0; 0.5]
|
||||
@fact interpolate(F5, N, [0.0, 0.0]) --> [5.0; 0.5]
|
||||
@fact interpolate(F5, dNdξ, [0.0, 0.0]) --> [5.0 0.0; 0.0 0.5]
|
||||
@fact interpolate(F6, N, [0.0, 0.0]) --> 36
|
||||
end
|
||||
=#
|
||||
|
||||
end
|
||||
+3
-4
@@ -3,12 +3,11 @@
|
||||
|
||||
module MortarTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: Element, Seg2, Quad4, MortarProblem, Assembly, assemble!
|
||||
using JuliaFEM: PlaneStressElasticityProblem, DirichletProblem, DirectSolver
|
||||
using JuliaFEM: project_from_slave_to_master, project_from_master_to_slave
|
||||
using JuliaFEM.Core: Element, Seg2, Quad4, MortarProblem, Assembly, assemble!
|
||||
using JuliaFEM.Core: PlaneStressElasticityProblem, DirichletProblem, DirectSolver
|
||||
using JuliaFEM.Core: project_from_slave_to_master, project_from_master_to_slave
|
||||
|
||||
function get_test_2d_model()
|
||||
# this is hand calculated and given as an example in my thesis
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
|
||||
module ElementTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: AbstractProblem, Problem
|
||||
using JuliaFEM: Element, Seg2, Quad4
|
||||
using JuliaFEM: IntegrationPoint, solve!
|
||||
using JuliaFEM.Core: AbstractProblem, Problem
|
||||
using JuliaFEM.Core: Element, Seg2, Quad4
|
||||
using JuliaFEM.Core: IntegrationPoint, solve!
|
||||
|
||||
import JuliaFEM.Core: get_unknown_field_name, get_unknown_field_type, get_potential_energy
|
||||
|
||||
abstract HeatProblem <: AbstractProblem
|
||||
|
||||
@@ -16,16 +17,16 @@ function HeatProblem(dim::Int=1, elements=[])
|
||||
return Problem{HeatProblem}(dim, elements)
|
||||
end
|
||||
|
||||
function JuliaFEM.get_unknown_field_name{P<:HeatProblem}(::Type{P})
|
||||
function get_unknown_field_name{P<:HeatProblem}(::Type{P})
|
||||
return "temperature"
|
||||
end
|
||||
|
||||
function JuliaFEM.get_unknown_field_type{P<:HeatProblem}(::Type{P})
|
||||
function get_unknown_field_type{P<:HeatProblem}(::Type{P})
|
||||
return Float64
|
||||
end
|
||||
|
||||
""" Calculate a potential Π = Wint - Wext of system. """
|
||||
function JuliaFEM.get_potential_energy(problem::Problem{HeatProblem}, element::Element{Quad4}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
function get_potential_energy(problem::Problem{HeatProblem}, element::Element{Quad4}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
k = element("temperature thermal conductivity", ip, time)
|
||||
f = element("temperature load", ip, time)
|
||||
T = element("temperature", ip, time, variation)
|
||||
@@ -36,7 +37,7 @@ function JuliaFEM.get_potential_energy(problem::Problem{HeatProblem}, element::E
|
||||
return Wint - Wext
|
||||
end
|
||||
|
||||
function JuliaFEM.get_potential_energy(problem::Problem{HeatProblem}, element::Element{Seg2}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
function get_potential_energy(problem::Problem{HeatProblem}, element::Element{Seg2}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
T = element("temperature", ip, time, variation)[1]
|
||||
T_ext = element("temperature external", ip, time)[1]
|
||||
coeff = element("temperature coefficient", ip, time)[1]
|
||||
|
||||
+3
-4
@@ -4,11 +4,10 @@
|
||||
module SolverTests
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM
|
||||
|
||||
using JuliaFEM: Seg2, Quad4
|
||||
using JuliaFEM: DirichletProblem, HeatProblem
|
||||
using JuliaFEM: LinearSolver
|
||||
using JuliaFEM.Core: Seg2, Quad4
|
||||
using JuliaFEM.Core: DirichletProblem, HeatProblem
|
||||
using JuliaFEM.Core: LinearSolver
|
||||
|
||||
function test_linearsolver()
|
||||
el1 = Quad4([1, 2, 3, 4])
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
|
||||
module SymbolicFieldTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM: Basis, Field, FieldSet, Expression, diff, grad
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM.Core: Basis, Field, FieldSet, Expression, diff, grad
|
||||
|
||||
|
||||
function get_basis()
|
||||
basis(xi) = 1/4*[
|
||||
|
||||
+1
-2
@@ -3,10 +3,9 @@
|
||||
|
||||
module TypesTests
|
||||
|
||||
using JuliaFEM
|
||||
using JuliaFEM.Test
|
||||
|
||||
using JuliaFEM: Field, FieldSet
|
||||
using JuliaFEM.Core: Field, FieldSet
|
||||
|
||||
function test_foo()
|
||||
@test 1+1 == 2
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
module TestAutoDiffWeakForm
|
||||
|
||||
using JuliaFEM.Test
|
||||
using JuliaFEM
|
||||
|
||||
using JuliaFEM: Problem, AbstractProblem, CG, Element, IntegrationPoint, Quad4, solve!
|
||||
using JuliaFEM.Core: Problem, AbstractProblem, CG, Element, IntegrationPoint, Quad4, solve!
|
||||
import JuliaFEM.Core: get_unknown_field_name, get_unknown_field_type, get_residual_vector
|
||||
|
||||
abstract PlaneStressElasticityProblem <: AbstractProblem
|
||||
|
||||
@@ -14,15 +14,15 @@ function PlaneStressElasticityProblem(dim::Int=2, elements=[])
|
||||
return Problem{PlaneStressElasticityProblem}(dim, elements)
|
||||
end
|
||||
|
||||
function JuliaFEM.get_unknown_field_name{P<:PlaneStressElasticityProblem}(::Type{P})
|
||||
function get_unknown_field_name{P<:PlaneStressElasticityProblem}(::Type{P})
|
||||
return "displacement"
|
||||
end
|
||||
|
||||
function JuliaFEM.get_unknown_field_type{P<:PlaneStressElasticityProblem}(::Type{P})
|
||||
function get_unknown_field_type{P<:PlaneStressElasticityProblem}(::Type{P})
|
||||
return Vector{Float64}
|
||||
end
|
||||
|
||||
function JuliaFEM.get_residual_vector{EL<:CG}(problem::Problem{PlaneStressElasticityProblem}, element::Element{EL}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
function get_residual_vector{EL<:CG}(problem::Problem{PlaneStressElasticityProblem}, element::Element{EL}, ip::IntegrationPoint, time::Number; variation=nothing)
|
||||
|
||||
|
||||
basis = element(ip, time)
|
||||
|
||||
Reference in New Issue
Block a user