Commit 952e370d authored by steffen.schotthoefer's avatar steffen.schotthoefer
Browse files

code restructuring

parent 971beab9
Pipeline #91202 failed with stages
in 5 minutes and 32 seconds
#include "numericalflux.h"
#include "upwindflux.h"
#include "fluxes/numericalflux.h"
#include "fluxes/upwindflux.h"
NumericalFlux::NumericalFlux( Config* settings ) {}
......
#include "upwindflux.h"
#include "fluxes/upwindflux.h"
UpwindFlux::UpwindFlux( Config* settings ) : NumericalFlux( settings ) {}
......@@ -57,6 +57,7 @@ void UpwindFlux::FluxVanLeer( const Matrix& Ax,
const Vector& psiR,
const Vector& n,
Vector& resultFlux ) const {
resultFlux += n[0] * 0.5 * Ax * ( psiL + psiR ) - abs( n[0] ) * AxAbs * ( psiR - psiL ) + n[1] * 0.5 * Az * ( psiL + psiR ) -
abs( n[1] ) * AzAbs * ( psiR - psiL );
resultFlux += n[0] * 0.5 * Ax * ( psiL + psiR ) - std::abs( n[0] ) * AxAbs * ( psiR - psiL ) + n[1] * 0.5 * Az * ( psiL + psiR ) -
std::abs( n[1] ) * AzAbs * ( psiR - psiL );
}
#include <mpi.h>
#include "io.h"
#include "solver.h"
#include "solvers/solver.h"
#include "settings/config.h"
......
#include "reconstructor.h"
#include "typedef.h"
Reconstructor::Reconstructor( Config* settings ) {}
......
......@@ -174,35 +174,38 @@ void Config::SetConfigOptions() {
/* BEGIN_CONFIG_OPTIONS */
/*! \par CONFIG_CATEGORY: Problem Definition \ingroup Config */
/*! @par CONFIG_CATEGORY: Problem Definition @ingroup Config */
/*--- Options related to problem definition and partitioning ---*/
// File Structure related options
/*! \brief OUTPUT_DIR \n DESCRIPTION: Relative Directory of output files \n DEFAULT "/out" \ingroup Config.*/
/*! @brief OUTPUT_DIR \n DESCRIPTION: Relative Directory of output files \n DEFAULT "/out" @ingroup Config.*/
AddStringOption( "OUTPUT_DIR", _outputDir, string( "/out" ) );
/*! \brief OUTPUT_FILE \n DESCRIPTION: Name of output file \n DEFAULT "output" \ingroup Config.*/
/*! @brief OUTPUT_FILE \n DESCRIPTION: Name of output file \n DEFAULT "output" @ingroup Config.*/
AddStringOption( "OUTPUT_FILE", _outputFile, string( "output" ) );
/*! \brief LOG_DIR \n DESCRIPTION: Relative Directory of log files \n DEFAULT "/out" \ingroup Config.*/
/*! @brief LOG_DIR \n DESCRIPTION: Relative Directory of log files \n DEFAULT "/out" @ingroup Config.*/
AddStringOption( "LOG_DIR", _logDir, string( "/out" ) );
/*!\brief MESH_FILE \n DESCRIPTION: Name of mesh file \n DEFAULT "" \ingroup Config.*/
AddStringOption( "MESH_FILE", _meshFile, string( "mesh.su2" ) );
// Quadrature relatated options
/*! \brief QUAD_TYPE \n DESCRIPTION: Type of Quadrature rule \n Options: see \link QUAD_NAME \endlink \n DEFAULT: QUAD_MonteCarlo \ingroup
/*! @brief QUAD_TYPE \n DESCRIPTION: Type of Quadrature rule \n Options: see @link QUAD_NAME \endlink \n DEFAULT: QUAD_MonteCarlo \ingroup
* Config*/
AddEnumOption( "QUAD_TYPE", _quadName, Quadrature_Map, QUAD_MonteCarlo );
/*!\brief QUAD_ORDER \n DESCRIPTION: Order of Quadrature rule \n DEFAULT 2 \ingroup Config.*/
AddUnsignedShortOption( "QUAD_ORDER", _quadOrder, 2 );
// Solver related options
/*! \brief CFL \n DESCRIPTION: CFL number \n DEFAULT 1.0 \ingroup Config.*/
/*! @brief CFL \n DESCRIPTION: CFL number \n DEFAULT 1.0 @ingroup Config.*/
AddDoubleOption( "CFL_NUMBER", _CFL, 1.0 );
/*! \brief TIME_FINAL \n DESCRIPTION: Final time for simulation \n DEFAULT 1.0 \ingroup Config.*/
/*! @brief TIME_FINAL \n DESCRIPTION: Final time for simulation \n DEFAULT 1.0 @ingroup Config.*/
AddDoubleOption( "TIME_FINAL", _tEnd, 1.0 );
/*! \brief Problem \n DESCRIPTION: Type of problem setting \n DEFAULT PROBLEM_ElectronRT \ingroup Config.*/
/*! @brief Problem \n DESCRIPTION: Type of problem setting \n DEFAULT PROBLEM_ElectronRT @ingroup Config.*/
AddEnumOption( "PROBLEM", _problemName, Problem_Map, PROBLEM_ElectronRT );
/*! \brief Solver \n DESCRIPTION: Solver used for problem \n DEFAULT SN_SOLVER \ingroup Config. */
/*! @brief Solver \n DESCRIPTION: Solver used for problem \n DEFAULT SN_SOLVER @ingroup Config. */
AddEnumOption( "SOLVER", _solverName, Solver_Map, SN_SOLVER );
/*! @brief CleanFluxMatrices \n DESCRIPTION: If true, very low entries (10^-10 or smaller) of the flux matrices will be set to zero,
* to improve floating point accuracy \n DEFAULT false \ingroup Config */
AddBoolOption( "CLEAN_FLUX_MATRICES", _cleanFluxMat, false );
// Mesh related options
// Boundary Markers
......
//#include "solvers/advectionsolver.h"
//
// AdvectionSolver::AdvectionSolver( Config* settings ) {}
#include "pnsolver.h"
#include "solvers/pnsolver.h"
#include "../ext/blaze/blaze/math/blas/cblas/gemm.h"
#include "toolboxes/errormessages.h"
#include "toolboxes/textprocessingtoolbox.h"
......@@ -71,17 +71,17 @@ void PNSolver::AdaptTimeStep() { _dE = _dE / _combinedSpectralRadius; }
void PNSolver::CleanFluxMatrices() {
for( unsigned idx_row = 0; idx_row < _nTotalEntries; idx_row++ ) {
for( unsigned idx_col = 0; idx_col < _nTotalEntries; idx_col++ ) {
if( _AxAbs( idx_row, idx_col ) < 0.00000000001 ) _AxAbs( idx_row, idx_col ) = 0.0;
if( _AxPlus( idx_row, idx_col ) < 0.00000000001 ) _AxPlus( idx_row, idx_col ) = 0.0;
if( _AxMinus( idx_row, idx_col ) < 0.00000000001 ) _AxMinus( idx_row, idx_col ) = 0.0;
if( std::abs( _AxAbs( idx_row, idx_col ) ) < 0.00000000001 ) _AxAbs( idx_row, idx_col ) = 0.0;
if( std::abs( _AxPlus( idx_row, idx_col ) ) < 0.00000000001 ) _AxPlus( idx_row, idx_col ) = 0.0;
if( std::abs( _AxMinus( idx_row, idx_col ) ) < 0.00000000001 ) _AxMinus( idx_row, idx_col ) = 0.0;
if( _AyAbs( idx_row, idx_col ) < 0.00000000001 ) _AyAbs( idx_row, idx_col ) = 0.0;
if( _AyPlus( idx_row, idx_col ) < 0.00000000001 ) _AyPlus( idx_row, idx_col ) = 0.0;
if( _AyMinus( idx_row, idx_col ) < 0.00000000001 ) _AyMinus( idx_row, idx_col ) = 0.0;
if( std::abs( _AyAbs( idx_row, idx_col ) ) < 0.00000000001 ) _AyAbs( idx_row, idx_col ) = 0.0;
if( std::abs( _AyPlus( idx_row, idx_col ) ) < 0.00000000001 ) _AyPlus( idx_row, idx_col ) = 0.0;
if( std::abs( _AyMinus( idx_row, idx_col ) ) < 0.00000000001 ) _AyMinus( idx_row, idx_col ) = 0.0;
if( _AzAbs( idx_row, idx_col ) < 0.00000000001 ) _AzAbs( idx_row, idx_col ) = 0.0;
if( _AzPlus( idx_row, idx_col ) < 0.00000000001 ) _AzPlus( idx_row, idx_col ) = 0.0;
if( _AzMinus( idx_row, idx_col ) < 0.00000000001 ) _AzMinus( idx_row, idx_col ) = 0.0;
if( std::abs( _AzAbs( idx_row, idx_col ) ) < 0.00000000001 ) _AzAbs( idx_row, idx_col ) = 0.0;
if( std::abs( _AzPlus( idx_row, idx_col ) ) < 0.00000000001 ) _AzPlus( idx_row, idx_col ) = 0.0;
if( std::abs( _AzMinus( idx_row, idx_col ) ) < 0.00000000001 ) _AzMinus( idx_row, idx_col ) = 0.0;
}
}
}
......
#include "snsolver.h"
#include "solvers/snsolver.h"
SNSolver::SNSolver( Config* settings ) : Solver( settings ) {}
......
#include "snsolverMPI.h"
#include "solvers/snsolverMPI.h"
#include <mpi.h>
SNSolverMPI::SNSolverMPI( Config* settings ) : Solver( settings ) {}
......
#include "solver.h"
#include "../../include/quadratures/quadraturebase.h"
#include "solvers/solver.h"
#include "io.h"
#include "mesh.h"
#include "pnsolver.h"
#include "quadratures/quadraturebase.h"
#include "settings/globalconstants.h"
#include "snsolver.h"
#include "solvers/pnsolver.h"
#include "solvers/snsolver.h"
Solver::Solver( Config* settings ) : _settings( settings ) {
// @TODO save parameters from settings class
......
......@@ -17,7 +17,7 @@ std::vector<std::vector<int>> quadratureorders = {
bool approxequal( double a, double b, bool lowAccuracy = false ) {
double tol = 1e-15; // For computed quadrature weights
if( lowAccuracy ) tol = 5e-5; // Mainly for Lookup Quadratures
return abs( a - b ) < tol;
return std::abs( a - b ) < tol;
}
TEST_CASE( "Quadrature weights sum to 4*pi.", "[quadrature]" ) {
......@@ -34,7 +34,7 @@ TEST_CASE( "Quadrature weights sum to 4*pi.", "[quadrature]" ) {
printf( "Quadrature %d at order %d . Error : %.15f (low accuracy testing was set to %d) \n",
quadraturename,
quadratureorder,
abs( Q->SumUpWeights() - 4 * M_PI ),
std::abs( Q->SumUpWeights() - 4 * M_PI ),
lowAccuracyTesting );
printf( "Computed result %.15f", Q->SumUpWeights() );
}
......@@ -60,7 +60,7 @@ TEST_CASE( "Quadrature points are on the unit sphere.", "[quadrature]" ) {
quadraturename,
quadratureorder,
i,
abs( norm( points[i] ) - 1.0 ),
std::abs( norm( points[i] ) - 1.0 ),
lowAccuracyTesting );
printf( "Computed result %.15f", norm( points[i] ) );
}
......@@ -106,7 +106,7 @@ TEST_CASE( "Integrate a constant function.", "[quadrature]" ) {
printf( "Quadrature %d at order %d : Error : %.15f (low accuracy testing was set to %d)\n",
quadraturename,
quadratureorder,
abs( Q->Integrate( f ) - 4.0 * M_PI ),
std::abs( Q->Integrate( f ) - 4.0 * M_PI ),
lowAccuracyTesting );
printf( "Computed result %.15f", Q->Integrate( f ) );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment