Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue defining new problem? #228

Open
Chaztikov opened this issue Jan 28, 2019 · 2 comments
Open

Issue defining new problem? #228

Chaztikov opened this issue Jan 28, 2019 · 2 comments

Comments

@Chaztikov
Copy link

Chaztikov commented Jan 28, 2019

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
Copy link
Member

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
Copy link
Author

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants