-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Conversation
cmad/fem_utils/interpolants.py
Outdated
from jaxtyping import Array, Float, Int | ||
from scipy import special | ||
import numpy as onp | ||
import equinox as eqx |
There was a problem hiding this comment.
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)?
cmad/fem_utils/interpolants.py
Outdated
@@ -0,0 +1,201 @@ | |||
from jaxtyping import Array, Float, Int | |||
from scipy import special | |||
import numpy as onp |
There was a problem hiding this comment.
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.
cmad/fem_utils/solve_fem.py
Outdated
|
||
""" | ||
|
||
DOF_NODE: number of degrees of freedom per node |
There was a problem hiding this comment.
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?
cmad/fem_utils/interpolants.py
Outdated
|
||
Attributes: | ||
values: Values of the shape functions at a discrete set of points. | ||
Shape is ``(nPts, nNodes)``, where ``nPts`` is the number of |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
cmad/fem_utils/interpolants.py
Outdated
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)``. |
There was a problem hiding this comment.
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?
cmad/fem_utils/fem_functions.py
Outdated
|
||
return PEL | ||
|
||
def assemble_global_stiffness( |
There was a problem hiding this comment.
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.
cmad/fem_utils/tests/test_fem.py
Outdated
E = 200 | ||
nu = 0.3 | ||
|
||
eq_num, NUM_FREE_DOF, NUM_PRES_DOF\ |
There was a problem hiding this comment.
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 \
cmad/fem_utils/interpolants.py
Outdated
from jaxtyping import Array, Float, Int | ||
from scipy import special | ||
import numpy as onp | ||
import equinox as eqx |
There was a problem hiding this comment.
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.
cmad/fem_utils/fem_functions.py
Outdated
|
||
def initialize_equation(NUM_NODES, DOF_NODE, disp_node): | ||
|
||
eq_num = np.zeros((NUM_NODES, DOF_NODE), dtype = int) |
There was a problem hiding this comment.
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.
cmad/fem_utils/quadrature_rule.py
Outdated
and the weights. | ||
""" | ||
|
||
n = math.ceil((degree + 1)/2) |
There was a problem hiding this comment.
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
No description provided.