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

Separate reference domain dimension and nodal coordinate dimension #295

Closed
wants to merge 3 commits into from

Conversation

yijiangh
Copy link

Summary

This PR tries to split the dim type parameter to ξdim and xdim. Before, the dimension of the reference domain (\xi) is coupled with the dimension of the nodal coordinate domain.

This PR starts with changing Values{dim,T,refshape} to Values{ξdim,xdim,T,refshape}, and other changes are made to make things compatible and non-breaking. The dim in function argument are renamed to ξdim or xdim to clarify the context.
This PR is particularly useful for modeling non-standard cell in JuAFEM, e.g. truss elements (1D Line cell with nodes in 2D or 3D).

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

  • I ran all tests on my computer and it's all green (i.e. ] test).
    • All local tests (julia 1.5.0 on Windows) passed except the ones involve file sha comparison. I'm not sure if the CI tests would pass or not
Test Summary:         | Fail  Total
Grid, DofHandler, vtk |   16     16
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

N::Matrix{Vec{dim,T}}
dNdx::Matrix{Tensor{2,dim,T,M}}
dNdξ::Matrix{Tensor{2,dim,T,M}}
# ? Vector dimension is assumed to be xdim ?
Copy link
Author

Choose a reason for hiding this comment

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

Are we assuming the vector dimension is xdim? I think this is related to a comment made in #193.

n_func_basefuncs = getnbasefunctions(func_interpol) * xdim
N = fill(zero(Vec{xdim,T}) * T(NaN), n_func_basefuncs, n_qpoints)
dNdx = fill(zero(Tensor{2,xdim,T}) * T(NaN), n_func_basefuncs, n_qpoints)
# TODO: each entry should be a second order tensor with shape xdim x ξdim
Copy link
Author

Choose a reason for hiding this comment

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

N::Array{Vec{dim,T},3}
dNdx::Array{Tensor{2,dim,T,M},3}
dNdξ::Array{Tensor{2,dim,T,M},3}
# ? Vector dimension is assumed to be xdim ?
Copy link
Author

Choose a reason for hiding this comment

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

@@ -40,14 +40,15 @@ For a scalar field, the `FaceScalarValues` type should be used. For vector field
FaceValues

# FaceScalarValues
struct FaceScalarValues{dim,T<:Real,refshape<:AbstractRefShape} <: FaceValues{dim,T,refshape}
# ? why 3 here? what if we have a hex cell?
Copy link
Author

Choose a reason for hiding this comment

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

Question here.

@lijas
Copy link
Collaborator

lijas commented Oct 1, 2020

I agree that there should be a way to model beams/shells/trusses etc in JuAFEM. I dont think the dofhandlers can currently correctly distribute dofs for shell elements if one wants 2nd order interpolations. This is due to how faces/edges are defined differently in 2d/3d interpolations. I did however try to solve this a while back in this branch https://github.com/lijas/JuAFEM.jl/tree/line2

My branch makes it possible to do something like this:

grid = Grid(Line3d, ...) #Grid in space-dim=3, but with line elements

#3d line cells with 2nd order 1d interpolation
dh = DofHandler(grid)
push!(dh, :u, 3, Lagrange{1,RefCube,2}()) 
push!(dh, :θ, 3, Lagrange{1,RefCube,2}()) 
close!(dh)

I dont think it is needed to rename every dim to xdim. Lets keeps dim for the space-dimension.
One has to rewrite the cell-values and add the parameter dim, which you seem to have done.

@yijiangh
Copy link
Author

yijiangh commented Oct 6, 2020

@lijas Thanks for your comments!

push!(dh, :θ, 3, Lagrange{1,RefCube,2}())

This is great! May I ask why the number of faces M equal to 1 and 0 for Line2d and Line3d in your branch here?

I dont think it is needed to rename every dim to xdim. Lets keeps dim for the space-dimension.

Hmm, I only changed dim whenever there is a confusion. We are not using named arguments almost anywhere in JuAFEM so I think this should be okay?

@yijiangh
Copy link
Author

yijiangh commented Oct 6, 2020

@lijas Also, do you have a working example for shell elements on your branch?

@lijas
Copy link
Collaborator

lijas commented Oct 8, 2020

A line element in 3d has no faces, it has only one "edge".
A line element in 2d has only one face(and no edges, because edges only exist in 3d). Maybe one could argue that there is two faces in 2d (one on each side).

Maybe these definitions for faces/edges are not always important, but when I have written generic contact algorithms for FE problems, I have noticed that it has been helpful. I also think it is the most correct.

I have no working shell example unfortunately. I just wrote some test to see that the dof distributions is correct for shells.

@termi-official termi-official mentioned this pull request May 3, 2023
6 tasks
@fredrikekre
Copy link
Member

Superseded by #694 + #651 (and some other supporting PRs). Thanks @yijiangh for the PR regardless!

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