Commit 522dde10 authored by gsaxena's avatar gsaxena

Added the 3D_tumor_example_X.cpp example to ./examples to simulate tumor growth.

Added script to plot it plotting_microenv_tumor.py (by Arnau Montagud) in ./matlab
Added script file to run this example as script_3DtumorX.sh
To compile this GS_BioFVM_X/GS_BioFVM> make 3DtumorX and then run using sbatch script_3DtumorX.sh
The main Makefile was modified to incorporate this example.
The executable will need to be deleted manually from the examples directory (before committing to Git)
parent 8753b5a4
This diff is collapsed.
......@@ -11,15 +11,15 @@ CC := mpic++
#For TAU
#CC := tau_cxx.sh
# change this to your own CPU archicture.
# change this to your own CPU archicture.
# Here is a list for gcc 4.9.0
# https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
# https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
ARCH := native # best auto-tuning
# core2 # a reasonably safe choice if native doesn't work
# core2 # a reasonably safe choice if native doesn't work
# ARCH := corei7
# ARCH := corei7-avx # earlier i7
# ARCH := core-avx-i # i7 ivy bridge or newer
# ARCH := corei7-avx # earlier i7
# ARCH := core-avx-i # i7 ivy bridge or newer
# ARCH := core-avx2 # i7 with Haswell or newer
# ARCH := nehalem
# ARCH := westmere
......@@ -29,7 +29,7 @@ ARCH := native # best auto-tuning
# ARCH := broadwell
# ARCH := bonnell
# ARCH := silvermont
# ARCH := nocona #64-bit pentium 4 or later
# ARCH := nocona #64-bit pentium 4 or later
#First for GCC and second for ICPC
......@@ -38,7 +38,7 @@ CFLAGS := -march=$(ARCH) -O2 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -s
BioFVM_OBJECTS := BioFVM_vector.o BioFVM_matlab.o BioFVM_utilities.o BioFVM_mesh.o \
BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_basic_agent.o \
BioFVM_agent_container.o BioFVM_MultiCellDS.o BioFVM_parallel.o
BioFVM_agent_container.o BioFVM_MultiCellDS.o BioFVM_parallel.o
pugixml_OBJECTS := pugixml.o
......@@ -48,43 +48,43 @@ EXAMPLES := ./examples/convergence_test1.cpp ./examples/convergence_test2.cpp \
./examples/convergence_test4_2.cpp ./examples/convergence_test5.cpp \
./examples/performance_test_substrates.cpp \
./examples/performance_test_voxels.cpp \
./examples/performance_test_numcells.cpp
./examples/performance_test_numcells.cpp
COMPILE_COMMAND := $(CC) $(CFLAGS)
COMPILE_COMMAND := $(CC) $(CFLAGS)
all: make_lib
make_lib: $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
make_lib: $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
BioFVM_vector.o: BioFVM_vector.cpp
$(COMPILE_COMMAND) -c BioFVM_vector.cpp
$(COMPILE_COMMAND) -c BioFVM_vector.cpp
BioFVM_agent_container.o: BioFVM_agent_container.cpp
$(COMPILE_COMMAND) -c BioFVM_agent_container.cpp
$(COMPILE_COMMAND) -c BioFVM_agent_container.cpp
BioFVM_mesh.o: BioFVM_mesh.cpp
$(COMPILE_COMMAND) -c BioFVM_mesh.cpp
$(COMPILE_COMMAND) -c BioFVM_mesh.cpp
BioFVM_microenvironment.o: BioFVM_microenvironment.cpp
$(COMPILE_COMMAND) -c BioFVM_microenvironment.cpp
$(COMPILE_COMMAND) -c BioFVM_microenvironment.cpp
BioFVM_solvers.o: BioFVM_solvers.cpp
$(COMPILE_COMMAND) -c BioFVM_solvers.cpp
$(COMPILE_COMMAND) -c BioFVM_solvers.cpp
BioFVM_utilities.o: BioFVM_utilities.cpp
$(COMPILE_COMMAND) -c BioFVM_utilities.cpp
$(COMPILE_COMMAND) -c BioFVM_utilities.cpp
BioFVM_basic_agent.o: BioFVM_basic_agent.cpp
$(COMPILE_COMMAND) -c BioFVM_basic_agent.cpp
$(COMPILE_COMMAND) -c BioFVM_basic_agent.cpp
BioFVM_matlab.o: BioFVM_matlab.cpp
$(COMPILE_COMMAND) -c BioFVM_matlab.cpp
BioFVM_MultiCellDS.o: BioFVM_MultiCellDS.cpp
$(COMPILE_COMMAND) -c BioFVM_MultiCellDS.cpp
BioFVM_parallel.o: BioFVM_parallel.cpp
$(COMPILE_COMMAND) -c BioFVM_parallel.cpp
......@@ -102,23 +102,25 @@ examples: $(BioFVM_OBJECTS) $(pugixml_OBJECTS) $(EXAMPLES)
$(COMPILE_COMMAND) -o ./examples/perf_test_substrates ./examples/performance_test_substrates.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/perf_test_voxels ./examples/performance_test_voxels.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/perf_test_numcells ./examples/performance_test_numcells.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
tutorial1: ./examples/tutorial1_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/tutorial1 ./examples/tutorial1_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
tutorial2: ./examples/tutorial2_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
tutorial2: ./examples/tutorial2_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/tutorial2 ./examples/tutorial2_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
tutorial3: ./examples/tutorial3_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/tutorial3 ./examples/tutorial3_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
main_experiment: ./examples/main_experiment.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
tutorial3: ./examples/tutorial3_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/tutorial3 ./examples/tutorial3_BioFVM.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
main_experiment: ./examples/main_experiment.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/tutorial3 ./examples/main_experiment.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
3DtumorX: ./examples/3D_tumor_example_X.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
$(COMPILE_COMMAND) -o ./examples/3DtumorX ./examples/3D_tumor_example_X.cpp $(BioFVM_OBJECTS) $(pugixml_OBJECTS)
clean:
rm -f *.o
rm -f $(PROGRAM_NAME)*
rm -f ./examples/conv_test*
rm -f ./examples/conv_test*
rm -f ./examples/perf_test*
zip:
zip $$(date +%b_%d_%Y_%H%M).zip *.cpp *.h *akefile* *.xml *.tex *.bib *hanges*.txt config/*.xml *.txt
zip VERSION_$(VERSION).zip *.cpp *.h *akefile* *.xml *.tex *.bib *hanges*.txt *.txt
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If you use BioFVM in your project, please cite BioFVM and the version %
% number, such as below: %
% %
% We solved the diffusion equations using BioFVM (Version 1.1.6) [1] %
% %
% [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient %
% parallelized diffusive transport solver for 3-D biological simulations,%
% Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) %
% %
% Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project %
% All rights reserved. %
% %
% Redistribution and use in source and binary forms, with or without %
% modification, are permitted provided that the following conditions are %
% met: %
% %
% 1. Redistributions of source code must retain the above copyright notice, %
% this list of conditions and the following disclaimer. %
% %
% 2. Redistributions in binary form must reproduce the above copyright %
% notice, this list of conditions and the following disclaimer in the %
% documentation and/or other materials provided with the distribution. %
% %
% 3. Neither the name of the copyright holder nor the names of its %
% contributors may be used to endorse or promote products derived from this %
% software without specific prior written permission. %
% %
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %
% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED %
% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A %
% PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER %
% OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, %
% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, %
% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR %
% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF %
% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING %
% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS %
% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
file_name='initial_concentration.mat';
x=1;y=2;z=3;
needed_plane=[x,y];
crossesction_index=setdiff([1,2,3], needed_plane);
labels={'x','y','z'};
load(file_name);
for i=5:size(multiscale_microenvironment,1)
m=multiscale_microenvironment;
temp= unique(sort(m(crossesction_index,:)));
if length(temp)==1 %2D
temp_median_index=1;
else
temp_median_index=floor(length(temp)/2);
end
temp_median= temp(temp_median_index);
m=m(:,m(crossesction_index,:)==temp_median);
tempx= unique(sort(m(needed_plane(1),:)));
stepx= abs(tempx(1)-tempx(2));
minx=tempx(1)-stepx/2;
maxx=tempx(end)+stepx/2;
tempy= unique(sort(m(needed_plane(2),:)));
stepy= abs(tempy(1)-tempy(2));
miny=tempy(1)-stepy/2;
maxy=tempy(end)+stepy/2;
num_rows= length(tempx);
num_cols= length(tempy);
% scaling the x values to range [1:numrows], the y values to range [1:numcols]
x_scaled= 1+ floor(num_rows*((m(needed_plane(1),:)-minx)/(maxx-minx)));
y_scaled= 1+ floor(num_cols*((m(needed_plane(2),:)-miny)/(maxy-miny)));
c1=sparse(y_scaled, x_scaled,m(i,:));
full_matrix=full(c1);
figure
imagesc(tempx, tempy, full_matrix(end:-1:1,:))
shading flat
colorbar('FontSize', 14)
title(['substrate' num2str(i-4)], 'FontSize', 14)
axis image
h = colorbar();
h1 = get( h , 'ylabel' );
set( h1 , 'string' , 'concentration' )
set( h1, 'fontsize', 12 )
set(gca,'XTick',minx:(maxx-minx)/2:maxx)
set(gca,'YTick',miny:(maxy-miny)/2:maxy)
set(gca,'YTickLabel',{num2str(maxy),num2str((maxy+miny)/2),num2str(miny)})
set(gca,'XTickLabel',{num2str(minx),num2str((minx+maxy)/2),num2str(maxx)})
xlabel([labels{needed_plane(1)},' (\mum)'])
ylabel([labels{needed_plane(2)},' (\mum)'])
end
This diff is collapsed.
# plot_microenvironment.py - plot results from
# http://www.mathcancer.org/blog/biofvm-warmup-2d-continuum-simulation-of-tumor-growth/
import sys
import os.path
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
""" ---- Sample use:
python plotting_microenv.py "filename.mat" z_cut
python plotting_microenv.py "final.mat" 2.025
----------"""
fname = sys.argv[1]
if (os.path.exists(fname) == False):
print("File %s does not exist" % fname)
sys.exit(0)
z = float(sys.argv[2])
info_dict = {}
scipy.io.loadmat(fname, info_dict)
M1 = info_dict['multiscale_microenvironment']
a2 = M1[:,:]
a3 = a2[:,a2[2,:] == z]
a7=a3.T
a6=a7[np.lexsort(( a7[:,1],a7[:,0]))]
fig, axs = plt.subplots(3, figsize=(6,9), dpi=300)
im00 = axs[0].imshow(a6[:,4].reshape(80,80), cmap='jet', extent=[0,4, 0,4])
fig.colorbar(im00, ax=axs[0])
axs[0].set_title("density_1")
im10 = axs[1].imshow(a6[:,5].reshape(80,80), cmap='jet', extent=[0,4, 0,4])
fig.colorbar(im10, ax=axs[1])
axs[1].set_title("density_2")
im20 = axs[2].imshow(a6[:,6].reshape(80,80), cmap='jet', extent=[0,4, 0,4])
fig.colorbar(im20, ax=axs[2])
axs[2].set_title("density_3")
fig.savefig( fname.replace(".mat", "") + '.png')
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=2
#SBATCH --cpus-per-task=24
#SBATCH -t 00:60:00
#SBATCH -o output-%j
#SBATCH -e error-%j
#SBATCH --exclusive
export OMP_DISPLAY_ENV=true
export OMP_NUM_THREADS=24
export OMP_PROC_BIND=spread
export OMP_PLACES=threads
mpiexec --map-by ppr:1:socket:pe=24 --report-bindings ./examples/3DtumorX
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment