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

fixes for two-stream and rieman problems #734

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions infiles/landau1x3vasg.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-title : Landau 1x3v
-subtitle : adaptive sparse grid, quadratic basis
# note: not ready yet

# d_t f + v d_x f + E(f) d_v f= \nu C(f)
# C(f) := d_v( (v-u)f + th d_v f )\
Expand All @@ -10,11 +11,10 @@
# mixed grid with level 7 full grid in x
# and level 6 sparse grid in v.
# quadratic basis
-grid : adapt
-grid : sparse
-start-levels : 5 4 4 4
-max_level : 5
-max_adapt_levels : 5 4 4 4
-thresh : 1e-8
-max-levels : 5 4 4 4
#-adapt : 1e-8
-degree : 2

# imex timestep
Expand All @@ -24,10 +24,10 @@
# dt = 0.75*CFL
# T = dt*250 = 0.05
-step-method : imex
-dt : 1.308997e-2
-num-steps : 3820
-dt : 1.308997e-3
-num-steps : 38200

# solver
-solver : gmres
-inner_it : 25
-tol : 1e-10
-isolve-iter : 200
-isolve-tol : 1e-10
8 changes: 3 additions & 5 deletions infiles/riemann1x3vmg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
# mixed grid with level 7 full grid in x
# and level 6 sparse grid in v.
# quadratic basis
-grid : mixed
-split : 1
-grid : mixed 1
-start-levels : 6 6 6 6
-max_level : 6
-degree : 2

# imex timestep
Expand All @@ -27,5 +25,5 @@

# solver
-solver : gmres
-inner_it : 50
-tol : 1e-8
-isolve-iter : 50
-isolve-tol : 1e-8
8 changes: 4 additions & 4 deletions infiles/twostream2dasg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

# disctretization in space
# level 7 adaptive sparse grid and quadratic basis
-grid : adapt
-grid : mixed 1
-start-levels : 7
-max_level : 7
-max-levels : 7
-degree : 2
-thresh : 1.E-6
-adapt : 1.E-6

# imex timestep
# CFL = dx*(1/(2k+1))*(1/|v_max|)
Expand All @@ -21,4 +21,4 @@
# T = dt*19200 = 45.0
-step-method : imex
-dt : 2.34375E-3
-num-steps : 19200
-num-steps : 19200
2 changes: 1 addition & 1 deletion python/asgard.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def __str__(self):
else:
plist = [(), ()]
for i in range(2, shot.num_dimensions):
plit.append(0.49 * (shot.dimension_max[i] + shot.dimension_min[i]))
plist.append(0.49 * (shot.dimension_max[i] + shot.dimension_min[i]))

z, x, y = shot.plot_data2d(plist, num_points = 256)

Expand Down
16 changes: 15 additions & 1 deletion src/asgard_program_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ void prog_opts::process_inputs(std::vector<std::string_view> const &argv,
{
auto s2 = move_process_next();
if (not s2)
throw std::runtime_error(report_no_value());
throw std::runtime_error(
"missing mixed grid number, see " + std::string(argv.front())
+ " -help");
try {
grid = grid_type::mixed;
mgrid_group = std::stoi(s2->data());
Expand All @@ -306,6 +308,18 @@ void prog_opts::process_inputs(std::vector<std::string_view> const &argv,
throw std::runtime_error(report_wrong_value());
}
}
else if (selected->size() > 6 and (*selected).find("mixed") != std::string::npos)
{
auto pos = (*selected).rfind("mixed") + 5; // 5 == length of "mixed"
try {
grid = grid_type::mixed;
mgrid_group = std::stoi(std::string((*selected).substr(pos)));
} catch(std::invalid_argument &) {
throw std::runtime_error(report_wrong_value());
} catch(std::out_of_range &) {
throw std::runtime_error(report_wrong_value());
}
}
else
throw std::runtime_error(report_wrong_value());
}
Expand Down
2 changes: 1 addition & 1 deletion src/asgard_program_options_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ TEST_CASE("new program options", "[single options]")
REQUIRE_THROWS_WITH(prog_opts(vecstrview({"exe", "-g", "dummy"})),
"invalid value for -g, see exe -help");
REQUIRE_THROWS_WITH(prog_opts(vecstrview({"exe", "-g", "mix"})),
"mix must be followed by a value, see exe -help");
"missing mixed grid number, see exe -help");
prog_opts opts3(vecstrview({"exe", "-g", "sparse"}));
REQUIRE_FALSE(opts3.mgrid_group);
}
Expand Down