Python ABAQUS debugging problem.

Mahendra g2mahendra at gmail.com
Thu May 10 10:37:43 EDT 2012


On May 10, 9:31 am, Mahendra <g2mahen... at gmail.com> wrote:
> Dear all,
>             I am learning to use python script for running ABAQUS
> (commerical finite element program). I am having a bug in the
> following chunk of code and am not sure what it is. I have three loops
> in my code. The first two loops work fine. The third loop is a
> combination of loop 1 and loop 2. It doesnt work. There is some syntax
> issue which it is not clear to me.
>
> #--------------------------#-------------------#
> # Creating a list of moduli for parametric study
> moduli = [ 1000, 500]
>
> #--------------------------#-------------------#
> # This loop works fine
>
> for E in moduli:
>     print E
>     lengthE='length'+str(E)
>     print lengthE
> #--------------------------#-------------------#
>
> #--------------------------#-------------------#
> # This loop works fine.
>
> for E in moduli:
> #   lengthE = 'length'+str(E)
> #       print E
> #       print lengthE
>
> mdb.models['Model-1'].materials['Elastic'].elastic.setValues(table=((E,
> 0.18), ))
>         job.submit()
>         job.waitForCompletion()
>         print 'Completed job for %s E' % (E)
> #--------------------------#-------------------#
>
> #--------------------------#-------------------#
> # This loop doesnt work.
> # It says syntax error in lengthE = 'length' + str(E)
> #--------------------------#-------------------#
> for E in moduli:
>     print E
>         lengthE = 'length' + str(E)
>
> mdb.models['Model-1'].materials['Elastic'].elastic.setValues(table=((E,
> 0.18), ))
>         job.submit()
>         job.waitForCompletion()
> #       print lengthE
>         print 'Completed job for %s E' % (E)
> #--------------------------#-------------------#
>
> Any help is deeply appreciated in this regard.
> Sincerely,
> Mahendra.

I think when I pasted the message from the code in this email, the
indentation is little off. I used notepad++ for writing the code. It
didnt show wrong indentation. However, on notepad it is wrongly
indented. The program is working now. Thanks for your time and sorry
for the inconvenience.
Mahendra.



More information about the Python-list mailing list