Skip to content

Commit dc8c549

Browse files
committed
Merge branch 'main' into release/0.4
2 parents b557ee8 + fbdbcad commit dc8c549

File tree

15 files changed

+363
-5526
lines changed

15 files changed

+363
-5526
lines changed

.github/workflows/ci_cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
python -m pip install .[doc]
6363
6464
- name: "Login to GitHub container registry"
65-
uses: docker/login-action@v2
65+
uses: docker/login-action@v3
6666
with:
6767
registry: ghcr.io
6868
username: ${{ github.actor }}
@@ -151,7 +151,7 @@ jobs:
151151
cache-dependency-path: 'pyproject.toml'
152152

153153
- name: "Login to GitHub container registry"
154-
uses: docker/login-action@v2
154+
uses: docker/login-action@v3
155155
with:
156156
registry: ghcr.io
157157
username: ${{ github.actor }}

README.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
PyDYNA
2-
========
2+
======
3+
4+
.. readme_start
5+
36
|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black|
47

58
.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
@@ -85,7 +88,7 @@ License
8588
=======
8689
PyDYNA is licensed under the MIT license.
8790

88-
PyDYNA makes no commercial claim over Ansys whatsoever. This libray extends the functionality of
91+
PyDYNA makes no commercial claim over Ansys whatsoever. This library extends the functionality of
8992
Ansys LS-DYNA by adding a Python interface to LS-DYNA without changing the core behavior or
9093
license of the original software. The use of the interactive control of PyDYNA requires a legally
9194
licensed local copy of LS-DYNA.

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PyDYNA documentation |version|
22
===============================
33

44
.. include:: ../../README.rst
5-
5+
:start-after: .. readme_start
66

77
.. jinja:: main_toctree
88

docker/pre/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Prerequisites
2525
instructions from `this page <https://docs.docker.com/engine/install/>`_.
2626

2727
* Download the latest Linux release artifacts for the ``pre`` Docker container:
28-
`linux-binaries.zip <https://github.com/ansys/pydyna/releases/download/v0.3.5/linux-binaries.zip>`_.
28+
`linux-binaries.zip <https://github.com/ansys/pydyna/releases/download/v0.4.2/linux-binaries.zip>`_.
2929

3030
* Move this ZIP file to the ``docker/pre`` directory.
3131

docker/solver/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ COPY mpi /opt/openmpi
8585
# ifort runtime libraries in /ansys_inc/lib
8686

8787
COPY docker_dir /ansys_inc
88+
RUN chmod 755 /ansys_inc/server.py

docker/solver/README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Prerequisites
2525
instructions from `this page <https://docs.docker.com/engine/install/>`_.
2626

2727
* Download the latest Linux release artifacts for the ``solver`` Docker container:
28-
`mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.3.5/mppdyna_docker_centos7.zip>`_.
28+
`mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.4.2/mppdyna_docker_centos7.zip>`_.
2929

3030
* Move this ZIP file to the ``docker/solver`` directory and unzip it in the same directory.
3131

@@ -35,6 +35,10 @@ Prerequisites
3535
3636
>>> Dockerfile README.rst do_build docker-compose.yml docker_dir mpi mppdyna_docker_centos7.zip
3737
38+
* Within docker_dir, there is a file called mppdyna. This file is the executable to run. It can be
39+
any executable (SMP, MPP) or revision and branch. To run a given file, the name shall be changed to
40+
mppdyna and copied inside docker_dir.
41+
3842
Once all prerequisites are met, you can build the Docker image for the ``solver`` service.
3943

4044
Build the Docker image
@@ -101,4 +105,4 @@ To copy files back from the ``solver`` container to your host machine use the co
101105
102106
docker cp <containerId>:/file/path/within/container /host/target/path
103107
104-
The path within the container is ``/rundir``.
108+
The path within the container is ``/rundir``.

docker/solver/do_build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ ssh-keygen -q -b 2048 -f ssh/id_rsa -N ""
88
echo "Host *" > ssh/config
99
echo " StrictHostKeyChecking no" >> ssh/config
1010
#
11+
chmod -R 755 *
12+
#
1113
# Build container
1214
#
1315
docker build -t dyna_solver_v04 .

examples/Explicit/output/ball_plate.k

Lines changed: 0 additions & 5466 deletions
This file was deleted.

pyproject.toml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,48 +27,48 @@ classifiers = [
2727

2828
dependencies = [
2929
"ansys-dpf-core>=0.7.2",
30-
"ansys-api-dyna==0.3.2",
30+
"ansys-api-dyna==0.3.5",
3131
]
3232

3333
[project.optional-dependencies]
3434
tests = [
35-
"pyvista==0.42.0",
36-
"matplotlib==3.7.2",
37-
"numpy==1.25.2",
38-
"pytest==7.4.1",
35+
"pyvista==0.42.3",
36+
"matplotlib==3.8.2",
37+
"numpy==1.26.2",
38+
"pytest==7.4.3",
3939
"pytest-cov==4.1.0",
4040
"joblib==1.3.2",
41-
"pandas==2.0.3",
41+
"pandas==2.1.3",
4242
"openpyxl==3.1.2",
43-
"scikit-learn==1.3.0",
44-
"pytest-xdist==3.3.1",
45-
"ipython==8.15.0",
43+
"scikit-learn==1.3.2",
44+
"pytest-xdist==3.5.0",
45+
"ipython==8.18.1",
4646
]
4747
doc = [
4848
"recommonmark==0.7.1",
49-
"matplotlib==3.7.2",
50-
"imageio==2.31.2",
51-
"imageio-ffmpeg==0.4.8",
52-
"pyvista==0.42.0",
53-
"numpydoc==1.5.0",
54-
"Sphinx==7.2.5",
49+
"matplotlib==3.8.2",
50+
"imageio==2.33.0",
51+
"imageio-ffmpeg==0.4.9",
52+
"pyvista==0.42.3",
53+
"numpydoc==1.6.0",
54+
"Sphinx==7.2.6",
5555
"sphinx-autobuild==2021.3.14",
5656
"sphinxcontrib-websupport==1.2.6",
5757
"pytest-sphinx==0.5.0",
5858
"sphinx-notfound-page==1.0.0",
5959
"sphinx-copybutton==0.5.2",
60-
"sphinx-gallery==0.14.0",
61-
"sphinx-autodoc-typehints==1.24.0",
62-
"ansys-sphinx-theme==0.10.4",
63-
"pypandoc==1.11",
60+
"sphinx-gallery==0.15.0",
61+
"sphinx-autodoc-typehints==1.25.2",
62+
"ansys-sphinx-theme==0.12.5",
63+
"pypandoc==1.12",
6464
"nbsphinx==0.9.3",
65-
"ipywidgets==8.1.0",
65+
"ipywidgets==8.1.1",
6666
"joblib==1.3.2",
67-
"scikit-learn==1.3.0",
68-
"ipython==8.15.0",
69-
"jupyterlab==4.0.5",
67+
"scikit-learn==1.3.2",
68+
"ipython==8.18.1",
69+
"jupyterlab==4.0.9",
7070
"sphinx-jinja==2.0.2",
71-
"sphinx-autoapi==2.1.1",
71+
"sphinx-autoapi==3.0.0",
7272
]
7373

7474
[tool.flit.module]

src/ansys/dyna/core/pre/dynabase.py

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class Motion(Enum):
2020
DISPLACEMENT = 2
2121

2222

23+
class RWMotion(Enum):
24+
VELOCITY = 0
25+
DISPLACEMENT = 1
26+
27+
2328
class DOF(Enum):
2429
X_TRANSLATIONAL = 1
2530
Y_TRANSLATIONAL = 2
@@ -140,12 +145,27 @@ class Function:
140145

141146
def __init__(self, Function=None):
142147
self.function = Function
148+
self.tabulated = False
149+
150+
def set_tabulated(self, heading="", function="", x=[], y=[]):
151+
self.tabulated = True
152+
self.heading = heading
153+
self.function_name = function
154+
self.x = x
155+
self.y = y
143156

144157
def create(self, stub):
145158
"""Create function."""
159+
if self.tabulated:
160+
ret = stub.CreateDefineFunctionTabulated(
161+
DefineFunctionTabulatedRequest(
162+
heading=self.heading, function=self.function_name, abscissa=self.x, ordinate=self.y
163+
)
164+
)
146165
ret = stub.CreateDefineFunction(DefineFunctionRequest(function=self.function))
147166
self.id = ret.id
148167
logging.info(f"Function {self.id} defined...")
168+
149169
return self.id
150170

151171

@@ -763,7 +783,7 @@ def create_general_keyword(self, opcode, keyworddata):
763783
\$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
764784
765785
opcode = "INITIAL_VELOCITY"
766-
keyworddata = "0\\n1.480E+01,0.000E+00,0.000E+00,0.000E+00,0.000E+00,0.000E+00"
786+
keyworddata = "0\n1.480E+01,0.000E+00,0.000E+00,0.000E+00,0.000E+00,0.000E+00"
767787
create_general_keyword(opcode = opcode,keyworddata=keyworddata)
768788
"""
769789
ret = self.stub.CreateGeneralKWD(GeneralKWDRequest(opcode=opcode, keyworddata=keyworddata))
@@ -2224,6 +2244,7 @@ def __init__(self):
22242244
self.spclist = []
22252245
self.imposedmotionlist = []
22262246
self.templist = []
2247+
self.convectionlist = []
22272248

22282249
def create_spc(
22292250
self,
@@ -2305,6 +2326,39 @@ def create_temperature(
23052326
param = [nodeset, curve, scalefactor]
23062327
self.templist.append(param)
23072328

2329+
def create_convection(
2330+
self,
2331+
segmentset=None,
2332+
convection_heat_transfer_coefficient=None,
2333+
convection_heat_transfer_coefficient_multiplier=0.0,
2334+
environment_temperature=None,
2335+
environment_temperature_multiplier=0.0,
2336+
):
2337+
"""Apply a convection boundary condition on SEGMENT_SET for a thermal analysis.
2338+
2339+
Parameters
2340+
----------
2341+
segmentset : SegmentSet.
2342+
Segment set.
2343+
convection_heat_transfer_coefficient : Curve
2344+
Convection heat transfer coefficient.
2345+
convection_heat_transfer_coefficient_multiplier : float
2346+
Curve multiplier for convection heat transfer coefficient.
2347+
environment_temperature : Curve
2348+
Environment temperature.
2349+
environment_temperature_multiplier : float
2350+
Curve multiplier for environment temperature.
2351+
2352+
"""
2353+
param = [
2354+
segmentset,
2355+
convection_heat_transfer_coefficient,
2356+
convection_heat_transfer_coefficient_multiplier,
2357+
environment_temperature,
2358+
environment_temperature_multiplier,
2359+
]
2360+
self.convectionlist.append(param)
2361+
23082362
def create(self):
23092363
"""Create a boundary condition."""
23102364
for obj in self.imposedmotionlist:
@@ -2399,7 +2453,7 @@ def create(self):
23992453
nid = nodeset.create(self.stub)
24002454
option = "SET"
24012455
if curve is not None:
2402-
cid = curve.id
2456+
cid = curve.create(self.stub)
24032457
else:
24042458
cid = 0
24052459
self.stub.CreateBdyTemp(
@@ -2411,6 +2465,19 @@ def create(self):
24112465
)
24122466
)
24132467
logging.info("Boundary Temperature Created...")
2468+
for obj in self.convectionlist:
2469+
ss, hlc, hmult, tlc, tmult = obj[0], obj[1], obj[2], obj[3], obj[4]
2470+
ssid, hlcid, tlcid = 0, 0, 0
2471+
if ss is not None:
2472+
ssid = ss.create(self.stub)
2473+
if hlc is not None:
2474+
hlcid = hlc.create(self.stub)
2475+
if tlc is not None:
2476+
tlcid = tlc.create(self.stub)
2477+
self.stub.CreateBdyConvection(
2478+
BdyConvectionRequest(ssid=ssid, pserod=0, hlcid=hlcid, hmult=hmult, tlcid=tlcid, tmult=tmult, loc=0)
2479+
)
2480+
logging.info("Boundary Convection Created...")
24142481

24152482

24162483
class InitialCondition:
@@ -2528,13 +2595,11 @@ def __init__(self, tail=Point(0, 0, 0), head=Point(0, 0, 0), radius=1, length=10
25282595
self.lcid = 0
25292596
self.dir = Direction(1, 0, 0)
25302597

2531-
def set_motion(self, curve, motion=Motion.VELOCITY, dir=Direction(1, 0, 0)):
2598+
def set_motion(self, curve, motion=RWMotion.VELOCITY, dir=Direction(1, 0, 0)):
25322599
"""Set the prescribed motion."""
25332600
curve.create(self.stub)
25342601
self.lcid = curve.id
25352602
self.motion = motion.value
2536-
if self.motion == Motion.DISPLACEMENT:
2537-
self.motion = 1
25382603
self.dir = dir
25392604

25402605
def create(self):
@@ -2589,13 +2654,11 @@ def __init__(self, center=Point(0, 0, 0), orient=Point(0, 0, 0), radius=1):
25892654
self.lcid = 0
25902655
self.dir = Direction(1, 0, 0)
25912656

2592-
def set_motion(self, curve, motion=Motion.VELOCITY, dir=Direction(1, 0, 0)):
2657+
def set_motion(self, curve, motion=RWMotion.VELOCITY, dir=Direction(1, 0, 0)):
25932658
"""Set the prescribed motion."""
25942659
curve.create(self.stub)
25952660
self.lcid = curve.id
25962661
self.motion = motion.value
2597-
if self.motion == Motion.DISPLACEMENT:
2598-
self.motion = 1
25992662
self.dir = dir
26002663

26012664
def create(self):

0 commit comments

Comments
 (0)