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

[Draft] Hyperelasticity support (based on work by Joseph Beckett) #184

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

mohamed82008
Copy link
Member

Summary

This draft PR is made from the hyperelastic branch of the fork https://github.com/estradalab/TopOpt.jl made by @jbecktt. I just wanted to see how many changes were made in a PR. The merge of master into this branch was clean so I hope no breakages were introduced and that you (@jbecktt) can continue working off of this branch jb/hyperelastic in the main TopOpt.jl repo. I invited you to be a collaborator in this repo.

tolulade2023 and others added 15 commits May 13, 2024 11:41
Adding functions relevant to the optimzaiton of mechanical test data richness and experimental certainty.
Converted the name from JosephLoadCantilever to TensionBar, added a schematic for the documentation, and deleted a requirements related to enforcing an even number of elements along the y/z directions that was unnecessary.
Fixes bug where all of the quadrature points were not iterated over all of the basis functions. Also adds missing quadrature weight and determinant of the Jacobian to the formulation
Ignore .ipynb, .jl, and .vtu files frequently developed during testing.
Added a tension bar problem type where x displacement are the only enforced condition on the bar. Two additional points have contraints to prevent translation of the sample and to prevent rigid body rotation about the x-axis.
All FEA currently done in TopOpt assumes plane strain. This small fix just clears up the ambiguous 3D terms of defgrad tensors of 2D problem types (i.e., F33=0 and F31=F32=F13=23=0)
Add detailed comments and make code more concise. The primary focus of the edits were to the sensitivity related functions (i.e., not the entropy related functions).
Making a simple indexing fix to fix a mutation error from Zygote when calling autodiff.
Adding basic fundamentals of a hyperelastic solver. Still needs plenty of cleanings and comments. The main issue currently is autodiff still needs to be upgraded to use ImplicitDiff.jl to handle the iterative nature of the solver. The code still needs additional validation, but the bones are there.
Only ignore .jl files in top level of directory. Also ignore .png and .zip files.
Additional validation is pending regarding the time stepping code, but confidence is fairly high that it is implemented correctly. Stability seems to be excellent so long as sufficiently small time steps are used to achieve the solution. This also includes some of the foundation for implenting a nearly-incompressible hyperelastic solver that is not implemented yet.
Nearly incompressible HE is still only partially implemented. The smart time stepping is not adjustable yet via kwargs.
if make_plot==true
#Below line creates figure slightly differently, using a method that is not the same as what was used to get h
# hist = histogram2d(K2_Vector, K3_Vector, nbins=n_bins, color=:viridis, xlims=K2_edges, ylims=K3_edges, background="black")
p=(heatmap(h))
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be better to separate the plotting to be done outside this function, perhaps in the test folder instead of src. I don't think adding the heavy Plots package as a dependency for a single function is a good idea when a user can just load Plots externally. Alternatively, if you would like to provide more convenience plotting functionality, we have a Makie extension which we can extend further to support additional plots.

Outputs: stressTerms[i,j] (i.e. ∂²W(K₁,K₂,K₃)/∂Kᵢ∂ξⱼ) and kinTerms[i,j,k] (this is equivalent to d^3W/dK_i/dXi_j/dK_kk) =#

function sensitivityFieldFncs(matlModel::Symbol)
@variables α K[1:3] # K[1:3] are the orthogonal strain invariants
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's discuss if use of Symbolics is really required here. I wonder if ForwardDiff could be used to get the derivatives numerically instead of symbolically.

@@ -496,7 +496,7 @@ function LBeam(
add!(ch, dbc)
close!(ch)

t = T(0)
t = T(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

is this intentional?

@@ -656,7 +656,7 @@ function TieBeam(
add!(ch, dbc2)
close!(ch)

t = T(0)
t = T(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

same comment

@@ -754,7 +754,7 @@ function RayProblem(
add!(ch, dbc)
end
close!(ch)
t = T(0)
t = T(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

looks intentional :) but why

@@ -9,6 +9,7 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Einsum = "b7d42ee7-0b51-5a75-98ca-779d3107e4c0"
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not used I think.

@@ -36,7 +39,9 @@ Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Copy link
Member Author

Choose a reason for hiding this comment

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

where is this used?

Comment on lines +32 to +33
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's consider using Makie if possible since we already have an extension for Makie.

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.

3 participants