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

Hello,

I am currently trying to load in some custom ionic models for tissue simulations in the 'Basic Tissue EP' example. However, I am getting a "L5 : Illegal IM specified" error. Full output is attached in the comments.

My current parameters in the .par file are as follows:

num_external_imp = 1

external_imp[0] = /home/chang/Desktop/openCARP_experiments/tenTusscher/model_library/mod_TT2.so

num_imp_regions = 1

imp_region[0].im = mod_TT2

imp_region[0].num_IDs = 1

These parameters were formed with Jorge's suggestions from https://opencarp.org/q2a/384/initialisation-of-tissue-using-external-model. Also, I made sure to recompile openCARP with -DDLOPEN=ON to enable dynamic library loading. What could be going wrong?

Thanks,

Chang

by (1.3k points)
chang@chang-silvalab:~/Desktop/openCARP_experiments/tenTusscher/cv_tests/01_basic_usage$ python3 ./run.py --duration 20 --S1-strength 20. --S1-dur 15 --visualize
================================================================================
SETTINGS SUMMARY
================================================================================
Executables
--------------------------------------------------------------------------------
   CARP:              /bin/openCARP
   MESHER:            /bin/mesher
   BENCH:             /bin/bench
   IGBHEAD:           /bin/igbhead
   IGBOPS:            /bin/igbops
   IGBEXTRACT:        /bin/igbextract
   IGBAPD:            /bin/igbapd
   IGBDFT:            /bin/igbdft
   MESHALYZER:        /bin/meshalyzer
   SV2H5B:            /home/chang/openCARP/external/carputils/bin/bin2h5.py
   SV2H5T:            /home/chang/openCARP/external/carputils/bin/txt2h5.py
   CLOSEST_HC:        /home/chang/openCARP/external/carputils/bin/closest_hc
   APDRESTITUTION:    /home/chang/openCARP/external/carputils/bin/APDrestitution
   TUNECV:            /home/chang/openCARP/external/carputils/bin/tuneCV
   RESTITUTECV:       /home/chang/openCARP/external/carputils/bin/restituteCV
   MESHTOOL:          /bin/meshtool
--------------------------------------------------------------------------------
Command Line Options
--------------------------------------------------------------------------------
   NP:        1
   BUILD:     CPU
   FLAVOR:    petsc
   DRY:       False
   VISUALIZE: True
--------------------------------------------------------------------------------
Solver Option Files
--------------------------------------------------------------------------------
   Parabolic: /home/chang/openCARP/external/carputils/carputils/resources/petsc_options/ilu_cg_opts
   Elliptic:  /home/chang/openCARP/external/carputils/carputils/resources/petsc_options/amg_cg_opts
--------------------------------------------------------------------------------
Paths
--------------------------------------------------------------------------------
   OPENCARP_SRC: None
--------------------------------------------------------------------------------
System Info
--------------------------------------------------------------------------------
   Python:    3.8.10
   OS:        Ubuntu 20.04.3 LTS
   SETTINGS:  /home/chang/.config/carputils/settings.yaml
   Email:     you@example.com
   Name:      Your Name
   ORCID:     0000-0000-0000-0000
================================================================================


Directory "2021-11-04_basic_20.0" already exists. Do you want to overwrite(y), quit(n), or append(a)? [y/n/a] y
Overwriting directory ...

Requested mesh already exists, skipping generation.
Reading file: meshes/2021-11-04_WYYrMlTbsK/block.elem
mkdir \
  -p /home/chang/Desktop/openCARP_experiments/tenTusscher/cv_tests/01_basic_usage/2021-11-04_basic_20.0

#-------------------------------------------------------------------------------
#              Launching openCARP Simulation 2021-11-04_basic_20.0
#-------------------------------------------------------------------------------

/bin/openCARP \
  +F ./basic.par \
  -ellip_use_pt 0 \
  -parab_use_pt 0 \
  -parab_options_file /home/chang/openCARP/external/carputils/carputils/resources/petsc_options/ilu_cg_opts \
  -ellip_options_file /home/chang/openCARP/external/carputils/carputils/resources/petsc_options/amg_cg_opts \
  -simID 2021-11-04_basic_20.0 \
  -meshname meshes/2021-11-04_WYYrMlTbsK/block \
  -dt 25 \
  -tend 20.0 \
  -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 1 \
  -phys_region[1].ID[0] 1 \
  -num_stim 1 \
  -stimulus[0].name S1 \
  -stimulus[0].stimtype 0 \
  -stimulus[0].strength 20.0 \
  -stimulus[0].duration 15.0 \
  -stimulus[0].x0 -5050.0 \
  -stimulus[0].xd 100.0 \
  -stimulus[0].y0 -550.0 \
  -stimulus[0].yd 1100.0 \
  -stimulus[0].z0 -150.0 \
  -stimulus[0].zd 300.0 \
  -gridout_i 3 \
  -gridout_e 3 \
  -spacedt 0.1

L2 : Output directory exists: 2021-11-04_basic_20.0

L1 : Warning: Legacy stimuli defined. Please consider switching to stimulus definition "stim[]"!

    *** Processing meshes ***

Reading reference mesh: meshes/2021-11-04_WYYrMlTbsK/block.*
Done in 0.011973 sec.
Processing submeshes
All done in 0.018699 sec.
Writing "Intracellular domain" surface: block_i.surf
Writing "Intracellular domain" mesh: block_i
Writing "Extracellular domain" surface: block_e.surf
Writing "Extracellular domain" mesh: block_e

    *** Initializing physics ***

Initializing Electrics ..

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

Assigning IMPS to tagged regions:
L5 : Illegal IM specified: mod_TT2
by (1.3k points)
And here is my .par file:

# ionic setup

num_external_imp = 1
external_imp[0] = /home/chang/Desktop/openCARP_experiments/tenTusscher/model_library/mod_TT2.so
num_imp_regions = 1
imp_region[0].im = mod_TT2
imp_region[0].num_IDs = 1

#electrical setup
num_stim             =      1

stimulus[0].name     = "S1"
stimulus[0].stimtype =      0
stimulus[0].strength =    250.0
stimulus[0].duration =      2.
stimulus[0].start    =      0.

bidomain    =   0
spacedt     =   1.
timedt      =   1.
parab_solve =   1
by (100 points)
I'm having the same problem. The beginning of my .par file is as follows:

num_external_imp        = 1
external_imp[0]         = /home/julieshade/Documents/ablation/test_data_generation/JB_Courtemanche_cAF_v2.so

num_imp_regions          = 1

imp_region[0].name       = non-fibrotic myocardium
imp_region[0].im         = JB_Courtemanche_cAF_v2
imp_region[0].num_IDs    = 1
imp_region[0].ID[0]      = 1

I get the following error when running a simulation based on 22_simple from the tutorials:
L5 : Illegal IM specified: JB_Courtemanche_cAF_v2

So far, I've tried the following things to fix it with no luck:
1. Re-building openCARP from source with -DDLOPEN=ON
2. Confirming via ~/openCARP/_build/CMakeCache.txt that dynamic library loading was enabled when the package was built. The following lines are present in CMakeCache.txt:
//Enable ionic shared library loading
DLOPEN:BOOL=ON
3. Re-generating the .so file from the .model file to make sure it's compatible with the manually built openCARP binaries
4. Running the following bench command, which output the expected trace, so I think the .so file is compatible with bench:
"bench --load-module ./JB_Courtemanche_cAF_v2.so --dt-out=1.0 --fout ./test_JB_model --imp-par flags=CAF"

Finally, when I comment out all of the above lines in my .par file except for the following:
"num_external_imp        = 1
external_imp[0]         = /home/julieshade/Documents/ablation/test_data_generation/JB_Courtemanche_cAF_v2.so"
the simulation runs with no error using the default ionic model. That makes me wonder if it's successfully loading the external ionic model and then failing to find it at the time of assigning properties to the mesh?
I would also greatly appreciate any help. Thanks! -Julie

2 Answers

0 votes
by (8.0k points)
Hi!

When you generated your dynamic model with make_dynamic_model.sh, you have also generated a source file that ends with "_dyn.cc". If you open that file, towards the file end there should be a variable named "__name", for example:

char __name[] = "mod_TT2";

This is the name that the dynamic model is identified by inside of openCARP. Please make sure that the value of __name matches the model name that you are using in the openCARP parameters.

For example, dynamic loading does not work if for example the .so file is renamed after generation.

Best, Aurel
by (100 points)
Hi Aurel,
Thank you for the suggestion! The end of the source file that ends with "_dyn.cc" contains the following:

namespace limpet {
extern "C" {
  int __is_plugin = 0;
  char __name[] = "JB_Courtemanche_cAF_v2";

The name matches that of the .so file and the name I used in the .par file (imp_region[0].im         = JB_Courtemanche_cAF_v2), but I still get the "L5 : Illegal IM specified: JB_Courtemanche_cAF_v2" error.

Do you know what else could be going wrong?
Thanks,
Julie
by (1.3k points)
Hi Aurel,

I can also confirm I am still getting the L5: Illegal IM speficied error. I followed Julie's steps to troubleshoot and also confirmed that the _dyn.cc file matches the correct name of the .so file.

Best,
Chang
0 votes
by (140 points)
As far as I can tell this is due to using the -O3 compiler flag. With -O2 it works.
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
MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], config: ["MMLorHTML.js"], jax: ["input/TeX"], processEscapes: true } }); MathJax.Hub.Config({ "HTML-CSS": { linebreaks: { automatic: true } } });
...