# Simulation does not run successfully when using the TELAPY module

**URL:** <https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282>\
**Category:** TELAPY / ADAO / OPENTURNS / and co.\
**Created:** [May 25, 2023, 12:58pm UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282 "2023-05-25T12:58:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_17414](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/dbc845/32.png) [@user\_17414](https://opentelemac.org/forum/u/user_17414)\
**Post date:** [May 25, 2023, 12:58pm UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/1 "2023-05-25T12:58:01Z")

</div>

Hello [name removed]!

Recently, I have been attempting to use TELAPY to control TELEMAC2D simulations (v8p4-Linux). I have been able to successfully run the “breach” example provided in the telapy notebooks. However, when I try to run my own case, the simulation does not progress beyond the initialization stage after telapy is successfully initiated (The code is shown in Figure 1). It gets stuck at the position shown in Figure 2. Interestingly, the same case runs smoothly without using telapy (as shown in Figure 3).

I have been unable to identify the source of this issue. I would greatly appreciate any suggestions or advice you can provide.

[name removed]

 ![Figure1.png](https://opentelemac.org/uploads/default/original/2X/9/902f99de7581ff86718368a3cae6ea70f385cc13.png)  
 ![Figure2.png](https://opentelemac.org/uploads/default/original/2X/1/1ff12564e253f5c773eca8d2f74caaa9eb4965f4.png)  
 ![Figure3.png](https://opentelemac.org/uploads/default/original/2X/d/d3bd21aa069d152dfd617b7e3b29bdcf488a45c1.png)

---

<div class="post-metadata">

**Author:** ![user\_16632](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/4da419/32.png) [@user\_16632](https://opentelemac.org/forum/u/user_16632)\
**Post date:** [May 26, 2023, 10:49am UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/2 "2023-05-26T10:49:18Z")

</div>

Hello!

Have you tried to run your code with one time-step at a time instead of simulating all the time steps at once with the command you have used?

Is the behavior the same when doing:

```auto
for i in range(number_of_time_steps):

    my_case.run_one_time_step()

```

[name removed]

---

<div class="post-metadata">

**Author:** ![user\_17414](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/dbc845/32.png) [@user\_17414](https://opentelemac.org/forum/u/user_17414)\
**Post date:** [May 26, 2023, 11:37am UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/3 "2023-05-26T11:37:00Z")

</div>

Hello [name removed],

Thank you for your reply!

I also tried the one time-step simulation, but it showed the same problem. Even the same code applied to the “breach” case works fine, so I’m confused as to why.

[name removed]

---

<div class="post-metadata">

**Author:** ![user\_16632](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/4da419/32.png) [@user\_16632](https://opentelemac.org/forum/u/user_16632)\
**Post date:** [May 26, 2023, 11:44am UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/4 "2023-05-26T11:44:12Z")

</div>

One solution may be not use DEBUGGER=1 in your .cas file to see where the computation is stopping. You can also link your files to run the case (if possible), and I can have a quick look at it.

---

<div class="post-metadata">

**Author:** ![user\_17414](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/dbc845/32.png) [@user\_17414](https://opentelemac.org/forum/u/user_17414)\
**Post date:** [May 26, 2023, 12:08pm UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/5 "2023-05-26T12:08:37Z")

</div>

I would be grateful if you could help me check what the problem is. I have attached all my files and my complete code is as follows:

```auto
import os

import sys

import numpy as np

from mpi4py import MPI

from telapy.api.t2d import Telemac2d

os.chdir('/opt/data/private/install/telemac/telemac-mascaret-v8p4r0/examples/nanjing/api')

my_case = Telemac2d('source_6m_userq.cas', comm=MPI.COMM_WORLD)

my_case.set_case()

my_case.init_state_default()

number_of_time_steps = my_case.get('MODEL.NTIMESTEPS')

[n_sources, [name removed], dim3] = my_case.get_var_size('MODEL.DSCE')

print(number_of_time_steps)

print(n_sources)

my_case.run_all_time_steps()

my_case.finalize()

```

[source\_6m\_userq.cas](https://opentelemac.org/forum/uploads/short-url/FfdGWG2hs9vJOuL6X85WMQEekh.cas) (10.7 KB)  
[bc\_icm\_source\_6m.cli](https://opentelemac.org/forum/uploads/short-url/moKDrm4PzcmO8ojW2ocBZBB9kW6.cli) (248 KB)

---

<div class="post-metadata">

**Author:** ![user\_63](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/c4cdca/32.png) [@user\_63](https://opentelemac.org/forum/u/user_63)\
**Post date:** [May 26, 2023, 12:14pm UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/6 "2023-05-26T12:14:02Z")

</div>

Hi

What is the result is you indicate 358 in MAXIMUM NUMBER OF SOURCES instead of 1000?

---

<div class="post-metadata">

**Author:** ![user\_17414](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/dbc845/32.png) [@user\_17414](https://opentelemac.org/forum/u/user_17414)\
**Post date:** [May 26, 2023, 12:39pm UTC](https://opentelemac.org/forum/t/simulation-does-not-run-successfully-when-using-the-telapy-module/7282/7 "2023-05-26T12:39:22Z")

</div>

Hello [name removed],

Thank you for your reply! After I modified the MAXIMUM NUMBER OF SOURCES in the cas file as you suggested, the result showed that the variable n\_sources became 358 after initialization but the problem was still not solved

[name removed]
