Commit d1c74e69 authored by Tianbai Xiao's avatar Tianbai Xiao
Browse files

Clean codes & add docs


Former-commit-id: 8c98b7ef
parent f01884ab
......@@ -42,9 +42,9 @@ class MNSolver : public Solver
Layout: _nCells x _nTotalEntries*/
OptimizerBase* _optimizer; /*! @brief: Class to solve minimal entropy problem */
VectorVector _solDx;
VectorVector _solDy;
VectorVector _solDx; /*! @brief: temporary storage of x-derivatives of alpha */
VectorVector _solDy; /*! @brief: temporary storage of y-derivatives of alpha */
// ---- Private Member functions ---
// IO
......
......@@ -38,8 +38,8 @@ class PNSolver : public Solver
Vector _scatterMatDiag; /*! @brief: diagonal of the scattering matrix (its a diagonal matrix by construction). Contains eigenvalues of the
scattering kernel. */
VectorVector _solDx;
VectorVector _solDy;
VectorVector _solDx; /*! @brief: temporary storage of x-derivatives of solution */
VectorVector _solDy; /*! @brief: temporary storage of y-derivatives of solution */
// ---- Member functions ----
......
......@@ -31,6 +31,7 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ) {
_quadPointsSphere = _quadrature->GetPointsSphere();
_settings->SetNQuadPoints( _nq );
// Initialize temporary storages of alpha derivatives
_solDx = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
_solDy = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
......@@ -91,20 +92,19 @@ void MNSolver::ComputeMoments() {
Vector MNSolver::ConstructFlux( unsigned idx_cell ) {
Vector alphaL( _nTotalEntries, 0.0 );
Vector alphaR( _nTotalEntries, 0.0 );
//--- Integration of Moment of flux ---
//--- Integration of moments of flux ---
double entropyL, entropyR, entropyFlux;
Vector flux( _nTotalEntries, 0.0 );
for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
//--- Temporary storages of reconstructed alpha ---
Vector alphaL( _nTotalEntries, 0.0 );
Vector alphaR( _nTotalEntries, 0.0 );
entropyFlux = 0.0; // Reset temorary flux
for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
entropyFlux = 0.0; // reset temorary flux
for( unsigned idx_neigh = 0; idx_neigh < _neighbors[idx_cell].size(); idx_neigh++ ) {
// Left side reconstruction
if( _reconsOrder > 1 ) {
alphaL = _alpha[idx_cell] +
_solDx[idx_cell] * ( _interfaceMidPoints[idx_cell][idx_neigh][0] - _cellMidPoints[idx_cell][0] ) +
......@@ -115,7 +115,7 @@ Vector MNSolver::ConstructFlux( unsigned idx_cell ) {
}
entropyL = _entropy->EntropyPrimeDual( blaze::dot( alphaL, _moments[idx_quad] ) );
// Store fluxes in psiNew, to save memory
// Right side reconstruction
if( _boundaryCells[idx_cell] == BOUNDARY_TYPE::NEUMANN && _neighbors[idx_cell][idx_neigh] == _nCells )
entropyR = entropyL;
else {
......@@ -130,11 +130,11 @@ Vector MNSolver::ConstructFlux( unsigned idx_cell ) {
entropyR = _entropy->EntropyPrimeDual( blaze::dot( alphaR, _moments[idx_quad] ) );
}
// Entropy flux
entropyFlux += _g->Flux( _quadPoints[idx_quad], entropyL, entropyR, _normals[idx_cell][idx_neigh] );
}
// Solution flux
flux += _moments[idx_quad] * ( _weights[idx_quad] * entropyFlux );
// ------- Relizablity Reconstruction Step ----
}
return flux;
}
......
......@@ -32,6 +32,7 @@ PNSolver::PNSolver( Config* settings ) : Solver( settings ) {
// Initialize Scatter Matrix
_scatterMatDiag = Vector( _nTotalEntries, 0 );
// Initialize temporary storages of solution derivatives
_solDx = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
_solDy = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
......
Markdown is supported
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