FS#29 Only reassmble the global stiffness matrix partially
Metadata
Property |
Value |
Project |
dumux |
Category |
Implicit models |
Reported by |
Anonymous (Id=0) |
Reported at |
Dec 3, 2009 10:10 |
Type |
Feature Request |
Version |
Git |
Last edited by |
Anonymous (Id=1) |
Last edited at |
Aug 17, 2010 08:21 |
Closed by |
Anonymous (Id=1) |
Closed at |
Aug 17, 2010 08:21 |
Closed in version |
unknown (Id=0) |
Resolution |
Implemented |
Description
A potentially huge speed-up could be achieved if the global stiffness matrix would only be reassembled for finite elements which are adjacent to boxes where the relative error is still above the threshold. for any other element, simply returning the stiffness matrix of the last newton iteration would be sufficient.
In pseudo-code the approach looks like this:
bool reassembleElement[grid.numElements()];
void MarkElements(NewtonDeltaVector deltaVec)
{
for (element in grid.elements()) {
reassembleElement[element.index()] = false;
for (vertex in element.vertices()) {
if (deltaVec.aboveThreshold(vertex)) {
reassembleElement[element.index()] = true;
}
}
}
}
void AssembleLocalJacobian(Element element)
{
if (reassembleElement[element.index()]) {
doFullLocalAssemble(element);
return;
}
for (vertexI in element.vertices()) {
for (vertexJ in element.vertices()) {
localStiffness[vertexI.localIndex()][vertexJ.localIndex()]
= lastGlobalStiffness[vertexI.globalIndex()][vertexJ.globalIndex()];
// make sure to return a null matrix for the next element
lastGlobalStiffness[vertexI.globalIndex()][vertexJ.globalIndex()] = 0;
}
}
}