Comments (12)
As an example of unexpected behavior:
The implementation of update_dirichlet_node
, which seems meant for being the simplest way of setting a DC for a single substrate at a single voxel, can lead to unexpected behavior. To see this, make the template project. Add DCs to substrate
with value 38. Then, add a second substrate with DCs off. Finally, use the following in custom.cpp
for setup_microenvironment
and run.
void setup_microenvironment( void )
{
initialize_microenvironment();
microenvironment.update_dirichlet_node( 175 , 1 , 1 ); // note that this supposedly leaves "substrate" (with index 0) alone
return;
}
the first substrate will end up with a DC of value 0 also at voxel 175:
from physicell.
HI, I wanted to touch base with you. Is this still unresolved?
from physicell.
Yeah, it still is unresolved when using the latest PhysiCell release.
from physicell.
Thanks, Daniel. Sorry I didn't see the response.
Maybe we should have a quick call about it in the next week or so, so we can examine and plan expected behavior for a fix in 1.11.1.
It might be a bug, or could be poor documentation, so I'd like to work it super carefully. Thank you!
from physicell.
That would work for me!
from physicell.
I created a unit test of sorts which seems to do what I expect. If nothing else, we have a concrete test for reference. I will likely do a PR to PhysiCell dev eventually; never too many tests. Rf the Readme.txt, the custom.cpp setup_microenvironment
, and the 2 .png images.
https://github.com/rheiland/PhysiCell/tree/development/unit_tests/custom_DCs_2substrates
from physicell.
And I just created a custom_v2.cpp which is more similar to your example in that it only changes a single (center) voxel value of just one substrate (oxygen) and leaves the other alone. See the updated files and Readme.txt. I also fixed the config file so the PMB/Studio (v2.19.2) would be happy. See *v2.png files too.
from physicell.
To more closely mimic Daniel's original test, I committed a new config file with the glucose BCs=99:
<variable name="glucose" units="dimensionless" ID="1">
<physical_parameter_set>
<diffusion_coefficient units="micron^2/min">0</diffusion_coefficient>
<decay_rate units="1/min">0</decay_rate>
</physical_parameter_set>
<initial_condition units="particles/micron^3">0</initial_condition>
<Dirichlet_boundary_condition units="particles/micron^3" enabled="True">99</Dirichlet_boundary_condition>
<Dirichlet_options>
<boundary_value ID="xmin" enabled="True">99</boundary_value>
<boundary_value ID="xmax" enabled="True">99</boundary_value>
<boundary_value ID="ymin" enabled="True">99</boundary_value>
<boundary_value ID="ymax" enabled="True">99</boundary_value>
<boundary_value ID="zmin" enabled="False">0</boundary_value>
<boundary_value ID="zmax" enabled="False">0</boundary_value>
</Dirichlet_options>
</variable>
Running the test using the simpler custom_v2.cpp where we only do:
void setup_microenvironment( void )
{
initialize_microenvironment();
int idx_oxygen = 0; // just hard-coded; better to get index by name.
double oxy_value = 40.0;
microenvironment.update_dirichlet_node( 4, idx_oxygen, oxy_value);
}
it seems like we still have the expected results? Perhaps I'm still missing something though. See https://github.com/rheiland/PhysiCell/blob/development/unit_tests/custom_DCs_2substrates/oxygen_v2.png and https://github.com/rheiland/PhysiCell/blob/development/unit_tests/custom_DCs_2substrates/glucose_v2.png
from physicell.
I finally got back to this and think I've fixed the bug, taking an approach that Paul agreed with, whereby we assume DC activation is false everywhere (instead of true, as it was previously), then just set it true when needed.
Please test if you get a chance, from this branch: https://github.com/MathCancer/PhysiCell/tree/dev-randy-DCs
- see diffs in BioFVM_microenvironment.h and .cpp
- changed
true
tofalse
in many places - added a new method
get_substrate_dirichlet_value
- commented out a loop at the very end setting activation vectors (rf.
April 2023
comment)
- changed
- see
unit_tests/custom_DCs_2substrates
(and Readme.txt there)
Not sure if we also want to fix a method with confusing args, rf. TODO? fix confusing swapped usage of args
comment in BioFVM_microenvironment.cpp
from physicell.
I just pushed this same fix into my (rheiland) fork (dev branch) for 1.12.0 (https://github.com/rheiland/PhysiCell/tree/development) and will do a PR into the MathCancer dev branch after some more testing. Please feel free to test your use case(s). I created a new, very simple one which also illustrated the bug before the fix:
- create 2 substrates: subA and subB
- specify DC only on xmax boundary of subA
- specify DC only on ymax boundary of subB
- run and plot results
Bug: Both DCs on both boundaries appear on both substrates.
from physicell.
Hello!
Do we feel this is now resolved in 1.13.0?
Thanks for your great work on this!
from physicell.
Yes! I believe it is resolved!
from physicell.
Related Issues (20)
- rename cancer_biorobots executable
- Compiling PhysiCell in a MacBook Pro with M2 HOT 1
- cell_rules.csv has typos
- PhyisiCell_rules typo in some Makefiles HOT 1
- hierarchical XML config files
- Improvement: flexible output
- Improvement: output.xml files with cell_type and substrate names
- Improvement: max_time or max_cell to stop execution
- Improvement: code generates output folder HOT 4
- Cell definitions share fixed_duration boolean for apoptosis death model HOT 5
- Sporadic error when rules sharing cell type and behavior HOT 14
- suspicious that custom data conserved attribute not being set HOT 2
- make reset - avoid "rm *.cpp"? HOT 6
- DC function standardization HOT 1
- Passing in files and folders as command line arguments
- Improvement: lineage tree information in default output HOT 1
- Improvement: Makefile save command automatically adjusts PROJ := my_project HOT 1
- Clarifying attack/damage rates HOT 2
- saving rules v1 instead of v2 to /output HOT 3
- Command "make" errors out on windows HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from physicell.