FEMSimulation
- class nrv.fmod.FEM.fenics_utils.FEMSimulation(D=3, mesh_file='', mesh=None, data=None, elem=None, ummesh=True, comm=<MagicMock name='mock.MPI.COMM_SELF' id='139958332359888'>, rank=0)[source]
Class usefull to solve the Static/Quasi-Static electrical current problem using FEM with FEniCSx algorithms (https://fenicsproject.org).
\[\nabla \mathbf{j}(\mathbf{r}) = 0\]\[\mathbf{j}(\mathbf{r}) = \mathbf{\sigma} (\mathbf{r}) \nabla V (\mathbf{r}), \forall \mathbf{r} \in \Omega\]Where \(\Omega\) is the simulation space, \(\bf{j}\) the the current density and \(V\) the electrical potential
The problem parameters (domains and boundaries condition) can be define using FEMParameters methods Contains methods to setup the matrix sytstem, to solve it and to access the results.
- Parameters:
D (int) – dim of the mesh, by default 3 NB: only 3 is implemented
mesh_file (str) – mesh directory and file name: by default “”
mesh (None or MshCreator) – if not None, (MshCreator) from which the mesh sould be used, by default None
data (str, dict or FEMParameters) – if not None, load FEMParameters attribute from data, by default None
elem (tupple (str, int)) – if None, (“Lagrange”, 1), else (element type, element order), by default None
ummesh (bool) – if True the scale of mesh space dimensions should be (um), else (m), by default True Usefull to link the update materials conductivity as in NRV conductivities are in S/m but NerveMshCreator space scale is um)
comm (int) – The MPI communicator to use for mesh creation, by default MPI.COMM_SELF
rank (int) – The rank the Gmsh model is initialized on, by default 0
Methods
|
initialisation of the FEMSimulation |
|
add new boundary or update if mesh_domain already exists |
|
add new domain or update if mesh_domain already exists |
|
add new internal boundary or update if mesh_domain already exists |
|
|
|
|
TO DO |
|
TO DO |
|
Generic method returning all the atributes of an NRV_class instance |
|
get krylov solver options |
|
|
TO DO |
|
retrun the surounding spaces of an internal boundary. |
|
|
|
Load all FEMParameters properties from a dictionary or a json file |
|
|
|
Return FEMParameters as dictionary and eventually save it as json file |
|
|
|
set a new mesh file name |
|
Generic method to set any attribute of |
|
|
|
set krylov solver options |
|
setup Bilinear form, Linear form and boundary conditions using paramters and kwargs to set the variable defined Neumann boundary conditions (see FEMParameters.add_boundary) If FEMSimulation already defined, can be used to modify variable defined NBC |
|
Assemble and solve the linear problem |
|
|
|
|