- Currently developed actively, and api also changes
- has complex mode and real mode; PDE solver library PETSc has either real or complex build, and FEniCSx has to be switched to the corresponding mode. Below command to check the available version and build, and install PETSc(Corresponding FEniCSx will be automatically installed). It is an idea to install both in different environment to allow switching.
''' conda search -c conda-forge PETSc conda install -c conda-forge petsc=3.21.6=complex_h9a830cf_0
'''
- Wrap constant with PETSc.ScalarType [Ref](https://jsdokken.com/dolfinx-tutorial/chapter1/complex_mode.html#variational-problem/)
```python
rho = fem.Constant(domain, PETSc.ScalarType(2700.0))
```
- Expected error [ incompatible function arguments. The following argument types are supported: ]
- conjugate tensor product either by ufl.conj or ufl.inner(second operand conjugated)
- Expected error [ ArityMismatch: Failure to conjugate test function in complex Form ]
- [# Similarly, if we want to use the function `ufl.derivative` to take derivatives of functionals, we need to take some special care. As `ufl.derivative` inserts a `ufl.TestFunction` to represent the variation, we need to take the conjugate of this to be able to use it to assemble vectors.](https://github.com/jorgensd/dolfinx-tutorial/blob/main/chapter1/complex_mode.py)
- Defining boundary condition with constants, below failed in solving the problem due to an incompatible type error
bcs = [
fem.dirichletbc(np.zeros((2,)), left_dofs, V),
fem.dirichletbc(np.zeros((2,)), right_dofs, V),
]
- Changing to numpy to PETSc.ScalarType resolved the issue
bcs = [
fem.dirichletbc(PETSc.ScalarType([0, 0]), left_dofs, V),
fem.dirichletbc(PETSc.ScalarType([0, 0]), right_dofs, V),
]
PETSc.ScalarType wraps the constant source on the right hand side. This is because we want the integration kernels to assemble into the correct floating type.
- When plotting, some values have to be set back to real values before plot
grid.point_data["Deflection"] = u.x.array.reshape(-1, 3).real
- ERROR [compute_integration_domains(): incompatible function arguments.]
- Some versions needs explicit type definition for meshtags
facet_tags = meshtags(mesh, mesh.topology.dim - 1,
np.concatenate([facets_left]),
np.array([0] * len(facets_left)).astype('int32'))
display(kappa.x.array[:])
- gmshio seems to fail to read hexahedron...Unknown cell type-KeyError: np.int32(6)
- works fine with tetrahedron
- cell:Volume physical group number
- facet_tags: Surface physical number
-
Install relevant traum libraries and jupyter labextension using conda(used pip to install viskex at first, ending up with those traum libraries installed by pip and not recognized)Tram for Jupyter Lab
p
The Shell interface ( ) is intended for mechanical analysis of thin-walled structures. The formulation used in the Shell interface is a Mindlin–Reissner type, which means that transverse shear deformations are accounted for. It can be used for rather thick shells as well as thin ones. It is possible to prescribe an offset in a direction normal to a selected surface, which for example can be used when meshing imported geometries. The Shell interface also includes other features such as damping, thermal expansion, and initial stresses and strains.
-Jupytext to convert .py <-> .ipynb: jupytext --to notebook notebook.py <-> jupytext --to py notebook.ipynb
- Gmsh official document
- Gmsh with python reference with different topology -Gmsh Python API basics blog
- Gmsh Python API for FEnics