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

Elasticity: add a local buffer struct to preallocate things needed in the assembly loop #220

Merged
merged 10 commits into from
Nov 26, 2019

Conversation

KristofferC
Copy link
Contributor

This is one step towards #219 where we need to preallocate all the local buffers that each thread will use. This makes that simpler.

@KristofferC KristofferC closed this Oct 4, 2018
@KristofferC KristofferC reopened this Oct 4, 2018
@KristofferC
Copy link
Contributor Author

The creation of this local buffers should probably be moved to somewhere around https://github.com/JuliaFEM/FEMBase.jl/blob/master/src/assembly.jl#L85.


[[FEMBase]]
deps = ["FEMBasis", "FEMQuad", "LinearAlgebra", "SparseArrays", "Statistics", "Test", "TimerOutputs"]
path = "../FEMBase"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing these changes from FEMBase repository

uuid = "be8e8821-3f6f-54c2-987c-d2773c3a52cb"
version = "0.2.0"

[[FEMSparse]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I registered package today and merged pull request

@@ -319,3 +319,80 @@ function JuliaFEM.Problem(mesh::Mesh, ::Type{P}, name, dimension, parent_field_n
problem.elements = create_elements(mesh, name)
return problem
end

"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is merged in another pull request, should be rebased.


# determine material model
const u = ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be in final deliverable?

# calculate stress vector based on material model
Parameters.@unpack bi, BL, BNL, Km, Kg, f_int, f_ext, f_buffer, f_buffer_dim, gdofs, gradu, strain,
strain_vec, stress_vec, F, D, Dtan, Bt_mul_D, Bt_mul_D_mul_B, Bt_mul_S = local_buffer
if !cheating
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be in final deliverable?

calculate_stress! = plastic_def["type"]
yield_surface_ = plastic_def["yield_surface"]
params = plastic_def["params"]
if cheating
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be in final deliverable?

@@ -0,0 +1,20 @@
using JuliaFEM, LinearAlgebra, Test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted in another pull request, should be rebased

@ahojukka5
Copy link
Member

ahojukka5 commented Apr 8, 2019

After looking at this pull request with detail, it looks that some parts of code is missing, which is defining K_csc and f_csc to problem.assembly. Anyway, we should design this so that we have an abstract representation of matrices in Assembly, so that we can just change SparseMatrixCOO -> SparseMatrixCSC and everything works as expected, and not define several different stiffness matrices to Assembly.

As a general note, this pull requests is trying to do too many things at once, and commits should have some meaningful description of what they are doing so that they can be merged separately. I tried to rebase this to newest master but lost the idea in the first rebase conflict. As this is still clearly "work in progress" stage, we should rebase commits so that we can pick already working ideas to the master branch.

M = problem.assembly.M
K = problem.assembly.K
f = problem.assembly.f
K_csc = problem.assembly.K_csc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we should not have several different presentations of stiffness matrix, but instead, have only one and define necessary functions so that code works for both of types?

@@ -3,7 +3,7 @@

using JuliaFEM, Test

include("../docs/make.jl")
# include("../docs/make.jl")
Copy link
Member

@ahojukka5 ahojukka5 Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in later PR, should be rebased. And I think it's not the subject of this pull request anyway.

@@ -25,8 +25,8 @@ update!(element, "geometry", X)
update!(element, "displacement", u)
problem = Problem(Elasticity, "tet10", 3)
add_element!(problem, element)
time = 0.0
assemble!(problem, time)
ttime = 0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a good idea which should be cherry-picked and merged separately.

@TeroFrondelius
Copy link
Member

As this is still clearly "work in progress" stage, we should rebase commits so that we can pick already working ideas to the master branch.

@KristofferC do you agree with @ahojukka5's comment here? I would need to get this merged. What would be the minimum energy principle to get there?

@ahojukka5 ahojukka5 merged commit 0362fa3 into master Nov 26, 2019
@ahojukka5 ahojukka5 deleted the kc/local_buffer branch November 26, 2019 08:33
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

Successfully merging this pull request may close these issues.

4 participants