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

You are not logged in.

#1 2020-02-21 15:33:37

sameer21101970
Member
Registered: 2019-09-06
Posts: 176

Python Loop

I could not understand, why the indent is wrong..how to correct...

Kindly reply. Thanks in Advance.

DEBUT(PAR_LOT='NON');

mesh = LIRE_MAILLAGE(FORMAT='MED', UNITE=20)

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

mater = [None]*4
fldmat = [None]*4
reslin = [None]*4
table0 = [None]*4

E1 = [1e+5,2e+5,3e+5,4e+5]

for i in range(0,3):

mater(i) = DEFI_MATERIAU(ELAS=_F(E=E1(i),
                              NU=0.3))
)

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

# ------------------------------------------------------------------------------------------
ERREUR DE COMPILATION DANS ACCAS - INTERRUPTION
>> JDC.py : DEBUT RAPPORT
CR phase d'initialisation
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! Compilation impossible :   File "fort.1", line 19 !
   !      mater(i) = DEFI_MATERIAU(ELAS=_F(E=E1(i),    !
   !          ^                                        !
   !  SyntaxError: expected an indented block          !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fin CR phase d'initialisation

>> JDC.py : FIN RAPPORT
EXECUTION_CODE_ASTER_EXIT_12082-sameer-desktop=1

<I>_EXIT_CODE = 1

Offline

#2 2020-02-21 17:26:25

chenghui62000
Member
From: Norway
Registered: 2018-06-19
Posts: 95

Re: Python Loop

change mater(i)  to mater[ i ]and try again.

Last edited by chenghui62000 (2020-02-21 17:27:16)

Offline

#3 2020-02-22 12:41:18

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

Re: Python Loop

I saw the .mess file. You should indent all the lines starting from mater\[i\] till line before FIN() (not FIN).

Although that may work and give no error, I suspect it will not result in what you want. I think every time, the resulting files will be overwritten and only the last loop files will be available at the end.

Offline

#4 2020-02-22 16:00:06

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

Re: Python Loop

Hello,

seems your bracketing in lines 21-23 in your .comm is erroneous? Life is easier with an editor that can do bracket checking (e.g. 'Geany').

If you intend to use Geany, add .comm to the filetype definitions under Python (Python=*.py;*.pyw;SConstruct;SConscript;wscript;*.comm;). It then will check your .comm as if it was a python file (what it partly is....).

Bye,

Mario.

Last edited by mf (2020-02-22 16:00:21)

Offline

#5 2020-02-24 13:53:28

sameer21101970
Member
Registered: 2019-09-06
Posts: 176

Re: Python Loop

Thanks all.
Successfully Solved.

Big Thanks to Code-Aster Team for Open Source Simulation. Sky is the limit, it takes some effort...but it is ok..

Offline