Skip to content

Commit 37671ea

Browse files
committed
Add and use PrecompileTools
1 parent 5395ff6 commit 37671ea

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
1616
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1717
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1818
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
19+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1920
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
2021
SharedArrays = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
2122
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
@@ -49,6 +50,7 @@ NonlinearSolve = "4"
4950
Parameters = "0.12"
5051
Pkg = "1"
5152
PreallocationTools = "0.4.25"
53+
PrecompileTools = "1.2.1"
5254
Serialization = "1"
5355
SharedArrays = "1"
5456
StaticArrays = "1"

src/VortexStepMethod.jl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ using Parameters
1616
using Serialization
1717
using SharedArrays
1818
using PreallocationTools
19+
using PrecompileTools
1920
using Pkg
2021

2122
# Export public interface
@@ -242,4 +243,44 @@ include("body_aerodynamics.jl")
242243
include("wake.jl")
243244
include("solver.jl")
244245

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

src/wing_geometry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function refine_aerodynamic_mesh!(wing::AbstractWing)
236236
return nothing
237237
end
238238

239-
@info "Refining aerodynamic mesh from $(length(wing.sections)) sections to $n_sections sections."
239+
@debug "Refining aerodynamic mesh from $(length(wing.sections)) sections to $n_sections sections."
240240

241241
# Handle two-section case
242242
if n_sections == 2

0 commit comments

Comments
 (0)