Skip to content

Commit e344ab0

Browse files
authored
Updated SSW meshes (#297)
1 parent 9e5e052 commit e344ab0

File tree

6 files changed

+144
-21
lines changed

6 files changed

+144
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
from pathlib import Path
2+
from funtofem.interface import Fun3dModel, Fun3dBC
3+
from mpi4py import MPI
4+
5+
here = Path(__file__).parent
6+
comm = MPI.COMM_WORLD
7+
8+
# Set whether to build an inviscid or viscous mesh
9+
# ------------------------------------------------
10+
# case = "inviscid"
11+
case = "turbulent"
12+
if case == "inviscid":
13+
project_name = "ssw-inviscid"
14+
else: # turbulent
15+
project_name = "ssw-turb"
16+
# ------------------------------------------------
17+
18+
# Set up FUN3D model, AIMs, and turn on the flow view
19+
# ------------------------------------------------
20+
fun3d_model = Fun3dModel.build(
21+
csm_file="ssw.csm",
22+
comm=comm,
23+
project_name=project_name,
24+
problem_name="capsFluidEgads",
25+
volume_mesh="aflr3",
26+
surface_mesh="egads",
27+
)
28+
mesh_aim = fun3d_model.mesh_aim
29+
fun3d_aim = fun3d_model.fun3d_aim
30+
fun3d_aim.set_config_parameter("view:flow", 1)
31+
fun3d_aim.set_config_parameter("view:struct", 0)
32+
# ------------------------------------------------
33+
34+
global_max = 10
35+
global_min = 0.1
36+
37+
mesh_aim.surface_aim.set_surface_mesh(
38+
edge_pt_min=10,
39+
edge_pt_max=200,
40+
mesh_elements="Mixed",
41+
global_mesh_size=0.0,
42+
max_surf_offset=0.01,
43+
max_dihedral_angle=15,
44+
)
45+
46+
num_pts_up = 80
47+
num_pts_bot = 80
48+
num_pts_y = 110
49+
mesh_aim.surface_aim.aim.input.Mesh_Sizing = {
50+
"teEdgeMesh": {
51+
"numEdgePoints": num_pts_y,
52+
"edgeDistribution": "Tanh",
53+
"initialNodeSpacing": [0, 0.05],
54+
},
55+
"leEdgeMesh": {
56+
"numEdgePoints": num_pts_y,
57+
"edgeDistribution": "Tanh",
58+
"initialNodeSpacing": [0, 0.05],
59+
},
60+
"tipUpperEdgeMesh": {
61+
"numEdgePoints": num_pts_up,
62+
"edgeDistribution": "Tanh",
63+
"initialNodeSpacing": [0.005, 0.002],
64+
},
65+
"tipLowerEdgeMesh": {
66+
"numEdgePoints": num_pts_bot,
67+
"edgeDistribution": "Tanh",
68+
"initialNodeSpacing": [0.002, 0.005],
69+
},
70+
"rootUpperEdgeMesh": {
71+
"numEdgePoints": num_pts_up,
72+
"edgeDistribution": "Tanh",
73+
"initialNodeSpacing": [0.005, 0.002],
74+
},
75+
"rootLowerEdgeMesh": {
76+
"numEdgePoints": num_pts_bot,
77+
"edgeDistribution": "Tanh",
78+
"initialNodeSpacing": [0.002, 0.005],
79+
},
80+
}
81+
82+
if case == "inviscid":
83+
Fun3dBC.inviscid(caps_group="wing").register_to(fun3d_model)
84+
else:
85+
mesh_aim.volume_aim.set_boundary_layer(
86+
initial_spacing=1e-5, max_layers=50, thickness=0.05, use_quads=True
87+
)
88+
Fun3dBC.viscous(caps_group="wing", wall_spacing=1).register_to(fun3d_model)
89+
90+
refinement = 1
91+
92+
FluidMeshOptions = {"egadsTessAIM": {}, "aflr3AIM": {}}
93+
94+
mesh_aim.saveDictOptions(FluidMeshOptions)
95+
96+
Fun3dBC.SymmetryY(caps_group="symmetry").register_to(fun3d_model)
97+
Fun3dBC.Farfield(caps_group="farfield").register_to(fun3d_model)
98+
99+
fun3d_model.setup()
100+
fun3d_aim.pre_analysis()
101+
102+
# if comm.rank == 0:
103+
# mesh_aim.surface_aim.aim.runAnalysis()
104+
# mesh_aim.surface_aim.aim.geometry.view()
105+
# exit()
106+
107+
# fun3d_aim.pre_analysis()

examples/fun3d_examples/ssw_meshdef_optimization/geometry/_mesh_tacs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
aim = egads_aim.aim
3535
aim.input.Mesh_Sizing = {
3636
"chord": {"numEdgePoints": 20},
37-
"span": {"numEdgePoints": 8},
38-
"vert": {"numEdgePoints": 4},
37+
"span": {"numEdgePoints": 10},
38+
"vert": {"numEdgePoints": 10},
3939
# "LEribFace": {"tessParams": [0.01, 0.1, 3]},
4040
# "LEribEdge": {"numEdgePoints": 20},
4141
}

examples/fun3d_examples/ssw_meshdef_optimization/geometry/ssw.csm

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Super Simple Wing geometry script
22

3-
cfgpmtr view:flow 0
4-
cfgpmtr view:struct 1
3+
cfgpmtr view:flow 1
4+
cfgpmtr view:struct 0
55

66
cfgpmtr midplane 0 # 0 is off, 1 is upper, 2 is lower
77
cfgpmtr chopMode 2 # 0 is off, 1 is LE, 2 is middle, 3 is TE
@@ -12,7 +12,7 @@ cfgpmtr nspars 2
1212
## DESIGN PARAMETERS
1313
# ---------------------------------
1414
# General wing and airfoil parameters
15-
despmtr ff 20.0 # Farfield distance
15+
despmtr ff 50.0 # Farfield distance
1616
despmtr sspan 5.0 # Semispan
1717
despmtr camber 0.02 # Maximum camber
1818
despmtr xCamber 0.4 # Location of maximum camber

examples/fun3d_examples/ssw_meshdef_optimization/geometry/wingAero.udc

+22-13
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ udparg $/wingSolid tc1 tc1 tc2 tc2 tc3 tc3 tc4 tc4
3131
udparg $/wingSolid twist1 twist1 twist2 twist2 twist3 twist3 twist4 twist4
3232
udparg $/wingSolid chord chord sspan sspan camber camber xCamber xCamber
3333
udparg $/wingSolid chopMode 0
34-
udprim $/wingSolid midplane 0
34+
udprim $/wingSolid midplane 0 wingCap 1
3535
store wingSolid
3636

3737
box -ff -ff -ff 2*ff 2*ff 2*ff
38-
attribute capsGroup $Farfield
39-
attribute capsMesh $Farfield
38+
attribute capsGroup $farfield
39+
attribute capsMesh $farfieldMesh
4040
attribute AFLR_GBC $FARFIELD_UG3_GBC
4141
attribute AFLR4_CMP_ID 1
4242
attribute AFLR4_Scale_Factor 10.0
@@ -60,28 +60,37 @@ select edge $tagComp1 $leEdge
6060
select edge $tagComp1 $teEdge
6161
attribute capsMesh $teEdgeMesh
6262

63-
select edge $tagComp $tipEdge
64-
attribute capsMesh $tipEdgeMesh
65-
6663
select face $capsGroup $*
6764
select not
68-
attribute capsGroup $SymmetryY
69-
attribute capsMesh $SymmetryY
65+
attribute capsGroup $symmetry
66+
attribute capsMesh $symmetryMesh
7067
attribute AFLR4_CMP_ID 2
7168
attribute AFLR_GBC $BL_INT_UG3_GBC
7269

7370
udprim editAttr filename <<
74-
EDGE ADJ2FACE capsGroup=wing
75-
AND ADJ2FACE capsGroup=SymmetryY
76-
SET capsMesh=rootEdgeMesh
71+
EDGE ADJ2FACE tagComp1=wingUpper
72+
AND ADJ2FACE capsGroup=symmetry
73+
SET capsMesh=rootUpperEdgeMesh
74+
75+
EDGE ADJ2FACE tagComp1=wingLower
76+
AND ADJ2FACE capsGroup=symmetry
77+
SET capsMesh=rootLowerEdgeMesh
78+
79+
EDGE ADJ2FACE tagComp1=wingUpper
80+
AND ADJ2FACE tagComp=tip
81+
SET capsMesh=tipUpperEdgeMesh
82+
83+
EDGE ADJ2FACE tagComp1=wingLower
84+
AND ADJ2FACE tagComp=tip
85+
SET capsMesh=tipLowerEdgeMesh
7786
>>
7887

7988
select body
80-
attribute capsAIM $fun3dAIM;aflr4AIM;aflr3AIM
89+
attribute capsAIM $fun3dAIM;aflr4AIM;aflr3AIM;egadsTessAIM
8190
attribute capsMeshLength 1.0
8291

8392
rotatex 90 0 0
8493
rotatez -aoa 0 0
8594

8695
end
87-
|||||||
96+
||||||||

examples/fun3d_examples/ssw_meshdef_optimization/geometry/wingSolid.udc

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ interface sharpTE in 1
2323
interface LEchop in 1
2424
interface TEchop in 1
2525

26+
interface wingCap in 0
27+
2628
interface midplane in 1 #0 is off, 1 is upper, 2 is lower
2729
interface chopMode in 1 #0 is off, 1 is LE, 2 is middle, 3 is TE
2830

@@ -243,7 +245,12 @@ select face
243245

244246
# Rule all of the sections together
245247
#rule 0
246-
blend
248+
#blend 0 -1;0.75
249+
ifthen wingCap EQ 0
250+
blend
251+
elseif wingCap EQ 1
252+
blend 0 -1;0.75
253+
endif
247254

248255
ifthen midplane EQ 1
249256
select face
@@ -282,4 +289,4 @@ udprim editAttr filename <<
282289
>>
283290

284291
end
285-
||||||||||||||
292+
|||||||||||||||

examples/fun3d_examples/ssw_meshdef_optimization/geometry/wingStruct.udc

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ udparg $/wingSolid twist1 twist1 twist2 twist2 twist3 twist3 twist4 twist4
5050
udparg $/wingSolid chord chord sspan sspan camber camber xCamber xCamber
5151
udparg $/wingSolid LEchop LEchop TEchop TEchop
5252
udparg $/wingSolid chopMode chopMode
53-
udprim $/wingSolid midplane midplane
53+
udprim $/wingSolid midplane midplane wingCap 0
5454
store wingSolid
5555

5656
# Make the spars

0 commit comments

Comments
 (0)