tag:blogger.com,1999:blog-51995677772452792024-02-07T01:38:32.730-08:00Paul Macklin's Math Cancer LabDedicated to developing patient-calibrated mathematical models that help improve clinical care.Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-5199567777245279.post-83159376134613902092016-08-10T01:00:00.001-07:002016-08-10T01:00:17.383-07:00Moving the blog to MathCancer.orgHi, everyone!<br />
<br />
<a href="http://www.blogger.com/">Blogspot</a> has been a great platform for me, but in the end, editing posts with source code and mathematics has been too much of a headache in the neglected blogspot and google UIs.<br />
<br />
Elsewhere in the universe, <a href="https://wordpress.com/">WordPress</a> has developed and encouraged a great ecosystem of plugins that let you do LaTeX and code syntax highlighting directly in your posts with ease. I can't spend hours and hours on fixing mangled posts. It's time to move on.<br />
<br />
So as of today, I am moving to a self-hosted blog at <a href="http://mathcancer.org/blog/">http://MathCancer.org/blog/</a><br />
<br />
I will leave old posts here and gradually migrate them over to <a href="http://mathcancer.org/blog">MathCancer.org/blog</a>. Thanks for following me over the last few years.<br />
<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-625564820468438132016-02-24T07:02:00.001-08:002016-02-29T07:47:14.282-08:00Saving MultiCellDS data from BioFVM<i><b>Note:</b> This is the fifth in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a>. </i><br />
<h2>
Introduction</h2>
A major initiative for my lab has been <a href="http://multicellds.org/">MultiCellDS</a>: a standard for multicellular data. The project aims to create model-neutral representations of simulation data (for both discrete and continuum models), which can also work for segmented experimental and clinical data. A single-time output is called a <i>digital snapshot</i>. An <a href="http://multicellds.org/Team.php#review_panel">interdisciplinary, multi-institutional review panel</a> has been hard at work to nail down the draft standard.<br />
<br />
A BioFVM MultiCellDS digital snapshot includes program and user metadata (more information to be included in a forthcoming publication), an output of the microenvironment, and any cells that are secreting or uptaking substrates. <br />
<br />
As of <a href="https://sourceforge.net/projects/biofvm/files/BioFVM/BioFVM%201.1.0/">Version 1.1.0</a>, BioFVM supports output saved to MultiCellDS XML files. Each download also includes a matlab function for importing MultiCellDS snapshots saved by BioFVM programs. This tutorial will get you going.<br />
<br />
BioFVM (finite volume method for biological problems) is an open source code for solving 3-D diffusion of 1 or more substrates. It was recently published as open access in <i>Bioinformatics</i> here:<br />
<br />
<a href="http://dx.doi.org/10.1093/bioinformatics/btv730">http://dx.doi.org/10.1093/bioinformatics/btv730</a><br />
<br />
The project website is at <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a>, and downloads are at<br />
<a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a>.<br />
<h2>
Working with MultiCellDS in BioFVM programs</h2>
We include a MultiCellDS_test.cpp file in the examples directory of every BioFVM download (Version 1.1.0 or later). Create a new project directory, copy the following files to it:<br />
<br />
BioFVM*.cpp and BioFVM*.h (from the main BioFVM directory)<br />
pugixml.* (from the main BioFVM directory)<br />
Makefile and MultiCellDS_test.cpp (from the examples directory)<br />
<br />
Open the MultiCellDS_test.cpp file to see the syntax as you read the rest of this post.<br />
<br />
See <a href="http://mathcancer.blogspot.com/2016/02/saving-multicellds-data-from-biofvm.html#tutorials">earlier tutorials (below)</a> if you have troubles with this.<br />
<h3>
Setting metadata values</h3>
There are few key bits of metadata. First, the program used for the simulation (all these fields are optional):<br />
<br />
<span style="color: red;">// the program name, version, and project website:</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.program_name = "BioFVM MultiCellDS Test";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.program_version = "1.0";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.program_URL</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "http://BioFVM.MathCancer.org";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: red;">// who created the program (if known)</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.surname = "Macklin";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.given_names = "Paul";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.email = "Paul.Macklin@usc.edu";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.URL </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "http://BioFVM.MathCancer.org"; </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.organization </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "University of Southern California";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.department </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "Center for Applied Molecular Medicine";</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.creator.ORCID = "0000-0002-9925-0151";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: purple; font-family: "courier new" , "courier" , monospace;"><br /></span></span>
<span style="color: red;">// (generally peer-reviewed) citation information for the program </span><br />
<div>
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.DOI </span></div>
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> =</span><span style="color: purple; font-family: "courier new" , "courier" , monospace;"> "10.1093/bioinformatics/btv730";</span><span class="Apple-tab-span" style="color: purple; font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.PMID = "26656933";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.PMCID = "PMC1234567";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.text </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "A. Ghaffarizaeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient parallelized diffusive transport solver for 3-D biological simulations, Bioinformatics, 2015. DOI: 10.1093/bioinformatics/btv730.";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.notes = "notes here";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.program.citation.URL </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "http://dx.doi.org/10.1093/bioinformatics/btv730";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<br />
<span style="color: red;">// user information: who ran the program </span><br />
<div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.surname = "Kirk";</span></div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.given_names = "James T.";</span></div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.email = "Jimmy.Kirk@starfleet.mil";</span></div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.organization = "Starfleet";</span></div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.department = "U.S.S. Enterprise (NCC 1701)";</span></div>
<div>
<span style="color: purple;">BioFVM_metadata.program.user.ORCID = "0000-0000-0000-0000";</span></div>
<div style="color: red;">
<br /></div>
</div>
<div style="color: red;">
// And finally, data citation information (the publication where this simulation snapshot appeared)</div>
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.DOI = "10.1093/bioinformatics/btv730";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.PMID = "12345678";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.PMCID = "PMC1234567";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.text </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "A. Ghaffarizaeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient parallelized diffusive transport solver for 3-D biological simulations, Bioinformatics, 2015. DOI: 10.1093/bioinformatics/btv730.";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.notes = "notes here";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.data_citation.URL </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> = "http://dx.doi.org/10.1093/bioinformatics/btv730";<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<div>
<br /></div>
<div>
You can sync the metadata current time, program runtime (wall time), and dimensional units using the following command. (This command is automatically run whenever you use the save command below.) </div>
<div>
<br /></div>
<div>
<div>
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.sync_to_microenvironment( M ); </span></div>
</div>
<div>
<br /></div>
<div>
You can display a basic summary of the metadata via: </div>
<div>
<br /></div>
<div>
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">BioFVM_metadata.display_information( std::cout ); </span></div>
<h3>
Setting options</h3>
By default (to save time and disk space), BioFVM saves the mesh as a Level 3 matlab file, whose location is embedded into the MultiCellDS XML file. You can disable this feature and revert to full XML (e.g., for human-readable cross-model reporting) via:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">set_save_biofvm_mesh_as_matlab( false ); </span><br />
<br />
Similarly, BioFVM defaults to saving the values of the substrates in a compact Level 3 matlab file. You can override this with:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">set_save_biofvm_data_as_matlab( false ); </span><br />
<br />
BioFVM by default saves the cell-centered sources and sinks. These take a lot of time to parse because they require very hierarchical data structures. You can disable saving the cells (basic_agents) via:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">set_save_biofvm_cell_data( false ); </span><br />
<br />
Lastly, when you do save the cells, we default to a customized, minimal matlab format. You can revert to a more standard (but much larger) XML format with:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">set_save_biofvm_cell_data_as_custom_matlab( false );</span><br />
<h3>
Saving a file</h3>
Saving the data is <i>very </i>straightforward:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">save_BioFVM_to_MultiCellDS_xml_pugi( "sample" , M , current_simulation_time ); </span><br />
<br />
Your data will be saved in sample.xml. (Depending upon your options, it may generate several .mat files beginning with "sample".)<br />
<br />
If you'd like the filename to depend upon the simulation time, use something more like this:<br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">double current_simulation_time = 10.347; </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">char filename_base [1024]; </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">sprintf( &filename_base , "sample_%f", current_simulation_time ); </span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;">save_BioFVM_to_MultiCellDS_xml_pugi( filename_base , M,</span><br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace;"> current_simulation_time ); </span><br />
<div>
<br /></div>
Your data will be saved in sample_10.347000.xml. (Depending upon your options, it may generate several .mat files beginning with "sample_10.347000".)<br />
<h3>
Compiling and running the program:</h3>
<span style="font-family: inherit;">Edit the Makefile as below:</span><br />
<br />
<span style="color: purple; font-family: "courier new" , "courier" , monospace; white-space: pre-wrap;">PROGRAM_NAME := MCDS_test</span><br />
<pre style="white-space: pre-wrap; word-wrap: break-word;"><span style="color: purple; font-family: "courier new" , "courier" , monospace;">all: $(BioFVM_OBJECTS) $(pugixml_OBJECTS) MultiCellDS_test.cpp</span></pre>
<pre style="word-wrap: break-word;"><span style="white-space: pre-wrap;"><span style="color: purple; font-family: "courier new" , "courier" , monospace;"> $(COMPILE_COMMAND) -o $(PROGRAM_NAME) $(BioFVM_OBJECTS) $(pugixml_OBJECTS) MultiCellDS_test.cpp</span></span></pre>
If you're running OSX, you'll probably need to update the compiler from "g++". <a href="http://mathcancer.blogspot.com/2016/02/saving-multicellds-data-from-biofvm.html#tutorials">See these tutorials</a>.<br />
<br />
Then, at the command prompt:<br />
<pre style="word-wrap: break-word;"></pre>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">make</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">./MCDS_test</span><br />
<div>
<br /></div>
On Windows, you'll need to run without the ./: <br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">make</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">MCDS_test</span><br />
<h2>
Working with MultiCellDS data in Matlab</h2>
<h3>
Reading data in Matlab</h3>
<div>
Copy the read_MultiCellDS_xml.m file from the matlab directory (included in every MultiCellDS download). To read the data, just do this:<br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">MCDS = read_MultiCellDS_xml( 'sample.xml' ); </span><br />
<br />
This should take around 30 seconds for larger data files (500,000 to 1,000,000 voxels with a few substrates, and around 250,000 cells). The long execution time is primarily because Matlab is ghastly inefficient at loops over hierarchical data structures. Increasing to 1,000,000 cells requires around 80-90 seconds to parse in matlab. </div>
<h3>
Plotting data in Matlab</h3>
<h4>
Plotting the 3-D substrate data</h4>
First, let's do some basic contour and surface plotting:<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">mid_index = round( length(MCDS.mesh.Z_coordinates)/2 ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">contourf( MCDS.mesh.X(:,:,mid_index), ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.mesh.Y(:,:,mid_index), ... </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).data(:,:,mid_index) , 20 ) ; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">axis image</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">colorbar </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('%s (%s) at t = %f %s, z = %f %s', MCDS.continuum_variables(2).name , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).units , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.current_time , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units, ... </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.mesh.Z_coordinates(mid_index), ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.spatial_units </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">) ); </span><br />
<br />
OR<br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">contourf( MCDS.mesh.X_coordinates , MCDS.mesh.Y_coordinates, ... </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).data(:,:,mid_index) , 20 ) ; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">axis image</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">colorbar </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('%s (%s) at t = %f %s, z = %f %s', ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).name , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).units , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.current_time , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units, ... </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.mesh.Z_coordinates(mid_index)</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">, ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.spatial_units </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">) ); </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span><br />
<br />
Here's a surface plot:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">surf( MCDS.mesh.X_coordinates , MCDS.mesh.Y_coordinates, ... </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(1).data(:,:,mid_index) ) ; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">colorbar </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">axis tight</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">zlabel( sprintf( '%s (%s)', MCDS.continuum_variables(1).name, ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(1).units ) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('%s (%s) at t = %f %s, z = %f %s', MCDS.continuum_variables(1).name , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(1).units , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.current_time , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units, ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.mesh.Z_coordinates(mid_index), ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.spatial_units ) ); </span><br />
<br />
Finally, here are some more advanced plots. The first is an "exploded" stack of contour plots:<br />
<br />
<span style="color: blue;">clf</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">contourslice( MCDS.mesh.X , MCDS.mesh.Y, MCDS.mesh.Z , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).data , [],[], ...</span><br />
<span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;"> MCDS.mesh.Z_coordinates(1:15:length(MCDS.mesh.Z_coordinates)),</span><span style="font-family: "courier new" , "courier" , monospace;">20);</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">view([-45 10]);</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">axis tight; </span></span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">zlabel( sprintf( 'z (%s)' , MCDS.metadata.spatial_units) ); </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('%s (%s) at t = %f %s', ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).name , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(2).units , ...</span><br />
<span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.</span><span style="font-family: "courier new" , "courier" , monospace;">current_time</span><span style="font-family: "courier new" , "courier" , monospace;">, ... </span></span><br />
<span style="color: blue;"><span style="font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units </span><span style="font-family: "courier new" , "courier" , monospace;">) ); </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
Next, we show how to use isosurfaces with transparency<br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">clf</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">patch( isosurface( MCDS.mesh.X , MCDS.mesh.Y, MCDS.mesh.Z, ...</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.continuum_variables(1).data, 1000 ), 'edgecolor', ...</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> 'none', 'facecolor', 'r' , 'facealpha' , 1 ); <br />hold on<br />patch( isosurface( MCDS.mesh.X , MCDS.mesh.Y, MCDS.mesh.Z, ...<br />MCDS.continuum_variables(1).data, 5000 ), 'edgecolor', ...<br /> 'none', 'facecolor', 'b' , 'facealpha' , 0.7 ); <br />patch( isosurface( MCDS.mesh.X , MCDS.mesh.Y, MCDS.mesh.Z, ...<br /> MCDS.continuum_variables(1).data, 10000 ), 'edgecolor', ...<br /> 'none', 'facecolor', 'g' , 'facealpha' , 0.5 ); <br />hold off<br />% shading interp <br />camlight<br />view(3)<br />axis image <br />axis tightcamlight
lighting gouraud<br />xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) );
<br />ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) );
<br />zlabel( sprintf( 'z (%s)' , MCDS.metadata.spatial_units) );<br />title( sprintf('%s (%s) at t = %f %s', ...
<br /> MCDS.continuum_variables(1).name , ...<br /> MCDS.continuum_variables(1).units , ...<br /> MCDS.metadata.current_time, ... <br /> MCDS.metadata.time_units ) );</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
You can get more 3-D <a href="http://www.mathworks.com/help/matlab/volume-visualization.html">volumetric visualization ideas at Matlab's website</a>. This <a href="http://web.mit.edu/8.13/matlab/MatlabTraining_IAP_2012/AGV/DemoFiles/ScriptFiles/html/Part7_SlicesIsosurfaces.html">visualization post at MIT</a> also has some great tips.</div>
<h4>
Plotting the cells</h4>
Here is a basic 3-D plot for the cells:<br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">plot3( MCDS.discrete_cells.state.position(:,1) , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.discrete_cells.state.position(:,2) , ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.discrete_cells.state.position(:,3) , 'bo' );</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">view(3)</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">axis tight</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">zlabel( sprintf( 'z (%s)' , MCDS.metadata.spatial_units) );</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('Cells at t = %f %s', MCDS.metadata.current_time, ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units ) );</span><br />
<br />
plot3 is more efficient than scatter3, but scatter3 will give more coloring options. Here is the syntax:<br />
<br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">scatter3( MCDS.discrete_cells.state.position(:,1), ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.discrete_cells.state.position(:,2), ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.discrete_cells.state.position(:,3) , 'bo' );</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">view(3)</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">axis tight</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">xlabel( sprintf( 'x (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">ylabel( sprintf( 'y (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">zlabel( sprintf( 'z (%s)' , MCDS.metadata.spatial_units) ); </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">title( sprintf('Cells at t = %f %s', MCDS.metadata.current_time, ...</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"> MCDS.metadata.time_units ) );</span><br />
<br />
Jan Poleszczuk gives some great insights on plotting many cells in 3D at <a href="https://computecancer.wordpress.com/">his blog</a>. I'd recommend checking out his <a href="https://computecancer.wordpress.com/2015/06/04/visualization-of-3d-tumor-using-isosurfaces-and-simple-blur/">post on visualizing a cellular automaton model</a>. At some point, I'll update this post with prettier plotting based on his methods. <br />
<h2>
What's next</h2>
Future releases of BioFVM will support reading MultiCellDS snapshots (for model initialization). <br />
<br />
Matlab is pretty slow at parsing and visualizing large amounts of data. We also plan to include resources for accessing MultiCellDS data in VTK / Paraview and Python.<br />
<h2 id="tutorials">
Tutorial Series for BioFVM</h2>
<h3 id="tutorial_series_setup">
Setting up your development environment</h3>
<div>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
<h3>
Using BioFVM</h3>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/biofvm-warmup-2d-continuum-simulation.html">BioFVM Warmup: a 2D continuum simulation of tumor growth</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/02/saving-multicellds-data-from-biofvm.html">Saving MultiCellDS data from BioFVM</a></li>
</ol>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-40338845167214306112016-01-22T09:55:00.000-08:002016-02-29T07:45:59.109-08:00BioFVM warmup: 2D continuum simulation of tumor growth<i><b>Note:</b> This is the fourth in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a>. See below for <a href="http:/#tutorial_series_setup">guides to setting up a C++ compiler</a> in Windows or OSX. </i><br />
<h2>
What you'll need</h2>
<ol>
<li>A working C++ development environment with support for OpenMP. See <a href="http:/#tutorial_series_setup">these prior tutorials</a> if you need help. </li>
<li>A download of BioFVM, available at <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a> and <a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a>. Use Version 1.0.3 or later. </li>
<li>Matlab or Octave for visualization. Matlab might be available for free at your university. Octave is open source and <a href="https://www.google.com/search?q=octave+download" target="_blank">available from a variety of sources</a>. </li>
</ol>
<h2>
Our modeling task</h2>
We will implement a basic 2-D model of tumor growth in a heterogeneous microenvironment, with inspiration by glioblastoma models by Kristin Swanson, Russell Rockne and others (e.g., <a href="http://dx.doi.org/10.1098/rsif.2014.1174">this work</a>), and continuum tumor growth models by Hermann Frieboes, John Lowengrub, and our own lab (e.g., <a href="http://dx.doi.org/10.1371/journal.pcbi.1003008">this paper</a> and <a href="http://dx.doi.org/10.1016/j.jtbi.2006.12.004">this paper</a>).<br />
<br />
We will model tumor growth driven by a growth substrate, where cells die when the growth substrate is insufficient. The tumor cells will have motility. A continuum blood vasculature will supply the growth substrate, but tumor cells can degrade this existing vasculature. We will revisit and extend this model from time to time in future tutorials.<br />
<h2>
Mathematical model</h2>
Taking inspiration from the groups mentioned above, we'll model a live cell density ρ of a relatively low-adhesion tumor cell species (e.g., glioblastoma multiforme). We'll assume that tumor cells move randomly towards regions of low cell density (modeled as diffusion with motility μ). We'll assume that that the net birth rate <i>r<sub>B</sub></i>is proportional to the concentration of growth substrate σ, which is released by blood vasculature with density <i>b</i>. Tumor cells can degrade the tissue and hence this existing vasculature. Tumor cells die at rate <i>r<sub>D</sub></i>when the growth substrate level is too low. We assume that the tumor
cell density cannot exceed a max level ρ<sub>max</sub>. A model that includes these effects is:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBiAb86fUmpGhJbupqX5FNUFuA6BohbgYxg7hZ4C7Gm8Tij2-C8csTj3tLprtSl4tbrLrBsPHciC3U6G-NmUboduzHXkjvOszqfn6jPmkQXrx5mp__nQ-D82IbCmO9umzVXzD4rku2eM8/s1600/PDEs.png" imageanchor="1"><img border="0" height="153" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBiAb86fUmpGhJbupqX5FNUFuA6BohbgYxg7hZ4C7Gm8Tij2-C8csTj3tLprtSl4tbrLrBsPHciC3U6G-NmUboduzHXkjvOszqfn6jPmkQXrx5mp__nQ-D82IbCmO9umzVXzD4rku2eM8/s400/PDEs.png" width="400" /></a></div>
where for the birth and death rates, we'll use the constitutive relations:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghjA4FY3m4OmGhuvAXDZs5dD8aWJUZbzWT0K8tO0C7S9LOmkcaUZyaovGP7PhGhL_ZEcKFBSQEkF-xGmnJbxzRI2nxtktHIiRRBd3Yu9BQUt-M26rK_teRYHS1L9QS2ffPiQVVXI7-o9E/s1600/constitutive.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="116" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghjA4FY3m4OmGhuvAXDZs5dD8aWJUZbzWT0K8tO0C7S9LOmkcaUZyaovGP7PhGhL_ZEcKFBSQEkF-xGmnJbxzRI2nxtktHIiRRBd3Yu9BQUt-M26rK_teRYHS1L9QS2ffPiQVVXI7-o9E/s320/constitutive.png" width="320" /></a></div>
<h3>
Mapping the model onto BioFVM</h3>
BioFVM solves on a vector <b>u</b> of substrates. We'll set <b>u</b> = [ρ , <i>b</i>, σ ]. The code expects PDES of the general form:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuSOtCMxN8k7m8MMYrBG4xM8ce7ecdc5r52uVFYOA-bLNcVytcyRhn74gZgi9IJoxHhFO8LR61zxV52Dnl4gYIWt3fUSiidnvFS6R99cIVTBvR4MSSzrCgTMCcHGP9sw_8oLGMUGSXe_E/s1600/general_form_PDE.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuSOtCMxN8k7m8MMYrBG4xM8ce7ecdc5r52uVFYOA-bLNcVytcyRhn74gZgi9IJoxHhFO8LR61zxV52Dnl4gYIWt3fUSiidnvFS6R99cIVTBvR4MSSzrCgTMCcHGP9sw_8oLGMUGSXe_E/s320/general_form_PDE.png" width="320" /></a></div>
So, we determine the decay rate (λ), source function (S), and uptake function (U) for the cell density ρ and the growth substrate σ.<br />
<h4>
Cell density</h4>
We first slightly rewrite the PDE:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNDbLcvkRKGLyG1W12pyZG5QoE4oCBTei5o6hYg9pTqhjTqYeFEdmp6oantmjrOzrwoMirjX60JNJMuTj-LXW6wI7zBxWqQY4aIEShobgj0IpjpEbiEkJ7qfFgNH_j4sqvSlYfgzFbHak/s1600/refreshed_rho_PDE.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="53" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNDbLcvkRKGLyG1W12pyZG5QoE4oCBTei5o6hYg9pTqhjTqYeFEdmp6oantmjrOzrwoMirjX60JNJMuTj-LXW6wI7zBxWqQY4aIEShobgj0IpjpEbiEkJ7qfFgNH_j4sqvSlYfgzFbHak/s400/refreshed_rho_PDE.png" width="400" /></a></div>
and then try to match to the general form term-by-term. While BioFVM wasn't intended for solving nonlinear PDEs of this form, we can make it work by quasi-linearizing, with the following functions:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9y1CHw6NM7f1ryoC9NiyCnd87qdsFEs7q_TGecVZlJAvYp807r-1c_IvfZQybBK1MGUsY5LozSV36-YjAklbELuYBPglG8GNGw9zcJ2wdA45eH_z-HLCq_ZAvcBTiqskRLpo-DPt_gT8/s1600/rho_functions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="60" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9y1CHw6NM7f1ryoC9NiyCnd87qdsFEs7q_TGecVZlJAvYp807r-1c_IvfZQybBK1MGUsY5LozSV36-YjAklbELuYBPglG8GNGw9zcJ2wdA45eH_z-HLCq_ZAvcBTiqskRLpo-DPt_gT8/s320/rho_functions.png" width="320" /></a>.</div>
When implementing this, we'll evaluate σ and ρ at the previous time step. The diffusion coefficient is mu, and the decay rate is zero. The target or saturation density is ρ<sub>max</sub>.<br />
<h4>
Growth substrate</h4>
Similarly, by matching the PDE for σ term-by-term with the general form, we use:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOvhQERDKS0L0cyfpP2t8f61LUoIk79zKv6RZtehmtsj4ZHyZzOHlt_VkHLLoCli-yWPtg_SQp0qp2qrrBdtpjRPmrGA8wrCX1dRxSF3qz7Dqog94y_Pl27BSpfNH3GyTxcTbvxPwVP5c/s1600/sigma_functions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="49" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOvhQERDKS0L0cyfpP2t8f61LUoIk79zKv6RZtehmtsj4ZHyZzOHlt_VkHLLoCli-yWPtg_SQp0qp2qrrBdtpjRPmrGA8wrCX1dRxSF3qz7Dqog94y_Pl27BSpfNH3GyTxcTbvxPwVP5c/s320/sigma_functions.png" width="320" /></a></div>
The diffusion coefficient is <i>D</i>, the decay rate is λ<sub>1</sub>, and the saturation density is σ<sub>max</sub>.<br />
<h4>
Blood vessels</h4>
Lastly, a term-by-term matching of the blood vessel equation gives the following functions:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLCuCf1me9bkh8kf_JVq_rc2Fmhwx80GWtUPl5ODU0TrBAigzjJrr1V0MbxtJoOqTkTXjzKry1aRRL23jk3wPwMWAPH7BaffkTH832NaOL3Qq6YpsfZBvgnoQ-plcd1HJp2QND6NCrY4/s1600/b_functions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="42" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLCuCf1me9bkh8kf_JVq_rc2Fmhwx80GWtUPl5ODU0TrBAigzjJrr1V0MbxtJoOqTkTXjzKry1aRRL23jk3wPwMWAPH7BaffkTH832NaOL3Qq6YpsfZBvgnoQ-plcd1HJp2QND6NCrY4/s320/b_functions.png" width="320" /></a></div>
The diffusion coefficient, decay rate, and saturation density are all zero.<br />
<h2>
Implementation in BioFVM</h2>
<b>1: Start a project:</b> Create a new directory for your project (I'd recommend "BioFVM_2D_tumor"), and enter the directory. Place a copy of BioFVM (the zip file) into your directory. Unzip BioFVM, and copy BioFVM*.h, BioFVM*.cpp, and pugixml* files into that directory.<br />
<br />
<b>2: Copy the matlab visualization files: </b>To help read and plot BioFVM data, we have provided matlab files. Copy all the *.m files from the matlab subdirectory to your project.<br />
<br />
<b>3: Copy the empty project: </b>BioFVM Version 1.0.3 or later includes a template project and Makefile to make it easier to get started. Copy the Makefile and template_project.cpp file to your project. Rename template_project.cpp to something useful, like 2D_tumor_example.cpp.<br />
<br />
<b>4: Edit the makefile:</b> Open a terminal window and browse to your project. Tailor the makefile to your new project:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> notepad++ Makefile</span><br />
<br />
Change the <span style="font-family: "courier new" , "courier" , monospace;">PROGRAM_NAME </span>to <span style="font-family: "courier new" , "courier" , monospace;">2Dtumor</span>. <br />
<br />
Also, rename <span style="font-family: "courier new" , "courier" , monospace;">main </span>to <span style="font-family: "courier new" , "courier" , monospace;">2D_tumor_example</span> throughout the Makefile.<br />
<br />
Lastly, note that if you are using OSX, you'll probably need to change from "g++" to your installed compiler. <a href="http://mathcancer.blogspot.com/#tutorial_series_setup">See these tutorials</a>.<br />
<br />
<b>5: Start adapting 2D_tumor_example.cpp:</b> First, open 2D_tumor_example.cpp:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">> notepad++ 2D_tumor_example.cpp</span><br />
<br />
Just after the "using namespace BioFVM" section of the code, define useful globals. Here and throughout, new and/or modified code is in blue:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">using namespace BioFVM:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">// helpful -- have indices for each "species" </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">int live_cells = 0; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">int blood_vessels = 1; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">int oxygen = 2; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">// some globals </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double prolif_rate = 1.0 /24.0; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double death_rate = 1.0 / 6; // </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double cell_motility = 50.0 / 365.25 / 24.0 ;</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">// 50 mm^2 / year --> mm^2 / hour </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double o2_uptake_rate = 3.673 * 60.0; // 165 micron length scale </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double vessel_degradation_rate = 1.0 / 2.0 / 24.0 ; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">// 2 days to disrupt tissue</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double max_cell_density = 1.0; </span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double o2_supply_rate = 10.0; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double o2_normoxic = 1.0; </span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">double o2_hypoxic = 0.2; </span><br />
<br />
<b>6: Set up the microenvironment: </b>Within main(), make sure we have the right number of substrates, and set them up:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// create a microenvironment, and set units </span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Microenvironment M; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.name = "<span style="color: blue;">Tumor </span>microenvironment"; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.time_units = "<span style="color: blue;">hr</span>"; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.spatial_units = "<span style="color: blue;">mm</span>"; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.mesh.units = M.spatial_units;</span><br />
<br />
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// set up and add all the densities you plan</span><br />
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; white-space: pre;"><br /></span>
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span><span style="font-family: "courier new" , "courier" , monospace;">M.set_density( 0 ,</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> "live cells" , "cells"</span><span style="font-family: "courier new" , "courier" , monospace;"> );</span></div>
<div>
<span class="Apple-tab-span" style="color: blue; font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">M.add_density( "blood vessels" , "vessels/mm^2" );</span><br />
<span class="Apple-tab-span" style="color: blue; font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">M.add_density( "oxygen" , "cells" );</span><br />
<span style="color: blue; font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="color: blue; white-space: pre;"> </span>// set the properties of the diffusing substrates</span><br />
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; white-space: pre;"><br /></span>
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; white-space: pre;"> </span><span style="font-family: "courier new" , "courier" , monospace;">M.diffusion_coefficients[</span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">live_cells</span><span style="font-family: "courier new" , "courier" , monospace;">] = </span><span style="color: blue; font-family: "courier new" , "courier" , monospace;">cell_motility</span><span style="font-family: "courier new" , "courier" , monospace;">; </span></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">M.diffusion_coefficients[blood_vessels] = 0; </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.diffusion_coefficients[oxygen] = 6.0; </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// 1e5 microns^2/min in units mm^2 / hr </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.decay_rates[<span style="color: blue;">live_cells</span>] = <span style="color: blue;">0;</span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.decay_rates[blood_vessels] = 0;</span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.decay_rates[oxygen] = 0.01 * o2_uptake_rate; </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// 1650 micron length scale </span></span></div>
</div>
<span style="font-family: "courier new" , "courier" , monospace;">
</span></div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
Notice how our earlier global definitions of "live_cells", "blood_vessels", and "oxygen" makes it easier to make sure we're referencing the correct substrates in lines like these.<br />
<br />
<b>7: Resize the domain and test: </b>For this example (and so the code runs very quickly), we'll work in 2D in a 2 cm × 2 cm domain:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// set the mesh size </span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double dx = 0.05; <span style="color: blue;">// 50 microns</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.resize_space( 0.0 ,<span style="color: blue;"> 20.0</span> , 0, <span style="color: blue;">20.0</span> , <span style="color: blue;">-dx/2.0</span>, <span style="color: blue;">dx/2.0</span> , dx, dx, dx ); </span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">Notice that we use a tissue thickness of dx/2 to use the 3D code for a 2D simulation. Now, let's test: </span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">> make </span><br />
> 2Dtumor<br />
<br />
Go ahead and cancel the simulation [Control]+C after a few seconds. You should see something like this:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Starting program ... </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Microenvironment summary: Tumor microenvironment: </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Mesh information: </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">type: uniform Cartesian</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Domain: [0,20] mm x [0,20] mm x [-0.025,0.025] mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> resolution: dx = 0.05 mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> voxels: 160000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> voxel faces: 0</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> volume: 20 cubic mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">Densities: (3 total)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> live cells:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> units: cells</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 0.00570386 mm^2 / hr</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 0 hr^-1</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 75523.9 mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> blood vessels:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> units: vessels/mm^2</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 0 mm^2 / hr</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 0 hr^-1</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 0 mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> oxygen:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> units: cells</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 6 mm^2 / hr</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 2.2038 hr^-1</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 1.65002 mm</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 0 hr (100 hr max)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Using method diffusion_decay_solver__constant_coefficients_LOD_3D (implicit 3-D LOD with Thomas Algorithm) ... </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 10 hr (100 hr max)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 20 hr (100 hr max)</span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<b>8: Set up initial conditions: </b>We're going to make a small central focus of tumor cells, and a "bumpy"field of blood vessels. </div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// set initial conditions </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to create a zero vector of length 3</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// std::vector<double> zero(3,0.0); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">std::vector<double> center(3);</span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>center[0] = M.mesh.x_coordinates[M.mesh.x_coordinates.size()-1] /2.0; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>center[1] = M.mesh.y_coordinates[M.mesh.y_coordinates.size()-1] /2.0; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>center[2] = 0;</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double radius = 1.0; </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>std::vector<double> one( M.density_vector(0).size() , 1.0 );</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double pi = 2.0 * asin( 1.0 ); </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax for a parallelized loop over all the </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// voxels in your mesh: <span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>#pragma omp parallel for</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for( int i=0; i < M.number_of_voxels() ; i++ )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">std::vector<double> displacement = M.voxels(i).center - center;</span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double distance = norm( displacement );</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if( distance < radius )</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.density_vector(i)[live_cells] = 0.1; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.density_vector(i)[blood_vessels]= 0.5 + 0.5*cos(0.4* pi * M.voxels(i).center[0])*cos(0.3*pi *M.voxels(i).center[1]); </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.density_vector(i)[oxygen] = o2_normoxic; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
</div>
<div>
<br /></div>
<div>
<b>9: Change to a 2D diffusion solver: </b></div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// set up the diffusion solver, sources and sinks </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M.diffusion_decay_solver = <span style="color: blue;">diffusion_decay_solver__constant_coefficients_LOD_2D</span>;</span></div>
</div>
<div>
<br /></div>
<div>
<b>10: Set the simulation times: </b>We'll simulate 10 days, with output every 12 hours. </div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>double t = 0.0; </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>double t_max = <span style="color: blue;">10.0 * 24.0; // 10 days</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>double dt = 0.1; </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>double output_interval =<span style="color: blue;"> 12.0;</span> // how often you save data </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>double next_output_time = t; // next time you save data </div>
</div>
<div>
<br /></div>
<div>
<b>11: Set up the source function: </b></div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void supply_function( Microenvironment* microenvironment, int voxel_index, std::vector<double>* write_here )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate write_here</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// (*write_here)[j]</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate in voxel voxel_index of microenvironment: </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// microenvironment->density_vector(voxel_index)[j]</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">static double temp1 = prolif_rate / ( o2_normoxic - o2_hypoxic ); </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">microenvironment->density_vector(voxel_index)[oxygen];</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] -= o2_hypoxic; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if( (*write_here)[live_cells] < 0.0 )</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = 0.0; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = temp1; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] *= </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">microenvironment->density_vector(voxel_index)[live_cells]; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[blood_vessels] = 0.0; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[oxygen] = o2_supply_rate; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[oxygen] *= </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">microenvironment->density_vector(voxel_index)[blood_vessels]; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
</div>
<div>
<br /></div>
<div>
Notice the use of the static internal variable temp1: the first time this function is called, it declares this helper variable (to save some multiplication operations down the road). The static variable is available to all subsequent calls of this function. </div>
<div>
<br /></div>
<div>
<b>12: Set up the target function (substrate saturation densities): </b></div>
<div>
<b><br /></b></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void supply_target_function( Microenvironment* microenvironment, int voxel_index, std::vector<double>* write_here )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate write_here</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// (*write_here)[j]</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate in voxel voxel_index of microenvironment: </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// microenvironment->density_vector(voxel_index)[j]</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = max_cell_density;</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[blood_vessels] = 1.0; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[oxygen] = o2_normoxic; <span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
</div>
<div>
<br /></div>
<div>
<b>13: Set up the uptake function: </b></div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void uptake_function( Microenvironment* microenvironment, int voxel_index, std::vector<double>* write_here )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate write_here</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// (*write_here)[j]</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// use this syntax to access the jth substrate in voxel voxel_index of microenvironment: </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// microenvironment->density_vector(voxel_index)[j]</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = o2_hypoxic; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] -= </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">microenvironment->density_vector(voxel_index)[oxygen]; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if( (*write_here)[live_cells] < 0.0 ) </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] = 0.0; <span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[live_cells] *= death_rate; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[oxygen] = o2_uptake_rate ; </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[oxygen] *= </span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;">microenvironment->density_vector(voxel_index)[live_cells]; </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="color: blue; font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="color: blue; font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[blood_vessels] = vessel_degradation_rate ; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(*write_here)[blood_vessels] *= </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;">microenvironment->density_vector(voxel_index)[live_cells]; </span><span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
</div>
<div>
<br /></div>
<div>
And that's it. The source should be ready to go!<br />
<h3>
Source files</h3>
You can download completed source for this example here:<br />
<br />
<ol>
<li><a href="http://sourceforge.net/projects/biofvm/files/Tutorials/2D_tumor_example/2D_tumor_example.cpp/download">2D_tumor_example.cpp</a></li>
<li><a href="http://sourceforge.net/projects/biofvm/files/Tutorials/2D_tumor_example/Makefile/download">Makefile</a></li>
</ol>
</div>
<h2>
Using the code</h2>
<h3>
Running the code</h3>
<div>
First, compile and run the code:</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> make</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> 2Dtumor</span></div>
<div>
<br /></div>
<div>
The output should look like this.</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Starting program ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Microenvironment summary: Tumor microenvironment: </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Mesh information: </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">type: uniform Cartesian</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Domain: [0,20] mm x [0,20] mm x [-0.025,0.025] mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> resolution: dx = 0.05 mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> voxels: 160000</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> voxel faces: 0</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> volume: 20 cubic mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Densities: (3 total)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> live cells:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> units: cells</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 0.00570386 mm^2 / hr</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 0 hr^-1</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 75523.9 mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> blood vessels:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> units: vessels/mm^2</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 0 mm^2 / hr</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 0 hr^-1</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 0 mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> oxygen:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> units: cells</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion coefficient: 6 mm^2 / hr</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> decay rate: 2.2038 hr^-1</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> diffusion length scale: 1.65002 mm</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 0 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Using method diffusion_decay_solver__constant_coefficients_LOD_2D (2D LOD with Thomas Algorithm) ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 12 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 24 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 36 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 48 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 60 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 72 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 84 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 96 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 108 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 120 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 132 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 144 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 156 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 168 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 180 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 192 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 204 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 216 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 228 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">simulation time: 240 hr (240 hr max)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
</div>
<h3>
Looking at the data</h3>
<div>
Now, let's pop it open in matlab (or octave): </div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> matlab</span></div>
<div>
<br /></div>
<div>
To load and plot a single time (e.g., the last tim)</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">!ls *.mat </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">M = read_microenvironment( 'output_240.000000.mat' ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">plot_microenvironment( M ); </span></div>
<div>
<br /></div>
<div>
To add some labels: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{1} = 'tumor cells'; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{2} = 'blood vessel density'; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{3} = 'growth substrate'; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">plot_microenvironment( M ,labels ); </span></div>
<div>
<br /></div>
</div>
<div>
Your output should look a bit like this: </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpz-ACwFfcr8x8TNJ3X_OwNeyGD95gNijQeLGX_HpWiKHx9PtZEuPP5uyZwy4IdqPV9bqTYRUY_BGLQA0AgOmtsqM9ijJNfRvskoGMhTM4BG3L70pNMTEHQm-w6p9pLmvUxnh8BKpuOMY/s1600/screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpz-ACwFfcr8x8TNJ3X_OwNeyGD95gNijQeLGX_HpWiKHx9PtZEuPP5uyZwy4IdqPV9bqTYRUY_BGLQA0AgOmtsqM9ijJNfRvskoGMhTM4BG3L70pNMTEHQm-w6p9pLmvUxnh8BKpuOMY/s400/screenshot.png" width="400" /></a></div>
<div>
Lastly, you might want to script the code to create and save plots of all the times. </div>
<br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{1} = 'tumor cells'; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{2} = 'blood vessel density'; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">labels{3} = 'growth substrate'; </span></div>
<span style="font-family: "courier new" , "courier" , monospace;">for i=0:20</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>t = i*12;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>input_file = sprintf( 'output_%3.6f.mat', t ); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>output_file = sprintf( 'output_%3.6f.png', t ); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>M = read_microenvironment( input_file ); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>plot_microenvironment( M , labels ); </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>print( gcf , '-dpng' , output_file );</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">end</span><br />
<div>
<h2>
Tutorial series for BioFVM</h2>
</div>
<h3 id="tutorial_series_setup">
Setting up your development environment</h3>
<div>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
<h3>
Using BioFVM</h3>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/biofvm-warmup-2d-continuum-simulation.html">BioFVM Warmup: a 2D continuum simulation of tumor growth</a></li>
</ol>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-69593728132041470292016-01-19T06:00:00.000-08:002016-06-14T07:05:18.933-07:00Setting up gcc / OpenMP on OSX (Homebrew edition) <i><b>Note:</b> This is the third in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>. This guide is for OSX users. Windows users should <a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">use this guide</a> instead. A Linux guide is expected soon.</i><br />
<br />
These instructions should get you up and running with a minimal environment for compiling 64-bit C++ projects with OpenMP (e.g., <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>) using gcc. These instructions were tested with OSX 10.11 (El Capitan), but they should work on any reasonably recent version of OSX.<br />
<br />
In the end result, you'll have a compiler and key makefile capabilities. The entire toolchain is free and open source.<br />
<br />
Of course, you can use other compilers and more sophisticated integrated desktop environments, but these instructions will get you a good baseline system with support for 64-bit binaries and OpenMP parallelization.<br />
<div>
<br /></div>
<b><i>Note 1:</i></b> <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">OSX / Xcode <i>appears </i>to have gcc</a> out of the box (you can type "gcc" in a Terminal window), but this really <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">just maps back onto Apple's build of clang</a>. Alas, this will not support OpenMP for parallelization.<br />
<br />
<b><i>Note 2:</i></b> Yesterday in <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">this post</a>, we showed how to set up gcc using the popular <a href="https://www.macports.org/">MacPorts</a> package manager. Because MacPorts builds gcc (and all its dependencies!) from source, it takes a very, very long time. On my 2012 Macbook Air, this step took <i>16 hours</i>. This tutorial uses Homebrew to dramatically speed up the process!<br />
<br />
<i style="font-weight: bold;">Note 3: </i>This is an update over the <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew-old.html">previous version</a>. It incorporates new information that Xcode command line tools can be installed without the full 4.41 GB download / installation of Xcode. Many thanks to <a href="http://walter.deback.net/">Walter de Back</a> and Tim at the <a href="http://www.twitter.com/MacHomebrew">Homebrew</a> project for their help!<br />
<h2>
What you'll need:</h2>
<ul>
<li><b>XCode Command Line Tools:</b> These command line tools are needed for Homebrew and related package managers. Installation instructions are now very simple and included below. As of January 18, 2016, this will install Version 2343.</li>
<li><b>Homebrew</b>: This is a package manager for OSX, which will let you easily download and install many linux utilities <i>without building them from source</i>. You'll particularly need it for getting gcc. Installation is a simple command-line script, as detailed below. As of January 17, 2016, this will download Version 0.9.5. </li>
<li><b>gcc5 </b>(from Homebrew)<b>:</b> This will be an up-to-date 64-bit version of gcc, with support for OpenMP. As of January 17, 2016, this will download Version 5.2.0.</li>
</ul>
<h2>
Main steps:</h2>
<h3>
1) Install the XCode Command Line Tools</h3>
<div>
Open a terminal window (Open Launchpad, then "Other", then "Terminal"), and run: <br />
<br />
> <span style="background-color: white; color: #292f33; font-family: "arial" , sans-serif; font-size: 14px; line-height: 18px; white-space: pre-wrap;">xcode-select --install</span><br />
<br />
A window should pop up asking you to either get Xcode or install. Choose the "install" option to avoid the huge 4+ GB Xcode download. It should only take a few minutes to complete. </div>
<h3>
2) Install Homebrew</h3>
<div>
Open a terminal window (Open Launchpad, then "Other", then "Terminal"), and run:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</span><br />
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Let the script run, and answer "y" whenever asked. This will not take very long. </span></div>
</div>
<h3>
3) Get, install, and prepare gcc</h3>
<div>
Open a terminal window (see above), and search for gcc, version 5.x or above<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> brew search gcc5</span><br />
<br />
You should see a list of packages, including gcc5. Take a note of what is found. (In my case, it found homebrew/versions/gcc5<br />
<br />
Then, download and install gcc5:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">> brew install homebrew/versions/gcc5</span><br />
<br />
This will download whatever dependencies are needed, generally already pre-compiled. The whole process should only take five or ten minutes.<br />
<br />
Lastly, you need to get the exact name of your compiler. In your terminal window, type <span style="font-family: "courier new" , "courier" , monospace;">g++</span>, and then hit tab twice to see a list. On my system, I see this:<br />
<br />
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++ g++-5</span></span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">g++-mp-5 </span></div>
<div class="p1">
<br /></div>
<div class="p1">
Look for the version of g++ without an "mp" in its name. In my case, it's g++-5. Double-check that you have the right one by checking its version. It should look something like this: </div>
<div class="p1">
<br /></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++-5 --version</span></span></div>
<div class="p1">
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++-5 (Homebrew gcc5 5.2.0) 5.2.0</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Copyright (C) 2015 Free Software Foundation, Inc.</span></span></div>
<div class="p1">
<span style="font-family: "courier new" , "courier" , monospace;"><span class="s1">This is free software; see the source for copying conditions. There is NO </span>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></div>
</div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Notice that Homebrew shows up in the information. The correct compiler is g++-5. </span></div>
</div>
<h3>
5) Test the compiler</h3>
<div>
<h4>
<b><u>Write a basic parallelized program:</u></b></h4>
</div>
<div>
Open Terminal (see above). You should be in your user profile's root directory. Make a new subdirectory, enter it, and create a new file: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> mkdir omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> cd omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> nano omp_test.cpp</span></div>
<div>
<br /></div>
<div>
Then, write your basic OpenMP test: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <iostream></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <cmath> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <vector></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <omp.h></span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int main( int argc, char* argv[] ) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> omp_set_num_threads( 8 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> double pi = acos( -1.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Allocating memory ..." << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::vector<double> my_vector( 128000000, 0.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Entering main loop ... " << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> #pragma omp parallel for</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> for( int i=0; i < my_vector.size(); i++ )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> my_vector[i] = exp( -sin( i*i + pi*log(i+1) ) ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span> </div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> return 0; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<br /></div>
<div>
Save the file (as omp_test.cpp). (In nano, use [Control]-X, Y, and then confirm the choice of filename.)</div>
<div>
<br /></div>
<div>
In the <span style="font-family: "courier new" , "courier" , monospace;">omp_set_num_threads()</span> line above, replace 8 with the maximum number of virtual processors on your CPU. (For a quad-core CPU with hyperthreading, this number is 8. On a hex-core CPU without hyperthreading, this number is 6.) If in doubt, leave it alone for now. </div>
<div>
<h4>
<u>Write a makefile:</u></h4>
</div>
<div>
Next, create a Makefile to start editing:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> nano Makefile </span><br />
<br />
Add the following contents: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CC := g++-</span><span style="font-family: "courier new" , "courier" , monospace;">5</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># replace this with your correct compiler as identified above</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ARCH := core2 # Replace this with your CPU architecture.</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># core2 is pretty safe for most modern machines. </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CFLAGS := -march=$(ARCH) -O3 -fopenmp -m64 -std=c++11</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">COMPILE_COMMAND := $(CC) $(CFLAGS)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OUTPUT := my_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">all: omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> $(COMPILE_COMMAND) -o $(OUTPUT) omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">clean:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> rm -f *.o $(OUTPUT).*</span></div>
<div>
<br /></div>
<div>
Go ahead and save this (as Makefile). ([Control]-X, Y, confirm the filename.)</div>
<div>
<h4>
<u>Compile and run the test:</u></h4>
</div>
<div>
Go back to your (still open) command prompt. Compile and run the program: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> make</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> ./my_test</span></div>
<div>
<br /></div>
<div>
The output should look something like this: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Allocating memory ...</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Entering main loop ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<i><b>Note 1: </b>If the make command gives errors like "**** missing separator", then you need to replace the white space (e.g., one or more spaces) at the start of the "$(COMPILE_COMMAND)" and "rm -f" lines with a single tab character. </i><br />
<br />
<i><b>Note 2: </b>If the compiler gives an error like "fatal error: 'omg.h' not found", you probably used Apple's build of clang, which does not include OpenMP support. You'll need to make sure that you specify your compiler on the CC line of your makefile. </i><br />
<i><br /></i>Now, let's verify that the code is using OpenMP.<br />
<br />
Open another Terminal window. While the code is running, run top. Take a look at the performance, particularly CPU usage. While your program is running, you should see CPU usage fairly close to '100% user'. (This is a good indication that your code is running the OpenMP parallelization as expected.)<br />
<h2>
What's next?</h2>
Download a copy of BioFVM and try out the included examples!<br />
<ol>
<li>BioFVM announcement on Blogspot: [<a href="http://mathcancer.blogspot.com/2015/12/biofvm-efficient-parallelized-diffusive.html">click here</a>] </li>
<li>BioFVM on MathCancer.org: <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a> </li>
<li>BioFVM on SourceForge: <a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a> </li>
<li>BioFVM Method Paper in BioInformatics: <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">http://dx.doi.org/10.1093/bioinformatics/btv730</a> </li>
</ol>
<h2>
Tutorial series for BioFVM</h2>
</div>
<div>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a></div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-8636052553159110472016-01-18T23:59:00.000-08:002016-06-14T07:05:45.963-07:00Setting up gcc / OpenMP on OSX (Homebrew edition) (outdated)<i><b>Note 1:</b> This is the third in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>. This guide is for OSX users. Windows users should <a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">use this guide</a> instead. A Linux guide is expected soon.</i><br />
<br />
<i><b>Note 2: </b>This tutorial is outdated. Please see <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">this updated version</a>.</i><br />
<br />
These instructions should get you up and running with a minimal environment for compiling 64-bit C++ projects with OpenMP (e.g., <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>) using gcc. These instructions were tested with OSX 10.11 (El Capitan), but they should work on any reasonably recent version of OSX.<br />
<br />
In the end result, you'll have a compiler and key makefile capabilities. The entire toolchain is free and open source.<br />
<br />
Of course, you can use other compilers and more sophisticated integrated desktop environments, but these instructions will get you a good baseline system with support for 64-bit binaries and OpenMP parallelization.<br />
<div>
<br /></div>
<b><i>Note 3:</i></b> <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">OSX / Xcode <i>appears </i>to have gcc</a> out of the box (you can type "gcc" in a Terminal window), but this really <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">just maps back onto Apple's build of clang</a>. Alas, this will not support OpenMP for parallelization.<br />
<br />
<b><i>Note 4:</i></b> Yesterday in <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">this post</a>, we showed how to set up gcc using the popular <a href="https://www.macports.org/">MacPorts</a> package manager. Because MacPorts builds gcc (and all its dependencies!) from source, it takes a very, very long time. On my 2012 Macbook Air, this step took <i>16 hours</i>. This tutorial uses Homebrew to dramatically speed up the process!<br />
<h2>
What you'll need:</h2>
<ul>
<li><b>XCode:</b> This includes command line development tools. Evidently, it is required for both Homebrew and its competitors (e.g., MacPorts). Download the latest version in the <a href="http://www.apple.com/osx/apps/app-store/">App Store</a>. (Search for xcode.) As of January 15, 2016, the App Store will install Version 7.2. <b>Please note that this is a 4.41 GB download!</b></li>
<li><b>Homebrew</b>: This is a package manager for OSX, which will let you easily download and install many linux utilities <i>without building them from source</i>. You'll particularly need it for getting gcc. Installation is a simple command-line script, as detailed below. As of January 17, 2016, this will download Version 0.9.5. </li>
<li><b>gcc5 </b>(from Homebrew)<b>:</b> This will be an up-to-date 64-bit version of gcc, with support for OpenMP. As of January 17, 2016, this will download Version 5.2.0.</li>
</ul>
<h2>
Main steps:</h2>
<h3>
1) Download, install, and prepare XCode</h3>
<div>
As mentioned above, open the App Store, search for Xcode, and start the download / install. Go ahead and grab a coffee while it's downloading and installing 4+ GB. Once it has installed, open Xcode, agree to the license, and let it install whatever components it needs. </div>
<div>
<br /></div>
<div>
Now, you need to get the command line tools. Go to the Xcode menu, select "Open Developer Tool", and choose "More Developer Tools ...". This will open up a site in Safari and prompt you to log in. </div>
<div>
<br /></div>
<div>
Sign on with your AppleID, agree to yet more licensing terms, and then search for "command line tools" for your version of Xcode and OSX. (In my case, this is OSX 10.11 with Xcode 7.2) Click the + next to the correct version, and then the link for the dmg file. (Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg). </div>
<div>
<br /></div>
<div>
Double-click the dmg file. Double-click pkg file it contains. Click "continue", "OK", and "agree" as much as it takes to install. Once done, go ahead and exit the installer and close the dmg file. </div>
<h3>
2) Install Homebrew</h3>
<div>
Open a terminal window (Open Launchpad, then "Other", then "Terminal"), and run:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</span><br />
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Let the script run, and answer "y" whenever asked. This will not take very long. </span></div>
</div>
<h3>
3) Get, install, and prepare gcc</h3>
<div>
Open a terminal window (see above), and search for gcc, version 5.x or above<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> brew search gcc5</span><br />
<br />
You should see a list of packages, including gcc5. Take a note of what is found. (In my case, it found homebrew/versions/gcc5<br />
<br />
Then, download and install gcc5:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">> brew install homebrew/versions/gcc5</span><br />
<br />
This will download whatever dependencies are needed, generally already pre-compiled. The whole process should only take five or ten minutes.<br />
<br />
Lastly, you need to get the exact name of your compiler. In your terminal window, type <span style="font-family: "courier new" , "courier" , monospace;">g++</span>, and then hit tab twice to see a list. On my system, I see this:<br />
<br />
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++ g++-5</span></span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;"> </span><span style="font-family: "courier new" , "courier" , monospace;">g++-mp-5 </span></div>
<div class="p1">
<br /></div>
<div class="p1">
Look for the version of g++ without an "mp" in its name. In my case, it's g++-5. Double-check that you have the right one by checking its version. It should look something like this: </div>
<div class="p1">
<br /></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++-5 --version</span></span></div>
<div class="p1">
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++-5 (Homebrew gcc5 5.2.0) 5.2.0</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Copyright (C) 2015 Free Software Foundation, Inc.</span></span></div>
<div class="p1">
<span style="font-family: "courier new" , "courier" , monospace;"><span class="s1">This is free software; see the source for copying conditions. There is NO </span>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></div>
</div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Notice that Homebrew shows up in the information. The correct compiler is g++-5. </span></div>
</div>
<h3>
5) Test the compiler</h3>
<div>
<h4>
<b><u>Write a basic parallelized program:</u></b></h4>
</div>
<div>
Open Terminal (see above). You should be in your user profile's root directory. Make a new subdirectory, enter it, and create a new file: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> mkdir omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> cd omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> nano omp_test.cpp</span></div>
<div>
<br /></div>
<div>
Then, write your basic OpenMP test: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <iostream></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <cmath> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <vector></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <omp.h></span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int main( int argc, char* argv[] ) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> omp_set_num_threads( 8 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> double pi = acos( -1.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Allocating memory ..." << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::vector<double> my_vector( 128000000, 0.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Entering main loop ... " << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> #pragma omp parallel for</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> for( int i=0; i < my_vector.size(); i++ )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> my_vector[i] = exp( -sin( i*i + pi*log(i+1) ) ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span> </div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> return 0; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<br /></div>
<div>
Save the file (as omp_test.cpp). (In nano, use [Control]-X, Y, and then confirm the choice of filename.)</div>
<div>
<br /></div>
<div>
In the <span style="font-family: "courier new" , "courier" , monospace;">omp_set_num_threads()</span> line above, replace 8 with the maximum number of virtual processors on your CPU. (For a quad-core CPU with hyperthreading, this number is 8. On a hex-core CPU without hyperthreading, this number is 6.) If in doubt, leave it alone for now. </div>
<div>
<h4>
<u>Write a makefile:</u></h4>
</div>
<div>
Next, create a Makefile to start editing:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> nano Makefile </span><br />
<br />
Add the following contents: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CC := g++-</span><span style="font-family: "courier new" , "courier" , monospace;">5</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># replace this with your correct compiler as identified above</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ARCH := core2 # Replace this with your CPU architecture.</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># core2 is pretty safe for most modern machines. </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CFLAGS := -march=$(ARCH) -O3 -fopenmp -m64 -std=c++11</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">COMPILE_COMMAND := $(CC) $(CFLAGS)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OUTPUT := my_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">all: omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> $(COMPILE_COMMAND) -o $(OUTPUT) omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">clean:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> rm -f *.o $(OUTPUT).*</span></div>
<div>
<br /></div>
<div>
Go ahead and save this (as Makefile). ([Control]-X, Y, confirm the filename.)</div>
<div>
<h4>
<u>Compile and run the test:</u></h4>
</div>
<div>
Go back to your (still open) command prompt. Compile and run the program: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> make</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> ./my_test</span></div>
<div>
<br /></div>
<div>
The output should look something like this: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Allocating memory ...</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Entering main loop ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<i><b>Note 1: </b>If the make command gives errors like "**** missing separator", then you need to replace the white space (e.g., one or more spaces) at the start of the "$(COMPILE_COMMAND)" and "rm -f" lines with a single tab character. </i><br />
<br />
<i><b>Note 2: </b>If the compiler gives an error like "fatal error: 'omg.h' not found", you probably used Apple's build of clang, which does not include OpenMP support. You'll need to make sure that you specify your compiler on the CC line of your makefile. </i><br />
<i><br /></i>Now, let's verify that the code is using OpenMP.<br />
<br />
Open another Terminal window. While the code is running, run top. Take a look at the performance, particularly CPU usage. While your program is running, you should see CPU usage fairly close to '100% user'. (This is a good indication that your code is running the OpenMP parallelization as expected.)<br />
<h2>
What's next?</h2>
Download a copy of BioFVM and try out the included examples!<br />
<ol>
<li>BioFVM announcement on Blogspot: [<a href="http://mathcancer.blogspot.com/2015/12/biofvm-efficient-parallelized-diffusive.html">click here</a>] </li>
<li>BioFVM on MathCancer.org: <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a> </li>
<li>BioFVM on SourceForge: <a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a> </li>
<li>BioFVM Method Paper in BioInformatics: <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">http://dx.doi.org/10.1093/bioinformatics/btv730</a> </li>
</ol>
<h2>
Tutorial series for BioFVM</h2>
</div>
<div>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a></div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-53601377228436229912016-01-18T11:37:00.000-08:002016-06-14T07:05:33.015-07:00Setting up gcc / OpenMP on OSX (MacPorts edition)<i><b>Note:</b> This is the second in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>. This guide is for OSX users. Windows users should <a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">use this guide</a> instead. A Linux guide is expected soon. </i><br />
<br />
These instructions should get you up and running with a minimal environment for compiling 64-bit C++ projects with OpenMP (e.g., <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>) using gcc. These instructions were tested with OSX 10.11 (El Capitan), but they should work on any reasonably recent version
of OSX.<br />
<br />
In the end result, you'll have a compiler and key makefile capabilities. The entire toolchain is free and open source.<br />
<br />
Of course, you can use other compilers and more sophisticated integrated desktop environments, but these instructions will get you a good baseline system with support for 64-bit binaries and OpenMP parallelization. <!-- In the future, I'd like to revisit this tutorial with LLVM/Clang, but I'm waiting for their OpenMP support to improve (in OSX). --><br />
<div>
<br /></div>
<b><i>Note 1:</i></b> <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">OSX / Xcode <i>appears </i>to have gcc</a> out of the box (you can type "gcc" in a Terminal window), but this really <a href="http://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x">just maps back onto Apple's build of clang</a>. Alas, this will not support OpenMP for parallelization.<br />
<br />
<b><i>Note 2:</i></b> This process is somewhat painful because MacPorts compiles everything from source, rather than using pre-compiled binaries. <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">This tutorial</a> uses <a href="http://brew.sh/">Homebrew</a>: a newer package manager that uses pre-compiled binaries to dramatically speed up the process. <b><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">I highly recommend using the Homebrew version of this tutorial.</a></b><br />
<h2>
What you'll need:</h2>
<ul>
<li><b>XCode:</b> This includes command line development tools. Evidently, it is required for both Macports and its competitors (e.g., Homebrew). Download the latest version in the <a href="http://www.apple.com/osx/apps/app-store/">App Store</a>. (Search for xcode.) As of January 15, 2016, the App Store will install Version 7.2. <b>Please note that this is a 4.41 GB download!</b></li>
<li><b>MacPorts</b>: This is a package manager for OSX, which will let you easily download, build and install many linux utilities. You'll particularly need it for getting gcc. Download the latest installer (MacPorts-2.3.4-10.11-ElCapitan.pkg) <a href="https://www.macports.org/install.php" target="_blank">here</a>. As of January 15, 2016, this will download Version 2.3.4. </li>
<li><b>gcc5 </b>(from MacPorts)<b>:</b> This will be an up-to-date 64-bit version of gcc, with support for OpenMP. As of January 15, 2016, this will download Version 5.3.0.</li>
<!--
<li><b>Aquamacs</b>: This is a version of the venerable emacs text editor for the Mac. Download the latest version (Aquamacs-Emacs-3.2.dmg) <a href="http://aquamacs.org/download.shtml">here</a>. As of January 15, 2016, this will download version 3.2.</li>
-->
</ul>
<h2>
Main steps:</h2>
<h3>
1) Download, install, and prepare XCode</h3>
<div>
As mentioned above, open the App Store, search for Xcode, and start the download / install. Go ahead and grab a coffee while it's downloading and installing 4+ GB. Once it has installed, open Xcode, agree to the license, and let it install whatever components it needs. </div>
<div>
<br /></div>
<div>
Now, you need to get the command line tools. Go to the Xcode menu, select "Open Developer Tool", and choose "More Developer Tools ...". This will open up a site in Safari and prompt you to log in. </div>
<div>
<br /></div>
<div>
Sign on with your AppleID, agree to yet more licensing terms, and then search for "command line tools" for your version of Xcode and OSX. (In my case, this is OSX 10.11 with Xcode 7.2) Click the + next to the correct version, and then the link for the dmg file. (Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg). </div>
<div>
<br /></div>
<div>
Double-click the dmg file. Double-click pkg file it contains. Click "continue", "OK", and "agree" as much as it takes to install. Once done, go ahead and exit the installer and close the dmg file. </div>
<h3>
2) Install Macports</h3>
<div>
Double-click the MacPorts pkg file you downloaded above. OSX may complain with a message like this:<br />
<blockquote>
"MacPorts-2.3.4-10.11-ElCapitan.pkg" can't be opened because it is from an unidentified developer.</blockquote>
If so, <a href="https://support.apple.com/kb/PH21769?viewlocale=en_US&locale=en_US">follow the directions here</a>.<br />
<br />
Leave all the default choices as they are in the installer. Click OK a bunch of times. The package scripts might take awhile.<br />
<br />
Open a terminal window (Open Launchpad, then "Other", then "Terminal"), and run:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> sudo port -v selfupdate</span><br />
<br />
to make sure that everything is up-to-date. </div>
<h3>
3) Get, install, and prepare gcc</h3>
<div>
Open a terminal window (see above), and search for gcc, version 5.x or above<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> port search gcc5</span><br />
<br />
You should see a list of packages, including gcc5.<br />
<br />
Then, download, build and install gcc5:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">> sudo port install gcc5</span><br />
<br />
You should see a list of packages, including gcc5.<br />
<br />
This will download, build, and install any dependencies necessary for gcc5, including llvm and many, many other things. This takes even longer than the 4.4 GB download of Xcode. Go get dinner and a coffee. You may well need to let this run overnight. (On my 2012 Macbook Air, it required 16 <i>hours </i>to fully build gcc5 and its dependencies. We'll discuss this point further below.)<br />
<br />
Lastly, you need to get the exact name of your compiler. In your terminal window, type <span style="font-family: "courier new" , "courier" , monospace;">g++</span>, and then hit tab twice to see a list. On my system, I see this:<br />
<br />
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++</span></span></div>
<br />
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++ g++-mp-5 </span></span></div>
<div class="p1">
<br /></div>
<div class="p1">
Look for the version of g++ with an "mp" in its name. In my case, it's g++-mp-5. Double-check that you have the right one by checking its version. It should look something like this: </div>
<div class="p1">
<br /></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Pauls-MBA:~ pmacklin$ g++-mp-5 --version</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">g++-mp-5 (MacPorts gcc5 5.3.0_0) 5.3.0</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">Copyright (C) 2015 Free Software Foundation, Inc.</span></span></div>
<div class="p1">
<span class="s1"><span style="font-family: "courier new" , "courier" , monospace;">This is free software; see the source for copying conditions. There is NO </span></span><span style="font-family: "courier new" , "courier" , monospace;">warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">Notice that MacPorts shows up in the information. The correct compiler is g++-mp-5. </span></div>
</div>
<!--
<h3>
4) Install the text editor [done] </h3>
<div>
Double-click the Aquamacs dmg file. Drag the Aquamacs icon to the left to the Applications icon. </div>
-->
<br />
<h3>
5) Test the compiler</h3>
<div>
<h4>
<b><u>Write a basic parallelized program:</u></b></h4>
</div>
<div>
Open Terminal (see above). You should be in your user profile's root directory. Make a new subdirectory, enter it, and create a new file: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> mkdir omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> cd omp_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> nano omp_test.cpp</span></div>
<div>
<br /></div>
<div>
Then, write your basic OpenMP test: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <iostream></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <cmath> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <vector></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <omp.h></span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int main( int argc, char* argv[] ) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> omp_set_num_threads( 8 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> double pi = acos( -1.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Allocating memory ..." << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::vector<double> my_vector( 128000000, 0.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Entering main loop ... " << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> #pragma omp parallel for</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> for( int i=0; i < my_vector.size(); i++ )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> my_vector[i] = exp( -sin( i*i + pi*log(i+1) ) ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span> </div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl; </span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> return 0; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<br /></div>
<div>
Save the file (as omp_test.cpp). (In nano, use [Control]-X, Y, and then confirm the choice of filename.)</div>
<div>
<br /></div>
<div>
In the <span style="font-family: "courier new" , "courier" , monospace;">omp_set_num_threads()</span> line above, replace 8 with the maximum number of virtual processors on your CPU. (For a quad-core CPU with hyperthreading, this number is 8. On a hex-core CPU without hyperthreading, this number is 6.) If in doubt, leave it alone for now, or set it at a relatively safe value of 4. </div>
<div>
<h4>
<u>Write a makefile:</u></h4>
</div>
<div>
Next, create a Makefile to start editing:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">> nano Makefile </span><br />
<br />
Add the following contents: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CC := g++-mp-</span><span style="font-family: "courier new" , "courier" , monospace;">5</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># replace this with your correct compiler as identified above</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ARCH := core2 # Replace this with your CPU architecture.</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># core2 is pretty safe for most modern machines. </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CFLAGS := -march=$(ARCH) -O3 -fopenmp -m64 -std=c++11</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">COMPILE_COMMAND := $(CC) $(CFLAGS)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OUTPUT := my_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">all: omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> $(COMPILE_COMMAND) -o $(OUTPUT) omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">clean:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> rm -f *.o $(OUTPUT).*</span></div>
<div>
<br /></div>
<div>
Go ahead and save this (as Makefile). ([Control]-X, Y, confirm the filename.)</div>
<div>
<h4>
<u>Compile and run the test:</u></h4>
</div>
<div>
Go back to your (still open) command prompt. Compile and run the program: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> make</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> ./my_test</span></div>
<div>
<br /></div>
<div>
The output should look something like this: </div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Allocating memory ...</span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Entering main loop ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<i><b>Note 1: </b>If the make command gives errors like "**** missing separator", then you need to replace the white space (e.g., one or more spaces) at the start of the "$(COMPILE_COMMAND)" and "rm -f" lines with a single tab character. </i><br />
<br />
<i><b>Note 2: </b>If the compiler gives an error like "fatal error: 'omp.h' not found", you probably used Apple's build of clang, which does not include OpenMP support. You'll need to make sure that you specify your compiler on the CC line of your makefile. </i><br />
<i><br /></i>
Now, let's verify that the code is using OpenMP.<br />
<br />
Open another Terminal window. While the code is running, run top. Take a look at the performance, particularly CPU usage. While your program is running, you should see CPU usage fairly close to '100% user'. (This is a good indication that your code is running the OpenMP parallelization as expected.)<br />
<h2>
MacPorts and Pain</h2>
MacPorts builds all the tools from source. While this ensures that you get very up-to-date binaries, it is very, very slow!<br />
<br />
However, all hope is not lost. It turns out that <a href="http://brew.sh/">Homebrew</a> will install pre-compiled binaries, so the 16-hour process of installing gcc is reduced to about 5-10 minutes. Check back tomorrow for a follow-up tutorial on how to use Homebrew to set up gcc.<br />
<h2>
What's next?</h2>
Download a copy of BioFVM and try out the included examples!<br />
<ol>
<li>BioFVM announcement on Blogspot: [<a href="http://mathcancer.blogspot.com/2015/12/biofvm-efficient-parallelized-diffusive.html">click here</a>] </li>
<li>BioFVM on MathCancer.org: <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a> </li>
<li>BioFVM on SourceForge: <a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a> </li>
<li>BioFVM Method Paper in BioInformatics: <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">http://dx.doi.org/10.1093/bioinformatics/btv730</a> </li>
</ol>
</div>
<div>
<div>
<h2>
Tutorial series for BioFVM</h2>
</div>
<div>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
</div>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-6417956878438749832016-01-08T02:11:00.000-08:002016-01-18T20:10:55.467-08:00Setting up a 64-bit gcc environment on Windows<i><b>Note:</b> This is the first in a series of "how-to" blog posts to help new users and developers of <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>. This guide is for Windows users. OSX users should use <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">this guide for Homebrew</a> (preferred method) or <a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">this guide for MacPorts</a> (much slower but reliable). </i><i>A Linux guide is expected soon.</i><br />
<br />
These instructions should get you up and running with a minimal environment for compiling 64-bit C++ projects with OpenMP (e.g., <a href="http://biofvm.mathcancer.org/">BioFVM</a> and <a href="http://physicell.mathcancer.org/">PhysiCell</a>) using a 64-bit Windows port of gcc. These instructions should work for any modern Windows installation, say Windows 7 or above. This tutorial assumes you have a 64-bit CPU running on a 64-bit operating system.<br />
<br />
In the end result, you'll have a compiler, key makefile capabilities, and a decent text editor. The entire toolchain is free and open source.<br />
<br />
Of course, you can use other compilers and more sophisticated integrated desktop environments, but these instructions will get you a good baseline system with support for 64-bit binaries and OpenMP parallelization.<br />
<h2>
What you'll need:</h2>
<ul>
<li><b>MinGW-w64 compiler:</b> This is a native port of the venerable gcc compiler for windows, with support for 64-bit executables. Download the latest installer (mingw-w64-install.exe) <a href="https://sourceforge.net/projects/mingw-w64/files/latest/download" target="_blank">here</a>. As of January 8, 2016, this installer will download gcc 5.3.0.</li>
<li><b>MSYS tools</b>: This gets you some of the common command-line utilities from Linux, Unix, and BSD systems (make, touch, etc.). Download the latest installer (mingw-get-setup.exe) <a href="https://sourceforge.net/projects/mingw/files/latest/download" target="_blank">here</a>. </li>
<li><b>Notepad++ text editor:</b> This is a full-featured text editor for Windows, including syntax highlighting, easy commenting, tabbed editing, etc. Download the latest version <a href="https://notepad-plus-plus.org/" target="_blank">here</a>. As of January 8, 2016, this will download Version 6.8.8. </li>
</ul>
<h2>
Main steps:</h2>
<h3>
1) Install the compiler</h3>
Run the mingw-w64-install.exe. When asked, select:<br />
<br />
<u>Version</u>: 5.3.0 (or later)<br />
<u>Architecture</u>: x86_64<br />
<u>Threads</u>: win32 (While I have tested posix, the native threading should be faster.)<br />
<u>Exception</u>: seh (While sjlj works and should be more compatible with various GNU tools, the native SEH should be faster.)<br />
<u>Build version</u>: 0 (or the default)<br />
<br />
Leave the destination folder wherever the installer wants to put it. In my case, it is:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">c:\Program Files\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4_rev0</span><br />
<br />
Let MinGW-w64 download and install whatever it needs.<br />
<h3>
2) Install the MSYS tools </h3>
<div>
Run mingw-get-setup.exe. Leave the default installation directory and any other defaults on the initial screen. Click "continue" and let it download what it needs to get started. (a bunch of XML files, for the most part.) Click "Continue" when it's done. </div>
<div>
<br /></div>
<div>
This will open up a new package manager. Our goal here is just to grab MSYS, rather than the full (but merely 32-bit) compiler. Scroll through and select ("mark for installation") the following: </div>
<div>
<ul>
<li><b>mingw-developer-toolkit</b>. (Note: This should automatically select <b>msys-base</b>.)</li>
</ul>
<div>
Next, click "Apply Changes" in the "Installation" menu. When prompted, click "Apply." Let the package manager download and install what it needs (on the order of 95 packages). Go ahead and close things once the installation is done, including the package manager. </div>
</div>
<h3>
3) Install the text editor</h3>
<div>
Run the Notepad++ installer. You can stick with the defaults. </div>
<h3>
4) Add these tools to your system path</h3>
<div>
Adding the compiler, text editor, and MSYS tools to your path helps you to run make files from the compiler. First, get the path of your compiler:</div>
<div>
<ol>
<li>Open Windows Explorer ( [Windows]+E )</li>
<li>Browse through <b>C:\</b>, then <b>Program Files</b>, <b>mingw-w64</b>, then a messy path name corresponding to our installation choices (in my case, <b>x86_64-5.3.0-win32-seh_rt_v4-rev0</b>), then <b>mingw64</b>, and finally <b>bin</b>. </li>
<li>Open notepad ([Windows]+R , notepad), </li>
<li>Go to the address bar of Explorer and copy ([Control]+C) the full path of the directory you just browsed to.</li>
<li>Paste it into notepad ([Control]+V), preceded and followed by a semicolon, and a final slash if it isn't there. In my case: </li>
</ol>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">;c:\Program Files\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4_rev0\mingw64\bin\; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
Then, get the path to Notepad++.</div>
<div>
<ol>
<li>Go back to Explorer, and choose "This PC" or "My Computer" from the left column. </li>
<li>Browse through <b>C:\</b>, then <b>Program Files (x86)</b>, then <b>Notepad++</b>.</li>
<li>Copy the path from the Explorer address bar. </li>
<li>Paste this path just after the final semicolon in notepad, followed by a backslash and a semicolon. In my case: </li>
</ol>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">;c:\Program Files\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4_rev0\mingw64\bin\;c:\Program Files (x86)\Notepad++\; </span></div>
</div>
<div>
<br /></div>
<div>
Then, get the path for MSYS:</div>
<div>
<ol>
<li>Go back to Explorer, and choose "This PC" or "My Computer" from the left column. </li>
<li>Browse through <b>C:\</b>, then <b>MinGW</b>, then <b>msys</b>, then <b>1.0</b>, and finally <b>bin</b>.</li>
<li>Copy the path from the Explorer address bar. </li>
<li>Paste this path just after the final semicolon in notepad, followed by a backslash and a semicolon. In my case: </li>
</ol>
</div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">;c:\Program Files\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4_rev0\mingw64\bin\;c:\Program Files (x86)\Notepad++\;C:\MinGW\msys\1.0\bin\; </span></div>
</div>
<div>
<br /></div>
<div>
Lastly, add these paths to the system path: </div>
<div>
<ol>
<li>Go the Start Menu, the right-click "This PC" or "My Computer", and chose "Properties."</li>
<li>Click on "Advanced system settings"</li>
<li>Click on "Environment Variables..." in the "Advanced" tab</li>
<li>Scroll through the "System Variables" below until you find Path. </li>
<li>Select "Path", then click "Edit..."</li>
<li>At the very end of "Variable Value", paste what you made in Notepad in the prior steps. <b>Make sure to paste at the end of the existing value, rather than overwriting it!</b></li>
<li>Hit OK, OK, and OK to completely exit the "Advanced system settings." </li>
</ol>
</div>
<h3>
5) Test the compiler</h3>
<div>
<h4>
<b><u>Write a basic parallelized program:</u></b></h4>
</div>
<div>
Enter a command prompt ( [windows]-R, then cmd ). You should be in your user profile's root directory. Make a new subdirectory, enter it, and create a new file: </div>
<div>
<br /></div>
<div>
> mkdir omp_test</div>
<div>
> cd omp_test</div>
<div>
> notepad++ omp_test.cpp</div>
<div>
<br /></div>
<div>
Then, write your basic OpenMP test: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <iostream></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <cmath> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <vector></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <omp.h></span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int main( int argc, char* argv[] ) </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> omp_set_num_threads( 8 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> double pi = acos( -1.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Allocating memory ..." << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::vector<double> my_vector( 128000000, 0.0 ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Entering main loop ... " << std::endl; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> #pragma omp parallel for</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> for( int i=0; i < my_vector.size(); i++ )</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> my_vector[i] = exp( -sin( i*i + pi*log(i+1) ) ); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span> </div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> std::cout << "Done!" << std::endl; </span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> return 0; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<br /></div>
<div>
Save the file (as omp_test.cpp). </div>
<div>
<br /></div>
<div>
In the omp_set_num_threads() line above, replace 8 with the maximum number of virtual processors on your CPU. (For a quad-core CPU with hyperthreading, this number is 8. On a hex-core CPU without hyperthreading, this number is 6.) If in doubt, leave it alone for now. </div>
<div>
<h4>
<u>Write a makefile:</u></h4>
</div>
<div>
Next, open up a new tab in Notepad++, and save it as "Makefile". Add the following contents: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CC := g++</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">ARCH := core2 # Replace this your CPU architecture.</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"># core2 is pretty safe for most modern machines. </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">CFLAGS := -march=$(ARCH) -O3 -fopenmp -m64 -std=c++11</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">COMPILE_COMMAND := $(CC) $(CFLAGS)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">OUTPUT := my_test</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">all: omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">$(COMPILE_COMMAND) -o $(OUTPUT) omp_test.cpp</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">clean:</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">rm -f *.o $(OUTPUT).*</span></div>
<div>
<br /></div>
<div>
Go ahead and save this (as Makefile).</div>
<div>
<h4>
<u>Compile and run the test:</u></h4>
</div>
<div>
Go back to your (still open) command prompt. Compile and run the program: </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> make</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">> my_test</span></div>
<div>
<br /></div>
<div>
The output should look something like this: </div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Allocating memory ...</span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Entering main loop ... </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Done!</span></div>
<div>
<br /></div>
<div>
Open up the Windows task manager ([windows]-R, taskmgr) while the code is running. Take a look at the performance tab, particularly the graphs of the CPU usage history. While your program. is running, you should see all your virtual processes 100% utilized. (This is a good indication that your code is running the OpenMP parallelization as expected.)<br />
<h2>
What's next?</h2>
Download a copy of BioFVM and try out the included examples!<br />
<br />
<ol>
<li>BioFVM announcement on Blogspot: [<a href="http://mathcancer.blogspot.com/2015/12/biofvm-efficient-parallelized-diffusive.html">click here</a>] </li>
<li>BioFVM on MathCancer.org: <a href="http://biofvm.mathcancer.org/">http://BioFVM.MathCancer.org</a> </li>
<li>BioFVM on SourceForge: <a href="http://biofvm.sf.net/">http://BioFVM.sf.net</a> </li>
<li>BioFVM Method Paper in BioInformatics: <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">http://dx.doi.org/10.1093/bioinformatics/btv730</a> </li>
</ol>
</div>
<div>
<h2>
Tutorial Series for BioFVM</h2>
<ol>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepWindowsForCoding.html">Preparing a 64-bit gcc environment for Windows with mingw-w64</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-MacPorts.html">Preparing gcc / OpenMP for OSX with MacPorts</a></li>
<li><a href="http://mathcancer.blogspot.com/2016/01/PrepOSXForCoding-Homebrew.html">Preparing gcc / OpenMP for OSX with Homebrew</a></li>
</ol>
</div>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-76253399371699902422015-12-14T07:04:00.000-08:002016-01-18T20:11:43.643-08:00BioFVM: an efficient, parallelized diffusive transport solver for 3-D biological simulationsI'm very excited to announce that our 3-D diffusion solver has been accepted for publication and is now online at <i>Bioinformatics</i>. <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">Click here to check out the open access preprint</a>!<br />
<blockquote class="tr_bq">
A. Ghaffarizadeh, S.H. Friedman, and P. Macklin. <span style="color: red;">BioFVM: an efficient, parallelized diffusive transport solver for 3-D biological simulations</span>. <i>Bioinformatics</i>, 2015. <br />
<b>DOI:</b> <a href="http://dx.doi.org/10.1093/bioinformatics/btv730">10.1093/bioinformatics/btv730</a> (free; open access)</blockquote>
<div>
<a href="http://biofvm.mathcancer.org/">BioFVM</a> (stands for "<b><u>F</u></b>inite <b><u>V</u></b>olume <b><u>M</u></b>ethod for <b><u>bio</u></b>logical problems) is an open source package to solve for 3-D diffusion of several substrates with desktop workstations, single supercomputer nodes, or even laptops (for smaller problems). We built it from the ground up for biological problems, with optimizations in C++ and OpenMP to take advantage of all those cores on your CPU. The code is available at <a href="http://biofvm.sf.net/">SourceForge</a> and <a href="http://biofvm.mathcancer.org/">BioFVM.MathCancer.org</a>. </div>
<div>
<br /></div>
<div>
The main idea here is to make it easier to simulate big, cool problems in 3-D multicellular biology. We'll take care of secretion, diffusion, and uptake of things like oxygen, glucose, metabolic waste products, signaling factors, and drugs, so you can focus on the rest of your model. </div>
<h2>
Design philosophy and main capabilities</h2>
<div>
Solving diffusion equations efficiently and accurately is hard, especially in 3D. Almost all biological simulations deal with this, many by using explicit finite differences (easy to code and accurate, but <i style="font-weight: bold;">very </i>slow!) or implicit methods like ADI (accurate and relatively fast, but difficult to code with complex linking to libraries). While real biological systems often depend upon many diffusing things (lots of signaling factors for cell-cell communication, growth substrates, drugs, etc.), most solvers only scale well to simulating two or three. We solve a system of PDEs of the following form: </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEdLqgFKrpWjM1wfPgREv-zVCHQFk_hiCpp5pSU-PBx1-qsm0v3tqU1hsRhPcLytmSSaseYw9jnjBm6jm44jKi_mPAXHi4pkqsTTh5QXwrveH9wZszdMcyR0WqcDW0g-oIL1WcgVGTZM/s1600/BioFVM_main_eqn.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEdLqgFKrpWjM1wfPgREv-zVCHQFk_hiCpp5pSU-PBx1-qsm0v3tqU1hsRhPcLytmSSaseYw9jnjBm6jm44jKi_mPAXHi4pkqsTTh5QXwrveH9wZszdMcyR0WqcDW0g-oIL1WcgVGTZM/s320/BioFVM_main_eqn.png" width="320" /></a></div>
<div>
<br /></div>
<div>
Above, all vector-vector products are term-by-term.<br />
<h3>
Solving for many diffusing substrates</h3>
<div>
We set out to write a package that could simulate many diffusing substrates using algorithms that were fast but simple enough to optimize. To do this, we wrote the entire solver to work on <i style="font-weight: bold;">vectors </i>of substrates, rather than on individual PDEs. In performance testing, we found that simulating 10 diffusing things only takes about 2.6 times longer than simulating one. (In traditional codes, simulating ten things takes ten times as long as simulating one.) We tried our hardest to break the code in our testing, but we failed. We simulated all the way from 1 diffusing substrate up to 128 without any problems. Adding new substrates increases the computational cost linearly.</div>
</div>
<h3>
Combining simple but tailored solvers</h3>
<div>
We used an approach called <i style="font-weight: bold;">operator splitting: </i>breaking a complicated PDE into a series of simpler PDEs and ODEs, which can be solved one at a time with implicit methods. This allowed us to write a very fast diffusion/decay solver, a bulk supply/uptake solver, and a cell-based secretion/uptake solver. Each of these individual solvers was individually optimized. Theory tells us that if each individual solver is first-order accurate in time and stable, then the overall approach is first-order accurate in time and stable. <!-- (<b>Aside: </b>Most computational models that are split into several steps, like "solve PDEs, then do PKPD, then update cells, then run angiogenesis, ..." are in fact relying upon operator splitting, even without stating it.) --> </div>
<div>
<br /></div>
<div>
The beauty of the approach is that each solver can individually be improved over time. For example, in BioFVM 1.0.2, we doubled the performance of the cell-based secretion/uptake solver. The operator splitting approach also lets us add new terms to the "main" PDE by writing new solvers, rather than rewriting a large, monolithic solver. We will take advantage of this to add advective terms (critical for interstitial flow) in future releases. </div>
<h3>
Optimizing the diffusion solver for large 3-D domains</h3>
<div>
For the first main release of BioFVM, we restricted ourselves to Cartesian meshes, which allowed us to write very tailored mesh data structures and diffusion solvers. (<b>Note:</b> the finite volume method reduces to finite differences on Cartesian meshes with trivial Neumann boundary conditions.) We intend to work on more general Voronoi meshes in a future release. (This will be particularly helpful for sources/sinks along blood vessels.)<br />
<br />
By using constant diffusion and decay coefficients, we were able to write very fast solvers for Cartesian meshes. We use the locally one-dimensional (LOD) method--a specialized form of operator splitting--to break the 3-D diffusion problem into a series of 1-D diffusion problems. For each (<i>y</i>,<i>z</i>) in our mesh, we have a 1-D diffusion problem along <i>x. </i>This yields a tridiagonal linear system which we can solve efficiently with the <a href="https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm">Thomas algorithm</a>. Moreover, because the forward-sweep steps only depend upon the coefficient matrix (which is unchanging over time), we can pre-compute and store the results in memory for all the <i>x</i>-diffusion problems. In fact, the structure of the matrix allows us to pre-compute part of the back-substitution steps as well. Same for <i>y-</i> and <i>z</i>-diffusion. This gives a big speedup.<br />
<br />
Next, we can use all those CPU cores to speed up our work. While the back-substitution steps of the Thomas algorithm can't be easily parallelized (it's a serial operation), we can solve many <i>x</i>-diffusion problems at the same time, using independent copies (instances) of the Thomas solver. So, we break up all the <i>x</i>-diffusion problems up across a big OpenMP loop, and repeat for <i>y</i>- and <i>z</i>-diffusion.<br />
<br />
Lastly, we used overloaded +=, axpy and similar operations on the vector of substrates, to avoid unnecessary (and very expensive) memory allocation and copy operations wherever we could. This was a really fun code to write!<br />
<br />
The work seems to have payed off: we have found that solving on 1 million voxel meshes (about 8 mm<sup>3</sup> at 20 μm resolution) is easy even for laptops.</div>
<div>
<h3>
Simulating many cells</h3>
We tailored the solver to allow both lattice- and off-lattice cell sources and sinks. Desktop workstations should have no trouble with 1,000,000 cells secreting and uptaking a few substrates. </div>
<div>
<h3>
Simplifying the non-science</h3>
</div>
<div>
We worked to minimize external dependencies, because few things are more frustrating than tracking down a bunch of libraries that may not work together on your platform. The first release BioFVM only has one external dependency: <a href="http://pugixml.org/">pugixml</a> (an XML parser). We didn't link an entire linear algebra library just to get <a href="https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_1">axpy</a> and a Thomas solver--it wouldn't have been optimized for our system anyway. We implemented what we needed of the <a href="https://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf">freely available .mat file specification</a>, rather than requiring a separate library for that. (We have used these matlab read/write routines in house for several years.)<br />
<br />
Similarly, we stuck to a very simple mesh data structure so we wouldn't have to maintain compatibility with general mesh libraries (which can tend to favor feature sets and generality over performance and simplicity). Rather than use general-purpose ODE solvers (with yet more library dependencies, and more work for maintaining compatibility), we wrote simple solvers tailored specifically to our equations.<br />
<br />
The upshot of this is that you don't have to do anything fancy to replicate results with BioFVM. Just grab a copy of the source, drop it into your project directory, include it in your project (e.g., your makefile), and you're good to go. </div>
<div>
<h2>
All the juicy details</h2>
</div>
<div>
The <i>Bioinformatics </i>paper is just 2 pages long, using the standard "Applications Note" format. It's a fantastic format for announcing and disseminating a piece of code, and we're grateful to be published there. But you should pop open the supplementary materials, because all the fun mathematics are there: </div>
<div>
<ul>
<li>The full details of the numerical algorithm, including information on our optimizations. </li>
<li><u>Convergence tests</u>: For several examples, we showed: </li>
<ul>
<li>First-order convergence in time (with respect to Δt), and stability</li>
<li>Second-order convergence in space (with respect to Δx)</li>
</ul>
<li><u>Accuracy tests</u>: For each convergence test, we looked at how small Δt has to be to ensure 5% relative accuracy at Δx = 20 μm resolution. For oxygen-like problems with cell-based sources and sinks, Δt = 0.01 min will do the trick. This is about 15 times larger than the stability-restricted time step for explicit methods. </li>
<li><u>Performance tests</u>:</li>
<ul>
<li>Computational cost (wall time to simulate a fixed problem on a fixed domain size with fixed time/spatial resolution) increases linearly with the number of substrates. 5-10 substrates are very feasible on desktop workstations.</li>
<li>Computational cost increases linearly with the number of voxels</li>
<li>Computational cost increases linearly in the number of cell-based source/sinks </li>
</ul>
</ul>
And of course because this code is open sourced, you can dig through the implementation details all you like! (And improvements are welcome!)</div>
<div>
<h2>
What's next? </h2>
<ul>
<li>As <a href="http://multicellds.org/">MultiCellDS</a> (multicellular data standard) matures, we will implement read/write support for <microenvironment> data in digital snapshots. </li>
<li>We have a few ideas to improve the speed of the cell-based sources and sinks. In particular, switching to a higher-order accurate solver may allow larger time step sizes, so long as the method is still stable. For the specific form of the sources/sinks, the trapezoid rule could work well here. </li>
<li>I'd like to allow a spatially-varying diffusion coefficient. We could probably do this (at very great memory cost) by writing separate Thomas solvers for each strip in <i>x</i>, <i>y</i>, and <i>z</i>, or by giving up the pre-computation part of the optimization. I'm still mulling this one over. </li>
<li>I'd also like to implement non-Cartesian meshes. The data structure isn't a big deal, but we lose the LOD optimization and Thomas solvers. In this case, we'd either use explicit methods (very slow!), use an iterative matrix solver (trickier to parallelize nicely, except in matrix-vector multiplication operations), or start with quasi-steady problems that let us use Gauss-Seidel iterative type methods, like <a href="http://dx.doi.org/10.1007/s10915-008-9190-z">this old paper</a>. </li>
<li>Since advective flow (particularly interstitial flow) is so important for many problems, I'd like to add an advective solver. This will require some sort of upwinding to maintain stability. </li>
<li>At some point, we'd like to port this to GPUs. However, I don't currently have time / resources to maintain a separate CUDA or OpenCL branch. (Perhaps this will be an excuse to learn <a href="https://github.com/JuliaGPU">Julia on GPUs</a>.)</li>
</ul>
<div>
Well, we hope you find BioFVM useful. If you give it a shot, I'd love to hear back from you!</div>
<div>
<br /></div>
<div>
Very best -- Paul </div>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-91247959748270479582015-02-20T01:22:00.000-08:002015-12-08T17:21:25.312-08:00Banner and Logo Contest : MultiCellDS ProjectAs the <a href="http://multicellds.org/">MultiCellDS</a> (multicellular data standards) project continues to ramp up, we could use some artistic skill.<br />
<br />
Right now, we don't have a banner (aside from a fairly barebones placeholder using a lovely LCARS font) or a logo. While I could whip up a fancier banner and logo, I have a feeling that there is much better talent out there. So, let's have a contest!<br />
<br />
Here are the guidelines and suggestions:<br />
<ol>
<li>The banner should use the text MultiCellDS Project. It's up to artist (and the use) whether the "multicellular data standards" part gets written out more fully (e.g., below the main part of the banner). </li>
<li>The logo should be shorter and easy to use on other websites. I'd suggest MCDS, stylized similarly to the main banner. </li>
<li>Think of MultiCell as a prefix: MultiCellDS, MultiCellXML, MultiCellHDF, MultiCellDB. So, the "banner" version should be extensible to new directions on the project. </li>
<li>The banner and logo should be submitted in a vector graphics format, with all source.</li>
<li>It goes without saying that you can't use clip art that you don't have rights to. (i.e., use your own artwork or photos, or properly-attributed creative commons-licensed art.) </li>
<li>The banner and logo need to belong to the MultiCellDS project once done.</li>
<li>We may do some final tweaks and finalization on the winning design for space or other constraints. But this will be done in full consultation with the winner. </li>
</ol>
So, what are the perks for winning?<br />
<ol>
<li>Permanent link to your personal research / profession page crediting you as the winner. </li>
<li>A blog/post detailing how awesome you and your banner and logo are. </li>
<li>Beer / coffee is on me next time I see you. SMB 2015 in Atlanta might be a good time to do it!</li>
<li>If we ever make t-shirts, I'll buy yours for you. :-) </li>
<li>You get to feel good for being awesome and helping out the project!</li>
</ol>
So, please post here, on the <a href="http://www.twitter.com/MultiCellDS">@MultiCellDS</a> twitter feed, or <a href="http://mathcancer.org/Contact.php">contact me</a> if you're interested. Once I get a sense of interest, I'll set a deadline for submissions and "voting" procedures.<br />
<br />
Thanks!!<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-30532014068174502162014-12-11T07:55:00.002-08:002015-01-10T11:13:29.166-08:002015 Speaking ScheduleHere is my current speaking schedule for 2015. Please join me if you can!<br />
<dl>
<!-- LLNL -->
<dt style="font-weight: normal;">
<b><u>Feb. 13, 2015</u>:</b> Seminar at the <a href="http://computation.llnl.gov/about/organization/institute-scientific-computing-research">Institute for Scientific Computing Research</a>, Lawrence Livermore National Laboratory (<a href="http://llnl.gov/">LLNL</a>)<br />
</dt>
<dd><b>Title:</b> <i>Scalable 3-D Agent-Based Simulations of Cells and Tissues in Biology and Cancer</i> [<a href="https://docs.google.com/document/d/1OQ0tsRckS6Jl6ap5-2zqiWQyQuOG1j0lp7q2Wh2TdY8/pub">abstract</a>]<br />
<!--
<b>Summary:</b> I will discuss lessons from hurricane forecasting and other fields that can be applied to
cancer and disease modeling and predictions, and the need for an <i>ecosystem</i> of computational models that can
share data and link together to make powerful predictors. I will discuss our efforts to create libraries
<i>digital cell lines</i> (and an associated multicell ontology) for improved model integration. We will explore
the possibilities for health, basic science, education, when models can routinely be combined with open,
standardized experimental, clinical, and simulation data. We will
-->
</dl>
<b>See Also:</b>
<dl>
<ul><a href="http://mathcancer.blogspot.com/2014/02/upcoming-talks-2014.html">2014 public speaking schedule</a></ul>
<ul><a href="http://mathcancer.blogspot.com/2013/01/2013-speaking-schedule.html">2013 public speaking schedule</a></ul>
</dl>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a></div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-58202833718847088562014-02-05T01:58:00.000-08:002014-12-11T07:52:03.247-08:002014 Speaking ScheduleHere is my current speaking schedule for 2014. Please join me if you can!<br />
<dl>
<!-- AAAS -->
<dt style="font-weight: normal;">
<b><u>Feb. 16, 2014</u>:</b> American Association for the Advancement of Science (<a href="http://www.aaas.org/">AAAS</a>) Annual Meeting, Chicago<br />
</dt>
<dd><b>Title:</b> <i>Integrating Next-Generation Computational Models of Cancer Progression and Outcome</i> [<a href="http://aaas.confex.com/aaas/2014/webprogram/Paper11909.html">abstract</a>]<br />
<!--
<b>Summary:</b> I will discuss lessons from hurricane forecasting and other fields that can be applied to
cancer and disease modeling and predictions, and the need for an <i>ecosystem</i> of computational models that can
share data and link together to make powerful predictors. I will discuss our efforts to create libraries
<i>digital cell lines</i> (and an associated multicell ontology) for improved model integration. We will explore
the possibilities for health, basic science, education, when models can routinely be combined with open,
standardized experimental, clinical, and simulation data. We will
-->
</dd><dd><b><i>invited by the National Cancer Institute </i></b></dd>
<!-- NWU -= Feb. 17 -->
<!-- unlisted -->
<!-- Brussels / ESMO -->
<dt style="font-weight: normal; margin-top: 5mm;">
<b><u>May 9, 2014</u>:</b>
European Society for Medical Oncology (<a href="http://www.esmo.org/">ESMO</a>) 2014 IMPAKT Breast Cancer Conference,
Brussels, Belgium<br />
</dt>
<dd><b>Title:</b> <i>Calibrating breast cancer simulations with patient pathology: Progress and future steps</i>
[<a href="http://www.esmo.org/Conferences/IMPAKT-2014-Breast-Cancer/Programme">programme</a>] <br />
<!-- <b>Summary:</b> TBA -->
</dd><dd><b><i>Plenary talk</i></b></dd>
<!-- Oxford -->
<dt style="font-weight: normal; margin-top: 5mm;">
<b><u>May 13, 2014</u>:</b>
<a href="http://www.maths.ox.ac.uk/groups/mathematical-biology">Wolfson Centre for Mathematical Biology</a> at the
<a href="http://www.ox.ac.uk/">University of Oxford</a>, Oxford, UK<br />
</dt>
<dd><b>Title:</b> <i>Advances in parallelized 3-D agent-based cancer modeling and digital cell lines </i>
[<a href="https://docs.google.com/document/d/14tQHNtmZ9s0eOYNz7LNNeom8rgbyr62v98hXcxpXq2s/pub">abstract</a>]
<!-- [<a href="http://aaas.confex.com/aaas/2014/webprogram/Paper11909.html">abstract</a>] --><br />
<!-- <b>Summary:</b> TBA -->
</dd>
<!-- USC Biostats -->
<dt style="font-weight: normal; margin-top: 5mm;">
<b><u>June 19, 2014</u>:</b>
Biostatistics Seminar, University of Southern California, Los Angeles<br />
</dt>
<dd><b>Title:</b> <i>Simulating 3-D systems of 500k cells with an agent-based model, and digital cell lines </i>[<a href="http://keck.usc.edu/Education/Academic_Department_and_Divisions/Department_of_Preventive_Medicine/Divisions/Biostatistics/Seminar_Series.aspx">link</a>]<!-- [<a href="http://aaas.confex.com/aaas/2014/webprogram/Paper11909.html">abstract</a>] --><br />
<!-- <b>Summary:</b> TBA -->
</dd>
<!-- COMBINE -->
<dt style="font-weight: normal; margin-top: 5mm;">
<b><u>Aug. 18, 2014</u>:</b>
COMBINE (<a href="http://co.mbine.org/">Computational Modeling in Biology Network</a>) 2014 Symposium,
University of Southern California, Los Angeles<br />
</dt>
<dd><b>Title:</b> <i>Digital cell lines and MultiCellDS: Standardizing cell phenotype data for data-driven cancer simulations</i>
[<a href="http://co.mbine.org/events/COMBINE_2014">Program</a>] <br />
<!-- <b>Summary:</b> TBA -->
</dd><dd><br /></dd><b>See Also: </b>
<dl><a href="http://mathcancer.blogspot.com/2013/01/2013-speaking-schedule.html">2013 public speaking schedule</a></dl>
<!-- MBI -->
<!-- [<a href="http://mbi.osu.edu/event/?id=495">website</a>] -->
</dl>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-28738438120589306832013-10-26T08:22:00.001-07:002013-10-26T08:22:40.683-07:00Website updates ...<p>I'm in the process of rolling out some updates to my website. The first
thing you'll see is a new talk / tutorial on computational modeling of biological processes,
based upon my recent talk at the <a href="http://uscpsoc.org/ShortCourse">USC PS-OC Short Course</a> in October 2013. I'll make another
post here when it's ready. It will include MATLAB source code to run through the models.</p>
<p>
In the medium term, I hope to update my list of <a href="http://MathCancer.org/Projects.php">projects</a> to better reflect current
efforts by my lab, particularly in (1) integrative modeling of cancer metastases using high-throughput <i>in vitro</i> experiments and
sophisticated bioengineered tissues for calibration and validation, and (2) development of standardizations for cell- and tissue-scale
models and experiments.</p>
<p>In the longer term, I hope to switch my website layout a bit to be more like the <a href="http://uscpsoc.org">USC PSOC website</a>. I
wrote that site about a year ago, and I like the CSS and structure a lot better. :-) </p>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a href="https://twitter.com/MathCancer" class="twitter-follow-button" data-show-count="false">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-81444344314604484752013-07-20T10:57:00.001-07:002013-07-20T12:14:21.236-07:00Interview at the 2013 NCI PS-OC Annual Meeting<p>I recently had the opportunity to be <a href="http://physics.cancer.gov/report/2013report/">interviewed</a> by <a href="http://humancomm-dev.clas.asu.edu/content/pauline-davies">Pauline Davies</a> at the <a href="http://www.capconcorp.com/meeting/2013/PSOC/default.asp">2013 Physical Sciences-Oncology Annual Meeting</a>.
(I gave one of the addresses–<b><i>"Exploring Possibilities for Next-Generation Computational Cancer Models that Work Together"</i></b>–at the meeting; <a href="http://mathcancer.org/publications/PSOC_2013_Program_Book_FINAL.pdf">agenda available here.</a>)
The interview (largely in layman's terms) discusses mathematical and computational modeling of cancer, the potential role for computational modeling in understanding cancer and making predictions that could help patients and their doctors make treatment choices, and the need for model and data standardizations to enable better predictions in the future. The interview draws parallels to hurricane predictions, where multiple models can read/write standardized data and be combined to improve their accuracy. </p>
<p>My interview can be <a href="http://physics.cancer.gov/report/2013report/PaulMacklin.aspx">found here</a>, as can the
<a href="http://physics.cancer.gov/report/2013report/">entire set of selected 2013 interviews</a>. You can find more information on
my <a href="http://MathCancer.org">lab</a> and work at <a href="http://MathCancer.org">MathCancer.org</a>.</p>
<p>I really want to thank
<a href="http://humancomm-dev.clas.asu.edu/content/pauline-davies">Pauline Davies</a>, <a href="http://physics.cancer.gov/opso/franca-koh.aspx">Jonathan Franca-Koh</a> and the <a href="http://www.cancer.gov/">NCI</a> <a href="http://physics.cancer.gov/">Office of Physical Sciences in Oncology</a> for the opportunity for this discussion!</p>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-6614087106723877582013-03-26T13:36:00.003-07:002013-03-27T09:35:39.779-07:00USC URAP to fund 3-person undergrad multidisciplinary cancer modeling team<p>We just got word from the <a href="http://www.usc.edu/programs/ugprograms/ugresearch/faculty_urp.shtml">USC Undergraduate Research Associates Program</a> (URAP) that I will have funding for a 3-person, multidisciplinary team of undergraduates starting summer 2013. This project will aim to assemble a team consisting of a computer programmer, a mathematician, and a biologist to jointly develop and refine user interfaces to make computational modeling of cancer faster and more accessible to a wider group of students. This work goes hand-in-hand with our educational goals in the
<a href="http://CICO.MathCancer.org">Consortium for Integrative Comptuational Oncology</a>. More details to come (including a job poster and selection details), but this should be a very fun and worthwhile project.</p>
<p>I'm really grateful to the URAP for this opportunity to fund some bright USC undergraduates in a neat project. Last year, <a href="http://MathCancer.org/People.php#undergrad_students">two of our interns</a> (Margy Gunnar and Alice Hyun) were funded under this program, and it was a fantastic experience (at least for me!) </p>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a href="https://twitter.com/MathCancer" class="twitter-follow-button" data-show-count="false">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-75909931237078098142013-02-12T09:04:00.000-08:002013-02-12T09:06:45.309-08:00Macklin Lab featured on March 2013 cover of Notices of the American Mathematical SocietyI'm very excited to be <a href="http://www.ams.org/notices/201303/">featured on this month's cover</a> of the Notices of the <a href="http://www.ams.org/">American Mathematical Society</a>. The cover shows a series of images from a multiscale simulation of a tumor growing in the brain, made with <a href="http://math.uci.edu/~lowengrb">John Lowengrub</a> while I was a Ph.D. student at <a href="http://math.uci.edu/">UC Irvine</a>. (See <a href="http://www.mathcancer.org/Publications.php#frieboes07_ni">Frieboes et al. 2007</a>, <a href="http://www.mathcancer.org/Publications.php#macklin09_jmb">Macklin et al. 2009</a>, and <a href="http://www.mathcancer.org/Publications.php#macklin08_jsc">Macklin and Lowengrub 2008</a>.) The "<a href="http://www.ams.org/notices/201303/rnoti-about.pdf">about the cover</a>" write-up (<a href="http://www.ams.org/notices/201303/rnoti-about.pdf">Page 325</a>) gives more detail.<br />
<br />
The inside has a <a href="http://www.ams.org/notices/201303/rnoti-about.pdf">short interview</a> on our more current work, particularly <a href="http://mathcancer.org/AMS2013">3-D agent-based modeling</a>. You should also read <a href="http://www.math.duke.edu/~rtd/">Rick Durrett</a>'s perspective <a href="http://www.ams.org/notices/201303/rnoti-p304.pdf">piece on cancer modeling</a> (Page <a href="http://www.ams.org/notices/201303/rnoti-p304.pdf">304</a>)—it's a great read! (And yup, Figure 3 is from our patient-calibrated breast cancer modeling in <a href="http://www.mathcancer.org/Publications.php#macklin12_jtb">Macklin et al. 2012</a>. ;-) )<br />
<br />
The entire March 2013 issue can be accessed for free at the AMS Notices website:<br />
<br />
<a href="http://www.ams.org/notices/201303/">http://www.ams.org/notices/201303/</a><br />
<br />
I want to thank <a href="http://www.math.ubc.ca/~cass/">Bill Casselman</a> and Rick Durrett for making this possible. I had a lot of fun in the process, and I'm grateful for the opportunity to trade ideas!<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-9585582125717677662013-01-01T02:57:00.000-08:002014-11-12T02:57:56.296-08:002013 Speaking ScheduleHere is my current speaking schedule for 2013. Please join me if you can!<br />
<dl>
<dt><b><u>March 22, 2013</u>:</b> Mathematical Biology Seminar, Department of Mathematics, Duke University, Durham, North Carolina</dt>
<dd><b>Title:</b> <i>From integration of multiscale data to emergent phenomena: the prognosis for patient-calibrated </i><i>computational oncology</i> [<a href="https://www.math.duke.edu/mcal?abstract-8042">abstract</a>]</dd>
<dt style="margin-top: 5mm;"><b><u>April 19, 2013</u>:</b> Fourth Annual National Cancer Institute Physical Sciences in Oncology Center (NCI PS-OCs) Network Investigators' Meeting, Phoenix, Arizona </dt>
<dd><b>Title: </b><i>Exploring possibilities for next-generation computational cancer models that work</i><br />
<i>together (a conversation starter) </i>[<a href="https://docs.google.com/document/d/1h1eB5EhuSGTSDgxrxaD4eP3_uk4C-dzrTLp3I20zzxs/pub">abstract</a>]<br />
</dd><dd><b><i>Plenary talk</i></b></dd>
<dt style="margin-top: 5mm;"></dt>
<dt style="margin-top: 5mm;"><b><u>May 30, 2013</u>:</b> Mathways into Cancer II International Workshop, Carmona, Spain</dt>
<dd><b>Title: </b><i>From multiscale data integration to predictions of emergent phenomena: the</i><br />
<i>prognosis for patient-calibrated computational oncology </i>[<a href="http://congreso.us.es/oncomath2013/main/main05.pdf">abstract</a>]<br />
</dd><dd><b><i>Plenary talk</i></b></dd><dd></dd>
<dt style="margin-top: 5mm;"></dt>
<dt style="margin-top: 5mm;"><b><u>June 12, 2013</u>:</b> Annual Meeting for the Society of Mathematical Biology (SMB), Mini-Symposium 11: Agent-based simulations in oncology: applications to therapeutics, Tempe, Arizona. </dt>
<dd><b>Title:</b> <i>Progress towards user-friendly, 3-D multiscale agent-based simulators for large (500k+ cells) </i><i>cancer systems: application to in situ growth and tumor-stroma interactions </i>[<a href="https://math.asu.edu/sites/math.asu.edu/files/attachments/book_of_abstracts_opt.pdf#page=163">abstract</a>]</dd>
<dt style="margin-top: 5mm;"><b><u>June 12, 2013</u>:</b> Annual Meeting for the Society of Mathematical Biology (SMB), Mini-Symposium 26: Patient-Specific Modeling of Cancer, Tempe, Arizona. </dt>
<dd><b>Title:</b> <i>Patient-calibrated 3-D simulations of ductal carcinoma in situ (DCIS) with comedonecrosis and </i><i>calcification </i>[<a href="https://math.asu.edu/sites/math.asu.edu/files/attachments/book_of_abstracts_opt.pdf#page=164">abstract</a>]<br />
</dd><dd><br /></dd><b>See Also:</b>
<dl><a href="http://mathcancer.blogspot.com/2014/02/upcoming-talks-2014.html">2014 public speaking schedule</a></dl>
</dl>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-51715191511981109492012-09-12T08:52:00.004-07:002012-09-26T15:17:15.989-07:00USC PSOC to host interdisciplinary cancer symposium<b><span style="color: red;">*** UPDATE: Registration has been extended to September 19, 2012, 5:00 pm Pacific Time. ***</span></b><br />
<br />
The <a href="http://physics.cancer.gov/">NCI-funded</a>, Physical Sciences in Oncology Center (PSOC) at USC is hosting its second annual symposium on interdisciplinary cancer research on September 27, 2012 from 7 am to 6 pm. The event is free but registration is required.<br />
<br />
The symposium will include a great diversity of expertise, spanning cell analysis, cancer evolution, modeling, drug delivery, and therapeutic response. We also have two fascinating keynote speakers: David A. Kirby, author of <i><a href="http://labcoatsinhollywood.com/">Lab Coats in Hollywood</a></i>, and <a href="http://www.theatlantic.com/corby-kummer">Corby Kummer</a>, senior editor and acclaimed food critic for the <i>Atlantic Monthly. </i>Here's the confirmed lineup:<br />
<br />
<b>Cell Analysis: </b><br />
<a href="http://ee.usc.edu/faculty_staff/faculty_directory/eun.htm">Eun Sok Kim</a> (University of Southern California)<br />
<a href="https://engineering.purdue.edu/Engr/People/ptProfile?resource_id=2871">Cagri Savran</a> (Purdue University)<br />
<b><br /></b>
<b>Mathematical Modeling:</b><br />
<a href="http://cico.mathcancer.org/People.php#newton">Paul Newton</a> (University of Southern California, and Co-Director of <a href="http://cico.mathcancer.org/">CICO</a>)<br />
<a href="http://www.stowers.org/faculty/kulesa-lab">Paul M. Kulesa</a> (Stowers Institute)<br />
<br />
<b>Cancer Evolution/Tumor Structures:</b><br />
<a href="http://biomedsci.ucsd.edu/faculty/faculty_descrip.aspx?id=229">Dwayne Stupack</a> (University of California San Diego)<br />
<a href="http://structure.usc.edu/ChenLab/">Lin Chen</a> (University of Southern California)<br />
<br />
<b>Drug Delivery/Therapeutic Response:</b><br />
<a href="http://www.princeton.edu/cbe/people/faculty/kevrekidis/">Yannis G. Kevrekidis</a> (Princeton University)<br />
<a href="http://www.doctorsofusc.com/doctor/bio/view/110799">David Agus</a> (University of Southern California)<br />
<a href="http://www.biomaterials.seas.harvard.edu/">Debra Auguste</a>, Harvard University<br />
<br />
It should be a wonderful event, and I hope you can attend!<br />
<br />
You can find the <a href="http://mathcancer.org/publications/USC_PSOC_2nd_Annual_Symposium_2012.pdf">full flyer and description here</a>.<br />
<br />
You can find the <a href="http://mathcancer.org/publications/PSOC_2nd_Annual_Symposium_Agenda.pdf">agenda here</a>.<br />
<br />
<a href="https://docs.google.com/spreadsheet/viewform?formkey=dDVEZ2luQU9hNU5qZXpLTnptQnpvWVE6MQ#gid=0">Click here</a> to <a href="https://docs.google.com/spreadsheet/viewform?formkey=dDVEZ2luQU9hNU5qZXpLTnptQnpvWVE6MQ#gid=0">register </a>(due by September <b><span style="color: red;">19</span></b>, 2012).<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-21356399149749042092012-06-15T08:59:00.002-07:002012-06-15T13:30:09.055-07:00Introducing CICO: The Consortium for Integrative Computational Oncology<div>
We've had some exciting times in the Macklin Math Cancer Lab!</div>
<br />
On May 18th, Paul Newton and I received received significant startup funding from the USC <a href="http://research.usc.edu/for-investigators/funding/usc/zumberge/">James H. Zumberge Research and Innovation Fund</a> to establish the <i>Consortium for Integrative Computational Oncology </i>(CICO). We're grateful for this opportunity to build a new resource for USC and the broader cancer community!<br />
<br />
CICO seeks to develop and promote cross-disciplinary, integrative collaborations across the USC (particularly the Viterbi School of Engineering and the Keck School of Medicine) in clinically-oriented cancer modeling. Among our guiding principles:<br />
<ul>
<li>Computational modeling of cancer must be driven by clinical needs. Modelers need to work hand-in-hand with clinicians at all steps of the modeling process.</li>
<li>Computational oncology works at its fullest potential when working with clinical data. This focus: </li>
<ul>
<li>drives advances in mathematical model design, </li>
<li>allows us to evaluate and choose between competing models, </li>
<li>helps biologists to test, validate, and refine current cancer biology orthodoxy, </li>
<li>helps clinicians to better interpret their data, and </li>
<li>is most likely to lead to computational tools that will make an impact in the clinic.</li>
</ul>
<li>Integrative computational oncology holds the potential to <i>integrate</i> advances from mathematical modeling, experiments, and clinical data into comprehensive tools that give a better understanding of cancer than any of these individual pieces alone. </li>
<li>Integrative computational oncology must include student education at its core, to create a true "ecosystem" of clinically-focused modeling students from the undergraduate to postdoctoral level. </li>
</ul>
You'll be hearing a lot more about CICO as we ramp up in the coming year!<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer">Follow @MathCancer</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-7170415724076871832012-05-14T15:35:00.004-07:002012-06-15T13:31:34.457-07:00Giving a talk at the PSOC Monthly Seminar<div style="text-align: justify;">
This is a definitely a thrill for me--I'm giving this month's talk at the USC PSOC seminar series. This should be a great opportunity to get the word out on what we're all about. In an unrelated note, be on the lookout for more frequent postings here (including some long promised to my friends in the <a href="http://www.smb.org/">SMB</a>!)</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Here are the talk details:<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<b>Date / Time: </b>Friday, May 18, 2012, noon - 1:00 pm</div>
<div style="text-align: justify;">
<b>Room / Building: </b>Harkness Auditorium; HSC Clinical Sciences Building, 2nd Floor; </div>
<div style="text-align: justify;">
<b>Address: </b>2250 Alcazar St., Los Angeles, CA 90033</div>
<div style="text-align: justify;">
<b>Lunch: </b>Free pizza at 11:45!</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<b>Title: </b>The Emerging Role of Patient-Calibrated Computational Modeling in Cancer Research: A Case Study in Ductal Carcinoma in Situ (DCIS)<br />
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<b>Abstract:</b> Current clinical oncology practice can generate a wide variety of data for patients. Radiology is used both to detect and plan surgical excisions. Immunostains performed on pre-surgical biopsies are used to diagnose (and grade) the cancers and select therapeutic agents. Molecular profiling may also help stratify patients and select therapeutic agents. However, there is currently no technique to quantitatively combine these diverse data sources, along with novel in vitro measurements, to improve surgical and therapeutic planning. In this talk, we will discuss efforts by my lab (<a href="http://mathcancer.org/">MathCancer.org</a>) and the Center for Applied Molecular Medicine to solve this issue. We will focus on developing and calibrating biologically-grounded computational models to individual patients (particularly ductal carcinoma in situ), encouraging (and validated!) results in quantitatively predicting clinical progression, the implications for making and quantitatively testing biological hypotheses, and the role of mathematical modeling in facilitating a deeper understanding of biology, pathology, and radiology. We anticipate that such efforts will play an increasing role in driving experimental cell biology, testing and challenging current cancer biology orthodoxy, and ultimately improving clinical care. </div>
<div style="text-align: justify;">
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/MathCancer" style="border: 1px solid black;">Follow @MathCancer</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
</script>
</div>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-56346896780826226302012-02-15T22:34:00.000-08:002012-06-01T11:06:02.998-07:00Grant submitted to the NSFToday, <a href="http://ae-www.usc.edu/personnel/newton/">Paul Newton</a> and I submitted a joint grant to the National Science Foundation in the<a href="http://www.nsf.gov/pubs/2012/nsf12514/nsf12514.htm"> Physical and Engineering Sciences in Oncology (PESO) program</a>. PESO is a neat program jointly run by the NSF and NCI, that has spun off the NCI's recent <a href="http://physics.cancer.gov/">physical sciences approach to cancer</a>. Our proposal brings together a a variety of techniques (spanning <a href="http://dx.doi.org/10.1016/j.jtbi.2012.02.002">agent-based models</a>, signaling, tissue biomechanics, fluid flow,<a href="http://dx.doi.org/10.1007/s10915-008-9190-z"> nonlinear transport</a>, and Markov chains) to study targeted aspects of cancer metastasis, from early microinvasion to circulating tumor cells (CTCs) to whole-body dissemination of metastatic disease. <br />
<br />
On a personal note, this is my first proposal as a Co-PI. *fingers crossed*<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a> <a class="button" href="http://mathcancer.org/">Return to MathCancer</a> <a href="https://twitter.com/MathCancer" class="twitter-follow-button" data-show-count="false">Follow @MathCancer</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-15336100182435097302012-02-02T11:46:00.000-08:002012-02-15T22:41:37.224-08:00Giving a talk at USC on Monday, February 6<span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">For those of you in the neighborhood, I'll be giving a on patient-calibrated computational modeling of breast cancer, and on the role of mathematical modeling in facilitating a deeper understanding of pathology and mammography.</span><br />
<br />
<span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">Monday, February 6, <a href="http://cams.usc.edu/">Center for the Applied Mathematical Sciences</a> (CAMS) at the University of Southern California. </span><br />
<br />
<b>Link and abstract: </b><a href="http://cams.usc.edu/Colloquia/2-6-2012.html"><span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;">http://cams.usc.edu/Colloquia/2-6-2012.html</span> </a><br />
<div>
<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a>
<a class="button" href="http://mathcancer.org/">Return to MathCancer</a>
</div>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-24207375892614990252012-02-01T09:05:00.000-08:002012-02-01T09:43:38.568-08:00DCIS modeling paper accepted<div>
<span style="color: black; font-family: inherit;"><a href="http://mathcancer.blogspot.com/2011/10/dcis-paper-resubmitted-lots-of-clinical.html">Recently</a>, I wrote about a major work we submitted to the Journal of Theoretical Biology: "<span style="background-color: #fafaf5; text-align: justify;">Patient-calibrated agent-based modelling of ductal carcinoma in situ (DCIS): From microscopic measurements to macroscopic predictions of clinical progression." </span></span></div>
<br />
I am pleased to report that our paper has now been accepted. You can <a href="http://www.mathcancer.org/Publications.php#macklin12_jtb">download the accepted preprint here</a>. We also have a lot of <a href="http://www.mathcancer.org/JTB_DCIS_2012/">supplementary material</a>, including simulation movies, simulation datasets (for 0, 15, 30, adn 45 days of growth), and open source C++ code for postprocessing and visualization. <br />
<br />
I <a href="http://mathcancer.blogspot.com/2011/10/dcis-paper-resubmitted-lots-of-clinical.html">discussed the results in detail here</a>, but here's the short version:<br />
<br />
<ol>
<li>We use a mechanistic, agent-based model of individual cancer cells growing in a duct. Cells are moved by adhesive and repulsive forces exchanged with other cells and the basement membrane. Cell phenotype is controlled by stochastic processes.</li>
<li>We constrained all parameter expected to be relatively independent of patients by a careful analysis of the experimental biological and clinical literature.</li>
<li>We developed the very first patient-specific calibration method, using clinically-accessible pathology. This is a key point in future patient-tailored predictions and surgical/therapeutic planning. </li>
<li>The model made numerous quantitative predictions, such as: </li>
<ol>
<li>The tumor grows at a constant rate, between 7 to 10 mm/year. This is right in the middle of the range reported in the clinic. </li>
<li>The tumor's size in mammgraphy is linearly correlated with the post-surgical pathology size. When we linearly extrapolate our correlation <i>across two orders of magnitude</i>, it goes right through the middle of a cluster of 87 clinical data points.</li>
<li>The tumor necrotic core has an age structuring: with oldest, calcified material in the center, and newest, most intact necrotic cells at the outer edge. </li>
<li>The appearance of a "typical" DCIS duct cross-section varies with distance from the leading edge; all types of cross-sections predicted by our model are observed in patient pathology. </li>
</ol>
<li>The model also gave new insight on the underlying biology of breast cancer, such as: </li>
<ol>
<li>The split between the viable rim and necrotic core (observed almost universally in pathology) is not just an artifact, but an actual biomechanical effect from fast necrotic cell lysis.</li>
<li>The constant rate of tumor growth arises from the biomechanical stress relief provided by lysing necrotic cells. This points to the critical role of intracellular and intra-tumoral water transport in determining the qualitative and quantitative behavior of tumors. </li>
<li>Pyknosis (nuclear degradation in necrotic cells), must occur at a time scale between that of cell lysis (on the order of hours) and cell calcification (on the order of weeks). </li>
<li>The current model cannot explain the full spectrum of calcification types; other biophysics, such as degradation over a long, 1-2 month time scale, must be at play.</li>
</ol>
</ol>
<div>
I hope you enjoy this article and find it useful. It is our hope that it will help drive our field from qualitative theory towards quantitative, patient-tailored predictions. </div>
<div>
<br /></div>
<div>
<b>Direct link to the preprint: </b><a href="http://www.mathcancer.org/Publications.php#macklin12_jtb">http://www.mathcancer.org/Publications.php#macklin12_jtb</a></div>
<div>
<br />
I want to express my greatest thanks to my co-authors, colleagues, and the editorial staff at the Journal of Theoretical Biology. </div>
<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a>
<a class="button" href="http://mathcancer.org/">Return to MathCancer</a>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-42023846688965623582011-11-17T12:52:00.000-08:002011-11-17T13:41:16.840-08:00Now hiring: Postdoctoral ResearcherI just posted a job opportunity for a <a href="http://www.mathcancer.org/Opportunities.php#postdoc_2011">postdoctoral researcher</a> for computational modeling of breast, prostate, and metastatic cancer, with a heavy emphasis on calibrating (and validating!) to <i>in vitro</i>, <i>in vivo</i>, and clinical data. <br />
<br />
If you're a talented computational modeler and have a passion for applying mathematics to make a difference in clinical care, please <a href="http://www.mathcancer.org/Opportunities.php#postdoc_2011">read the job posting and apply</a>!<br />
<br />
(<b>Note: </b>Interested students in the Los Angeles/Orange County area may want to attend my <a href="http://www.math.uci.edu/seminars_events/calendar.php?mode=allincat&catid=7">applied math seminar talk at UCI</a> next week to learn more about this work.)<br />
<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a>
<a class="button" href="http://mathcancer.org/">Return to MathCancer</a>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-68672092050609425012011-11-07T18:49:00.000-08:002011-11-07T18:49:04.349-08:00MMCL welcomes Gianluca D'AntonioThe <a href="http://www.mathcancer.org/">Macklin Math Cancer Lab</a> is pleased to welcome Gianluca D'Antonio, a M.S. student of <a href="http://calvino.polito.it/~preziosi/">Luigi Preziosi</a> and mathematician from <a href="http://www.polito.it/index.en.php">Politecnico di Torino</a>. Gianluca, who brings with him a wealth of expertise in biomechanics modeling, will spend 6 months at <a href="http://camm.usc.edu/">CAMM</a> at the <a href="http://keck.usc.edu/">Keck School of Medicine</a> of <a href="http://www.usc.edu/">USC</a> to model basement membrane deformation by growing tumors, biomechanical feedback between the stroma and growing tumors, and related problems. Gianluca's interests and expertise fit very nicely into our broader vision of mechanistic cancer modeling, as well as USC / CAMM's focus on applying the physical sciences to cancer (as part of the USC-led <a href="http://physics.cancer.gov/">PSOC</a>).<br />
<br />
He is our first international visiting scholar, and we're very excited for the multidisciplinary work we will accomplish together! So, please join us in welcoming Gianluca!<br />
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a>
<a class="button" href="http://mathcancer.org/">Return to MathCancer</a>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comtag:blogger.com,1999:blog-5199567777245279.post-51817570343549554642011-10-14T09:48:00.000-07:002011-10-14T09:48:48.242-07:00PSOC Short Course on Multidisciplinary Cancer ModelingNext Monday (October 17, 2011), the USC-led Physical Sciences Oncology Center / <a href="http://camm.usc.edu/">CAMM</a> will host a short course on multidisciplinary cancer modeling, combining the expertise of biologists, oncologists, and physical scientists. I'll attach a PDF flyer of the schedule below. I am giving a talk during "Session II - The Physicist Perspective on Cancer." I will focus on tailoring mathematical models from the ground up to clinical data from individual patients, with an emphasis on using computational models to make testable clinical predictions, and using these models a platforms to generate hypotheses on cancer biology. <br />
<br />
The response to our short course has been overwhelming (in a good way), with around 200 registrants! So, registration is unfortunately closed at this time. However, the talks will be broadcast live via a webcast. The link and login details are in the PDF below. I hope to see you there! -- Paul<br />
<br />
<b>Agenda</b><br />
7:00 am - 8:25 am : <b>Registration, breakfast, and opening comments, etc.</b><br />
David B. Agus, M.D. (Director of USC CAMM)<br />
W. Daniel Hillis, Ph.D. (PI of USC PSOC, Applied Minds)<br />
Larry A. Nagahara (NCI PSOC Program Director)<br />
<br />
8:30 am - 10:15 am : <b>Session I - Cancer Biology and the Cancer Genome</b><br />
Paul Mischel, UCLA - The Biology of Cancer from Cell to Patient, Oncogenesis to Therapeutic Response<br />
Matteo Pellegrini, UCLA - Evolution in Cancer<br />
Mitchelll Gross, USC - Historical Perspective on Cancer Diagnosis and Treatment<br />
<br />
10:30 am - 12:15 pm : <b>Session II - The Physicist Perspective on Cancer</b><br />
Dan Ruderman, USC - Cancer as a Multi-scale Problem<br />
Paul Macklin, USC - Computational Models of Cancer Growth<br />
Tom Tombrello, Cal-Tech - Perspective: Big Problems in Physics vs. Cancer<br />
<br />
1:45 pm. - 3:10 pm : <b>Session III - Novel Measurement Platforms & Data Management & Integration</b><br />
Michelle Povinelli, USC - The Role of Novel Microdevices in Dissecting Cellular Phenomena<br />
Carl Kesselman, USC - Data Management & Integration Challenges in Interdisciplinary Studies<br />
<br />
3:10 pm - 3:40 pm : <b>Session IV - Creativity in Research at the Interface between the Life and Physical Sciences</b><br />
'Fireside Chat' David Agus and Danny Hillis, USC<br />
<br />
4:00 pm - 5:00 pm : <b>Capstone - Keynote Speaker</b><br />
Tim Walsh, Game Inventor, Keynote Speaker<br />
<br />
5:30 pm - 8:00 pm : <b>Poster Session and Reception</b><br />
<b><br /></b><br />
<div style="text-align: center;">
<span class="Apple-style-span" style="color: red;"><b><a href="http://mathcancer.org/publications/PSOC_short_course_2011.pdf">Click here for the poster, including webcast information:</a> <a href="http://mathcancer.org/publications/PSOC_short_course_2011.pdf">http://mathcancer.org/publications/PSOC_short_course_2011.pdf</a></b></span></div>
<div style="text-align: center;">
<br /></div>
<hr class="end_post" />
<div style="text-align: center;">
<a class="button" href="http://mathcancer.blogspot.com/">Return to News</a>
<a class="button" href="http://mathcancer.org/">Return to MathCancer</a>
</div>Paul Macklinhttp://www.blogger.com/profile/09297161792728160749noreply@blogger.comUniversity of Southern California - Park Campus, 699 Exposition Blvd, Los Angeles, CA 90089, USA34.0233473 -118.283816534.0171358 -118.29152500000001 34.0295588 -118.276108