Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandeled exception when using get_value to retrieve 'twsi' values. #2772

Closed
4 tasks done
mikerife opened this issue Feb 13, 2024 · 6 comments · Fixed by #2773
Closed
4 tasks done

Unhandeled exception when using get_value to retrieve 'twsi' values. #2772

mikerife opened this issue Feb 13, 2024 · 6 comments · Fixed by #2773
Assignees

Comments

@mikerife
Copy link

🤓 Before submitting the issue

🔍 Description of the bug

Using the following results in an unhandled error (uncaught exception):

FC3 = mapdl.get_value("NODE", 9, "S", "TWSI")

Can use the following as a work-around:

mapdl.run("*get,fc3,node,9,s,twsi")
FC3 = mapdl.parameters["FC3"]

🕵️ Steps To Reproduce

from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(loglevel="WARNING", print_com=True)

mapdl.units("bin")

# parameters
# loading
F_1 = 10_000

# geometric
L_1 = 10
w_1 = 1
h_1 = 2

# material
EXX_1 = 30E6
PR_1 = 0
SXf = 25_000
SXYf = 500

mapdl.prep7()

# 8 NODE LAYERED SHELL
mapdl.et(1, "SHELL281")
# STORE RESULTS FOR ALL LAYERS
mapdl.keyopt(1, 8, 2)
# define the four layers of the section
mapdl.sectype(1, "SHELL")
mapdl.secdata(h_1/4, 1, 0, 5, "LAYER1")
mapdl.secdata(h_1/4, 1, 0, 5, "LAYER2")
mapdl.secdata(h_1/4, 1, 0, 5, "LAYER3")
mapdl.secdata(h_1/4, 1, 0, 5, "LAYER4")

# material model
mapdl.mp("EX", 1, EXX_1)
mapdl.mp("NUXY", 1, PR_1)

# use FC command to INPUT  FAILURE STRESSES FOR MATERIAL 1
# COMPRESSION VALUES ARE LEFT TO DEFAULT
mapdl.fc(1, "TEMP")
mapdl.fc(1, "S", "XTEN", SXf)
mapdl.fc(1, "S", "XCMP", -SXf)
mapdl.fc(1, "S", "YTEN", 3000)
mapdl.fc(1, "S", "YCMP", -3000)
mapdl.fc(1, "S", "ZTEN", 5000)
mapdl.fc(1, "S", "ZCMP", -5000)
mapdl.fc(1, "S", "XY", SXYf)
mapdl.fc(1, "S", "YZ", SXYf)
mapdl.fc(1, "S", "XZ", SXYf)
mapdl.fc(1, "S", "XYCP")
mapdl.fc(1, "S", "YZCP")
mapdl.fc(1, "S", "XZCP")

# create nodes
mapdl.n(1)
mapdl.n(3, "", 1)
mapdl.fill()
mapdl.ngen(11, 3, 1, 3, 1, 1)

# create elements
mapdl.e(1, 7, 9, 3, 4, 8, 6, 2)
mapdl.egen(5, 6, -1)

# COUPLE FREE END NODES
mapdl.nsel("S", "LOC", "X", L_1)
mapdl.cp(1, "UZ", "ALL")
mapdl.nsel("ALL")

mapdl.finish()

mapdl.slashsolu()
mapdl.antype("STATIC")
mapdl.time(1)

# SELECT NODES AT FIXED END AND CONSTRAIN
mapdl.nsel("S", "LOC", "X")
mapdl.d("ALL", "ALL")

# APPLY END FORCE
mapdl.nsel("S", "LOC", "X", L_1)
mapdl.nsel("R", "LOC", "Y", 0)
mapdl.f("ALL", "FZ", F_1)

mapdl.outres('all', 'all')

mapdl.solve()
mapdl.finish()

mapdl.post1()
mapdl.set('last')

# use element tables to gather stress results
mapdl.etable("SXZ", "S", "XZ")  # STRESS ALONG XZ
mapdl.etable("ILSXZ", "SMISC", 68)  # SXZ INTERLAMINAR SHEAR STRESS
mapdl.etable("ILMX", "SMISC", 60)  # INTERLAMINAR SHEAR STRESS VECTOR SUM

SIGXZ1 = mapdl.get_value("ELEM", 4, "ETAB", "SXZ")
SIGXZ2 = mapdl.get_value("ELEM", 1, "ETAB", "ILSXZ")
SIGXZ3 = mapdl.get_value("ELEM", 1, "ETAB", "ILMX")

mapdl.esel("S", "ELEM", "", 1)
mapdl.nsle("S")
mapdl.layer("FCMAX")
# FC3 = mapdl.get_value("NODE", 9, "S", "TWSI")
mapdl.run("*get,fc3,node,9,s,twsi")
FC3 = mapdl.parameters["FC3"]
mapdl.allsel("ALL")

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.10

📝 PyMAPDL Report

Show the Report!

# PASTE HERE THE OUTPUT OF `python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"` here

📝 Installed packages

Show the installed packages!

# PASTE HERE THE OUTPUT OF `python -m pip freeze` here

📝 Logger output file

Show the logger output file.

# PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE.

@germa89
Copy link
Collaborator

germa89 commented Feb 13, 2024

I see the error:


 *** WARNING ***                         CP =      17.192   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 *** WARNING ***                         CP =      17.192   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 *** WARNING ***                         CP =      17.193   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 *** WARNING ***                         CP =      17.193   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 *** WARNING ***                         CP =      17.193   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 *** WARNING ***                         CP =      17.193   TIME= 11:37:20
 Material for this node can not be determined.  No failure criteria      
 calculations done at this node in POST1.                                

 ************************************************************************
 The number of ERROR and WARNING messages exceeds 20.                    
 Additional messages suppressed.  See ( /local/simulation/file.err )     
 for suppressed messages.                                                
 ************************************************************************

 *GET  __TEMP__  FROM  NODE      9  ITEM=S    TWSI  VALUE=  225.000000

but surprisingly the value is correct 225.00.

I am not sure how to get rid of the warnings without silence them forever.

@germa89 germa89 mentioned this issue Feb 13, 2024
@germa89 germa89 self-assigned this Feb 13, 2024
@germa89 germa89 added the BUG label Feb 13, 2024
@germa89
Copy link
Collaborator

germa89 commented Feb 13, 2024

@mikerife @koubaa

I have a question regarding design:

If my model is clear (no nodes defined), the following query (get maximum define node ID):

mapdl.get_value("node", 0, "num", "maxd")

should:
a) Return 0.0?
b) Raise a No nodes defined error?

It should be noticed that MAPDL prints already a NOTE message:

There are no NODES defined

@mikerife
Copy link
Author

@mikerife @koubaa

I have a question regarding design:

If my model is clear (no nodes defined), the following query (get maximum define node ID):

mapdl.get_value("node", 0, "num", "maxd")

should: a) Return 0.0? b) Raise a No nodes defined error?

It should be noticed that MAPDL prints already a NOTE message:

There are no NODES defined

I would prefer that 0.0 be returned but also keep the Note message.

@germa89
Copy link
Collaborator

germa89 commented Feb 13, 2024

How to keep the note message? We currently dont store any.

There are about 3 type of messages in MAPDL (error, warning and note), which we have, quite relaxed, related them to:

MAPDL PyMAPDL
Error Exception
Warning Warning
Note Nothing

But as I said, this relationship is not enforced 1-to-1. Because MAPDL behaviour on Error is not very standarized. Some errors make MAPDL to exit, sometimes, it just keep going. Some errors are very redundant.

I feel I should probably enforce the following:

MAPDL PyMAPDL
Error Exception
Warning Warning
Note print

But I think it could make PyMAPDL very verbose.

Other option could be trying to parse everything from MAPDL and create a sort of message queue. We can raise errors from there, and let the user check this queue for the rest of the messages.
But, MAPDL messages are not super standardised (sometimes you don't know when the error message ends).

@mikerife
Copy link
Author

@germa89
Adding a "FCTYP,ADD,TWSI" to the input file is the...more correct approach and does away with the issue. Sorry I missed that yesterday. Thing to watch out for is FCTYP is a post processing command while FC can be used in either /prep7 or /post1. I prefer to keep commands together that act together, if possible, so I redid the script and moved the FC to post processing and now the script runs as expected.
MIke

@germa89
Copy link
Collaborator

germa89 commented Feb 13, 2024

Let's keep approach A.

But definitely, this question about the messsages will keep popping up in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants