Skip to content

Commit d11354b

Browse files
committed
Merge branch 'zzqbranch'
2 parents 747a5c5 + 9f4d19b commit d11354b

35 files changed

+1703
-305
lines changed

doc/source/getting-started/SERVER_SOLVER_README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Run an example on the client side
3434
3535
hostname = "localhost"
3636
port = "5000"
37-
dyna=solver.DynaSolver(hostname,port) # connect to the server
37+
dyna=launch_dyna(ip = hostname,port = port) # connect to the server
3838
dyna.push("./output/ball_plate.k") # push an input file
3939
dyna.start_locally(input = "ball_plate.k",nproc=1)
4040

doc/source/getting-started/example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ you can get the Python file from ``examples/solver/ball_plate_solver.py``.
9898
9999
hostname = "localhost"
100100
port = "5000"
101-
dyna=solver.DynaSolver(hostname,port) # connect to the container
101+
dyna=launch_dyna(ip = hostname,port = port) # connect to the container
102102
dyna.push("./output/ball_plate.k") # push an input file
103103
dyna.start(4) # start 4 ranks of mppdyna
104104
dyna.run("i=ball_plate.k memory=10m ncycle=20000") # begin execution

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.4.3/linux-binaries.zip>`_.
28+
`linux-binaries.zip <https://github.com/ansys/pydyna/releases/download/v0.4.6/linux-binaries.zip>`_.
2929

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

docker/solver/Dockerfile

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ LABEL "com.ansys.description"="Ansys MPPDYNA with gRPC server"
1313

1414
# install some missing stuff we want/need
1515

16-
RUN yum -y install openssh-clients openssh-server bind-utils sudo python3
17-
RUN python3 -m pip install --upgrade pip
18-
RUN python3 -m pip install grpcio
19-
RUN python3 -m pip install grpcio-tools
20-
RUN python3 -m pip install protobuf==4.21.0
16+
RUN yum -y install openssh-clients openssh-server bind-utils sudo python3 unzip &>/dev/null && yum clean all
17+
RUN python3 -m pip install --upgrade pip && \
18+
python3 -m pip install grpcio && \
19+
python3 -m pip install grpcio-tools && \
20+
python3 -m pip install protobuf==4.21.0
2121
#
2222
ENV USER mpirun
2323
ENV HOME /home/mpirun
@@ -27,16 +27,15 @@ ENV LSTC_LICENSE_SERVER license
2727
ENV SSHDIR ${HOME}/.ssh
2828

2929

30-
RUN groupadd ${USER}
31-
RUN useradd -g ${USER} -d ${HOME} ${USER} && \
30+
RUN groupadd ${USER} && useradd -g ${USER} -d ${HOME} ${USER} && \
3231
echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
3332
#
34-
RUN mkdir -p /ansys_inc/lib
35-
RUN mkdir -p /rundir
36-
RUN mkdir /var/run/sshd
37-
RUN mkdir -p ${SSHDIR}
38-
RUN chown -R ${USER}:${USER} /rundir
39-
RUN chmod -R 755 /rundir
33+
RUN mkdir -p /ansys_inc/lib && \
34+
mkdir -p /rundir && \
35+
mkdir /var/run/sshd && \
36+
mkdir -p ${SSHDIR} && \
37+
chown -R ${USER}:${USER} /rundir && \
38+
chmod -R 755 /rundir
4039
WORKDIR /rundir
4140

4241
# set up the runtime environment variables for
@@ -73,29 +72,28 @@ RUN echo "export PATH=/opt/openmpi/bin:\${PATH}" >> ${HOME}/.bashrc
7372
#RUN ssh-keygen -A
7473

7574

76-
RUN ssh-keygen -q -b 2048 -f ${SSHDIR}/id_rsa -N ""
77-
RUN chmod 700 ${SSHDIR} && chmod -R 600 ${SSHDIR}/id_rsa
78-
RUN echo "Host *" > ${SSHDIR}/config
79-
RUN echo " StrictHostKeyChecking no" >> ${SSHDIR}/config
80-
RUN cp ${SSHDIR}/id_rsa.pub ${SSHDIR}/authorized_keys
81-
RUN ssh-keygen -A
75+
RUN ssh-keygen -q -b 2048 -f ${SSHDIR}/id_rsa -N "" && \
76+
chmod 700 ${SSHDIR} && chmod -R 600 ${SSHDIR}/id_rsa && \
77+
echo "Host *" > ${SSHDIR}/config && \
78+
echo " StrictHostKeyChecking no" >> ${SSHDIR}/config && \
79+
cp ${SSHDIR}/id_rsa.pub ${SSHDIR}/authorized_keys && \
80+
ssh-keygen -A
8281

8382
RUN chmod -R 600 ${SSHDIR}* && \
84-
chown -R ${USER}:${USER} ${SSHDIR}
85-
86-
RUN chown -R ${USER}:${USER} ${HOME}
83+
chown -R ${USER}:${USER} ${SSHDIR} && \
84+
chown -R ${USER}:${USER} ${HOME}
8785

8886
# Copy the openmpi libraries
8987

90-
RUN yum install -y unzip
9188
COPY mppdyna_docker_centos7.zip .
92-
RUN unzip -qu mppdyna_docker_centos7.zip && rm mppdyna_docker_centos7.zip
93-
RUN mkdir -p /opt/openmpi
94-
RUN cp -r mpi/* /opt/openmpi
95-
RUN chmod -R 777 /opt/openmpi
89+
RUN unzip -qu mppdyna_docker_centos7.zip && \
90+
rm mppdyna_docker_centos7.zip && \
91+
mkdir -p /opt/openmpi && \
92+
cp -r mpi/* /opt/openmpi && \
93+
chmod -R 777 /opt/openmpi && \
9694

9795
# The executable will go in /ansys_inc, and the
9896
# ifort runtime libraries in /ansys_inc/lib
9997

100-
RUN cp -rpu docker_dir/* /ansys_inc/
101-
RUN chmod -R 777 /ansys_inc/
98+
cp -rpu docker_dir/* /ansys_inc/ && \
99+
chmod -R 777 /ansys_inc/

docker/solver/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 ``solver`` Docker container:
28-
`mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.4.3/mppdyna_docker_centos7.zip>`_.
28+
`mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.4.6/mppdyna_docker_centos7.zip>`_.
2929

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.12",
2626
]
2727

28-
dependencies = ["ansys-dpf-core>=0.7.2", "ansys-api-dyna==0.3.5"]
28+
dependencies = ["ansys-dpf-core>=0.7.2", "ansys-api-dyna==0.3.6"]
2929

3030
[project.optional-dependencies]
3131
tests = [

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44

55
from ansys.dyna.core.pre.dynalogging import Logger
6+
from ansys.dyna.core.pre.model import Model
67

78
LOG = Logger(level=logging.ERROR, to_file=False, to_stdout=True)
89
LOG.debug("Loaded logging module as LOG")

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
Module for creating a DYNA input deck.
66
"""
77

8-
# from subprocess import DETACHED_PROCESS
9-
108
from enum import Enum
119
import logging
1210

11+
# from subprocess import DETACHED_PROCESS
12+
from typing import List
13+
1314
from ansys.api.dyna.v0.kwprocess_pb2 import * # noqa : F403
1415
from ansys.api.dyna.v0.kwprocess_pb2_grpc import * # noqa : F403
1516

@@ -277,11 +278,21 @@ def __init__(self):
277278
self.have_hourglass = False
278279
self.have_bulk_viscosity = False
279280
self.have_control_shell = False
281+
# add for drawing entity
282+
self._parent: DynaSolution = None
283+
self.init_velocity: List = None
284+
self.bdy_spc: List = None
280285

281286
def get_stub():
282287
"""Get the stub of the ``DynaBase`` object."""
283288
return DynaBase.stub
284289

290+
def set_parent(self, parent=None):
291+
self._parent = parent
292+
model = self._parent.model
293+
self.boundaryconditions.assign_model(model)
294+
self.initialconditions.assign_model(model)
295+
285296
def set_timestep(self, tssfac=0.9, isdo=0, timestep_size_for_mass_scaled=0.0, max_timestep=None):
286297
"""Set the structural time step size control using different options.
287298
@@ -2245,6 +2256,10 @@ def __init__(self):
22452256
self.imposedmotionlist = []
22462257
self.templist = []
22472258
self.convectionlist = []
2259+
self._model = None
2260+
2261+
def assign_model(self, model):
2262+
self._model = model
22482263

22492264
def create_spc(
22502265
self,
@@ -2273,6 +2288,8 @@ def create_spc(
22732288
"""
22742289
param = [nodeset, tx, ty, tz, rx, ry, rz, cid, birth, death]
22752290
self.spclist.append(param)
2291+
# self.bdy_spc = nodeset.nodes
2292+
self._model.add_bdy_spc(nodeset.nodes)
22762293

22772294
def create_imposed_motion(
22782295
self,
@@ -2488,6 +2505,10 @@ def __init__(self):
24882505
self.velocitylist = []
24892506
self.velocitynodelist = []
24902507
self.temperaturelist = []
2508+
self._model = None
2509+
2510+
def assign_model(self, model):
2511+
self._model = model
24912512

24922513
def create_velocity(
24932514
self,
@@ -2503,6 +2524,8 @@ def create_velocity(
25032524
def create_velocity_node(self, nodeid, trans=Velocity(0, 0, 0), rot=RotVelocity(0, 0, 0)):
25042525
"""Define initial nodal point velocities for a node."""
25052526
self.velocitynodelist.append([nodeid, trans, rot])
2527+
# self.init_velocity.append([nodeid,trans.x,trans.y,trans.z])
2528+
self._model.add_init_velocity([nodeid, trans.x, trans.y, trans.z])
25062529

25072530
def create_temperature(self, nodeset=None, temperature=0):
25082531
"""Create an initial nodal point temperature."""

0 commit comments

Comments
 (0)