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

Update loops to use jax calls and JIT some functions #27

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

chahak13
Copy link
Collaborator

No description provided.


Parameters
----------
obj : diffmpm.node.Nodes, diffmpm.particle._ParticlesState

Choose a reason for hiding this comment

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

I think it should be vel in the docstring or obj in the function, same issue with all the functions.

Damping forces on the nodes.
loc : ArrayLike
Locations of all the nodes. Expected shape (nnodes, 1, ndim)
initialized: bool

Choose a reason for hiding this comment

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

There are no parameters initialized,data in this method.

Comment on lines 57 to 64
initialized: bool
`False` if particle property arrays like mass need to be initialized.
If `True`, they are set to values from `data`.
data: tuple
Tuple of length 13 that sets arrays for mass, density, volume,
velocity, acceleration, momentum, strain, stress, strain_rate,
dstrain, f_ext, reference_loc and volumetric_strain_centroid.

Choose a reason for hiding this comment

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

These parameters are not present in this method also docstring for init_vel can be added.

Comment on lines +146 to +158
Parameters
----------
state:
Current state
elements: diffmpm._ElementState
Elements that the particles are present in, and are used to
compute the particles' volumes.
total_elements: int
Total elements present in `elements`.
"""

Choose a reason for hiding this comment

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

docstring not matching function arguments

initialized: Optional[bool] = None,
volume: Optional[ArrayLike] = None,
) -> Quad4NState:
"""Initialize Linear1D.

Choose a reason for hiding this comment

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

Suggested change
"""Initialize Linear1D.
"""Initialize Quad4N.


def init_state(
self,
nelements: int,

Choose a reason for hiding this comment

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

Suggested change
nelements: int,
nelements: chex.ArrayDevice,

self,
nelements: int,
total_elements: int,
el_len: float,

Choose a reason for hiding this comment

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

Suggested change
el_len: float,
el_len: chex.ArrayDevice,

@chahak13
Copy link
Collaborator Author

chahak13 commented Aug 17, 2023

image

Ran optimization with 2D Uniaxial stress example. Given stress, estimated Young's Modulus. This is with the stateless implementation. This is possible because 1034d4f changes all for loops to scans so that bidirectional differentiation can work.

@kks32 ^

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.

2 participants