-
Notifications
You must be signed in to change notification settings - Fork 66
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
Initial truss implementation #176
Conversation
Still need a lot of improvements and testing
Hi. I comment more later on. As a quick comment, discrete boundary conditions like point loads or fixed nodes, one needs to define el = Element(Poi1, [node_id]) After that, to fix some dof of that node: update!(el, "displacement 1", 0.0) To add point load: update!(el, "displacement traction force 1", 10.0) And so on. |
src/problems_truss.jl
Outdated
element::Element, time, ::Type{Val{:plane_stress}}) | ||
#Require that the num ber pof nodes = 2 | ||
nnodes = length(element) | ||
K = ones(4, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually you want to integrate this numerically, i.e.
K = zeros(2, 2)
for ip in get_integration_points(element)
dN = element(ip, time, Val{:Grad})
detJ = element(ip, time, Val{:detJ})
A = element("cross section area", ip, time)
E = element("youngs modulus", ip, time)
K += ip.weight*E*A*dN'*dN*detJ
end
src/problems_truss.jl
Outdated
E = element("youngs modulus", 1, time) # Should we do it this way | ||
A = element("cross section area", 1, time) | ||
# Do I need to find the length of the Truss | ||
L=1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Length is not explicitly required as it comes from the "size factor" detJ
Looks that |
Have changed the implementation according to Jukka's advice. Still missing where to do the local to global transformation for trusses in 2d and 3d. And my solving of the model isn't quite right either.
Hi Jukka,
I've changed the files to integrate as you suggested regarding the
stiffness matrix. That comes out ok now for a local truss.
I guess that I now can have a spatially varying A and E, how do I set up
that so it can be tested? Or at least at the endpoints as it is implemented
now.
I'm not sure where I should do the local to global transformation of this
local stiffness matrix if I want to make a model of trusses like the simple
one below
\
\
\
\---->P
/
/
/
/
And I have tried to solve one horizontal truss with a force and bc in the
test, but I don't assemble and solve correctly.
Thanks again,
Jan
…On Thu, Aug 31, 2017 at 2:03 PM, Jukka Aho ***@***.***> wrote:
Looks that test_truss.jl is empty, you can add more commits to this PR
simply by git add, git commit, git push and so on.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bjs90Fh5F1uru8LF6ohqUWc6WV-uks5sdqEXgaJpZM4PHyhw>
.
|
The K matrix was forgotten. Tried a variable field
Hi. I think we could include file
We can then do other structural elements with the same concept. Yes, E and A can be spatially varying, to test that, they must be defined in each nodes, in the same way like geometry is done, e.g.
About that transformation matrix, let that be Q. It's for 2d problems 2x4, I quess for 3d it's 3x6. It can be done just before adding local matrix (which is size 2x2 in 2d setting) to global matrix K, where it's expanded to 4x4 matrix in 2d setting by Q' * Ke * Q. We need somehow pass the information, is our truss in 2d or 3d setting, to the assembly procedure. That is done in problem definition, when we write
means basically that we have 2 unknown dofs for each node, so total number of dofs for 2 node truss element is then 4. In asssembly procedure, we then have Number of nodes = number of basis functions = nnodes = length(element)
ndim = get_unknown_field_dimension(problem)
ndofs = nnodes*ndim Then you can allocate empty K, For that transformation matrix we need to use some trigonometric functions and calculate angles from original geometry, we can get the geometry of element by |
src/problems_truss.jl
Outdated
""" | ||
type Truss <: FieldProblem | ||
# these are found from problem.properties for type Problem{Elasticity} | ||
formulation :: Symbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think we don't need even this at this point, type definition can be empty:
type Truss <: FieldProblem
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later on we can define here for example, how do we want to calculate our local stiffness matrix. For example, we can have finite_strain :: Bool
and access this inside assembly procedure from problem.properties.finite_strain
and in that case calculate also geometric stiffness and have finite strain truss element.
src/problems_truss.jl
Outdated
error("3d elements not implemented in this example") | ||
end | ||
|
||
function assemble!(assembly::Assembly, problem::Problem{Truss}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we can remove the assemble!
functions above and have here
function assemble!(assembly::Assembly, problem::Problem{Truss}, element::Element{Seg2}, time)
src/problems_truss.jl
Outdated
|
||
function assemble!(assembly::Assembly, problem::Problem{Truss}, | ||
element::Element{Seg2}, time, ::Type{Val{:plane_stress}}) | ||
#Require that the number of nodes = 2 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number of nodes will always be here 2 if definition of element is Element{Seg2}
. In principle you could write the same function for Seg3
elements also, but they can be assembled in same function also.
src/problems_truss.jl
Outdated
end | ||
function Truss() | ||
# formulations: plane_stress, plane_strain, continuum | ||
return Truss(:plane_stress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove that formulation definition from the type, here we just return Truss()
. Actually, this initializator can be in that case removed because it's not doing anything else than giving infinite loop. The use of initializator is needed only when we have internal properties for Problem to have some good default.
Jukka,
Thanks for your input. Another question related to including it in
JuliaFEM.jl, I'm not quite sure that I have done the right thing when I
cloned the project. I put it in one arbitrary place on my disk. Is there a
way I can get Julia to pick up my cloned version, or do I need to clone it
according to the guidelines in Julia?
Thanks,
Jan
…On Fri, Sep 1, 2017 at 7:46 AM, Jukka Aho ***@***.***> wrote:
Hi.
I think we could include file problems_truss.jl in JuliaFEM.jl and export
Truss to get problem type automatically to namespace, maybe something
like this to the end of other problem definitions:
# structural elements
include("problems_truss.jl")
export Truss
We can then do other structural elements with the same concept.
Yes, E and A can be spatially varying, to test that, they must be defined
in each nodes, in the same way like geometry is done, e.g.
E = Dict(1 => 100e9, 2 => 200e9)
update!(element, "youngs modulus", E)
About that transformation matrix, let that be Q. It's for 2d problems 2x4,
I quess for 3d it's 3x6. It can be done just before adding local matrix
(which is size 2x2 in 2d setting) to global matrix K, where it's expanded
to 4x4 matrix in 2d setting by Q' * Ke * Q. We need somehow pass the
information, is our truss in 2d or 3d setting, to the assembly procedure.
That is done in problem definition, when we write
p = Problem(Truss, "test problem", 2)
means basically that we have 2 unknown dofs for each node, so total number
of dofs for 2 node truss element is then 4. In asssembly procedure, we then
have dim = get_unknown_field_dimension(problem) returning that number 2
for Truss problem. Of course we could have several different problems like
Truss1D, Truss2D, Truss3D and so on, e.g. in ABAQUS there is T2D2 and T2D3,
but I think that would lead to lot of boilerplate code.
Number of nodes = number of basis functions = length(element), so I would
write
nnodes = length(element)
ndim = get_unknown_field_dimension(problem)
ndofs = nnodes*ndim
Then you can allocate empty K, K = zeros(ndofs, ndofs).
For that transformation matrix we need to use some trigonometric functions
and calculate angles from original geometry, we can get the geometry of
element by X = element("geometry", time), when we can access to e.g.
second dof of first node by X[1][2], X is basically a list of vectors.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bq0VrvZPvT53F3czOFq3yK2Gw1NKks5sd5pFgaJpZM4PHyhw>
.
|
Do you have the whole JuliaFEM cloned somewhere in your disk, to other place than |
I have installed Julia Pro, and did an Pkg.add()
After that I did a clone in a different place on my disk, and that is where
the problems_truss.jl reside.
It sounds like my clone should have been under /.julia/v0.6 instead?
Jan
…On Fri, Sep 1, 2017 at 10:46 AM, Jukka Aho ***@***.***> wrote:
Do you have the whole JuliaFEM cloned somewhere in your disk, to other
place than ~/.julia/v0.6, or have JuliaFEM installed using Pkg.add(...)
and problems_truss.jl file somewhere outside of installation?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bj_E8uzyo1fL8b7095xsx4FLZSzcks5sd8RUgaJpZM4PHyhw>
.
|
Well, yes. You can do the changes directly to the version in |
https://docs.julialang.org/en/latest/manual/packages/#Making-changes-to-an-existing-package-1 This is how Julia community thinks developing should be done. |
Added to the juliaFEM.jl and test
Jukka,
I've been on the road for a couple of weeks.
I've updated the files and moved to the existing package way of doing
things.
In my test you see I get the 1d version right, but if I try to go to 2 dofs
, I get asymmetric matrixes and an error from JuliaFEM.
I added two points in the nodes, and I say that I have 2 DOF's in the
problem. Then the error occurs. I guess that I somehow need to use the same
local approach for getting the local 2x2 K matrix, and then do the
corrdinate transformmation.
So I'm unsure where the asymmetry is in my assumptions. I tried to make a
lokal K along the lines of the test, and then do the coord transform on
that local K, but that also didn't quite seem to be right.
I guess I need advice on how to takle the problem.
Regards,
Jan
…On Fri, Sep 1, 2017 at 3:40 PM, Jukka Aho ***@***.***> wrote:
https://docs.julialang.org/en/release-0.4/manual/packages/#
making-changes-to-an-existing-package
This is how Julia community thinks developing should be done.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bmbzcj1fMqhiaMCo5pFtfCwyuQZpks5seAkzgaJpZM4PHyhw>
.
|
Ok this should now be possible to develop in own package e.g. Truss.jl, I create a new package and let's move discussion to there. |
Excellent.
Regards,
Jan
13. nov. 2017 10.49 skrev "Jukka Aho" <notifications@github.com>:
Ok this should now be possible to develop in own package e.g. Truss.jl, I
create a new package and let's move discussion to there.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bpsuo4yUyzRuRonfqltKsLXvBrz-ks5s2BDBgaJpZM4PHyhw>
.
|
Hi Jukka,
Have you made a new package that I can start looking at?
Regards,
…On Mon, Nov 13, 2017 at 10:49 AM, Jukka Aho ***@***.***> wrote:
Ok this should now be possible to develop in own package e.g. Truss.jl, I
create a new package and let's move discussion to there.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS4bpsuo4yUyzRuRonfqltKsLXvBrz-ks5s2BDBgaJpZM4PHyhw>
.
|
Yes, |
Ok now we have https://github.com/JuliaFEM/FEMTruss.jl. About this technical details, I think we should try official JuliaFEM Gitter channel. |
Still need a lot of improvements and testing
I'm not sure how to set up the support features, where the global transformations should go when making a truss model and how to put in point loads