Comments (2)
Here is an example:
from ansys.mapdl.core import launch_mapdl
mapdl= launch_mapdl(additional_switches='-smp')
import numpy as np
ma_Lx=0.03
ma_Ly=0.05
ma_nelx=4
ma_nely=2
xmin=1e-3
p=3
nel_ma=ma_nelx*ma_nely
DH1=[[2.19963816e+11, 6.51264991e+10, -5.36441803e-07],
[ 6.51264991e+10, 2.19963816e+11, 5.36441803e-07],
[ 2.38418579e-07, -3.57627869e-07, 7.62813778e+10]]
elem_list = np.arange(1, nel_ma + 1)
S=np.linalg.inv(DH1)
Ex=1/S[0,0]
Ey=1/S[1,1]
vh=-S[1,0]/S[0,0]
Gh=1/S[2,2]
G2=Ex/(2*(1+vh))
mapdl.clear()
mapdl.prep7()
mapdl.mp("EX",1, Ex)
mapdl.mp("EY",1, Ey)
mapdl.mp("EZ",1, Ex)
mapdl.mp("PRXY",1,vh)
#mapdl2.mp("PRYZ",1,vh)
#mapdl2.mp("PRXZ",1,vh)
mapdl.mp("GXY",1,Gh)
mapdl.mp("GYZ",1,Gh)
mapdl.mp("GXZ",1,Gh)
mapdl.mp("EX",2,xmin**p)
mapdl.mp("PRXY",2,vh)
mapdl.et(1,"PLANE42",kop2=1)
mapdl.blc4(0,0,ma_Lx,ma_Ly)
mapdl.mat(1)
mapdl.allsel()
mapdl.lsel("S", "LOC", "X",0)
mapdl.lsel("A", "LOC", "X",ma_Lx)
mapdl.lesize("ALL","","",ma_nely)
mapdl.allsel()
mapdl.lsel("S", "LOC", "Y",0)
mapdl.lsel("A", "LOC", "Y",ma_Ly)
mapdl.lesize("ALL","","",ma_nelx)
mapdl.allsel()
mapdl.amesh("ALL")
F = -100 # downward 100 newton force
mapdl.nsel("S", "LOC", "X",0) # select nodes at x=0
mapdl.d("ALL", "ALL",0) # set all dof of selected nodes to 0
mapdl.allsel() # select all nodes
mapdl.nsel("S", "LOC", "X", ma_Lx) # select nodes at x=len_x
#mapdl.nsel("R", "LOC", "Y", Ly) # select subset of nodes in the y region
mapdl.nsel("R", "LOC", "Y", 0.5*ma_Ly) # select subset of nodes in the y region
mapdl.f("ALL","FY", F) # apply force
mapdl.allsel() # reselect all entities
nel_ma=int(mapdl.get("ELEM_sum","ELEMENT",0,"COUNT"))
nnods_ma=int(mapdl.get("NODE_sum","NODE",0,"COUNT"))
#print("nel=",nel_ma)
#print("nnods=",nnods_ma)
coor_ma = np.copy(mapdl.mesh.nodes[:, [0, 1]]) # coordinates matrix
elem_prop_ma = np.array(mapdl.mesh.elem)
inci_ma= np.copy(elem_prop_ma[:, -4::])
mapdl.run("/SOLU")
mapdl.antype("STATIC")
mapdl.solve()
mapdl.run("/POST1 ") # Post-processor module
# Cálculo del desplazamiento
mapdl.format(20)
U_ma= np.zeros(2*nnods_ma)
mapdl.dim('U_nodal',"ARRAY",nnods_ma,2)
mapdl.starvget('U_nodal(1,1)',"NODE",1,"U","X")
mapdl.starvget('U_nodal(1,2)',"NODE",1,"U","Y")
U1=mapdl.parameters["U_nodal"]
for k in range(1,nnods_ma+1):
U_ma[(2*k)-2]=U1[k-1,0]
U_ma[(2*k)-1]=U1[k-1,1]
From this code I compared the results in the variable U_ma. With the results reported in Ansys: Here is the comparison:
There are significant digits that are lost when I want to collect an Ansys variable to use in Python. Which in this case is displacement. I would like to know how I can increase that number of significant digits, so as not to lose precision, because I must use that offset value for subsequent calculations.
from pymapdl.
Hi @Clauperezma
Can you share a minimum working example? So I can check changes against it?
from pymapdl.
Related Issues (20)
- MAPDL commands do not match API HOT 1
- Large files in the final python package HOT 1
- `sphinx-build` configuration is not being catched
- Failed scheduled build HOT 24
- post_processing.plot_nodal_pressure() fails for CPT element type though data is there.
- On the MSTOLE the two fields with component names seem to require the names be enclosed in single quotes by MAPDL aaS.
- MAPDL server connection terminated when running on linux container HOT 1
- Hello, is there any method to calculate
- In `mapdl.input_strings(cmd)`, if cmd is very long command, it fails with `MapdlExitedError` HOT 3
- Add support for EEMBED and SFCONTROL
- Add support for Solid293 HOT 1
- Add support for new commands for multistage cyclic symmetry and harmonic balance method.
- Revise project metadata to align with PyAnsys standards HOT 1
- Add ML course link to docs
- Node numbering is inconsistent HOT 4
- No dynamic visualization HOT 10
- Using HPC licenses with `MapdlPool` HOT 2
- PyMAPDL should fail if not instances have been launched in MapdlPool
- Use chain_commands in convert_script HOT 1
- PyMapdl crahes/looses connection, when running in a loop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymapdl.