Ivar KJELBERG
COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
Jan 22, 2011, 2:30 a.m. EST
Hi
for me this is something I believe only COMSOL can clarify (but we all are certainly interested to know) What I have her is that its evaluated once, but with V4 and all the different solver combinations it might not be always true.
When you say you integrate that means that the value is an average one, and its constant over the domain w.r.t time and not evolving locally ?
There is always this issue between distributed evolution of a varaible (per element) and the gobal averages or integrated value one mut distinguish
--
Good luck
Ivar
Hi
for me this is something I believe only COMSOL can clarify (but we all are certainly interested to know) What I have her is that its evaluated once, but with V4 and all the different solver combinations it might not be always true.
When you say you integrate that means that the value is an average one, and its constant over the domain w.r.t time and not evolving locally ?
There is always this issue between distributed evolution of a varaible (per element) and the gobal averages or integrated value one mut distinguish
--
Good luck
Ivar
Andrew Prudil
Nuclear Materials
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
Jan 24, 2011, 11:31 a.m. EST
The value of the spatial integral is global, it does not change locally. I'm using an equation (which varies locally) of which one of the inputs is an integral over the spatial domain. It seems that if you define it this way it causes SIGNIFICANT slow down on the assembling equations steps of the solver.
After a session of trial and error, I believe that "equations" are evaluated each and EVERY time they are needed, WITHOUT storing the results. Meaning that if you have values which do not change locally, you may be computing things unnecessarily at each point.
That being said, the this seems to usually account for a small portion of the total solution time. I believe this effect is usually small, except in cases where the computation time for a single evaluation is expensive (like for example integrating over a domain with a large number of mesh points, which results in a significant number of memory calls slowing everything down). These equations only seem to be evaluated between iterations to produce the value (and the derivatives for the Jacobian). Since most of the computation time for my model is in matrix inversion, they have little effect on the speed (with the notable exception of this spatial integral).
SOLUTION
I believe I have found a solution to slow down caused by the integration which is the "Global Variables" (the ODE physics mode). This application mode does not need to be used to solve ODEs, it can be used for other things like computing a value once per iteration. This is what I did, I used the ODE mode to perform the integration and assign it a variable, then I used the resulting variable in the rest of my model. Solved the problem wonderfully.
The value of the spatial integral is global, it does not change locally. I'm using an equation (which varies locally) of which one of the inputs is an integral over the spatial domain. It seems that if you define it this way it causes SIGNIFICANT slow down on the assembling equations steps of the solver.
After a session of trial and error, I believe that "equations" are evaluated each and EVERY time they are needed, WITHOUT storing the results. Meaning that if you have values which do not change locally, you may be computing things unnecessarily at each point.
That being said, the this seems to usually account for a small portion of the total solution time. I believe this effect is usually small, except in cases where the computation time for a single evaluation is expensive (like for example integrating over a domain with a large number of mesh points, which results in a significant number of memory calls slowing everything down). These equations only seem to be evaluated between iterations to produce the value (and the derivatives for the Jacobian). Since most of the computation time for my model is in matrix inversion, they have little effect on the speed (with the notable exception of this spatial integral).
SOLUTION
I believe I have found a solution to slow down caused by the integration which is the "Global Variables" (the ODE physics mode). This application mode does not need to be used to solve ODEs, it can be used for other things like computing a value once per iteration. This is what I did, I used the ODE mode to perform the integration and assign it a variable, then I used the resulting variable in the rest of my model. Solved the problem wonderfully.