get values of a scalar in a matrix
At the moment I am facing the following problem:
Iīve got a cut plane from my 3d grid. At this plane I have liquid at the bottom (alpha = 1) and gas above (alpha = 0). What I want to have is the value of alpha in every cell in a matrix and the matrix has the form of the cut plane. For example, my cut plane is a square. At the bottom Iīve got two rows of cells which are filled with liquid and three rows with gas above it. Iīve got 5 columns. The array looks like this: 0 0 0 0 0 Gas 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 Liquid 1 1 1 1 1 Is it possible to get those matrix of a cut plane calculated with OpenFOAM? I only get a list of coordinates (x,y,z) and alpha after it with sample. Can anybody help? Or has an idea how to get to this point? Thanks a lot |
Is this for post-processing? I had to get the "matrix" look a few months ago the only way that worked for me was to manipulate the data from the list of coordinates using Matlab. First I exported the data, using either a slice in paraView or the alpha1 value and cell centers (using the writeCellCentres utility) from the time directory. Then arrange the x values in ascending order, ensuring that all other columns follow the same arrangement. Then arrange y values in ascending order. Determine the # of x values, and that will be the # of columns in your matrix. Build a matrix that creates a new row each time you reach the final # of x values. Each row corresponds with a y value. Assign your alpha1 values to the matrix. It's a work around, but if you want to do this for many time steps it's easy to import them all and run them through this program since they all have the same format.
|
Greetings to all!
What comes to mind is the following procedure:
Bruno |
Is it possible to use this idea to generate a much smaller data set recording the position of just the interface? (if this is already what this thread describes, apologies for misunderstanding)
What I mean is to output a file which lists for example, the coordinate positions of all the cells whose value of alpha1 lies between 0.01 and 0.99 or something. My guess is that this would be much more quickly rendered in paraview/visit/other post-processing software than the whole dataset, coloured by alpha1, and the only loss would be some pretty colour for the regions with alpha1 =0 or =1. |
Greetings Christian,
AFAIK, there are at least two ways to extract the surface interface between 2 fluids, as defined in the field "alpha":
Best regards, Bruno |
Hello Bruno,
I tried to follow your description, but I have some problems. As far as I understand you I need to create a list of points so that sample can extract the values at these points. (step 6) This list is created with writeCellCentre and topoSet. But I donīt get it. When I did writeCellCentre (step 1), I have in every time-folder the files ccx, ccy and ccz. Do they have to "communicate" with topoSet (step 2)? But what is sample doing then there? (step 3) Could you explain me the steps a bit in detail? Thanks a lot idefix |
Hi idefix,
Sorry about that. I didn't mange to get it a test myself, so I didn't confirm if sample could handle "cellSet"s. I've edited the other post and added the following information: Quote:
Now that I think about it, sample could use the feature to export data from a "cellSet", "faceSet" and/or "pointSet". I'll see what I can do in the next few days. Nonetheless, in the meantime, you can rely on using this command, as explained in post #8 on that other thread: Code:
foamToVTK -cellSet c0 -latestTime -poly As for what topoSet does, you can see and example here: http://www.cfd-online.com/Forums/ope...tml#post467934 post #22. Best regards, Bruno |
Hello Bruno,
thatīs very interesting to know but I have many time steps for which I want to do this postprocessing. So I start to program a little tool which is based on your ideas: The main thing is the following (at the moment I am only interesting in the coordinates and alpha1): Code:
Thanks again for your help. Idefix |
All times are GMT -4. The time now is 22:45. |