Skip to content

Commit

Permalink
Add radiation-driven shell to regression tests (#810)
Browse files Browse the repository at this point in the history
### Description
Adds this problem to the nightly regression test suite. There was also a
bug in the initial conditions in the radiation flux in converting from
spherical to Cartesian flux components (now fixed).

At late times, the simulation still has a slightly discrepancy w.r.t.
the semi-analytic solution (similar to that shown in the original code
paper). This is most likely due to initial shell thickness being quite
significant. (There is not an easy solution to this, since there is no
steady-state solution that satisfies the M1 closure for sufficiently
thin shells.)


![shell_velocity](https://github.com/user-attachments/assets/0473f97c-3506-4d40-94c5-a9b84e2900f0)


https://github.com/user-attachments/assets/8851d7cd-9d92-4de6-ac7e-ab5fef035af5

### Related issues
Closes #743.

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues (if applicable; see
above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [x] *(For quokka-astro org members)* I have manually triggered the GPU
tests with the magic comment `/azp run`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
BenWibking and pre-commit-ci[bot] authored Dec 10, 2024
1 parent ba00076 commit 5835ef8
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 189 deletions.
82 changes: 44 additions & 38 deletions extern/dust_shell/initial_conditions.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# r_over_r0 reduced_flux Erad_cgs Frad_cgs
1.000000000000000048e-04 3.755101031908026650e-05 5.849260643223253650e-07 6.584810833497746207e-01
1.441718602973596219e-03 5.413927440706735881e-04 5.849081618804471932e-07 9.493378914228637555e+00
2.704299640581599162e-02 1.013562762624721503e-02 5.846128128060447862e-07 1.776395559784417060e+02
5.264427420865838703e-02 1.961668425674432600e-02 5.840360439316570708e-07 3.434677422808198344e+02
7.824555201150078243e-02 2.888029728914901992e-02 5.830889736094660357e-07 5.048439908936409779e+02
1.038468298143431778e-01 3.783067358743209818e-02 5.817195410834095839e-07 6.597485279428594822e+02
1.779956739478935068e-01 6.114121918945376183e-02 5.759656028151289446e-07 1.055726310902443856e+03
2.521445180814438358e-01 7.899856349142272971e-02 5.696285693863173242e-07 1.349061225503343167e+03
3.262933622149941648e-01 9.023184801610512062e-02 5.638115733303117799e-07 1.525156961640026111e+03
4.062237502412902046e-01 9.486076267381476912e-02 5.588646660393681869e-07 1.589329583582680470e+03
4.861541382675862444e-01 9.293464799427836320e-02 5.553646422860039258e-07 1.547307347592608494e+03
5.660845262938822842e-01 8.651743901096156653e-02 5.525405597518683318e-07 1.433139683424766645e+03
6.460149143201783239e-01 7.823584123424670578e-02 5.460810899423697447e-07 1.280806719571427266e+03
6.807459332032566035e-01 7.481212301298670320e-02 5.394891460892043165e-07 1.209972204515023122e+03
7.154769520863348831e-01 7.186691853201436497e-02 5.286291820213997449e-07 1.138940038957400475e+03
7.502079709694131626e-01 6.968198530201698271e-02 5.117644526806205409e-07 1.069082781484670022e+03
7.849389898524914422e-01 6.855134780844877873e-02 4.872960447401361441e-07 1.001450729546252319e+03
8.196700087355697217e-01 6.879633527401403381e-02 4.542155802142597972e-07 9.368024854275187181e+02
8.521778939234854189e-01 7.061262999568297671e-02 4.154382001870662751e-07 8.794466892024265690e+02
8.846857791114011160e-01 7.438479746469706111e-02 3.701317120995621678e-07 8.253937649803749537e+02
9.171936642993168132e-01 8.066352339760292367e-02 3.203808828403107721e-07 7.747551733282971327e+02
9.497015494872325103e-01 9.020744304431384253e-02 2.690248161789397429e-07 7.275375597170433366e+02
1.003030219610614449e+00 1.158923399574568469e-01 1.891775328524417536e-07 6.572717886984859206e+02
1.024463928995228423e+00 1.311152943576374130e-01 1.606398288646572669e-07 6.314330214299012596e+02
1.045897638379842398e+00 1.499304699665272855e-01 1.350219548090641344e-07 6.068970081536025418e+02
1.067331347764456373e+00 1.729284538875688892e-01 1.125730104992235057e-07 5.836082760506781142e+02
1.088765057149070348e+00 2.007054354675900376e-01 9.332050127159230878e-08 5.615092306215482267e+02
1.118146872845352524e+00 2.474951844047469651e-01 7.184122515985754712e-08 5.330417009732285578e+02
1.000000000000000048e-04 3.755101032144143522e-05 5.849260642855459238e-07 6.584810833497746207e-01
1.441718602968267149e-03 5.413927440846509056e-04 5.849081618524834593e-07 9.493378914019864112e+00
2.704299640580912212e-02 1.013562762624422263e-02 5.846128128060968788e-07 1.776395559784050988e+02
5.264427420864997709e-02 1.961668425674107166e-02 5.840360439316672352e-07 3.434677422807688458e+02
7.824555201149083206e-02 2.888029728914537353e-02 5.830889736094605300e-07 5.048439908935724816e+02
1.038468298143316870e-01 3.783067358742812220e-02 5.817195410834083134e-07 6.597485279427886553e+02
1.779956739478792960e-01 6.114121918944982748e-02 5.759656028151295798e-07 1.055726310902377008e+03
2.521445180814269049e-01 7.899856349141945455e-02 5.696285693863187006e-07 1.349061225503290416e+03
3.262933622149745139e-01 9.023184801610305283e-02 5.638115733303131563e-07 1.525156961639994961e+03
4.062237502412764378e-01 9.486076267381457483e-02 5.588646660393688221e-07 1.589329583582679106e+03
4.861541382675783618e-01 9.293464799427880729e-02 5.553646422860042435e-07 1.547307347592616679e+03
5.660845262938802858e-01 8.651743901096177469e-02 5.525405597518682259e-07 1.433139683424769828e+03
6.460149143201822097e-01 7.823584123424630332e-02 5.460810899423690035e-07 1.280806719571418853e+03
6.807459332032604893e-01 7.481212301298635625e-02 5.394891460892032577e-07 1.209972204515015164e+03
7.154769520863387688e-01 7.186691853201411517e-02 5.286291820213980508e-07 1.138940038957392744e+03
7.502079709694170484e-01 6.968198530201683005e-02 5.117644526806179998e-07 1.069082781484662291e+03
7.849389898524953280e-01 6.855134780844875098e-02 4.872960447401328619e-07 1.001450729546245043e+03
8.196700087355736075e-01 6.879633527401417259e-02 4.542155802142554032e-07 9.368024854275116695e+02
8.521778939234886385e-01 7.061262999568328202e-02 4.154382001870618282e-07 8.794466892024209983e+02
8.846857791114036695e-01 7.438479746469750520e-02 3.701317120995581444e-07 8.253937649803708609e+02
9.171936642993187006e-01 8.066352339760342327e-02 3.203808828403075957e-07 7.747551733282942905e+02
9.497015494872337316e-01 9.020744304431432825e-02 2.690248161789377312e-07 7.275375597170417450e+02
1.003030219610615559e+00 1.158923399574575547e-01 1.891775328524401654e-07 6.572717886984843290e+02
1.024463928995229312e+00 1.311152943576380792e-01 1.606398288646561817e-07 6.314330214299002364e+02
1.045897638379843064e+00 1.499304699665278962e-01 1.350219548090634198e-07 6.068970081536018597e+02
1.067331347764456817e+00 1.729284538875693888e-01 1.125730104992230822e-07 5.836082760506776594e+02
1.088765057149070570e+00 2.007054354675903429e-01 9.332050127159211025e-08 5.615092306215478857e+02
1.118146872845352524e+00 2.474951844047470206e-01 7.184122515985753388e-08 5.330417009732285578e+02
1.147446050287565411e+00 3.040530980337316502e-01 5.557934245197780048e-08 5.066214110713187893e+02
1.176745227729778298e+00 3.688774428023082197e-01 4.358752202844885829e-08 4.820199144752725715e+02
1.206044405171991185e+00 4.385500681459409411e-01 3.491927786461010067e-08 4.590977238732691035e+02
Expand Down Expand Up @@ -58,14 +58,20 @@
1.546576247924941638e+00 8.636240495720141075e-01 1.079436353580702643e-08 2.794746821838933784e+02
1.596404594890389994e+00 8.791200480310583654e-01 9.952498041173527408e-09 2.623016290403775201e+02
1.646232941855838350e+00 8.916142219547158465e-01 9.227997027531266418e-09 2.466636400124249064e+02
1.734375178853998056e+00 9.091912467741695147e-01 8.153162862422567086e-09 2.222296828330790390e+02
1.822517415852157763e+00 9.224110306819669480e-01 7.277792911337121628e-09 2.012541684514484359e+02
1.734375178853998056e+00 9.091912467741694037e-01 8.153162862422568740e-09 2.222296828330790390e+02
1.822517415852157763e+00 9.224110306819671701e-01 7.277792911337119974e-09 2.012541684514484359e+02
1.910659652850317469e+00 9.323283560477764187e-01 6.551368291360504820e-09 1.831140256663184118e+02
1.998801889848477176e+00 9.400305847321852593e-01 5.937260295798599041e-09 1.673203545558839949e+02
2.086944126846637104e+00 9.463952883490297507e-01 5.409702260886093429e-09 1.534852463072307103e+02
2.272433441672774723e+00 9.563968807764520186e-01 4.514889045582422516e-09 1.294511568363405729e+02
2.457922756498912342e+00 9.638255901339627396e-01 3.829417015942469982e-09 1.106501019861635768e+02
2.643412071325049961e+00 9.695659269448310136e-01 3.291247133925901363e-09 9.566620401136817975e+01
2.828901386151187580e+00 9.740199695318354500e-01 2.860645873254432982e-09 8.353195821790863818e+01
3.195695155395610776e+00 9.804830097508788755e-01 2.226880004038710651e-09 6.545722516738128149e+01
3.500000000000000000e+00 9.840687773348448797e-01 1.849720182475050407e-09 5.456977847985999830e+01
1.998801889848477176e+00 9.400305847321853703e-01 5.937260295798599041e-09 1.673203545558839949e+02
2.086944126846637104e+00 9.463952883490298618e-01 5.409702260886092602e-09 1.534852463072307103e+02
2.272433441672772059e+00 9.563968807762568414e-01 4.514889045583355576e-09 1.294511568363408855e+02
2.457922756498907013e+00 9.638255901347262400e-01 3.829417015939454081e-09 1.106501019861640600e+02
2.643412071325041968e+00 9.695659269473928532e-01 3.291247133917225065e-09 9.566620401136876239e+01
2.828901386151176922e+00 9.740199695356472898e-01 2.860645873243259426e-09 8.353195821790926345e+01
3.195695155818024880e+00 9.804830097539137812e-01 2.226880003443110004e-09 6.545722515007672371e+01
3.562488925484872837e+00 9.847259406867946430e-01 1.784206642841335117e-09 5.267217275611908178e+01
3.929282695151720795e+00 9.876556558038823708e-01 1.462296600552641392e-09 4.329739107983610324e+01
4.570182323792682411e+00 9.908450535180021168e-01 1.077444177193692332e-09 3.200525022874398928e+01
5.211081952433644027e+00 9.929357294822037661e-01 8.269716695772742945e-10 2.461684964939163933e+01
5.851981581074605643e+00 9.944685441777345591e-01 6.547426396019746781e-10 1.952011529386182431e+01
6.492881209715567259e+00 9.956025175470230026e-01 5.312594591625017127e-10 1.585672027136650897e+01
7.000000000000000000e+00 9.962532121817468944e-01 4.567744063764533480e-10 1.364244461996499957e+01
2 changes: 1 addition & 1 deletion extern/dust_shell/matplotlibrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set the backend, otherwise the figure won't show up. Note that this will
# depend on your system setup; to see which backend is the default,
# run "matplotlib.get_backend()" in the Python interpreter.
backend : GTK3Agg
backend : Agg

# Increase the default DPI, and change the file type from png to pdf
savefig.dpi : 300
Expand Down
7 changes: 4 additions & 3 deletions extern/dust_shell/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def func_M1(t, y):

# solve for critical point
def g(r):
return 3.0*r_0*dlnF_dr(r*r_0) + (4.0/r) + 2.0*sqrt(3.0)*r_0*rho(r*r_0)*kappa0
return float(3.0*r_0*dlnF_dr(r*r_0) + (4.0/r) + 2.0*sqrt(3.0)*r_0*rho(r*r_0)*kappa0)

#plt.figure()
#r_arr = np.linspace(1.0e-3, 2.0, 100)
Expand All @@ -139,7 +139,7 @@ def solve_branch(f0, r0, r1):

# solve right branch
r_start = r_crit + eps
r_end = 3.5 # in units of r_0
r_end = 7.0 # in units of r_0
f_start = f_crit + eps * df_dr_crit
print(f"r_crit = {r_crit}; r_start = {r_start}")
print(f"f_crit = {f_crit}; f_start = {f_start}")
Expand All @@ -166,7 +166,8 @@ def solve_branch(f0, r0, r1):

plt.xlabel('radius r (dimensionless)')
plt.ylabel('reduced flux f (dimensionless)')
plt.xlim(0., 3.5)
#plt.xlim(0., 3.5)
plt.xlim(0., 7.0)
plt.ylim(0., 1.)
plt.savefig('solution.pdf')

Expand Down
16 changes: 16 additions & 0 deletions regression/quokka-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,19 @@ doVis = 1
visVar = temperature
testSrcTree = .
ignore_return_code = 0

[RadhydroShell-GPU]
buildDir = .
target = test_radhydro3d_shell
inputFile = tests/radhydro_shell_regression.in
link1File = extern/dust_shell/initial_conditions.txt
dim = 3
cmakeSetupOpts = -DAMReX_GPU_BACKEND=CUDA
restartTest = 0
useMPI = 1
numprocs = 1
compileTest = 0
doVis = 1
visVar = gasDensity
testSrcTree = .
ignore_return_code = 0
2 changes: 2 additions & 0 deletions src/problems/RadhydroShell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ if (AMReX_SPACEDIM EQUAL 3)
if(AMReX_GPU_BACKEND MATCHES "CUDA")
setup_target_for_cuda_compilation(test_radhydro3d_shell)
endif()

add_test(NAME RadhydroShell COMMAND test_radhydro3d_shell radhydro_shell.in ${QuokkaTestParams} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
endif()
Loading

0 comments on commit 5835ef8

Please # to comment.