-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsem_proxy_options.h
More file actions
95 lines (89 loc) · 3.82 KB
/
sem_proxy_options.h
File metadata and controls
95 lines (89 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef FUNTIDES_MAIN_FE_INCLUDE_SEM_PROXY_OPTIONS_H_
#define FUNTIDES_MAIN_FE_INCLUDE_SEM_PROXY_OPTIONS_H_
#pragma once
#include <cxxopts.hpp>
#include <stdexcept>
#include <string>
class SemProxyOptions
{
public:
// Defaults
int order = 2;
int ex = 50, ey = 50, ez = 50;
float lx = 2000.f, ly = 2000.f, lz = 2000.f;
float srcx = 1010.f, srcy = 1010.f, srcz = 1010.f;
float rcvx = 1310.f, rcvy = 1310.f, rcvz = 1310.f;
std::string implem = "makutu"; // makutu
std::string method = "sem"; // sem
std::string mesh = "cartesian";
std::string anisotropy = "iso"; // iso|vti|tti
float dt = 0.006;
float timemax = 0.7;
bool autodt = false;
// snapshots
bool snapshots = false;
int snap_time_interval = 10;
// sponge boundaries parameters
float boundaries_size = 0;
bool surface_sponge = false;
float taper_delta = 0.015;
// Boolean to tell if the model is charged on nodes or on element
bool isModelOnNodes = false;
bool isElastic = false;
bool free_surface = false;
void validate() const
{
if (order < 1) throw std::runtime_error("order must be >= 1");
if (ex <= 0 || ey <= 0 || ez <= 0)
throw std::runtime_error("ex/ey/ez must be > 0");
if (lx <= 0 || ly <= 0 || lz <= 0)
throw std::runtime_error("lx/ly/lz must be > 0");
}
// Bind CLI flags to this instance (no --help here)
static void bind_cli(cxxopts::Options& opts, SemProxyOptions& o)
{
opts.add_options()("o,order", "Order of approximation",
cxxopts::value<int>(o.order))(
"ex", "Number of elements on X (Cartesian mesh)",
cxxopts::value<int>(o.ex))("ey",
"Number of elements on Y (Cartesian mesh)",
cxxopts::value<int>(o.ey))(
"ez", "Number of elements on Z (Cartesian mesh)",
cxxopts::value<int>(o.ez))("lx", "Domain size X (Cartesian)",
cxxopts::value<float>(o.lx))(
"ly", "Domain size Y (Cartesian)", cxxopts::value<float>(o.ly))(
"lz", "Domain size Z (Cartesian)", cxxopts::value<float>(o.lz))(
"implem", "Implementation: makutu",
cxxopts::value<std::string>(o.implem))(
"method", "Method: sem|dg", cxxopts::value<std::string>(o.method))(
"mesh", "Mesh: cartesian|ucartesian",
cxxopts::value<std::string>(o.mesh))(
"dt", "Time step selection in s (default = 0.001s)",
cxxopts::value<float>(o.dt))(
"timemax", "Duration of the simulation in s (default = 1.5s)",
cxxopts::value<float>(o.timemax))(
"auto-dt", "Select automatique dt via CFL equation.",
cxxopts::value<bool>(o.autodt))("s,snapshots", "Enable snapshot.",
cxxopts::value<bool>(o.snapshots))(
"snap-interval",
"Interval on iteration between two snapshots. (default=10)",
cxxopts::value<int>(o.snap_time_interval))(
"boundaries-size", "Size of absorbing boundaries (meters)",
cxxopts::value<float>(o.boundaries_size))(
"sponge-surface", "Considere the surface's nodes as non sponge nodes",
cxxopts::value<bool>(o.surface_sponge))(
"taper-delta", "Taper delta for sponge boundaries value",
cxxopts::value<float>(o.taper_delta))(
"is-model-on-nodes",
"Boolean to tell if the model is charged on nodes (true) or on element "
"(false)",
cxxopts::value<bool>(o.isModelOnNodes))(
"is-elastic", "Elastic simulation", cxxopts::value<bool>(o.isElastic))(
"free-surface",
"Enable free surface on top boundary (Z+). Default: true",
cxxopts::value<bool>(o.free_surface))(
"anisotropy", "Anisotropy type for elastic: iso|vti|tti (default=iso)",
cxxopts::value<std::string>(o.anisotropy));
}
};
#endif // FUNTIDES_MAIN_FE_INCLUDE_SEM_PROXY_OPTIONS_H_