I generated my own paraboloid mesh using a python script [1] and saving it in .vtk format. I checked the shape of the mesh in Paraview and all seems correct.

Now I want to run a simulation on this mesh, so I converted it to carp_txt using meshtool:

meshtool convert -imsh=surface_mesh -ifmt=vtk -omsh=surface_mesh -ofmt=carp_txt

When I check the output .pts file, I notice that new vertices are created, that are far out of the original bounds of the mesh. the original mesh was situated in *(x,y,z) \in [0,40]x[0,40]x[-0.05,20,05]*. Some points however have the following coordinate:

0.000000 1.573437 272009238956254653579264.000000

0.000000 1.721875 272007851847569423466496.000000

0.000000 1.924219 -107374232.000000

0.000000 2.090625 -107374160.000000

...

So the z-coordinate is very far off for these points. I additionally do not manage to visualize the output mesh using meshalyzer.

My question is thus:

a) Why does this happen?

b) When trying to run a simulation [2] on this mesh, I get the error

L5 : error: Empty stimulus[0] electrode def! Aborting!

Would this be related to this weird effect in the carp_txt mesh or is something else going on?

For reference, here is

[1] the python script I used to generate the mesh

""" Creates paraboloid surface mesh with small thickness """

import numpy as np

import pyvista as pv

# Define the function for the surface

def surface_func(x, y):

return -0.025*(x-20)**2 - 0.025*(y-20)**2 + 20

# Define grid points

x = np.arange(0, 40.1, 0.25)

y = np.arange(0, 40.1, 0.25)

X, Y = np.meshgrid(x, y)

# Calculate Z coordinates using the surface function

Z_top = surface_func(X, Y) + 0.05

Z_bottom = surface_func(X, Y) - 0.05

# Create PyVista meshes for the top and bottom surfaces

top_surface = pv.StructuredGrid(X, Y, Z_top)

bottom_surface = pv.StructuredGrid(X, Y, Z_bottom)

# Merge the two surfaces to create a thickened mesh

thickened_mesh = top_surface + bottom_surface

# Write the mesh to a VTK file

thickened_mesh.save('surface_mesh.vtk')

[2] the parameters of the stimulus

stim[0].name = "S1"

stim[0].crct.type = 0

stim[0].elec.geom_type = 2

stim[0].elec.p0[0] = 0.

stim[0].elec.p0[1] = 0.

stim[0].elec.p0[2] = 0.

stim[0].elec.p1[0] = 4.

stim[0].elec.p1[1] = 40.

stim[0].elec.p1[2] = 20.

stim[0].elec.dump_vtx_file = 1

stim[0].ptcl.stimlist = 0

stim[0].ptcl.duration = 1.0

stim[0].pulse.strength = 100.0