mirror of
https://codeberg.org/vcbferreira/NuFI_deal.ii
synced 2026-08-12 14:33:18 +02:00
Several f0s cases added, to be tested
This commit is contained in:
+41
-11
@@ -35,21 +35,51 @@ inline double f0(const double x, const double v,
|
||||
const double eps = Parameters::EPS;
|
||||
const double k = Parameters::WAVE_NR;
|
||||
|
||||
double result;
|
||||
const double factor = Parameters::F0_FACTOR;
|
||||
|
||||
auto maxwell = [factor](double u, double v = 0, double v_th = 1) {
|
||||
return 1 / v_th * factor *
|
||||
std::exp(-0.5 * (u - v) * (u - v) / (v_th * v_th));
|
||||
};
|
||||
|
||||
double prefactor;
|
||||
double gaussian;
|
||||
double computed_max;
|
||||
double result;
|
||||
|
||||
switch (f0_type) {
|
||||
case 0:
|
||||
prefactor = Parameters::F0_FACTOR * (1.0 + eps * std::cos(k * x));
|
||||
gaussian = v * v * std::exp(-0.5 * v * v);
|
||||
result = prefactor * gaussian;
|
||||
case 1:
|
||||
// test
|
||||
prefactor = Parameters::F0_FACTOR * (1.0 + eps * std::cos(k * x));
|
||||
gaussian = v * v * std::exp(-0.5 * v * v);
|
||||
result = prefactor * gaussian;
|
||||
case 0: // two-stream
|
||||
{
|
||||
computed_max = maxwell(v);
|
||||
prefactor = (1.0 + eps * std::cos(k * x)) * v * v;
|
||||
result = prefactor * computed_max;
|
||||
break;
|
||||
}
|
||||
case 1: // Landau-damping
|
||||
{
|
||||
computed_max = maxwell(v);
|
||||
prefactor = (1.0 + eps * std::cos(k * x));
|
||||
result = prefactor * computed_max;
|
||||
break;
|
||||
}
|
||||
case 2: // Maxwellian
|
||||
{
|
||||
result = maxwell(v);
|
||||
break;
|
||||
}
|
||||
case 3: // Bump-on tail
|
||||
{
|
||||
const double beam_density = 0.05;
|
||||
const double beam_v_th = 0.2;
|
||||
const double beam_v = 3;
|
||||
const double alpha = beam_density / (1 - beam_density);
|
||||
|
||||
const double beam_max = maxwell(v, beam_v, beam_v_th);
|
||||
computed_max = maxwell(v);
|
||||
result = (1 - alpha) * computed_max + alpha * beam_max;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw std::invalid_argument("Invalid f0_type");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
+7
-2
@@ -23,10 +23,15 @@ constexpr double V_DOMAIN_RIGHT = 10.;
|
||||
constexpr unsigned int NV = 128;
|
||||
constexpr double DV = std::abs(V_DOMAIN_RIGHT - V_DOMAIN_LEFT) / NV;
|
||||
|
||||
constexpr size_t f0_TYPE = 0; // for switch case
|
||||
// f0_TYPE:
|
||||
// 0 -> twos-stream
|
||||
// 1 -> landau-damping
|
||||
// 2 -> maxwellian
|
||||
// 3 -> bump-on-tail
|
||||
constexpr size_t f0_TYPE = 3;
|
||||
|
||||
// deal.ii options
|
||||
constexpr unsigned int GLOBAL_REFINEMENT = 6;
|
||||
constexpr unsigned int GLOBAL_REFINEMENT = 7;
|
||||
constexpr unsigned int FE_DEGREE = 3;
|
||||
constexpr unsigned int CONVERGENCE_ITERATIONS = 5000;
|
||||
constexpr double CONVERGENCE_LIMIT = 1e-8;
|
||||
|
||||
Reference in New Issue
Block a user