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
250 stars 66 forks source link

Initial truss implementation #176

Closed jtveiten closed 6 years ago

jtveiten commented 7 years ago

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

ahojukka5 commented 7 years ago

Hi. I comment more later on. As a quick comment, discrete boundary conditions like point loads or fixed nodes, one needs to define Element{Poi1}, i.e.

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.

ahojukka5 commented 7 years ago

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.

jtveiten commented 7 years ago

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 notifications@github.com 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-326274850, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bjs90Fh5F1uru8LF6ohqUWc6WV-uks5sdqEXgaJpZM4PHyhw .

ahojukka5 commented 7 years ago

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.

jtveiten commented 7 years ago

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 notifications@github.com 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-326494439, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bq0VrvZPvT53F3czOFq3yK2Gw1NKks5sd5pFgaJpZM4PHyhw .

ahojukka5 commented 7 years ago

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?

jtveiten commented 7 years ago

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 notifications@github.com 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-326525993, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bj_E8uzyo1fL8b7095xsx4FLZSzcks5sd8RUgaJpZM4PHyhw .

ahojukka5 commented 7 years ago

Well, yes. You can do the changes directly to the version in ~/.julia/v0.6/JuliaFEM. I think you can just rename the old JuliaFEM directory to something else and then move the cloned copy to ~/.julia/v0.6. Alternatively, create symbolic link if working with Linux. Third option is to add path where you have cloned JuliaFEM to LOAD_PATH, i.e. push!(LOAD_PATH, "path_to_repositories").

ahojukka5 commented 7 years ago

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.

jtveiten commented 6 years ago

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 notifications@github.com 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-326582634, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bmbzcj1fMqhiaMCo5pFtfCwyuQZpks5seAkzgaJpZM4PHyhw .

ahojukka5 commented 6 years ago

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.

jtveiten commented 6 years ago

Excellent.

Regards, Jan

  1. 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-343866588, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bpsuo4yUyzRuRonfqltKsLXvBrz-ks5s2BDBgaJpZM4PHyhw .

jtveiten commented 6 years ago

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 notifications@github.com 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 https://github.com/JuliaFEM/JuliaFEM.jl/pull/176#issuecomment-343866588, or mute the thread https://github.com/notifications/unsubscribe-auth/AFS4bpsuo4yUyzRuRonfqltKsLXvBrz-ks5s2BDBgaJpZM4PHyhw .

ahojukka5 commented 6 years ago

Yes, FEMBase.jl, but I'm still working with documentation for that. We can however start with this one, let's create a new package and move development to there.

ahojukka5 commented 6 years ago

Ok now we have https://github.com/JuliaFEM/FEMTruss.jl. About this technical details, I think we should try official JuliaFEM Gitter channel.