Skip to content

Commit d44cbcf

Browse files
committed
fixed nodal averaging for mixed elements
1 parent 3bc0998 commit d44cbcf

17 files changed

+52654
-52285
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pyansys
22
=======
33
This Python module allows you to:
4-
- Interactively control an instance of ANSYS using Python. Linux only (for now)
4+
- Interactively control an instance of ANSYS using Python. Linux only (for now).
55
- Extract data from ANSYS files and to display them if ``VTK`` is installed.
66
- Read in result ``(.rst)``, mass and stiffness ``(.full)``, and block archive ``(.cdb)`` files.
77

doc/ansys_control.rst

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,62 @@ Additionally, each function with the ANSYS class has help associated within it.
148148
same number will be redefined. Keypoints may be redefined only if it
149149
is not yet attached to a line or is not yet meshed. Solid modeling in
150150
a toroidal system is not recommended.
151-
151+
152+
153+
Translating Scripts
154+
-------------------
155+
Existing ANSYS scripts can be translated using:
156+
157+
.. code:: python
158+
159+
import pyansys
160+
161+
inputfile = 'ansys_inputfile.inp'
162+
pyscript = 'pyscript.py'
163+
pyansys.ConvertFile(inputfile, pyscript)
164+
165+
For example, verification file vm1.dat:
166+
167+
.. code::
168+
169+
/VERIFY,VM1
170+
/PREP7
171+
/TITLE, VM1, STATICALLY INDETERMINATE REACTION FORCE ANALYSIS
172+
C*** STR. OF MATL., TIMOSHENKO, PART 1, 3RD ED., PAGE 26, PROB.10
173+
ANTYPE,STATIC ! STATIC ANALYSIS
174+
ET,1,LINK180
175+
SECTYPE,1,LINK
176+
SECDATA,1 ! CROSS SECTIONAL AREA (ARBITRARY) = 1
177+
MP,EX,1,30E6
178+
N,1
179+
N,2,,4
180+
N,3,,7
181+
N,4,,10
182+
E,1,2 ! DEFINE ELEMENTS
183+
184+
Translates to:
185+
186+
.. code:: python
187+
188+
import pyansys
189+
ansys = pyansys.ANSYS(loglevel="debug")
190+
191+
ansys.RunCommand("/VERIFY,VM1")
192+
ansys.RunCommand("/PREP7")
193+
ansys.RunCommand("/TITLE, VM1, STATICALLY INDETERMINATE REACTION FORCE ANALYSIS")
194+
ansys.RunCommand("C*** STR. OF MATL., TIMOSHENKO, PART 1, 3RD ED., PAGE 26, PROB.10")
195+
ansys.Antype("STATIC ! STATIC ANALYSIS")
196+
ansys.Et(1, "LINK180")
197+
ansys.Sectype(1, "LINK")
198+
ansys.Secdata("1 ! CROSS SECTIONAL AREA (ARBITRARY) = 1")
199+
ansys.Mp("EX", 1, 30E6)
200+
ansys.N(1)
201+
ansys.N(2, "", 4)
202+
ansys.N(3, "", 7)
203+
ansys.N(4, "", 10)
204+
ansys.E(1, "2 ! DEFINE ELEMENTS")
205+
206+
Some of the commands with ``/`` are not directly translated to functions and are instead run as commands. See the following Caveats and Notes section for more details.
152207

153208
Caveats and Notes
154209
-----------------

pyansys/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
from pyansys.binary_reader import FullReader
66
from pyansys.cellquality import *
77
from pyansys.ansys import ANSYS
8+
from pyansys.convert import ConvertFile

pyansys/_cellqual.pxd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from libc.stdint cimport int32_t, int64_t
2+
3+
cdef inline double HexLinJac(int64_t [::1] cellarr, int c, double [:, ::1] pts) nogil
4+

pyansys/cython/_cellqual.pyx renamed to pyansys/_cellqual.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,8 @@ cdef inline double WegLinJac(int64_t [::1] cellarr, int c,
242242
return jac
243243

244244

245-
cdef inline double HexLinJac(int64_t [::1] cellarr, int c,
246-
double [:, ::1] pts) nogil:
245+
cdef inline double HexLinJac(int64_t [::1] cellarr, int c, double [:, ::1] pts) nogil:
247246
""" Returns minimum scaled jacobian of a hexahedrals cell's edge nodes """
248-
249247
cdef int indS, ind0, ind1, ind2
250248

251249
cdef double [3] e0
@@ -268,7 +266,7 @@ cdef inline double HexLinJac(int64_t [::1] cellarr, int c,
268266
e2[j] = pts[ind2, j] - pts[indS, j]
269267

270268
# normalize the determinant of the jacobian
271-
tnorm = (NormCalc(e0)*NormCalc(e1)*NormCalc(e2))
269+
tnorm = NormCalc(e0)*NormCalc(e1)*NormCalc(e2)
272270
normjac = TripleProduct(e1, e2, e0)/tnorm
273271

274272
# Track minimum jacobian

pyansys/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# major, minor, patch
2-
version_info = 0, 25, 0
2+
version_info = 0, 26, 0
33

44
# Nice string for the version
55
__version__ = '.'.join(map(str, version_info))

0 commit comments

Comments
 (0)