Skip to content

Commit

Permalink
Merge branch 'sm/3d'
Browse files Browse the repository at this point in the history
  • Loading branch information
smarras79 committed Apr 18, 2024
2 parents 1d9f51d + 03c6438 commit 09fd178
Show file tree
Hide file tree
Showing 25 changed files with 323 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github/workflows/CI.yml
docs/build/
plotnodes.py
12 changes: 5 additions & 7 deletions problems/equations/CompEuler/wave1d_lag/user_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ function user_inputs()
# Mesh paramters and files:
#---------------------------------------------------------------------------
:lread_gmsh => false, #If false, a 1D problem will be enforced
#:gmsh_filename => "./meshes/gmsh_grids/2d-grid.msh",
#:gmsh_filename => "./meshes/gmsh_grids/hexa_TFI_25x25.msh",
#:gmsh_filename => "./meshes/gmsh_grids/circle_TFI.msh",
#:gmsh_filename => "./meshes/gmsh_grids/hexa_TFI_10x10_periodic.msh",
#---------------------------------------------------------------------------
# Output formats: "png" -> plots to png file. "ascii" -> data to npoin file
#---------------------------------------------------------------------------
:outformat => "png", #choice: "png", "ascii" (default is ascii)
:plot_vlines => [-2.5,2.5],
:plot_axis => [-0.05,0.55, -0.35,0.35],
:outformat => "png", #choice: "png", "ascii" (default is ascii)
:loverwrite_output => true,
:output_dir => "./CI-runs", #this is in github
:plot_vlines => [-2.5,2.5],
:plot_axis => [-0.05,0.55, -0.35,0.35],
#---------------------------------------------------------------------------
# 1D (lread_gmsh => faluse): the grid is built by jexpresso
#---------------------------------------------------------------------------
Expand Down
56 changes: 56 additions & 0 deletions test/CI-ref/CompEuler/theta/user_inputs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function user_inputs()
inputs = Dict(
#---------------------------------------------------------------------------
# User define your inputs below: the order doesn't matter
#---------------------------------------------------------------------------
:ode_solver => SSPRK54(), #ORK256(),#SSPRK33(), #SSPRK33(), #SSPRK54(),
:Δt => 0.4,
:tinit => 0.0,
:tend => 1000.0,
#:tinit => 100.0,
#:tend => 1000.0,
#:lrestart => true,
:restart_input_file_path => "./output/CompEuler/theta/output-19Nov2023-115126",
:ndiagnostics_outputs => 2,
#:case => "rtb",
:lsource => true,
#---------------------------------------------------------------------------
#Integration and quadrature properties
#---------------------------------------------------------------------------
:interpolation_nodes =>"lgl",
:nop => 4, # Polynomial order
#---------------------------------------------------------------------------
# Physical parameters/constants:
#---------------------------------------------------------------------------
:lvisc => true, #false by default NOTICE: works only for Inexact
:ivisc_equations => (1, 2, 3, 4),
=> (0.0, 20.0, 20.0, 60.0), #horizontal viscosity constant for momentum
#---------------------------------------------------------------------------
# Mesh paramters and files:
#---------------------------------------------------------------------------
:lread_gmsh => true, #If false, a 1D problem will be enforced
#:gmsh_filename => "./meshes/gmsh_grids/hexa_circle.msh",
:gmsh_filename => "./meshes/gmsh_grids/hexa_TFI_RTB20x20.msh", #for nop=4
#---------------------------------------------------------------------------
# Filter parameters
#---------------------------------------------------------------------------
#:lfilter => true,
#:mu_x => 0.01,
#:mu_y => 0.01,
#:filter_type => "erf",
#---------------------------------------------------------------------------
# Plotting parameters
#---------------------------------------------------------------------------
:outformat => "vtk",
:loverwrite_output => true,
:output_dir => "./output/",
:loutput_pert => true, #this is only implemented for VTK for now
#---------------------------------------------------------------------------
) #Dict
#---------------------------------------------------------------------------
# END User define your inputs below: the order doesn't matter
#---------------------------------------------------------------------------

return inputs

end
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_1.h5
Binary file not shown.
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_2.h5
Binary file not shown.
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_3.h5
Binary file not shown.
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_4.h5
Binary file not shown.
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_5.h5
Binary file not shown.
Binary file modified test/CI-ref/CompEuler/thetaTracers/var_6.h5
Binary file not shown.
55 changes: 55 additions & 0 deletions test/CI-ref/CompEuler/wave1d_lag/user_inputs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
function user_inputs()
inputs = Dict(
#---------------------------------------------------------------------------
#
# User define your inputs below: the order doesn't matter
# IMPORTANT NOTICE: DO NOT FORGET the "," at the end of each entry!!!
#---------------------------------------------------------------------------
:ode_solver => SSPRK33(),
:tend => 9.0,
:Δt => 1.0e-3,
:ndiagnostics_outputs => 30, #these are steps, not seconds
:output_dir => "./output/",
#---------------------------------------------------------------------------
#Integration and quadrature properties
#---------------------------------------------------------------------------
:interpolation_nodes => "lgl", # Choice: "lgl", "cg", "cgl"
:nop => 6, # Polynomial order
:nop_laguerre => 50,
:lexact_integration => false,
:lsource => true,
:llaguerre_1d_right => true,
:llaguerre_1d_left => true,
:laguerre_beta => 1.0,
:yfac_laguerre => 0.05,
#---------------------------------------------------------------------------
# Physical parameters/constants:
#---------------------------------------------------------------------------
:lvisc => false,
:νx => 0.01, #kinematic viscosity constant
:νy => 0.01, #kinematic viscosity constant
#---------------------------------------------------------------------------
# Mesh paramters and files:
#---------------------------------------------------------------------------
:lread_gmsh => false, #If false, a 1D problem will be enforced
#---------------------------------------------------------------------------
# Output formats: "png" -> plots to png file. "ascii" -> data to npoin file
#---------------------------------------------------------------------------
:outformat => "hdf5", #choice: "png", "ascii" (default is ascii)
:loverwrite_output => true,
:plot_vlines => [-2.5,2.5],
:plot_axis => [-0.05,0.55, -0.35,0.35],
#---------------------------------------------------------------------------
# 1D (lread_gmsh => faluse): the grid is built by jexpresso
#---------------------------------------------------------------------------
:xmin => -2.5,
:xmax => 2.5,
:nelx => 50,
) #Dict
#---------------------------------------------------------------------------
# END User define your inputs below: the order doesn't matter
#---------------------------------------------------------------------------

return inputs

end
Binary file added test/CI-ref/CompEuler/wave1d_lag/var_1.h5
Binary file not shown.
Binary file added test/CI-ref/CompEuler/wave1d_lag/var_2.h5
Binary file not shown.
2 changes: 2 additions & 0 deletions test/CI-runs/CompEuler/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ module CompEulerTests
using Test

@testset "theta" begin include("theta/thetaTests.jl") end
@testset "thetaTracers" begin include("thetaTracers/thetaTests.jl") end
@testset "wave1d_lag" begin include("wave1d_lag/Tests.jl") end

end # module
1 change: 0 additions & 1 deletion test/CI-runs/CompEuler/theta/meshes

This file was deleted.

1 change: 0 additions & 1 deletion test/CI-runs/CompEuler/theta/user_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function user_inputs()
#---------------------------------------------------------------------------
:outformat => "hdf5",
:loverwrite_output => true,
# :output_dir => "./test/CI-runs",
:output_dir => "./CI-runs", #this is in github
:loutput_pert => true, #this is only implemented for VTK for now
#---------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion test/CI-runs/CompEuler/thetaTracers/delete_output_dirs

This file was deleted.

10 changes: 10 additions & 0 deletions test/CI-runs/CompEuler/thetaTracers/thetaTests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module CompEulerthetaTests

project_root = dirname(Base.current_project())
include(joinpath(project_root, "test", "solnCompare.jl"))

using .solnCompare
using Test

@testset "JEXPRESSO Examples" begin run_example("CompEuler", "thetaTracers") end
end # module
1 change: 0 additions & 1 deletion test/CI-runs/CompEuler/thetaTracers/user_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function user_inputs()
#---------------------------------------------------------------------------
:outformat => "hdf5",
:loverwrite_output => true,
#:output_dir => "./test/CI-runs",
:output_dir => "./CI-runs",
:loutput_pert => true, #this is only implemented for VTK for now
#---------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/Tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module CompEulerthetaTests

project_root = dirname(Base.current_project())
include(joinpath(project_root, "test", "solnCompare.jl"))

using .solnCompare
using Test

@testset "JEXPRESSO Examples" begin run_example("CompEuler", "wave1d_lag") end
end # module
40 changes: 40 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/initialize.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function initialize(SD, PT, mesh::St_mesh, inputs::Dict, OUTPUT_DIR::String, TFloat)
"""
"""
@info " Initialize fields for 1D adv diff ........................ "

#---------------------------------------------------------------------------------
# Solution variables:
#
# NOTICE: while these names can be arbitrary, the length of this tuple
# defines neqs, which is used to allocate all necessary equation-dependent arrays
#
#---------------------------------------------------------------------------------
qvars = ("u", "v")
q = define_q(SD, mesh.nelem, mesh.npoin, mesh.ngl, qvars, TFloat; neqs=length(qvars))
#---------------------------------------------------------------------------------

σ = Float64(0.15)
σ2= σ*σ
for ip=1:mesh.npoin
x = mesh.x[ip]

ex = -(x - 0.0)^2/σ2
q.qn[ip,1] = 2^ex
q.qn[ip,2] = 0.0

#Store initial background state for plotting and analysis of pertuebations
q.qe[ip,1] = 0.0
q.qe[ip,2] = 0.0

end

for ivar=1:length(qvars)
plot_initial(SD, mesh.x, q.qn[:,ivar], ivar, OUTPUT_DIR)
end

@info " Initialize fields for 1D adv diff ........................ DONE "

return q
end
41 changes: 41 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/user_bc.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
qibdy is an Array{Floats} of size `nvars`
src/equations/EQUATIONS_NAME/user_bc.jl contains a set of user-defined boundary conditions functions
that can be modified as needed.
The function defined in src/equations/EQUATIONS_NAME/user_bc.jl
are called by the b.c. functions defined in src/kernel/custom_bcs.jl
within a boundary-edge loop that detects the "tag" string defined in the user-generated *.msh file.
For example:
If some domain boundaries of gmsh file mymesh.msh are tagged as "inflow" and "no_slip", then the user
creating the functions in user_bc.jl must define the behavior of the unknown or its derivatives
on those boundaries.
```math
if (tag === "inflow")
qibdy[1] = 3.0
elseif (tag === "fix_temperature")
qibdy[2] = 300.0
end
return qibdy
```
where `qibdy[i=1:nvar]` is the value unknown `i`
"""
function user_bc_dirichlet!(q::SubArray{Float64}, x::AbstractFloat, t::AbstractFloat, tag::String,qbdy::AbstractArray,qe::SubArray{Float64},::TOTAL)

nothing
end

function user_bc_dirichlet!(q::SubArray{Float64}, x::AbstractFloat, t::AbstractFloat, tag::String,qbdy::AbstractArray,qe::SubArray{Float64},::PERT)

nothing
end

function user_bc_neumann(q::AbstractArray, gradq::AbstractArray, x::AbstractFloat, t::AbstractFloat, inputs::Dict)

flux = zeros(size(q,2),1)
return flux
end
10 changes: 10 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/user_flux.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function user_flux!(F::SubArray{Float64}, G::SubArray{Float64}, SD::NSD_1D,
q::SubArray{Float64},
qe::SubArray{Float64},
mesh::St_mesh,
::CL, ::TOTAL; neqs=4, ip=1)

F[1] = q[2]
F[2] = q[1]

end
56 changes: 56 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/user_inputs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function user_inputs()
inputs = Dict(
#---------------------------------------------------------------------------
#
# User define your inputs below: the order doesn't matter
# IMPORTANT NOTICE: DO NOT FORGET the "," at the end of each entry!!!
#---------------------------------------------------------------------------
:ode_solver => SSPRK33(),
:tend => 9.0,
:Δt => 1.0e-3,
:ndiagnostics_outputs => 30, #these are steps, not seconds
:output_dir => "./output/",
#---------------------------------------------------------------------------
#Integration and quadrature properties
#---------------------------------------------------------------------------
:interpolation_nodes => "lgl", # Choice: "lgl", "cg", "cgl"
:nop => 6, # Polynomial order
:nop_laguerre => 50,
:lexact_integration => false,
:lsource => true,
:llaguerre_1d_right => true,
:llaguerre_1d_left => true,
:laguerre_beta => 1.0,
:yfac_laguerre => 0.05,
#---------------------------------------------------------------------------
# Physical parameters/constants:
#---------------------------------------------------------------------------
:lvisc => false,
:νx => 0.01, #kinematic viscosity constant
:νy => 0.01, #kinematic viscosity constant
#---------------------------------------------------------------------------
# Mesh paramters and files:
#---------------------------------------------------------------------------
:lread_gmsh => false, #If false, a 1D problem will be enforced
#---------------------------------------------------------------------------
# Output formats: "png" -> plots to png file. "ascii" -> data to npoin file
#---------------------------------------------------------------------------
:outformat => "hdf5", #choice: "png", "ascii" (default is ascii)
:loverwrite_output => true,
:output_dir => "./CI-runs", #this is in github
:plot_vlines => [-2.5,2.5],
:plot_axis => [-0.05,0.55, -0.35,0.35],
#---------------------------------------------------------------------------
# 1D (lread_gmsh => faluse): the grid is built by jexpresso
#---------------------------------------------------------------------------
:xmin => -2.5,
:xmax => 2.5,
:nelx => 50,
) #Dict
#---------------------------------------------------------------------------
# END User define your inputs below: the order doesn't matter
#---------------------------------------------------------------------------

return inputs

end
35 changes: 35 additions & 0 deletions test/CI-runs/CompEuler/wave1d_lag/user_source.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function user_source!(S::SubArray{Float64}, q::SubArray{Float64}, qe::SubArray{Float64}, npoin, ::CL,::TOTAL; neqs=1,x=0.0, y=0.0, ymin=0.0, ymax=30000.0, ngl=5, nely=10,xmin = -120000, xmax =120000)

PhysConst = PhysicalConst{Float64}()

#
# S(q(x)) = -ρg
#

if (x >= 2.49)#nsponge_points * dsy) #&& dbl >= 0.0)
sponge_coe = 2.0/(1+exp((0.3*(xmax-2.5)-x+2.5)/((xmax)/18)))
elseif (x <=-2.49)
sponge_coe = 2.0/(1+exp(-(0.3*(xmin+2.5)-x-2.5)/((xmax)/18)))
else
sponge_coe = 0.0
end
#@info xmin,xmax,x,sponge_coe
zt = xmax
zd = 5000.0
z = max(x-zd,0.0)
dgamma =0.00005
alpha = 0.85
sigma = zt/18.0
fac1 = (alpha*zt-x)/sigma
#=if (x >=60.0)
cs = dgamma/(1+exp(fac1))
else
cs = 0.0
end=#
#cs = 1.0*sinpi(0.5*z/(zt-zd))^2
cs = min(sponge_coe,1)
#@info "β x: " ctop,cxr,cxl,cs, zs, y, x, ymin, ymax, dsy, dbl
S[1] = -(cs)*(q[1])
S[2] = -(cs)*(q[2])
return S
end
3 changes: 2 additions & 1 deletion test/solnCompare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ function run_example(parsed_equations::String, parsed_equations_case_name::Strin
end

finally
nothing
# Ensure we navigate back to the initial directory
cd(project_root)
# cd(project_root)
end
end

Expand Down

0 comments on commit 09fd178

Please sign in to comment.