Files
JuliaFEM.jl/test/domains/continuum/test_helpers.jl
T
Jukka Aho e1d46340db test(continuum): drop unused create_material_state helper
Stateful initialization now flows through `GlobalMaterialCache` construction in
the individual tests, so the placeholder helper only duplicated errors.

- Remove `create_material_state` and its docstring from shared continuum helpers.
2026-05-09 18:45:02 +03:00

54 lines
1.4 KiB
Julia
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Shared helper functions for kernel allocation tests
using JuliaFEM
using Tensors
using LinearAlgebra
"""
create_test_mesh() -> Mesh{8, Hex8}
Create a single Hex8 element mesh for testing.
"""
function create_test_mesh()
# Single Hex8 element with 8 nodes
# Node coordinates for a unit cube
X = Vec{3,Float64}[
Vec{3}((0.0, 0.0, 0.0)), # Node 1
Vec{3}((1.0, 0.0, 0.0)), # Node 2
Vec{3}((1.0, 1.0, 0.0)), # Node 3
Vec{3}((0.0, 1.0, 0.0)), # Node 4
Vec{3}((0.0, 0.0, 1.0)), # Node 5
Vec{3}((1.0, 0.0, 1.0)), # Node 6
Vec{3}((1.0, 1.0, 1.0)), # Node 7
Vec{3}((0.0, 1.0, 1.0)), # Node 8
]
# Single element connectivity (must be UInt32)
connectivity = [NTuple{8,UInt32}((1, 2, 3, 4, 5, 6, 7, 8))]
return Mesh{8,Hex8}(X, connectivity)
end
"""
create_test_kernel() -> ContinuumKernel
Create a ContinuumKernel with LinearElastic material for testing.
"""
function create_test_kernel()
# Material properties: Steel-like
E = 200.0e9 # Young's modulus (Pa)
ν = 0.3 # Poisson's ratio
# Create linear elastic material
material = LinearElastic(E, ν)
# Create continuum formulation (3D elasticity)
formulation = ContinuumFormulation{FullThreeD}()
# Create kernel (field is optional, defaults to Displacement{3})
kernel = ContinuumKernel(formulation, material)
return kernel
end