-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from Pressio/gradients_for_euler_swe_2d
gradients for euler 2d and swe 2d
- Loading branch information
Showing
21 changed files
with
798 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests_cpp/eigen_2d_euler_riemann_explicit_with_gradients/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
add_subdirectory(firstorder) | ||
add_subdirectory(weno3) | ||
add_subdirectory(weno5) |
18 changes: 18 additions & 0 deletions
18
tests_cpp/eigen_2d_euler_riemann_explicit_with_gradients/compare.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
import numpy as np | ||
import sys, os | ||
|
||
if __name__== "__main__": | ||
goldInit = np.loadtxt("grad_gold_init.txt") | ||
goldFinal = np.loadtxt("grad_gold_final.txt") | ||
|
||
Dinit = np.loadtxt("grad_result_init.txt") | ||
Dfinal = np.loadtxt("grad_result_final.txt") | ||
|
||
assert(np.allclose(goldInit.shape, Dinit.shape)) | ||
assert(np.isnan(Dinit).all() == False) | ||
assert(np.allclose(goldInit, Dinit, rtol=1e-8, atol=1e-8)) | ||
|
||
assert(np.allclose(goldFinal.shape, Dfinal.shape)) | ||
assert(np.isnan(Dfinal).all() == False) | ||
assert(np.allclose(goldFinal, Dfinal, rtol=1e-8, atol=1e-8)) |
19 changes: 19 additions & 0 deletions
19
tests_cpp/eigen_2d_euler_riemann_explicit_with_gradients/firstorder/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
set(testname eigen_2d_riemann_firstorder_explicit_with_gradients) | ||
set(exename ${testname}_exe) | ||
|
||
configure_file(../plot.py plot.py COPYONLY) | ||
configure_file(../compare.py compare.py COPYONLY) | ||
configure_file(grad_gold_init.txt grad_gold_init.txt COPYONLY) | ||
configure_file(grad_gold_final.txt grad_gold_final.txt COPYONLY) | ||
|
||
add_executable(${exename} ${CMAKE_CURRENT_SOURCE_DIR}/../main.cc) | ||
|
||
add_test(NAME ${testname} | ||
COMMAND ${CMAKE_COMMAND} | ||
-DMESHDRIVER=${MESHSRC}/create_full_mesh.py | ||
-DOUTDIR=${CMAKE_CURRENT_BINARY_DIR} | ||
-DEXENAME=$<TARGET_FILE:${exename}> | ||
-DSTENCILVAL=3 | ||
-P ${CMAKE_CURRENT_SOURCE_DIR}/../test.cmake | ||
) |
88 changes: 88 additions & 0 deletions
88
tests_cpp/eigen_2d_euler_riemann_explicit_with_gradients/firstorder/grad_gold_final.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
-4.99947e-15 0.0227273 0.00024179257402832 0.0001587844768091 0.0002916487704758 0.00037171245853092 1 | ||
0.02272727272727 -4.9994730577652e-15 0.00024179257402832 0.0002916487704758 0.0001587844768091 0.00037171245853092 2 | ||
0.06818181818182 -4.9994730577652e-15 0.0002418098346976 0.00029165824499352 0.00015879395132683 0.00037172892207445 2 | ||
0.11363636363636 -4.9994730577652e-15 0.00024187550798696 0.00029169471458354 0.00015883052942388 0.00037179231956582 2 | ||
0.15909090909091 -4.9994730577652e-15 0.00024209363727776 0.00029181717438351 0.00015895508431966 0.00037200676644962 2 | ||
0.20454545454545 -4.9994730577652e-15 0.00024280010417585 0.00029221577348279 0.00015936919790525 0.00037271643194799 2 | ||
0.25 -4.9994730577652e-15 0.00024505501019953 0.00029347213320166 0.00016071568898355 0.00037503205612407 2 | ||
0.29545454545455 -4.9994730577652e-15 0.00025205486006183 0.00029717373011392 0.0001648849663448 0.00038236603271887 2 | ||
0.34090909090909 -4.9994730577652e-15 0.00027261597492642 0.00030674088150409 0.00017662191450194 0.00040437974618098 2 | ||
0.38636363636364 -4.9994730577652e-15 0.00032775519366692 0.00032658929997572 0.0002051045091899 0.00046581715465172 2 | ||
0.43181818181818 -4.9994730577652e-15 0.00045806189310689 0.00035564356401182 0.00026281889991178 0.00062255504214386 2 | ||
0.47727272727273 -4.9994730577652e-15 0.00072164760867725 0.0003761559368138 0.00036089804786606 0.00097576595523631 2 | ||
0.52272727272727 -4.9994730577652e-15 0.0011683451008169 0.0003546656800086 0.0005026549423311 0.0016457997558699 2 | ||
0.56818181818182 -4.9994730577652e-15 0.0017961476939897 0.00027101494324636 0.0006772321871165 0.0026793395655564 2 | ||
0.61363636363636 -4.9994730577652e-15 0.0025334740754088 0.00014600659656695 0.00086202039626196 0.0039731020027725 2 | ||
0.65909090909091 -4.9994730577652e-15 0.0032734118869523 2.6179196865217e-05 0.0010350340170758 0.0053191709894921 2 | ||
0.70454545454545 -4.9994730577652e-15 0.0039238639863856 -5.3096359174854e-05 0.0011833595856642 0.0065194017693027 2 | ||
0.75 -4.9994730577652e-15 0.004433721827077 -8.4170954281626e-05 0.0013026253338714 0.0074578631940089 2 | ||
0.79545454545455 -4.9994730577652e-15 0.0047925621057156 -7.9830961176265e-05 0.0013933972560559 0.0081072679406767 2 | ||
0.84090909090909 -4.9994730577652e-15 0.0050181004241426 -5.9223431813094e-05 0.0014585921705733 0.0085020423655089 2 | ||
0.88636363636364 -4.9994730577652e-15 0.0051421137965153 -3.7920598525133e-05 0.0015021876355244 0.0087067276693702 2 | ||
0.93181818181818 -4.9994730577652e-15 0.0051991133507907 -2.4005938457473e-05 0.0015284640440741 0.0087912944445754 2 | ||
1 0.02272727272727 0.0090359849857944 -0.019452276704155 0.010875872759546 -0.0040593889931575 1 | ||
0.97727272727273 -4.9994730577652e-15 0.0052184422950272 -1.8411595258034e-05 0.0015411663090229 0.0088150200239294 2 | ||
-4.9994730577652e-15 0.06818181818182 0.0002418098346976 0.00015879395132683 0.00029165824499352 0.00037172892207445 1 | ||
1 0.06818181818182 0.0090553139300309 -0.019446682360956 0.010888575024495 -0.0040356634138035 1 | ||
-4.9994730577652e-15 0.11363636363636 0.00024187550798696 0.00015883052942388 0.00029169471458354 0.00037179231956582 1 | ||
1 0.11363636363636 0.0091070510963459 -0.019427061060073 0.010929319147111 -0.0039737941948173 1 | ||
-4.9994730577652e-15 0.15909090909091 0.00024209363727776 0.00015895508431966 0.00029181717438351 0.00037200676644962 1 | ||
1 0.15909090909091 0.0092050658176635 -0.019384812138271 0.011032005095355 -0.0038780221950244 1 | ||
-4.9994730577652e-15 0.20454545454545 0.00024280010417585 0.00015936919790525 0.00029221577348279 0.00037271643194799 1 | ||
1 0.20454545454545 0.0093469336470217 -0.019317037268417 0.011278348063469 -0.003837511271502 1 | ||
-4.9994730577652e-15 0.25 0.00024505501019953 0.00016071568898355 0.00029347213320166 0.00037503205612407 1 | ||
1 0.25 0.0094944086299686 -0.01923595597745 0.011903040124603 -0.0041762629788038 1 | ||
-4.9994730577652e-15 0.29545454545455 0.00025205486006183 0.0001648849663448 0.00029717373011392 0.00038236603271887 1 | ||
1 0.29545454545455 0.0096874354826181 -0.019121715717498 0.013623951626905 -0.0055919854548406 1 | ||
-4.9994730577652e-15 0.34090909090909 0.00027261597492642 0.00017662191450194 0.00030674088150409 0.00040437974618098 1 | ||
1 0.34090909090909 0.010691431144954 -0.018567805443693 0.0181417762461 -0.0086018982759746 1 | ||
-4.9994730577652e-15 0.38636363636364 0.00032775519366692 0.0002051045091899 0.00032658929997572 0.00046581715465172 1 | ||
1 0.38636363636364 0.0154767971479 -0.015647714550885 0.02745016937638 -0.010107749835237 1 | ||
-4.9994730577652e-15 0.43181818181818 0.00045806189310689 0.00026281889991178 0.00035564356401182 0.00062255504214386 1 | ||
1 0.43181818181818 0.030386802097302 -0.0052229296811009 0.040276419309436 0.0045938536636014 1 | ||
-4.9994730577652e-15 0.47727272727273 0.00072164760867725 0.00036089804786606 0.0003761559368138 0.00097576595523631 1 | ||
1 0.47727272727273 0.062505745487986 0.020405807679591 0.049817822326952 0.063541511446605 1 | ||
-4.9994730577652e-15 0.52272727272727 0.0011683451008169 0.0005026549423311 0.0003546656800086 0.0016457997558699 1 | ||
1 0.52272727272727 0.11130816337814 0.064537572903645 0.051327963297864 0.18189765791631 1 | ||
-4.9994730577652e-15 0.56818181818182 0.0017961476939897 0.0006772321871165 0.00027101494324636 0.0026793395655564 1 | ||
1 0.56818181818182 0.16349940782192 0.11744163395926 0.052232114335704 0.32836623048905 1 | ||
-4.9994730577652e-15 0.61363636363636 0.0025334740754088 0.00086202039626196 0.00014600659656695 0.0039731020027725 1 | ||
1 0.61363636363636 0.20130800989074 0.15831433860585 0.063584613992469 0.44320152290833 1 | ||
-4.9994730577652e-15 0.65909090909091 0.0032734118869523 0.0010350340170758 2.6179196865217e-05 0.0053191709894921 1 | ||
1 0.65909090909091 0.21287167896845 0.17116721434516 0.08708342060635 0.47972263210767 1 | ||
-4.9994730577652e-15 0.70454545454545 0.0039238639863856 0.0011833595856642 -5.3096359174854e-05 0.0065194017693027 1 | ||
1 0.70454545454545 0.20475855719217 0.15930667440571 0.1114083753452 0.45416240550438 1 | ||
-4.9994730577652e-15 0.75 0.004433721827077 0.0013026253338714 -8.4170954281626e-05 0.0074578631940089 1 | ||
1 0.75 0.1861975616781 0.13244965957743 0.12707098930396 0.39495910120074 1 | ||
-4.9994730577652e-15 0.79545454545455 0.0047925621057156 0.0013933972560559 -7.9830961176265e-05 0.0081072679406767 1 | ||
1 0.79545454545455 0.16261151799295 0.098987187198602 0.13213941854453 0.31819652237088 1 | ||
-4.9994730577652e-15 0.84090909090909 0.0050181004241426 0.0014585921705733 -5.9223431813094e-05 0.0085020423655089 1 | ||
1 0.84090909090909 0.1375852490161 0.064788620703264 0.12791274911293 0.23477868454076 1 | ||
-4.9994730577652e-15 0.88636363636364 0.0051421137965153 0.0015021876355244 -3.7920598525133e-05 0.0087067276693702 1 | ||
1 0.88636363636364 0.11354925418369 0.03369663274502 0.11689636130305 0.15276310559538 1 | ||
-4.9994730577652e-15 0.93181818181818 0.0051991133507907 0.0015284640440741 -2.4005938457473e-05 0.0087912944445754 1 | ||
1 0.93181818181818 0.09210205308933 0.0084841415101546 0.10187528969949 0.078135392270292 1 | ||
-4.9994730577652e-15 0.97727272727273 0.0052184422950272 0.0015411663090229 -1.8411595258034e-05 0.0088150200239294 1 | ||
0.02272727272727 1 0.0090359849857944 0.010875872759546 -0.019452276704155 -0.0040593889931575 2 | ||
0.06818181818182 1 0.0090553139300309 0.010888575024495 -0.019446682360956 -0.0040356634138035 2 | ||
0.11363636363636 1 0.0091070510963459 0.010929319147111 -0.019427061060073 -0.0039737941948173 2 | ||
0.15909090909091 1 0.0092050658176635 0.011032005095355 -0.019384812138271 -0.0038780221950244 2 | ||
0.20454545454545 1 0.0093469336470217 0.011278348063469 -0.019317037268417 -0.003837511271502 2 | ||
0.25 1 0.0094944086299686 0.011903040124603 -0.01923595597745 -0.0041762629788038 2 | ||
0.29545454545455 1 0.0096874354826181 0.013623951626905 -0.019121715717498 -0.0055919854548406 2 | ||
0.34090909090909 1 0.010691431144954 0.0181417762461 -0.018567805443693 -0.0086018982759746 2 | ||
0.38636363636364 1 0.0154767971479 0.02745016937638 -0.015647714550885 -0.010107749835237 2 | ||
0.43181818181818 1 0.030386802097302 0.040276419309436 -0.0052229296811009 0.0045938536636014 2 | ||
0.47727272727273 1 0.062505745487986 0.049817822326952 0.020405807679591 0.063541511446605 2 | ||
0.52272727272727 1 0.11130816337814 0.051327963297864 0.064537572903645 0.18189765791631 2 | ||
0.56818181818182 1 0.16349940782192 0.052232114335704 0.11744163395926 0.32836623048905 2 | ||
0.61363636363636 1 0.20130800989074 0.063584613992469 0.15831433860585 0.44320152290833 2 | ||
0.65909090909091 1 0.21287167896845 0.08708342060635 0.17116721434516 0.47972263210767 2 | ||
0.70454545454545 1 0.20475855719217 0.1114083753452 0.15930667440571 0.45416240550438 2 | ||
0.75 1 0.1861975616781 0.12707098930396 0.13244965957743 0.39495910120074 2 | ||
0.79545454545455 1 0.16261151799295 0.13213941854453 0.098987187198602 0.31819652237088 2 | ||
0.84090909090909 1 0.1375852490161 0.12791274911293 0.064788620703264 0.23477868454076 2 | ||
0.88636363636364 1 0.11354925418369 0.11689636130305 0.03369663274502 0.15276310559538 2 | ||
0.93181818181818 1 0.09210205308933 0.10187528969949 0.0084841415101546 0.078135392270292 2 | ||
0.97727272727273 1 0.074805801771816 0.085969298159237 -0.0074218500300985 0.017161620615766 2 | ||
1 0.97727272727273 0.074805801771816 -0.0074218500300985 0.085969298159237 0.017161620615766 1 |
88 changes: 88 additions & 0 deletions
88
tests_cpp/eigen_2d_euler_riemann_explicit_with_gradients/firstorder/grad_gold_init.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
-4.99947e-15 0.0227273 0 0 0 0 1 | ||
0.02272727272727 -4.9994730577652e-15 0 0 0 0 2 | ||
0.06818181818182 -4.9994730577652e-15 0 0 0 0 2 | ||
0.11363636363636 -4.9994730577652e-15 0 0 0 0 2 | ||
0.15909090909091 -4.9994730577652e-15 0 0 0 0 2 | ||
0.20454545454545 -4.9994730577652e-15 0 0 0 0 2 | ||
0.25 -4.9994730577652e-15 0 0 0 0 2 | ||
0.29545454545455 -4.9994730577652e-15 0 0 0 0 2 | ||
0.34090909090909 -4.9994730577652e-15 0 0 0 0 2 | ||
0.38636363636364 -4.9994730577652e-15 0 0 0 0 2 | ||
0.43181818181818 -4.9994730577652e-15 0 0 0 0 2 | ||
0.47727272727273 -4.9994730577652e-15 0 0 0 0 2 | ||
0.52272727272727 -4.9994730577652e-15 0 0 0 0 2 | ||
0.56818181818182 -4.9994730577652e-15 0 0 0 0 2 | ||
0.61363636363636 -4.9994730577652e-15 0 0 0 0 2 | ||
0.65909090909091 -4.9994730577652e-15 0 0 0 0 2 | ||
0.70454545454545 -4.9994730577652e-15 0 0 0 0 2 | ||
0.75 -4.9994730577652e-15 0 0 0 0 2 | ||
0.79545454545455 -4.9994730577652e-15 0 0 0 0 2 | ||
0.84090909090909 -4.9994730577652e-15 0 0 0 0 2 | ||
0.88636363636364 -4.9994730577652e-15 0 0 0 0 2 | ||
0.93181818181818 -4.9994730577652e-15 0 0 0 0 2 | ||
1 0.02272727272727 0 0 0 0 1 | ||
0.97727272727273 -4.9994730577652e-15 0 0 0 0 2 | ||
-4.9994730577652e-15 0.06818181818182 0 0 0 0 1 | ||
1 0.06818181818182 0 0 0 0 1 | ||
-4.9994730577652e-15 0.11363636363636 0 0 0 0 1 | ||
1 0.11363636363636 0 0 0 0 1 | ||
-4.9994730577652e-15 0.15909090909091 0 0 0 0 1 | ||
1 0.15909090909091 0 0 0 0 1 | ||
-4.9994730577652e-15 0.20454545454545 0 0 0 0 1 | ||
1 0.20454545454545 0 0 0 0 1 | ||
-4.9994730577652e-15 0.25 0 0 0 0 1 | ||
1 0.25 0 0 0 0 1 | ||
-4.9994730577652e-15 0.29545454545455 0 0 0 0 1 | ||
1 0.29545454545455 0 0 0 0 1 | ||
-4.9994730577652e-15 0.34090909090909 0 0 0 0 1 | ||
1 0.34090909090909 0 0 0 0 1 | ||
-4.9994730577652e-15 0.38636363636364 0 0 0 0 1 | ||
1 0.38636363636364 0 0 0 0 1 | ||
-4.9994730577652e-15 0.43181818181818 0 0 0 0 1 | ||
1 0.43181818181818 0 0 0 0 1 | ||
-4.9994730577652e-15 0.47727272727273 0 0 0 0 1 | ||
1 0.47727272727273 0 0 0 0 1 | ||
-4.9994730577652e-15 0.52272727272727 0 0 0 0 1 | ||
1 0.52272727272727 0 0 0 0 1 | ||
-4.9994730577652e-15 0.56818181818182 0 0 0 0 1 | ||
1 0.56818181818182 0 0 0 0 1 | ||
-4.9994730577652e-15 0.61363636363636 0 0 0 0 1 | ||
1 0.61363636363636 0 0 0 0 1 | ||
-4.9994730577652e-15 0.65909090909091 0 0 0 0 1 | ||
1 0.65909090909091 0 0 0 0 1 | ||
-4.9994730577652e-15 0.70454545454545 0 0 0 0 1 | ||
1 0.70454545454545 0 0 0 0 1 | ||
-4.9994730577652e-15 0.75 0 0 0 0 1 | ||
1 0.75 0 0 0 0 1 | ||
-4.9994730577652e-15 0.79545454545455 0 0 0 0 1 | ||
1 0.79545454545455 0 0 0 0 1 | ||
-4.9994730577652e-15 0.84090909090909 0 0 0 0 1 | ||
1 0.84090909090909 0 0 0 0 1 | ||
-4.9994730577652e-15 0.88636363636364 0 0 0 0 1 | ||
1 0.88636363636364 0 0 0 0 1 | ||
-4.9994730577652e-15 0.93181818181818 0 0 0 0 1 | ||
1 0.93181818181818 0 0 0 0 1 | ||
-4.9994730577652e-15 0.97727272727273 0 0 0 0 1 | ||
0.02272727272727 1 0 0 0 0 2 | ||
0.06818181818182 1 0 0 0 0 2 | ||
0.11363636363636 1 0 0 0 0 2 | ||
0.15909090909091 1 0 0 0 0 2 | ||
0.20454545454545 1 0 0 0 0 2 | ||
0.25 1 0 0 0 0 2 | ||
0.29545454545455 1 0 0 0 0 2 | ||
0.34090909090909 1 0 0 0 0 2 | ||
0.38636363636364 1 0 0 0 0 2 | ||
0.43181818181818 1 0 0 0 0 2 | ||
0.47727272727273 1 0 0 0 0 2 | ||
0.52272727272727 1 0 0 0 0 2 | ||
0.56818181818182 1 0 0 0 0 2 | ||
0.61363636363636 1 0 0 0 0 2 | ||
0.65909090909091 1 0 0 0 0 2 | ||
0.70454545454545 1 0 0 0 0 2 | ||
0.75 1 0 0 0 0 2 | ||
0.79545454545455 1 0 0 0 0 2 | ||
0.84090909090909 1 0 0 0 0 2 | ||
0.88636363636364 1 0 0 0 0 2 | ||
0.93181818181818 1 0 0 0 0 2 | ||
0.97727272727273 1 0 0 0 0 2 | ||
1 0.97727272727273 0 0 0 0 1 |
Oops, something went wrong.