Quantum Phenomena Explorer 7.9.8
Interactive quantum-phenomena Explorer Tutor — source documentation
Loading...
Searching...
No Matches
quantumhalledge2d_tests.cpp
Go to the documentation of this file.
1/**
2 * @file quantumhalledge2d_tests.cpp
3 * @brief Implements regression and invariant tests for quantumhalledge2d tests.
4 * @ingroup qpe_tests
5 *
6 * Source: @c tests/quantumhalledge2d_tests.cpp. This file is part of Quantum Phenomena Explorer (QPE),
7 * maintained by Officina Turini. See LICENSE_IT.txt / LICENSE.txt for the
8 * QPE freeware source-available terms and THIRD_PARTY_NOTICES.txt for
9 * third-party components.
10 */
11
17#include <cmath>
18namespace qpe { namespace tests {
19namespace {
20/**
21 * @brief Runs one.
22 * @param b The b value used by the operation.
23 * @param drift The drift value used by the operation.
24 * @param edgeProbability The edge probability value used by the operation.
25 * @param error Output diagnostic text on failure.
26 */
27bool runOne(double b, double &drift, double &edgeProbability, std::string &error)
28{
29 QuantumHallEdge2DConfig c; c.enabled=true; c.fieldStrength=b; c.edgeY=-8.0; c.wallHeight=120.0;
30 c.launchY=-5.3; c.orbitRadius=4.2; c.packetSigma=1.1; c.edgeBand=4.0; c.analysisEndTime=8.0;
31 ComplexField2D f(256u,256u,0.16f,0.16f); PotentialField2D v; U1GaugeField2D g;
32 if (!QuantumHallEdge2D::buildFields(f,c,v,g,&error) ||
33 !QuantumHallEdge2D::prepareState(f,c,1.0,1.0,&error)) return false;
34 QuantumHallEdgeHistory2D h; if(!h.configure(f,c)){error="Hall history configuration failed";return false;} h.append(0.0,f);
37 for(int i=0;i<400;++i)s.stepGaugeCovariant(f,v,g);
38 h.append(s.time(),f); const auto &a=h.samples().back(); drift=a.driftFromStart; edgeProbability=a.edgeProbability;
39 if(std::fabs(a.norm-1.0)>3.0e-3){error="Hall edge propagation lost norm";return false;} return true;
40}
41}
42/**
43 * @brief Runs quantum hall edge2 d tests.
44 * @param error Output diagnostic text on failure.
45 */
46bool runQuantumHallEdge2DTests(std::string &error)
47{
48 double dp=0.0,dm=0.0,ep=0.0,em=0.0;
49 if(!runOne(+0.45,dp,ep,error)||!runOne(-0.45,dm,em,error))return false;
50 if(dp<9.0||dm>-9.0||ep<0.80||em<0.80){error="Hall edge packet did not show robust chiral edge transport";return false;}
51 if(std::fabs(dp+dm)>0.35){error="Hall edge chirality is not symmetric under B reversal";return false;}
52 error.clear();return true;
53}
54} }
Owning Cartesian grid of complex scalar samples.
Implements the Potential Field2D component.
static bool prepareState(ComplexField2D &field, const QuantumHallEdge2DConfig &config, double mass, double hbar, std::string *reason=nullptr)
Prepares state.
static bool buildFields(const ComplexField2D &reference, const QuantumHallEdge2DConfig &config, PotentialField2D &potential, U1GaugeField2D &gauge, std::string *reason=nullptr)
Builds fields.
Implements the Quantum Hall Edge History2D component.
bool configure(const ComplexField2D &field, const QuantumHallEdge2DConfig &config)
Returns configure.
const std::vector< QuantumHallEdgeSample2D > & samples() const noexcept
Samples s.
void append(double time, const ComplexField2D &field)
Carries out append.
Symmetric split-step Fourier solver for the scalar 2D Schrodinger equation.
double time() const noexcept
Returns accumulated simulation time in solver units.
void setParameters(const SplitStepFourier2DParams &params)
Replaces physical/time-step parameters and invalidates prepared caches.
void preparePotential(const PotentialField2D &potential)
Precomputes the scalar-potential half-step phase cache.
void prepare(const ComplexField2D &field)
Precomputes spectral kinetic phase factors for a specific grid.
void stepGaugeCovariant(ComplexField2D &field, const PotentialField2D &potential, const U1GaugeField2D &gauge)
Advances one gauge-covariant Schrodinger step using U(1) links.
Discrete U(1) gauge connection for gauge-covariant Schrodinger experiments.
Declares the complex scalar field container representing two-dimensional wave functions.
bool runOne(double b, double &drift, double &edgeProbability, std::string &error)
Runs one.
bool runQuantumHallEdge2DTests(std::string &error)
Runs quantum hall edge2 d tests.
Declares the potentialfield2d physics/numerical component used by QPE experiments.
Declares the quantumhalledge2d physics/numerical component used by QPE experiments.
Declares regression and invariant tests for quantumhalledge2d tests.
Declares the two-dimensional split-step Fourier propagator for the scalar Schrodinger branch.
Configuration values for Quantum Hall Edge2D Config.
Physical/numerical parameters for scalar split-step propagation.
float hbar
Reduced Planck constant in simulation units.
float dt
Propagation step in simulation time units.
float mass
Particle/effective mass in simulation units.