Skip to content

Commit

Permalink
fixed nodal averaging for mixed elements
Browse files Browse the repository at this point in the history
  • Loading branch information
akaszynski committed Mar 17, 2018
1 parent 3bc0998 commit d44cbcf
Show file tree
Hide file tree
Showing 17 changed files with 52,654 additions and 52,285 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pyansys
=======
This Python module allows you to:
- Interactively control an instance of ANSYS using Python. Linux only (for now)
- Interactively control an instance of ANSYS using Python. Linux only (for now).
- Extract data from ANSYS files and to display them if ``VTK`` is installed.
- Read in result ``(.rst)``, mass and stiffness ``(.full)``, and block archive ``(.cdb)`` files.

Expand Down
57 changes: 56 additions & 1 deletion doc/ansys_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,62 @@ Additionally, each function with the ANSYS class has help associated within it.
same number will be redefined. Keypoints may be redefined only if it
is not yet attached to a line or is not yet meshed. Solid modeling in
a toroidal system is not recommended.
Translating Scripts
-------------------
Existing ANSYS scripts can be translated using:

.. code:: python
import pyansys
inputfile = 'ansys_inputfile.inp'
pyscript = 'pyscript.py'
pyansys.ConvertFile(inputfile, pyscript)
For example, verification file vm1.dat:

.. code::
/VERIFY,VM1
/PREP7
/TITLE, VM1, STATICALLY INDETERMINATE REACTION FORCE ANALYSIS
C*** STR. OF MATL., TIMOSHENKO, PART 1, 3RD ED., PAGE 26, PROB.10
ANTYPE,STATIC ! STATIC ANALYSIS
ET,1,LINK180
SECTYPE,1,LINK
SECDATA,1 ! CROSS SECTIONAL AREA (ARBITRARY) = 1
MP,EX,1,30E6
N,1
N,2,,4
N,3,,7
N,4,,10
E,1,2 ! DEFINE ELEMENTS
Translates to:

.. code:: python
import pyansys
ansys = pyansys.ANSYS(loglevel="debug")
ansys.RunCommand("/VERIFY,VM1")
ansys.RunCommand("/PREP7")
ansys.RunCommand("/TITLE, VM1, STATICALLY INDETERMINATE REACTION FORCE ANALYSIS")
ansys.RunCommand("C*** STR. OF MATL., TIMOSHENKO, PART 1, 3RD ED., PAGE 26, PROB.10")
ansys.Antype("STATIC ! STATIC ANALYSIS")
ansys.Et(1, "LINK180")
ansys.Sectype(1, "LINK")
ansys.Secdata("1 ! CROSS SECTIONAL AREA (ARBITRARY) = 1")
ansys.Mp("EX", 1, 30E6)
ansys.N(1)
ansys.N(2, "", 4)
ansys.N(3, "", 7)
ansys.N(4, "", 10)
ansys.E(1, "2 ! DEFINE ELEMENTS")
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.

Caveats and Notes
-----------------
Expand Down
1 change: 1 addition & 0 deletions pyansys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from pyansys.binary_reader import FullReader
from pyansys.cellquality import *
from pyansys.ansys import ANSYS
from pyansys.convert import ConvertFile
4 changes: 4 additions & 0 deletions pyansys/_cellqual.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from libc.stdint cimport int32_t, int64_t

cdef inline double HexLinJac(int64_t [::1] cellarr, int c, double [:, ::1] pts) nogil

6 changes: 2 additions & 4 deletions pyansys/cython/_cellqual.pyx → pyansys/_cellqual.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ cdef inline double WegLinJac(int64_t [::1] cellarr, int c,
return jac


cdef inline double HexLinJac(int64_t [::1] cellarr, int c,
double [:, ::1] pts) nogil:
cdef inline double HexLinJac(int64_t [::1] cellarr, int c, double [:, ::1] pts) nogil:
""" Returns minimum scaled jacobian of a hexahedrals cell's edge nodes """

cdef int indS, ind0, ind1, ind2

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

# normalize the determinant of the jacobian
tnorm = (NormCalc(e0)*NormCalc(e1)*NormCalc(e2))
tnorm = NormCalc(e0)*NormCalc(e1)*NormCalc(e2)
normjac = TripleProduct(e1, e2, e0)/tnorm

# Track minimum jacobian
Expand Down
2 changes: 1 addition & 1 deletion pyansys/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# major, minor, patch
version_info = 0, 25, 0
version_info = 0, 26, 0

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

0 comments on commit d44cbcf

Please sign in to comment.