Skip to content
Snippets Groups Projects

Implement regularizations for Euler eq

Closed Florian Atteneder requested to merge fa/euler-new-regulates into main
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
+ 119
13
@@ -213,20 +213,33 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d,
bdryconds, ldg_bdryconds, av_bdryconds)
@unpack cache, mesh = env
@unpack equation = P
@unpack equation, prms = P
reg = prms.av_regularization
if reg === :mono
rhs_mono!(cache, mesh, equation, P)
elseif reg === :navierstokes
rhs_navierstokes!(cache, mesh, equation, P)
elseif reg === :general
rhs_general!(cache, mesh, equation, P)
else
TODO(reg)
end
end
@unpack rho, q, E = get_dynamic_variables(cache)
function rhs_mono!(cache, mesh, equation, P)
@unpack rho, q, E = get_dynamic_variables(cache)
@unpack flx_rho, flx_q, flx_E, p, eps,
ldg_rho, ldg_q, ldg_E,
flx_ldg_rho, flx_ldg_q, flx_ldg_E = get_static_variables(cache)
@unpack rhs_rho, rhs_q, rhs_E = get_rhs_variables(cache)
@unpack nflx_rho, nflx_q, nflx_E,
nflx_ldg_rho, nflx_ldg_q, nflx_ldg_E = get_bdry_variables(cache)
ldg_rho, ldg_q, ldg_E = get_static_variables(cache)
@unpack rhs_rho, rhs_q, rhs_E = get_rhs_variables(cache)
@unpack nflx_rho, nflx_q, nflx_E = get_bdry_variables(cache)
@unpack bdry_rho, bdry_q, bdry_E,
bdry_v,
bdry_ldg_rho, bdry_ldg_q, bdry_ldg_E,
bdry_smoothed_mu = get_bdry_variables(mesh.cache)
@unpack v, smoothed_mu = get_static_variables(mesh.cache)
bdry_smoothed_mu = get_bdry_variables(mesh.cache)
@unpack v, smoothed_mu = get_static_variables(mesh.cache)
dg1d.interpolate_face_data!(mesh, rho, bdry_rho)
dg1d.interpolate_face_data!(mesh, q, bdry_q)
@@ -234,8 +247,8 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d,
dg1d.interpolate_face_data!(mesh, v, bdry_v)
## solve auxiliary equation: q + ∂x u = 0
dg1d.new_broadcast_faces!(ldg_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(ldg_bdryllf, equation, mesh)
dg1d.new_broadcast_faces!(mono_ldg_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(mono_ldg_bdryllf, equation, mesh)
compute_rhs_weak_form!(ldg_rho, rho, nflx_rho, mesh)
compute_rhs_weak_form!(ldg_q, q, nflx_q, mesh)
compute_rhs_weak_form!(ldg_E, E, nflx_E, mesh)
@@ -249,8 +262,51 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d,
dg1d.interpolate_face_data!(mesh, ldg_E, bdry_ldg_E)
dg1d.interpolate_face_data!(mesh, smoothed_mu, bdry_smoothed_mu)
dg1d.new_broadcast_volume!(av_flux, equation, mesh)
dg1d.new_broadcast_faces!(av_nflux, equation, mesh)
dg1d.new_broadcast_volume!(mono_av_flux, equation, mesh)
dg1d.new_broadcast_faces!(mono_av_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(mono_bdryllf, equation, mesh)
# TODO don't we also need av_bdrylff here?
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_E, flx_E, nflx_E, mesh)
return
end
function rhs_navierstokes!(cache, mesh, equation, P)
@unpack rho, q, E = get_dynamic_variables(cache)
@unpack flx_rho, flx_q, flx_E, u,
ldg_u = get_static_variables(cache)
@unpack rhs_rho, rhs_q, rhs_E = get_rhs_variables(cache)
@unpack nflx_rho, nflx_q, nflx_E, nflx_u = get_bdry_variables(cache)
@unpack bdry_rho, bdry_q, bdry_E,
bdry_v, bdry_u,
bdry_ldg_u,
bdry_smoothed_mu = get_bdry_variables(mesh.cache)
@unpack v, smoothed_mu = get_static_variables(mesh.cache)
dg1d.new_broadcast_volume!(navierstokes_u, equation, mesh)
dg1d.interpolate_face_data!(mesh, rho, bdry_rho)
dg1d.interpolate_face_data!(mesh, q, bdry_q)
dg1d.interpolate_face_data!(mesh, E, bdry_E)
dg1d.interpolate_face_data!(mesh, v, bdry_v)
dg1d.interpolate_face_data!(mesh, u, bdry_u)
## solve auxiliary equation: q + ∂x u = 0
dg1d.new_broadcast_faces!(navierstokes_ldg_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(navierstokes_ldg_bdryllf, equation, mesh)
compute_rhs_weak_form!(ldg_u, u, nflx_u, mesh)
## compute rhs of regularized equation: ∂t u + ∂x f + ∂x μ q = 0
dg1d.new_broadcast_volume!(flux, equation, mesh)
dg1d.new_broadcast_faces!(llf, equation, mesh)
dg1d.interpolate_face_data!(mesh, ldg_u, bdry_ldg_u)
dg1d.interpolate_face_data!(mesh, smoothed_mu, bdry_smoothed_mu)
dg1d.new_broadcast_volume!(navierstokes_av_flux, equation, mesh)
dg1d.new_broadcast_faces!(navierstokes_av_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(bdryllf, equation, mesh)
# TODO don't we also need av_bdrylff here?
@@ -260,6 +316,56 @@ function rhs!(env, P::Project, hrsc::HRSC.AbstractArtificialViscosity, ::Mesh1d,
return
end
function rhs_general!(cache, mesh, equation)
TODO()
@unpack rho, q, E = get_dynamic_variables(cache)
@unpack flx_rho, flx_q, flx_E, p, eps,
ldg_rho, ldg_rhoe, ldg_u,
flx_ldg_rho, flx_ldg_q, flx_ldg_E = get_static_variables(cache)
@unpack rhs_rho, rhs_q, rhs_E = get_rhs_variables(cache)
@unpack nflx_rho, nflx_q, nflx_E,
nflx_ldg_rho, nflx_ldg_q, nflx_ldg_E = get_bdry_variables(cache)
@unpack bdry_rho, bdry_q, bdry_E,
bdry_v,
bdry_ldg_rho, bdry_ldg_rhoe, bdry_ldg_u,
bdry_smoothed_mu = get_bdry_variables(mesh.cache)
@unpack v, smoothed_mu = get_static_variables(mesh.cache)
dg1d.new_broadcast_volume!(mono_rhoeps, equation, mesh)
dg1d.interpolate_face_data!(mesh, rho, bdry_rho)
dg1d.interpolate_face_data!(mesh, rhoeps, bdry_rhoeps)
dg1d.interpolate_face_data!(mesh, u, bdry_u)
dg1d.interpolate_face_data!(mesh, v, bdry_v)
## solve auxiliary equation: q + ∂x u = 0
dg1d.new_broadcast_faces!(general_ldg_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(general_ldg_bdryllf, equation, mesh)
compute_rhs_weak_form!(ldg_rho, rho, nflx_rho, mesh)
compute_rhs_weak_form!(ldg_q, rhoeps, nflx_rhoeps, mesh)
compute_rhs_weak_form!(ldg_E, u, nflx_u, mesh)
## compute rhs of regularized equation: ∂t u + ∂x f + ∂x μ q = 0
dg1d.new_broadcast_volume!(flux, equation, mesh)
dg1d.new_broadcast_faces!(llf, equation, mesh)
dg1d.interpolate_face_data!(mesh, ldg_rho, bdry_ldg_rho)
dg1d.interpolate_face_data!(mesh, ldg_rhoeps, bdry_ldg_rhoeps)
dg1d.interpolate_face_data!(mesh, ldg_u, bdry_ldg_u)
dg1d.interpolate_face_data!(mesh, smoothed_mu, bdry_smoothed_mu)
dg1d.new_broadcast_volume!(general_av_flux, equation, mesh)
dg1d.new_broadcast_faces!(general_av_nflux, equation, mesh)
dg1d.new_broadcast_bdry!(general_bdryllf, equation, mesh)
# TODO don't we also need av_bdrylff here?
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_E, flx_E, nflx_E, mesh)
return
end
function rhs!(env, P::Project2d, hrsc::HRSC.AbstractArtificialViscosity, mesh::Mesh2d,
Loading