pecos / tps

Torch Plasma Simulator
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

Updated primitive variables p -> T #90

Closed marc-85 closed 2 years ago

marc-85 commented 2 years ago

Changes

This PR contains 3 main changes:

The GPU version has also been updated. It is now able to run with passive scalar. The drawback is that now it is slower. This is because in some kernels, the interpolation was carried out after loading all required data for a particular element. This is no longer possible for increased number of equations (it is now limited to 20 equations). Interpolation is now carried out for each variable which means interpolants are loaded as many times as equations are solved. This decrease in performance can potentially offset by running with higher polynomial orders (this last comment to be checked).

Things to bear in mind

  1. The reference solutions have been modified since computing temperature gradients give slightly different solutions
  2. Wall BCs assume DryAir in places. This will need to be revisited once we freeze the GasMixture class
  3. The GPU version assumes DryAir in some functions. This needs generalizing which may be relatively straightforward.

MASA convergence tests

Convergence rates have been verified with MASA for both Euler (Re=\infty) and and Navier-Stokes with Re=14. The Mach number in both cases was M=0.1. While the rates remain the same for the Euler case (to be expected since these equations are independent of temperature gradients) the rates change slightly for the Navier-Stokes case (see below). This is also to be expected due to the current implementation of the viscous fluxes.

refinement pol order L2 error dens order L2 error vel order L2 error press order
0 1 5.50E-02   4.07E+00   1.42E+03  
1 1 1.34E-02 2.04 1.11E+00 1.88 6.43E+02 1.15
2 1 3.20E-03 2.06 2.79E-01 1.99 1.89E+02 1.76
3 1 7.89E-04 2.02 6.91E-02 2.01 5.19E+01 1.87
-- -- -- -- -- -- -- --
0 3 1.39E-03   1.28E-01   9.21E+01  
1 3 8.80E-05 3.98 9.16E-03 3.81 8.03E+00 3.52
2 3 6.33E-06 3.80 6.03E-04 3.93 7.78E-01 3.37
3 3 4.36E-07 3.86 4.21E-05 3.84 7.04E-02 3.47
koomie commented 2 years ago

Documenting the order of the solution differences incurred:

density

$ h5diff -r --delta=1e-9 ref_solns/cyl3d_coarse.4iters.h5 ref_solns_pressure_primitives/cyl3d_coarse.4iters.h5  /solution/density
dataset: </solution/density> and </solution/density>
size:           [24612]           [24612]
position        density         density         difference          
------------------------------------------------------------
[ 20040 ]          1.21327         1.21327         1.01839e-09    
[ 20721 ]          1.21415         1.21415         1.11728e-09    
[ 22185 ]          1.21718         1.21718         1.5326e-09     
[ 22425 ]          1.21772         1.21772         1.61963e-09    
[ 23360 ]          1.21595         1.21595         1.27625e-09    
[ 23398 ]          1.2147          1.2147          1.18119e-09    
6 differences found

rho-u

$ h5diff -r --delta=1e-6 ref_solns/cyl3d_coarse.4iters.h5 ref_solns_pressure_primitives/cyl3d_coarse.4iters.h5  /solution/rho-u
dataset: </solution/rho-u> and </solution/rho-u>
size:           [24612]           [24612]
position        rho-u           rho-u           difference          
------------------------------------------------------------
[ 22426 ]          18.0379         18.0379         1.02457e-06    
[ 22427 ]          17.1003         17.1003         1.10245e-06    
2 differences found

rho-v

$ h5diff -r --delta=2e-7 ref_solns/cyl3d_coarse.4iters.h5 ref_solns_pressure_primitives/cyl3d_coarse.4iters.h5  /solution/rho-v
dataset: </solution/rho-v> and </solution/rho-v>
size:           [24612]           [24612]
position        rho-v           rho-v           difference          
------------------------------------------------------------
[ 5875 ]          0.837575        0.837575        2.14437e-07    
[ 6867 ]          -0.0616651      -0.0616653      2.13152e-07    
[ 10861 ]          -0.0729642      -0.0729639      2.06637e-07    
[ 19091 ]          0.182275        0.182275        2.04475e-07    
[ 19576 ]          1.06406         1.06406         2.05506e-07    
[ 20018 ]          1.21144         1.21144         2.5861e-07     
[ 20507 ]          1.06645         1.06645         2.02288e-07    
[ 20522 ]          -1.22843        -1.22843        3.15595e-07    
[ 21356 ]          -0.967231       -0.967231       2.84834e-07    
[ 21702 ]          -1.50662        -1.50662        3.09351e-07    
[ 21725 ]          0.615428        0.615428        2.09092e-07    
[ 22104 ]          -0.498491       -0.498491       2.19315e-07    
[ 22209 ]          0.42436         0.42436         2.6855e-07     
[ 22210 ]          -0.0749706      -0.0749708      2.08657e-07    
[ 22278 ]          0.507382        0.507382        3.20415e-07    
[ 22489 ]          -0.824939       -0.82494        3.38774e-07    
[ 22602 ]          -0.486034       -0.486034       3.67441e-07    
[ 22824 ]          0.904103        0.904103        3.87538e-07    
[ 23360 ]          0.00346558      0.00346537      2.13122e-07    
[ 24548 ]          0.661496        0.661496        2.10979e-07    
20 differences found

rho-w

$ h5diff -r --delta=2e-7 ref_solns/cyl3d_coarse.4iters.h5 ref_solns_pressure_primitives/cyl3d_coarse.4iters.h5  /solution/rho-w
dataset: </solution/rho-w> and </solution/rho-w>
size:           [24612]           [24612]
position        rho-w           rho-w           difference          
------------------------------------------------------------
[ 3267 ]          0.108117        0.108117        2.33845e-07    
[ 9462 ]          0.110773        0.110773        2.01423e-07    
[ 17523 ]          -0.292629       -0.292629       2.16004e-07    
[ 18810 ]          -1.08976        -1.08976        2.76116e-07    
[ 20338 ]          -0.734929       -0.73493        3.10586e-07    
[ 20339 ]          -0.549149       -0.54915        2.11404e-07    
[ 20506 ]          1.78762         1.78762         2.2018e-07     
[ 20722 ]          -0.793232       -0.793232       2.2132e-07     
[ 20823 ]          1.71891         1.71891         2.20417e-07    
[ 20892 ]          -0.644418       -0.644418       2.27947e-07    
[ 21068 ]          -0.0345053      -0.0345055      2.54667e-07    
[ 21109 ]          1.13453         1.13453         2.90457e-07    
[ 21141 ]          -0.0135222      -0.0135219      2.45357e-07    
[ 21143 ]          -0.142196       -0.142196       2.4571e-07     
[ 21349 ]          0.418434        0.418434        2.80406e-07    
[ 21350 ]          0.0204053       0.0204051       2.37715e-07    
[ 21412 ]          -0.827687       -0.827687       2.35675e-07    
[ 21557 ]          0.15843         0.15843         2.41911e-07    
[ 21558 ]          -0.234227       -0.234228       2.46029e-07    
[ 21737 ]          -1.01409        -1.01409        2.20639e-07    
[ 21842 ]          1.39407         1.39407         3.56239e-07    
[ 21990 ]          1.54663         1.54663         2.33166e-07    
[ 22202 ]          0.324418        0.324418        2.05519e-07    
[ 22426 ]          -1.49499        -1.49499        2.59193e-07    
[ 22576 ]          -0.161705       -0.161705       2.12475e-07    
[ 23360 ]          -1.04003        -1.04003        2.26341e-07    
[ 23412 ]          1.22676         1.22676         2.35979e-07    
[ 23414 ]          -0.887601       -0.887601       2.02283e-07    
28 differences found

rho-E (relative)

$ h5diff -r --relative 4e-9 ref_solns/cyl3d_coarse.4iters.h5 ref_solns_pressure_primitives/cyl3d_coarse.4iters.h5  /solution/rho-E
dataset: </solution/rho-E> and </solution/rho-E>
size:           [24612]           [24612]
position        rho-E           rho-E           difference      relative       
------------------------------------------------------------------------
[ 20040 ]          258408.7971     258408.7961     0.001047896454  4.05518874e-09
[ 20505 ]          258520.7132     258520.712      0.001172940305  4.537123122e-09
[ 20520 ]          257966.4086     257966.4074     0.001264759427  4.902806716e-09
[ 20821 ]          258562.9616     258562.9605     0.001126207644  4.355641847e-09
[ 21841 ]          257994.3599     257994.3586     0.001231313247  4.772636286e-09
[ 22185 ]          259677.9486     259677.9474     0.001181709435  4.550673061e-09
[ 22425 ]          259534.9274     259534.9259     0.001497964869  5.771727429e-09
[ 22427 ]          270698.4881     270698.4894     0.001301015902  4.806143927e-09
[ 23116 ]          269380.8345     269380.8358     0.001325124467  4.919149088e-09
[ 23117 ]          258287.227      258287.2258     0.00122206597   4.731422365e-09
[ 23201 ]          258496.0412     258496.0402     0.001045500365  4.044550805e-09
[ 23360 ]          259471.2188     259471.2175     0.001323732024  5.101652656e-09
[ 23362 ]          270187.2363     270187.2375     0.001228933688  4.548452059e-09
[ 23398 ]          259474.1805     259474.1795     0.001072542917  4.133524634e-09
[ 23412 ]          258643.9934     258643.9924     0.001051878935  4.066898707e-09
[ 23413 ]          269417.8694     269417.8705     0.001091087761  4.049797386e-09
16 differences found