├── .clang-format ├── .github ├── actions │ ├── build │ │ └── action.yml │ └── test │ │ └── action.yml └── workflows │ └── main.yml ├── .gitignore ├── CITATION.cff ├── CMakeLists.txt ├── LICENSE ├── README.md ├── gmgpolar_small.png ├── include ├── DirectSolver │ ├── DirectSolverGive │ │ └── directSolverGive.h │ ├── DirectSolverGiveCustomLU │ │ └── directSolverGiveCustomLU.h │ ├── DirectSolverTake │ │ └── directSolverTake.h │ ├── DirectSolverTakeCustomLU │ │ └── directSolverTakeCustomLU.h │ └── directSolver.h ├── ExtrapolatedSmoother │ ├── ExtrapolatedSmootherGive │ │ └── extrapolatedSmootherGive.h │ ├── ExtrapolatedSmootherTake │ │ └── extrapolatedSmootherTake.h │ └── extrapolatedSmoother.h ├── GMGPolar │ ├── gmgpolar.h │ └── test_cases.h ├── InputFunctions │ ├── BoundaryConditions │ │ ├── cartesianR2_Boundary_CircularGeometry.h │ │ ├── cartesianR2_Boundary_CzarnyGeometry.h │ │ ├── cartesianR2_Boundary_ShafranovGeometry.h │ │ ├── cartesianR6_Boundary_CircularGeometry.h │ │ ├── cartesianR6_Boundary_CzarnyGeometry.h │ │ ├── cartesianR6_Boundary_ShafranovGeometry.h │ │ ├── polarR6_Boundary_CircularGeometry.h │ │ ├── polarR6_Boundary_CulhamGeometry.h │ │ ├── polarR6_Boundary_CzarnyGeometry.h │ │ ├── polarR6_Boundary_ShafranovGeometry.h │ │ ├── refined_Boundary_CircularGeometry.h │ │ ├── refined_Boundary_CulhamGeometry.h │ │ ├── refined_Boundary_CzarnyGeometry.h │ │ └── refined_Boundary_ShafranovGeometry.h │ ├── DensityProfileCoefficients │ │ ├── poissonCoefficients.h │ │ ├── sonnendruckerCoefficients.h │ │ ├── sonnendruckerGyroCoefficients.h │ │ ├── zoniCoefficients.h │ │ ├── zoniGyroCoefficients.h │ │ ├── zoniShiftedCoefficients.h │ │ └── zoniShiftedGyroCoefficients.h │ ├── DomainGeometry │ │ ├── circularGeometry.h │ │ ├── circularGeometry.inl │ │ ├── culhamGeometry.h │ │ ├── culhamGeometry.inl │ │ ├── czarnyGeometry.h │ │ ├── czarnyGeometry.inl │ │ ├── shafranovGeometry.h │ │ └── shafranovGeometry.inl │ ├── ExactSolution │ │ ├── cartesianR2_CircularGeometry.h │ │ ├── cartesianR2_CzarnyGeometry.h │ │ ├── cartesianR2_ShafranovGeometry.h │ │ ├── cartesianR6_CircularGeometry.h │ │ ├── cartesianR6_CzarnyGeometry.h │ │ ├── cartesianR6_ShafranovGeometry.h │ │ ├── polarR6_CircularGeometry.h │ │ ├── polarR6_CulhamGeometry.h │ │ ├── polarR6_CzarnyGeometry.h │ │ ├── polarR6_ShafranovGeometry.h │ │ ├── refined_CircularGeometry.h │ │ ├── refined_CulhamGeometry.h │ │ ├── refined_CzarnyGeometry.h │ │ └── refined_ShafranovGeometry.h │ ├── SourceTerms │ │ ├── cartesianR2_Poisson_CircularGeometry.h │ │ ├── cartesianR2_Poisson_CzarnyGeometry.h │ │ ├── cartesianR2_Poisson_ShafranovGeometry.h │ │ ├── cartesianR2_SonnendruckerGyro_CircularGeometry.h │ │ ├── cartesianR2_SonnendruckerGyro_CzarnyGeometry.h │ │ ├── cartesianR2_SonnendruckerGyro_ShafranovGeometry.h │ │ ├── cartesianR2_Sonnendrucker_CircularGeometry.h │ │ ├── cartesianR2_Sonnendrucker_CzarnyGeometry.h │ │ ├── cartesianR2_Sonnendrucker_ShafranovGeometry.h │ │ ├── cartesianR2_ZoniGyro_CircularGeometry.h │ │ ├── cartesianR2_ZoniGyro_CzarnyGeometry.h │ │ ├── cartesianR2_ZoniGyro_ShafranovGeometry.h │ │ ├── cartesianR2_ZoniShiftedGyro_CircularGeometry.h │ │ ├── cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h │ │ ├── cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h │ │ ├── cartesianR2_ZoniShifted_CircularGeometry.h │ │ ├── cartesianR2_ZoniShifted_CzarnyGeometry.h │ │ ├── cartesianR2_ZoniShifted_ShafranovGeometry.h │ │ ├── cartesianR2_Zoni_CircularGeometry.h │ │ ├── cartesianR2_Zoni_CzarnyGeometry.h │ │ ├── cartesianR2_Zoni_ShafranovGeometry.h │ │ ├── cartesianR6_Poisson_CircularGeometry.h │ │ ├── cartesianR6_Poisson_CzarnyGeometry.h │ │ ├── cartesianR6_Poisson_ShafranovGeometry.h │ │ ├── cartesianR6_SonnendruckerGyro_CircularGeometry.h │ │ ├── cartesianR6_SonnendruckerGyro_CzarnyGeometry.h │ │ ├── cartesianR6_SonnendruckerGyro_ShafranovGeometry.h │ │ ├── cartesianR6_Sonnendrucker_CircularGeometry.h │ │ ├── cartesianR6_Sonnendrucker_CzarnyGeometry.h │ │ ├── cartesianR6_Sonnendrucker_ShafranovGeometry.h │ │ ├── cartesianR6_ZoniGyro_CircularGeometry.h │ │ ├── cartesianR6_ZoniGyro_CzarnyGeometry.h │ │ ├── cartesianR6_ZoniGyro_ShafranovGeometry.h │ │ ├── cartesianR6_ZoniShiftedGyro_CircularGeometry.h │ │ ├── cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h │ │ ├── cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h │ │ ├── cartesianR6_ZoniShifted_CircularGeometry.h │ │ ├── cartesianR6_ZoniShifted_CzarnyGeometry.h │ │ ├── cartesianR6_ZoniShifted_ShafranovGeometry.h │ │ ├── cartesianR6_Zoni_CircularGeometry.h │ │ ├── cartesianR6_Zoni_CzarnyGeometry.h │ │ ├── cartesianR6_Zoni_ShafranovGeometry.h │ │ ├── polarR6_Poisson_CircularGeometry.h │ │ ├── polarR6_Poisson_CzarnyGeometry.h │ │ ├── polarR6_Poisson_ShafranovGeometry.h │ │ ├── polarR6_SonnendruckerGyro_CircularGeometry.h │ │ ├── polarR6_SonnendruckerGyro_CzarnyGeometry.h │ │ ├── polarR6_SonnendruckerGyro_ShafranovGeometry.h │ │ ├── polarR6_Sonnendrucker_CircularGeometry.h │ │ ├── polarR6_Sonnendrucker_CzarnyGeometry.h │ │ ├── polarR6_Sonnendrucker_ShafranovGeometry.h │ │ ├── polarR6_ZoniGyro_CircularGeometry.h │ │ ├── polarR6_ZoniGyro_CzarnyGeometry.h │ │ ├── polarR6_ZoniGyro_ShafranovGeometry.h │ │ ├── polarR6_ZoniShiftedGyro_CircularGeometry.h │ │ ├── polarR6_ZoniShiftedGyro_CulhamGeometry.h │ │ ├── polarR6_ZoniShiftedGyro_CzarnyGeometry.h │ │ ├── polarR6_ZoniShiftedGyro_ShafranovGeometry.h │ │ ├── polarR6_ZoniShifted_CircularGeometry.h │ │ ├── polarR6_ZoniShifted_CzarnyGeometry.h │ │ ├── polarR6_ZoniShifted_ShafranovGeometry.h │ │ ├── polarR6_Zoni_CircularGeometry.h │ │ ├── polarR6_Zoni_CzarnyGeometry.h │ │ ├── polarR6_Zoni_ShafranovGeometry.h │ │ ├── refined_ZoniShiftedGyro_CircularGeometry.h │ │ ├── refined_ZoniShiftedGyro_CulhamGeometry.h │ │ ├── refined_ZoniShiftedGyro_CzarnyGeometry.h │ │ └── refined_ZoniShiftedGyro_ShafranovGeometry.h │ ├── boundaryConditions.h │ ├── densityProfileCoefficients.h │ ├── domainGeometry.h │ ├── exactSolution.h │ └── sourceTerm.h ├── Interpolation │ └── interpolation.h ├── Level │ └── level.h ├── LinearAlgebra │ ├── coo_matrix.h │ ├── csr_matrix.h │ ├── diagonalSolver.h │ ├── sparseLUSolver.h │ ├── symmetricTridiagonalSolver.h │ ├── vector.h │ └── vector_operations.h ├── PolarGrid │ ├── multiindex.h │ ├── point.h │ ├── polargrid.h │ └── polargrid.inl ├── Residual │ ├── ResidualGive │ │ └── residualGive.h │ ├── ResidualTake │ │ └── residualTake.h │ └── residual.h ├── Smoother │ ├── SmootherGive │ │ └── smootherGive.h │ ├── SmootherTake │ │ └── smootherTake.h │ └── smoother.h ├── Stencil │ └── stencil.h ├── Utilities │ └── cmdline.h └── common │ ├── equals.h │ ├── geometry_helper.h │ ├── global_definitions.h │ └── space_dimension.h ├── pull_request_template.md ├── scripts ├── comparison │ ├── README.txt │ ├── run_gmgpolar_1.0.sh │ └── run_gmgpolar_2.0.sh ├── compile.sh ├── coverage.sh ├── ctest.sh ├── memory_usage │ └── memory_usage.py ├── old_scripts │ ├── README.txt │ ├── batch │ │ └── batch.sh_paper │ ├── batch_deprecated │ │ ├── batch.sh │ │ ├── batch_omp.sh │ │ ├── batch_write_radii_angles.sh │ │ └── test_culham.sh │ ├── performance │ │ └── run_gmgpolar.sh │ ├── plot_tools │ │ ├── lskkr23_plot_benchmarks_strong_scaling.py │ │ ├── lskkr23_plot_sol_coeff_compute_flops.ipynb │ │ ├── lskkr23_plot_weak_scaling.py │ │ └── lskkr23_read_output_strong_scaling.py │ └── python │ │ ├── make_points_r.py │ │ ├── make_points_theta.py │ │ ├── parse_rhs.py │ │ ├── plot_culham.py │ │ ├── print_tables.py │ │ └── treat_output.py ├── performance_likwid │ ├── plots │ │ └── plot_data.py │ └── start_likwid_benchmark.sh ├── roofline_model │ ├── peak_performance.sh │ └── roofline_model.py ├── scalability │ ├── strong_scaling │ │ ├── plot_strong_scaling.py │ │ └── start_strong_scaling_benchmark.sh │ └── weak_scaling │ │ ├── plot_weak_scaling.py │ │ └── start_weak_scaling_benchmark.sh └── tutorial │ ├── convergence_order.sh │ ├── help.sh │ ├── run.sh │ └── sbatch.sh ├── src ├── CMakeLists.txt ├── DirectSolver │ ├── DirectSolverGive │ │ ├── applySymmetryShift.cpp │ │ ├── buildSolverMatrix.cpp │ │ ├── directSolverGive.cpp │ │ ├── initializeMumps.cpp │ │ └── matrixStencil.cpp │ ├── DirectSolverGiveCustomLU │ │ ├── buildSolverMatrix.cpp │ │ ├── directSolverGive.cpp │ │ └── matrixStencil.cpp │ ├── DirectSolverTake │ │ ├── applySymmetryShift.cpp │ │ ├── buildSolverMatrix.cpp │ │ ├── directSolverTake.cpp │ │ ├── initializeMumps.cpp │ │ └── matrixStencil.cpp │ ├── DirectSolverTakeCustomLU │ │ ├── buildSolverMatrix.cpp │ │ ├── directSolverTake.cpp │ │ └── matrixStencil.cpp │ └── directSolver.cpp ├── ExtrapolatedSmoother │ ├── ExtrapolatedSmootherGive │ │ ├── buildAscMatrices.cpp │ │ ├── extrapolatedSmootherGive.cpp │ │ ├── initializeMumps.cpp │ │ ├── smootherSolver.cpp │ │ ├── smootherStencil.cpp │ │ └── task_parallelization.cpp │ ├── ExtrapolatedSmootherTake │ │ ├── buildAscMatrices.cpp │ │ ├── extrapolatedSmootherTake.cpp │ │ ├── initializeMumps.cpp │ │ ├── smootherSolver.cpp │ │ └── smootherStencil.cpp │ └── extrapolatedSmoother.cpp ├── GMGPolar │ ├── MultigridMethods │ │ ├── implicitly_extrapolated_multigrid_F_Cycle.cpp │ │ ├── implicitly_extrapolated_multigrid_V_Cycle.cpp │ │ ├── implicitly_extrapolated_multigrid_W_Cycle.cpp │ │ ├── multigrid_F_Cycle.cpp │ │ ├── multigrid_V_Cycle.cpp │ │ └── multigrid_W_Cycle.cpp │ ├── build_rhs_f.cpp │ ├── gmgpolar.cpp │ ├── level_interpolation.cpp │ ├── parser.cpp │ ├── select_test_case.cpp │ ├── setup.cpp │ ├── solver.cpp │ └── writeToVTK.cpp ├── InputFunctions │ ├── BoundaryConditions │ │ ├── CMakeLists.txt │ │ ├── cartesianR2_Boundary_CircularGeometry.cpp │ │ ├── cartesianR2_Boundary_CzarnyGeometry.cpp │ │ ├── cartesianR2_Boundary_ShafranovGeometry.cpp │ │ ├── cartesianR6_Boundary_CircularGeometry.cpp │ │ ├── cartesianR6_Boundary_CzarnyGeometry.cpp │ │ ├── cartesianR6_Boundary_ShafranovGeometry.cpp │ │ ├── polarR6_Boundary_CircularGeometry.cpp │ │ ├── polarR6_Boundary_CulhamGeometry.cpp │ │ ├── polarR6_Boundary_CzarnyGeometry.cpp │ │ ├── polarR6_Boundary_ShafranovGeometry.cpp │ │ ├── refined_Boundary_CircularGeometry.cpp │ │ ├── refined_Boundary_CulhamGeometry.cpp │ │ ├── refined_Boundary_CzarnyGeometry.cpp │ │ └── refined_Boundary_ShafranovGeometry.cpp │ ├── CMakeLists.txt │ ├── DensityProfileCoefficients │ │ ├── CMakeLists.txt │ │ ├── poissonCoefficients.cpp │ │ ├── sonnendruckerCoefficients.cpp │ │ ├── sonnendruckerGyroCoefficients.cpp │ │ ├── zoniCoefficients.cpp │ │ ├── zoniGyroCoefficients.cpp │ │ ├── zoniShiftedCoefficients.cpp │ │ └── zoniShiftedGyroCoefficients.cpp │ ├── DomainGeometry │ │ ├── CMakeLists.txt │ │ ├── circularGeometry.cpp │ │ ├── culhamGeometry.cpp │ │ ├── czarnyGeometry.cpp │ │ └── shafranovGeometry.cpp │ ├── ExactSolution │ │ ├── CMakeLists.txt │ │ ├── cartesianR2_CircularGeometry.cpp │ │ ├── cartesianR2_CzarnyGeometry.cpp │ │ ├── cartesianR2_ShafranovGeometry.cpp │ │ ├── cartesianR6_CircularGeometry.cpp │ │ ├── cartesianR6_CzarnyGeometry.cpp │ │ ├── cartesianR6_ShafranovGeometry.cpp │ │ ├── polarR6_CircularGeometry.cpp │ │ ├── polarR6_CulhamGeometry.cpp │ │ ├── polarR6_CzarnyGeometry.cpp │ │ ├── polarR6_ShafranovGeometry.cpp │ │ ├── refined_CircularGeometry.cpp │ │ ├── refined_CulhamGeometry.cpp │ │ ├── refined_CzarnyGeometry.cpp │ │ └── refined_ShafranovGeometry.cpp │ └── SourceTerms │ │ ├── CMakeLists.txt │ │ ├── cartesianR2_Poisson_CircularGeometry.cpp │ │ ├── cartesianR2_Poisson_CzarnyGeometry.cpp │ │ ├── cartesianR2_Poisson_ShafranovGeometry.cpp │ │ ├── cartesianR2_SonnendruckerGyro_CircularGeometry.cpp │ │ ├── cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp │ │ ├── cartesianR2_SonnendruckerGyro_ShafranovGeometry.cpp │ │ ├── cartesianR2_Sonnendrucker_CircularGeometry.cpp │ │ ├── cartesianR2_Sonnendrucker_CzarnyGeometry.cpp │ │ ├── cartesianR2_Sonnendrucker_ShafranovGeometry.cpp │ │ ├── cartesianR2_ZoniGyro_CircularGeometry.cpp │ │ ├── cartesianR2_ZoniGyro_CzarnyGeometry.cpp │ │ ├── cartesianR2_ZoniGyro_ShafranovGeometry.cpp │ │ ├── cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp │ │ ├── cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp │ │ ├── cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp │ │ ├── cartesianR2_ZoniShifted_CircularGeometry.cpp │ │ ├── cartesianR2_ZoniShifted_CzarnyGeometry.cpp │ │ ├── cartesianR2_ZoniShifted_ShafranovGeometry.cpp │ │ ├── cartesianR2_Zoni_CircularGeometry.cpp │ │ ├── cartesianR2_Zoni_CzarnyGeometry.cpp │ │ ├── cartesianR2_Zoni_ShafranovGeometry.cpp │ │ ├── cartesianR6_Poisson_CircularGeometry.cpp │ │ ├── cartesianR6_Poisson_CzarnyGeometry.cpp │ │ ├── cartesianR6_Poisson_ShafranovGeometry.cpp │ │ ├── cartesianR6_SonnendruckerGyro_CircularGeometry.cpp │ │ ├── cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp │ │ ├── cartesianR6_SonnendruckerGyro_ShafranovGeometry.cpp │ │ ├── cartesianR6_Sonnendrucker_CircularGeometry.cpp │ │ ├── cartesianR6_Sonnendrucker_CzarnyGeometry.cpp │ │ ├── cartesianR6_Sonnendrucker_ShafranovGeometry.cpp │ │ ├── cartesianR6_ZoniGyro_CircularGeometry.cpp │ │ ├── cartesianR6_ZoniGyro_CzarnyGeometry.cpp │ │ ├── cartesianR6_ZoniGyro_ShafranovGeometry.cpp │ │ ├── cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp │ │ ├── cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp │ │ ├── cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp │ │ ├── cartesianR6_ZoniShifted_CircularGeometry.cpp │ │ ├── cartesianR6_ZoniShifted_CzarnyGeometry.cpp │ │ ├── cartesianR6_ZoniShifted_ShafranovGeometry.cpp │ │ ├── cartesianR6_Zoni_CircularGeometry.cpp │ │ ├── cartesianR6_Zoni_CzarnyGeometry.cpp │ │ ├── cartesianR6_Zoni_ShafranovGeometry.cpp │ │ ├── polarR6_Poisson_CircularGeometry.cpp │ │ ├── polarR6_Poisson_CzarnyGeometry.cpp │ │ ├── polarR6_Poisson_ShafranovGeometry.cpp │ │ ├── polarR6_SonnendruckerGyro_CircularGeometry.cpp │ │ ├── polarR6_SonnendruckerGyro_CzarnyGeometry.cpp │ │ ├── polarR6_SonnendruckerGyro_ShafranovGeometry.cpp │ │ ├── polarR6_Sonnendrucker_CircularGeometry.cpp │ │ ├── polarR6_Sonnendrucker_CzarnyGeometry.cpp │ │ ├── polarR6_Sonnendrucker_ShafranovGeometry.cpp │ │ ├── polarR6_ZoniGyro_CircularGeometry.cpp │ │ ├── polarR6_ZoniGyro_CzarnyGeometry.cpp │ │ ├── polarR6_ZoniGyro_ShafranovGeometry.cpp │ │ ├── polarR6_ZoniShiftedGyro_CircularGeometry.cpp │ │ ├── polarR6_ZoniShiftedGyro_CulhamGeometry.cpp │ │ ├── polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp │ │ ├── polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp │ │ ├── polarR6_ZoniShifted_CircularGeometry.cpp │ │ ├── polarR6_ZoniShifted_CzarnyGeometry.cpp │ │ ├── polarR6_ZoniShifted_ShafranovGeometry.cpp │ │ ├── polarR6_Zoni_CircularGeometry.cpp │ │ ├── polarR6_Zoni_CzarnyGeometry.cpp │ │ ├── polarR6_Zoni_ShafranovGeometry.cpp │ │ ├── refined_ZoniShiftedGyro_CircularGeometry.cpp │ │ ├── refined_ZoniShiftedGyro_CulhamGeometry.cpp │ │ ├── refined_ZoniShiftedGyro_CzarnyGeometry.cpp │ │ └── refined_ZoniShiftedGyro_ShafranovGeometry.cpp ├── Interpolation │ ├── extrapolated_prolongation.cpp │ ├── extrapolated_restriction.cpp │ ├── fmg_interpolation.cpp │ ├── injection.cpp │ ├── interpolation.cpp │ ├── prolongation.cpp │ └── restriction.cpp ├── Level │ ├── level.cpp │ └── levelCache.cpp ├── PolarGrid │ ├── anisotropic_division.cpp │ ├── load_write_grid.cpp │ ├── multiindex.cpp │ ├── point.cpp │ └── polargrid.cpp ├── Residual │ ├── ResidualGive │ │ ├── applyAGive.cpp │ │ └── residualGive.cpp │ ├── ResidualTake │ │ ├── applyResidualTake.cpp │ │ └── residualTake.cpp │ └── residual.cpp ├── Smoother │ ├── SmootherGive │ │ ├── buildMatrix.cpp │ │ ├── initializeMumps.cpp │ │ ├── matrixStencil.cpp │ │ ├── smootherGive.cpp │ │ ├── smootherSolver.cpp │ │ └── task_parallelization.cpp │ ├── SmootherTake │ │ ├── buildMatrix.cpp │ │ ├── initializeMumps.cpp │ │ ├── matrixStencil.cpp │ │ ├── smootherSolver.cpp │ │ └── smootherTake.cpp │ └── smoother.cpp ├── Stencil │ └── stencil.cpp ├── convergence_order.cpp ├── main.cpp ├── strong_scaling.cpp └── weak_scaling.cpp ├── tests ├── CMakeLists.txt ├── DirectSolver │ ├── directSolver.cpp │ └── directSolverNoMumps.cpp ├── ExtrapolatedSmoother │ └── extrapolated_smoother.cpp ├── Interpolation │ ├── extrapolated_prolongation.cpp │ ├── extrapolated_restriction.cpp │ ├── prolongation.cpp │ └── restriction.cpp ├── LinearAlgebra │ ├── csr_matrix.cpp │ ├── cyclic_tridiagonal_solver.cpp │ ├── matrix.cpp │ ├── tridiagonal_solver.cpp │ ├── vector.cpp │ └── vector_operations.cpp ├── PolarGrid │ └── polargrid.cpp ├── Residual │ └── residual.cpp ├── Smoother │ └── smoother.cpp └── gmgpolar_tests.cpp └── third-party └── CMakeLists.txt /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | IndentWidth: 4 3 | SortIncludes: false 4 | ColumnLimit: 120 5 | AlignTrailingComments: false 6 | AccessModifierOffset: -4 7 | AlignConsecutiveAssignments: true 8 | ReflowComments: false 9 | BraceWrapping: 10 | AfterClass: true 11 | AfterFunction: true 12 | BeforeElse: true 13 | BeforeCatch: true 14 | AfterNamespace: true 15 | AfterEnum: true 16 | BreakBeforeBraces: "Custom" 17 | PointerAlignment: Left 18 | AllowShortFunctionsOnASingleLine: false 19 | NamespaceIndentation: Inner 20 | BreakConstructorInitializersBeforeComma: true 21 | AlwaysBreakTemplateDeclarations: Yes 22 | AllowShortLambdasOnASingleLine: Empty 23 | IndentPPDirectives: BeforeHash -------------------------------------------------------------------------------- /.github/actions/build/action.yml: -------------------------------------------------------------------------------- 1 | name: "Linux Build" 2 | runs: 3 | using: "composite" 4 | steps: 5 | - name: Install dependencies 6 | shell: bash 7 | run: | 8 | sudo apt-get -qq update 9 | sudo apt-get -qq install gcc-13 10 | sudo apt-get -qq -y install g++-13 11 | sudo apt-get -qq -y install lcov 12 | - name: Build 13 | shell: 14 | # ensure that the installed compiler version is used 15 | run: | 16 | export CC=/usr/bin/gcc-13 17 | export CXX=/usr/bin/g++-13 18 | mkdir build && cd build 19 | cmake -DCMAKE_BUILD_TYPE=Debug -DGMGPOLAR_ENABLE_COVERAGE=ON .. 20 | make -j4 21 | - name: create build dir archive 22 | shell: bash 23 | run: | 24 | tar -czf build.tar.gz build 25 | - name: Upload build dir archive 26 | uses: actions/upload-artifact@v4 27 | with: 28 | name: build-cpp-linux-gmgpolar 29 | path: build.tar.gz 30 | retention-days: 1 31 | -------------------------------------------------------------------------------- /.github/actions/test/action.yml: -------------------------------------------------------------------------------- 1 | name: "Test on Linux" 2 | description: "Run the unit tests on Linux" 3 | inputs: 4 | build-artifact: 5 | description: "Name of the build artifact that contains the unit test" 6 | required: true 7 | 8 | runs: 9 | using: "composite" 10 | steps: 11 | - name: Install Dependencies 12 | shell: bash 13 | run: | 14 | sudo apt-get -qq update 15 | sudo apt-get -qq -y install lcov 16 | sudo apt-get -qq update 17 | - name: Download build test directory 18 | uses: actions/download-artifact@v4 19 | with: 20 | name: ${{ inputs.build-artifact }} 21 | - name: extract build archive 22 | shell: bash 23 | run: | 24 | tar -xzf build.tar.gz 25 | - name: Run unit tests 26 | shell: bash 27 | # always run tests as cmake target coverage 28 | # does not return an error if a test fails 29 | run: | 30 | cd build/tests 31 | sudo chmod a+x gmgpolar_tests 32 | ./gmgpolar_tests --gtest_output="xml:testreport.xml" 33 | - name: Compute code coverage 34 | shell: bash 35 | # compute code coverage 36 | run: | 37 | cd build 38 | cmake --build . --target coverage 39 | - name: Upload test report 40 | uses: actions/upload-artifact@v4 41 | with: 42 | name: test-report 43 | path: build/tests/testreport.xml 44 | if-no-files-found: error 45 | retention-days: 3 46 | - name: Upload coverage reports 47 | uses: actions/upload-artifact@v4 48 | with: 49 | name: test-coverage-reports 50 | path: | 51 | build/coverage-filtered.info 52 | build/coverage 53 | if-no-files-found: error 54 | retention-days: 1 -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: GMGPolarCI 2 | 3 | on : 4 | schedule: 5 | - cron: "40 2 * * *" 6 | push: 7 | branches: 8 | - "main" 9 | pull_request: 10 | types: [opened, reopened, synchronize, ready_for_review] 11 | 12 | jobs: 13 | install-and-build: 14 | if: github.event.pull_request.draft == false 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: ./.github/actions/build 19 | 20 | run-unit-test: 21 | needs: install-and-build 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v4 25 | - uses: ./.github/actions/test 26 | with: 27 | build-artifact: build-cpp-linux-gmgpolar 28 | 29 | codecov: 30 | if: github.event.pull_request.draft == false 31 | needs: [run-unit-test] 32 | runs-on: ubuntu-latest 33 | steps: 34 | - uses: actions/checkout@v4 35 | - name: Download cpp coverage report 36 | uses: actions/download-artifact@v4 37 | with: 38 | name: test-coverage-reports 39 | - name: Deploy to codecov.io 40 | uses: codecov/codecov-action@v3 41 | with: 42 | token: ${{ secrets.CODECOV_TOKEN }} 43 | files: coverage-filtered.info 44 | verbose: true 45 | -------------------------------------------------------------------------------- /gmgpolar_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciCompMod/GMGPolar/e4cde7466c989576c0704dfca8112b03d93c1160/gmgpolar_small.png -------------------------------------------------------------------------------- /include/DirectSolver/directSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LevelCache; 4 | class Level; 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../InputFunctions/domainGeometry.h" 11 | #include "../InputFunctions/densityProfileCoefficients.h" 12 | #include "../Level/level.h" 13 | #include "../PolarGrid/polargrid.h" 14 | #include "../common/global_definitions.h" 15 | #include "../LinearAlgebra/vector.h" 16 | #include "../LinearAlgebra/vector_operations.h" 17 | #include "../LinearAlgebra/coo_matrix.h" 18 | #include "../LinearAlgebra/csr_matrix.h" 19 | #include "../LinearAlgebra/sparseLUSolver.h" 20 | #include "../Stencil/stencil.h" 21 | 22 | class DirectSolver 23 | { 24 | public: 25 | explicit DirectSolver(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 26 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 27 | int num_omp_threads); 28 | 29 | virtual ~DirectSolver() = default; 30 | 31 | // Note: The rhs (right-hand side) vector gets overwritten during the solution process. 32 | virtual void solveInPlace(Vector& solution) = 0; 33 | 34 | protected: 35 | const PolarGrid& grid_; 36 | const LevelCache& level_cache_; 37 | const DomainGeometry& domain_geometry_; 38 | const DensityProfileCoefficients& density_profile_coefficients_; 39 | const bool DirBC_Interior_; 40 | const int num_omp_threads_; 41 | }; 42 | -------------------------------------------------------------------------------- /include/ExtrapolatedSmoother/extrapolatedSmoother.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LevelCache; 4 | class Level; 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../InputFunctions/domainGeometry.h" 11 | #include "../LinearAlgebra/diagonalSolver.h" 12 | #include "../LinearAlgebra/coo_matrix.h" 13 | #include "../LinearAlgebra/csr_matrix.h" 14 | #include "../LinearAlgebra/sparseLUSolver.h" 15 | #include "../LinearAlgebra/symmetricTridiagonalSolver.h" 16 | #include "../LinearAlgebra/vector.h" 17 | #include "../LinearAlgebra/vector_operations.h" 18 | #include "../PolarGrid/polargrid.h" 19 | 20 | #include "../Level/level.h" 21 | #include "../Stencil/stencil.h" 22 | #include "../common/global_definitions.h" 23 | 24 | class ExtrapolatedSmoother 25 | { 26 | public: 27 | explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCache& level_cache, 28 | const DomainGeometry& domain_geometry, 29 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 30 | int num_omp_threads); 31 | virtual ~ExtrapolatedSmoother() = default; 32 | 33 | virtual void extrapolatedSmoothing(Vector& x, const Vector& rhs, Vector& temp) = 0; 34 | 35 | protected: 36 | const PolarGrid& grid_; 37 | const LevelCache& level_cache_; 38 | const DomainGeometry& domain_geometry_; 39 | const DensityProfileCoefficients& density_profile_coefficients_; 40 | const bool DirBC_Interior_; 41 | const int num_omp_threads_; 42 | }; 43 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR2_Boundary_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR2_Boundary_CircularGeometry : public BoundaryConditions 8 | { 9 | public: 10 | CartesianR2_Boundary_CircularGeometry() = default; 11 | explicit CartesianR2_Boundary_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_Boundary_CircularGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR2_Boundary_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR2_Boundary_CzarnyGeometry : public BoundaryConditions 8 | { 9 | public: 10 | explicit CartesianR2_Boundary_CzarnyGeometry(); 11 | explicit CartesianR2_Boundary_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~CartesianR2_Boundary_CzarnyGeometry() = default; 15 | 16 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const override; 19 | 20 | private: 21 | const double Rmax = 1.3; 22 | const double inverse_aspect_ratio_epsilon = 0.3; 23 | const double ellipticity_e = 1.4; 24 | 25 | void initializeGeometry(); 26 | double factor_xi; 27 | }; 28 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR2_Boundary_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR2_Boundary_ShafranovGeometry : public BoundaryConditions 8 | { 9 | public: 10 | CartesianR2_Boundary_ShafranovGeometry() = default; 11 | explicit CartesianR2_Boundary_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_Boundary_ShafranovGeometry() = default; 14 | 15 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double elongation_kappa = 0.3; 22 | const double shift_delta = 0.2; 23 | }; 24 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR6_Boundary_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR6_Boundary_CircularGeometry : public BoundaryConditions 8 | { 9 | public: 10 | CartesianR6_Boundary_CircularGeometry() = default; 11 | explicit CartesianR6_Boundary_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_Boundary_CircularGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR6_Boundary_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR6_Boundary_CzarnyGeometry : public BoundaryConditions 8 | { 9 | public: 10 | explicit CartesianR6_Boundary_CzarnyGeometry(); 11 | explicit CartesianR6_Boundary_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~CartesianR6_Boundary_CzarnyGeometry() = default; 15 | 16 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const override; 19 | 20 | private: 21 | const double Rmax = 1.3; 22 | const double inverse_aspect_ratio_epsilon = 0.3; 23 | const double ellipticity_e = 1.4; 24 | 25 | void initializeGeometry(); 26 | double factor_xi; 27 | }; 28 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/cartesianR6_Boundary_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class CartesianR6_Boundary_ShafranovGeometry : public BoundaryConditions 8 | { 9 | public: 10 | CartesianR6_Boundary_ShafranovGeometry() = default; 11 | explicit CartesianR6_Boundary_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_Boundary_ShafranovGeometry() = default; 14 | 15 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double elongation_kappa = 0.3; 22 | const double shift_delta = 0.2; 23 | }; 24 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/polarR6_Boundary_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class PolarR6_Boundary_CircularGeometry : public BoundaryConditions 8 | { 9 | public: 10 | PolarR6_Boundary_CircularGeometry() = default; 11 | explicit PolarR6_Boundary_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_Boundary_CircularGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/polarR6_Boundary_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class PolarR6_Boundary_CulhamGeometry : public BoundaryConditions 8 | { 9 | public: 10 | PolarR6_Boundary_CulhamGeometry() = default; 11 | explicit PolarR6_Boundary_CulhamGeometry(const double& Rmax); 12 | virtual ~PolarR6_Boundary_CulhamGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/polarR6_Boundary_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class PolarR6_Boundary_CzarnyGeometry : public BoundaryConditions 8 | { 9 | public: 10 | explicit PolarR6_Boundary_CzarnyGeometry(); 11 | explicit PolarR6_Boundary_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~PolarR6_Boundary_CzarnyGeometry() = default; 15 | 16 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const override; 19 | 20 | private: 21 | const double Rmax = 1.3; 22 | const double inverse_aspect_ratio_epsilon = 0.3; 23 | const double ellipticity_e = 1.4; 24 | 25 | void initializeGeometry(); 26 | double factor_xi; 27 | }; 28 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/polarR6_Boundary_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class PolarR6_Boundary_ShafranovGeometry : public BoundaryConditions 8 | { 9 | public: 10 | PolarR6_Boundary_ShafranovGeometry() = default; 11 | explicit PolarR6_Boundary_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_Boundary_ShafranovGeometry() = default; 14 | 15 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double elongation_kappa = 0.3; 22 | const double shift_delta = 0.2; 23 | }; 24 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/refined_Boundary_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class Refined_Boundary_CircularGeometry : public BoundaryConditions 8 | { 9 | public: 10 | Refined_Boundary_CircularGeometry() = default; 11 | explicit Refined_Boundary_CircularGeometry(const double& Rmax); 12 | virtual ~Refined_Boundary_CircularGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/refined_Boundary_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class Refined_Boundary_CulhamGeometry : public BoundaryConditions 8 | { 9 | public: 10 | Refined_Boundary_CulhamGeometry() = default; 11 | explicit Refined_Boundary_CulhamGeometry(const double& Rmax); 12 | virtual ~Refined_Boundary_CulhamGeometry() = default; 13 | 14 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | }; 21 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/refined_Boundary_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class Refined_Boundary_CzarnyGeometry : public BoundaryConditions 8 | { 9 | public: 10 | explicit Refined_Boundary_CzarnyGeometry(); 11 | explicit Refined_Boundary_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~Refined_Boundary_CzarnyGeometry() = default; 15 | 16 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const override; 19 | 20 | private: 21 | const double Rmax = 1.3; 22 | const double inverse_aspect_ratio_epsilon = 0.3; 23 | const double ellipticity_e = 1.4; 24 | 25 | void initializeGeometry(); 26 | double factor_xi; 27 | }; 28 | -------------------------------------------------------------------------------- /include/InputFunctions/BoundaryConditions/refined_Boundary_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../boundaryConditions.h" 6 | 7 | class Refined_Boundary_ShafranovGeometry : public BoundaryConditions 8 | { 9 | public: 10 | Refined_Boundary_ShafranovGeometry() = default; 11 | explicit Refined_Boundary_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~Refined_Boundary_ShafranovGeometry() = default; 14 | 15 | double u_D(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double elongation_kappa = 0.3; 22 | const double shift_delta = 0.2; 23 | }; 24 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class PoissonCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | PoissonCoefficients() = default; 11 | explicit PoissonCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~PoissonCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.5 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class SonnendruckerCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | SonnendruckerCoefficients() = default; 11 | explicit SonnendruckerCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~SonnendruckerCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.66 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class SonnendruckerGyroCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | SonnendruckerGyroCoefficients() = default; 11 | explicit SonnendruckerGyroCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~SonnendruckerGyroCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.66 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class ZoniCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | ZoniCoefficients() = default; 11 | explicit ZoniCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~ZoniCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.4837 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class ZoniGyroCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | ZoniGyroCoefficients() = default; 11 | explicit ZoniGyroCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~ZoniGyroCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.4837 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class ZoniShiftedCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | ZoniShiftedCoefficients() = default; 11 | explicit ZoniShiftedCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~ZoniShiftedCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.678 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../densityProfileCoefficients.h" 6 | 7 | class ZoniShiftedGyroCoefficients : public DensityProfileCoefficients 8 | { 9 | public: 10 | ZoniShiftedGyroCoefficients() = default; 11 | explicit ZoniShiftedGyroCoefficients(const double& Rmax, const double& alpha); 12 | virtual ~ZoniShiftedGyroCoefficients() = default; 13 | 14 | double alpha(const double& r) const override; 15 | double beta(const double& r) const override; 16 | 17 | double getAlphaJump() const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double alpha_jump = 0.678 * 1.3; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/DomainGeometry/circularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../domainGeometry.h" 6 | 7 | class CircularGeometry : public DomainGeometry 8 | { 9 | public: 10 | CircularGeometry() = default; 11 | explicit CircularGeometry(const double& Rmax); 12 | 13 | virtual ~CircularGeometry() = default; 14 | 15 | double Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | double Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | double dFx_dr(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const override; 19 | double dFy_dr(const double& r, const double& theta, const double& sin_theta, 20 | const double& cos_theta) const override; 21 | double dFx_dt(const double& r, const double& theta, const double& sin_theta, 22 | const double& cos_theta) const override; 23 | double dFy_dt(const double& r, const double& theta, const double& sin_theta, 24 | const double& cos_theta) const override; 25 | 26 | private: 27 | const double Rmax = 1.3; 28 | }; 29 | 30 | #include "circularGeometry.inl" -------------------------------------------------------------------------------- /include/InputFunctions/DomainGeometry/circularGeometry.inl: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "circularGeometry.h" 4 | 5 | // In earlier versions denoted by 'x' 6 | inline double CircularGeometry::Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 7 | return (r/Rmax) * cos_theta; 8 | } 9 | 10 | // In earlier versions denoted by 'y' 11 | inline double CircularGeometry::Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 12 | return (r/Rmax) * sin_theta; 13 | } 14 | 15 | 16 | // In earlier versions denoted by 'Jrr' 17 | inline double CircularGeometry::dFx_dr(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 18 | return (cos_theta) / Rmax; 19 | } 20 | 21 | // In earlier versions denoted by 'Jtr' 22 | inline double CircularGeometry::dFy_dr(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 23 | return (sin_theta) / Rmax; 24 | } 25 | 26 | // In earlier versions denoted by 'Jrt' 27 | inline double CircularGeometry::dFx_dt(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 28 | return (-(r/Rmax)) * sin_theta; 29 | } 30 | 31 | // In earlier versions denoted by 'Jtt' 32 | inline double CircularGeometry::dFy_dt(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 33 | return (r/Rmax) * cos_theta; 34 | } 35 | -------------------------------------------------------------------------------- /include/InputFunctions/DomainGeometry/czarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../domainGeometry.h" 6 | 7 | /* Triangular Shape and Ellipticity */ 8 | 9 | class CzarnyGeometry : public DomainGeometry 10 | { 11 | public: 12 | explicit CzarnyGeometry(); 13 | explicit CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 14 | const double& ellipticity_e); 15 | 16 | virtual ~CzarnyGeometry() = default; 17 | 18 | double Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 19 | double Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 20 | double dFx_dr(const double& r, const double& theta, const double& sin_theta, 21 | const double& cos_theta) const override; 22 | double dFy_dr(const double& r, const double& theta, const double& sin_theta, 23 | const double& cos_theta) const override; 24 | double dFx_dt(const double& r, const double& theta, const double& sin_theta, 25 | const double& cos_theta) const override; 26 | double dFy_dt(const double& r, const double& theta, const double& sin_theta, 27 | const double& cos_theta) const override; 28 | 29 | private: 30 | const double Rmax = 1.3; 31 | const double inverse_aspect_ratio_epsilon = 0.3; 32 | const double ellipticity_e = 1.4; 33 | 34 | void initializeGeometry(); 35 | double factor_xi; 36 | }; 37 | 38 | #include "czarnyGeometry.inl" 39 | -------------------------------------------------------------------------------- /include/InputFunctions/DomainGeometry/shafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../domainGeometry.h" 6 | 7 | /* Strechted Ellipse with a Shafranov Shift */ 8 | 9 | class ShafranovGeometry : public DomainGeometry 10 | { 11 | public: 12 | ShafranovGeometry() = default; 13 | explicit ShafranovGeometry(const double& Rmax, const double& elongation_kappa, const double& shift_delta); 14 | 15 | virtual ~ShafranovGeometry() = default; 16 | 17 | double Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 18 | double Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 19 | double dFx_dr(const double& r, const double& theta, const double& sin_theta, 20 | const double& cos_theta) const override; 21 | double dFy_dr(const double& r, const double& theta, const double& sin_theta, 22 | const double& cos_theta) const override; 23 | double dFx_dt(const double& r, const double& theta, const double& sin_theta, 24 | const double& cos_theta) const override; 25 | double dFy_dt(const double& r, const double& theta, const double& sin_theta, 26 | const double& cos_theta) const override; 27 | 28 | private: 29 | const double Rmax = 1.3; 30 | const double elongation_kappa = 0.3; 31 | const double shift_delta = 0.2; 32 | }; 33 | 34 | #include "shafranovGeometry.inl" -------------------------------------------------------------------------------- /include/InputFunctions/DomainGeometry/shafranovGeometry.inl: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shafranovGeometry.h" 4 | 5 | 6 | // In earlier versions denoted by 'x' 7 | inline double ShafranovGeometry::Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 8 | return (1.0 - elongation_kappa) * (r/Rmax) * cos_theta - shift_delta * (r/Rmax) * (r/Rmax); 9 | } 10 | 11 | // In earlier versions denoted by 'y' 12 | inline double ShafranovGeometry::Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 13 | return (1.0 + elongation_kappa) * (r/Rmax) * sin_theta; 14 | } 15 | 16 | 17 | // In earlier versions denoted by 'Jrr' 18 | inline double ShafranovGeometry::dFx_dr(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 19 | return ( (Rmax - elongation_kappa * Rmax) * cos_theta - 2.0 * shift_delta * r ) / ( Rmax * Rmax ); 20 | } 21 | 22 | // In earlier versions denoted by 'Jtr' 23 | inline double ShafranovGeometry::dFy_dr(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 24 | return (elongation_kappa + 1.0) * sin_theta / Rmax; 25 | } 26 | 27 | // In earlier versions denoted by 'Jrt' 28 | inline double ShafranovGeometry::dFx_dt(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 29 | return ((elongation_kappa - 1.0) * r * sin_theta) / Rmax; 30 | } 31 | 32 | // In earlier versions denoted by 'Jtt' 33 | inline double ShafranovGeometry::dFy_dt(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const { 34 | return ((elongation_kappa + 1.0) * r * cos_theta) / Rmax; 35 | } -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR2_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR2_CircularGeometry : public ExactSolution 8 | { 9 | public: 10 | CartesianR2_CircularGeometry() = default; 11 | explicit CartesianR2_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_CircularGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR2_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR2_CzarnyGeometry : public ExactSolution 8 | { 9 | public: 10 | explicit CartesianR2_CzarnyGeometry(); 11 | explicit CartesianR2_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~CartesianR2_CzarnyGeometry() = default; 15 | 16 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double inverse_aspect_ratio_epsilon = 0.3; 22 | const double ellipticity_e = 1.4; 23 | 24 | void initializeGeometry(); 25 | double factor_xi; 26 | }; 27 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR2_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR2_ShafranovGeometry : public ExactSolution 8 | { 9 | public: 10 | CartesianR2_ShafranovGeometry() = default; 11 | explicit CartesianR2_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_ShafranovGeometry() = default; 14 | 15 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | const double elongation_kappa = 0.3; 21 | const double shift_delta = 0.2; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR6_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR6_CircularGeometry : public ExactSolution 8 | { 9 | public: 10 | CartesianR6_CircularGeometry() = default; 11 | explicit CartesianR6_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_CircularGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR6_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR6_CzarnyGeometry : public ExactSolution 8 | { 9 | public: 10 | explicit CartesianR6_CzarnyGeometry(); 11 | explicit CartesianR6_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~CartesianR6_CzarnyGeometry() = default; 15 | 16 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double inverse_aspect_ratio_epsilon = 0.3; 22 | const double ellipticity_e = 1.4; 23 | 24 | void initializeGeometry(); 25 | double factor_xi; 26 | }; 27 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/cartesianR6_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class CartesianR6_ShafranovGeometry : public ExactSolution 8 | { 9 | public: 10 | CartesianR6_ShafranovGeometry() = default; 11 | explicit CartesianR6_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_ShafranovGeometry() = default; 14 | 15 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 16 | const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | const double elongation_kappa = 0.3; 21 | const double shift_delta = 0.2; 22 | }; 23 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/polarR6_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class PolarR6_CircularGeometry : public ExactSolution 8 | { 9 | public: 10 | PolarR6_CircularGeometry() = default; 11 | explicit PolarR6_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_CircularGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/polarR6_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class PolarR6_CulhamGeometry : public ExactSolution 8 | { 9 | public: 10 | PolarR6_CulhamGeometry() = default; 11 | explicit PolarR6_CulhamGeometry(const double& Rmax); 12 | virtual ~PolarR6_CulhamGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/polarR6_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class PolarR6_CzarnyGeometry : public ExactSolution 8 | { 9 | public: 10 | explicit PolarR6_CzarnyGeometry(); 11 | explicit PolarR6_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~PolarR6_CzarnyGeometry() = default; 15 | 16 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double inverse_aspect_ratio_epsilon = 0.3; 22 | const double ellipticity_e = 1.4; 23 | 24 | void initializeGeometry(); 25 | double factor_xi; 26 | }; 27 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/polarR6_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class PolarR6_ShafranovGeometry : public ExactSolution 8 | { 9 | public: 10 | PolarR6_ShafranovGeometry() = default; 11 | explicit PolarR6_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, const double& shift_delta); 12 | virtual ~PolarR6_ShafranovGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/refined_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class Refined_CircularGeometry : public ExactSolution 8 | { 9 | public: 10 | Refined_CircularGeometry() = default; 11 | explicit Refined_CircularGeometry(const double& Rmax); 12 | virtual ~Refined_CircularGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/refined_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class Refined_CulhamGeometry : public ExactSolution 8 | { 9 | public: 10 | Refined_CulhamGeometry() = default; 11 | explicit Refined_CulhamGeometry(const double& Rmax); 12 | virtual ~Refined_CulhamGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | }; 20 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/refined_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class Refined_CzarnyGeometry : public ExactSolution 8 | { 9 | public: 10 | explicit Refined_CzarnyGeometry(); 11 | explicit Refined_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | 14 | virtual ~Refined_CzarnyGeometry() = default; 15 | 16 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 17 | const double& cos_theta) const override; 18 | 19 | private: 20 | const double Rmax = 1.3; 21 | const double inverse_aspect_ratio_epsilon = 0.3; 22 | const double ellipticity_e = 1.4; 23 | 24 | void initializeGeometry(); 25 | double factor_xi; 26 | }; 27 | -------------------------------------------------------------------------------- /include/InputFunctions/ExactSolution/refined_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../exactSolution.h" 6 | 7 | class Refined_ShafranovGeometry : public ExactSolution 8 | { 9 | public: 10 | Refined_ShafranovGeometry() = default; 11 | explicit Refined_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, const double& shift_delta); 12 | virtual ~Refined_ShafranovGeometry() = default; 13 | 14 | double exact_solution(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Poisson_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Poisson_CircularGeometry() = default; 11 | explicit CartesianR2_Poisson_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_Poisson_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Poisson_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Poisson_CzarnyGeometry() = default; 11 | explicit CartesianR2_Poisson_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_Poisson_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Poisson_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Poisson_ShafranovGeometry() = default; 11 | explicit CartesianR2_Poisson_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_Poisson_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_SonnendruckerGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_SonnendruckerGyro_CircularGeometry() = default; 11 | explicit CartesianR2_SonnendruckerGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_SonnendruckerGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_SonnendruckerGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_SonnendruckerGyro_CzarnyGeometry() = default; 11 | explicit CartesianR2_SonnendruckerGyro_CzarnyGeometry(const double& Rmax, 12 | const double& inverse_aspect_ratio_epsilon, 13 | const double& ellipticity_e); 14 | virtual ~CartesianR2_SonnendruckerGyro_CzarnyGeometry() = default; 15 | 16 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | const double inverse_aspect_ratio_epsilon = 0.3; 21 | const double ellipticity_e = 1.4; 22 | 23 | void initializeGeometry(); 24 | double factor_xi; 25 | }; 26 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_SonnendruckerGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_SonnendruckerGyro_ShafranovGeometry() = default; 11 | explicit CartesianR2_SonnendruckerGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_SonnendruckerGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Sonnendrucker_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Sonnendrucker_CircularGeometry() = default; 11 | explicit CartesianR2_Sonnendrucker_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_Sonnendrucker_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Sonnendrucker_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Sonnendrucker_CzarnyGeometry() = default; 11 | explicit CartesianR2_Sonnendrucker_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_Sonnendrucker_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Sonnendrucker_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Sonnendrucker_ShafranovGeometry() = default; 11 | explicit CartesianR2_Sonnendrucker_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_Sonnendrucker_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniGyro_CircularGeometry() = default; 11 | explicit CartesianR2_ZoniGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_ZoniGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniGyro_CzarnyGeometry() = default; 11 | explicit CartesianR2_ZoniGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_ZoniGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniGyro_ShafranovGeometry() = default; 11 | explicit CartesianR2_ZoniGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_ZoniGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShiftedGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShiftedGyro_CircularGeometry() = default; 11 | explicit CartesianR2_ZoniShiftedGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_ZoniShiftedGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShiftedGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShiftedGyro_CzarnyGeometry() = default; 11 | explicit CartesianR2_ZoniShiftedGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_ZoniShiftedGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShiftedGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShiftedGyro_ShafranovGeometry() = default; 11 | explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_ZoniShiftedGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShifted_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShifted_CircularGeometry() = default; 11 | explicit CartesianR2_ZoniShifted_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_ZoniShifted_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShifted_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShifted_CzarnyGeometry() = default; 11 | explicit CartesianR2_ZoniShifted_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_ZoniShifted_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_ZoniShifted_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_ZoniShifted_ShafranovGeometry() = default; 11 | explicit CartesianR2_ZoniShifted_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_ZoniShifted_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Zoni_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Zoni_CircularGeometry() = default; 11 | explicit CartesianR2_Zoni_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR2_Zoni_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Zoni_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Zoni_CzarnyGeometry() = default; 11 | explicit CartesianR2_Zoni_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR2_Zoni_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR2_Zoni_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR2_Zoni_ShafranovGeometry() = default; 11 | explicit CartesianR2_Zoni_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR2_Zoni_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Poisson_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Poisson_CircularGeometry() = default; 11 | explicit CartesianR6_Poisson_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_Poisson_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Poisson_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Poisson_CzarnyGeometry() = default; 11 | explicit CartesianR6_Poisson_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_Poisson_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Poisson_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Poisson_ShafranovGeometry() = default; 11 | explicit CartesianR6_Poisson_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_Poisson_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_SonnendruckerGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_SonnendruckerGyro_CircularGeometry() = default; 11 | explicit CartesianR6_SonnendruckerGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_SonnendruckerGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_SonnendruckerGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_SonnendruckerGyro_CzarnyGeometry() = default; 11 | explicit CartesianR6_SonnendruckerGyro_CzarnyGeometry(const double& Rmax, 12 | const double& inverse_aspect_ratio_epsilon, 13 | const double& ellipticity_e); 14 | virtual ~CartesianR6_SonnendruckerGyro_CzarnyGeometry() = default; 15 | 16 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 17 | 18 | private: 19 | const double Rmax = 1.3; 20 | const double inverse_aspect_ratio_epsilon = 0.3; 21 | const double ellipticity_e = 1.4; 22 | 23 | void initializeGeometry(); 24 | double factor_xi; 25 | }; 26 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_SonnendruckerGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_SonnendruckerGyro_ShafranovGeometry() = default; 11 | explicit CartesianR6_SonnendruckerGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_SonnendruckerGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Sonnendrucker_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Sonnendrucker_CircularGeometry() = default; 11 | explicit CartesianR6_Sonnendrucker_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_Sonnendrucker_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Sonnendrucker_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Sonnendrucker_CzarnyGeometry() = default; 11 | explicit CartesianR6_Sonnendrucker_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_Sonnendrucker_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Sonnendrucker_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Sonnendrucker_ShafranovGeometry() = default; 11 | explicit CartesianR6_Sonnendrucker_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_Sonnendrucker_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniGyro_CircularGeometry() = default; 11 | explicit CartesianR6_ZoniGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_ZoniGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniGyro_CzarnyGeometry() = default; 11 | explicit CartesianR6_ZoniGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_ZoniGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniGyro_ShafranovGeometry() = default; 11 | explicit CartesianR6_ZoniGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_ZoniGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShiftedGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShiftedGyro_CircularGeometry() = default; 11 | explicit CartesianR6_ZoniShiftedGyro_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_ZoniShiftedGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShiftedGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShiftedGyro_CzarnyGeometry() = default; 11 | explicit CartesianR6_ZoniShiftedGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_ZoniShiftedGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShiftedGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShiftedGyro_ShafranovGeometry() = default; 11 | explicit CartesianR6_ZoniShiftedGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_ZoniShiftedGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShifted_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShifted_CircularGeometry() = default; 11 | explicit CartesianR6_ZoniShifted_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_ZoniShifted_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShifted_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShifted_CzarnyGeometry() = default; 11 | explicit CartesianR6_ZoniShifted_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_ZoniShifted_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_ZoniShifted_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_ZoniShifted_ShafranovGeometry() = default; 11 | explicit CartesianR6_ZoniShifted_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_ZoniShifted_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Zoni_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Zoni_CircularGeometry() = default; 11 | explicit CartesianR6_Zoni_CircularGeometry(const double& Rmax); 12 | virtual ~CartesianR6_Zoni_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Zoni_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Zoni_CzarnyGeometry() = default; 11 | explicit CartesianR6_Zoni_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~CartesianR6_Zoni_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class CartesianR6_Zoni_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | CartesianR6_Zoni_ShafranovGeometry() = default; 11 | explicit CartesianR6_Zoni_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~CartesianR6_Zoni_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Poisson_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Poisson_CircularGeometry() = default; 11 | explicit PolarR6_Poisson_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_Poisson_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Poisson_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Poisson_CzarnyGeometry() = default; 11 | explicit PolarR6_Poisson_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_Poisson_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Poisson_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Poisson_ShafranovGeometry() = default; 11 | explicit PolarR6_Poisson_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_Poisson_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_SonnendruckerGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_SonnendruckerGyro_CircularGeometry() = default; 11 | explicit PolarR6_SonnendruckerGyro_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_SonnendruckerGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_SonnendruckerGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_SonnendruckerGyro_CzarnyGeometry() = default; 11 | explicit PolarR6_SonnendruckerGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_SonnendruckerGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_SonnendruckerGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_SonnendruckerGyro_ShafranovGeometry() = default; 11 | explicit PolarR6_SonnendruckerGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_SonnendruckerGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Sonnendrucker_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Sonnendrucker_CircularGeometry() = default; 11 | explicit PolarR6_Sonnendrucker_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_Sonnendrucker_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Sonnendrucker_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Sonnendrucker_CzarnyGeometry() = default; 11 | explicit PolarR6_Sonnendrucker_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_Sonnendrucker_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Sonnendrucker_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Sonnendrucker_ShafranovGeometry() = default; 11 | explicit PolarR6_Sonnendrucker_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_Sonnendrucker_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniGyro_CircularGeometry() = default; 11 | explicit PolarR6_ZoniGyro_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_ZoniGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniGyro_CzarnyGeometry() = default; 11 | explicit PolarR6_ZoniGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_ZoniGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniGyro_ShafranovGeometry() = default; 11 | explicit PolarR6_ZoniGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_ZoniGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShiftedGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShiftedGyro_CircularGeometry() = default; 11 | explicit PolarR6_ZoniShiftedGyro_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_ZoniShiftedGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShiftedGyro_CulhamGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShiftedGyro_CulhamGeometry() = default; 11 | explicit PolarR6_ZoniShiftedGyro_CulhamGeometry(const double& Rmax); 12 | virtual ~PolarR6_ZoniShiftedGyro_CulhamGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShiftedGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShiftedGyro_CzarnyGeometry() = default; 11 | explicit PolarR6_ZoniShiftedGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_ZoniShiftedGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShiftedGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShiftedGyro_ShafranovGeometry() = default; 11 | explicit PolarR6_ZoniShiftedGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_ZoniShiftedGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShifted_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShifted_CircularGeometry() = default; 11 | explicit PolarR6_ZoniShifted_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_ZoniShifted_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShifted_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShifted_CzarnyGeometry() = default; 11 | explicit PolarR6_ZoniShifted_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_ZoniShifted_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_ZoniShifted_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_ZoniShifted_ShafranovGeometry() = default; 11 | explicit PolarR6_ZoniShifted_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_ZoniShifted_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Zoni_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Zoni_CircularGeometry() = default; 11 | explicit PolarR6_Zoni_CircularGeometry(const double& Rmax); 12 | virtual ~PolarR6_Zoni_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Zoni_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Zoni_CzarnyGeometry() = default; 11 | explicit PolarR6_Zoni_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~PolarR6_Zoni_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class PolarR6_Zoni_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | PolarR6_Zoni_ShafranovGeometry() = default; 11 | explicit PolarR6_Zoni_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~PolarR6_Zoni_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class Refined_ZoniShiftedGyro_CircularGeometry : public SourceTerm 8 | { 9 | public: 10 | Refined_ZoniShiftedGyro_CircularGeometry() = default; 11 | explicit Refined_ZoniShiftedGyro_CircularGeometry(const double& Rmax); 12 | virtual ~Refined_ZoniShiftedGyro_CircularGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class Refined_ZoniShiftedGyro_CulhamGeometry : public SourceTerm 8 | { 9 | public: 10 | Refined_ZoniShiftedGyro_CulhamGeometry() = default; 11 | explicit Refined_ZoniShiftedGyro_CulhamGeometry(const double& Rmax); 12 | virtual ~Refined_ZoniShiftedGyro_CulhamGeometry() = default; 13 | 14 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 15 | 16 | private: 17 | const double Rmax = 1.3; 18 | }; 19 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class Refined_ZoniShiftedGyro_CzarnyGeometry : public SourceTerm 8 | { 9 | public: 10 | Refined_ZoniShiftedGyro_CzarnyGeometry() = default; 11 | explicit Refined_ZoniShiftedGyro_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 12 | const double& ellipticity_e); 13 | virtual ~Refined_ZoniShiftedGyro_CzarnyGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double inverse_aspect_ratio_epsilon = 0.3; 20 | const double ellipticity_e = 1.4; 21 | 22 | void initializeGeometry(); 23 | double factor_xi; 24 | }; 25 | -------------------------------------------------------------------------------- /include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../sourceTerm.h" 6 | 7 | class Refined_ZoniShiftedGyro_ShafranovGeometry : public SourceTerm 8 | { 9 | public: 10 | Refined_ZoniShiftedGyro_ShafranovGeometry() = default; 11 | explicit Refined_ZoniShiftedGyro_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 12 | const double& shift_delta); 13 | virtual ~Refined_ZoniShiftedGyro_ShafranovGeometry() = default; 14 | 15 | double rhs_f(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const override; 16 | 17 | private: 18 | const double Rmax = 1.3; 19 | const double elongation_kappa = 0.3; 20 | const double shift_delta = 0.2; 21 | }; 22 | -------------------------------------------------------------------------------- /include/InputFunctions/boundaryConditions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class BoundaryConditions 4 | { 5 | public: 6 | BoundaryConditions() = default; 7 | virtual ~BoundaryConditions() = default; 8 | 9 | virtual double u_D(const double& r, const double& theta, const double& sin_theta, 10 | const double& cos_theta) const = 0; 11 | // Only used if DirBC_Interior = true 12 | virtual double u_D_Interior(const double& r, const double& theta, const double& sin_theta, 13 | const double& cos_theta) const = 0; 14 | }; -------------------------------------------------------------------------------- /include/InputFunctions/densityProfileCoefficients.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class DensityProfileCoefficients 4 | { 5 | public: 6 | DensityProfileCoefficients() = default; 7 | virtual ~DensityProfileCoefficients() = default; 8 | 9 | virtual double alpha(const double& r) const = 0; 10 | virtual double beta(const double& r) const = 0; 11 | 12 | // Only used in custom mesh generation -> refinement_radius 13 | virtual double getAlphaJump() const = 0; 14 | }; -------------------------------------------------------------------------------- /include/InputFunctions/domainGeometry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * @class DomainGeometry 5 | * @brief An abstract base class representing the geometric properties of a domain. 6 | * 7 | * This class provides an interface for calculating geometric transformations and their derivatives 8 | * for a domain in polar coordinates (r, θ). It includes pure virtual functions to compute the 9 | * Cartesian coordinates (Fx, Fy) from polar coordinates, as well as their partial derivatives with 10 | * respect to r and θ. 11 | * 12 | * Subclasses should implement the specific transformations and derivative calculations for their 13 | * respective geometric domains. 14 | */ 15 | 16 | class DomainGeometry 17 | { 18 | public: 19 | DomainGeometry() = default; 20 | virtual ~DomainGeometry() = default; 21 | 22 | // In earlier versions denoted by 'x' and 'y'. 23 | virtual double Fx(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const = 0; 24 | virtual double Fy(const double& r, const double& theta, const double& sin_theta, const double& cos_theta) const = 0; 25 | 26 | // In earlier versions denoted by 'Jrr', 'Jtr', 'Jrt' and 'Jtt'. 27 | virtual double dFx_dr(const double& r, const double& theta, const double& sin_theta, 28 | const double& cos_theta) const = 0; 29 | virtual double dFy_dr(const double& r, const double& theta, const double& sin_theta, 30 | const double& cos_theta) const = 0; 31 | virtual double dFx_dt(const double& r, const double& theta, const double& sin_theta, 32 | const double& cos_theta) const = 0; 33 | virtual double dFy_dt(const double& r, const double& theta, const double& sin_theta, 34 | const double& cos_theta) const = 0; 35 | }; 36 | -------------------------------------------------------------------------------- /include/InputFunctions/exactSolution.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ExactSolution 4 | { 5 | public: 6 | ExactSolution() = default; 7 | virtual ~ExactSolution() = default; 8 | 9 | virtual double exact_solution(const double& r, const double& theta, const double& sin_theta, 10 | const double& cos_theta) const = 0; 11 | }; -------------------------------------------------------------------------------- /include/InputFunctions/sourceTerm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class SourceTerm 4 | { 5 | public: 6 | SourceTerm() = default; 7 | virtual ~SourceTerm() = default; 8 | 9 | virtual double rhs_f(const double& r, const double& theta, const double& sin_theta, 10 | const double& cos_theta) const = 0; 11 | }; -------------------------------------------------------------------------------- /include/PolarGrid/multiindex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../common/space_dimension.h" 8 | 9 | class MultiIndex 10 | { 11 | public: 12 | static_assert(space_dimension > 0 && space_dimension <= 3, "Invalid space dimension"); 13 | 14 | //! Creates a multi index with undefined coordinate values. 15 | MultiIndex() = default; 16 | 17 | //! Initializes all coordinate values of the multi index with `value`. 18 | explicit MultiIndex(int value); 19 | //! Initializes 2-dimensional multi index coordinate values with `i` and `j`. 20 | //! Works only if `space_dimension` is 2. 21 | explicit MultiIndex(int i, int j); 22 | //! Initializes 3-dimensional multi index coordinate values with `i`, `j` and `k`. 23 | //! Works only if `space_dimension` is 3. 24 | explicit MultiIndex(int i, int j, int k); 25 | 26 | //! Returns the size of the multi index. 27 | //! This is equal to `space_dimension`. 28 | int size() const; 29 | 30 | //! Tests if two multi indices are equal 31 | bool operator==(const MultiIndex& other) const; 32 | //! Tests if two multi indices are inequal 33 | bool operator!=(const MultiIndex& other) const; 34 | 35 | //! Returns the `i`th coordinate value of the multi index. 36 | const int& operator[](int i) const; 37 | 38 | //! Returns a mutable reference to the `i`th coordinate value of the multi index. 39 | int& operator[](int i); 40 | 41 | int* data(); 42 | const int* data() const; 43 | 44 | private: 45 | int data_[space_dimension]; 46 | }; -------------------------------------------------------------------------------- /include/PolarGrid/point.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../common/equals.h" 8 | #include "../common/space_dimension.h" 9 | 10 | class Point 11 | { 12 | public: 13 | static_assert(space_dimension > 0 && space_dimension <= 3, "Invalid space dimension"); 14 | 15 | //! Creates a point with undefined coordinate values. 16 | Point() = default; 17 | 18 | //! Initializes all coordinate values of the point with `value`. 19 | explicit Point(double value); 20 | //! Initializes 2-dimensional point coordinate values with `x` and `y`. 21 | //! Works only if `space_dimension` is 2. 22 | explicit Point(double x, double y); 23 | //! Initializes 3-dimensional point coordinate values with `x`, `y` and `z`. 24 | //! Works only if `space_dimension` is 3. 25 | explicit Point(double x, double y, double z); 26 | 27 | //! Returns the size of the point. 28 | //! This is equal to `space_dimension`. 29 | int size() const; 30 | 31 | //! Returns the `i`th coordinate value of the point. 32 | const double& operator[](int i) const; 33 | 34 | //! Returns a mutable reference to the `i`th coordinate value of the point. 35 | double& operator[](int i); 36 | 37 | private: 38 | double data_[space_dimension]; 39 | }; 40 | 41 | bool equals(const Point& lhs, const Point& rhs); 42 | double norm(const Point& point); 43 | void add(Point& result, const Point& lhs, const Point& rhs); 44 | void subtract(Point& result, const Point& lhs, const Point& rhs); 45 | void multiply(Point& result, const double& scalar, const Point& lhs); -------------------------------------------------------------------------------- /include/Residual/ResidualGive/residualGive.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../residual.h" 4 | 5 | class ResidualGive : public Residual 6 | { 7 | public: 8 | explicit ResidualGive(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 9 | const DensityProfileCoefficients& density_profile_coefficients, const bool DirBC_Interior, 10 | const int num_omp_threads); 11 | ~ResidualGive() override = default; 12 | 13 | void computeResidual(Vector& result, const Vector& rhs, const Vector& x) const override; 14 | 15 | private: 16 | void applyCircleSection(const int i_r, Vector& result, const Vector& x) const; 17 | void applyRadialSection(const int i_theta, Vector& result, const Vector& x) const; 18 | }; -------------------------------------------------------------------------------- /include/Residual/ResidualTake/residualTake.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../residual.h" 4 | 5 | class ResidualTake : public Residual 6 | { 7 | public: 8 | explicit ResidualTake(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 9 | const DensityProfileCoefficients& density_profile_coefficients, const bool DirBC_Interior, 10 | const int num_omp_threads); 11 | ~ResidualTake() override = default; 12 | 13 | void computeResidual(Vector& result, const Vector& rhs, const Vector& x) const override; 14 | 15 | private: 16 | void applyCircleSection(const int i_r, Vector& result, const Vector& rhs, 17 | const Vector& x) const; 18 | void applyRadialSection(const int i_theta, Vector& result, const Vector& rhs, 19 | const Vector& x) const; 20 | }; -------------------------------------------------------------------------------- /include/Residual/residual.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LevelCache; 4 | class Level; 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../PolarGrid/polargrid.h" 11 | 12 | #include "../InputFunctions/boundaryConditions.h" 13 | #include "../InputFunctions/densityProfileCoefficients.h" 14 | #include "../InputFunctions/domainGeometry.h" 15 | #include "../InputFunctions/sourceTerm.h" 16 | #include "../Level/level.h" 17 | #include "../LinearAlgebra/vector.h" 18 | #include "../LinearAlgebra/vector_operations.h" 19 | #include "../common/global_definitions.h" 20 | 21 | class Residual 22 | { 23 | public: 24 | explicit Residual(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 25 | const DensityProfileCoefficients& density_profile_coefficients, const bool DirBC_Interior, 26 | const int num_omp_threads); 27 | virtual ~Residual() = default; 28 | 29 | virtual void computeResidual(Vector& result, const Vector& rhs, const Vector& x) const = 0; 30 | 31 | protected: 32 | /* ------------------- */ 33 | /* Constructor members */ 34 | const PolarGrid& grid_; 35 | const LevelCache& level_cache_; 36 | const DomainGeometry& domain_geometry_; 37 | const DensityProfileCoefficients& density_profile_coefficients_; 38 | const bool DirBC_Interior_; 39 | const int num_omp_threads_; 40 | }; 41 | -------------------------------------------------------------------------------- /include/Smoother/smoother.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LevelCache; 4 | class Level; 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../InputFunctions/boundaryConditions.h" 11 | #include "../InputFunctions/densityProfileCoefficients.h" 12 | #include "../InputFunctions/domainGeometry.h" 13 | #include "../InputFunctions/sourceTerm.h" 14 | #include "../Level/level.h" 15 | #include "../LinearAlgebra/coo_matrix.h" 16 | #include "../LinearAlgebra/csr_matrix.h" 17 | #include "../LinearAlgebra/sparseLUSolver.h" 18 | #include "../LinearAlgebra/symmetricTridiagonalSolver.h" 19 | #include "../LinearAlgebra/vector.h" 20 | #include "../LinearAlgebra/vector_operations.h" 21 | #include "../PolarGrid/polargrid.h" 22 | #include "../Stencil/stencil.h" 23 | #include "../common/global_definitions.h" 24 | 25 | class Smoother 26 | { 27 | public: 28 | explicit Smoother(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 29 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 30 | int num_omp_threads); 31 | virtual ~Smoother() = default; 32 | 33 | virtual void smoothing(Vector& x, const Vector& rhs, Vector& temp) = 0; 34 | 35 | protected: 36 | const PolarGrid& grid_; 37 | const LevelCache& level_cache_; 38 | const DomainGeometry& domain_geometry_; 39 | const DensityProfileCoefficients& density_profile_coefficients_; 40 | const bool DirBC_Interior_; 41 | const int num_omp_threads_; 42 | }; 43 | -------------------------------------------------------------------------------- /include/Stencil/stencil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class StencilPosition 7 | { 8 | TopLeft, 9 | Top, 10 | TopRight, 11 | Left, 12 | Center, 13 | Right, 14 | BottomLeft, 15 | Bottom, 16 | BottomRight, 17 | }; 18 | 19 | /** 20 | * @brief Represents a stencil pattern used in sparse matrix construction 21 | * (see p. 44 table 4 of Julian Litz Master Thesis) 22 | * 23 | * The Stencil class helps define neighborhood structure of a grid node. 24 | * It maps each `StencilPosition` to an integer index that represents its 25 | * inclusion in the stencil pattern. 26 | * 27 | * Non-zero indices are obtained via `ptr + offset`, where: 28 | * - The Stencil class stores the offset for each position. 29 | * - A value of `-1` means the position is not included in the stencil pattern. 30 | * - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. 31 | */ 32 | class Stencil 33 | { 34 | public: 35 | Stencil(std::initializer_list init); 36 | int operator[](StencilPosition type) const; 37 | 38 | private: 39 | std::array values_; 40 | int stencil_size_; 41 | }; 42 | -------------------------------------------------------------------------------- /include/common/equals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | template 8 | inline std::enable_if_t, bool> equals(T lhs, T rhs) 9 | { 10 | return std::abs(lhs - rhs) <= 11 | (1e3 * std::numeric_limits::epsilon()) * std::max(1.0, std::max(std::abs(lhs), std::abs(rhs))); 12 | } -------------------------------------------------------------------------------- /include/common/geometry_helper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "../InputFunctions/domainGeometry.h" 5 | 6 | #include 7 | 8 | inline void compute_jacobian_elements(const DomainGeometry& domain_geometry, const double& r, const double& theta, 9 | const double& sin_theta, const double& cos_theta, const double& coeff_alpha, 10 | double& arr, double& att, double& art, double& detDF) 11 | { 12 | /* Calculate the elements of the Jacobian matrix for the transformation mapping */ 13 | /* The Jacobian matrix is: */ 14 | /* [Jrr, Jrt] */ 15 | /* [Jtr, Jtt] */ 16 | const double Jrr = domain_geometry.dFx_dr(r, theta, sin_theta, cos_theta); 17 | const double Jtr = domain_geometry.dFy_dr(r, theta, sin_theta, cos_theta); 18 | const double Jrt = domain_geometry.dFx_dt(r, theta, sin_theta, cos_theta); 19 | const double Jtt = domain_geometry.dFy_dt(r, theta, sin_theta, cos_theta); 20 | /* Compute the determinant of the Jacobian matrix */ 21 | detDF = Jrr * Jtt - Jrt * Jtr; 22 | /* Compute the elements of the symmetric matrix: */ 23 | /* 0.5 * alpha * DF^{-1} * DF^{-T} * |det(DF)| */ 24 | /* which is represented by: */ 25 | /* [arr, 0.5*art] */ 26 | /* [0.5*atr, att] */ 27 | arr = 0.5 * (Jtt * Jtt + Jrt * Jrt) * coeff_alpha / fabs(detDF); 28 | att = 0.5 * (Jtr * Jtr + Jrr * Jrr) * coeff_alpha / fabs(detDF); 29 | art = (-Jtt * Jtr - Jrt * Jrr) * coeff_alpha / fabs(detDF); 30 | /* Note that the inverse Jacobian matrix DF^{-1} is: */ 31 | /* 1.0 / det(DF) * */ 32 | /* [Jtt, -Jrt] */ 33 | /* [-Jtr, Jrr] */ 34 | } 35 | -------------------------------------------------------------------------------- /include/common/space_dimension.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | constexpr inline int space_dimension = 2; -------------------------------------------------------------------------------- /scripts/comparison/README.txt: -------------------------------------------------------------------------------- 1 | Here we compare the results from GMGPolar Version 1.0 to the refactored codebase. 2 | The GMGPolar_1.0 folder and GMGPolar_2.0 folder should be in the same directory. 3 | Pleas adjust the paths in GMGPolar_1.0 and compile the code. 4 | -------------------------------------------------------------------------------- /scripts/comparison/run_gmgpolar_1.0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | maxOpenMPThreads=32 4 | 5 | R0=1e-8 6 | Rmax=1.3 7 | nr_exp=4 8 | ntheta_exp=5 9 | anisotropic_factor=0 10 | divideBy2=3 11 | 12 | DirBC_Interior=0 # Across-origin(0), u_D_Interior(1) 13 | 14 | # Test Cases # 15 | geometry=2 # Circular (0), Shafranov(1), Czarny(2), Culham (3) 16 | kappa_eps=0.3 # Shafranov: 0.3, Czarny = 0.3, else unused 17 | delta_e=1.4 # Shafranov: 0.2, Czarny = 1.4, else unused 18 | problem=6 # CartesianR2(5), CartesianR6(7), PolarR6(6), RefinedRadius(4) 19 | alpha_coeff=0 # Poisson(3), Sonnendrucker(0), Zoni(1), Zoni-Shifted(2) 20 | beta_coeff=1 # Zero(0), Gyro - Alpha Inverse(1) 21 | 22 | extrapolation=1 23 | maxLevels=3 24 | preSmoothingSteps=1 25 | postSmoothingSteps=1 26 | multigridCycle=0 27 | 28 | maxIterations=150 29 | residualNormType=2 # convergence_criterium: scaled L2 (0), scaled inf (1), L2 (2), inf (3) 30 | absoluteTolerance=1e-12 31 | relativeTolerance=1e-12 32 | 33 | ./../../../GMGPolar_1.0/build/gmgpolar_simulation --verbose 2 --optimized 1 --matrix_free 1 --debug 0 --compute_rho 1 --check_error 1 --write_radii_angles 0 --nr_exp $nr_exp --ntheta_exp $ntheta_exp --fac_ani $anisotropic_factor --level $maxLevels --maxiter $maxIterations --v1 $preSmoothingSteps --v2 $postSmoothingSteps --cycle $multigridCycle --mod_pk $geometry --extrapolation $extrapolation --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 --prob $problem --alpha_coeff $alpha_coeff --beta_coeff $beta_coeff --openmp $maxOpenMPThreads --res_norm $residualNormType --R0 $R0 --R $Rmax --kappa_eps $kappa_eps --delta_e $delta_e --tol_bound_check $absoluteTolerance --rel_red_conv $relativeTolerance 34 | -------------------------------------------------------------------------------- /scripts/ctest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Navigate to the build directory 4 | cd ../build || { echo "Build folder not found!"; exit 1; } 5 | 6 | # Run ctest in verbose mode 7 | ctest --verbose -------------------------------------------------------------------------------- /scripts/memory_usage/memory_usage.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | ### Evaluates the maximum memory usage from a given Valgrind output file. ### 4 | ### Warning: Valgrind does not support mumps! ### 5 | 6 | # Define the filename 7 | filename = 'massif.out.328959' 8 | 9 | # Initialize variables to store maximum memory usage 10 | max_memory_usage_MB = 0 11 | 12 | # Use regular expressions to find all occurrences of memory usage 13 | heap_pattern = re.compile(r'mem_heap_B=(\d+)') 14 | extra_pattern = re.compile(r'mem_heap_extra_B=(\d+)') 15 | 16 | try: 17 | with open(filename, 'r') as file: 18 | data = file.read() 19 | 20 | # Find all matches in the data 21 | heap_matches = heap_pattern.findall(data) 22 | extra_matches = extra_pattern.findall(data) 23 | 24 | # Calculate the maximum memory usage in megabytes 25 | for heap, extra in zip(heap_matches, extra_matches): 26 | heap_B = int(heap) 27 | extra_B = int(extra) 28 | total_memory_B = heap_B + extra_B 29 | total_memory_MB = total_memory_B / (1024 * 1024) # Convert bytes to megabytes 30 | if total_memory_MB > max_memory_usage_MB: 31 | max_memory_usage_MB = total_memory_MB 32 | 33 | # Print the maximum memory usage 34 | print(f"Maximum memory usage: {max_memory_usage_MB:.2f} MB") 35 | 36 | except FileNotFoundError: 37 | print(f"Error: The file '{filename}' does not exist.") 38 | except Exception as e: 39 | print(f"An error occurred: {e}") 40 | -------------------------------------------------------------------------------- /scripts/old_scripts/README.txt: -------------------------------------------------------------------------------- 1 | This folder contains scripts from GMGPolar Version 1.0 development. 2 | These scripts are no longer supported. -------------------------------------------------------------------------------- /scripts/old_scripts/batch_deprecated/batch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #fixed variables 4 | debug=0 # D 5 | v1=1 # v1 6 | v2=1 # v2 7 | cycle=1 # c 8 | compute_rho=0 # compute_rho 9 | level=-1 # l 10 | plotit=0 # P 11 | solveit=1 # S 12 | maxiter=150 # maxiter 13 | periodic=1 # periodic 14 | origin_NOT_coarse=0 # origin_NOT_coarse 15 | theta_aniso=0 # theta_aniso 16 | paraview=0 # paraview 17 | prob=5 # prob 18 | R=1.3 # R 19 | kappa_eps=0 # k 20 | delta_e=0 # d 21 | discr=3 # discr 22 | fac_ani=3 # a 23 | nr_exp=4 # n 24 | ntheta_exp=4 # ntheta_exp 25 | 26 | 27 | #changing variables 28 | mod_pk=0 # mod_pk (0/1) 29 | R0=0.1 # r (1e-8/1e-5/1e-2) 30 | DirBC_Interior=0 # DirBC_Interior (0/1) 31 | divideBy2=0 # divideBy2 (3/4/5/6) 32 | smoother=3 # smoother (3,13) 33 | extrapolation=0 # E 34 | 35 | 36 | 37 | #overwrite existing file with an empty file 38 | break > output.txt 39 | 40 | 41 | 42 | for extrapol in 0 1 43 | do 44 | 45 | for smoother in 3 13 #iterate over old/new version of smoothing 46 | do 47 | 48 | for R0 in 1e-5 1e-2 1e-1 #iterate over inner radius 49 | do 50 | 51 | for mod_pk in 0 1 #iterate over geometry 52 | do 53 | 54 | for DirBC_Interior in 1 0 #iterate over treatment of origin (across-the-origin/ Diriclet BC) 55 | do 56 | 57 | for divideBy2 in 0 1 2 3 #iterate over the different grid sizes 58 | do 59 | 60 | #call the multigrid algorithm, and append the output to a file 61 | ./build/main -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother -E $extrapol >> output.txt 62 | 63 | done 64 | done 65 | done 66 | done 67 | done 68 | done 69 | 70 | -------------------------------------------------------------------------------- /scripts/old_scripts/batch_deprecated/batch_omp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #fixed variables 4 | debug=0 # D 5 | v1=1 # v1 6 | v2=1 # v2 7 | cycle=1 # c 8 | compute_rho=0 # compute_rho 9 | level=-1 # l 10 | plotit=0 # P 11 | solveit=1 # S 12 | maxiter=150 # maxiter 13 | periodic=1 # periodic 14 | origin_NOT_coarse=0 # origin_NOT_coarse 15 | theta_aniso=0 # theta_aniso 16 | paraview=0 # paraview 17 | prob=5 # prob 18 | R=1.3 # R 19 | kappa_eps=0 # k 20 | delta_e=0 # d 21 | discr=3 # discr 22 | fac_ani=3 # a 23 | nr_exp=4 # n 24 | ntheta_exp=4 # ntheta_exp 25 | 26 | 27 | #changing variables 28 | mod_pk=0 # mod_pk (0/1) 29 | R0=1e-5 # r (1e-8/1e-5/1e-2) 30 | DirBC_Interior=0 # DirBC_Interior (0/1) 31 | divideBy2=0 # divideBy2 (3/4/5/6) 32 | smoother=3 # smoother (3,13) 33 | extrapol=0 # E 34 | 35 | verb=0 36 | 37 | 38 | 39 | #overwrite existing file with an empty file 40 | break > output_omp.txt 41 | 42 | 43 | 44 | 45 | for mod_pk in 1 #iterate over geometry 46 | do 47 | 48 | for DirBC_Interior in 1 #iterate over treatment of origin (across-the-origin/ Diriclet BC) 49 | do 50 | 51 | for divideBy2 in 3 #iterate over the different grid sizes 52 | do 53 | 54 | for omp in 1 2 4 55 | do 56 | 57 | for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #just do it several times to get an average value 58 | do 59 | 60 | #call the multigrid algorithm, and append the output to a file 61 | ./build/main -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother -E $extrapol --openmp $omp --verbose $verb >> output_omp.txt 62 | 63 | done 64 | done 65 | done 66 | done 67 | done 68 | 69 | -------------------------------------------------------------------------------- /scripts/old_scripts/batch_deprecated/batch_write_radii_angles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #fixed variables 4 | debug=0 5 | v1=1 6 | v2=1 7 | cycle=1 8 | compute_rho=0 9 | level=-1 10 | plotit=0 11 | solveit=1 12 | maxiter=300 13 | periodic=1 14 | origin_NOT_coarse=0 15 | theta_aniso=0 16 | paraview=0 17 | discr=1 18 | nr_exp=4 19 | ntheta_exp=4 20 | res_norm=3 21 | R0=1e-5 22 | DirBC_Interior=1 23 | smoother=3 24 | rel_red_conv=1e-11 25 | write_radii_angles=1 26 | 27 | # Problem 28 | prob=7 29 | alpha_coeff=2 # Zoni shifted 30 | beta_coeff=1 31 | 32 | # geometry/grid 33 | R=1.0 34 | fac_ani=1 35 | mod_pk=0 36 | kappa_eps=0.3 37 | delta_e=0.2 38 | divideBy2=0 39 | 40 | # MG 41 | openmp=4 42 | extrapolation=1 43 | 44 | #f_grid_r="radii_files/aniso3/divide0.txt" 45 | #f_grid_theta="angles_files/aniso3/divide0.txt" 46 | f_grid_r="" 47 | f_grid_theta="" 48 | 49 | build_dir=build_gnu 50 | 51 | #overwrite existing file with an empty file 52 | break > output.txt 53 | 54 | ################################################# 55 | ## TABLE 1-2: TEST CASES 56 | ################################################# 57 | mkdir -p outputs 58 | 59 | for R in 1.0 1.3 60 | do 61 | for fac_ani in 0 1 3 62 | do 63 | for divideBy2 in 0 1 2 3 4 5 6 7 8 64 | do 65 | ./build/main -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother --verbose 0 --debug $debug --extrapolation $extrapolation --maxiter 150 --optimized 1 --openmp $openmp --v1 $v1 --v2 $v2 -R $R --prob $prob --maxiter $maxiter --alpha_coeff $alpha_coeff --beta_coeff $beta_coeff --res_norm $res_norm --write_radii_angles $write_radii_angles --f_grid_r "radii_files/Rmax"$R"/aniso"$fac_ani"/divide"$divideBy2".txt" --f_grid_theta "angles_files/Rmax"$R"/aniso"$fac_ani"/divide"$divideBy2".txt" 66 | done 67 | done 68 | done 69 | -------------------------------------------------------------------------------- /scripts/old_scripts/batch_deprecated/test_culham.sh: -------------------------------------------------------------------------------- 1 | # Deprecated script. 2 | 3 | # Original Output: 4 | # terminate called after throwing an instance of 'std::runtime_error' 5 | # what(): Wrong choice for the geometry 6 | 7 | if [ -z $1 ] || [ -z $2 ] 8 | then 9 | echo "Please provide cell sizes for test" 10 | else 11 | if [ $(($1 % 2)) -eq 1 ] 12 | then 13 | echo "There must be an even number of cells (r direction)" 14 | else 15 | if [ $(($2 % 2)) -eq 1 ] 16 | then 17 | echo "There must be an even number of cells (theta direction)" 18 | else 19 | 20 | mkdir -p culham 21 | 22 | cd culham 23 | 24 | python3 ../../python/make_points_r.py $1 r.txt --R0 1e-3 --R 1.0 25 | python3 ../../python/make_points_theta.py $2 theta.txt 26 | 27 | build_dir=build_gnu 28 | 29 | # Refactoring changes: 30 | # ../${build_dir}/main -n 4 -a 0 --mod_pk 3 --DirBC_Interior 1 --divideBy2 0 -r 1e-5 --smoother 3 --verbose 2 --debug 0 --extrapolation 0 --optimized 1 --openmp 4 --v1 1 --v2 1 -R 1 --prob 7 --maxiter 300 --alpha_coeff 2 --beta_coeff 1 --res_norm 3 --f_grid_r "r.txt" --f_grid_theta "theta.txt" --rel_red_conv 1e-9 --f_sol_out out.txt 31 | ../${build_dir}/gmgpolar --nr_exp 4 --anisotropic_factor 0 --geometry 3 --DirBC_Interior 1 --divideBy2 0 --R0 1e-5 --verbose 2 --extrapolation 0 --openmp 4 --preSmoothingSteps 1 --postSmoothingSteps 1 --Rmax 1.0 --problem 1 --maxIterations 300 --alpha_coeff 3 --alpha_jump 0.7081 --beta_coeff 1 --residualNormType 2 --write_grid_file $write_grid_file --load_grid_file 1 --file_grid_radii "r.txt" --file_grid_angles "theta.txt" 32 | 33 | python3 ../../python/plot_culham.py 34 | 35 | fi 36 | fi 37 | fi 38 | -------------------------------------------------------------------------------- /scripts/old_scripts/python/make_points_r.py: -------------------------------------------------------------------------------- 1 | from argparse import ArgumentParser 2 | import numpy as np 3 | 4 | parser = ArgumentParser(description='Tool for generating points') 5 | parser.add_argument('Nc', type=int, help='Number of cells (must be a multiple of 2)') 6 | parser.add_argument('outfile', type=str, help='File where points should be printed') 7 | parser.add_argument('--R0', type=float, default=1e-5, help='Minimum radius') 8 | parser.add_argument('--R', type=float, default=1.0, help='Maximum radius') 9 | args = parser.parse_args() 10 | 11 | 12 | R0 = args.R0 13 | R = args.R 14 | outfile = args.outfile 15 | N = args.Nc 16 | 17 | pts = np.linspace(R0, R, N+1) 18 | 19 | with open(outfile,'w') as f: 20 | for p in pts: 21 | print(p, file=f) 22 | -------------------------------------------------------------------------------- /scripts/old_scripts/python/make_points_theta.py: -------------------------------------------------------------------------------- 1 | from argparse import ArgumentParser 2 | import numpy as np 3 | 4 | parser = ArgumentParser(description='Tool for generating points') 5 | parser.add_argument('Nc', type=int, help='Number of cells (must be a multiple of 2)') 6 | parser.add_argument('outfile', type=str, help='File where points should be printed') 7 | args = parser.parse_args() 8 | 9 | 10 | outfile = args.outfile 11 | N = args.Nc 12 | 13 | pts = np.linspace(0.0, 2*np.pi, N, endpoint=False) 14 | 15 | with open(outfile,'w') as f: 16 | for p in pts: 17 | print(p, file=f) 18 | 19 | -------------------------------------------------------------------------------- /scripts/old_scripts/python/plot_culham.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | r, q, x, y, phi = np.loadtxt('out.txt', unpack=True) 5 | with open('out.txt') as fl: 6 | comment = fl.readline() 7 | words = comment.split() 8 | nr = int(words[3]) 9 | ntheta = int(words[6]) 10 | x = x.reshape(nr,ntheta) 11 | y = y.reshape(nr,ntheta) 12 | phi = phi.reshape(nr,ntheta) 13 | 14 | x = np.concatenate((x, x[:, 0, np.newaxis]), axis=1) 15 | y = np.concatenate((y, y[:, 0, np.newaxis]), axis=1) 16 | phi = np.concatenate((phi, phi[:, 0, np.newaxis]), axis=1) 17 | 18 | fig, ax = plt.subplots(1,1) 19 | clevels = np.linspace( phi.min(), phi.max(), 101) 20 | im = ax.contourf( x, y, phi, clevels, cmap='seismic' ) 21 | for c in im.collections: 22 | c.set_edgecolor('face') 23 | plt.colorbar( im ) 24 | 25 | n1 = nr//8 26 | ax.plot( x[:,::n1], y[:,::n1], '-', color='lightgrey', lw=0.5 ) 27 | ax.plot( x[:,nr-1], y[:,nr-1], '-', color='lightgrey', lw=0.5 ) 28 | ax.plot( x.transpose()[:,::n1], y.transpose()[:,::n1], '-', color='lightgrey', lw=0.5 ) 29 | # style 30 | ax.set_xlabel( r'$x$' ) 31 | ax.set_ylabel( r'$y$' ) 32 | #ax.set_title( r'Numerical solution: $\phi(x1,x2)$' ) 33 | ax.set_aspect( 'equal' ) 34 | fig.tight_layout() 35 | 36 | plt.show() 37 | 38 | -------------------------------------------------------------------------------- /scripts/roofline_model/peak_performance.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=RoofLine 3 | #SBATCH --output=slurm-%A-Roofline-Model.out 4 | #SBATCH --error=slurm-%A-Roofline-Model.err 5 | #SBATCH -N 1 6 | #SBATCH -n 1 7 | #SBATCH -c 56 8 | #SBATCH --threads-per-core=1 9 | #SBATCH --nodelist="be-cpu03" 10 | #SBATCH -t 1440 11 | #SBATCH --exclusive 12 | 13 | srun likwid-topology 14 | 15 | # CPU name: Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz 16 | # CPU type: Intel Skylake SP processor 17 | # CPU stepping: 4 18 | # Sockets: 4 19 | # Cores per socket: 14 20 | # Threads per core: 1 21 | # Level 1: 32 kB 22 | # Level 2: 1 MB 23 | # Level 3: 19 MB 24 | # NUMA domains: 4 25 | 26 | # So we have 4 x 14 hardware threads on this machine. 27 | # We use a stream size of 4 x 14 x 32 kB = 1792 kB, 28 | # 32kB for each of the 56 hardware threads so that each vector chunk fits into the L1 cache of one core. 29 | 30 | # Upper Peak GFLOPS Estimate: 2.6 GHz x 32 FLOPS/cycle x 56 cores = 4659.2 GFLOPS 31 | srun likwid-bench -t peakflops_avx -W N:1792kB:56 # GFlops/s: 1256.6 32 | # Remark: peakflops_avx512 is not available 33 | 34 | # Bandwidth according to cluster documentation: GByte/s: 281.0 35 | srun likwid-bench -t load_avx512 -W N:2GB:56 # GByte/s: 355.6 36 | -------------------------------------------------------------------------------- /scripts/scalability/strong_scaling/start_strong_scaling_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=gmgpolar 3 | #SBATCH --output=../../slurm_output/slurm-%A-Strong-Scaling-Benchmark.out 4 | #SBATCH --error=../../slurm_output/slurm-%A-Strong-Scaling-Benchmark.err 5 | #SBATCH -N 1 6 | #SBATCH -n 1 7 | #SBATCH -c 56 8 | #SBATCH --threads-per-core=1 9 | #SBATCH -t 1400 10 | # #SBATCH --nodelist="be-cpu02" 11 | #SBATCH --exclusive 12 | 13 | # Adjust parameters in src/strong_scaling.cpp 14 | 15 | srun --cpus-per-task=56 ./../../../build/strong_scaling 16 | -------------------------------------------------------------------------------- /scripts/scalability/weak_scaling/start_weak_scaling_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --job-name=gmgpolar 3 | #SBATCH --output=../../slurm_output/slurm-%A-Weak-Scaling-Benchmark.out 4 | #SBATCH --error=../../slurm_output/slurm-%A-Weak-Scaling-Benchmark.err 5 | #SBATCH -N 1 6 | #SBATCH -n 1 7 | #SBATCH -c 56 8 | #SBATCH --threads-per-core=1 9 | #SBATCH -t 1400 10 | # #SBATCH --nodelist="be-cpu02" 11 | #SBATCH --exclusive 12 | 13 | # Adjust parameters in src/weak_scaling.cpp 14 | 15 | srun --cpus-per-task=56 ./../../../build/weak_scaling 16 | -------------------------------------------------------------------------------- /scripts/tutorial/convergence_order.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adjust parameters in src/convergence_order.cpp 4 | 5 | ./../../build/convergence_order -------------------------------------------------------------------------------- /scripts/tutorial/help.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./../../build/gmgpolar --help -------------------------------------------------------------------------------- /src/DirectSolver/DirectSolverGive/directSolverGive.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/DirectSolver/DirectSolverGive/directSolverGive.h" 2 | 3 | #ifdef GMGPOLAR_USE_MUMPS 4 | 5 | DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCache& level_cache, 6 | const DomainGeometry& domain_geometry, 7 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 8 | int num_omp_threads) 9 | : DirectSolver(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 10 | { 11 | solver_matrix_ = buildSolverMatrix(); 12 | initializeMumpsSolver(mumps_solver_, solver_matrix_); 13 | } 14 | 15 | void DirectSolverGive::solveInPlace(Vector& solution) 16 | { 17 | // Adjusts the right-hand side vector to account for symmetry corrections. 18 | // This transforms the system matrixA * solution = rhs into the equivalent system: 19 | // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). 20 | // The correction modifies the rhs to account for the influence of the Dirichlet boundary conditions, 21 | // ensuring that the solution at the boundary is correctly adjusted and maintains the required symmetry. 22 | applySymmetryShift(solution); 23 | // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. 24 | solveWithMumps(solution); 25 | } 26 | 27 | DirectSolverGive::~DirectSolverGive() 28 | { 29 | finalizeMumpsSolver(mumps_solver_); 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/DirectSolver/DirectSolverGiveCustomLU/directSolverGive.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/DirectSolver/DirectSolverGiveCustomLU/directSolverGiveCustomLU.h" 2 | 3 | DirectSolverGiveCustomLU::DirectSolverGiveCustomLU(const PolarGrid& grid, const LevelCache& level_cache, 4 | const DomainGeometry& domain_geometry, 5 | const DensityProfileCoefficients& density_profile_coefficients, 6 | bool DirBC_Interior, int num_omp_threads) 7 | : DirectSolver(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 8 | { 9 | solver_matrix_ = buildSolverMatrix(); 10 | lu_solver_ = SparseLUSolver(solver_matrix_); 11 | } 12 | 13 | void DirectSolverGiveCustomLU::solveInPlace(Vector& solution) 14 | { 15 | lu_solver_.solveInPlace(solution); 16 | } 17 | 18 | DirectSolverGiveCustomLU::~DirectSolverGiveCustomLU() 19 | { 20 | } -------------------------------------------------------------------------------- /src/DirectSolver/DirectSolverTake/directSolverTake.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/DirectSolver/DirectSolverTake/directSolverTake.h" 2 | 3 | #ifdef GMGPOLAR_USE_MUMPS 4 | 5 | DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCache& level_cache, 6 | const DomainGeometry& domain_geometry, 7 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 8 | int num_omp_threads) 9 | : DirectSolver(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 10 | { 11 | solver_matrix_ = buildSolverMatrix(); 12 | initializeMumpsSolver(mumps_solver_, solver_matrix_); 13 | } 14 | 15 | void DirectSolverTake::solveInPlace(Vector& solution) 16 | { 17 | // Adjusts the right-hand side vector to account for symmetry corrections. 18 | // This transforms the system matrixA * solution = rhs into the equivalent system: 19 | // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). 20 | // The correction modifies the rhs to account for the influence of the Dirichlet boundary conditions, 21 | // ensuring that the solution at the boundary is correctly adjusted and maintains the required symmetry. 22 | applySymmetryShift(solution); 23 | // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. 24 | solveWithMumps(solution); 25 | } 26 | 27 | DirectSolverTake::~DirectSolverTake() 28 | { 29 | finalizeMumpsSolver(mumps_solver_); 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/DirectSolver/DirectSolverTakeCustomLU/directSolverTake.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/DirectSolver/DirectSolverTakeCustomLU/directSolverTakeCustomLU.h" 2 | 3 | DirectSolverTakeCustomLU::DirectSolverTakeCustomLU(const PolarGrid& grid, const LevelCache& level_cache, 4 | const DomainGeometry& domain_geometry, 5 | const DensityProfileCoefficients& density_profile_coefficients, 6 | bool DirBC_Interior, int num_omp_threads) 7 | : DirectSolver(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 8 | { 9 | solver_matrix_ = buildSolverMatrix(); 10 | lu_solver_ = SparseLUSolver(solver_matrix_); 11 | } 12 | 13 | void DirectSolverTakeCustomLU::solveInPlace(Vector& solution) 14 | { 15 | lu_solver_.solveInPlace(solution); 16 | } 17 | 18 | DirectSolverTakeCustomLU::~DirectSolverTakeCustomLU() 19 | { 20 | } -------------------------------------------------------------------------------- /src/DirectSolver/directSolver.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/DirectSolver/directSolver.h" 2 | 3 | DirectSolver::DirectSolver(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : grid_(grid) 7 | , level_cache_(level_cache) 8 | , domain_geometry_(domain_geometry) 9 | , density_profile_coefficients_(density_profile_coefficients) 10 | , DirBC_Interior_(DirBC_Interior) 11 | , num_omp_threads_(num_omp_threads) 12 | { 13 | } -------------------------------------------------------------------------------- /src/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h" 2 | 3 | ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCache& level_cache, 4 | const DomainGeometry& domain_geometry, 5 | const DensityProfileCoefficients& density_profile_coefficients, 6 | const bool DirBC_Interior, const int num_omp_threads) 7 | : ExtrapolatedSmoother(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, 8 | num_omp_threads) 9 | { 10 | buildAscMatrices(); 11 | #ifdef GMGPOLAR_USE_MUMPS 12 | initializeMumpsSolver(inner_boundary_mumps_solver_, inner_boundary_circle_matrix_); 13 | #else 14 | inner_boundary_lu_solver_ = SparseLUSolver(inner_boundary_circle_matrix_); 15 | #endif 16 | } 17 | 18 | ExtrapolatedSmootherGive::~ExtrapolatedSmootherGive() 19 | { 20 | #ifdef GMGPOLAR_USE_MUMPS 21 | finalizeMumpsSolver(inner_boundary_mumps_solver_); 22 | #endif 23 | } 24 | 25 | void ExtrapolatedSmootherGive::extrapolatedSmoothing(Vector& x, const Vector& rhs, Vector& temp) 26 | { 27 | extrapolatedSmoothingForLoop(x, rhs, temp); /* This is the fastest option */ 28 | // extrapolatedSmoothingTaskLoop(x, rhs, temp); 29 | // extrapolatedSmoothingTaskDependencies(x, rhs, temp); 30 | } -------------------------------------------------------------------------------- /src/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h" 2 | 3 | ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCache& level_cache, 4 | const DomainGeometry& domain_geometry, 5 | const DensityProfileCoefficients& density_profile_coefficients, 6 | const bool DirBC_Interior, const int num_omp_threads) 7 | : ExtrapolatedSmoother(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, 8 | num_omp_threads) 9 | { 10 | buildAscMatrices(); 11 | #ifdef GMGPOLAR_USE_MUMPS 12 | initializeMumpsSolver(inner_boundary_mumps_solver_, inner_boundary_circle_matrix_); 13 | #else 14 | inner_boundary_lu_solver_ = SparseLUSolver(inner_boundary_circle_matrix_); 15 | #endif 16 | } 17 | 18 | ExtrapolatedSmootherTake::~ExtrapolatedSmootherTake() 19 | { 20 | #ifdef GMGPOLAR_USE_MUMPS 21 | finalizeMumpsSolver(inner_boundary_mumps_solver_); 22 | #endif 23 | } 24 | -------------------------------------------------------------------------------- /src/ExtrapolatedSmoother/extrapolatedSmoother.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/ExtrapolatedSmoother/extrapolatedSmoother.h" 2 | 3 | ExtrapolatedSmoother::ExtrapolatedSmoother(const PolarGrid& grid, const LevelCache& level_cache, 4 | const DomainGeometry& domain_geometry, 5 | const DensityProfileCoefficients& density_profile_coefficients, 6 | const bool DirBC_Interior, const int num_omp_threads) 7 | : grid_(grid) 8 | , level_cache_(level_cache) 9 | , domain_geometry_(domain_geometry) 10 | , density_profile_coefficients_(density_profile_coefficients) 11 | , DirBC_Interior_(DirBC_Interior) 12 | , num_omp_threads_(num_omp_threads) 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BOUNDARY_CONDITIONS_SOURCES 2 | cartesianR2_Boundary_CircularGeometry.cpp 3 | cartesianR2_Boundary_CzarnyGeometry.cpp 4 | cartesianR2_Boundary_ShafranovGeometry.cpp 5 | cartesianR6_Boundary_CircularGeometry.cpp 6 | cartesianR6_Boundary_CzarnyGeometry.cpp 7 | cartesianR6_Boundary_ShafranovGeometry.cpp 8 | polarR6_Boundary_CircularGeometry.cpp 9 | polarR6_Boundary_CulhamGeometry.cpp 10 | polarR6_Boundary_CzarnyGeometry.cpp 11 | polarR6_Boundary_ShafranovGeometry.cpp 12 | refined_Boundary_CircularGeometry.cpp 13 | refined_Boundary_CulhamGeometry.cpp 14 | refined_Boundary_CzarnyGeometry.cpp 15 | refined_Boundary_ShafranovGeometry.cpp 16 | ) 17 | 18 | add_library(InputFunctions_BoundaryConditions STATIC ${BOUNDARY_CONDITIONS_SOURCES}) 19 | 20 | target_include_directories(InputFunctions_BoundaryConditions PUBLIC 21 | ${CMAKE_CURRENT_SOURCE_DIR} 22 | ${CMAKE_SOURCE_DIR}/include/InputFunctions/BoundaryConditions 23 | ) 24 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/cartesianR2_Boundary_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/cartesianR2_Boundary_CircularGeometry.h" 2 | 3 | CartesianR2_Boundary_CircularGeometry::CartesianR2_Boundary_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double CartesianR2_Boundary_CircularGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (1.0 - (r / Rmax) * (r / Rmax)) * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * 12 | cos(2.0 * M_PI * (r / Rmax) * cos_theta); 13 | } 14 | 15 | double CartesianR2_Boundary_CircularGeometry::u_D_Interior(const double& r, const double& theta, 16 | const double& sin_theta, const double& cos_theta) const 17 | { 18 | return (1.0 - (r / Rmax) * (r / Rmax)) * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * 19 | cos(2.0 * M_PI * (r / Rmax) * cos_theta); 20 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/cartesianR2_Boundary_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/cartesianR2_Boundary_ShafranovGeometry.h" 2 | 3 | CartesianR2_Boundary_ShafranovGeometry::CartesianR2_Boundary_ShafranovGeometry(const double& Rmax, 4 | const double& elongation_kappa, 5 | const double& shift_delta) 6 | : Rmax(Rmax) 7 | , elongation_kappa(elongation_kappa) 8 | , shift_delta(shift_delta) 9 | { 10 | } 11 | 12 | double CartesianR2_Boundary_ShafranovGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 13 | const double& cos_theta) const 14 | { 15 | return (1.0 - (r / Rmax) * (r / Rmax)) * 16 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 17 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 18 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 19 | } 20 | 21 | double CartesianR2_Boundary_ShafranovGeometry::u_D_Interior(const double& r, const double& theta, 22 | const double& sin_theta, const double& cos_theta) const 23 | { 24 | return (1.0 - (r / Rmax) * (r / Rmax)) * 25 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 26 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 27 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 28 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/cartesianR6_Boundary_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/cartesianR6_Boundary_CircularGeometry.h" 2 | 3 | CartesianR6_Boundary_CircularGeometry::CartesianR6_Boundary_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double CartesianR6_Boundary_CircularGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 12 | sin(2.0 * M_PI * (r / Rmax) * sin_theta) * cos(2.0 * M_PI * (r / Rmax) * cos_theta); 13 | } 14 | 15 | double CartesianR6_Boundary_CircularGeometry::u_D_Interior(const double& r, const double& theta, 16 | const double& sin_theta, const double& cos_theta) const 17 | { 18 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 19 | sin(2.0 * M_PI * (r / Rmax) * sin_theta) * cos(2.0 * M_PI * (r / Rmax) * cos_theta); 20 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/cartesianR6_Boundary_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/cartesianR6_Boundary_ShafranovGeometry.h" 2 | 3 | CartesianR6_Boundary_ShafranovGeometry::CartesianR6_Boundary_ShafranovGeometry(const double& Rmax, 4 | const double& elongation_kappa, 5 | const double& shift_delta) 6 | : Rmax(Rmax) 7 | , elongation_kappa(elongation_kappa) 8 | , shift_delta(shift_delta) 9 | { 10 | } 11 | 12 | double CartesianR6_Boundary_ShafranovGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 13 | const double& cos_theta) const 14 | { 15 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 16 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 17 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 18 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 19 | } 20 | 21 | double CartesianR6_Boundary_ShafranovGeometry::u_D_Interior(const double& r, const double& theta, 22 | const double& sin_theta, const double& cos_theta) const 23 | { 24 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 25 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 26 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 27 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 28 | } 29 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/polarR6_Boundary_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/polarR6_Boundary_CircularGeometry.h" 2 | 3 | PolarR6_Boundary_CircularGeometry::PolarR6_Boundary_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_Boundary_CircularGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 12 | } 13 | 14 | double PolarR6_Boundary_CircularGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const 16 | { 17 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 18 | } 19 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/polarR6_Boundary_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/polarR6_Boundary_CulhamGeometry.h" 2 | 3 | PolarR6_Boundary_CulhamGeometry::PolarR6_Boundary_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_Boundary_CulhamGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.0; 12 | } 13 | 14 | double PolarR6_Boundary_CulhamGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const 16 | { 17 | return 0.0; 18 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/polarR6_Boundary_CzarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/polarR6_Boundary_CzarnyGeometry.h" 2 | 3 | void PolarR6_Boundary_CzarnyGeometry::initializeGeometry() 4 | { 5 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 6 | } 7 | 8 | PolarR6_Boundary_CzarnyGeometry::PolarR6_Boundary_CzarnyGeometry(const double& Rmax, 9 | const double& inverse_aspect_ratio_epsilon, 10 | const double& ellipticity_e) 11 | : Rmax(Rmax) 12 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 13 | , ellipticity_e(ellipticity_e) 14 | { 15 | initializeGeometry(); 16 | } 17 | 18 | double PolarR6_Boundary_CzarnyGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 19 | const double& cos_theta) const 20 | { 21 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 22 | } 23 | 24 | double PolarR6_Boundary_CzarnyGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 25 | const double& cos_theta) const 26 | { 27 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 28 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/polarR6_Boundary_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/polarR6_Boundary_ShafranovGeometry.h" 2 | 3 | PolarR6_Boundary_ShafranovGeometry::PolarR6_Boundary_ShafranovGeometry(const double& Rmax, 4 | const double& elongation_kappa, 5 | const double& shift_delta) 6 | : Rmax(Rmax) 7 | , elongation_kappa(elongation_kappa) 8 | , shift_delta(shift_delta) 9 | { 10 | } 11 | 12 | double PolarR6_Boundary_ShafranovGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 13 | const double& cos_theta) const 14 | { 15 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 16 | } 17 | 18 | double PolarR6_Boundary_ShafranovGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 19 | const double& cos_theta) const 20 | { 21 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 22 | } -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/refined_Boundary_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/refined_Boundary_CircularGeometry.h" 2 | 3 | Refined_Boundary_CircularGeometry::Refined_Boundary_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double Refined_Boundary_CircularGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 12 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 13 | cos(21.0 * theta) + 14 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 15 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 16 | cos(9.0 * theta); 17 | } 18 | 19 | double Refined_Boundary_CircularGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 20 | const double& cos_theta) const 21 | { 22 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 23 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 24 | cos(21.0 * theta) + 25 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 26 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 27 | cos(9.0 * theta); 28 | } 29 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/refined_Boundary_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/refined_Boundary_CulhamGeometry.h" 2 | 3 | Refined_Boundary_CulhamGeometry::Refined_Boundary_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double Refined_Boundary_CulhamGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.0; 12 | } 13 | 14 | double Refined_Boundary_CulhamGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 15 | const double& cos_theta) const 16 | { 17 | return 0.0; 18 | } 19 | -------------------------------------------------------------------------------- /src/InputFunctions/BoundaryConditions/refined_Boundary_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/BoundaryConditions/refined_Boundary_ShafranovGeometry.h" 2 | 3 | Refined_Boundary_ShafranovGeometry::Refined_Boundary_ShafranovGeometry(const double& Rmax, 4 | const double& elongation_kappa, 5 | const double& shift_delta) 6 | : Rmax(Rmax) 7 | , elongation_kappa(elongation_kappa) 8 | , shift_delta(shift_delta) 9 | { 10 | } 11 | 12 | double Refined_Boundary_ShafranovGeometry::u_D(const double& r, const double& theta, const double& sin_theta, 13 | const double& cos_theta) const 14 | { 15 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 16 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 17 | cos(21.0 * theta) + 18 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 19 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 20 | cos(9.0 * theta); 21 | } 22 | 23 | double Refined_Boundary_ShafranovGeometry::u_D_Interior(const double& r, const double& theta, const double& sin_theta, 24 | const double& cos_theta) const 25 | { 26 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 27 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 28 | cos(21.0 * theta) + 29 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 30 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 31 | cos(9.0 * theta); 32 | } 33 | -------------------------------------------------------------------------------- /src/InputFunctions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(BoundaryConditions) 2 | add_subdirectory(DensityProfileCoefficients) 3 | add_subdirectory(DomainGeometry) 4 | add_subdirectory(ExactSolution) 5 | add_subdirectory(SourceTerms) 6 | 7 | add_library(InputFunctions INTERFACE) 8 | 9 | target_link_libraries(InputFunctions INTERFACE 10 | InputFunctions_BoundaryConditions 11 | InputFunctions_DensityProfileCoefficients 12 | InputFunctions_DomainGeometry 13 | InputFunctions_ExactSolution 14 | InputFunctions_SourceTerms 15 | ) 16 | 17 | target_include_directories(InputFunctions INTERFACE 18 | ${CMAKE_SOURCE_DIR}/include/InputFunctions 19 | ) -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(DENSITY_PROFILE_COEFFICIENTS_SOURCES 2 | poissonCoefficients.cpp 3 | sonnendruckerCoefficients.cpp 4 | sonnendruckerGyroCoefficients.cpp 5 | zoniCoefficients.cpp 6 | zoniGyroCoefficients.cpp 7 | zoniShiftedCoefficients.cpp 8 | zoniShiftedGyroCoefficients.cpp 9 | ) 10 | 11 | add_library(InputFunctions_DensityProfileCoefficients STATIC ${DENSITY_PROFILE_COEFFICIENTS_SOURCES}) 12 | target_include_directories(InputFunctions_DensityProfileCoefficients PUBLIC 13 | ${CMAKE_CURRENT_SOURCE_DIR} 14 | ${CMAKE_SOURCE_DIR}/include/InputFunctions/DensityProfileCoefficients 15 | ) -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/poissonCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/poissonCoefficients.h" 2 | 3 | PoissonCoefficients::PoissonCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double PoissonCoefficients::alpha(const double& r) const 10 | { 11 | return 1.0; 12 | } 13 | 14 | double PoissonCoefficients::beta(const double& r) const 15 | { 16 | return 0.0; 17 | } 18 | 19 | double PoissonCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/sonnendruckerCoefficients.h" 2 | 3 | SonnendruckerCoefficients::SonnendruckerCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double SonnendruckerCoefficients::alpha(const double& r) const 10 | { 11 | return 0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111); 12 | } 13 | 14 | double SonnendruckerCoefficients::beta(const double& r) const 15 | { 16 | return 0.0; 17 | } 18 | 19 | double SonnendruckerCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/sonnendruckerGyroCoefficients.h" 2 | 3 | SonnendruckerGyroCoefficients::SonnendruckerGyroCoefficients(const double& _Rmax, const double& _alpha_jump) 4 | : Rmax(_Rmax) 5 | , alpha_jump(_alpha_jump) 6 | { 7 | } 8 | 9 | double SonnendruckerGyroCoefficients::alpha(const double& r) const 10 | { 11 | return 0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111); 12 | } 13 | 14 | double SonnendruckerGyroCoefficients::beta(const double& r) const 15 | { 16 | return pow((0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111)), 17 | (double)((-1))); 18 | } 19 | 20 | double SonnendruckerGyroCoefficients::getAlphaJump() const 21 | { 22 | return alpha_jump; 23 | } 24 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/zoniCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/zoniCoefficients.h" 2 | 3 | ZoniCoefficients::ZoniCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double ZoniCoefficients::alpha(const double& r) const 10 | { 11 | return exp(-tanh(10.0 * (r / Rmax) - 5.0)); 12 | } 13 | 14 | double ZoniCoefficients::beta(const double& r) const 15 | { 16 | return 0.0; 17 | } 18 | 19 | double ZoniCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/zoniGyroCoefficients.h" 2 | 3 | ZoniGyroCoefficients::ZoniGyroCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double ZoniGyroCoefficients::alpha(const double& r) const 10 | { 11 | return exp(-tanh(10.0 * (r / Rmax) - 5.0)); 12 | } 13 | 14 | double ZoniGyroCoefficients::beta(const double& r) const 15 | { 16 | return exp(tanh(10.0 * (r / Rmax) - 5.0)); 17 | } 18 | 19 | double ZoniGyroCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/zoniShiftedCoefficients.h" 2 | #include 3 | ZoniShiftedCoefficients::ZoniShiftedCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double ZoniShiftedCoefficients::alpha(const double& r) const 10 | { 11 | return exp(-tanh(20.0 * (r / Rmax) - 14.0)); 12 | } 13 | 14 | double ZoniShiftedCoefficients::beta(const double& r) const 15 | { 16 | return 0.0; 17 | } 18 | 19 | double ZoniShiftedCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DensityProfileCoefficients/zoniShiftedGyroCoefficients.h" 2 | 3 | ZoniShiftedGyroCoefficients::ZoniShiftedGyroCoefficients(const double& Rmax, const double& alpha_jump) 4 | : Rmax(Rmax) 5 | , alpha_jump(alpha_jump) 6 | { 7 | } 8 | 9 | double ZoniShiftedGyroCoefficients::alpha(const double& r) const 10 | { 11 | return exp(-tanh(20.0 * (r / Rmax) - 14.0)); 12 | } 13 | 14 | double ZoniShiftedGyroCoefficients::beta(const double& r) const 15 | { 16 | return exp(tanh(20.0 * (r / Rmax) - 14.0)); 17 | } 18 | 19 | double ZoniShiftedGyroCoefficients::getAlphaJump() const 20 | { 21 | return alpha_jump; 22 | } 23 | -------------------------------------------------------------------------------- /src/InputFunctions/DomainGeometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(DOMAIN_GEOMETRY_SOURCES 2 | circularGeometry.cpp 3 | culhamGeometry.cpp 4 | czarnyGeometry.cpp 5 | shafranovGeometry.cpp 6 | ) 7 | 8 | add_library(InputFunctions_DomainGeometry STATIC ${DOMAIN_GEOMETRY_SOURCES}) 9 | target_include_directories(InputFunctions_DomainGeometry PUBLIC 10 | ${CMAKE_CURRENT_SOURCE_DIR} 11 | ${CMAKE_SOURCE_DIR}/include/InputFunctions/DomainGeometry 12 | ) -------------------------------------------------------------------------------- /src/InputFunctions/DomainGeometry/circularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DomainGeometry/circularGeometry.h" 2 | 3 | CircularGeometry::CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /src/InputFunctions/DomainGeometry/czarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DomainGeometry/czarnyGeometry.h" 2 | 3 | CzarnyGeometry::CzarnyGeometry() 4 | { 5 | initializeGeometry(); 6 | } 7 | 8 | CzarnyGeometry::CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 9 | const double& ellipticity_e) 10 | : Rmax(Rmax) 11 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 12 | , ellipticity_e(ellipticity_e) 13 | { 14 | initializeGeometry(); 15 | } 16 | 17 | void CzarnyGeometry::initializeGeometry() 18 | { 19 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 20 | } 21 | -------------------------------------------------------------------------------- /src/InputFunctions/DomainGeometry/shafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/DomainGeometry/shafranovGeometry.h" 2 | 3 | ShafranovGeometry::ShafranovGeometry(const double& Rmax, const double& elongation_kappa, const double& shift_delta) 4 | : Rmax(Rmax) 5 | , elongation_kappa(elongation_kappa) 6 | , shift_delta(shift_delta) 7 | { 8 | } -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(EXACT_SOLUTION_SOURCES 2 | cartesianR2_CircularGeometry.cpp 3 | cartesianR2_CzarnyGeometry.cpp 4 | cartesianR2_ShafranovGeometry.cpp 5 | cartesianR6_CircularGeometry.cpp 6 | cartesianR6_CzarnyGeometry.cpp 7 | cartesianR6_ShafranovGeometry.cpp 8 | polarR6_CircularGeometry.cpp 9 | polarR6_CulhamGeometry.cpp 10 | polarR6_CzarnyGeometry.cpp 11 | polarR6_ShafranovGeometry.cpp 12 | refined_CircularGeometry.cpp 13 | refined_CulhamGeometry.cpp 14 | refined_CzarnyGeometry.cpp 15 | refined_ShafranovGeometry.cpp 16 | ) 17 | 18 | add_library(InputFunctions_ExactSolution STATIC ${EXACT_SOLUTION_SOURCES}) 19 | target_include_directories(InputFunctions_ExactSolution PUBLIC 20 | ${CMAKE_CURRENT_SOURCE_DIR} 21 | ${CMAKE_SOURCE_DIR}/include/InputFunctions/ExactSolution 22 | ) -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR2_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR2_CircularGeometry.h" 2 | 3 | CartesianR2_CircularGeometry::CartesianR2_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double CartesianR2_CircularGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (1.0 - (r / Rmax) * (r / Rmax)) * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * 12 | cos(2.0 * M_PI * (r / Rmax) * cos_theta); 13 | } -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR2_CzarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR2_CzarnyGeometry.h" 2 | 3 | void CartesianR2_CzarnyGeometry::initializeGeometry() 4 | { 5 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 6 | } 7 | 8 | CartesianR2_CzarnyGeometry::CartesianR2_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 9 | const double& ellipticity_e) 10 | : Rmax(Rmax) 11 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 12 | , ellipticity_e(ellipticity_e) 13 | { 14 | initializeGeometry(); 15 | } 16 | 17 | double CartesianR2_CzarnyGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const 19 | { 20 | double temp = 21 | sqrt(inverse_aspect_ratio_epsilon * (2.0 * (r / Rmax) * cos_theta + inverse_aspect_ratio_epsilon) + 1.0); 22 | return (1.0 - (r / Rmax) * (r / Rmax)) * 23 | sin(2.0 * M_PI * ellipticity_e * (r / Rmax) * sin_theta * factor_xi / (2.0 - temp)) * 24 | cos(2.0 * M_PI * (1.0 - temp) / inverse_aspect_ratio_epsilon); 25 | } 26 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR2_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR2_ShafranovGeometry.h" 2 | 3 | CartesianR2_ShafranovGeometry::CartesianR2_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 4 | const double& shift_delta) 5 | : Rmax(Rmax) 6 | , elongation_kappa(elongation_kappa) 7 | , shift_delta(shift_delta) 8 | { 9 | } 10 | 11 | double CartesianR2_ShafranovGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 12 | const double& cos_theta) const 13 | { 14 | return (1.0 - (r / Rmax) * (r / Rmax)) * 15 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 16 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 17 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 18 | } -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR6_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR6_CircularGeometry.h" 2 | 3 | CartesianR6_CircularGeometry::CartesianR6_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double CartesianR6_CircularGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 12 | sin(2.0 * M_PI * (r / Rmax) * sin_theta) * cos(2.0 * M_PI * (r / Rmax) * cos_theta); 13 | } -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR6_CzarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR6_CzarnyGeometry.h" 2 | 3 | void CartesianR6_CzarnyGeometry::initializeGeometry() 4 | { 5 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 6 | } 7 | 8 | CartesianR6_CzarnyGeometry::CartesianR6_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 9 | const double& ellipticity_e) 10 | : Rmax(Rmax) 11 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 12 | , ellipticity_e(ellipticity_e) 13 | { 14 | initializeGeometry(); 15 | } 16 | 17 | double CartesianR6_CzarnyGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const 19 | { 20 | double temp = 21 | sqrt(inverse_aspect_ratio_epsilon * (2.0 * (r / Rmax) * cos_theta + inverse_aspect_ratio_epsilon) + 1.0); 22 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 23 | sin(2.0 * M_PI * ellipticity_e * (r / Rmax) * sin_theta * factor_xi / (2.0 - temp)) * 24 | cos(2.0 * M_PI * (1.0 - temp) / inverse_aspect_ratio_epsilon); 25 | } 26 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/cartesianR6_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/cartesianR6_ShafranovGeometry.h" 2 | 3 | CartesianR6_ShafranovGeometry::CartesianR6_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 4 | const double& shift_delta) 5 | : Rmax(Rmax) 6 | , elongation_kappa(elongation_kappa) 7 | , shift_delta(shift_delta) 8 | { 9 | } 10 | 11 | double CartesianR6_ShafranovGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 12 | const double& cos_theta) const 13 | { 14 | return 0.4096 * pow(((r / Rmax) - 1.0), 6.0) * pow(((r / Rmax) + 1.0), 6.0) * 15 | sin(M_PI * (2.0 * elongation_kappa * (r / Rmax) * sin_theta + 2.0 * (r / Rmax) * sin_theta)) * 16 | cos(M_PI * ((-2.0) * shift_delta * ((r / Rmax) * (r / Rmax)) - 17 | 2.0 * elongation_kappa * (r / Rmax) * cos_theta + 2.0 * (r / Rmax) * cos_theta)); 18 | } 19 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/polarR6_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/polarR6_CircularGeometry.h" 2 | 3 | PolarR6_CircularGeometry::PolarR6_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_CircularGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 12 | } 13 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/polarR6_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/polarR6_CulhamGeometry.h" 2 | 3 | PolarR6_CulhamGeometry::PolarR6_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_CulhamGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.0; 12 | } 13 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/polarR6_CzarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/polarR6_CzarnyGeometry.h" 2 | 3 | void PolarR6_CzarnyGeometry::initializeGeometry() 4 | { 5 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 6 | } 7 | 8 | PolarR6_CzarnyGeometry::PolarR6_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 9 | const double& ellipticity_e) 10 | : Rmax(Rmax) 11 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 12 | , ellipticity_e(ellipticity_e) 13 | { 14 | initializeGeometry(); 15 | } 16 | 17 | double PolarR6_CzarnyGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const 19 | { 20 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 21 | } 22 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/polarR6_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/polarR6_ShafranovGeometry.h" 2 | 3 | PolarR6_ShafranovGeometry::PolarR6_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 4 | const double& shift_delta) 5 | : Rmax(Rmax) 6 | , elongation_kappa(elongation_kappa) 7 | , shift_delta(shift_delta) 8 | { 9 | } 10 | 11 | double PolarR6_ShafranovGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 12 | const double& cos_theta) const 13 | { 14 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 15 | } -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/refined_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/refined_CircularGeometry.h" 2 | 3 | Refined_CircularGeometry::Refined_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double Refined_CircularGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 12 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 13 | cos(21.0 * theta) + 14 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 15 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 16 | cos(9.0 * theta); 17 | } 18 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/refined_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/refined_CulhamGeometry.h" 2 | 3 | Refined_CulhamGeometry::Refined_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double Refined_CulhamGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.0; 12 | } 13 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/refined_CzarnyGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/refined_CzarnyGeometry.h" 2 | 3 | void Refined_CzarnyGeometry::initializeGeometry() 4 | { 5 | factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); 6 | } 7 | 8 | Refined_CzarnyGeometry::Refined_CzarnyGeometry(const double& Rmax, const double& inverse_aspect_ratio_epsilon, 9 | const double& ellipticity_e) 10 | : Rmax(Rmax) 11 | , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) 12 | , ellipticity_e(ellipticity_e) 13 | { 14 | initializeGeometry(); 15 | } 16 | 17 | double Refined_CzarnyGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 18 | const double& cos_theta) const 19 | { 20 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 21 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 22 | cos(21.0 * theta) + 23 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 24 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 25 | cos(9.0 * theta); 26 | } 27 | -------------------------------------------------------------------------------- /src/InputFunctions/ExactSolution/refined_ShafranovGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/ExactSolution/refined_ShafranovGeometry.h" 2 | 3 | Refined_ShafranovGeometry::Refined_ShafranovGeometry(const double& Rmax, const double& elongation_kappa, 4 | const double& shift_delta) 5 | : Rmax(Rmax) 6 | , elongation_kappa(elongation_kappa) 7 | , shift_delta(shift_delta) 8 | { 9 | } 10 | 11 | double Refined_ShafranovGeometry::exact_solution(const double& r, const double& theta, const double& sin_theta, 12 | const double& cos_theta) const 13 | { 14 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 15 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 16 | cos(21.0 * theta) + 17 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 18 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 19 | cos(9.0 * theta); 20 | } 21 | -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h" 2 | 3 | CartesianR2_Poisson_CircularGeometry::CartesianR2_Poisson_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double CartesianR2_Poisson_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 8.0 * M_PI * (r / Rmax) * sin_theta * cos(2.0 * M_PI * (r / Rmax) * sin_theta) * 12 | cos(2.0 * M_PI * (r / Rmax) * cos_theta) - 13 | 8.0 * M_PI * (r / Rmax) * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * 14 | sin(2.0 * M_PI * (r / Rmax) * cos_theta) * cos_theta + 15 | 8.0 * (M_PI * M_PI) * (1.0 - (r / Rmax) * (r / Rmax)) * pow(sin_theta, 2.0) * 16 | sin(2.0 * M_PI * (r / Rmax) * sin_theta) * cos(2.0 * M_PI * (r / Rmax) * cos_theta) + 17 | 8.0 * (M_PI * M_PI) * (1.0 - (r / Rmax) * (r / Rmax)) * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * 18 | pow(cos_theta, 2.0) * cos(2.0 * M_PI * (r / Rmax) * cos_theta) + 19 | 4.0 * sin(2.0 * M_PI * (r / Rmax) * sin_theta) * cos(2.0 * M_PI * (r / Rmax) * cos_theta); 20 | } 21 | -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h" 2 | 3 | PolarR6_Poisson_CircularGeometry::PolarR6_Poisson_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_Poisson_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (-pow((r / Rmax), 4.0)) * (14.7456 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 12 | 1.0 * (r / Rmax) * 13 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 14 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) - 15 | 34.816 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)); 16 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h" 2 | 3 | PolarR6_Sonnendrucker_CircularGeometry::PolarR6_Sonnendrucker_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_Sonnendrucker_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (-pow((r / Rmax), 4.0)) * 12 | ((r / Rmax) * 13 | (0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111)) * 14 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 15 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) - 16 | 5.03290747193186 * (r / Rmax) * 17 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 18 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) / 19 | (208.641975308642 * pow(((r / Rmax) - 0.769230769230769), 2.0) + 1.0) - 20 | 49.5616 * (0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111)) * 21 | pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta) + 22 | 6.0 * (0.452961672473868 - 0.348432055749129 * atan(14.4444444444444 * (r / Rmax) - 11.1111111111111)) * 23 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 24 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta))); 25 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h" 2 | 3 | PolarR6_ZoniGyro_CircularGeometry::PolarR6_ZoniGyro_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_ZoniGyro_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * exp(tanh(10.0 * (r / Rmax) - 5.0)) * 12 | cos(11.0 * theta) - 13 | pow((r / Rmax), 4.0) * 14 | ((r / Rmax) * 15 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 16 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) * 17 | exp(-tanh(10.0 * (r / Rmax) - 5.0)) + 18 | (r / Rmax) * 19 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 20 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 21 | (10.0 * pow(tanh(10.0 * (r / Rmax) - 5.0), 2.0) - 10.0) * exp(-tanh(10.0 * (r / Rmax) - 5.0)) - 22 | 49.5616 * pow(((r / Rmax) - 1.0), 6.0) * exp(-tanh(10.0 * (r / Rmax) - 5.0)) * cos(11.0 * theta) + 23 | 6.0 * 24 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 25 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 26 | exp(-tanh(10.0 * (r / Rmax) - 5.0))); 27 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h" 2 | 3 | PolarR6_ZoniShiftedGyro_CircularGeometry::PolarR6_ZoniShiftedGyro_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_ZoniShiftedGyro_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * exp(tanh(20.0 * (r / Rmax) - 14.0)) * 12 | cos(11.0 * theta) - 13 | pow((r / Rmax), 4.0) * 14 | ((r / Rmax) * 15 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 16 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) * 17 | exp(-tanh(20.0 * (r / Rmax) - 14.0)) + 18 | (r / Rmax) * 19 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 20 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 21 | (20.0 * pow(tanh(20.0 * (r / Rmax) - 14.0), 2.0) - 20.0) * exp(-tanh(20.0 * (r / Rmax) - 14.0)) - 22 | 49.5616 * pow(((r / Rmax) - 1.0), 6.0) * exp(-tanh(20.0 * (r / Rmax) - 14.0)) * cos(11.0 * theta) + 23 | 6.0 * 24 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 25 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 26 | exp(-tanh(20.0 * (r / Rmax) - 14.0))); 27 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h" 2 | 3 | PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_ZoniShiftedGyro_CulhamGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); 12 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h" 2 | 3 | PolarR6_ZoniShifted_CircularGeometry::PolarR6_ZoniShifted_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_ZoniShifted_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (-pow((r / Rmax), 4.0)) * 12 | ((r / Rmax) * 13 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 14 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) * 15 | exp(-tanh(20.0 * (r / Rmax) - 14.0)) + 16 | (r / Rmax) * 17 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 18 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 19 | (20.0 * pow(tanh(20.0 * (r / Rmax) - 14.0), 2.0) - 20.0) * exp(-tanh(20.0 * (r / Rmax) - 14.0)) - 20 | 49.5616 * pow(((r / Rmax) - 1.0), 6.0) * exp(-tanh(20.0 * (r / Rmax) - 14.0)) * cos(11.0 * theta) + 21 | 6.0 * 22 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 23 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 24 | exp(-tanh(20.0 * (r / Rmax) - 14.0))); 25 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h" 2 | 3 | PolarR6_Zoni_CircularGeometry::PolarR6_Zoni_CircularGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double PolarR6_Zoni_CircularGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return (-pow((r / Rmax), 4.0)) * 12 | ((r / Rmax) * 13 | (12.288 * (r / Rmax) * pow(((r / Rmax) - 1.0), 4.0) * cos(11.0 * theta) + 14 | 17.2032 * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta)) * 15 | exp(-tanh(10.0 * (r / Rmax) - 5.0)) + 16 | (r / Rmax) * 17 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 18 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 19 | (10.0 * pow(tanh(10.0 * (r / Rmax) - 5.0), 2.0) - 10.0) * exp(-tanh(10.0 * (r / Rmax) - 5.0)) - 20 | 49.5616 * pow(((r / Rmax) - 1.0), 6.0) * exp(-tanh(10.0 * (r / Rmax) - 5.0)) * cos(11.0 * theta) + 21 | 6.0 * 22 | (2.4576 * (r / Rmax) * pow(((r / Rmax) - 1.0), 5.0) * cos(11.0 * theta) + 23 | 2.4576 * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta)) * 24 | exp(-tanh(10.0 * (r / Rmax) - 5.0))); 25 | } -------------------------------------------------------------------------------- /src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h" 2 | 3 | Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(const double& Rmax) 4 | : Rmax(Rmax) 5 | { 6 | } 7 | 8 | double Refined_ZoniShiftedGyro_CulhamGeometry::rhs_f(const double& r, const double& theta, const double& sin_theta, 9 | const double& cos_theta) const 10 | { 11 | return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + 12 | exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * 13 | cos(21.0 * theta) + 14 | (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + 15 | exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * 16 | cos(9.0 * theta); 17 | } -------------------------------------------------------------------------------- /src/Interpolation/injection.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/Interpolation/interpolation.h" 2 | 3 | /* Remark: This injection is not scaled. */ 4 | 5 | void Interpolation::applyInjection(const Level& fromLevel, const Level& toLevel, Vector& result, 6 | const Vector& x) const 7 | { 8 | assert(toLevel.level_depth() == fromLevel.level_depth() + 1); 9 | 10 | omp_set_num_threads(threads_per_level_[toLevel.level_depth()]); 11 | 12 | const PolarGrid& fineGrid = fromLevel.grid(); 13 | const PolarGrid& coarseGrid = toLevel.grid(); 14 | 15 | assert(x.size() == fineGrid.numberOfNodes()); 16 | assert(result.size() == coarseGrid.numberOfNodes()); 17 | 18 | #pragma omp parallel if (fineGrid.numberOfNodes() > 10'000) 19 | { 20 | /* For loop matches circular access pattern */ 21 | #pragma omp for nowait 22 | for (int i_r_coarse = 0; i_r_coarse < coarseGrid.numberSmootherCircles(); i_r_coarse++) { 23 | int i_r = i_r_coarse * 2; 24 | for (int i_theta_coarse = 0; i_theta_coarse < coarseGrid.ntheta(); i_theta_coarse++) { 25 | int i_theta = i_theta_coarse * 2; 26 | result[coarseGrid.index(i_r_coarse, i_theta_coarse)] = x[fineGrid.index(i_r, i_theta)]; 27 | } 28 | } 29 | 30 | /* For loop matches circular access pattern */ 31 | #pragma omp for nowait 32 | for (int i_theta_coarse = 0; i_theta_coarse < coarseGrid.ntheta(); i_theta_coarse++) { 33 | int i_theta = i_theta_coarse * 2; 34 | for (int i_r_coarse = coarseGrid.numberSmootherCircles(); i_r_coarse < coarseGrid.nr(); i_r_coarse++) { 35 | int i_r = i_r_coarse * 2; 36 | result[coarseGrid.index(i_r_coarse, i_theta_coarse)] = x[fineGrid.index(i_r, i_theta)]; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Interpolation/interpolation.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/Interpolation/interpolation.h" 2 | 3 | Interpolation::Interpolation(const std::vector& threads_per_level, const bool DirBC_Interior) 4 | : threads_per_level_(threads_per_level) 5 | , DirBC_Interior_(DirBC_Interior) 6 | { 7 | } -------------------------------------------------------------------------------- /src/PolarGrid/load_write_grid.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/PolarGrid/polargrid.h" 2 | 3 | void PolarGrid::writeToFile(const std::string& file_r, const std::string& file_theta, const int precision) const 4 | { 5 | writeVectorToFile(file_r, radii_, precision); 6 | writeVectorToFile(file_theta, angles_, precision); 7 | } 8 | 9 | void PolarGrid::writeVectorToFile(const std::string& filename, const std::vector& vector, 10 | const int precision) const 11 | { 12 | // Open the file for writing 13 | std::ofstream outputFile(filename); 14 | 15 | // Check if the file is opened successfully 16 | if (!outputFile.is_open()) { 17 | std::cerr << "Error opening file: " << filename << std::endl; 18 | return; 19 | } 20 | 21 | // Set the precision for output file 22 | outputFile << std::fixed << std::setprecision(precision); 23 | 24 | // Write each double from the vector to the file 25 | for (const auto& num : vector) { 26 | outputFile << num << std::endl; 27 | } 28 | 29 | // Close the file 30 | outputFile.close(); 31 | } 32 | 33 | void PolarGrid::loadVectorFromFile(const std::string& filename, std::vector& vector) const 34 | { 35 | // Open the file for reading 36 | std::ifstream inputFile(filename); 37 | 38 | // Check if the file is opened successfully 39 | if (!inputFile.is_open()) { 40 | std::cerr << "Error opening file: " << filename << std::endl; 41 | return; 42 | } 43 | 44 | // Clear the vector before loading new data 45 | vector.clear(); 46 | 47 | // Read data from the file into the vector 48 | double value; 49 | while (inputFile >> value) { 50 | vector.push_back(value); 51 | } 52 | 53 | // Close the file 54 | inputFile.close(); 55 | } -------------------------------------------------------------------------------- /src/PolarGrid/multiindex.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/PolarGrid/multiindex.h" 2 | 3 | MultiIndex::MultiIndex(int value) 4 | { 5 | assert(space_dimension >= 0); 6 | std::fill(std::begin(data_), std::end(data_), value); 7 | } 8 | 9 | MultiIndex::MultiIndex(int i, int j) 10 | { 11 | assert(space_dimension == 2); 12 | data_[0] = i; 13 | data_[1] = j; 14 | } 15 | 16 | MultiIndex::MultiIndex(int i, int j, int k) 17 | { 18 | assert(space_dimension == 3); 19 | data_[0] = i; 20 | data_[1] = j; 21 | data_[2] = k; 22 | } 23 | 24 | int MultiIndex::size() const 25 | { 26 | return space_dimension; 27 | } 28 | 29 | bool MultiIndex::operator==(const MultiIndex& other) const 30 | { 31 | for (int d = 0; d < space_dimension; d++) { 32 | if (data_[d] != other.data_[d]) { 33 | return false; 34 | } 35 | } 36 | return true; 37 | } 38 | 39 | bool MultiIndex::operator!=(const MultiIndex& other) const 40 | { 41 | for (int d = 0; d < space_dimension; d++) { 42 | if (data_[d] != other.data_[d]) { 43 | return true; 44 | } 45 | } 46 | return false; 47 | } 48 | 49 | const int& MultiIndex::operator[](int i) const 50 | { 51 | assert(i >= 0); 52 | assert(i < space_dimension); 53 | return data_[i]; 54 | } 55 | 56 | int& MultiIndex::operator[](int i) 57 | { 58 | assert(i >= 0); 59 | assert(i < space_dimension); 60 | return data_[i]; 61 | } 62 | 63 | int* MultiIndex::data() 64 | { 65 | return data_; 66 | } 67 | 68 | const int* MultiIndex::data() const 69 | { 70 | return data_; 71 | } -------------------------------------------------------------------------------- /src/Residual/ResidualTake/residualTake.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/Residual/ResidualTake/residualTake.h" 2 | 3 | ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : Residual(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 7 | { 8 | } 9 | 10 | /* ------------------ */ 11 | /* result = rhs - A*x */ 12 | 13 | // clang-format off 14 | void ResidualTake::computeResidual(Vector& result, const Vector& rhs, const Vector& x) const 15 | { 16 | assert(result.size() == x.size()); 17 | omp_set_num_threads(num_omp_threads_); 18 | 19 | assert(level_cache_.cacheDensityProfileCoefficients()); 20 | assert(level_cache_.cacheDomainGeometry()); 21 | 22 | if (omp_get_max_threads() == 1) { 23 | /* Single-threaded execution */ 24 | for (int i_r = 0; i_r < grid_.numberSmootherCircles(); i_r++) { 25 | applyCircleSection(i_r, result, rhs, x); 26 | } 27 | for (int i_theta = 0; i_theta < grid_.ntheta(); i_theta++) { 28 | applyRadialSection(i_theta, result, rhs, x); 29 | } 30 | } 31 | else { 32 | /* Multi-threaded execution */ 33 | #pragma omp parallel 34 | { 35 | /* Circle Section */ 36 | #pragma omp for nowait 37 | for (int i_r = 0; i_r < grid_.numberSmootherCircles(); i_r++) { 38 | applyCircleSection(i_r, result, rhs, x); 39 | } 40 | /* Radial Section */ 41 | #pragma omp for nowait 42 | for (int i_theta = 0; i_theta < grid_.ntheta(); i_theta++) { 43 | applyRadialSection(i_theta, result, rhs, x); 44 | } 45 | } 46 | } 47 | } 48 | // clang-format on -------------------------------------------------------------------------------- /src/Residual/residual.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/Residual/residual.h" 2 | 3 | Residual::Residual(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : grid_(grid) 7 | , level_cache_(level_cache) 8 | , domain_geometry_(domain_geometry) 9 | , density_profile_coefficients_(density_profile_coefficients) 10 | , DirBC_Interior_(DirBC_Interior) 11 | , num_omp_threads_(num_omp_threads) 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /src/Smoother/SmootherGive/smootherGive.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/Smoother/SmootherGive/smootherGive.h" 2 | 3 | SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : Smoother(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 7 | { 8 | buildAscMatrices(); 9 | #ifdef GMGPOLAR_USE_MUMPS 10 | initializeMumpsSolver(inner_boundary_mumps_solver_, inner_boundary_circle_matrix_); 11 | #else 12 | inner_boundary_lu_solver_ = SparseLUSolver(inner_boundary_circle_matrix_); 13 | #endif 14 | } 15 | 16 | SmootherGive::~SmootherGive() 17 | { 18 | #ifdef GMGPOLAR_USE_MUMPS 19 | finalizeMumpsSolver(inner_boundary_mumps_solver_); 20 | #endif 21 | } 22 | 23 | void SmootherGive::smoothing(Vector& x, const Vector& rhs, Vector& temp) 24 | { 25 | smoothingForLoop(x, rhs, temp); /* This is the fastest option */ 26 | // smoothingTaskLoop(x, rhs, temp); 27 | // smoothingTaskDependencies(x, rhs, temp); 28 | } 29 | -------------------------------------------------------------------------------- /src/Smoother/SmootherTake/smootherTake.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/Smoother/SmootherTake/smootherTake.h" 2 | 3 | SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : Smoother(grid, level_cache, domain_geometry, density_profile_coefficients, DirBC_Interior, num_omp_threads) 7 | { 8 | buildAscMatrices(); 9 | #ifdef GMGPOLAR_USE_MUMPS 10 | initializeMumpsSolver(inner_boundary_mumps_solver_, inner_boundary_circle_matrix_); 11 | #else 12 | inner_boundary_lu_solver_ = SparseLUSolver(inner_boundary_circle_matrix_); 13 | #endif 14 | } 15 | 16 | SmootherTake::~SmootherTake() 17 | { 18 | #ifdef GMGPOLAR_USE_MUMPS 19 | finalizeMumpsSolver(inner_boundary_mumps_solver_); 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /src/Smoother/smoother.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/Smoother/smoother.h" 2 | 3 | Smoother::Smoother(const PolarGrid& grid, const LevelCache& level_cache, const DomainGeometry& domain_geometry, 4 | const DensityProfileCoefficients& density_profile_coefficients, bool DirBC_Interior, 5 | int num_omp_threads) 6 | : grid_(grid) 7 | , level_cache_(level_cache) 8 | , domain_geometry_(domain_geometry) 9 | , density_profile_coefficients_(density_profile_coefficients) 10 | , DirBC_Interior_(DirBC_Interior) 11 | , num_omp_threads_(num_omp_threads) 12 | { 13 | } -------------------------------------------------------------------------------- /src/Stencil/stencil.cpp: -------------------------------------------------------------------------------- 1 | #include "../../include/Stencil/stencil.h" 2 | 3 | Stencil::Stencil(std::initializer_list init) 4 | : values_{} 5 | { 6 | std::copy(init.begin(), init.end(), values_.begin()); 7 | stencil_size_ = 0; 8 | for (int i = 0; i < static_cast(init.size()); i++) { 9 | if (values_[i] != -1) 10 | stencil_size_++; 11 | } 12 | } 13 | 14 | int Stencil::operator[](StencilPosition type) const 15 | { 16 | return values_[static_cast(type)]; 17 | } 18 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../include/GMGPolar/gmgpolar.h" 4 | 5 | int main(int argc, char* argv[]) 6 | { 7 | // Display Build Type 8 | #ifdef NDEBUG 9 | std::cout << "Build Type: Release" << std::endl; 10 | #else 11 | std::cout << "Build Type: Debug" << std::endl; 12 | #endif 13 | 14 | // Check Likwid Status 15 | #ifdef GMGPOLAR_USE_LIKWID 16 | std::cout << "Likwid: ON" << std::endl; 17 | #else 18 | std::cout << "Likwid: OFF" << std::endl; 19 | #endif 20 | 21 | // Check MUMPS Status 22 | #ifdef GMGPOLAR_USE_MUMPS 23 | std::cout << "MUMPS: ON\n" << std::endl; 24 | #else 25 | std::cout << "MUMPS: OFF\n" << std::endl; 26 | #endif 27 | 28 | // Initialize LIKWID markers if enabled 29 | LIKWID_INIT(); 30 | 31 | // Initialize solver and set parameters from command-line arguments 32 | GMGPolar solver; 33 | solver.setParameters(argc, argv); 34 | // Run Solver Setup with optional LIKWID markers 35 | solver.setup(); 36 | // Execute Solve Phase with optional LIKWID markers 37 | solver.solve(); 38 | 39 | // Finalize LIKWID markers if enabled 40 | LIKWID_CLOSE(); 41 | 42 | // Retrieve and print solution and timings 43 | Vector& solution = solver.solution(); 44 | const PolarGrid& grid = solver.grid(); 45 | 46 | solver.printTimings(); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | project(GMGPolarTests LANGUAGES CXX) 4 | 5 | set(CMAKE_CXX_STANDARD 20) 6 | set(CMAKE_CXX_STANDARD_REQUIRED True) 7 | 8 | # Create a single test executable that includes all test sources 9 | add_executable(gmgpolar_tests 10 | gmgpolar_tests.cpp 11 | LinearAlgebra/vector.cpp 12 | LinearAlgebra/vector_operations.cpp 13 | LinearAlgebra/matrix.cpp 14 | LinearAlgebra/csr_matrix.cpp 15 | LinearAlgebra/tridiagonal_solver.cpp 16 | LinearAlgebra/cyclic_tridiagonal_solver.cpp 17 | PolarGrid/polargrid.cpp 18 | Interpolation/prolongation.cpp 19 | Interpolation/restriction.cpp 20 | Interpolation/extrapolated_prolongation.cpp 21 | Interpolation/extrapolated_restriction.cpp 22 | Residual/residual.cpp 23 | DirectSolver/directSolver.cpp 24 | DirectSolver/directSolverNoMumps.cpp 25 | Smoother/smoother.cpp 26 | ExtrapolatedSmoother/extrapolated_smoother.cpp 27 | ) 28 | 29 | # Set the compile features and link libraries 30 | target_compile_features(gmgpolar_tests PRIVATE cxx_std_17) 31 | target_link_libraries(gmgpolar_tests GMGPolarLib GTest::gtest_main) 32 | 33 | # Register the test 34 | add_test(NAME gmgpolar_tests COMMAND gmgpolar_tests) 35 | 36 | include(GoogleTest) 37 | gtest_discover_tests(gmgpolar_tests) 38 | -------------------------------------------------------------------------------- /tests/gmgpolar_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Define the main function only once 4 | int main(int argc, char* argv[]) { 5 | testing::InitGoogleTest(&argc, argv); 6 | return RUN_ALL_TESTS(); 7 | } 8 | -------------------------------------------------------------------------------- /third-party/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Adding GoogleTest") 2 | 3 | include(FetchContent) 4 | FetchContent_Declare( 5 | googletest 6 | GIT_REPOSITORY https://github.com/google/googletest.git 7 | GIT_TAG release-1.12.1 8 | ) 9 | 10 | # For Windows: Prevent overriding the parent project's compiler/linker settings 11 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) 12 | FetchContent_MakeAvailable(googletest) --------------------------------------------------------------------------------