JuliaFEM / FEMBase.jl

JuliaFEM base package (core functionality)
http://juliafem.org/
MIT License
16 stars 9 forks source link

Element function accepts incompatible input arguments #29

Open ahniemi opened 6 years ago

ahniemi commented 6 years ago

Element function allows creation of Quad8 type element with four nodes:

julia> element2 = Element(Quad8, [1,2,3,4])
FEMBase.Element{FEMBasis.Quad8}(-1, [1, 2, 3, 4], FEMBase.Point{")FEMBase.IntegrationPoint}[], Dict{String,FEMBase.AbstractField}(), FEMBasis.Quad8())

It might good to check compatibility of input arguments here.

ahojukka5 commented 6 years ago

Interestingly, this is actually not breaking the code. During interpolation, we loop through the number of basis functions, so this is working:

using FEMBase
el = Element(Quad4, [1, 2, 3, 4, 5])
X = Dict(1=>[0.0,0.0], 2=>[1.0,0.0], 3=>[1.0,1.0], 4=>[0.0,1.0], 5=>[2.0,0.0])
update!(el, "geometry", X)
xi = (0.0, 0.0)
time = 0.0
el("geometry", xi, time)

# output

2-element Array{Float64,1}:
 0.5
 0.5

In principle, given the geometry locally, the element is working as its own little "unit", without any knowledge about its connectivity:

el2 = Element(Quad4, Int[])
update!(el2, "geometry", ([0.0,0.0], [1.0,0.0], [1.0,1.0], [0.0,1.0]))
el2("geometry", xi, time)

# output

2-element Array{Float64,1}:
 0.5
 0.5

Maybe should give a warning if there is a length mismatch between the connectivity and length of basis?