mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-11 06:08:07 +00:00
added description how to formulate new problems
This commit is contained in:
+3
-1
@@ -10,7 +10,9 @@ using Logging
|
||||
include("types.jl") # type definitions
|
||||
include("elements.jl") # elements
|
||||
include("equations.jl") # formulations
|
||||
include("math.jl") # basic mathematical operations
|
||||
include("problems.jl") # problems
|
||||
|
||||
include("math.jl") # basic mathematical operations -- obsolete ..?
|
||||
|
||||
include("elasticity_solver.jl")
|
||||
include("xdmf.jl")
|
||||
|
||||
+4
-1
@@ -27,13 +27,16 @@ has_rhs(eq::Equation) = false
|
||||
get_rhs(eq::Equation, xi) = nothing
|
||||
get_element(eq::Equation) = eq.element
|
||||
get_integration_points(eq::Equation) = eq.integration_points
|
||||
|
||||
# couple convenient functions -- could make weak form definition easier
|
||||
get_connectivity(eq::Equation) = get_connectivity(get_element(eq))
|
||||
get_basis(eq::Equation, ip::IntegrationPoint) = get_basis(get_element(eq), ip.xi)
|
||||
get_dbasisdx(eq::Equation, ip::IntegrationPoint) = get_dbasisdx(get_element(eq), ip.xi)
|
||||
interpolate(eq::Equation, field::Union(ASCIIString, Symbol), ip::IntegrationPoint) = interpolate(get_element(el), field, ip.xi)
|
||||
integrate_lhs(eq::Equation) = has_lhs(eq) ? integrate(eq, get_lhs) : nothing
|
||||
integrate_rhs(eq::Equation) = has_rhs(eq) ? integrate(eq, get_rhs) : nothing
|
||||
|
||||
|
||||
"""
|
||||
Return determinant of Jacobian for numerical integration.
|
||||
"""
|
||||
@@ -72,7 +75,7 @@ function get_global_dofs(eq::Equation)
|
||||
eq.global_dofs
|
||||
end
|
||||
|
||||
function set_global_dofs(eq::Equation, dofs)
|
||||
function set_global_dofs!(eq::Equation, dofs)
|
||||
eq.global_dofs = dofs
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
abstract Problem
|
||||
|
||||
get_equations(pr::Problem) = pr.equations
|
||||
get_dimension(pr::Type{Problem}) = nothing
|
||||
get_equation(pr::Type{Problem}, el::Type{Element}) = nothing
|
||||
|
||||
"""
|
||||
Add new element to problem
|
||||
"""
|
||||
function add_element!(pr::Problem, el::Element)
|
||||
eq = get_equation(typeof(pr), typeof(el))
|
||||
push!(pr.equations, eq(el))
|
||||
end
|
||||
|
||||
"""
|
||||
Return total number of basis functions in problem
|
||||
"""
|
||||
function get_number_of_basis_functions(pr::Problem)
|
||||
conn = Int[]
|
||||
for eq in get_equations(pr)
|
||||
append!(conn, get_connectivity(eq))
|
||||
end
|
||||
length(unique(conn))
|
||||
end
|
||||
|
||||
"""
|
||||
Problem matrix size dimension
|
||||
"""
|
||||
function get_matrix_dimension(pr::Problem)
|
||||
get_dimension(typeof(pr))*get_number_of_basis_functions(pr)
|
||||
end
|
||||
|
||||
"""
|
||||
Assign global dofs for element. This doesn't do any reordering.
|
||||
"""
|
||||
function set_global_dofs!(pr::Problem)
|
||||
#ndim = get_dimension(pr)*get_number_of_basis_functions(pr)
|
||||
#ndim = get_matrix_dimension(pr)
|
||||
dim = get_dimension(typeof(pr))
|
||||
nconn = get_number_of_basis_functions(pr)
|
||||
ndim = dim*nconn
|
||||
Logging.debug("Problem (matrix) dimension: $ndim")
|
||||
gdofs = reshape(collect(1:ndim), dim, nconn)
|
||||
for eq in get_equations(pr)
|
||||
lconn = get_connectivity(eq)
|
||||
gconn = gdofs[:, lconn][:]
|
||||
set_global_dofs!(eq, gconn)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user