From 1acc8684692927c8c5c6e7fb0a4f722153bab8ad Mon Sep 17 00:00:00 2001 From: zhangzhanqun Date: Mon, 11 Sep 2023 13:46:54 +0800 Subject: [PATCH 1/2] 1.update em_randles_batmat,2.correct opt for rigidwall_motion,3.increment define_function/curve ID --- docker/pre/README.rst | 2 +- src/ansys/dyna/core/pre/dynabase.py | 13 ++++++------- src/ansys/dyna/core/pre/dynaem.py | 6 ++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docker/pre/README.rst b/docker/pre/README.rst index de641e457..1e9334ed5 100644 --- a/docker/pre/README.rst +++ b/docker/pre/README.rst @@ -25,7 +25,7 @@ Prerequisites instructions from `this page `_. * Download the latest Linux release artifacts for the ``pre`` Docker container: - `linux-binaries.zip `_. + `linux-binaries.zip `_. * Move this ZIP file to the ``docker/pre`` directory. diff --git a/src/ansys/dyna/core/pre/dynabase.py b/src/ansys/dyna/core/pre/dynabase.py index c97c8ad53..cfda404be 100644 --- a/src/ansys/dyna/core/pre/dynabase.py +++ b/src/ansys/dyna/core/pre/dynabase.py @@ -13,12 +13,15 @@ from ansys.api.dyna.v0.kwprocess_pb2 import * # noqa : F403 from ansys.api.dyna.v0.kwprocess_pb2_grpc import * # noqa : F403 - class Motion(Enum): VELOCITY = 0 ACCELERATION = 1 DISPLACEMENT = 2 +class RWMotion(Enum): + VELOCITY = 0 + DISPLACEMENT = 1 + class DOF(Enum): X_TRANSLATIONAL = 1 @@ -2528,13 +2531,11 @@ def __init__(self, tail=Point(0, 0, 0), head=Point(0, 0, 0), radius=1, length=10 self.lcid = 0 self.dir = Direction(1, 0, 0) - def set_motion(self, curve, motion=Motion.VELOCITY, dir=Direction(1, 0, 0)): + def set_motion(self, curve, motion=RWMotion.VELOCITY, dir=Direction(1, 0, 0)): """Set the prescribed motion.""" curve.create(self.stub) self.lcid = curve.id self.motion = motion.value - if self.motion == Motion.DISPLACEMENT: - self.motion = 1 self.dir = dir def create(self): @@ -2589,13 +2590,11 @@ def __init__(self, center=Point(0, 0, 0), orient=Point(0, 0, 0), radius=1): self.lcid = 0 self.dir = Direction(1, 0, 0) - def set_motion(self, curve, motion=Motion.VELOCITY, dir=Direction(1, 0, 0)): + def set_motion(self, curve, motion=RWMotion.VELOCITY, dir=Direction(1, 0, 0)): """Set the prescribed motion.""" curve.create(self.stub) self.lcid = curve.id self.motion = motion.value - if self.motion == Motion.DISPLACEMENT: - self.motion = 1 self.dir = dir def create(self): diff --git a/src/ansys/dyna/core/pre/dynaem.py b/src/ansys/dyna/core/pre/dynaem.py index 63b405e2b..3ce911995 100644 --- a/src/ansys/dyna/core/pre/dynaem.py +++ b/src/ansys/dyna/core/pre/dynaem.py @@ -808,9 +808,11 @@ def create(self): """Set parameter for Randles Cell.""" if self.define_batmac: sid = 0 + soutouid = 0 if self.psid is not None: sid = self.psid.create(self.stub) - soctou = self.soctou.create(self.stub) + if self.soctou is not None: + soutouid = self.soctou.create(self.stub) modified_prm = [] for par in self.prm: if type(par) == float: @@ -826,7 +828,7 @@ def create(self): q=self.q, cq=self.cq, socinit=self.socinit, - soctou=soctou, + soctou=soutouid, chargedirparam=modified_prm, temp=self.temp, frther=self.frther, From 34da2702e561bc25fe847cacdbdc251ee1830507 Mon Sep 17 00:00:00 2001 From: zhangzhanqun Date: Mon, 11 Sep 2023 13:53:25 +0800 Subject: [PATCH 2/2] reformat code --- src/ansys/dyna/core/pre/dynabase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ansys/dyna/core/pre/dynabase.py b/src/ansys/dyna/core/pre/dynabase.py index cfda404be..55dca7f4a 100644 --- a/src/ansys/dyna/core/pre/dynabase.py +++ b/src/ansys/dyna/core/pre/dynabase.py @@ -13,11 +13,13 @@ from ansys.api.dyna.v0.kwprocess_pb2 import * # noqa : F403 from ansys.api.dyna.v0.kwprocess_pb2_grpc import * # noqa : F403 + class Motion(Enum): VELOCITY = 0 ACCELERATION = 1 DISPLACEMENT = 2 + class RWMotion(Enum): VELOCITY = 0 DISPLACEMENT = 1