What‘s Airbyte - Open Data Integration

Airbyte is an open-source data integration engine that helps you consolidate your data in your data warehouses, lakes and databases.

Open Data Integration (ELT - Extract load transform)

#=############################################################################## DESCRIPTION Simulation of a DJI 9443 rotor in hover (two-bladed rotor, 9.4 inches diameter). This example replicates the experiment described in Zawodny & Boyd (2016), "Acoustic Characterization and Prediction of Representative, Small-scale Rotary-wing Unmanned Aircraft System Components." AUTHORSHIP Author : Eduardo J. Alvarez (edoalvarez.com) Email : Edo.AlvarezR@gmail.com Created : Mar 2023 Last updated : Mar 2023 License : MIT =############################################################################### #= Use the following parameters to obtain the desired fidelity ---- MID-LOW FIDELITY — n = 20 # Number of blade elements per blade nsteps_per_rev = 36 # Time steps per revolution p_per_step = 4 # Sheds per time step sigma_rotor_surf= R/10 # Rotor-on-VPM smoothing radius vpm_integration = vpm.euler # VPM time integration scheme vpm_SFS = vpm.SFS_none # VPM LES subfilter-scale model shed_starting = false # Whether to shed starting vortex suppress_fountain = true # Suppress hub fountain effect sigmafactor_vpmonvlm = 1.0 # Shrink particles by this factor when # calculating VPM-on-VLM/Rotor induced velocities ---- MID-HIGH FIDELITY — n = 50 nsteps_per_rev = 72 p_per_step = 2 sigma_rotor_surf= R/10 sigmafactor_vpmonvlm = 1.0 shed_starting = false suppress_fountain = true vpm_integration = vpm.rungekutta3 vpm_SFS = vpm.SFS_none ---- HIGH FIDELITY ----- n = 50 nsteps_per_rev = 360 p_per_step = 2 sigma_rotor_surf= R/80 sigmafactor_vpmonvlm = 5.5 shed_starting = true suppress_fountain = false vpm_integration = vpm.rungekutta3 vpm_SFS = vpm.DynamicSFS(vpm.Estr_fmm, vpm.pseudo3level_positive; alpha=0.999, maxC=1.0, clippings=[vpm.clipping_backscatter]) =# import FLOWUnsteady as uns import FLOWVLM as vlm import FLOWVPM as vpm run_name = “rotorhover-example” # Name of this simulation save_path = run_name # Where to save this simulation paraview = true # Whether to visualize with Paraview Uncomment this to have the folder named after this file instead save_path = String(split(@FILE, “.”)[1]) run_name = “singlerotor” paraview = false ----------------- GEOMETRY PARAMETERS ---------------------------------------- Rotor geometry rotor_file = “DJI9443.csv” # Rotor geometry data_path = uns.def_data_path # Path to rotor database pitch = 0.0 # (deg) collective pitch of blades CW = false # Clock-wise rotation xfoil = false # Whether to run XFOIL read_polar = vlm.ap.read_polar2 # What polar reader to use NOTE: If xfoil=true, XFOIL will be run to generate the airfoil polars used by blade elements before starting the simulation. XFOIL is run on the airfoil contours found in rotor_file at the corresponding local Reynolds and Mach numbers along the blade. Alternatively, the user can provide pre-computer airfoil polars using xfoil=false and providing the polar files through rotor_file. read_polar is the function that will be used to parse polar files. Use vlm.ap.read_polar for files that are direct outputs of XFOIL (e.g., as downloaded from www.airfoiltools.com). Use vlm.ap.read_polar2 for CSV files. Discretization n = 20 # Number of blade elements per blade r = 1/10 # Geometric expansion of elements NOTE: Here a geometric expansion of 1/10 means that the spacing between the tip elements is 1/10 of the spacing between the hub elements. Refine the discretization towards the blade tip like this in order to better resolve the tip vortex. Read radius of this rotor and number of blades R, B = uns.read_rotor(rotor_file; data_path=data_path)[[1,3]] ----------------- SIMULATION PARAMETERS -------------------------------------- Operating conditions RPM = 5400 # RPM J = 0.0001 # Advance ratio Vinf/(nD) AOA = 0 # (deg) Angle of attack (incidence angle) rho = 1.071778 # (kg/m^3) air density mu = 1.85508e-5 # (kg/ms) air dynamic viscosity speedofsound = 342.35 # (m/s) speed of sound NOTE: For cases with zero freestream velocity, it is recommended that a negligible small velocity is used instead of zero in order to avoid potential numerical instabilities (hence, J here is negligible small instead of zero) magVinf = JRPM/60(2R) Vinf(X, t) = magVinf[cos(AOApi/180), sin(AOApi/180), 0] # (m/s) freestream velocity vector ReD = 2piRPM/60R * rho/mu * 2R # Diameter-based Reynolds number Matip = 2piRPM/60 * R / speedofsound # Tip Mach number println(“”" RPM: ( R P M ) V i n f : (RPM)Vinf:(Vinf(zeros(3), 0)) m/s Matip: ( r o u n d ( M a t i p , d i g i t s = 3 ) ) R e D : (round(Matip,digits=3))ReD:(round(ReD, digits=0)) “”") ----------------- SOLVER PARAMETERS ------------------------------------------ Aerodynamic solver VehicleType = uns.UVLMVehicle # Unsteady solver VehicleType = uns.QVLMVehicle # Quasi-steady solver const_solution = VehicleType==uns.QVLMVehicle # Whether to assume that the # solution is constant or not Time parameters nrevs = 10 # Number of revolutions in simulation nsteps_per_rev = 36 # Time steps per revolution nsteps = const_solution ? 2 : nrevs*nsteps_per_rev # Number of time steps ttot = nsteps/nsteps_per_rev / (RPM/60) # (s) total simulation time VPM particle shedding p_per_step = 4 # Sheds per time step shed_starting = false # Whether to shed starting vortex shed_unsteady = true # Whether to shed vorticity from unsteady loading unsteady_shedcrit = 0.001 # Shed unsteady loading whenever circulation # fluctuates by more than this ratio max_particles = ((2*n+1)*B)nstepsp_per_step + 1 # Maximum number of particles Regularization sigma_rotor_surf= R/10 # Rotor-on-VPM smoothing radius lambda_vpm = 2.125 # VPM core overlap # VPM smoothing radius sigma_vpm_overwrite = lambda_vpm * 2piR/(nsteps_per_rev*p_per_step) sigmafactor_vpmonvlm= 1 # Shrink particles by this factor when # calculating VPM-on-VLM/Rotor induced velocities Rotor solver vlm_rlx = 0.5 # VLM relaxation <-- this also applied to rotors hubtiploss_correction = ((0.4, 5, 0.1, 0.05), (2, 1, 0.25, 0.05)) # Hub and tip correction VPM solver vpm_integration = vpm.euler # VPM temporal integration scheme vpm_integration = vpm.rungekutta3 vpm_viscous = vpm.Inviscid() # VPM viscous diffusion scheme vpm_viscous = vpm.CoreSpreading(-1, -1, vpm.zeta_fmm; beta=100.0, itmax=20, tol=1e-1) vpm_SFS = vpm.SFS_none # VPM LES subfilter-scale model vpm_SFS = vpm.SFS_Cd_twolevel_nobackscatter vpm_SFS = vpm.SFS_Cd_threelevel_nobackscatter vpm_SFS = vpm.DynamicSFS(vpm.Estr_fmm, vpm.pseudo3level_positive; alpha=0.999, maxC=1.0, clippings=[vpm.clipping_backscatter]) vpm_SFS = vpm.DynamicSFS(vpm.Estr_fmm, vpm.pseudo3level_positive; alpha=0.999, rlxf=0.005, minC=0, maxC=1 clippings=[vpm.clipping_backscatter], controls=[vpm.control_sigmasensor], ) NOTE: In most practical situations, open rotors operate at a Reynolds number high enough that viscous diffusion in the wake is actually negligible. Hence, it does not make much of a difference whether we run the simulation with viscous diffusion enabled or not. On the other hand, such high Reynolds numbers mean that the wake quickly becomes turbulent and it is crucial to use a subfilter-scale (SFS) model to accurately capture the turbulent decay of the wake (turbulent diffusion). if VehicleType == uns.QVLMVehicle # Mute warnings regarding potential colinear vortex filaments. This is # needed since the quasi-steady solver will probe induced velocities at the # lifting line of the blade uns.vlm.VLMSolver._mute_warning(true) end ----------------- WAKE TREATMENT --------------------------------------------- NOTE: It is known in the CFD community that rotor simulations with an impulsive RPM start (i.e., 0 to RPM in the first time step, as opposed to gradually ramping up the RPM) leads to the hub “fountain effect”, with the root wake reversing the flow near the hub. The fountain eventually goes away as the wake develops, but this happens very slowly, which delays the convergence of the simulation to a steady state. To accelerate convergence, here we define a wake treatment procedure that suppresses the hub wake for the first three revolutions, avoiding the fountain effect altogether. This is especially helpful in low and mid-fidelity simulations. suppress_fountain = true # Toggle Supress wake shedding on blade elements inboard of this r/R radial station no_shedding_Rthreshold = suppress_fountain ? 0.35 : 0.0 Supress wake shedding for this many time steps no_shedding_nstepsthreshold = 3*nsteps_per_rev omit_shedding = [] # Index of blade elements to supress wake shedding Function to suppress or activate wake shedding function wake_treatment_supress(sim, args…; optargs…) # Case: start of simulation -> suppress shedding if sim.nt == 1 # Identify blade elements on which to suppress shedding for i in 1:vlm.get_m(rotor) HS = vlm.getHorseshoe(rotor, i) CP = HS[5] if uns.vlm.norm(CP - vlm._get_O(rotor)) <= no_shedding_Rthreshold*R push!(omit_shedding, i) end end end # Case: sufficient time steps -> enable shedding if sim.nt == no_shedding_nstepsthreshold # Flag to stop suppressing omit_shedding .= -1 end return false end ----------------- 1) VEHICLE DEFINITION -------------------------------------- println(“Generating geometry…”) Generate rotor rotor = uns.generate_rotor(rotor_file; pitch=pitch, n=n, CW=CW, blade_r=r, altReD=[RPM, J, mu/rho], xfoil=xfoil, read_polar=read_polar, data_path=data_path, verbose=true, plot_disc=true ); println(“Generating vehicle…”) Generate vehicle system = vlm.WingSystem() # System of all FLOWVLM objects vlm.addwing(system, “Rotor”, rotor) rotors = [rotor]; # Defining this rotor as its own system rotor_systems = (rotors, ); # All systems of rotors wake_system = vlm.WingSystem() # System that will shed a VPM wake # NOTE: Do NOT include rotor when using the quasi-steady solver if VehicleType != uns.QVLMVehicle vlm.addwing(wake_system, “Rotor”, rotor) end vehicle = VehicleType( system; rotor_systems=rotor_systems, wake_system=wake_system ); ------------- 2) MANEUVER DEFINITION ----------------------------------------- Non-dimensional translational velocity of vehicle over time Vvehicle(t) = zeros(3) Angle of the vehicle over time anglevehicle(t) = zeros(3) RPM control input over time (RPM over RPMref) RPMcontrol(t) = 1.0 angles = () # Angle of each tilting system (none) RPMs = (RPMcontrol, ) # RPM of each rotor system maneuver = uns.KinematicManeuver(angles, RPMs, Vvehicle, anglevehicle) ------------- 3) SIMULATION DEFINITION --------------------------------------- Vref = 0.0 # Reference velocity to scale maneuver by RPMref = RPM # Reference RPM to scale maneuver by Vinit = VrefVvehicle(0) # Initial vehicle velocity Winit = pi/180(anglevehicle(1e-6) - anglevehicle(0))/(1e-6*ttot) # Initial angular velocity simulation = uns.Simulation(vehicle, maneuver, Vref, RPMref, ttot; Vinit=Vinit, Winit=Winit); Restart simulation restart_file = nothing NOTE: Uncomment the following line to restart a previous simulation. Point it to a particle field file (with its full path) at a specific time step, and run_simulation will start this simulation with the particle field found in the restart simulation. restart_file = “/path/to/a/previous/simulation/rotorhover-example_pfield.360” ------------- 4) MONITORS DEFINITIONS ---------------------------------------- Generate rotor monitor monitor_rotor = uns.generate_monitor_rotors(rotors, J, rho, RPM, nsteps; t_scale=RPM/60, # Scaling factor for time in plots t_lbl=“Revolutions”, # Label for time axis save_path=save_path, run_name=run_name, figname=“rotor monitor”, ) Generate monitor of flow enstrophy (numerical stability) monitor_enstrophy = uns.generate_monitor_enstrophy(; save_path=save_path, run_name=run_name, figname=“enstrophy monitor” ) Generate monitor of SFS model coefficient Cd monitor_Cd = uns.generate_monitor_Cd(; save_path=save_path, run_name=run_name, figname=“Cd monitor” ) Concatenate monitors monitors = uns.concatenate(monitor_rotor, monitor_enstrophy, monitor_Cd) ------------- 5) RUN SIMULATION ---------------------------------------------- println(“Running simulation…”) Concatenate monitors and wake treatment procedure into one runtime function runtime_function = uns.concatenate(monitors, wake_treatment_supress) Run simulation uns.run_simulation(simulation, nsteps; # ----- SIMULATION OPTIONS ------------- Vinf=Vinf, rho=rho, mu=mu, sound_spd=speedofsound, # ----- SOLVERS OPTIONS ---------------- p_per_step=p_per_step, max_particles=max_particles, vpm_integration=vpm_integration, vpm_viscous=vpm_viscous, vpm_SFS=vpm_SFS, sigma_vlm_surf=sigma_rotor_surf, sigma_rotor_surf=sigma_rotor_surf, sigma_vpm_overwrite=sigma_vpm_overwrite, sigmafactor_vpmonvlm=sigmafactor_vpmonvlm, vlm_rlx=vlm_rlx, hubtiploss_correction=hubtiploss_correction, shed_starting=shed_starting, shed_unsteady=shed_unsteady, unsteady_shedcrit=unsteady_shedcrit, omit_shedding=omit_shedding, extra_runtime_function=runtime_function, # ----- RESTART OPTIONS ----------------- restart_vpmfile=restart_file, # ----- OUTPUT OPTIONS ------------------ save_path=save_path, run_name=run_name, save_wopwopin=true, # <— Generates input files for PSU-WOPWOP noise analysis save_code=@FILE ); ----------------- 6) VISUALIZATION ------------------------------------------- if paraview println(“Calling Paraview…”) # Files to open in Paraview files = joinpath(save_path, run_name*"_pfield...xmf;") for bi in 1:B global files files *= run_name*"_Rotor_Blade$(bi)_loft...vtk;" files *= run_name*"_Rotor_Blade$(bi)_vlm...vtk;" end # Call Paraview run(`paraview --data=$(files)`) end ------------- 6) POSTPROCESSING ---------------------------------------------- Post-process monitor plots include(joinpath(uns.examples_path, “rotorhover”, “rotorhover_postprocessing.jl”)) 这是用Julia写的单个旋翼运动的文件,现在把他改成共轴旋翼运动的文件,上下两个旋翼参数相同,且间距为0.1D,D为旋翼直径
10-24
<think>为了将单旋翼运动模拟改为共轴双旋翼(coaxial rotors),我们需要在原有代码的基础上进行以下修改: 1. 生成两个相同的旋翼(rotor1和rotor2),并将它们分别放置在上下位置(沿Z轴方向,间距0.1D,其中D为旋翼直径)。 2. 将两个旋翼添加到系统中,并分别设置它们的旋转方向(通常共轴旋翼的上下旋翼旋转方向相反,以抵消扭矩)。 3. 修改车辆(vehicle)定义,将两个旋翼都包含进去。 4. 在监控器(monitor)中可能需要分别监控两个旋翼的性能,或者整体监控。 具体修改步骤: 步骤1:定义两个旋翼,并调整它们的位置。 我们首先读取一个旋翼的几何,然后复制一份作为第二个旋翼。 上旋翼(top rotor)位置在(0,0,0.05*D)处(因为间距0.1D,所以每个旋翼偏移0.05D),下旋翼(bottom rotor)位置在(0,0,-0.05*D)处。 注意:原单旋翼的位置在(0,0,0),所以我们需要将两个旋翼分别上下移动。 步骤2:设置旋转方向。 原单旋翼的旋转方向由参数`CW`(Clockwise)控制。对于共轴旋翼,通常一个顺时针,一个逆时针。因此,我们让一个旋翼的`CW=true`,另一个`CW=false`。 步骤3:将两个旋翼添加到车辆系统中。 步骤4:在模拟中,需要为两个旋翼分别指定RPM控制函数(这里两个旋翼RPM相同,但方向相反已经在生成旋翼时设置)。 其他注意事项: - 在生成第二个旋翼时,注意避免重复运行XFOIL(如果使用的话),因为两个旋翼的几何和空气动力学特性相同,可以复用第一个旋翼的极曲线数据。 - 在定义车辆系统时,需要将两个旋翼都加入。 - 在监控器部分,可以分别监控两个旋翼,也可以监控整体的性能。 我们开始修改代码: 由于原代码很长,我们只修改关键部分。以下是修改后的代码片段(注意:我们只展示修改的部分,其余部分保持原样)。 </think>要将单旋翼模拟修改为共轴双旋翼(上下两个旋翼),需要进行以下关键修改: ### 主要修改步骤: 1. **创建两个旋翼对象**(一个上方,一个下方) 2. **设置旋翼位置**(Z轴方向间隔0.1D) 3. **定义反向旋转方向**(共轴旋翼通常反向旋转) 4. **更新车辆系统定义** 5. **调整监控和可视化部分** ### 修改后的代码示例(关键部分): ```julia # ... 前面参数定义保持不变 ... ################# 修改1:创建两个旋翼对象 ################# println("Generating geometry...") # 原始旋翼(下方旋翼) rotor_bottom = uns.generate_rotor(rotor_file; pitch=pitch, n=n, CW=true, blade_r=r, # CW=true 顺时针旋转 altReD=[RPM, J, mu/rho], xfoil=xfoil, read_polar=read_polar, data_path=data_path ) # 上方旋翼(反向旋转) rotor_top = uns.generate_rotor(rotor_file; pitch=pitch, n=n, CW=false, blade_r=r, # CW=false 逆时针旋转 altReD=[RPM, J, mu/rho], xfoil=xfoil, read_polar=read_polar, data_path=data_path ) # 设置旋翼位置(Z方向间距0.1D) z_offset = 0.1 * 2R # D=2R,所以间距0.1D vlm.setcoordsystem(rotor_top, [0,0,z_offset], [1,0,0], [0,1,0], [0,0,1]) vlm.setcoordsystem(rotor_bottom, [0,0,0], [1,0,0], [0,1,0], [0,0,1]) ################# 修改2:更新车辆系统 ################# println("Generating vehicle...") system = vlm.WingSystem() # 系统包含所有旋翼 vlm.addwing(system, "TopRotor", rotor_top) vlm.addwing(system, "BottomRotor", rotor_bottom) rotors = [rotor_top, rotor_bottom] # 包含两个旋翼 # 创建尾迹系统 wake_system = vlm.WingSystem() if VehicleType != uns.QVLMVehicle vlm.addwing(wake_system, "TopRotor", rotor_top) vlm.addwing(wake_system, "BottomRotor", rotor_bottom) end # 更新车辆定义 vehicle = VehicleType(system; rotor_systems=(rotors,), # 注意这里改为元组包含rotors wake_system=wake_system ) ################# 修改3:RPM控制函数 ################# # 两个旋翼相同RPM RPMcontrol(t) = 1.0 RPMs = (RPMcontrol, RPMcontrol) # 两个控制函数 maneuver = uns.KinematicManeuver(angles, RPMs, Vvehicle, anglevehicle) # ... 后续代码保持不变 ... ################# 修改4:更新监控器 ################# # 分别为两个旋翼创建监控器 monitor_top = uns.generate_monitor_rotors([rotor_top], J, rho, RPM, nsteps; t_scale=RPM/60, t_lbl="Revolutions", save_path=save_path, run_name=run_name*"_top", figname="Top Rotor Monitor" ) monitor_bottom = uns.generate_monitor_rotors([rotor_bottom], J, rho, RPM, nsteps; t_scale=RPM/60, t_lbl="Revolutions", save_path=save_path, run_name=run_name*"_bottom", figname="Bottom Rotor Monitor" ) # 合并监控器 monitors = uns.concatenate(monitor_top, monitor_bottom, monitor_enstrophy, monitor_Cd) # ... 运行模拟代码保持不变 ... ################# 修改5:可视化更新 ################# if paraview println("Calling Paraview...") files = joinpath(save_path, run_name*"_pfield...xmf;") for (ri, rotor) in enumerate([rotor_top, rotor_bottom]) for bi in 1:B files *= run_name*"_Rotor$(ri)_Blade$(bi)_loft...vtk;" files *= run_name*"_Rotor$(ri)_Blade$(bi)_vlm...vtk;" end end run(`paraview --data=$(files)`) end ``` ### 关键修改说明: 1. **双旋翼创建**: - 上方旋翼设置为逆时针旋转(`CW=false`) - 下方旋翼保持顺时针旋转(`CW=true`) - Z轴方向设置0.1D(0.2R)的间距 2. **车辆系统更新**: - `rotor_systems` 参数现在包含两个旋翼 - 尾迹系统同时包含两个旋翼的尾迹 3. **RPM控制**: - 为两个旋翼创建独立的RPM控制函数(相同参数) 4. **监控器更新**: - 为每个旋翼单独创建监控器 - 结果文件名添加`_top`和`_bottom`后缀区分 5. **可视化更新**: - Paraview现在会加载两个旋翼的几何文件 - 文件名通过`Rotor1/Rotor2`区分上下旋翼 ### 注意事项: 1. **相互作用影响**: - 上方旋翼的尾迹会影响下方旋翼的入流条件 - 可能需要增加仿真步数(`nrevs`)使流场稳定 2. **性能考虑**: - 粒子数量会翻倍,可能需要调整`max_particles` - 计算时间预计增加60-80% 3. **参数调整建议**: ```julia nrevs = 15 # 增加转速稳定时间 max_particles = 2*((2*n+1)*B)*nsteps*p_per_step + 2 # 双倍粒子容量 ``` ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值