Skip to content
Snippets Groups Projects
Commit eb83ba7c authored by Florian Atteneder's avatar Florian Atteneder
Browse files

hack in bdryconds for EulerEq

parent 229fddd4
Branches fa/wip/srhd+av
No related tags found
2 merge requests!52improvements to ScalarEq, EulerEq, SRHD,!51Draft: Fa/wip/srhd+av
Pipeline #5805 failed
...@@ -82,6 +82,29 @@ end ...@@ -82,6 +82,29 @@ end
end end
@with_signature function bdryllf(equation::EulerEquation)
@accepts Prefix(lhs), rho, flx_rho, q, flx_q, E, flx_E, v
@accepts Prefix(rhs), init_rho, init_flx_rho, init_q, init_flx_q, init_E, init_flx_E, init_v
@accepts nx
vmax = max(lhs_v, rhs_init_v)
lhs_nflx = nx*lhs_flx_rho
rhs_init_nflx = nx*rhs_init_flx_rho
nflx_rho = LLF(lhs_nflx, rhs_init_nflx, lhs_rho, rhs_init_rho, vmax)
lhs_nflx = nx*lhs_flx_q
rhs_init_nflx = nx*rhs_init_flx_q
nflx_q = LLF(lhs_nflx, rhs_init_nflx, lhs_q, rhs_init_q, vmax)
lhs_nflx = nx*lhs_flx_E
rhs_init_nflx = nx*rhs_init_flx_E
nflx_E = LLF(lhs_nflx, rhs_init_nflx, lhs_E, rhs_init_E, vmax)
@returns nflx_rho, nflx_q, nflx_E
end
@with_signature function av_flux(eq::EulerEquation) @with_signature function av_flux(eq::EulerEquation)
@accepts flx_rho, ldg_rho, flx_q, ldg_q, flx_E, ldg_E, smoothed_mu @accepts flx_rho, ldg_rho, flx_q, ldg_q, flx_E, ldg_E, smoothed_mu
......
...@@ -5,6 +5,7 @@ function initialdata!(env, P::Project, prms, mesh::Mesh1d) ...@@ -5,6 +5,7 @@ function initialdata!(env, P::Project, prms, mesh::Mesh1d)
initialdata_entropy_variables!(env, P, prms) initialdata_entropy_variables!(env, P, prms)
initialdata_hrsc!(env, P, P.hrsc, prms, mesh) initialdata_hrsc!(env, P, P.hrsc, prms, mesh)
initialdata_tci!(env, P, P.tci, prms) initialdata_tci!(env, P, P.tci, prms)
initialdata_bdrycond!(env, P, P.bdrycond, mesh)
end end
function initialdata!(env, P::Project2d, prms, mesh::Mesh2d) function initialdata!(env, P::Project2d, prms, mesh::Mesh2d)
...@@ -220,3 +221,20 @@ function initialdata_tci!(env, P::Project, tci::TCI.AbstractTCI, prms) ...@@ -220,3 +221,20 @@ function initialdata_tci!(env, P::Project, tci::TCI.AbstractTCI, prms)
@unpack flag = get_cell_variables(env.cache) @unpack flag = get_cell_variables(env.cache)
@. flag = 0.0 @. flag = 0.0
end end
function initialdata_bdrycond!(env, P::Project, bdrycond::dg1d.DirichletBC2, mesh)
@unpack rho, q, E = get_dynamic_variables(mesh.cache)
@unpack flx_rho, flx_q, flx_E, v = get_static_variables(mesh.cache)
@unpack init_flx_rho, init_flx_q, init_flx_E, init_v = get_static_variables(mesh.cache)
@unpack init_rho, init_q, init_E = get_static_variables(mesh.cache)
broadcast_volume_2!(speed, P.equation, mesh)
broadcast_volume_2!(flux, P.equation, mesh)
init_rho .= rho
init_q .= q
init_E .= E
init_flx_rho .= flx_rho
init_flx_q .= flx_q
init_flx_E .= flx_E
init_v .= v
end
...@@ -203,6 +203,7 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d, ...@@ -203,6 +203,7 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d,
broadcast_faces_2!(llf, equation, mesh) broadcast_faces_2!(llf, equation, mesh)
broadcast_volume_2!(av_flux, equation, mesh) broadcast_volume_2!(av_flux, equation, mesh)
broadcast_faces_2!(av_nflux, equation, mesh) broadcast_faces_2!(av_nflux, equation, mesh)
dg1d.broadcast_bdry_2!(bdryllf, equation, P.bdrycond, mesh)
compute_rhs_weak_form!(rhs_rho, flx_rho, nflx_rho, mesh) compute_rhs_weak_form!(rhs_rho, flx_rho, nflx_rho, mesh)
compute_rhs_weak_form!(rhs_q, flx_q, nflx_q, mesh) compute_rhs_weak_form!(rhs_q, flx_q, nflx_q, mesh)
......
...@@ -17,18 +17,21 @@ function Project(env::Environment, mesh::Mesh1d, prms) ...@@ -17,18 +17,21 @@ function Project(env::Environment, mesh::Mesh1d, prms)
nothing, nothing nothing, nothing
end end
P = Project(equation, rsolver, hrsc, tci, ldg_rsolver, av_rsolver) bdrycond = dg1d.DirichletBC2()
P = Project(equation, rsolver, hrsc, tci, ldg_rsolver, av_rsolver, bdrycond)
# register variables # register variables
# TODO add a ::Nothing overload for register_variables! # TODO add a ::Nothing overload for register_variables!
# TODO Somehow replace _register_variables! with register_variables! # TODO Somehow replace _register_variables! with register_variables!
@unpack cache = env @unpack cache = env
_register_variables!(mesh, P) _register_variables!(mesh, P)
_register_variables!(mesh.cache, bdrycond)
register_variables!(mesh, rsolver, dont_register=true) register_variables!(mesh, rsolver, dont_register=true)
display(cache)
# setup initial data # setup initial data
initialdata!(env, P, prms["EulerEq"]) initialdata!(env, P, prms["EulerEq"])
# TODO Need to setup some initial viscosity in order to have a chance to even
# start evolving with the EV method and higher orders
# setup boundary conditions # setup boundary conditions
bdryconds = make_BoundaryConditions(env, equation, rsolver, prms["EulerEq"]) bdryconds = make_BoundaryConditions(env, equation, rsolver, prms["EulerEq"])
...@@ -179,3 +182,13 @@ function _register_variables!(mesh, P::Project2d, ::Mesh2d) ...@@ -179,3 +182,13 @@ function _register_variables!(mesh, P::Project2d, ::Mesh2d)
global_variablenames = (:t,) # recent time stamps global_variablenames = (:t,) # recent time stamps
) )
end end
# TODO Already overwritten above
# function _register_variables!(cache, bdryconds::Nothing) end
function _register_variables!(cache, bdryconds::dg1d.AbstractBC)
register_variables!(cache,
static_variablenames = (:init_rho, :init_q, :init_E, :init_v,
:init_flx_rho, :init_flx_q, :init_flx_E)
)
end
...@@ -12,7 +12,8 @@ mutable struct Project{T_Equation <:EulerEquation, ...@@ -12,7 +12,8 @@ mutable struct Project{T_Equation <:EulerEquation,
T_HRSC <:Maybe{HRSC.AbstractHRSC}, T_HRSC <:Maybe{HRSC.AbstractHRSC},
T_TCI <:Maybe{TCI.AbstractTCI}, T_TCI <:Maybe{TCI.AbstractTCI},
T_LDG_RSolver<:Maybe{AbstractRiemannSolver}, T_LDG_RSolver<:Maybe{AbstractRiemannSolver},
T_AV_RSolver<:Maybe{AbstractRiemannSolver}} T_AV_RSolver<:Maybe{AbstractRiemannSolver},
T_BC}
equation::T_Equation equation::T_Equation
rsolver::T_RSolver rsolver::T_RSolver
......
...@@ -10,7 +10,9 @@ id = "sod_shock_tube" ...@@ -10,7 +10,9 @@ id = "sod_shock_tube"
range = [ -1.0, 1.0 ] range = [ -1.0, 1.0 ]
cfl = 0.5 cfl = 0.5
n = 1 n = 1
k = 1000 k = 500
# n = 1
# k = 1000
basis = "lgl" basis = "lgl"
[Output] [Output]
...@@ -22,7 +24,7 @@ variables = [ "rho", "q", "E", "smoothed_mu", "S", "v" ] ...@@ -22,7 +24,7 @@ variables = [ "rho", "q", "E", "smoothed_mu", "S", "v" ]
tend = 0.6 tend = 0.6
[Log] [Log]
progress_stdout = false progress_stdout = true
[HRSC] [HRSC]
method = "av" method = "av"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment