Channelflow 2.0

FlowField class memory management

Hi all,

I was doing a computation which involved calling a series of FlowFields in a loop and the minimal code was something as follows:

for (Real ta = 0; ta <= T; ta += n * dt) {
          for (Real tb = 0; tb <= T; tb += n * dt){
            string ua_name = "u" + t2s(ta, 1);
            string ub_name = "u" + t2s(tb, 1);
            FlowField ua("data/" + ua_name);
           FlowField ub("data/" + ub_name);

            // do something with ua and ub


I noticed that it crashed after some time. When I ran the `top’ command on my linux system, I realized that there might be some memory issues with the FlowField class of Channelflow 2.0.

For demonstration, I have created a minimal example for chflow FlowField memory leak ( click here), which I added to the examples directory. The example first generates a time-series for the Couette flow and then loops through the fields and adds them as ua + ub.

When I did some digging, I realized that there is no destructor in the current FlowField class. I am not sure how the memory is being managed and how this issue can be resolved.

Any help is appreciated. Thanks and take care.