|
| 1 | +using PrecompileTools |
| 2 | + |
| 3 | +@setup_workload begin |
| 4 | + # Minimal setup - these are lightweight and don't add much to precompilation time |
| 5 | + mesh_points = LinRange(0.0, 1.0, 10) |
| 6 | + |
| 7 | + @compile_workload begin |
| 8 | + # Precompile FVMGeometry creation - common entry point |
| 9 | + geom = FVMGeometry(mesh_points) |
| 10 | + |
| 11 | + # Precompile boundary condition types with common cases |
| 12 | + lhs_dir = Dirichlet(0.0) |
| 13 | + rhs_dir = Dirichlet(1.0) |
| 14 | + lhs_neu = Neumann(0.0) |
| 15 | + rhs_neu = Neumann(0.0) |
| 16 | + |
| 17 | + # Precompile BoundaryConditions with different combinations |
| 18 | + bc_dir = BoundaryConditions(lhs = lhs_dir, rhs = rhs_dir) |
| 19 | + bc_neu = BoundaryConditions(lhs = lhs_neu, rhs = rhs_neu) |
| 20 | + bc_mix = BoundaryConditions(lhs = lhs_dir, rhs = rhs_neu) |
| 21 | + |
| 22 | + # Precompile FVMProblem creation |
| 23 | + diffusion_function = (u, x, t, p) -> one(u) |
| 24 | + initial_condition = collect(mesh_points) |
| 25 | + |
| 26 | + prob = FVMProblem( |
| 27 | + mesh_points, lhs_dir, rhs_dir; |
| 28 | + diffusion_function = diffusion_function, |
| 29 | + initial_condition = initial_condition, |
| 30 | + final_time = 1.0 |
| 31 | + ) |
| 32 | + |
| 33 | + # Precompile ODEProblem creation - this is a common operation |
| 34 | + ode_prob = SciMLBase.ODEProblem(prob) |
| 35 | + |
| 36 | + # Precompile jacobian_sparsity |
| 37 | + jac_sp = jacobian_sparsity(prob) |
| 38 | + end |
| 39 | +end |
0 commit comments