@@ -115,7 +115,7 @@ bool AxialConvectionDispersionOperatorBaseDG::configureModelDiscretization(IPara
115
115
116
116
paramProvider.pushScope (" discretization" );
117
117
_OSmode = 0 ;
118
- _maxBlending = 0 .0 ;
118
+ _maxBlending = 1 .0 ;
119
119
_blendingThreshold = 0.0 ;
120
120
_troubledCells = nullptr ;
121
121
@@ -128,7 +128,10 @@ bool AxialConvectionDispersionOperatorBaseDG::configureModelDiscretization(IPara
128
128
129
129
const bool write_smoothness_indicator = paramProvider.exists (" RETURN_SMOOTHNESS_INDICATOR" ) ? static_cast <bool >(paramProvider.getInt (" RETURN_SMOOTHNESS_INDICATOR" )) : false ;
130
130
if (write_smoothness_indicator)
131
+ {
131
132
_troubledCells = new double [nCells * nComp];
133
+ std::fill (_troubledCells, _troubledCells + nCells * nComp, 0.0 );
134
+ }
132
135
133
136
std::string smoothness_indicator = paramProvider.exists (" SMOOTHNESS_INDICATOR" ) ? paramProvider.getString (" SMOOTHNESS_INDICATOR" ) : " MODAL_ENERGY_LEGENDRE" ;
134
137
@@ -501,7 +504,9 @@ int AxialConvectionDispersionOperatorBaseDG::residualImpl(const IModel& model, d
501
504
_troubledCells[comp + cell * _nComp] = std::min (_maxBlending, _smoothnessIndicator->calcSmoothness (y + offsetC () + comp + cell * _strideCell, _strideNode, _nComp, cell));
502
505
if (_troubledCells[comp + cell * _nComp] < _blendingThreshold)
503
506
_troubledCells[comp + cell * _nComp] = 0.0 ;
504
- else if (_smoothnessIndicator->timeRelaxation ()) // note: 0.0 <-> no relaxation
507
+ else if (1.0 - _troubledCells[comp + cell * _nComp] < _blendingThreshold)
508
+ _troubledCells[comp + cell * _nComp] = 1.0 ;
509
+ else if (_smoothnessIndicator->timeRelaxation ()) // note: 0.0 <-> no time relaxation
505
510
_troubledCells[comp + cell * _nComp] = std::max (_smoothnessIndicator->timeRelaxation () * oldIndicator, _troubledCells[comp + cell * _nComp]);
506
511
}
507
512
// if (_OSmode == 1) // WENO
@@ -559,14 +564,19 @@ int AxialConvectionDispersionOperatorBaseDG::residualImpl(const IModel& model, d
559
564
// ========================================//
560
565
561
566
// Calculate the substitute h(g(c), c) and apply inverse mapping jacobian (reference space)
562
- if (DGblending < 1. 0 )
567
+ if (_OSmode != 0 )
563
568
{
564
- for (int cell = 0 ; cell < _nCells; cell++)
565
- _h.segment (cell * _nNodes, _nNodes) = 2.0 / static_cast <ParamType>(_deltaZ) * (-u * _C.segment (cell * _nNodes, _nNodes) * (1.0 - _troubledCells[comp + cell * _nComp])).template cast <ResidualType>();
566
- _h += (2.0 / static_cast <ParamType>(_deltaZ) * d_ax * (-2.0 / static_cast <ParamType>(_deltaZ)) * _g).template cast <ResidualType>();
569
+ if (DGblending < 1.0 )
570
+ {
571
+ for (int cell = 0 ; cell < _nCells; cell++)
572
+ _h.segment (cell * _nNodes, _nNodes) = 2.0 / static_cast <ParamType>(_deltaZ) * (-u * _C.segment (cell * _nNodes, _nNodes) * (1.0 - _troubledCells[comp + cell * _nComp])).template cast <ResidualType>();
573
+ _h += (2.0 / static_cast <ParamType>(_deltaZ) * d_ax * (-2.0 / static_cast <ParamType>(_deltaZ)) * _g).template cast <ResidualType>();
574
+ }
575
+ else
576
+ _h = 2.0 / static_cast <ParamType>(_deltaZ) * (-u * _C * DGblending + d_ax * (-2.0 / static_cast <ParamType>(_deltaZ)) * _g).template cast <ResidualType>();
567
577
}
568
578
else
569
- _h = 2.0 / static_cast <ParamType>(_deltaZ) * (-u * _C * DGblending + d_ax * (-2.0 / static_cast <ParamType>(_deltaZ)) * _g).template cast <ResidualType>();
579
+ _h = 2.0 / static_cast <ParamType>(_deltaZ) * (-u * _C + d_ax * (-2.0 / static_cast <ParamType>(_deltaZ)) * _g).template cast <ResidualType>();
570
580
571
581
// DG volume integral in strong form
572
582
volumeIntegral<ResidualType, ResidualType>(_h, _resC);
0 commit comments