ansys / pymapdl

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

Hello, is there any method to calculate #3085

Closed Capedvilla closed 1 month ago

Capedvilla commented 1 month ago

πŸ€“ Before submitting the issue

πŸ” Description of the bug

Here is the code of ansys apdl:

FINISH
/SOLU
ANTYPE,TRANS
TRNOPT,FULL

lumpm,off 
*dim,aceX,table,751,1 
*creat,ei_wv
*vread,aceX(1,1),Imva10_acc,txt,,1 
(f14.9) 
*vread,aceX(1,0),Imva10_t,txt,,1 
(f5.2) 
aceX(0,1)=1 
*end 
/input,ei_wv

TM_START=0.02
TM_END=1
TM_INCR=0.02

*DO,TM,TM_START,TM_END,TM_INCR 
TIME,TM 

KBC,0       
NSUB,1   

ACEL,,aceX(TM),
allsel
SOLVE 
*ENDDO

finish

I want translate it in pymapdl , here is what I facing:

mapdl.finish()

# Enter solution mode
mapdl.run("/SOLU")
mapdl.antype('TRANS')
mapdl.trnopt('FULL')
mapdl.kbc(0)  # Linear ramping of loading
# Importing acceleration data
mapdl.lumpm('OFF')

acceleration_data = np.loadtxt('Imva10_acc.txt')
time_data = np.loadtxt('Imva10_t.txt')

earthquake_data = np.column_stack((time_data, acceleration_data))

mapdl.load_table('earthquake_jiasudu_apdl', earthquake_data, 'TIME')
print(mapdl.parameters['earthquake_jiasudu_apdl'])

mapdl.parameters["aceX"] = earthquake_data
mapdl.parameters["acc"] = acceleration_data

# Analysis setup
tm_start = 0.02
tm_end = 1
tm_incr = 0.02

for tm in np.arange(tm_start, tm_end+tm_incr , tm_incr):
    mapdl.time(tm)
    mapdl.kbc(0)  # Linear ramping of loading
    mapdl.nsubst(1)  # Setting number of substeps
    mapdl.acel(['',mapdl.parameters['earthquake_jiasudu_apdl'][tm],''])
    mapdl.allsel()
    mapdl.solve()

mapdl.finish()

The mapdl.acel seems not easy to apply, in apdl there is aceX(TM), which seems not the accelerate data, how can I do

πŸ•΅οΈ Steps To Reproduce

The log will automatically be formatted as Python code! No need to type backticks.

πŸ’» Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.9

πŸ’Ύ Which MAPDL version are you using?

2021R1

πŸ“ PyMAPDL Report

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

πŸ“ Installed packages

Show the installed packages! ```text # PASTE HERE THE OUTPUT OF `python -m pip freeze` here ```

πŸ“ Logger output file

Show the logger output file. ```text # PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE. ```