IsoSurface to generate a contour ?
I would really like to generate contour plots as:
http://people.cst.cmich.edu/yelam1k/asee/proceedings/2018/1/36.pdf
Can this be done in anyway in DualSPHysics?
Kind regards
I would really like to generate contour plots as:
http://people.cst.cmich.edu/yelam1k/asee/proceedings/2018/1/36.pdf
Can this be done in anyway in DualSPHysics?
Kind regards
Comments
Yes, I manage to make contour plots with the MeasureTool of DualSPHysics. With measure points on a rectangular plane with a high enough resolution these kinds of plots are possible. I wrote a Matlab script that generates a 'fpoints.txt' file (input for the MeasureTool) with all point coordinates in a plane (or planes) by giving it: [X_min, X_max], [Y_min, Y_max] (and [Z_min, Z_max]) and resolution steps Δx and Δy (Δz). I attach the Matlab code as a .txt file (the .m extension is not supportet here) and you can copy it into a Matlab script. You can make an arbitrary amount of coordinates within seconds with this, but I suggest not making more then 10^6 due to the MeasureTool runtime.
For example, I made a contour plot on a 1m x 2m plane with a resolution Δx = Δy = 0.002 (≈5*10^5 coordinate points). The result is this:
I hope you have access to Matlab, otherwise you can re-write the code into a python script (or I can do it for you).
Thank you @Hannes ! That is so nice.
Would you mind doing a Python version if you have time? I think it would benefit alot of us, both students and companies, and I must say the picture you made looks great!
I have used Matlab previously a lot, but I would prefer a Python version, due to the ease of sharing etc. Perhaps this / a similar approach could be bundled into DualSPHysics @Alex ?
Kind regards, Ahmed
Here is the same code in Python. In the first 10 lines you can specify the domain (X_min/max, Y_min/max, Z_min/max) and the resolution steps (Δx, Δy, Δz). It produces the same 'fpoints.txt' file as the Matlab code above, which is a list of all intersecting coordinates from the specified domain. In conjunction with the MeasureTool one can evaluate the flow variables in a plane (or planes) and generate contour plots. (Again, I am uploading the python code as a .txt file, the .py extension is not supported):
Have fun,
Hannes
Thank you very much @Hannes !
I wish I could upvote posts on this forum :-)
I look forward to playing around with it and using it with the measure tool.
Kind regards