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

You are not logged in.

#1 2020-08-12 06:13:41

Nidish
Member
Registered: 2020-06-04
Posts: 21

EXTR_MATR Error

I'm trying to export the mass and stiffness matrix from a structural analysis. Here's the comm file snippet:

 ASSEMBLAGE(CARA_ELEM=elemprop,
           CHAM_MATER=fieldmat,
           CHARGE=(ties, rbe3s, bnrel, fix),
           MATR_ASSE=(_F(MATRICE=CO('Mass'),
                         OPTION='MASS_MECA'),
                      _F(MATRICE=CO('Stiff'),
                         OPTION='RIGI_MECA')),
           MODELE=model,
           NUME_DDL=CO('ndofs'),
           VECT_ASSE=_F(CHARGE=(load, ),
                        OPTION='CHAR_MECA',
                        VECTEUR=CO('Fp')))

import numpy as np
import scipy.sparse as ss
# vals, lins, cols, dim = M.EXTR_MATR(sparse=True)
mas = ss.csr_matrix(Mass.EXTR_MATR())
stif = ss.csr_matrix(Stiff.EXTR_MATR())

ss.save_npz("/home/nidish/Documents/Academics/RESEARCH/CAD_AND_MESHES/BRB_FOSS/PARTS/test_bnw_rbe/Mass.npz", mas)
ss.save_npz("/home/nidish/Documents/Academics/RESEARCH/CAD_AND_MESHES/BRB_FOSS/PARTS/test_bnw_rbe/Stiff.npz", stif) 

I'm running these from Salome_Meca on Ubuntu 20.04.

The matrices are exported fine if I ran this code on console mode. But if I ran it on interactive mode through salome_meca it gives me an error (see log-file, attached).

What's going on?


Attachments:
output.log.runCommand_launcher_script_Wed_Aug_12_00_11_08_2020-61313, Size: 11.62 KiB, Downloads: 103

Offline

#2 2020-08-12 07:38:31

mf
Member
Registered: 2019-06-18
Posts: 170

Re: EXTR_MATR Error

Hi,

did you try PAR_LOT='NON' in your POURSUITE?

Mario.

Offline

#3 2020-08-12 17:37:21

Nidish
Member
Registered: 2020-06-04
Posts: 21

Re: EXTR_MATR Error

Hello,

I'm not sure where to call POURSUITE(PAR_LOT='NON').

The same error happens even when I prepend the above command file with PURSUIRE(PAR_LOT='NON')

Nidish

Offline

#4 2020-08-12 17:46:36

mf
Member
Registered: 2019-06-18
Posts: 170

Re: EXTR_MATR Error

Hi,

you just showed a short snippet of your code. There I saw a POURSUITE command and assumed, that there is the mistake with PAR_LOT. But it could also be in the DEBUT command at the beginning.

It even says in the error:

ERREUR WITH INTERPRETATION IN ACCAS - INTERRUPTION
>> JDC.py: DEBUT CR phase d'initialisation
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! Erreur dans matr_asse.EXTR_MATR en PAR_LOT='OUI' !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fin CR phase d'initialisation

Mario.

Offline

#5 2020-08-13 00:05:03

Nidish
Member
Registered: 2020-06-04
Posts: 21

Re: EXTR_MATR Error

Here's the complete comm file

 mesh = LIRE_MAILLAGE(UNITE=20)

model = AFFE_MODELE(AFFE=_F(MODELISATION=('3D', ),
                            PHENOMENE='MECANIQUE',
                            TOUT='OUI'),
                    MAILLAGE=mesh)

mater = DEFI_MATERIAU(ELAS=_F(E=200000000000.0,
                              NU=0.3,
                              RHO=7800.0))

fieldmat = AFFE_MATERIAU(AFFE=_F(MATER=(mater, ),
                                 TOUT='OUI'),
                         MAILLAGE=mesh,
                         MODELE=model)

bc = AFFE_CHAR_MECA(DDL_IMPO=_F(DX=0.0,
                                DY=0.0,
                                DZ=0.0,
                                GROUP_NO=('FixNode', )),
                    MODELE=model)

ASSEMBLAGE(CHAM_MATER=fieldmat,
           CHARGE=(bc, ),
           MATR_ASSE=(_F(MATRICE=CO('Mass'),
                         OPTION='MASS_MECA'),
                      _F(MATRICE=CO('Stiff'),
                         OPTION='RIGI_MECA')),
           MODELE=model,
           NUME_DDL=CO('ndofs'))

import numpy as np
import scipy.sparse as ss
# vals, lins, cols, dim = M.EXTR_MATR(sparse=True)
mas = ss.csr_matrix(Mass.EXTR_MATR())
stif = ss.csr_matrix(Stiff.EXTR_MATR())

ss.save_npz("/home/nidish/Mass.npz", mas)
ss.save_npz("/home/nidish/Stiff.npz", stif) 
 

Offline

#6 2020-11-12 08:27:28

Achille_2016
Member
Registered: 2020-11-11
Posts: 9

Re: EXTR_MATR Error

Hello everyone. I am trying to do the same but I have the same problem if i run this code on salome shell and on interactive mode through salome_meca

Offline

#7 2020-11-14 03:24:26

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

Re: EXTR_MATR Error

Nidish wrote:

Here's the complete comm file

 mesh = LIRE_MAILLAGE(UNITE=20)

model = AFFE_MODELE(AFFE=_F(MODELISATION=('3D', ),
                            PHENOMENE='MECANIQUE',
                            TOUT='OUI'),
                    MAILLAGE=mesh)

mater = DEFI_MATERIAU(ELAS=_F(E=200000000000.0,
                              NU=0.3,
                              RHO=7800.0))

fieldmat = AFFE_MATERIAU(AFFE=_F(MATER=(mater, ),
                                 TOUT='OUI'),
                         MAILLAGE=mesh,
                         MODELE=model)

bc = AFFE_CHAR_MECA(DDL_IMPO=_F(DX=0.0,
                                DY=0.0,
                                DZ=0.0,
                                GROUP_NO=('FixNode', )),
                    MODELE=model)

ASSEMBLAGE(CHAM_MATER=fieldmat,
           CHARGE=(bc, ),
           MATR_ASSE=(_F(MATRICE=CO('Mass'),
                         OPTION='MASS_MECA'),
                      _F(MATRICE=CO('Stiff'),
                         OPTION='RIGI_MECA')),
           MODELE=model,
           NUME_DDL=CO('ndofs'))

import numpy as np
import scipy.sparse as ss
# vals, lins, cols, dim = M.EXTR_MATR(sparse=True)
mas = ss.csr_matrix(Mass.EXTR_MATR())
stif = ss.csr_matrix(Stiff.EXTR_MATR())

ss.save_npz("/home/nidish/Mass.npz", mas)
ss.save_npz("/home/nidish/Stiff.npz", stif) 
 

The problem is, this is not the complete file for code_aster. The file is generated in SLOME-MECA and hence does not have the very first command called DEBUT. Each CA command file starts with DEBUT() and has many options within it. In SM, the DEBUT command is considered implied and with default options. The option you are interested in is PAR_LOT='OUI' which you should change to PAR_LOT='NON'. So the first line should be

DEBUT(PAR_LOT='NON')

Change this and excute is within SM as usual.

So your overall code should be :

# Add this line
DEBUT(PAR_LOT='NON')

# Regular code
mesh = LIRE_MAILLAGE(UNITE=20)

model = AFFE_MODELE(AFFE=_F(MODELISATION=('3D', ),
                            PHENOMENE='MECANIQUE',
                            TOUT='OUI'),
                    MAILLAGE=mesh)

mater = DEFI_MATERIAU(ELAS=_F(E=200000000000.0,
                              NU=0.3,
                              RHO=7800.0))

fieldmat = AFFE_MATERIAU(AFFE=_F(MATER=(mater, ),
                                 TOUT='OUI'),
                         MAILLAGE=mesh,
                         MODELE=model)

bc = AFFE_CHAR_MECA(DDL_IMPO=_F(DX=0.0,
                                DY=0.0,
                                DZ=0.0,
                                GROUP_NO=('FixNode', )),
                    MODELE=model)

ASSEMBLAGE(CHAM_MATER=fieldmat,
           CHARGE=(bc, ),
           MATR_ASSE=(_F(MATRICE=CO('Mass'),
                         OPTION='MASS_MECA'),
                      _F(MATRICE=CO('Stiff'),
                         OPTION='RIGI_MECA')),
           MODELE=model,
           NUME_DDL=CO('ndofs'))

import numpy as np
import scipy.sparse as ss
# vals, lins, cols, dim = M.EXTR_MATR(sparse=True)
mas = ss.csr_matrix(Mass.EXTR_MATR())
stif = ss.csr_matrix(Stiff.EXTR_MATR())

ss.save_npz("/home/nidish/Mass.npz", mas)
ss.save_npz("/home/nidish/Stiff.npz", stif) 

Offline