First time here? Checkout the FAQ!
x
0 votes
by (570 points)
Hello,

As the title says, my ionic models and dynamic tags are assigned to the bath.

I'm trying to simulate a slab enclosed within a bath on both sides. Following the dynamic tagging example and extending it to a 3D application, I end up with my ionic models being assigned to the bath instead.

Is this an ID/tagging issue?

Appreciate your help. Below is my par file for reference.

------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

#=======================================================<<

num_phys_regions                        = 2

phys_region[0].name                     = Intracellular domain

phys_region[0].ptype                    = 0

phys_region[0].num_IDs                  = 1

phys_region[0].ID[0]                    = 1

phys_region[1].name                     = Extracellular domain

phys_region[1].ptype                    = 1

phys_region[1].num_IDs                  = 2

phys_region[1].ID[0]                    = 0

phys_region[1].ID[1]                    = 1

num_imp_regions                         = 2

imp_region[0].im                        = GrandiPanditVoigt

imp_region[0].num_IDs                   = 1

imp_region[0].ID[0]                     = 1

imp_region[1].im                        = GrandiPanditVoigt

imp_region[1].num_IDs                   = 1

imp_region[1].ID[0]                     = 2

imp_region[1].im_param                  = "ISO=1"

num_gregions                            = 2

gregion[0].num_IDs                      = 2

gregion[0].ID[0]                        = 1

gregion[0].g_il                         = 0.2183

gregion[0].g_it                         = 0.2183

gregion[0].g_in                         = 0.2183

gregion[0].g_el                         = 0.7842

gregion[0].g_et                         = 0.7842

gregion[0].g_en                         = 0.7842

gregion[1].num_IDs                      = 1

gregion[1].ID[0]                        = 2

gregion[1].g_il                         = 0.2183

gregion[1].g_it                         = 0.2183

gregion[1].g_in                         = 0.2183

gregion[1].g_el                         = 0.7842

gregion[1].g_et                         = 0.7842

gregion[1].g_en                         = 0.7842

num_stim                                = 3

stimulus[0].stimtype                    = 0

stimulus[0].strength                    = 200.0

stimulus[0].duration                    = 2.0

stimulus[0].start                       = 0

stimulus[0].bcl                         = 300.0

stimulus[0].npls                        = 2

stimulus[1].stimtype                    = 0

stimulus[1].strength                    = 20.0

stimulus[1].start                       = 528.0

stimulus[1].bcl                         = 300.0

stimulus[1].duration                    = 2.0

stimulus[1].npls                        = 1

stimulus[2].stimtype                    = 3

stimulus[0].x0                          = -750.0

stimulus[0].xd                          = 500.0

stimulus[0].y0                          = -750.0

stimulus[0].yd                          = 31500.0

stimulus[0].z0                          = -750.0

stimulus[0].zd                          = 6500.0

stimulus[1].x0                          = 2750.0

stimulus[1].xd                          = 30500.0

stimulus[1].y0                          = -250.0

stimulus[1].yd                          = 15500.0

stimulus[1].z0                          = -250.0

stimulus[1].zd                          = 5500.0

stimulus[2].x0                          = 60250.0

stimulus[2].xd                          = 500.0

stimulus[2].y0                          = -750.0

stimulus[2].yd                          = 31500.0

stimulus[2].z0                          = -750.0

stimulus[2].zd                          = 6500.0

dt                                      = 5

parab_solve                             = 1

spacedt                                 = 0.5

timedt                                  = 5

bidomain                                = 1

numtagreg                               = 2

tagreg[0].type                          = 4

tagreg[0].elemfile                      = releaseSite/f_release_30.0

tagreg[0].tag                           = 2

tagreg[1].type                          = 4

tagreg[1].elemfile                      = releaseSite/n_release_30.0

tagreg[1].tag                           = 1

meshname                                = meshes/2024-03-01_xrfzJoehvY/block

tend                                    = 3600.0

simID                                   = atrialBARS_RE_ISO_Density30.0_2024-03-01

bidomain                                = 1

1 Answer

0 votes
by (19.2k points)
Please share a minimal working example to reproduce this issue
by (570 points)
Hi Axel,

I'm providing a link to my Google Drive here as my code has too many characters to post.
 
https://drive.google.com/file/d/1mh7xj53-9y0EqJfl5hPw43WlhM5oUbwg/view?usp=sharing

I cleaned it the best I could for better readability. Let me know if you have trouble accessing the file.

Thank you!
Karl
by (120 points)
edited by
Christian Barrios and I found the problem:

The assignment of the ionic model to the intracellular domain (with tag 1) is correct, you can check this is in the parameters.par file in the atrialBARS_RE_XY file:

num_imp_regions                         = 2
imp_region[0].im                        = GrandiPanditVoigt
imp_region[0].num_IDs                   = 1
imp_region[0].ID[0]                     = 1
imp_region[1].im                        = GrandiPanditVoigt
imp_region[1].num_IDs                   = 1
imp_region[1].ID[0]                     = 1

You have two different imp regions, both having tag number 1 (intracellular) and both with the GPV ionic model assigned to them. I think the simulation crashes at some point not because of an incorrect assignment of ionic models to the regions but because your stimulus is empty.  

Cheers,
Joshua
by (570 points)
Thank you, Joshua and Christian.

I revised my code to make the two imp_regions unique. However, my problem persists. To be clear, my code doesn't crash.

I think it has something to do with my dynamic retagging procedure. I use the entire list of mesh elements, assuming this includes the bath, and retag the bath elements with IDs that should be the tissues' ID (see code below).

elems = np.loadtxt(tissue+'.elem', skiprows=1, usecols=(1,2,3,4),dtype=int)
pts = np.loadtxt(tissue+'.pts', skiprows=1)

Do you know a way to isolate just the tissue elements?
by (220 points)
Hello Karl,

When Joshua and I ran your code in our machines independently we got the same error about the stimulus electrode being empty. Perhaps you could share the command lines that you are using to run your code as we are only running your .py file with your default values and that is perhaps the reason why we do not get the same results: This is part of the console's output:
L2 : Output directory exists: atrialBARS_RE_2024-03-12

L1 : Warning: Legacy stimuli defined. Please consider switching to stimulus definition "stim[]"!
L3 : Region tag 0 in gregion_i[0] not found in element list for Intracellular domain grid.

L4 : Missing element tags in element file!
Check region ID specs in input files!

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

    *** Processing meshes ***

Reading reference mesh: meshes/2024-03-12_HeaohJZtTs/block.*
Done in 0.346374 sec.
Done in 0.001250 sec.
Processing submeshes
All done in 0.673301 sec.

    *** Initializing physics ***

Initializing Electrics ..

Setting up ionic models and plugins
-----------------------------------

Assigning IMPS to tagged regions:
    Ionic model: GrandiPanditVoigt to tag region(s) [1].
=======================================
You can see how the electrode is empty and therefore the simulation aborted. However, the ionic model is assigned to tag region 1 which corresponds with the element tags that are not in the bath and that belong to intracelular and extracellular domains. You can check which elements belong to the bath by checking the fiber file block.lon and seeing which elements have assigned a fiber vector of (0,0,0)

Another thing that I noticed is when you assigned the conductivities to the bath you do not use the parameter g_bath to define the conductivity in the bath. And you assigned tag/ID 1 to both gregion[0] and region[1]. Each one of the gregions might have multiple tags/IDs but each ID should belong to a single gregion. At least that is what can be observed when running the file with default parameters.
Best Regards,
Cristian
by (570 points)
Hi Christian,

Thanks for the tips. I've made adjustments to my tags/ID and bath conductivity. I've also resolved the empty stimulus error.

I updated the file on my google drive to reflect my changes.

With regards to my custom parameters, I call my function as follows:

python ./atrialBARS_reEntry_v1.2.py --iso True --dens 30

These commands will enable dynamic retagging of my mesh elements. Let me know if you observe any changes to the bath.
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
...