# Automating Test Simulations with Error Handling in 3DEC

**URL:** <https://forum.itascainternational.com/t/automating-test-simulations-with-error-handling-in-3dec/1775>\
**Category:** 3DEC\
**Tags:** fish, python\
**Created:** [October 24, 2024, 11:25pm UTC](https://forum.itascainternational.com/t/automating-test-simulations-with-error-handling-in-3dec/1775 "2024-10-24T23:25:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdi.S](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mahdi.S](https://forum.itascainternational.com/u/Mahdi.S)\
**Post date:** [October 24, 2024, 11:25pm UTC](https://forum.itascainternational.com/t/automating-test-simulations-with-error-handling-in-3dec/1775/1 "2024-10-24T23:25:36Z")

</div>

Hi Everyone,  
I have developed a Python script to automate the modeling of 205 tests in 3DEC. However, I am encountering an error related to mesh generation, which suggests that I need to adjust the size of the BBM. To handle this issue, I want the program to skip the current test and proceed to the next one whenever this error occurs.

As I understand it, this error needs to be handled within the FISH, or in Python (if I am correct). I know that “_ **system.error** _” can be used in FISH to handle errors, but I am unsure how to apply it in this case. I’ve tried AI assistant with not success.

Would “_ **try, except, and else** _” in Python be used as a possible solution?  
Could you please guide me on how to handle this error so that when the program detects it, the current test is skipped, and it moves on to the next one?

* * *

Here is the error:

3dec\>block zone generate edgelength [max\_zone\_length]  
— 35107 blocks changed to deformable

```
  35106 blocks were zoned

```

mesh generation failed for the following blocks :  
block centroid volume  
32535 1.977E+01 4.454E+00 7.187E+00 3.752E-02  
1 blocks were not zoned  
— Assigning DFN fracture IDs to subcontacts  
\*\*\* Python error: 'mesh generation error\n change specified edge length or split blocks\n While processing line 49 of source …

Thanks,  
Mahdi

---

<div class="post-metadata">

**Author:** ![markus](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.itascainternational.com/markus/32/288_2.png) [@markus](https://forum.itascainternational.com/u/markus)\
**Post date:** [October 25, 2024, 7:50am UTC](https://forum.itascainternational.com/t/automating-test-simulations-with-error-handling-in-3dec/1775/2 "2024-10-25T07:50:56Z")

</div>

> [@Mahdi.S](#):
>
> Would “_ **try, except, and else** _” in Python be used as a possible solution?

Yes.  
This will automatically continue the python code on error and you can e.g. construct it in a way that makes it try increasingly smaller values of edgelengths.
