jax_fem.generate module#

class jax_fem.generate_mesh.Mesh(points, cells, ele_type='TET4')[source]#

Mesh manager.

points#

Shape is (num_total_nodes, dim).

Type:

NumpyArray

cells#

Shape is (num_cells, num_nodes).

Type:

NumpyArray

count_selected_faces(location_fn)[source]#

Given location functions, compute the number of faces that satisfy the location function. Useful for setting up distributed load conditions.

Parameters:

location_fns (list) – location_fns

Returns:

face_count

Return type:

int

jax_fem.generate_mesh.check_mesh_TET4(points, cells)[source]#

Check the order of TET4 element.

Parameters:
Returns:

qlts

Return type:

JaxArray

jax_fem.generate_mesh.get_meshio_cell_type(ele_type)[source]#

Convert element type into a compatible string with meshio.

Parameters:

ele_type (str) – ele_type

Returns:

cell_type – Compatible with meshio.

Return type:

str

jax_fem.generate_mesh.rectangle_mesh(Nx, Ny, domain_x, domain_y)[source]#

Generate QUAD4 mesh.

Parameters:
  • Nx (int) – Number of nodes along x-axis.

  • Ny (int) – Number of nodes along y-axis.

  • domain_x (float) – Length of side along x-axis.

  • domain_y (float) – Length of side along y-axis.

jax_fem.generate_mesh.box_mesh(Nx, Ny, Nz, domain_x, domain_y, domain_z)[source]#

Generate HEX8 mesh.

Parameters:
  • Nx (int) – Number of nodes along x-axis.

  • Ny (int) – Number of nodes along y-axis.

  • Nz (int) – Number of nodes along z-axis.

  • domain_x (float) – Length of side along x-axis.

  • domain_y (float) – Length of side along y-axis.

  • domain_z (float) – Length of side along z-axis.

jax_fem.generate_mesh.box_mesh_gmsh(Nx, Ny, Nz, domain_x, domain_y, domain_z, data_dir, ele_type='HEX8')[source]#

Generate a box mesh with the help of gmsh. Some useful links include tutorial_hex, tutorial_t1, tutorial_t3.

Parameters:
  • Nx (int) – Number of nodes along x-axis.

  • Ny (int) – Number of nodes along y-axis.

  • Nz (int) – Number of nodes along z-axis.

  • domain_x (float) – Length of side along x-axis.

  • domain_y (float) – Length of side along y-axis.

  • domain_z (float) – Length of side along z-axis.

  • data_dir (str) – A directory to store the generated mesh.

  • ele_type (str) – The type is ele_type. Accept ‘HEX8’, ‘TET4’ or ‘TET10’.

Returns:

out_mesh – Mesh in meshio format.

Return type:

MeshioMesh

jax_fem.generate_mesh.cylinder_mesh_gmsh(data_dir, R=5, H=10, circle_mesh=5, hight_mesh=20, rect_ratio=0.4)[source]#

Generate a cylinder mesh with the help of gmsh.

Contributed by Xinxin Wu at PKU in July, 2022, folloing the tutorial.

Parameters:
  • data_dir (str) – A directory to store the generated mesh.

  • R (float) – radius

  • H (float) – hight

  • circle_mesh (int) – num of meshs in circle lines

  • hight_mesh (int) – num of meshs in hight

  • rect_ratio (float) – rect length/R

Returns:

out_mesh – Mesh in meshio format.

Return type:

MeshioMesh