- problem can be now represented using potential energy or residual

force vector, autodiff takes care of linearization

- elasticity equations are now solved using e.g. principle of minimum
  potential energy. syntax is quite good, see notebook.

- updated how to interpolate fields, by introducing function spaces.
  syntax is now good. still have to figure out how to do time derivatives

- etc. etc. tutorial is broken at the moment, i took of get_lhs and
  get_rhs because they didn't really work.
This commit is contained in:
Jukka Aho
2015-10-26 05:40:41 +02:00
parent 2c11b2b2b2
commit 016e3cd8bf
15 changed files with 1870 additions and 826 deletions
+14 -7
View File
@@ -70,12 +70,17 @@ JuliaFEM.Field{Array{Array{T,1},1}}(0.5,1,Array{T,1}[[1.0,1.0],[1.0,1.0]])
"""
function Base.similar(field::Field, data::Vector)
fdim = round(Int, length(data)/length(field)) # dimension of field variable
if fdim == 1
new_field = Field(field.time, data)
return new_field
end
new_field = Field(field.time, similar(field.values))
data = reshape(data, round(Int, length(data)/length(field)), length(field))
data = reshape(data, fdim, length(field))
for i=1:length(new_field)
new_field.values[i] = data[:,i]
end
new_field
return new_field
end
@@ -117,7 +122,6 @@ function Base.endof(fieldset::FieldSet)
end
""" Basis function. """
type Basis
basis :: Function
@@ -128,9 +132,9 @@ function Basis(basis)
Basis(basis, ForwardDiff.jacobian(basis))
end
""" Get partial derivative of basis function. """
diff(h::Basis) = h.dbasisdxi
derivative(h::Basis) = h.dbasisdxi
function grad(basis::Basis)
(ip) -> basis.dbasisdxi(ip.xi)
end
"""
@@ -158,7 +162,10 @@ end
# convenient functions -- maybe this is not correct place for them
""" Evaluate basis function in point ξ. """
call(b::Basis, xi) = b.basis(xi)
call(b::Basis, xi::Vector) = b.basis(xi)
call(b::Basis, ip::IntegrationPoint) = b.basis(ip.xi)
Base.(:*)(basis::Basis, fs::FieldSet) = (xi, t) -> basis(xi)*fs(t)
#""" Interpolate field (h*f)(ξ) """
#Base.(:*)(f::Function, fld::Field) = (x) -> f(x)*fld
#""" Interpolate from set of fields with basis b, i.e. f(t) = b(t)*[f1, f2] """