JuliaFEM / FEMBase.jl

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

Add function to properly extract global solution #64

Open sebastianpech opened 4 years ago

sebastianpech commented 4 years ago

As mentioned in JuliaFEM/FEMBeam.jl#22 I had problems with the correct mapping of local to global DOFs for mixed problem with different number of DOFs.

This solved the problem by using the problem specific get_gdofs and then reshapes the result.

Basically get_global_solution is replaced with get_element_solution. I didn't see get_global_solution beeing used anywhere else, so unless it's needed outside the package it could be deleted.

ahojukka5 commented 4 years ago

This also looks good for me, but for some reason, this is breaking one test, test/test_problems.jl, any idea what is going on. The tests in this package are not the best ones, so there might be something not serious though.

ahojukka5 commented 4 years ago

This maybe has something to do with "empty connectivity" for unconnected elements. We have something like this:

element = Element(Seg2, Int[])

which is used to create "placeholder" elements in some applications. Clearly this is having hard time to guess how to update. And this practice is bad anyway. Let's change that so that unconnected elements are created using

element = Element(Seg2, [0, 0])

So we give node number 0 for elements which are not connected with that node to anywhere. This special case should be taken into account in functions updating data from global solution back to elements.

sebastianpech commented 4 years ago

Can't test currently. After rebasing on master and getting FEMBasis 0.3.1 to my local env. I get

ERROR: LoadError: LoadError: invalid subtyping in definition of Poi1
Stacktrace:
 [1] top-level scope at /Users/sebastianpech/SynologyDrive/Projekte/julia-dev/FEMBase.jl/src/elements_lagrange.jl:4
 [2] include at ./boot.jl:328 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1094
 [4] include at ./Base.jl:31 [inlined]
 [5] include(::String) at /Users/sebastianpech/SynologyDrive/Projekte/julia-dev/FEMBase.jl/src/FEMBase.jl:4
 [6] top-level scope at /Users/sebastianpech/SynologyDrive/Projekte/julia-dev/FEMBase.jl/src/FEMBase.jl:28
 [7] include at ./boot.jl:328 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1094
 [9] include(::Module, ::String) at ./Base.jl:31
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:330 [inlined]
 [12] eval(::Expr) at ./client.jl:432
 [13] top-level scope at ./none:3
in expression starting at /Users/sebastianpech/SynologyDrive/Projekte/julia-dev/FEMBase.jl/src/elements_lagrange.jl:4
in expression starting at /Users/sebastianpech/SynologyDrive/Projekte/julia-dev/FEMBase.jl/src/FEMBase.jl:28