ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
423 stars 120 forks source link

MAPDL command 'lsread' not working in ansys.mapdl #1354

Closed agrishin closed 2 years ago

agrishin commented 2 years ago

When issuing command mapd.run('lsread,1') or mapdl.lsread(1), message feedback says

"READ ANSYS LOADS DATA FROM FILE = file.s01"

This looks correct, but the command clearly doesn't get executed, as can be verified with a subsequent:

mapdl.run('flist')

which produces the following output:

*** NOTE ***
No nodal forces to list.

Below is a small test script which builds a flat plate, writes out one load step, and then fails to read that load step from file:

from ansys.mapdl.core import launch_mapdl
import numpy as np
import sys,os

mapdl = launch_mapdl(run_location=fpath,override=True)
mapdl.prep7()
#build a 5 x 5 flat plate out of shell181 elements...
mapdl.run('rect,0,5,0,5')
mapdl.run('et,1,shell181')
mapdl.run('mp,ex,1,10.0e5')
mapdl.run('sect,1,shell')
mapdl.run('secdata,0.1')    #0.1 thick
mapdl.run('esize,1')
mapdl.run('amesh,all')
mapdl.run('d,node(0,0,0),all')  #fix at corner 1
mapdl.run('d,node(0,5,0),all')  #fix at corner 2
mapdl.run('d,node(5,5,0),all')  #fix at corner 3
mapdl.run('d,node(5,0,0),all')  #fix at corner 4
mapdl.run('/solu')
mapdl.run('antype,static')
mapdl.run('f,node(2,2,0),fz,-10')   #define force at (2,2,0)
mapdl.run('lswrite,1')      #write load out as load step 1
mapdl.run('fdele,all,all')  #delete all loads
mapdl.run('ddele,all,all')  #delete all disps
mapdl.run('lsread,1')   #read load step 1. This doesn't work!
mapdl.run('flist')  #list all loads
akaszynski commented 2 years ago

Try running this command "non-interactively" with:

with mapdl.non_interactive:
    mapd.run('lsread,1')

@germa89, we need to add this command to our current non-interactive commands. If I don't close this out for the next patch release please assign yourself.

germa89 commented 2 years ago

Interesting... I don't see a reason for this command to not work. Pinging @FredAns for possible inputs.

akaszynski commented 2 years ago

@germa89, my fix works. We just need to ensure that we always run LSREAD in non_interactive mode.

For reference:

from ansys.mapdl.core import launch_mapdl
import numpy as np
import sys,os

mapdl = launch_mapdl()
mapdl.prep7()
#build a 5 x 5 flat plate out of shell181 elements...
mapdl.run('rect,0,5,0,5')
mapdl.run('et,1,shell181')
mapdl.run('mp,ex,1,10.0e5')
mapdl.run('sect,1,shell')
mapdl.run('secdata,0.1')    #0.1 thick
mapdl.run('esize,1')
mapdl.run('amesh,all')
mapdl.run('d,node(0,0,0),all')  #fix at corner 1
mapdl.run('d,node(0,5,0),all')  #fix at corner 2
mapdl.run('d,node(5,5,0),all')  #fix at corner 3
mapdl.run('d,node(5,0,0),all')  #fix at corner 4
mapdl.run('/solu')
mapdl.run('antype,static')
mapdl.run('f,node(2,2,0),fz,-10')   #define force at (2,2,0)
mapdl.run('lswrite,1')      #write load out as load step 1
mapdl.run('fdele,all,all')  #delete all loads
mapdl.run('ddele,all,all')  #delete all disps
with mapdl.non_interactive:
    mapdl.run('lsread,1')   #read load step 1. This doesn't work!
mapdl.run('flist')  #list all loads
LIST NODAL FORCES FOR SELECTED NODES         1 TO       36 BY        1
 CURRENTLY SELECTED NODAL LOAD SET= FX   FY   FZ   MX   MY   MZ  

 *** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE 2022 R2          22.2     ***
 Ansys Mechanical Enterprise                       
 00000000  VERSION=LINUX x64     10:15:14  AUG 22, 2022 CP=      0.561

    NODE  LABEL     REAL           IMAG
       26  FZ     -10.0000000      0.00000000
germa89 commented 2 years ago

By the way, thank you @agrishin for the very detailed and reproducible issue. It is VERY appreciated.

akaszynski commented 2 years ago

Solved as of #1384.

agrishin commented 1 year ago

Ok. That works. Thanks guys. I’ll forward to the customer (Costas V. at Honeywell)…

Alex Grishin, PhD Consulting Engineer PADT, Inc. www.padtinc.com 480-813-4884 x133 @.***

Simulation – Product Development – Rapid Prototyping

CONFIDENTIALITY NOTICE: This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. Unless you are the intended recipient, you are hereby notified that copying, forwarding, printing or otherwise disseminating the information contained in or attached to this e-mail is strictly prohibited. If you are not the intended recipient, please notify the sender by telephone, and immediately and permanently delete and destroy all copies and printouts of this e-mail message and/or attachments.

From: Alex Kaszynski @.> Sent: Monday, August 15, 2022 2:42 PM To: pyansys/pymapdl @.> Cc: Alex Grishin @.>; Author @.> Subject: Re: [pyansys/pymapdl] MAPDL command 'lsread' not working in ansys.mapdl (Issue #1354)

Try running this command "non-interactively" with:

with mapdl.non_interactive:

mapd.run('lsread,1')

@germa89https://github.com/germa89, we need to add this command to our current non-interactive commands. If I don't close this out for the next patch release please assign yourself.

— Reply to this email directly, view it on GitHubhttps://github.com/pyansys/pymapdl/issues/1354#issuecomment-1215885534, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB4ZO25BJ3Q4V2JOVNLQ4KTVZK2R3ANCNFSM56TRG6YA. You are receiving this because you authored the thread.Message ID: @.**@.>>