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

Navier-Stokes 1D #1597

Merged
merged 24 commits into from
Aug 11, 2023
Merged

Navier-Stokes 1D #1597

merged 24 commits into from
Aug 11, 2023

Conversation

DanielDoehring
Copy link
Contributor

Related to #1147

Convergence study:

####################################################################################################
l2
rho                 rho_v1              rho_e               
error     EOC       error     EOC       error     EOC       
1.13e-04  -         6.23e-05  -         2.82e-04  -         
6.13e-06  4.21      3.51e-06  4.15      1.74e-05  4.02      
3.49e-07  4.13      2.19e-07  4.00      1.10e-06  3.99      
2.20e-08  3.99      1.38e-08  3.98      7.07e-08  3.96      

mean      4.11      mean      4.04      mean      3.99      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_e               
error     EOC       error     EOC       error     EOC       
6.26e-04  -         3.62e-04  -         1.61e-03  -         
4.76e-05  3.72      2.38e-05  3.93      1.05e-04  3.94      
3.51e-06  3.76      1.49e-06  3.99      6.65e-06  3.98      
2.57e-07  3.77      9.10e-08  4.03      4.12e-07  4.01      

mean      3.75      mean      3.99      mean      3.98      
----------------------------------------------------------------------------------------------------

@jlchan jlchan self-requested a review August 7, 2023 15:24
@codecov
Copy link

codecov bot commented Aug 7, 2023

Codecov Report

Merging #1597 (955a95e) into main (7936e61) will increase coverage by 11.33%.
Report is 1 commits behind head on main.
The diff coverage is 98.91%.

❗ Current head 955a95e differs from pull request most recent head 6a935e5. Consider uploading reports for the commit 6a935e5 to get more accurate results

@@             Coverage Diff             @@
##             main    #1597       +/-   ##
===========================================
+ Coverage   84.97%   96.30%   +11.33%     
===========================================
  Files         402      405        +3     
  Lines       33046    33250      +204     
===========================================
+ Hits        28078    32020     +3942     
+ Misses       4968     1230     -3738     
Flag Coverage Δ
unittests 96.30% <98.91%> (+11.33%) ⬆️

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

Files Changed Coverage Δ
src/Trixi.jl 43.48% <ø> (ø)
src/equations/compressible_navier_stokes_2d.jl 98.06% <ø> (-0.11%) ⬇️
src/equations/compressible_navier_stokes_3d.jl 98.33% <ø> (ø)
src/equations/equations_parabolic.jl 100.00% <ø> (ø)
src/equations/compressible_navier_stokes_1d.jl 97.59% <97.59%> (ø)
..._dgsem/elixir_navierstokes_convergence_periodic.jl 100.00% <100.00%> (ø)
..._1d_dgsem/elixir_navierstokes_convergence_walls.jl 100.00% <100.00%> (ø)
src/equations/compressible_euler_1d.jl 97.36% <100.00%> (+59.92%) ⬆️
src/equations/compressible_navier_stokes.jl 100.00% <100.00%> (ø)

... and 101 files with indirect coverage changes

Copy link
Contributor

@jlchan jlchan left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! I just have a small comment on coverage

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for catching these!

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like the 1D parabolic boundary conditions are tested anywhere. Would it be possible to modify this elixir to be non-periodic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be, I can try the y-direction from the 2D example to test wall & adiabatic BCs.

Comment on lines 280 to 330
"""
struct BoundaryConditionNavierStokesWall

Creates a wall-type boundary conditions for the compressible Navier-Stokes equations.
The fields `boundary_condition_velocity` and `boundary_condition_heat_flux` are intended
to be boundary condition types such as the `NoSlip` velocity boundary condition and the
`Adiabatic` or `Isothermal` heat boundary condition.

!!! warning "Experimental feature"
This is an experimental feature and may change in future releases.
"""
struct BoundaryConditionNavierStokesWall{V, H}
boundary_condition_velocity::V
boundary_condition_heat_flux::H
end

"""
struct NoSlip

Use to create a no-slip boundary condition with `BoundaryConditionNavierStokesWall`. The field `boundary_value_function`
should be a function with signature `boundary_value_function(x, t, equations)`
and should return a `SVector{NDIMS}` whose entries are the velocity vector at a
point `x` and time `t`.
"""
struct NoSlip{F}
boundary_value_function::F # value of the velocity vector on the boundary
end

"""
struct Isothermal

Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).
The field `boundary_value_function` should be a function with signature
`boundary_value_function(x, t, equations)` and return a scalar value for the
temperature at point `x` and time `t`.
"""
struct Isothermal{F}
boundary_value_function::F # value of the temperature on the boundary
end

"""
struct Adiabatic

Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).
The field `boundary_value_normal_flux_function` should be a function with signature
`boundary_value_normal_flux_function(x, t, equations)` and return a scalar value for the
normal heat flux at point `x` and time `t`.
"""
struct Adiabatic{F}
boundary_value_normal_flux_function::F # scaled heat flux 1/T * kappa * dT/dn
end
Copy link
Member

Choose a reason for hiding this comment

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

Aren't these structs already defined in the file for the 2D system? Since the structs are generic, could we please move them to another file - maybe src/equations/compressible_navier_stokes.jl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes and no - I moved them from 2D to 1D for now. Adding a seperate file src/equations/compressible_navier_stokes.jl is a more expressive way, I think

Comment on lines 96 to 112
"""
!!! warning "Experimental code"
This code is experimental and may be changed or removed in any future release.

`GradientVariablesPrimitive` and `GradientVariablesEntropy` are gradient variable type parameters
for `CompressibleNavierStokesDiffusion1D`. By default, the gradient variables are set to be
`GradientVariablesPrimitive`. Specifying `GradientVariablesEntropy` instead uses the entropy variable
formulation from
- Hughes, Mallet, Franca (1986)
A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the
compressible Euler and Navier-Stokes equations and the second law of thermodynamics.
[https://doi.org/10.1016/0045-7825(86)90127-1](https://doi.org/10.1016/0045-7825(86)90127-1)

Under `GradientVariablesEntropy`, the Navier-Stokes discretization is provably entropy stable.
"""
struct GradientVariablesPrimitive end
struct GradientVariablesEntropy end
Copy link
Member

Choose a reason for hiding this comment

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

See below

@DanielDoehring
Copy link
Contributor Author

So I adapted the non-periodic direction from the 2D example.

For this, I had to add boundary_condition_slip_wall for 1D Compressible Euler - please have a look at that.

Convergence of the example:

####################################################################################################
l2
rho                 rho_v1              rho_e               
error     EOC       error     EOC       error     EOC       
2.25e-08  -         1.82e-08  -         7.71e-08  -         
1.19e-09  4.24      5.69e-10  5.00      3.04e-09  4.66      
6.91e-11  4.11      2.04e-11  4.80      1.42e-10  4.42      
3.97e-12  4.12      8.88e-13  4.52      7.54e-12  4.23      
2.11e-13  4.24      1.30e-13  2.77      4.38e-13  4.11      

mean      4.18      mean      4.27      mean      4.36      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_e               
error     EOC       error     EOC       error     EOC       
1.62e-07  -         1.47e-07  -         5.37e-07  -         
6.74e-09  4.59      4.24e-09  5.11      2.01e-08  4.74      
3.68e-10  4.19      1.22e-10  5.11      9.10e-10  4.46      
2.17e-11  4.08      4.47e-12  4.78      4.55e-11  4.32      
1.09e-12  4.32      3.32e-13  3.75      2.08e-12  4.45      

mean      4.30      mean      4.69      mean      4.49      
----------------------------------------------------------------------------------------------------

@ranocha ranocha requested a review from jlchan August 8, 2023 09:18
Copy link
Contributor

@jlchan jlchan left a comment

Choose a reason for hiding this comment

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

Looks very good. I have two minor suggestions to make sure we test all the BC and gradient variables functionality.

test/test_parabolic_1d.jl Outdated Show resolved Hide resolved
Copy link
Contributor

@jlchan jlchan left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for adding this.

@ranocha ranocha merged commit d52a041 into trixi-framework:main Aug 11, 2023
17 checks passed
@DanielDoehring DanielDoehring deleted the NavierStokes1D branch August 11, 2023 08:17
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