Skip to content

Commit

Permalink
update energy argument for physics API and use mesh_dev in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mberto79 committed Aug 29, 2024
1 parent e3dc07b commit f23a96c
Show file tree
Hide file tree
Showing 36 changed files with 95 additions and 92 deletions.
6 changes: 3 additions & 3 deletions CASE_3D_BFS U.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mesh_file = "unv_sample_meshes/bfs_unv_tet_10mm.unv"

@time mesh = UNV3D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.5, 0.0, 0.0]
nu = 1e-3
Expand All @@ -22,8 +22,8 @@ model = Physics(
time = Transient(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
4 changes: 2 additions & 2 deletions CASE_3D_BFS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mesh_file = "unv_sample_meshes/bfs_unv_tet_10mm.unv"
mesh_file = "unv_sample_meshes/bfs_OF_tet_meshes/5mm/polyMesh/"
@time mesh = FOAM3D_mesh(mesh_file, scale=0.001, integer_type=Int64, float_type=Float64)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.5, 0.0, 0.0]
nu = 1e-3
Expand All @@ -22,7 +22,7 @@ model = Physics(
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = Energy{Isothermal}(),
domain = mesh_gpu
domain = mesh_dev
)


Expand Down
4 changes: 2 additions & 2 deletions CASE_3D_BFS_LES.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using CUDA
mesh_file = "unv_sample_meshes/bfs_unv_hex_5mm.unv"
mesh = UNV3D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

# INLET CONDITIONS

Expand All @@ -24,7 +24,7 @@ model = Physics(
time = Transient(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = LES{Smagorinsky}(),
energy = nothing,
energy = Energy{Isothermal}(),
domain = mesh
)

Expand Down
6 changes: 3 additions & 3 deletions CASE_3D_box.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mesh_file="unv_sample_meshes/box_TET_PRISM_25_5mm.unv"

@time mesh=UNV3D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.01,0.0,0.0]
nu=1e-3
Expand All @@ -29,8 +29,8 @@ model = Physics(
time = Steady(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
6 changes: 3 additions & 3 deletions CASE_3D_cylinder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mesh_file = "unv_sample_meshes/3D_cylinder_extruded_HEX_PRISM_FIXED.unv"
mesh_file = "unv_sample_meshes/3D_cylinder_extruded_HEX_PRISM_FIXED_2mm_fine.unv"
@time mesh = UNV3D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.50, 0.0, 0.0]
velocity = [0.50, 0.0, 0.0]
Expand All @@ -24,8 +24,8 @@ model = Physics(
time = Steady(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
6 changes: 3 additions & 3 deletions CASE_3D_cylinder_U.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mesh_file = "unv_sample_meshes/3D_cylinder.unv"
mesh_file = "unv_sample_meshes/3D_cylinder_extruded_HEX_PRISM_FIXED_2mm.unv"
@time mesh = UNV3D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.5, 0.0, 0.0]
noSlip = [0.0, 0.0, 0.0]
Expand All @@ -21,8 +21,8 @@ model = Physics(
time = Transient(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
6 changes: 3 additions & 3 deletions CASE_OF_CRMHL_Wingbody.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ using CUDA
mesh_file = "unv_sample_meshes/OF_CRMHL_Wingbody_1v/polyMesh/"
@time mesh = FOAM3D_mesh(mesh_file, scale=0.001, integer_type=Int64, float_type=Float64)

mesh_gpu = adapt(CUDABackend(), mesh)
# mesh_gpu = mesh
mesh_dev = adapt(CUDABackend(), mesh)
# mesh_dev = mesh

# # check volume calculation
# volumes = ScalarField(mesh)
Expand All @@ -34,7 +34,7 @@ model = Physics(
# turbulence = LES{Smagorinsky}(),
energy = Energy{Isothermal}(),
# domain = mesh
domain = mesh_gpu
domain = mesh_dev
)

walls = [:Fuselage, :FuselageAft, :Windshield, :WindshieldFrame, :WingLower,
Expand Down
4 changes: 2 additions & 2 deletions CASE_OF_buildings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using CUDA
mesh_file = "unv_sample_meshes/OF_buildings/polyMesh/"
@time mesh = FOAM3D_mesh(mesh_file, integer_type=Int64, float_type=Float64)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

Umag = 1.5
velocity = [Umag, 0.0, 0.0]
Expand All @@ -23,7 +23,7 @@ model = Physics(
time = Steady(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{KOmega}(),
energy = nothing,
energy = Energy{Isothermal}(),
domain = mesh
)

Expand Down
9 changes: 5 additions & 4 deletions CASE_UNV_BFS_U.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ using CUDA
mesh_file = "unv_sample_meshes/backwardFacingStep_10mm.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)
mesh_dev = mesh

velocity = [0.5, 0.0, 0.0]
nu = 1e-3
Expand All @@ -18,14 +19,14 @@ model = Physics(
time = Transient(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{Laminar}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Dirichlet(:inlet, velocity),
Neumann(:outlet, 0.0),
Dirichlet(:wall, [0.0, 0.0, 0.0]),
Wall(:wall, [0.0, 0.0, 0.0]),
Dirichlet(:top, [0.0, 0.0, 0.0])
)

Expand Down
9 changes: 5 additions & 4 deletions CASE_UNV_BFS_U_lowRe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ mesh_file = "unv_sample_meshes/backwardFacingStep_5mm.unv"
# mesh_file = "unv_sample_meshes/backwardFacingStep_2mm.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)
mesh_dev = mesh

nu = 1e-3
u_mag = 1.5
Expand All @@ -22,14 +23,14 @@ model = Physics(
time = Transient(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{KOmega}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Dirichlet(:inlet, velocity),
Neumann(:outlet, 0.0),
Dirichlet(:wall, [0.0, 0.0, 0.0]),
Wall(:wall, [0.0, 0.0, 0.0]),
Dirichlet(:top, [0.0, 0.0, 0.0])
)

Expand Down
4 changes: 2 additions & 2 deletions CASE_UNV_BFS_highRe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using CUDA
mesh_file = "unv_sample_meshes/backwardFacingStep_5mm_long.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

nu = 1e-3
u_mag = 3.5
Expand All @@ -24,7 +24,7 @@ model = Physics(
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{KOmega}(),
energy = Energy{Isothermal}(),
domain = mesh_gpu
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
33 changes: 17 additions & 16 deletions CASE_UNV_BFS_lowRe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ mesh_file = "unv_sample_meshes/backwardFacingStep_5mm.unv"
mesh_file = "unv_sample_meshes/backwardFacingStep_2mm.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)
mesh_dev = mesh

nu = 1e-3
# u_mag = 3.5 # 2mm mesh
Expand All @@ -25,14 +26,14 @@ model = Physics(
time = Steady(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{KOmega}(),
energy = nothing,
domain = mesh_gpu
energy = Energy{Isothermal}(),
domain = mesh_dev
)

@assign! model momentum U (
Dirichlet(:inlet, velocity),
Neumann(:outlet, 0.0),
Dirichlet(:wall, [0.0, 0.0, 0.0]),
Wall(:wall, [0.0, 0.0, 0.0]),
Dirichlet(:top, [0.0, 0.0, 0.0])
)

Expand Down Expand Up @@ -65,7 +66,7 @@ model = Physics(
)

schemes = (
U = set_schemes(gradient=Midpoint),
U = set_schemes(divergence=LUST, gradient=Midpoint),
p = set_schemes(gradient=Midpoint),
k = set_schemes(gradient=Midpoint),
omega = set_schemes(gradient=Midpoint)
Expand All @@ -78,35 +79,35 @@ solvers = (
preconditioner = Jacobi(),
convergence = 1e-7,
relax = 0.7,
rtol = 1e-5,
atol = 1e-2
rtol = 1e-2,
atol = 1e-10
),
p = set_solver(
model.momentum.p;
solver = CgSolver, #GmresSolver, #CgSolver, # BicgstabSolver, GmresSolver
preconditioner = Jacobi(),
convergence = 1e-7,
relax = 0.3,
rtol = 1e-5,
atol = 1e-3
rtol = 1e-3,
atol = 1e-10
),
k = set_solver(
model.turbulence.k;
solver = BicgstabSolver, # BicgstabSolver, GmresSolver
preconditioner = Jacobi(),
convergence = 1e-7,
relax = 0.7,
rtol = 1e-5,
atol = 1e-2
relax = 0.3,
rtol = 1e-2,
atol = 1e-10
),
omega = set_solver(
model.turbulence.omega;
solver = BicgstabSolver, # BicgstabSolver, GmresSolver
preconditioner = Jacobi(),
convergence = 1e-7,
relax = 0.7,
rtol = 1e-5,
atol = 1e-2
relax = 0.3,
rtol = 1e-2,
atol = 1e-10
)
)

Expand All @@ -130,7 +131,7 @@ initialise!(model.turbulence.nut, k_inlet/ω_inlet)

Rx, Ry, Rz, Rp, model_out = run!(model, config) # 36.90k allocs

Reff = stress_tensor(model.momentum.U, nu, model.turbulence.nut)
Reff = stress_tensor(model.momentum.U, nu, model.turbulence.nut, config)
Fp = pressure_force(:wall, model.momentum.p, 1.25)
Fv = viscous_force(:wall, model.momentum.U, 1.25, nu, model.turbulence.nut)

Expand Down
2 changes: 1 addition & 1 deletion CASE_UNV_BFS_transonic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using XCALibre
mesh_file = "unv_sample_meshes/backwardFacingStep_5mm.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

# mesh_gpu = adapt(CUDABackend(), mesh)
# mesh_dev = adapt(CUDABackend(), mesh)

velocity = [600, 0.0, 0.0]
nu = 1e-1
Expand Down
6 changes: 3 additions & 3 deletions CASE_UNV_flatplate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ using Krylov
mesh_file = "unv_sample_meshes/flatplate_2D_laminar.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

# mesh_gpu = adapt(CUDABackend(), mesh)
mesh_gpu = mesh
# mesh_dev = adapt(CUDABackend(), mesh)
mesh_dev = mesh

velocity = [0.2, 0.0, 0.0]
nu = 1e-5
Expand All @@ -23,7 +23,7 @@ model = Physics(
),
turbulence = RANS{Laminar}(),
energy = Energy{Isothermal}(),
domain = mesh_gpu
domain = mesh_dev
)

@assign! model momentum U (
Expand Down
4 changes: 2 additions & 2 deletions CASE_UNV_flatplate_LKE_ERCOFTAC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mesh_file = "unv_sample_meshes/flatplate_transition.unv"

mesh = UNV2D_mesh(mesh_file, scale=0.001)

mesh_gpu = adapt(CUDABackend(), mesh)
mesh_dev = adapt(CUDABackend(), mesh)

# Turbulence Model
velocity = [5.4,0,0]
Expand All @@ -26,7 +26,7 @@ model = Physics(
time = Steady(),
fluid = Fluid{Incompressible}(nu = nu),
turbulence = RANS{KOmegaLKE}(Tu = 0.01, walls=(:wall,)),
energy = nothing,
energy = Energy{Isothermal}(),
domain = mesh
)

Expand Down
2 changes: 1 addition & 1 deletion CASE_UNV_flatplate_fixedT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Krylov
mesh_file = "unv_sample_meshes/flatplate_2D_laminar.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

# mesh_gpu = adapt(CUDABackend(), mesh)
# mesh_dev = adapt(CUDABackend(), mesh)

velocity = [0.2, 0.0, 0.0]
nu = 1e-4
Expand Down
2 changes: 1 addition & 1 deletion CASE_UNV_flatplate_fixedT_KOmega.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Krylov
mesh_file = "unv_sample_meshes/flatplate_2D_laminar.unv"
mesh = UNV2D_mesh(mesh_file, scale=0.001)

# mesh_gpu = adapt(CUDABackend(), mesh)
# mesh_dev = adapt(CUDABackend(), mesh)

velocity = [10, 0.0, 0.0]
nu = 1e-4
Expand Down
Loading

0 comments on commit f23a96c

Please sign in to comment.