Skip to content

Commit 521a310

Browse files
committed
Add switch to deactivate checking of LSMatrix
1 parent ed9dc2f commit 521a310

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ FoamFile
116116
// inverse can have. Only change if you know what you
117117
// are doing!
118118

119+
checkCondition false;// Check the condition of the pseudo inverse matrix
120+
// If the central stencil has at least one zero entry
121+
// the matrix is removed for all stencils of this cell.
119122
// ************************************************************************* /
120123
```
121124

libWENOEXT/WENOBase/WENOBase.C

+11-2
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,16 @@ Foam::scalarRectangularMatrix Foam::WENOBase::calcMatrix
548548

549549
scalarRectangularMatrix AInv = svdCurrPtr->VSinvUt();
550550

551-
if (stencilI == 0 && svdCurrPtr->nZeros() != 0)
551+
if (checkCondition_ && stencilI == 0 && svdCurrPtr->nZeros() != 0)
552552
{
553553
deleteStencil(localCellI,stencilI);
554554
stencilsID_[localCellI][stencilI][0] = int(Cell::empty);
555+
return scalarRectangularMatrix
556+
(
557+
nDvt_,
558+
nCells,
559+
scalar(0.0)
560+
);
555561
}
556562

557563
if (AInv.n() != stencilSize-1)
@@ -697,6 +703,8 @@ Foam::WENOBase::WENOBase
697703

698704
maxCondition_ = WENODict.lookupOrAddDefault<scalar>("maxCondition",1e-05);
699705

706+
checkCondition_ = WENODict.lookupOrAddDefault<Switch>("checkCondition",true);
707+
700708
// ------------- Initialize Lists --------------------------------------
701709

702710
stencilsID_.setSize(localMesh.nCells());
@@ -773,7 +781,8 @@ Foam::WENOBase::WENOBase
773781

774782
}
775783

776-
LSMatrixCheck();
784+
if (checkCondition_)
785+
LSMatrixCheck();
777786

778787

779788
Info << "\t5) Calcualte smoothness indicator B..."<<endl;

libWENOEXT/WENOBase/WENOBase.H

+5
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ class WENOBase
168168
//- Lists of oscillation matrices for each stencil of each cell
169169
List<geometryWENO::DynamicMatrix> B_;
170170

171+
//- Switch to check the condition of the first stencil of the
172+
// pseudo inverse matrices.
173+
// If true it removes the matrix if the central stencil has at least
174+
// one zero entry. (Default is true)
175+
Switch checkCondition_;
171176

172177
//- Private member functions
173178

0 commit comments

Comments
 (0)