Skip to content

Commit 5d559fb

Browse files
committed
New file precompile.jl
1 parent 8a8366a commit 5d559fb

File tree

2 files changed

+41
-40
lines changed

2 files changed

+41
-40
lines changed

src/VortexStepMethod.jl

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -254,46 +254,7 @@ include("panel.jl")
254254
include("body_aerodynamics.jl")
255255
include("wake.jl")
256256
include("solver.jl")
257+
include("precompile.jl")
257258

258-
@setup_workload begin
259-
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
260-
# precompile file and potentially make loading faster.
261-
# list = [OtherType("hello"), OtherType("world!")]
262-
path = dirname(pathof(@__MODULE__))
263-
264-
@compile_workload begin
265-
# all calls in this block will be precompiled, regardless of whether
266-
# they belong to your package or not (on Julia 1.8 and higher)
267-
# Step 1: Define wing parameters
268-
n_panels = 20 # Number of panels
269-
span = 20.0 # Wing span [m]
270-
chord = 1.0 # Chord length [m]
271-
v_a = 20.0 # Magnitude of inflow velocity [m/s]
272-
density = 1.225 # Air density [kg/m³]
273-
alpha_deg = 30.0 # Angle of attack [degrees]
274-
alpha = deg2rad(alpha_deg)
275-
276-
# Step 2: Create wing geometry with linear panel distribution
277-
wing = Wing(n_panels, spanwise_panel_distribution=LINEAR)
278-
279-
# Add wing sections - defining only tip sections with inviscid airfoil model
280-
add_section!(wing,
281-
[0.0, span/2, 0.0], # Left tip LE
282-
[chord, span/2, 0.0], # Left tip TE
283-
INVISCID)
284-
add_section!(wing,
285-
[0.0, -span/2, 0.0], # Right tip LE
286-
[chord, -span/2, 0.0], # Right tip TE
287-
INVISCID)
288-
289-
# Step 3: Initialize aerodynamics
290-
body_aero::BodyAerodynamics = BodyAerodynamics([wing])
291-
292-
gamma_initial = zeros(length(body_aero.panels))
293-
calculate_circulation_distribution_elliptical_wing(gamma_initial, body_aero)
294-
295-
nothing
296-
end
297-
end
298259

299260
end # module

src/precompile.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@setup_workload begin
2+
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
3+
# precompile file and potentially make loading faster.
4+
# list = [OtherType("hello"), OtherType("world!")]
5+
path = dirname(pathof(@__MODULE__))
6+
7+
@compile_workload begin
8+
# all calls in this block will be precompiled, regardless of whether
9+
# they belong to your package or not (on Julia 1.8 and higher)
10+
# Step 1: Define wing parameters
11+
n_panels = 20 # Number of panels
12+
span = 20.0 # Wing span [m]
13+
chord = 1.0 # Chord length [m]
14+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
15+
density = 1.225 # Air density [kg/m³]
16+
alpha_deg = 30.0 # Angle of attack [degrees]
17+
alpha = deg2rad(alpha_deg)
18+
19+
# Step 2: Create wing geometry with linear panel distribution
20+
wing = Wing(n_panels, spanwise_panel_distribution=LINEAR)
21+
22+
# Add wing sections - defining only tip sections with inviscid airfoil model
23+
add_section!(wing,
24+
[0.0, span/2, 0.0], # Left tip LE
25+
[chord, span/2, 0.0], # Left tip TE
26+
INVISCID)
27+
add_section!(wing,
28+
[0.0, -span/2, 0.0], # Right tip LE
29+
[chord, -span/2, 0.0], # Right tip TE
30+
INVISCID)
31+
32+
# Step 3: Initialize aerodynamics
33+
body_aero::BodyAerodynamics = BodyAerodynamics([wing])
34+
35+
gamma_initial = zeros(length(body_aero.panels))
36+
calculate_circulation_distribution_elliptical_wing(gamma_initial, body_aero)
37+
38+
nothing
39+
end
40+
end

0 commit comments

Comments
 (0)