3D Sub Meshes#
- class pybamm.ScikitFemSubMesh3D(skfem_mesh, nodes, elements, coord_sys, tabs=None)[source]#
A 3D submesh class for unstructured tetrahedral meshes generated by scikit-fem.
- Parameters:
Extends:
pybamm.meshes.meshes.SubMesh- static load_mesh_from_file(file_path, boundary_mapping, domain_mapping, domain_tag_name=None, boundary_tag_name=None)[source]#
Loads a generic mesh file and converts it to a scikit-fem Mesh object.
This function is designed to work with meshes from most software packages including GMSH, Ansys, Abaqus, FEniCS, etc. It automatically detects common tag naming conventions or allows manual specification.
- Parameters:
file_path (str) – The path to the mesh file (It supports .msh, .xdmf, may also work with others but not tested).
boundary_mapping (dict) – Maps PyBaMM boundary names to integer tags (e.g., {“r_inner”: 1}).
domain_mapping (dict) – Maps PyBaMM domain names to integer tags (e.g., {“current collector”: 5}).
domain_tag_name (str, optional) – The name of the cell data array that contains domain tags for elements.
boundary_tag_name (str, optional) – The name of the cell data array that contains boundary tags for facets.
- class pybamm.ScikitFemGenerator3D(geom_type, **gen_params)[source]#
A mesh generator that creates 3D tetrahedral meshes using scikit-fem.
- Parameters:
geom_type (str) – The type of geometry to generate. Must be one of “pouch” for a rectangular prism, or “cylinder” for a cylindrical annulus.
gen_params (dict) –
A dictionary of geometry-specific parameters. for eg:
- ”h”float, optional
The target characteristic length of the mesh elements. A smaller ‘h’ results in a finer mesh and a more accurate solution, but increases computation time. Default is 0.3.
Extends:
pybamm.meshes.meshes.MeshGenerator