I have a large RF simulation, and I need to get the value of the electric field on a rather dense rectilinear grid. For this, I have been using mphinterp. However, I have been running into the problem that if I make the grid too large I run out of heap memory.
At first I thought that this was due to evaluating too many points simultaneously, so I split the evaluations up but got the same problem. I played around with this a bit and noticed that ANY call to mphinterp seems to permanently (as far as I can tell) increase the amount of RAM being used by comsolserver.exe. So, even if I call mphinterp at a single point over and over the RAM being used by COMSOL will steadily increase until I hit my heap limit and get an error. At this point, trying to do pretty much anything with my model returns the out of memory error, since there seems to be no way to unallocate this RAM, and I have to quit and restart COMSOL.
This is quite a problem for me, since I do in fact need a large number of points in this grid. I can manually set the heap allocation to be larger, but I'm rather curious why this is occurring in the first place. As far as I can determine from the documentation mphinterp is supposed to interpolate the value of a given expression based on the existing solution vector, so I see no reason why it should need to permanently increase the amount of memory used by the model.
Does anyone know why this is happening? Is this a bug (memory leak, or something else)? If not, is there any way to free up the memory used once I have the interpolated values?
At first I thought that this was due to evaluating too many points simultaneously, so I split the evaluations up but got the same problem. I played around with this a bit and noticed that ANY call to mphinterp seems to permanently (as far as I can tell) increase the amount of RAM being used by comsolserver.exe. So, even if I call mphinterp at a single point over and over the RAM being used by COMSOL will steadily increase until I hit my heap limit and get an error. At this point, trying to do pretty much anything with my model returns the out of memory error, since there seems to be no way to unallocate this RAM, and I have to quit and restart COMSOL.
This is quite a problem for me, since I do in fact need a large number of points in this grid. I can manually set the heap allocation to be larger, but I'm rather curious why this is occurring in the first place. As far as I can determine from the documentation mphinterp is supposed to interpolate the value of a given expression based on the existing solution vector, so I see no reason why it should need to permanently increase the amount of memory used by the model.
Does anyone know why this is happening? Is this a bug (memory leak, or something else)? If not, is there any way to free up the memory used once I have the interpolated values?