phydev / angio

Developing a 3D phase-field modelling for tumor angiogenesis
http://phydev.github.io/angio
GNU General Public License v2.0
1 stars 2 forks source link

postprocessing issue #4

Open dpdclub opened 1 week ago

dpdclub commented 1 week ago

Dear Maurício,

We run into some issue when postprocessing the results, after remove all the space within the file name, we tried to run run_get, but it awlays gave us error as follows, do you have a clue of why this is happening,

Thanks a lot,

:~/Desktop/tumor/angio-master$ ./run_get
 initial file, last_file, delta, dir_name:
10, 50 ,10, 001 
 ---------------------------------------------------------
                       get_data_m module

  This program calculate the mean diameter and the
  the number of branches for each time step of a
  simulation and plot two graphs as a function of time.
 ---------------------------------------------------------
Calculating . . .
          10
wc: 001/phi: No such file or directory
wc: 10.xyz: No such file or directory
wc: 001/phis: No such file or directory
wc: 10.xyz: No such file or directory
          20
wc: 001/phi: No such file or directory
wc: 20.xyz: No such file or directory
wc: 001/phis: No such file or directory
wc: 20.xyz: No such file or directory
          30
wc: 001/phi: No such file or directory
wc: 30.xyz: No such file or directory
wc: 001/phis: No such file or directory
wc: 30.xyz: No such file or directory
          40
wc: 001/phi: No such file or directory
wc: 40.xyz: No such file or directory
wc: 001/phis: No such file or directory
wc: 40.xyz: No such file or directory
          50
wc: 001/phi: No such file or directory
wc: 50.xyz: No such file or directory
wc: 001/phis: No such file or directory
wc: 50.xyz: No such file or directory
At line 121 of file run_get.F90 (unit = 16, file = 'plot_file.aux')
Fortran runtime error: Cannot write to file opened for READ
phydev commented 5 days ago

Hi,

The error says that the program cannot find your files in the specified location. You're probably running the script in the wrong folder.

Check out the path where the data is expected to be, relative to the script location in the source code:

https://github.com/phydev/angio/blob/c4b3988ca5f2e3c2bdc7ea6d892f68d271028bc1/tools/run_get.F90#L63

dpdclub commented 5 days ago

Hi Maurício,

Thanks for your reply. Another question is how do you visualize the results and make a plot like what you have shown in the front page of this github page.

Thanks,

phydev commented 5 days ago

I suggest you to use VisIt or Paraview to make 3D visualisations. In my opinion VisIt is the best, but I know some people prefer Paraview. :)

I have a script to convert XYZ to VTI format:

https://github.com/phydev/scripts/blob/master/xyz2vti.py

dpdclub commented 5 days ago

Thanks for providing this information. Could you also please help me to clarify what are stored in phi.xyz, phis.xyz, t.xyz and ti.xyz, respectively.

phydev commented 5 days ago

If I remember correctly, these files are generated in the last step of the simulation. All of them are organised with the CSV format and have four columns with the spatial coordinates $(x,y,z)$ and a fourth column with different fields. The files with suffix i identify the initial condition. Numbered files are snapshots of the system in transient states along the simulation, the numbers are time steps.

See Fig. 1 of the paper:

Figure1

dpdclub commented 5 days ago

Got it. Thanks for the explaination. How do you connect the ϕ in phi.xyz with the diameter of the vessels

phydev commented 4 days ago

What do you mean? How is the mean diameter computed?

We have the total volume occupied by the vessels (all points where $phi$>0), the number of vessels, and the length of the vessels, all obtained from the thinning algorithm. You can define the total volume occupied by the number of vessels to obtain the mean vessel volume. If you assume that the vessels are cylindrical you can use basic geometry to obtain the diameter: https://github.com/phydev/angio/blob/c4b3988ca5f2e3c2bdc7ea6d892f68d271028bc1/tools/run_get.F90#L111

We cleaned up the data by removing volume relative to very short vessels (we named it dead_volume): https://github.com/phydev/angio/blob/c4b3988ca5f2e3c2bdc7ea6d892f68d271028bc1/tools/get_data_m.F90#L374

dpdclub commented 4 days ago

I mean the way to assess the diameter of new vessels at different locations like ϕ . The reason I am asking is that I want to run simulate the blood flow and how the red blood cells are transporting within this newly generated vessels. Or It would be easier if I can extract the boundary of the newly generated new vessels from the results so I can perfuse blood within these vessels using my solver, please let me know if this is doable.

Thanks,

phydev commented 4 days ago

You can extract the boundaries, since it is well defined by the region of phase transition between the interior and the exterior of the vessels. However, modelling red blood cells is costly due to the computation of the Canham-Helfrich functional to model the membrane. Integrating everything at the same time can be challenging because of different time scales across the membrane relaxation, the blood vessels growth, and the advection. Maybe a sharp interface model for the vessels could work better? I'm not sure, but it's certainly an interesting problem.

I recently left academia, but the last master student I co-supervised modelled red blood cells, so it can useful to look up his thesis or other published works from the main supervisor lab (his thesis will be available online soon.)

The PI, my former PhD supervisor, is always looking forward for new collaborations, so I also recommend to keep in touch with him if you are interested (he is super nice!): https://biologicalmodelling.com/

https://scholar.google.pt/citations?hl=en&user=GCWOijAAAAAJ&view_op=list_works&sortby=pubdate

dpdclub commented 4 days ago

Great to hear your thoughts and thanks for making the connection. I plan to extract the boundary and simulate blood flow using an different solver, not the phase-field. With the current postpreocess tools you provided, could we extract the boundary from the phi.xyz files? Also, in the input, how do we specify which rule of deactivating the hypoxic cells will be used, like the rule 1 and 2 introduced in the paper. Also how to specify the initial number of the hypoxic cells or the number of VEGF sources in the simulation system.

Thanks,

phydev commented 3 days ago

With the current postprocess tools you provided, could we extract the boundary from the phi.xyz files?

No, I haven't implemented that feature. VisIt and Paraview can identify and render the boundaries automatically, if you need it for subsequent computations you will need to implement yourself according to the method you will use to model the red blood cells.

Also, in the input, how do we specify which rule of deactivating the hypoxic cells will be used, like the rule 1 and 2 introduced in the paper. Also how to specify the initial number of the hypoxic cells or the number of VEGF sources in the simulation system.

That is documented in the README.md. The variable flow_FT (boolean) activate and deactivate the blood flow computation. If activated, the VEGF production is regulated by the presence of blood flow.

Change source_max to specify the maximum number of VEGF sources in the system, we don't set the exact final number because the cells are placed randomly in the box. You can modify the code to add the cells in an ordered manner though, if that is important.

dpdclub commented 1 day ago

Hi Maurício,

Thank you very much for these clarifications. One more question on the periodicity, if I turn on the flag periodic_FT, it means the simulation box is periodic in all the x y z direction or only on the z direction? I see the code comments that if Periodic, it becomes ndim =2, does it mean that there will be no spacial variation along the z direction like the 2D example in the paper? What happens if Periodic flag is off and the new vessels to the boundary of the simulation box, do they just stop growing?.

phydev commented 1 day ago

I think I implemented reflective boundary conditions in the Z-axis when Periodic is False. This keeps the main vessel in the cilindrical stable solution while avoiding vessels crossing up and down the simulation box. But I think all simulations I ran were with periodic conditions on the 3 directions.