JuliaFEM / JuliaFEM.jl

The JuliaFEM software library is a framework that allows for the distributed processing of large Finite Element Models across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage.
http://juliafem.github.io/JuliaFEM.jl/latest/
MIT License
252 stars 66 forks source link

Issue defining new problem? #228

Open Chaztikov opened 5 years ago

Chaztikov commented 5 years ago

Errors arise if I run (as written in some of the example scripts)

using Pkg
using JuliaFEM
import JuliaFEM
import JuliaFEM: assemble!, get_unknown_field_name, Problem::FieldProblem

type Truss <: FieldProblem
end

function get_unknown_field_name(problem::Problem{Truss})
    return "displacement"
end

A working alternative seems to be:

"""
Problem u(X) = u₀ in Γ(d)
"""
mutable struct Dirichlet <: BoundaryProblem
    formulation :: Symbol
    variational :: Bool
    dual_basis :: Bool
    order :: Int
end

function Dirichlet()
    Dirichlet(:incremental, false, false, 1)
end

""" Return dual basis transformation matrix Ae. """
function get_dualbasis(element::Element, time::Float64, order=1)
    nnodes = length(element)
    De = zeros(nnodes, nnodes)
    Me = zeros(nnodes, nnodes)
    for ip in get_integration_points(element, order)
        detJ = element(ip, time, Val{:detJ})
        w = ip.weight*detJ
        N = element(ip, time)
        De += w*Matrix(Diagonal(vec(N)))
        Me += w*N'*N
    end
    return De, Me, De*inv(Me)
end

function get_formulation_type(problem::Problem{Dirichlet})
    return problem.properties.formulation
end

(as listed in the Dirichlet problem .jl file)

Please let me know if I missed something. Thanks, Charles

ahojukka5 commented 5 years ago

Hi. It looks that this is using syntax before Julia 0.7. Could you point where you have found this script so I could modify it? For example, type keyword is not more used in Julia 1.0.

Chaztikov commented 5 years ago

Hi and thanks, I don't fully recall, but believe I used this from the website:

http://www.juliafem.org/examples/2017-09-16-convection-diffusion-equation/