Skip to content

Commit 581542f

Browse files
committed
Merge remote-tracking branch 'origin/review'
2 parents 41634b4 + f9bda24 commit 581542f

File tree

2 files changed

+93
-113
lines changed

2 files changed

+93
-113
lines changed

README.rst

Lines changed: 93 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -48,108 +48,110 @@ Here is a basic preprocessing example:
4848
.. code:: python
4949
5050
import os
51-
import sys
52-
from ansys.dyna.core.pre.dynasolution import DynaSolution
53-
from ansys.dyna.core.pre.dynaicfd import (
54-
DynaICFD,
55-
ICFDAnalysis,
56-
MatICFD,
57-
ICFDPart,
58-
ICFDDOF,
59-
Curve,
60-
ICFDVolumePart,
61-
MeshedVolume,
62-
)
63-
from ansys.dyna.core.pre import examples
64-
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/cylinderflow.png'
65-
66-
hostname = "localhost"
67-
if len(sys.argv) > 1:
68-
hostname = sys.argv[1]
69-
70-
icfd_solution = DynaSolution(hostname)
71-
# Import the initial mesh data(nodes and elements)
72-
fns = []
73-
path = os.getcwd()+os.sep
74-
fns.append(path+"cylinder_flow.k")
75-
icfd_solution.open_files(fns)
76-
# Set total time of simulation
77-
icfd_solution.set_termination(termination_time=100)
78-
79-
icfd = DynaICFD()
80-
icfd_solution.add(icfd)
81-
82-
icfdanalysis = ICFDAnalysis()
83-
icfdanalysis.set_timestep()
84-
icfd.add(icfdanalysis)
85-
86-
# define model
87-
mat = MatICFD(flow_density=1.0, dynamic_viscosity=0.005)
88-
89-
part_inflow = ICFDPart(1)
90-
part_inflow.set_material(mat)
91-
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 10000], y=[1, 1]))
92-
part_inflow.set_prescribed_velocity(dof=ICFDDOF.Y, motion=Curve(x=[0, 10000], y=[0, 0]))
93-
icfd.parts.add(part_inflow)
94-
95-
part_outflow = ICFDPart(2)
96-
part_outflow.set_material(mat)
97-
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
98-
icfd.parts.add(part_outflow)
99-
100-
part_symmetric = ICFDPart(3)
101-
part_symmetric.set_material(mat)
102-
part_symmetric.set_free_slip()
103-
icfd.parts.add(part_symmetric)
104-
105-
part_wall = ICFDPart(4)
106-
part_wall.set_material(mat)
107-
part_wall.set_non_slip()
108-
part_wall.compute_drag_force()
109-
part_wall.set_boundary_layer(number=3)
110-
icfd.parts.add(part_wall)
111-
112-
partvol = ICFDVolumePart(surfaces=[1, 2, 3, 4])
113-
partvol.set_material(mat)
114-
icfd.parts.add(partvol)
115-
# define the volume space that will be meshed,The boundaries
116-
# of the volume are the surfaces "spids"
117-
meshvol = MeshedVolume(surfaces=[1, 2, 3, 4])
118-
icfd.add(meshvol)
119-
120-
icfd_solution.create_database_binary(dt=1)
121-
serverpath = icfd_solution.save_file()
122-
serveroutfile = '/'.join((serverpath,"cylinder_flow.k"))
123-
downloadpath = os.path.join(os.getcwd(), "output")
124-
if not os.path.exists(downloadpath):
125-
os.makedirs(downloadpath)
126-
downloadfile = os.path.join(downloadpath,"cylinder_flow.k")
127-
icfd_solution.download(serveroutfile,downloadfile)
128-
51+
import sys
52+
from ansys.dyna.core.pre.dynasolution import DynaSolution
53+
from ansys.dyna.core.pre.dynaicfd import (
54+
DynaICFD,
55+
ICFDAnalysis,
56+
MatICFD,
57+
ICFDPart,
58+
ICFDDOF,
59+
Curve,
60+
ICFDVolumePart,
61+
MeshedVolume,
62+
)
63+
from ansys.dyna.core.pre import examples
64+
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/cylinderflow.png'
65+
66+
hostname = "localhost"
67+
if len(sys.argv) > 1:
68+
hostname = sys.argv[1]
69+
70+
icfd_solution = DynaSolution(hostname)
71+
# Import the initial mesh data(nodes and elements)
72+
fns = []
73+
path = os.getcwd()+os.sep
74+
fns.append(path+"cylinder_flow.k")
75+
icfd_solution.open_files(fns)
76+
# Set total time of simulation
77+
icfd_solution.set_termination(termination_time=100)
78+
79+
icfd = DynaICFD()
80+
icfd_solution.add(icfd)
81+
82+
icfdanalysis = ICFDAnalysis()
83+
icfdanalysis.set_timestep()
84+
icfd.add(icfdanalysis)
85+
86+
# define model
87+
mat = MatICFD(flow_density=1.0, dynamic_viscosity=0.005)
88+
89+
part_inflow = ICFDPart(1)
90+
part_inflow.set_material(mat)
91+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 10000], y=[1, 1]))
92+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.Y, motion=Curve(x=[0, 10000], y=[0, 0]))
93+
icfd.parts.add(part_inflow)
94+
95+
part_outflow = ICFDPart(2)
96+
part_outflow.set_material(mat)
97+
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
98+
icfd.parts.add(part_outflow)
99+
100+
part_symmetric = ICFDPart(3)
101+
part_symmetric.set_material(mat)
102+
part_symmetric.set_free_slip()
103+
icfd.parts.add(part_symmetric)
104+
105+
part_wall = ICFDPart(4)
106+
part_wall.set_material(mat)
107+
part_wall.set_non_slip()
108+
part_wall.compute_drag_force()
109+
part_wall.set_boundary_layer(number=3)
110+
icfd.parts.add(part_wall)
111+
112+
partvol = ICFDVolumePart(surfaces=[1, 2, 3, 4])
113+
partvol.set_material(mat)
114+
icfd.parts.add(partvol)
115+
# define the volume space that will be meshed,The boundaries
116+
# of the volume are the surfaces "spids"
117+
meshvol = MeshedVolume(surfaces=[1, 2, 3, 4])
118+
icfd.add(meshvol)
119+
120+
icfd_solution.create_database_binary(dt=1)
121+
serverpath = icfd_solution.save_file()
122+
serveroutfile = '/'.join((serverpath,"cylinder_flow.k"))
123+
downloadpath = os.path.join(os.getcwd(), "output")
124+
if not os.path.exists(downloadpath):
125+
os.makedirs(downloadpath)
126+
downloadfile = os.path.join(downloadpath,"cylinder_flow.k")
127+
icfd_solution.download(serveroutfile,downloadfile)
128+
129129
Here is a basic solving example:
130130

131131
.. code:: python
132132
133-
>>> import ansys.dyna.core.solver as solver
134-
>>> dyna=solver.DynaSovler(hostname,port) # connect to the container
135-
>>> dyna.push("cylinder_flow.k") # push an input file
136-
>>> dyna.start(4) # start 4 ranks of mppdyna
137-
>>> dyna.run("i=cylinder_flow.k memory=10m ncycle=20000") # begin execution
133+
hostname = "localhost"
134+
port = "5000"
135+
import ansys.dyna.core.solver as solver
136+
dyna=solver.DynaSolver(hostname,port) # connect to the container
137+
dyna.push("cylinder_flow.k") # push an input file
138+
dyna.start(4) # start 4 ranks of mppdyna
139+
dyna.run("i=./output/cylinder_flow.k memory=10m ncycle=20000") # begin execution
138140
139141
Here is a basic postprocessing example:
140142

141143
.. code:: python
142144
143-
from ansys.dpf import core as dpf
145+
from ansys.dpf import core as dpf
144146
145-
ds = dpf.DataSources()
146-
ds.set_result_file_path(r'./d3plot', 'd3plot')
147+
ds = dpf.DataSources()
148+
ds.set_result_file_path(r'./d3plot', 'd3plot')
147149
148-
resultOp = dpf.Operator("lsdyna::d3plot::stress_von_mises")
149-
resultOp.inputs.data_sources(ds)
150-
# set the time
151-
resultOp.inputs.time_scoping.connect([3])
152-
result = resultOp.outputs.stress_von_mises()
150+
resultOp = dpf.Operator("lsdyna::d3plot::stress_von_mises")
151+
resultOp.inputs.data_sources(ds)
152+
# set the time
153+
resultOp.inputs.time_scoping.connect([3])
154+
result = resultOp.outputs.stress_von_mises()
153155
154156
For more examples, see `Examples <https://dyna.docs.pyansys.com/version/stable/examples/index.html>`_
155157
in the PyDYNA documentation.

src/ansys/dyna/core/solver/docker-compose.yml

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

0 commit comments

Comments
 (0)