Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parabolic terms for DGMulti #1136

Merged

Conversation

jlchan
Copy link
Contributor

@jlchan jlchan commented May 20, 2022

This PR should introduce a framework for LDG-type discretizations of parabolic terms. Boundary conditions are specified for the inviscid and viscous parts separately; combined boundary conditions such as Robin BCs will need some additional work to implement.

  • Add a parabolic solver field (or at least a way to specify parabolic numerical parameters)
  • Decide how general we want the BCs to be

@codecov
Copy link

codecov bot commented May 21, 2022

Codecov Report

Merging #1136 (63d67d7) into dev (b6d801c) will decrease coverage by 0.01%.
The diff coverage is 96.31%.

@@            Coverage Diff             @@
##              dev    #1136      +/-   ##
==========================================
- Coverage   96.79%   96.78%   -0.01%     
==========================================
  Files         309      314       +5     
  Lines       24258    24487     +229     
==========================================
+ Hits        23479    23699     +220     
- Misses        779      788       +9     
Flag Coverage Δ
unittests 96.78% <96.31%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../dgmulti_2d/elixir_advection_diffusion_periodic.jl 0.00% <0.00%> (ø)
src/Trixi.jl 66.67% <ø> (ø)
src/visualization/types.jl 94.87% <ø> (ø)
...ization/semidiscretization_hyperbolic_parabolic.jl 91.46% <91.46%> (ø)
examples/dgmulti_2d/elixir_advection_diffusion.jl 100.00% <100.00%> (ø)
src/equations/equations.jl 98.08% <100.00%> (+0.40%) ⬆️
src/equations/laplace_diffusion_2d.jl 100.00% <100.00%> (ø)
src/solvers/dgmulti/dg.jl 98.90% <100.00%> (-0.01%) ⬇️
src/solvers/dgmulti/dg_parabolic.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6d801c...63d67d7. Read the comment docs.

jlchan added 2 commits May 27, 2022 05:53
avoids conflicts when using dg::DGMultiFluxDiff
examples/dgmulti_2d/elixir_advection_diffusion.jl Outdated Show resolved Hide resolved
src/equations/equations.jl Outdated Show resolved Hide resolved
src/equations/equations.jl Outdated Show resolved Hide resolved
src/equations/laplace_diffusion_2d.jl Outdated Show resolved Hide resolved
@jlchan jlchan closed this May 27, 2022
@jlchan jlchan reopened this May 27, 2022
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're good to go when the remaining open discussions are resolved or added to the list in #1147. Thanks, @jlchan!

Copy link
Member

@sloede sloede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Good to go for dev from my side.

@jlchan
Copy link
Contributor Author

jlchan commented May 27, 2022

Thanks @sloede and @ranocha for the reviews! Hopefully the tests are fixed now and this can move to dev.

@jlchan jlchan merged commit c60c025 into trixi-framework:dev May 27, 2022
@jlchan
Copy link
Contributor Author

jlchan commented May 27, 2022

Tests were passing except for Codecov, and coverage losses were being reported in files we didn't change. I went ahead and merged since I think these are spurious failures.

ranocha added a commit that referenced this pull request Oct 11, 2022
* Parabolic terms for DGMulti (#1136)

* minor formatting

* adding multi-term semidiscretization

* fixing bug and adding test

* changing name

* changing name, importing SplitODEFunction

* fixing test by adding norm

* trying another test fix

* adding norm back

* adjusting tol

* try to fix test again

* syntax error

* removing norm frm test

* adding cache to parabolic terms (enable reuse of inviscid cache)

* generalize dgmulti iterators

* fix typo

* generalizing reset_du! for dgmulti

* WIP gradient and divergence computations

* fix name

* more generalization

* divergence + remove repeated code

* adding cache

* remove test

* update diffusion test

* update diffusion rhs

* moving routines around

* fix multiple includes

* removing time dependence for now from viscous rhs

* export ScalarDiffusion2D

* fix test

* working periodic advection RHS

* cleanup and comments

* making periodic advection-diffusion example

* trim whitespace

* adding t back in to parabolic rhs


add t back in

* refactoring boundary condition code

* update elixir with BCs

* change default DGMulti interface flux behavior

same as in #1139

* cleanup

* renaming variables

* BC prepping

* cleanup of elixir

* more name fixing

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* adding Neumann BCs

* switching to weak form


weak form


more weak form


weak form

* fixing cache variable names

* simplified parabolic boundary flux treatement

* updated elixir with different types of BCs

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Update src/equations/equations.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* rhs! -> rhs_parabolic!

* move Gradient/Divergence types

* add "no boundary condition" BC

* rename ScalarDiffusion -> LaplaceDiffusion


r


r

* rhs -> rhs_parabolic! again

* comments

* moving tests around

* scalarDiffusion -> LaplaceDiffusion

* tuple-based constructor

* updating examples

* add ScalarPlotData2D docstring (#1145)

Co-authored-by: Jesse Chan <[email protected]>

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>

* renaming for consistency

parabolic_equations -> equations_parabolic
no_boundary_condition -> boundary_condition_do_nothing

* move Neumann BCs into equations.jl

* renaming, e.g., ParabolicEquations -> EquationsParabolic, etc

* rename test module

* generalize LaplaceDiffusion2D to any number of variables

* removing saveat times and standardizing `tol` names

* parabolic_cache -> cache_parabolic


cache

* renaming `create_cache` -> `create_cache_parabolic`

avoids conflicts when using dg::DGMultiFluxDiff

* Update examples/dgmulti_2d/elixir_advection_diffusion.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Update src/equations/equations.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* parabolic_boundary_conditions -> boundary_conditions_parabolic

similarly for hyperbolic
d

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* add equations as field to LaplaceDiffusion2D

* moving Neumann BCs into equations.jl and adding default BC behavior

* running parabolic tests, adding integration test

* adding parabolic tests to ci

* missing comma

* Update src/equations/laplace_diffusion_2d.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* fix test

* fix test typo

* fix tests (for real this time)

* improve test coverage

Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Additional work on parabolic terms  (#1148)

* make "do nothing BC" a struct, move it to basic_types

* add varnames for LaplaceDiffusion

* add forgotten @threaded

* update comment

* Revert "add forgotten @threaded"

This reverts commit 1564501.

* add @threaded (without enumerate)

* remove periodic advection diffusion elixir (redundant)

* adding test

* one more test

* Update src/basic_types.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>

* Reorganization of boundary conditions (#1152)

* moving "default" boundary conditions back into equations file

* add periodic advection_diffusion back in

* updating test

* update test

* Apply suggestions from code review

Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>

* Adding parabolic solver option (#1153)

* adding parabolic solver types

* incorporating parabolic solver types into dg_parabolic penalties

* specializing parabolic solver options in LaplaceDiffusion2D

* moving things around to fix CI

* dropped arg in test

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* renaming files and ViscousFlux solvers


renaming files


rename


rename

* Added TODO note for penalty term

* ViscousFlux___ -> ViscousFormulation___

* move function def around

Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>

* rearrange include order

* Add support for hyperbolic-parabolic systems to TreeMesh2D (#1156)

* Add prototype for advection-diffusion elixir for TreeMesh2D

* Initial implementation of `calc_gradient!` for TreeMesh{2}

* First complete implementation of the parabolic rhs operator for TreeMesh

* Make it work

* Add first elixir that works

* Clean up elixir

* first draft of container for Navier-Stokes constants and fluxes

* remove unneeded temperature computation

* draft of elixir with possible boundary condition structure

* added manufactured solution and source term

* fix typo in function name for MMS

* update variable names for consistency. improve comments

* fix dumb typos in new equation system name

* actually export new equations

* add comment near variable_mapping declaration.

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* parabolic equations now exported separately

* change name to CompressibleNavierStokesEquations2D

* export NS with proper name

* explicitly require compressible Euler in the type parameter

* name kinematic viscosity nu for consistency with Lattice-Boltzmann

* add promotion in constructor

* make Reynolds, Prandtl, Mach, and kappa keyword arguments

* update constructor call in elixir

* reduce computation by exploiting stress tensor symmetry

* fix unpacking of flux

* modifying parabolic cache creation

in cache, we assume we take the gradient of all hyperbolic variables. since the number of parabolic variables can differ from the number of hyperbolic variables, we pass in the hyperbolic equations to `create_cache_parabolic` now

* comments

* comments

* formatting and renaming equations to equations_hyperbolic


formatting comments

* fix unpacking of gradients in flux

* adding CNS BCs

* adding lid-driven cavity elixir

* adding variable transform, editing cons2prim for CNS

* add prim2cons for NS (inconsistent right now)

* add draft of DGMulti Navier Stokes convergence elixir

* converging solution using elixir for TreeMesh with BCs

* fixing DGMulti advection diffusion elixir convergence

* naming equations as parabolic/hyperbolic

* generalizing transform_variables

* add TODO


more todos

* additional checks on get_unsigned_normal

* adding isothermal BC

* commenting out unused CNS functions for now

* fix call to transform_variables

* comments and cleanup

* changing default solver and Re for cavity

* adding more advection diffusion tests

* label tests

* add gradient_variables field to SemidiscretizationHyperbolicParabolic

* Revert "add gradient_variables field to SemidiscretizationHyperbolicParabolic"

This reverts commit 063b602.

* allowing for specialization in transform_variables

adding a function `gradient_variable_transformation` which should get specialized if the gradient variables are not conservative variables

* formatting and comments

* reverting elixir

* comments

* standardizing time tol

* minor fix to CNS boundary flux for convenience

make it so that the density state is computed correctly, even though it's not used

* formatting + comments

* using primitive variables in viscous flux instead of conservative

* minor formatting

* add CNS tests

* fix test

* testing if scoping issues fix TreeMesh tests

* decreasing timestep tol for TreeMesh parabolic test

* enabling periodic BCs for TreeMesh + more tests

* fix density BC flux (unused, but could be useful)

* adding non-working TreeMesh elixirs

* adding AD checks

* standardizing parameters in convergence elixirs

* minor cleanup

* revert DGMulti CNS elixir setup back to the one used in tests

* adding TreeMesh CNS convergence test

* removing redundant elixir

* add more tests

* add more test

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* set version to v0.4.43

* set development version to v0.4.44-pre

* add YouTube links to JuliaCon presentations (#1192)

* add YouTube links to JuliaCon presentations

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* improved readability of equation docstrings in compressible Euler files

* Navier-Stokes in 2D on DGMulti and TreeMesh (#1165)

* first draft of container for Navier-Stokes constants and fluxes

* remove unneeded temperature computation

* draft of elixir with possible boundary condition structure

* added manufactured solution and source term

* fix typo in function name for MMS

* update variable names for consistency. improve comments

* fix dumb typos in new equation system name

* actually export new equations

* add comment near variable_mapping declaration.

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* parabolic equations now exported separately

* change name to CompressibleNavierStokesEquations2D

* export NS with proper name

* explicitly require compressible Euler in the type parameter

* name kinematic viscosity nu for consistency with Lattice-Boltzmann

* add promotion in constructor

* make Reynolds, Prandtl, Mach, and kappa keyword arguments

* update constructor call in elixir

* reduce computation by exploiting stress tensor symmetry

* fix unpacking of flux

* modifying parabolic cache creation

in cache, we assume we take the gradient of all hyperbolic variables. since the number of parabolic variables can differ from the number of hyperbolic variables, we pass in the hyperbolic equations to `create_cache_parabolic` now

* comments

* comments

* formatting and renaming equations to equations_hyperbolic


formatting comments

* fix unpacking of gradients in flux

* adding CNS BCs

* adding lid-driven cavity elixir

* adding variable transform, editing cons2prim for CNS

* add prim2cons for NS (inconsistent right now)

* add draft of DGMulti Navier Stokes convergence elixir

* converging solution using elixir for TreeMesh with BCs

* fixing DGMulti advection diffusion elixir convergence

* naming equations as parabolic/hyperbolic

* generalizing transform_variables

* add TODO


more todos

* additional checks on get_unsigned_normal

* adding isothermal BC

* commenting out unused CNS functions for now

* fix call to transform_variables

* comments and cleanup

* changing default solver and Re for cavity

* adding more advection diffusion tests

* label tests

* add gradient_variables field to SemidiscretizationHyperbolicParabolic

* Revert "add gradient_variables field to SemidiscretizationHyperbolicParabolic"

This reverts commit 063b602.

* allowing for specialization in transform_variables

adding a function `gradient_variable_transformation` which should get specialized if the gradient variables are not conservative variables

* formatting and comments

* reverting elixir

* comments

* standardizing time tol

* minor fix to CNS boundary flux for convenience

make it so that the density state is computed correctly, even though it's not used

* formatting + comments

* using primitive variables in viscous flux instead of conservative

* minor formatting

* add CNS tests

* fix test

* testing if scoping issues fix TreeMesh tests

* decreasing timestep tol for TreeMesh parabolic test

* enabling periodic BCs for TreeMesh + more tests

* fix density BC flux (unused, but could be useful)

* adding non-working TreeMesh elixirs

* adding AD checks

* standardizing parameters in convergence elixirs

* minor cleanup

* revert DGMulti CNS elixir setup back to the one used in tests

* adding TreeMesh CNS convergence test

* removing redundant elixir

* add more tests

* add more test

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* add docstrings

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>

* add docstring for CNS equations

* removing some addressed TODOs

* adjust definition of the kappa constant

* avoid overwriting u_grad with viscous_flux results

* remove old TODOs

* clarify TODOs for later

* removing let statements

* rearrange main docstring. Fix typos in math environment causing it to not parse

* update TODO notes

* Apply suggestions from code review

Co-authored-by: Andrew Winters <[email protected]>

* update TODO notes

* Apply suggestions from code review

Co-authored-by: Andrew Winters <[email protected]>

* update TODO notes

* changing diffusivity names

Auto stash before merge of "parabolic-treemesh" and "origin/parabolic-treemesh"

* Reynolds/Prandtl number name changes for consistency

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
Co-authored-by: Andrew Winters <[email protected]>

* fixing bug introduced by GH code review

* moving manufactured solution into the CNS equations file

* fix allocation issue

* get_diffusivity -> diffusivity

* removing cruft code, adding comment on messy prim2cons routine

* moving manufactured solution back into elixirs

* Update examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl

* TODO -> Todo, and .6 -> 0.6


d

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* adding note to Adiabatic/Isothermal BCs

* replacing CompressibleNavierStokesEquations with ...Diffusion

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* documenting Jacobian sign flip

* remove extra arg to `gradient_variable_transformation`

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* change warning to error

* fix bug introduced by search/replace

* dg_parabolic -> parabolic_scheme

* BoundaryConditionViscousWall -> BoundaryConditionNavierStokesWall

* u_grad -> gradients

* fix test

* renaming

* update comment

* converting to signature `flux(u, gradients, orientation, equations)`

* using prolong2interfaces/boundaries

* unpacking `gradients` and `flux_viscous`

* using calc_surface_integral!

* adding @muladd

* Apply suggestions from code review

* update comments

* Rename grad_u -> gradients

* Update src/equations/compressible_navier_stokes_2d.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Rename remaining grad_u/u_grad -> gradients

* Refactor into prolong2interfaces!

* Refactor calc_volume_integral!

* Refactor calc_interface_flux

* Refactor prolong2boundaries!

* Refactor calc_divergence!

* Formatting consistency

* Remove dispatch on volume integral type

* Add comment on why surface_integral is passed to prolong2interfaces!

* Explicitly use weak form volume integral to allow easy overriding in test

* Add flux differencing test for CNS test

* Remove erroneous P4estMesh{2} dispatch

* Remove non-cons terms from parabolic solver

Co-authored-by: Andrew Winters <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>

* Add commentary on reuse of interfaces/boundaries data structures (#1199)

* Add comments on storing flux values in `u`

* Rearrange function names for consistency

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Andrew Winters <[email protected]>

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Andrew Winters <[email protected]>

* Adding parabolic term description to NEWS.md (#1207)

* Add Literate docs for advection-diffusion (#1208)

* adding literate docs for advection-diffusion

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* rename "adding parabolic terms" -> "parabolic terms"

Co-authored-by: Hendrik Ranocha <[email protected]>

* Adding a tutorial on adding new parabolic terms (#1209)

* Viscous terms from entropy gradients (#1202)

* first draft of entropy stable gradients

* update TODOs

* added elixir with discontinuous solution for ES testing

* forgot one TODO marker

* adding GradientVariables**** type parameter

* fix bug (missing type param in constructor)

* add elixir with periodic CNS manufactured solution

* fix gradient conversion

* fix entropy variables w/BCs

* updating elixirs with `gradient_variables=GradientVariablesPrimitive()`

* Update src/equations/compressible_navier_stokes_2d.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* removing unused routines

* removing specialized entropy2cons and cons2entropy routines

* adding more tests

* removing unused elixirs

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>

* adding docs/warning for gradient variable type

* extracting w_inner[4] into a more clearly named variable

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
Co-authored-by: Jesse Chan <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>

* adding some minor documentation (#1214)

* fix parabolic PID (#1224)

* fix parabolic PID

* activate analysis_callback in Navier-Stokes convergence test

* fix typo

* Rescale compressible Navier-Stokes (#1230)

* remove the nondimensionalization and update the docstring for CNS

* update TreeMesh elixirs and test values

* update the elixirs and test values for DGMulti

* fix unbalanced parentheses

* file renaming for consistency

* update file names in the parabolic test script

* remove the gas constant as a parameter and update comments

* rename viscosity to dynamic_viscosity

* add comment about units in the docstring

* Update src/equations/compressible_navier_stokes_2d.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* unify notation to call the viscosity mu

* fix undefined variable

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* improve type stability of semidiscretize for parabolic semi (#1231)

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Andrew Winters <[email protected]>
@jlchan jlchan mentioned this pull request Jun 1, 2023
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants