First time here? Checkout the FAQ!
x
0 votes
by (120 points)

Hi everyone,

I'm new to OpenCARP and having trouble getting stimulus to work in my simulations. I'm using the Docker version (git hash 4f19932) on Mac.

My simulation runs fine - the mesh loads, the Tomek model works, everything completes without errors. But the tissue never gets stimulated. When I check the Stimulus_0.trc file, it shows 0.000 nodes selected every time.

I've tried several approaches:

First attempt - geometric stimulus using x0, xd, y0, yd parameters to define a box on the left side of my tissue. I made sure the coordinates overlap with actual nodes in my mesh, but still 0 nodes selected.

Second attempt - made the stimulus box much bigger to cover the entire left side. Still nothing.

Third attempt - created an explicit vertex file (left_stim.vtx) with 84 specific node numbers and used stimtype 1. The file format looks correct (first line is the count, then one node index per line). Still 0 nodes.

Fourth attempt - tried changing my mesh element regions from 1 to 0 in case there was a mismatch. No difference.

The weird thing is there's no error message - the simulation just runs and ignores the stimulus completely. The electrics.log file doesn't even mention stimulus initialization.

My mesh is a 2D triangular mesh with 1038 nodes and 1804 elements. Here's a typical command I'm using:

openCARP -meshname mesh_name -simID test -tend 100 -dt 0.02 
-parab_solve 1 -num_imp_regions 1 -imp_region[0].im Tomek 
-imp_region[0].num_IDs 1 -imp_region[0].ID[0] 0 
-num_stim 1 -stimulus[0].stimtype 1 
-stimulus[0].vtx_file left_stim.vtx 
-stimulus[0].strength -80.0 -stimulus[0].duration 2.0 
-stimulus[0].start 10.0 -bidomain 0

Is there something obvious I'm missing? Or is there a known issue with stimulus in this Docker version? Any suggestions would be really helpful - I've been stuck on this for a while!

Thanks in advance for any help!

1 Answer

0 votes
by (1.5k points)

Hey,

without having all the details of what you tried, I can try to address some common pitfalls I've came across myself with setting stimuli:

I've noticed you use the old stimulus parameter. This is a legacy parameter and only supported for backward compatibility. Please use the up to date stim convention.

When I check the Stimulus_0.trc file, it shows 0.000 nodes selected every time.

The trace file Stimulus_0.trc does not show you the selected nodes. It contains the waveform function of the chosen stimulus, i.e. its combinations of time and normalized amplitude. This function is later multiplied by stim.strength at corresponding time-steps. If you want to see the selected nodes, use the parameter stim[0].elec.dump_vtx_file 1, which will create a .vtx file containing the node IDs of the stimulus.

First attempt - geometric stimulus using x0, xd, y0, yd parameters to define a box on the left side of my tissue. I made sure the coordinates overlap with actual nodes in my mesh, but still 0 nodes selected.

For geometric definitions, it is important to get all the associated parameters correct for the shape you are using, e.g. for a block you need to make sure to have p0 defined as the lower left corner and p1 as the upper right corner. If you mix this up, you might end up with a block definition that doesn't catch the desired points.

Why your stimulus is not working:

You are defining an extracellular current stimulus (type = 1) in a monodomain simulation. This is not possible, since there is no extracellular domain defined in monodomain setups. Use a transmembrane current (type = 0) instead.

ago by (120 points)

Thank you! I've verified all your points: 

Using modern convention: -stim[0].elec.p0/p1 with -stim[0].crct.type 0

transmembrane current (type=0)

.vtx file confirms node selection (full-tissue: 1038 nodes, half-tissue: 525 nodes)

Geometric parameters correct (p0<p1, coordinates overlap mesh) THE ISSUE: Stimulus IS working - nodes are selected and activated. The problem is propagation failure: 

• Full-tissue (1038 nodes): Perfect 25mV APs, proper propagation 

• Half-tissue (525 nodes): Local activation only, wave stops at boundary 

• Spatial maps show sharp cutoff between stimulated/resting regions Tested: conductivity 0.17-3.0 S/m, stimulus -500 to -5000 μA/cm², Tomek/TenTusscher/O'Hara models Result: All show activation without propagation Questions: 

Minimum critical mass for 2D propagation? 

External mesh (Python/Delaunay) vs internal mesher issues?

Adjustable excitability parameters in Tomek? 

Mesh: 1038 nodes, 163μm edges, validated connectivity

Best, Minoo Majidi

ago by (1.5k points)

Hey,

can you specify what you mean with 2D in your case? Do you have an actual triangulated mesh or just nodes connected by lines?

The minimum critical mass to kick off propagation depends on a lot of things including tissue conductivity, number of neighboring nodes next to the stimulus, ionic model choice, stimulus current density etc.. So there is no definite answer to that, except that you need sufficient current to depolarize the cells above threshold.

External mesh (Python/Delaunay) vs internal mesher issues?

Not sure what you mean by that.

Can you maybe share your mesh and parameter file here? That would make it easier for me to help.

Best, Tobias 

ago by (120 points)

Hi Tobias,

Thank you for the response!

2D Mesh Details: Yes, I have a proper triangulated mesh:

  • 1038 nodes in 2D space (x, y coordinates)
  • 1804 triangular elements connecting them
  • Generated using Python's meshio library with Delaunay triangulation
  • Saved in OpenCARP .pts/.elem/.lon format

Attached Files in a zip format: https://opencarp.org/q2a/?qa=blob&qa_blobid=4628146563859465809

  1. eMT_stadium_microns.pts - Node coordinates
  2. eMT_stadium_microns.elem - Element connectivity
  3. eMT_stadium_microns.lon - Fiber directions
  4. run_full_tissue.sh - Working simulation (full-tissue stimulus)
  5. run_localized.sh - Failing simulation (localized stimulus)

What Works vs What Fails:

  • Full-tissue stimulus (all 1038 nodes): Perfect 25mV APs, proper propagation
  • Localized stimulus (even 525 nodes = 50%): Local activation only, no propagation

I've tested conductivity 0.17-3.0 S/m, stimulus -500 to -10000 μA/cm², and multiple ionic models - all show the same pattern.

Looking forward to your insights!

Best, Minoo

ago by (1.5k points)
Hey,

I was not actually able to get any propagation going with either of your settings. So I am actually wondering how you see an AP with the full stimulus setup.

However, the fix is pretty simple on my end. You have to use a positive stimulus amplitude for the transmembrane current to depolarize the cells. Your setup results in a hyperpolarization of the cells (makes Vm more negative). The 500 uA/cm^2 you set is also quite large. 50 uA/cm^2 was sufficient in my case to make both your files run as they should.
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...