Skip to content

Making a Mesh Accessible to the Solver

tdowrick edited this page Jan 16, 2017 · 1 revision

The solver only accepts finite element meshes saved in the Dune Grid Format (DGF). A Matlab function dune_exporter, to write a mesh to this format is provided in the folder PEITS_root/PEITS/dune-peits/matlab. It takes seven arguments:

  • Nodes - an Nx3 matrix with the coordinates in meters, where N is the number of nodes.

  • Tetra - a Tx4 matrix defining the T tetrahedra by their four nodes.

  • sigma - a Tx1 matrix with the conductivity value in Sm^-1 or tissue index for each element. If it is an integer it is interpreted as a tissue index and assigned a conductivity value that is set in the conductivities file specified in the parameter file.

  • filepath - the path where the file should be saved to, i.e. ‘/home/username/PEITS/dune-peits/data/‘.

  • filename - the name of the new mesh, e.g. ‘new_mesh.dgf‘.

  • electrodepositions - an Ex3 matrix with the approximate coordinates of the E electrodes in meters.

  • groundposition - a 1x3 vector with the approximate coordinates of where a node should be set to ground.

The dune_exporter function writes three files, the DGF file with the mesh, a param_new_mesh file with mesh specic parameters and an electrode_positions_new_mesh file with the precise electrode positions. The precise electrode positions are used by the solver to find surface triangles that have their center within a surrounding sphere. If the electrode movement Jacobian should be computed, then the function generate_surface_coords can be used to create the surface coordinate system (eps and d have to be adapted to the mesh resolution), which can then be written into a text file (e.g. fprintf). The name of the surface coordinate file then needs to be updated in the mesh specific parameter file param_new_mesh.

Clone this wiki locally