lukasbystricky / Stokes2D

Code to simulate two-dimensional Stokes flow using boundary integral equations
3 stars 2 forks source link

crash within mex_SQ_slp_velocity_grad.cpp #1

Open A-DCA opened 7 months ago

A-DCA commented 7 months ago

Hi,

I am interested in your code and I am playing with it to see whether I may use it for my research.

I compiled C codes Mingw6.3 for Matlab2023b and then run demo_periodic_pouseille_flow.m . I seemd to work fine till evaluate_velocity_gradient(solution, X, Y), within which it crashed at mex_SQ_slp_velocity_grad(...).

In that C code, it worked fine but the crash seems to be inside the loop after line 183 within if(!accuracy) { ...}. That crash occurred after 14th iteration based on mexPrintf display. It can be repeated. When I set 'accuracy' to true, the program finished successfully.

What is likely the cause to this crash? Any help is highly appreciated.

Kind regards, Jingsheng Ma, Heriot-Watt University

lukasbystricky commented 6 months ago

Hi,

Sorry for the late reply. Unfortunately this code hasn't been actively maintained so I'm not sure I'll be able to give you a perfect answer, but I can try and give some hints at least. The code isn't as well commented as it should be so it's probably not easy to understand.

First of all, the check on line 183 is essentially checking whether or not special quadrature is needed. So by setting accurate to true, you're essentially disabling the special quadrature. The code loops over all target points, so the fact that it's crashing after 14 times means that one of the target points is problematic in some way. I can't really say off the top of my head why that would be, unless you modified the problem in some way. If you set accurate to true, and everything runs, do the results look reasonable?