|
| 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() |
0 commit comments