Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2018-09-07 22:24:25

Nirav Shah
Member
Registered: 2018-08-03
Posts: 1

code_aster mesh read in python

Hello,

I am trying to run below code to read mesh created by code_aster into python.
import sys
sys.path.append('~/salome_meca_7/V2016/tools/Code_aster_stable-1260')
sys.path.append('/opt/aster')
sys.path.append('/opt/aster/13.6/lib/aster')
#import the necessary libraries
from Utilitai.partition import *
import string
import numpy as N
from code_aster.Cata.Commands import LIRE_MAILLAGE

DEBUT(PAR_LOT='NON',);

meshf=LIRE_MAILLAGE(INFO=1,
                    UNITE=20,
                    FORMAT='MED',
                    );
meshf=DEFI_GROUP(reuse=meshf,
                 MAILLAGE=meshf,
                 CREA_GROUP_NO=_F(GROUP_MA='bottom',),
                 );
mesh=partition.MAIL_PY()
mesh.FromAster('meshf')
FIN();

However, I am getting below error :
Traceback (most recent call last):
  File "temp.py", line 6, in <module>
    from Utilitai.partition import *
  File "/opt/aster/13.6/lib/aster/Utilitai/partition.py", line 22, in <module>
    import aster_core
  File "/opt/aster/13.6/lib/aster/aster_core.py", line 37, in <module>
    import _aster_core
ImportError: No module named _aster_core

Can someone help me to resolve the error?


Attachments:
temp.py, Size: 637 B, Downloads: 127

Offline

#2 2018-09-12 19:05:03

dbpatankar
Member
From: Roorkee, Uttarakhand, India
Registered: 2010-05-22
Posts: 172

Re: code_aster mesh read in python

I dont know what you want to achieve with this.

However, if you simply want to read mesh file (.med) in python, you can simply use meshio module.

Offline

#3 2018-09-13 08:45:57

tianyikillua
Member
From: Paris
Registered: 2017-11-06
Posts: 61

Re: code_aster mesh read in python

Nice to know that people are using meshio to read MED meshes. If you run into any trouble, please post it here or submit a bug on the github page github.com/nschloe/meshio

(I wrote the MED interface of meshio)

Offline

#4 2018-09-19 22:37:46

mcnguyen
Member
From: Paris
Registered: 2017-06-26
Posts: 16

Re: code_aster mesh read in python

Hi,

Please see the small correction below and I hope it can solve error.

from Utilitai.partition import *
from code_aster.Cata.Commands import LIRE_MAILLAGE

DEBUT(PAR_LOT='NON',);

meshf=LIRE_MAILLAGE(INFO=1,
                    UNITE=20,
                    FORMAT='MED',
                    );
meshf=DEFI_GROUP(reuse=meshf,
                 MAILLAGE=meshf,
                 CREA_GROUP_NO=_F(GROUP_MA='bottom',),
                 );

mesh=MAIL_PY()
mesh.FromAster('meshf')

FIN();

Offline