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

Additional work on parabolic terms #1148

Merged
merged 12 commits into from
May 31, 2022
Merged

Conversation

jlchan
Copy link
Contributor

@jlchan jlchan commented May 30, 2022

There are just some minor changes to clean up and improve coverage for parabolic terms in DGMulti: tests, cleaning up new boundary condition types, and adding utilities like varnames.

@jlchan jlchan marked this pull request as ready for review May 30, 2022 15:50
@jlchan jlchan marked this pull request as draft May 30, 2022 15:51
@jlchan jlchan changed the base branch from main to dev May 30, 2022 15:53
@codecov
Copy link

codecov bot commented May 30, 2022

Codecov Report

Merging #1148 (94d7c29) into dev (8bddf91) will decrease coverage by 0.00%.
The diff coverage is 83.33%.

❗ Current head 94d7c29 differs from pull request most recent head c8bf814. Consider uploading reports for the commit c8bf814 to get more accurate results

@@            Coverage Diff             @@
##              dev    #1148      +/-   ##
==========================================
- Coverage   96.78%   96.78%   -0.00%     
==========================================
  Files         314      313       -1     
  Lines       24487    24489       +2     
==========================================
+ Hits        23699    23700       +1     
- Misses        788      789       +1     
Flag Coverage Δ
unittests 96.78% <83.33%> (-<0.01%) ⬇️

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

Impacted Files Coverage Δ
src/equations/laplace_diffusion_2d.jl 90.00% <0.00%> (-10.00%) ⬇️
src/basic_types.jl 100.00% <100.00%> (ø)
src/solvers/dgmulti/dg.jl 98.90% <100.00%> (ø)
src/equations/equations.jl 94.23% <0.00%> (-3.85%) ⬇️

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 8bddf91...c8bf814. Read the comment docs.

@jlchan jlchan marked this pull request as ready for review May 30, 2022 19:47
@jlchan jlchan requested review from ranocha and sloede May 30, 2022 22:46
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.

LGTM!

src/basic_types.jl Outdated Show resolved Hide resolved
@ranocha
Copy link
Member

ranocha commented May 31, 2022

Looks good to me except one minor comment. Thanks, @jlchan! You can go ahead and merge this (either including my suggestion or as it is if you prefer that).

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
@jlchan jlchan merged commit b346c8f into trixi-framework:dev May 31, 2022
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 <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* Update src/equations/equations.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* 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 <jesse.chan@rice.edu>

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

* Update src/equations/equations.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* parabolic_boundary_conditions -> boundary_conditions_parabolic

similarly for hyperbolic
d

* Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* 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 <ranocha@users.noreply.github.com>

* fix test

* fix test typo

* fix tests (for real this time)

* improve test coverage

Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* 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 <ranocha@users.noreply.github.com>

Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Hendrik Ranocha <mail@ranocha.de>

* 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 <ranocha@users.noreply.github.com>

* 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 <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <ranocha@users.noreply.github.com>

* 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 <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* 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 <ranocha@users.noreply.github.com>

* 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 <ranocha@users.noreply.github.com>

* add docstrings

Co-authored-by: Hendrik Ranocha <mail@ranocha.de>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Jesse Chan <jesse.chan@rice.edu>

* 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 <andrew.ross.winters@liu.se>

* update TODO notes

* Apply suggestions from code review

Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>

* 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 <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>

* 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 <ranocha@users.noreply.github.com>

* adding note to Adiabatic/Isothermal BCs

* replacing CompressibleNavierStokesEquations with ...Diffusion

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

* 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 <michael@sloede.com>

* 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 <andrew.ross.winters@liu.se>
Co-authored-by: Hendrik Ranocha <mail@ranocha.de>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Jesse Chan <jchan985@gmail.com>

* 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 <ranocha@users.noreply.github.com>

* Update src/solvers/dgsem_tree/dg_2d_parabolic.jl

Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>

* 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 <ranocha@users.noreply.github.com>

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

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

* 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 <ranocha@users.noreply.github.com>

* adding docs/warning for gradient variable type

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

Co-authored-by: Hendrik Ranocha <mail@ranocha.de>
Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Jesse Chan <jchan985@gmail.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Jesse Chan <1156048+jlchan@users.noreply.github.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* 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 <michael@sloede.com>

* unify notation to call the viscosity mu

* fix undefined variable

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

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

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <mail@ranocha.de>
Co-authored-by: Andrew Winters <andrew.ross.winters@liu.se>
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.

None yet

3 participants