Skip to content

Add FEM capability #4

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add FEM capability #4

wants to merge 9 commits into from

Conversation

bgranzow
Copy link

No description provided.

from jaxtyping import Array, Float, Int
from scipy import special
import numpy as onp
import equinox as eqx
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the motivation for adding equinox and related dependencies (e.g. jaxtyping)?

@@ -0,0 +1,201 @@
from jaxtyping import Array, Float, Int
from scipy import special
import numpy as onp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would prefer

import numpy as np
import jax.numpy as jnp

for consistency with CMAD main.


"""

DOF_NODE: number of degrees of freedom per node
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are integer variables capitalized according to this naming convention?

If so, SURF_TRACTION_VECTOR should be lowercase?


Attributes:
values: Values of the shape functions at a discrete set of points.
Shape is ``(nPts, nNodes)``, where ``nPts`` is the number of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming convention here is different that other parts of the code. What is the reason for that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have been trying to follow PEP 8 guidelines for CMAD main.

https://peps.python.org/pep-0008/

Copy link
Collaborator

Choose a reason for hiding this comment

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

prefer (num_points, num_nodes) for consistency with the rest of the code.

gradients: Values of the parametric gradients of the shape functions.
Shape is ``(nPts, nDim, nNodes)``, where ``nDim`` is the number
of spatial dimensions. Line elements are an exception, which
have shape ``(nPts, nNdodes)``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nNdodes? is that a typo?


return PEL

def assemble_global_stiffness(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Talk through how this works.

E = 200
nu = 0.3

eq_num, NUM_FREE_DOF, NUM_PRES_DOF\
Copy link
Collaborator

Choose a reason for hiding this comment

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

space needed between variable and continuation character \

from jaxtyping import Array, Float, Int
from scipy import special
import numpy as onp
import equinox as eqx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typically only near-universal packages (e.g. numpy, pandas, matplotlib) are allowed to have shortened names.


def initialize_equation(NUM_NODES, DOF_NODE, disp_node):

eq_num = np.zeros((NUM_NODES, DOF_NODE), dtype = int)
Copy link
Collaborator

Choose a reason for hiding this comment

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

PEP 8 states no space between = in function arguments except when combining argument annotation with default values.

and the weights.
"""

n = math.ceil((degree + 1)/2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

try using numpy utilities instead of math

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