mirror of
https://codeberg.org/vcbferreira/NuFI_deal.ii
synced 2026-08-12 14:33:18 +02:00
nufi working, dealii solves poisson, E saved as independent spline
This commit is contained in:
+6
-6
@@ -47,19 +47,19 @@ double eval(double x, const double *coeffs) noexcept
|
||||
x -= Parameters::X_DOMAIN_LEFT;
|
||||
|
||||
// Get "periodic position" in box at origin.
|
||||
x = x - Parameters::LX * floor( x/Parameters::LX );
|
||||
x = x - Parameters::LX * floor( x*Parameters::LX_INV );
|
||||
|
||||
// Knot number
|
||||
double x_knot = floor( x/Parameters::SPLINE_DX);
|
||||
double x_knot = floor( x*Parameters::SPLINE_DX_INV);
|
||||
|
||||
size_t ii = static_cast<size_t>(x_knot);
|
||||
|
||||
// Convert x to reference coordinates.
|
||||
x = x/Parameters::SPLINE_DX - x_knot;
|
||||
x = x*Parameters::SPLINE_DX_INV - x_knot;
|
||||
|
||||
// Scale according to derivative.
|
||||
double factor = 1;
|
||||
for ( size_t i = 0; i < dx; ++i ) factor *= 1/Parameters::SPLINE_DX;
|
||||
for ( size_t i = 0; i < dx; ++i ) factor *= 1*Parameters::SPLINE_DX_INV;
|
||||
|
||||
return factor*splines1d::eval<double,Parameters::SPLINE_ORDER,dx>(x, coeffs + ii);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void interpolate( real *coeffs, const real *values)
|
||||
coeffs[ i ] = tmp[ i % Parameters::SPLINE_NX ];
|
||||
}
|
||||
|
||||
double integral_space_vector(const double *current_coeffs, double dx = Parameters::SPLINE_DX, size_t Nx = Parameters::SPLINE_NX)
|
||||
inline double integral_space_vector(const double *current_coeffs, double dx = Parameters::SPLINE_DX, size_t Nx = Parameters::SPLINE_NX)
|
||||
{
|
||||
double integral = 0.0;
|
||||
double x = Parameters::X_DOMAIN_LEFT;
|
||||
@@ -153,7 +153,7 @@ double integral_space_vector(const double *current_coeffs, double dx = Parameter
|
||||
return integral;
|
||||
};
|
||||
|
||||
double integral_space_vector_squared(const double *current_coeffs, double dx = Parameters::SPLINE_DX, size_t Nx = Parameters::SPLINE_NX)
|
||||
inline double integral_space_vector_squared(const double *current_coeffs, double dx = Parameters::SPLINE_DX, size_t Nx = Parameters::SPLINE_NX)
|
||||
{
|
||||
double integral = 0.0;
|
||||
double x = Parameters::X_DOMAIN_LEFT;
|
||||
|
||||
+9
-6
@@ -11,11 +11,13 @@ namespace Parameters
|
||||
constexpr double X_DOMAIN_LEFT = 0.0;
|
||||
constexpr double X_DOMAIN_RIGHT = 4*M_PI;
|
||||
constexpr double LX = std::abs(X_DOMAIN_RIGHT- X_DOMAIN_LEFT);
|
||||
constexpr double LX_INV = 1/LX;
|
||||
|
||||
constexpr double V_DOMAIN_LEFT = -10.0;
|
||||
constexpr double V_DOMAIN_RIGHT = 10.0;
|
||||
|
||||
constexpr unsigned int NV = 562;
|
||||
constexpr unsigned int NV = 512;
|
||||
constexpr double DV = std::abs(V_DOMAIN_RIGHT - V_DOMAIN_LEFT)/NV;
|
||||
|
||||
// deal.ii options
|
||||
constexpr unsigned int GLOBAL_REFINEMENT = 7;
|
||||
@@ -25,15 +27,16 @@ namespace Parameters
|
||||
|
||||
constexpr double EPS = 0.01;
|
||||
constexpr double WAVE_NR = 0.5;
|
||||
constexpr double F0_FACTOR = 0.39894228040143267793994;
|
||||
constexpr double F0_FACTOR = 0.39894228040143267793994; // 1/sqrt(2pi)
|
||||
|
||||
// NUFI options
|
||||
constexpr double DT=1./16.;
|
||||
constexpr unsigned int TMAX = 20;
|
||||
constexpr double DT=1./10.;
|
||||
constexpr unsigned int TMAX = 50;
|
||||
|
||||
//spline options
|
||||
constexpr int SPLINE_NX = 562;
|
||||
constexpr double SPLINE_DX = LX/(SPLINE_NX-1);
|
||||
constexpr int SPLINE_NX = 256;
|
||||
constexpr double SPLINE_DX = LX/(SPLINE_NX);
|
||||
constexpr double SPLINE_DX_INV = 1/SPLINE_DX;
|
||||
constexpr size_t SPLINE_ORDER = 4;
|
||||
|
||||
//Plotting options
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
#ifndef SPLINES_H
|
||||
#define SPLINES_H
|
||||
#ifndef SPLINES_HP
|
||||
#define SPLINES_HP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user