← Back to team overview

yade-users team mailing list archive

Re: [Question #706765]: Batch file question

 

Question #706765 on Yade changed:
https://answers.launchpad.net/yade/+question/706765

    Status: Open => Answered

Jan Stránský proposed the following answer:
> readParamsFromTable(rMean=rMean, rRelFuzz=rRelFuzz,num=num, maxLoad=1e3, minLoad=1e2)
> NameError: name 'rMean' is not defined

Please provide a complete script.
But as the error says, rMean is not defined. I.e. the variable rMean is first used at this line, but there is nothing about it before in the script.
I guess similar situation would be with rRelFuzz and num.

You have to either use a literal value:
###
readParamsFromTable(rMean=123,...)
###

or use defined variable, e.g.:
###
rMean = 123
readParamsFromTable(rMean=rMean,...)
from yade.params.table import *
###
but then rMean value is that from readParamsFromTable and the first line does not make sense.. e.g.
###
rMean = 123
readParamsFromTable(rMean=234,...)
from yade.params.table import *
print(rMean) # 234
###

The way I used to use it is:
###
readParamsFromTable(
    # default values
    rMean = 123,
    ...
)
from yade.params.table import *
###
now you can use rMean variable (imported from yade.params.table) which is either the value given from table in batch run or the specified default value in case of plain yade run or if the value in table is not given.

> If I understand correctly, I assume that since I print the value in
the stopUnloading part if it run properly it would print the porosity
into the log files

Yes

Cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.