Skip to content

Commit 5161d2f

Browse files
committed
Merge remote-tracking branch 'origin/zhanqun/dyna-prev4' into main
2 parents d78c09c + 37910b0 commit 5161d2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+175382
-698
lines changed

examples/ICFD/icfd_cylinderflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
icfd_solution = DynaSolution(hostname)
3131
# Import the initial mesh data(nodes and elements)
3232
fns = []
33-
path = examples.icfd_cylinderflow + os.sep
34-
fns.append(path + "mesh.k")
33+
path = examples.cylinder_flow + os.sep
34+
fns.append(path + "cylinder_flow.k")
3535
icfd_solution.open_files(fns)
3636
# Set total time of simulation
3737
icfd_solution.set_termination(termination_time=100)

examples/ICFD/icfd_dem_coupling.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"""
2+
DEM Coupling
3+
============
4+
5+
This example shows how to couple the ICFD fluid solver with DEM particles.
6+
"""
7+
8+
import os
9+
import sys
10+
11+
12+
from ansys.dyna.core.pre.dynasolution import DynaSolution
13+
from ansys.dyna.core.pre.dynaicfd import (
14+
DynaICFD,
15+
MatICFD,
16+
ICFDPart,
17+
ICFDDOF,
18+
Curve,
19+
ICFDVolumePart,
20+
MeshedVolume,
21+
ICFDAnalysis,
22+
SolidPart,
23+
SolidFormulation,
24+
Curve,
25+
Velocity,
26+
Point,
27+
ICFD_CouplingForm
28+
)
29+
from ansys.dyna.core.pre.dynadem import DEMAnalysis
30+
from ansys.dyna.core.pre.dynamaterial import MatRigidDiscrete
31+
from ansys.dyna.core.pre import examples
32+
33+
34+
hostname = "localhost"
35+
if len(sys.argv) > 1:
36+
hostname = sys.argv[1]
37+
38+
solution = DynaSolution(hostname)
39+
# Import the initial mesh data(nodes and elements)
40+
fns = []
41+
path = examples.dem_coupling + os.sep
42+
fns.append(path + "dem_coupling.k")
43+
solution.open_files(fns)
44+
solution.set_termination(termination_time=100)
45+
icfd = DynaICFD()
46+
solution.add(icfd)
47+
48+
icfd.set_timestep(tssfac=0.8)
49+
50+
icfdanalysis = ICFDAnalysis()
51+
icfdanalysis.set_timestep(0.05)
52+
icfdanalysis.set_coupling_dem(formulation=ICFD_CouplingForm.FORCE_USING_FLUID_PRESSURE_GRADIENT)
53+
icfd.add(icfdanalysis)
54+
55+
demanalysis = DEMAnalysis()
56+
demanalysis.set_des(normal_damping_coeff=0.9, tangential_damping_coeff=0.9, static_friction_coeff=0.3, rolling_friction_coeff=0.001)
57+
icfd.add(demanalysis)
58+
59+
# define model
60+
mat = MatICFD(flow_density=2.0, dynamic_viscosity=0.01)
61+
62+
part_inflow = ICFDPart(1)
63+
part_inflow.set_material(mat)
64+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 10000], y=[1, 1]))
65+
icfd.parts.add(part_inflow)
66+
67+
part_outflow = ICFDPart(2)
68+
part_outflow.set_material(mat)
69+
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
70+
icfd.parts.add(part_outflow)
71+
72+
part_symmetric = ICFDPart(3)
73+
part_symmetric.set_material(mat)
74+
part_symmetric.set_free_slip()
75+
icfd.parts.add(part_symmetric)
76+
77+
icfd.set_initial(velocity=Velocity(1, 0, 0))
78+
79+
partvol = ICFDVolumePart(surfaces=[1, 2, 3])
80+
partvol.set_material(mat)
81+
icfd.parts.add(partvol)
82+
# define the volume space that will be meshed,The boundaries
83+
# of the volume are the surfaces "spids"
84+
meshvol = MeshedVolume(surfaces=[1, 2, 3])
85+
meshvol.meshsize_box(size=0.05,min_point=Point(-1, -1, -1),max_point=Point(1, 1, 1))
86+
icfd.add(meshvol)
87+
88+
#define rigid cylinder
89+
matrigid = MatRigidDiscrete(mass_density=1000,young_modulus=1e4)
90+
disc = SolidPart(101)
91+
disc.set_material(matrigid)
92+
disc.set_element_formulation(SolidFormulation.ONE_POINT_COROTATIONAL)
93+
icfd.parts.add(disc)
94+
95+
solution.create_database_binary(dt=1.0)
96+
solution.save_file()

examples/ICFD/icfd_imposed_move.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
"""
2+
Imposed move
3+
============
4+
5+
This example shows how to impose the displacements on the fluid nodes through the use of the ICFD_CONTROL_IMPOSED_MOVE keyword.
6+
"""
7+
8+
import os
9+
import sys
10+
11+
12+
from ansys.dyna.core.pre.dynasolution import DynaSolution
13+
from ansys.dyna.core.pre.dynaicfd import (
14+
DynaICFD,
15+
MatICFD,
16+
ICFDPart,
17+
ICFDDOF,
18+
Curve,
19+
ICFDVolumePart,
20+
MeshedVolume,
21+
ICFDAnalysis,
22+
Curve
23+
)
24+
from ansys.dyna.core.pre import examples
25+
26+
27+
hostname = "localhost"
28+
if len(sys.argv) > 1:
29+
hostname = sys.argv[1]
30+
31+
solution = DynaSolution(hostname)
32+
# Import the initial mesh data(nodes and elements)
33+
fns = []
34+
path = examples.imposed_move + os.sep
35+
fns.append(path + "imposed_move.k")
36+
solution.open_files(fns)
37+
solution.set_termination(termination_time=40)
38+
icfd = DynaICFD()
39+
solution.add(icfd)
40+
41+
icfdanalysis = ICFDAnalysis()
42+
icfdanalysis.set_timestep(0.05)
43+
icfd.add(icfdanalysis)
44+
45+
# define model
46+
mat = MatICFD(flow_density=1.0, dynamic_viscosity=0.005)
47+
48+
part_inflow = ICFDPart(1)
49+
part_inflow.set_material(mat)
50+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 5, 6, 10000], y=[0, 0, 1, 1]))
51+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.Y, motion=Curve(x=[0, 10000], y=[0, 0]))
52+
icfd.parts.add(part_inflow)
53+
54+
part_outflow = ICFDPart(2)
55+
part_outflow.set_material(mat)
56+
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
57+
icfd.parts.add(part_outflow)
58+
59+
part_symmetric = ICFDPart(3)
60+
part_symmetric.set_material(mat)
61+
part_symmetric.set_free_slip()
62+
icfd.parts.add(part_symmetric)
63+
64+
part_wall = ICFDPart(4)
65+
part_wall.set_material(mat)
66+
part_wall.set_non_slip()
67+
part_wall.compute_drag_force()
68+
part_wall.set_boundary_layer(number=3)
69+
part_wall.set_imposed_move(vy=Curve(func="2*3.14/10*sin(2*3.14/10*TIME+3.14/2)"))
70+
icfd.parts.add(part_wall)
71+
72+
partvol = ICFDVolumePart(surfaces=[1, 2, 3, 4])
73+
partvol.set_material(mat)
74+
icfd.parts.add(partvol)
75+
# define the volume space that will be meshed,The boundaries
76+
# of the volume are the surfaces "spids"
77+
meshvol = MeshedVolume(surfaces=[1, 2, 3, 4])
78+
icfd.add(meshvol)
79+
80+
solution.create_database_binary(dt=0.5)
81+
solution.save_file()
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
"""
2+
Mesh Adaptivity
3+
===============
4+
5+
This example shows a simple ICFD problem with adaptivity.
6+
"""
7+
8+
import os
9+
import sys
10+
11+
12+
from ansys.dyna.core.pre.dynasolution import DynaSolution
13+
from ansys.dyna.core.pre.dynaicfd import (
14+
DynaICFD,
15+
MatICFD,
16+
ICFDPart,
17+
ICFDDOF,
18+
Curve,
19+
ICFDVolumePart,
20+
MeshedVolume,
21+
ICFDAnalysis
22+
)
23+
from ansys.dyna.core.pre import examples
24+
25+
26+
hostname = "localhost"
27+
if len(sys.argv) > 1:
28+
hostname = sys.argv[1]
29+
30+
solution = DynaSolution(hostname)
31+
# Import the initial mesh data(nodes and elements)
32+
fns = []
33+
path = examples.mesh_adaptivity + os.sep
34+
fns.append(path + "mesh_adaptivity.k")
35+
solution.open_files(fns)
36+
solution.set_termination(termination_time=40)
37+
icfd = DynaICFD()
38+
solution.add(icfd)
39+
40+
icfdanalysis = ICFDAnalysis()
41+
icfdanalysis.set_timestep()
42+
icfdanalysis.set_mesh_adaptivity(min_mesh_size=0.02,max_mesh_size=0.2,max_perceptual_error=2,num_iteration=10)
43+
icfd.add(icfdanalysis)
44+
45+
# define model
46+
mat = MatICFD(flow_density=1.0, dynamic_viscosity=0.005)
47+
48+
part_inflow = ICFDPart(1)
49+
part_inflow.set_material(mat)
50+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 10000], y=[1, 1]))
51+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.Y, motion=Curve(x=[0, 10000], y=[0, 0]))
52+
icfd.parts.add(part_inflow)
53+
54+
part_outflow = ICFDPart(2)
55+
part_outflow.set_material(mat)
56+
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
57+
icfd.parts.add(part_outflow)
58+
59+
part_symmetric = ICFDPart(3)
60+
part_symmetric.set_material(mat)
61+
part_symmetric.set_free_slip()
62+
icfd.parts.add(part_symmetric)
63+
64+
part_wall = ICFDPart(4)
65+
part_wall.set_material(mat)
66+
part_wall.set_non_slip()
67+
part_wall.compute_drag_force()
68+
part_wall.set_boundary_layer(number=2)
69+
icfd.parts.add(part_wall)
70+
71+
part_meshsize = ICFDPart(5)
72+
part_meshsize.set_material(mat)
73+
icfd.parts.add(part_meshsize)
74+
75+
partvol = ICFDVolumePart(surfaces=[1, 2, 3, 4])
76+
partvol.set_material(mat)
77+
icfd.parts.add(partvol)
78+
# define the volume space that will be meshed,The boundaries
79+
# of the volume are the surfaces "spids"
80+
meshvol = MeshedVolume(surfaces=[1, 2, 3, 4])
81+
icfd.add(meshvol)
82+
83+
solution.create_database_binary(dt=0.5)
84+
solution.save_file()
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""
2+
Mesh Morphing
3+
=============
4+
5+
This example shows a simple ICFD problem with mesh morphing.
6+
"""
7+
8+
import os
9+
import sys
10+
11+
12+
from ansys.dyna.core.pre.dynasolution import DynaSolution
13+
from ansys.dyna.core.pre.dynaicfd import (
14+
DynaICFD,
15+
MatICFD,
16+
ICFDPart,
17+
ICFDDOF,
18+
Curve,
19+
ICFDVolumePart,
20+
MeshedVolume,
21+
ICFDAnalysis
22+
)
23+
from ansys.dyna.core.pre import examples
24+
25+
26+
hostname = "localhost"
27+
if len(sys.argv) > 1:
28+
hostname = sys.argv[1]
29+
30+
solution = DynaSolution(hostname)
31+
# Import the initial mesh data(nodes and elements)
32+
fns = []
33+
path = examples.mesh_morphing + os.sep
34+
fns.append(path + "mesh_morphing.k")
35+
solution.open_files(fns)
36+
solution.set_termination(termination_time=40)
37+
icfd = DynaICFD()
38+
solution.add(icfd)
39+
40+
icfdanalysis = ICFDAnalysis()
41+
icfdanalysis.set_timestep(0.05)
42+
icfd.add(icfdanalysis)
43+
44+
# define model
45+
mat = MatICFD(flow_density=1.0, dynamic_viscosity=0.005)
46+
47+
part_inflow = ICFDPart(1)
48+
part_inflow.set_material(mat)
49+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.X, motion=Curve(x=[0, 5, 6, 10000], y=[0, 0, 1, 1]))
50+
part_inflow.set_prescribed_velocity(dof=ICFDDOF.Y, motion=Curve(x=[0, 10000], y=[0, 0]))
51+
icfd.parts.add(part_inflow)
52+
53+
part_outflow = ICFDPart(2)
54+
part_outflow.set_material(mat)
55+
part_outflow.set_prescribed_pressure(pressure=Curve(x=[0, 10000], y=[0, 0]))
56+
icfd.parts.add(part_outflow)
57+
58+
part_symmetric = ICFDPart(3)
59+
part_symmetric.set_material(mat)
60+
part_symmetric.set_free_slip()
61+
icfd.parts.add(part_symmetric)
62+
63+
part_wall = ICFDPart(4)
64+
part_wall.set_material(mat)
65+
part_wall.set_non_slip()
66+
part_wall.compute_drag_force()
67+
part_wall.set_boundary_layer(number=2)
68+
part_wall.set_imposed_move(vy=Curve(func="2*3.14/10*sin(2*3.14/10*TIME+3.14/2)"))
69+
icfd.parts.add(part_wall)
70+
71+
part_meshmorph = ICFDPart(5)
72+
part_meshmorph.set_material(mat)
73+
icfd.parts.add(part_meshmorph)
74+
75+
partvol1 = ICFDVolumePart(surfaces=[1, 2, 3, 5])
76+
partvol1.set_material(mat)
77+
icfd.parts.add(partvol1)
78+
partvol2 = ICFDVolumePart(surfaces=[5, 4])
79+
partvol2.set_material(mat)
80+
partvol2.set_imposed_move(vy=Curve(func="2*3.14/10*sin(2*3.14/10*TIME+3.14/2)"))
81+
icfd.parts.add(partvol2)
82+
# define the volume space that will be meshed,The boundaries
83+
# of the volume are the surfaces "spids"
84+
meshvol = MeshedVolume(surfaces=[1, 2, 3, 4])
85+
meshvol.set_fluid_interfaces([5])
86+
icfd.add(meshvol)
87+
88+
solution.create_database_binary(dt=0.5)
89+
solution.save_file()

0 commit comments

Comments
 (0)