Commit d8500aab authored by jannick.wolters's avatar jannick.wolters
Browse files

added GetStoppingPower to problembase

parent 751d7066
Pipeline #103240 passed with stages
in 25 minutes and 16 seconds
......@@ -37,13 +37,21 @@ inline std::map<std::string, QUAD_NAME> Quadrature_Map{ { "MONTE_CARLO", QUAD_Mo
{ "LDFESA", QUAD_LDFESA } };
// Problem name
enum PROBLEM_NAME { PROBLEM_LineSource, PROBLEM_Checkerboard, PROBLEM_ElectronRT, PROBLEM_WaterPhantom, PROBLEM_LineSource_Pseudo_1D };
enum PROBLEM_NAME {
PROBLEM_LineSource,
PROBLEM_Checkerboard,
PROBLEM_ElectronRT,
PROBLEM_WaterPhantom,
PROBLEM_LineSource_Pseudo_1D,
PROBLEM_LineSource_Pseudo_1D_Physics
};
inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_LineSource },
{ "CHECKERBOARD", PROBLEM_Checkerboard },
{ "ELECTRONRT", PROBLEM_ElectronRT },
{ "WATERPHANTOM", PROBLEM_WaterPhantom },
{ "LINESOURCE_PSEUDO_1D", PROBLEM_LineSource_Pseudo_1D } };
{ "LINESOURCE_PSEUDO_1D", PROBLEM_LineSource_Pseudo_1D },
{ "LINESOURCE_PSEUDO_1D_PHYSICS", PROBLEM_LineSource_Pseudo_1D_Physics } };
// Kernel name
enum KERNEL_NAME { KERNEL_Isotropic, KERNEL_Isotropic1D };
......
......@@ -21,7 +21,6 @@ class Checkerboard : public ProblemBase
virtual VectorVector GetScatteringXS( const Vector& energies );
virtual VectorVector GetTotalXS( const Vector& energies );
virtual std::vector<VectorVector> GetExternalSource( const Vector& energies );
virtual Vector GetStoppingPower( const Vector& energies );
virtual VectorVector SetupIC();
};
......
......@@ -25,7 +25,6 @@ class ElectronRT : public ProblemBase
virtual VectorVector GetScatteringXSE( const Vector& energies, const Vector& angles );
virtual Vector GetTotalXSE( const Vector& energies );
virtual std::vector<VectorVector> GetExternalSource( const Vector& energies );
virtual Vector GetStoppingPower( const Vector& energies );
virtual VectorVector SetupIC();
std::vector<double> GetDensity( const VectorVector& cellMidPoints );
};
......
......@@ -15,7 +15,6 @@ class LineSource_SN : public ProblemBase
virtual VectorVector GetScatteringXS( const Vector& energies );
virtual VectorVector GetTotalXS( const Vector& energies );
virtual std::vector<VectorVector> GetExternalSource( const Vector& energies );
virtual Vector GetStoppingPower( const Vector& energies );
virtual VectorVector SetupIC();
};
......@@ -30,6 +29,15 @@ class LineSource_SN_Pseudo1D : public LineSource_SN
VectorVector SetupIC() override;
};
class LineSource_SN_Pseudo1D_Physics : public LineSource_SN_Pseudo1D
{
private:
LineSource_SN_Pseudo1D_Physics() = delete;
public:
LineSource_SN_Pseudo1D_Physics( Config* settings, Mesh* mesh );
};
class LineSource_PN : public ProblemBase
{
private:
......@@ -52,7 +60,6 @@ class LineSource_PN : public ProblemBase
virtual VectorVector GetScatteringXS( const Vector& energies ) override;
virtual VectorVector GetTotalXS( const Vector& energies ) override;
virtual std::vector<VectorVector> GetExternalSource( const Vector& energies ) override;
virtual Vector GetStoppingPower( const Vector& energies ) override;
virtual VectorVector SetupIC() override;
};
......
......@@ -65,7 +65,7 @@ class ProblemBase
* materials defined by density and energies in vector energy
* @param energies is vector with energies
*/
virtual Vector GetStoppingPower( const Vector& energies ) = 0;
virtual Vector GetStoppingPower( const Vector& energies );
/**
* @brief GetDensity gives back vector of densities for every spatial cell
......
......@@ -2,7 +2,7 @@ OUTPUT_DIR = ../result
OUTPUT_FILE = example_csd
LOG_DIR = ../result/logs
MESH_FILE = linesource_pseudo_1D.su2
PROBLEM = LINESOURCE_PSEUDO_1D
PROBLEM = LINESOURCE_PSEUDO_1D_PHYSICS
SOLVER = CSD_SN_SOLVER
CONTINUOUS_SLOWING_DOWN = NO
HYDROGEN_FILE = ENDL_H.txt
......
......@@ -30,11 +30,6 @@ std::vector<VectorVector> Checkerboard::GetExternalSource( const Vector& energie
return std::vector<VectorVector>( 1u, Q );
}
Vector Checkerboard::GetStoppingPower( const Vector& energies ) {
// @TODO
return Vector( energies.size(), 0.0 );
}
VectorVector Checkerboard::SetupIC() {
VectorVector psi( _mesh->GetNumCells(), Vector( _settings->GetNQuadPoints(), 1e-10 ) );
return psi;
......
......@@ -33,11 +33,6 @@ std::vector<VectorVector> ElectronRT::GetExternalSource( const Vector& energies
return std::vector<VectorVector>( energies.size(), std::vector<Vector>( _mesh->GetNumCells(), Vector( _settings->GetNQuadPoints(), 0.0 ) ) );
}
Vector ElectronRT::GetStoppingPower( const Vector& energies ) {
// @TODO
return _physics->GetStoppingPower( energies );
}
VectorVector ElectronRT::SetupIC() {
// @TODO
return VectorVector( _mesh->GetNumCells(), Vector( _settings->GetNQuadPoints(), 1e-10 ) );
......
#include "problems/linesource.h"
#include "common/config.h"
#include "common/mesh.h"
#include "physics.h"
// ---- LineSource_SN ----
......@@ -16,11 +17,6 @@ std::vector<VectorVector> LineSource_SN::GetExternalSource( const Vector& energi
return std::vector<VectorVector>( 1u, std::vector<Vector>( _mesh->GetNumCells(), Vector( 1u, 0.0 ) ) );
}
Vector LineSource_SN::GetStoppingPower( const Vector& energies ) {
// @TODO
return Vector( energies.size(), 1.0 );
}
VectorVector LineSource_SN::SetupIC() {
VectorVector psi( _mesh->GetNumCells(), Vector( _settings->GetNQuadPoints(), 1e-10 ) );
auto cellMids = _mesh->GetCellMidPoints();
......@@ -48,6 +44,10 @@ VectorVector LineSource_SN_Pseudo1D::SetupIC() {
return psi;
}
LineSource_SN_Pseudo1D_Physics::LineSource_SN_Pseudo1D_Physics( Config* settings, Mesh* mesh ) : LineSource_SN_Pseudo1D( settings, mesh ) {
_physics = new Physics( settings->GetHydrogenFile(), settings->GetOxygenFile(), "../input/stopping_power.txt" );
}
// ---- LineSource_PN ----
int LineSource_PN::GlobalIndex( int l, int k ) const {
......@@ -68,11 +68,6 @@ std::vector<VectorVector> LineSource_PN::GetExternalSource( const Vector& energi
return std::vector<VectorVector>( 1u, std::vector<Vector>( _mesh->GetNumCells(), Vector( 1u, 0.0 ) ) );
}
Vector LineSource_PN::GetStoppingPower( const Vector& energies ) {
// @TODO
return Vector( energies.size(), 0.0 );
}
VectorVector LineSource_PN::SetupIC() {
// Compute number of equations in the system
int ntotalEquations = GlobalIndex( _settings->GetMaxMomentDegree(), _settings->GetMaxMomentDegree() ) + 1;
......
......@@ -31,3 +31,13 @@ ProblemBase* ProblemBase::Create( Config* settings, Mesh* mesh ) {
}
std::vector<double> ProblemBase::GetDensity( const VectorVector& cellMidPoints ) { return std::vector<double>( cellMidPoints.size(), 1.0 ); }
Vector ProblemBase::GetStoppingPower( const Vector& energies ) {
if( _physics ) {
return _physics->GetStoppingPower( energies );
}
else {
ErrorMessages::Error( "Problem child class has not initialized a 'Physics' object!", CURRENT_FUNCTION );
return Vector( 1, -1.0 );
}
}
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