nameerror

Asked by zyz

Hello,all
I am using Ubuntu 16.04LTS, and Yade 20200519-3889~fb69be8~xenial1 using python version: 3.5.2.
I'm a beginner. I'm having some trouble with my studies, which is in Documentation » Tutorial » Setting up a simulation » Parametric studies. The links is https://yade-dem.org/doc/tutorial-geo.html
When I execute the following code, it will continuously prompt a same error. Thank you very much for your help.
-------------------------------------------------------------
utils.readParamsFromTable(damping=.2)
from yade.params import table
NewtonIntegrator(damping=table.damping),
O.engines+=[PyRunner(iterPeriod=1000,command='checkUnbalancedForce()')]
def checkUnbalancedForce():
        if utils.unbalancedForce<0.05:
        utils.saveDataTxt(O.tags['d.id']+'.data.bz2')
        import sys
        sys.exit(0)
O.run()
-------------------------------------------------------------
NameError Traceback(most recent call last)
/usr/bin/yadedaily in <module>()
NameError: name'checkUnbalancedForce' is not defined
--------------------------------------------------------------
NameError Traceback(most recent call last)
/usr/bin/yadedaily in <module>()
NameError: name'checkUnbalancedForce' is not defined
--------------------------------------------------------------
NameError Traceback(most recent call last)
/usr/bin/yadedaily in <module>()
NameError: name'checkUnbalancedForce' is not defined

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
zyz
Solved:
Last query:
Last reply:
Revision history for this message
Chareyre (bruno-chareyre-9) said :
#1

Hi, please provide a script, not a code fragment.
Regards
Bruno

Le sam. 30 mai 2020 05:31, zyz <email address hidden> a
écrit :

> New question #691048 on Yade:
> https://answers.launchpad.net/yade/+question/691048
>
> Hello,all
> I am using Ubuntu 16.04LTS, and Yade 20200519-3889~fb69be8~xenial1 using
> python version: 3.5.2.
> When I execute the following code, it will continuously prompt a same
> error. Thank you very much for your help.
> -------------------------------------------------------------
> utils.readParamsFromTable(damping=.2)
> from yade.params import table
> NewtonIntegrator(damping=table.damping),
> O.engines+=[PyRunner(iterPeriod=1000,command='checkUnbalancedForce()')]
> def checkUnbalancedForce():
> if utils.unbalancedForce<0.05:
> utils.saveDataTxt(O.tags['d.id']+'.data.bz2')
> import sys
> sys.exit(0)
> O.run()
> -------------------------------------------------------------
> NameError
> Traceback(most recent call last)
> /usr/bin/yadedaily in <module>()
> NameError: name'checkUnbalancedForce' is not defined
> --------------------------------------------------------------
> NameError
> Traceback(most recent call last)
> /usr/bin/yadedaily in <module>()
> NameError: name'checkUnbalancedForce' is not defined
> --------------------------------------------------------------
> NameError
> Traceback(most recent call last)
> /usr/bin/yadedaily in <module>()
> NameError: name'checkUnbalancedForce' is not defined
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Jérôme Duriez (jduriez) said :
#2

Hi

Especially after you got a first answer, please never modify your initial question, it makes the discussion completely meaningless to everyone else.

Please review https://www.yade-dem.org/wiki/Howtoask and try to improve your initial script and what you share with us asking for some support. I doubt the above code does output what you say it outputs.

Note that the "NewtonIntegrator(damping=table.damping)," is suspicious as a valid part of a valid YADE script, and that parentheses are missing at the end at utils.unbalancedForce in case you're interested in the returned value and not the function itself.

Revision history for this message
zyz (gscczyz) said :
#3

thank all above!