Commit 65c3db82 authored by steffen.schotthoefer's avatar steffen.schotthoefer
Browse files

added option that 2d SN uses only half of the quadrature points

parent 7f792df1
Pipeline #104460 passed with stages
in 29 minutes and 44 seconds
......@@ -226,7 +226,7 @@ class Config
unsigned inline GetReconsOrder() { return _reconsOrder; }
SOLVER_NAME inline GetSolverName() const { return _solverName; }
double inline GetTEnd() const { return _tEnd; }
bool inline GetUseAllGaussPts() const { return _allGaussPts; }
bool inline GetSNAllGaussPts() const { return _allGaussPts; }
bool inline GetIsCSD() const { return _csd; }
// Optimizer
......@@ -251,7 +251,7 @@ class Config
void SetNQuadPoints( unsigned nq ) { _nQuadPoints = nq; }
void SetQuadName( QUAD_NAME quadName ) { _quadName = quadName; } /*! @brief Never change the quadName! This is only for the test framework. */
void SetQuadOrder( unsigned quadOrder ) { _quadOrder = quadOrder; } /*! @brief Never change the quadOrder! This is only for the test framework. */
void SetSNAllGaussPts( bool useall ) { _allGaussPts = useall; } /*! @brief Never change the this! This is only for the test framework. */
// Mesh Structure
void SetNCells( unsigned nCells ) { _nCells = nCells; }
};
......
......@@ -17,7 +17,7 @@
class QDummy : public QuadratureBase
{
public:
QDummy( unsigned order );
QDummy( Config* settings );
virtual ~QDummy() {}
void SetName() override;
......
......@@ -11,7 +11,7 @@ class QGaussLegendre1D : public QuadratureBase
bool CheckOrder();
public:
QGaussLegendre1D( unsigned order );
QGaussLegendre1D( Config* settings );
virtual ~QGaussLegendre1D() {}
inline void SetName() override { _name = "Tensorized Gauss-Legendre quadrature."; }
......
......@@ -16,7 +16,7 @@ class QGaussLegendreTensorized : public QuadratureBase
virtual ~QGaussLegendreTensorized() {}
inline void SetName() override { _name = "Tensorized Gauss-Legendre quadrature"; }
inline void SetNq() override { _nq = 2 * pow( GetOrder(), 2 ); }
void SetNq() override;
void SetPointsAndWeights() override;
void SetConnectivity() override;
......
......@@ -6,7 +6,7 @@
class QLDFESA : public QLookupQuadrature
{
public:
QLDFESA( unsigned order );
QLDFESA( Config* settings );
virtual ~QLDFESA() {}
inline void SetName() override { _name = "LDFESA quadrature"; }
......
......@@ -6,7 +6,7 @@
class QLebedev : public QLookupQuadrature
{
public:
QLebedev( unsigned order );
QLebedev( Config* settings );
virtual ~QLebedev() {}
inline void SetName() override { _name = "Lebedev quadrature"; }
......
......@@ -6,7 +6,7 @@
class QLevelSymmetric : public QLookupQuadrature
{
public:
QLevelSymmetric( unsigned order );
QLevelSymmetric( Config* settings );
virtual ~QLevelSymmetric() {}
inline void SetName() override { _name = "Level Symmetric quadrature"; }
......
......@@ -6,7 +6,7 @@
class QLookupQuadrature : public QuadratureBase
{
public:
QLookupQuadrature( unsigned order );
QLookupQuadrature( Config* settings );
virtual ~QLookupQuadrature() {}
// helper
......
......@@ -34,8 +34,7 @@ class QuadratureBase
// Quadrature Hub
/*! @brief Creates a quadrature rule with a given name and a given order.
* @param: std::string name: Name of the quadrature rule
* @param: unsigned order: Order of the quadrature rule
* @param: Config* settings: Settings to handle quadrature options
* @returns Quadrature* quadrature: returns pointer to instance of the given derived quadrature class */
static QuadratureBase* CreateQuadrature( Config* settings );
......
......@@ -5,13 +5,13 @@
#include "toolboxes/errormessages.h"
NewtonOptimizer::NewtonOptimizer( Config* settings ) : OptimizerBase( settings ) {
_quadrature = QuadratureBase::CreateQuadrature( settings->GetQuadName(), settings->GetQuadOrder() );
_quadrature = QuadratureBase::CreateQuadrature( settings );
_nq = _quadrature->GetNq();
_weights = _quadrature->GetWeights();
_quadPointsSphere = _quadrature->GetPointsSphere();
_maxIterations = settings->GetNewtonIter();
_alpha = settings->GetNewtonStepSize();
_maxLineSearches = settings->GetMaxLineSearches();
_maxLineSearches = settings->GetNewtonMaxLineSearches();
_epsilon = settings->GetNewtonOptimizerEpsilon();
}
......
......@@ -11,7 +11,7 @@
#include "quadratures/qdummy.h"
QDummy::QDummy( unsigned order ) : QuadratureBase( order ) {
QDummy::QDummy( Config* settings ) : QuadratureBase( settings ) {
SetName();
SetNq();
SetPointsAndWeights();
......
#include "quadratures/qgausslegendre1D.h"
#include "toolboxes/errormessages.h"
QGaussLegendre1D::QGaussLegendre1D( unsigned order ) : QuadratureBase( order ) {
QGaussLegendre1D::QGaussLegendre1D( Config* settings ) : QuadratureBase( settings ) {
SetName();
CheckOrder();
SetNq();
......
#include "quadratures/qgausslegendretensorized.h"
#include "common/config.h"
#include "toolboxes/errormessages.h"
QGaussLegendreTensorized::QGaussLegendreTensorized( Config* settings ) : QuadratureBase( settings ) {
......@@ -9,6 +10,15 @@ QGaussLegendreTensorized::QGaussLegendreTensorized( Config* settings ) : Quadrat
SetConnectivity();
}
void QGaussLegendreTensorized::SetNq() {
_nq = 2 * pow( GetOrder(), 2 );
// 2d case SN solver only needs half of the sphere
if( _settings->GetSolverName() == SN_SOLVER && _settings->GetSNAllGaussPts() == false ) {
_nq = pow( GetOrder(), 2 );
}
}
void QGaussLegendreTensorized::SetPointsAndWeights() {
Vector nodes1D( _order ), weights1D( _order );
......@@ -48,7 +58,7 @@ void QGaussLegendreTensorized::SetPointsAndWeights() {
unsigned range = _order; // By default, use all quad points
double normalizationFactor = 1.0;
if( _settings->GetSolverName() == SN_SOLVER && _settings->GetUseAllGaussPts() == false ) {
if( _settings->GetSolverName() == SN_SOLVER && _settings->GetSNAllGaussPts() == false ) {
range = std::floor( _order / 2.0 ); // comment (steffen): why do we only need half of the points:
//=> In 2D we would count everything twice. (not wrong with scaling)
normalizationFactor = 2.0;
......
......@@ -2,7 +2,7 @@
#include "quadratures/lookuptable_ldfesa.h"
#include "toolboxes/errormessages.h"
QLDFESA::QLDFESA( unsigned order ) : QLookupQuadrature( order ) {
QLDFESA::QLDFESA( Config* settings ) : QLookupQuadrature( settings ) {
SetAvailOrders();
......
......@@ -2,7 +2,7 @@
#include "quadratures/lookuptable_lebedev.h"
#include "toolboxes/errormessages.h"
QLebedev::QLebedev( unsigned order ) : QLookupQuadrature( order ) {
QLebedev::QLebedev( Config* settings ) : QLookupQuadrature( settings ) {
SetAvailOrders();
......
......@@ -2,7 +2,7 @@
#include "quadratures/lookuptable_levelsymmetric.h"
#include "toolboxes/errormessages.h"
QLevelSymmetric::QLevelSymmetric( unsigned order ) : QLookupQuadrature( order ) {
QLevelSymmetric::QLevelSymmetric( Config* settings ) : QLookupQuadrature( settings ) {
SetAvailOrders();
......
......@@ -3,7 +3,7 @@
#include <fstream>
#include <sstream>
QLookupQuadrature::QLookupQuadrature( unsigned order ) : QuadratureBase( order ) {}
QLookupQuadrature::QLookupQuadrature( Config* settings ) : QuadratureBase( settings ) {}
void QLookupQuadrature::printAvailOrders() const {
auto log = spdlog::get( "event" );
......
......@@ -23,7 +23,7 @@ QuadratureBase* QuadratureBase::CreateQuadrature( Config* settings ) {
case QUAD_LevelSymmetric: return new QLevelSymmetric( settings );
case QUAD_LDFESA: return new QLDFESA( settings );
case QUAD_Lebedev: return new QLebedev( settings );
default: return new QMonteCarlo( settings ); // Use MonteCarlo as dummy
default: return new QMonteCarlo( settings ); // Use MonteCarlo as default
}
}
......
......@@ -23,7 +23,7 @@ Solver::Solver( Config* settings ) : _settings( settings ) {
_settings->SetNCells( _nCells );
// build quadrature object and store frequently used params
_quadrature = QuadratureBase::CreateQuadrature( settings->GetQuadName(), settings->GetQuadOrder() );
_quadrature = QuadratureBase::CreateQuadrature( settings );
_nq = _quadrature->GetNq();
_settings->SetNQuadPoints( _nq );
......
% ---- File specifications ----
OUTPUT_DIR = ../../result
OUTPUT_FILE = rtsn_test_unit
LOG_DIR = ../../result/logs
MESH_FILE = unit.su2
% ---- Solver specifications ----
CFL_NUMBER = 0.5
TIME_FINAL = 0.0
PROBLEM = ELECTRONRT
% ---- Boundary Conditions ----
BC_DIRICHLET = ( void )
QUAD_TYPE = MONTE_CARLO
QUAD_ORDER = 1
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