|
[Sponsors] |
Is there a trigger that tells me whether the matrix has changed |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 293
Rep Power: 23 ![]() |
I am looking for a (boolean) trigger that tells me whether the matrix has changed since the last check to be able to cache and re-use data.
The idea is to toggle between true and false and re-use data as often as possible to avoid expensive re-calculations. Is there something like that? |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Member
Amirhossein Taran
Join Date: Sep 2016
Location: Dublin, Ireland
Posts: 65
Rep Power: 10 ![]() |
Quote:
Hi Klaus, I don't understand why you can't define this boolean yourself. e.g. comparing the matrix with itself shows whether it has changed or not! Regards, Amir. |
||
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Junchao Zhang
Join Date: Jan 2025
Location: U.S.
Posts: 15
Rep Power: 2 ![]() |
Wow, I also had the same question. To compare, you need to save the old matrix. There is a cost in saving the matrix and then comparing. We want to avoid the cost.
|
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 293
Rep Power: 23 ![]() |
The point is indeed, that comparing entire matrices has a significant impact on data storage requirements and overall performance even when using hash algorithms and I am looking for ways to speed simulations up.
|
|
![]() |
![]() |
![]() |
![]() |
#5 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,310
Rep Power: 36 ![]() ![]() |
Quote:
Just save the sum of diagonals and sum of off diagonals in two variables. Just compare these two values and see if they changed above a thresold. You can also add, min, max of dia and min max of off diagonals. This was you do not need to store last matrix. |
||
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
Junchao Zhang
Join Date: Jan 2025
Location: U.S.
Posts: 15
Rep Power: 2 ![]() |
I feel all these approach are unsafe with respect to false positive, i.e., the sums of entries of two matrices are equal but the two matrices are not equal.
|
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,310
Rep Power: 36 ![]() ![]() |
||
![]() |
![]() |
![]() |
![]() |
#8 |
New Member
Junchao Zhang
Join Date: Jan 2025
Location: U.S.
Posts: 15
Rep Power: 2 ![]() |
It depends on the design. For example, in petsc a matrix has a two integer attributes: state and nonzerostate. Whenever the sparsity pattern changed, the nonzerostate is increased; and whenever an operation modifying matrix values is called, the state is increased. With that, one can easily and safely detect matrix changes.
|
|
![]() |
![]() |
![]() |
![]() |
#9 | |
Senior Member
|
Quote:
2/ When is matrix assembly a computational bottleneck? |
||
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 293
Rep Power: 23 ![]() |
@dlahaye
1/ I think it is save to assume that the matrix changes at every inner iteration of e.g. a SIMPLE iteration. You might this be looking for deviations from this rule; >> Not really, it depends on the simulation type, e.g. moving mesh... 2/ When is matrix assembly a computational bottleneck? >> It's not. A matrix change, changes the eigenvalues, which triggers computationally expensive re-calculations which I want to keep to a minimum |
|
![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,310
Rep Power: 36 ![]() ![]() |
Quote:
Then i think you do not understand the problem that has been discussed. Every iteration an operation modiying the matrix IS performed thanks to descretization. What we are talking about is matrix being same as last iteration that one obtained after descretization. This matrix will stop to be different once the convergence is achieved. |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Access and modify zero matrix coefficient | thang_cegroup | OpenFOAM Programming & Development | 0 | April 16, 2019 23:01 |
Problem simulating the temperature rise in a composite material (chtMultiRegionFoam) | Adam_K | OpenFOAM Running, Solving & CFD | 2 | March 27, 2019 06:51 |
How can I get the number of elements per row form the matrix? | klausb | OpenFOAM Programming & Development | 2 | December 30, 2018 15:27 |
Changing viewfactor Model and use the changed my model by calling "mySolver" | FabianF | OpenFOAM Programming & Development | 2 | January 14, 2014 11:25 |
How to find the product of A+ matrix and A- matrix | arjun shanker | Main CFD Forum | 0 | November 12, 2010 22:12 |