simnibs.simulation.calc_fields

simnibs.simulation.calc_fields(potentials, fields, cond=None, dadt=None, units='mm', E=None)

Given a mesh and the electric potentials at the nodes, calculates the fields

Parameters:
  • potentials (simnibs.msh.mesh_io.NodeData) – NodeData field with potentials. Attention: the mesh property should be set

  • fields (Any combination of 'vEeJjsDg') – Fields to output v: electric potential at the nodes E: Electric field at the elements e: Electric field magnitude at the elements J: Current density at the elements j: Current density magnitude at the elements s: Conductivity at the elements D: dA/dt at the nodes g: gradiet of the potential at the elements

  • cond (simnibs.mesh.mesh_io.ElementData (optional)) – Conductivity at the elements, used to calculate J, j and s. Might be a scalar or a tensor.

  • dadt (simnibs.msh.mesh_io.NodeData (optional)) – dA/dt at the nodes for TMS simulations

  • units ({'mm' or 'm'} (optional)) – Mesh units, either milimiters (mm) or meters (m). Default: mm

  • E (np.ndarray or simnibs.msh.mesh_io.ElementData) – Electric field, if it has been already calculated

Returns:

mesh – Mesh object with the calculated fields

Return type:

simnibs.msh.mesh_io.Msh