Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DC function standardization #214

Open
drbergman opened this issue Feb 26, 2024 · 1 comment
Open

DC function standardization #214

drbergman opened this issue Feb 26, 2024 · 1 comment

Comments

@drbergman
Copy link
Contributor

drbergman commented Feb 26, 2024

There are many functions provided in BioFVM_microenvironment.cpp designed for implementing Dirichlet conditions (DCs). However, there is inconsistency across what they do and the naming conventions shed little light on what their under-the-hood differences are. Case in point (and maybe even the whole enchilada):

  • add_dirichlet_node does not update dirichlet_activation_vectors and thus cannot be used to start applying a DC
  • update_dirichlet_node( int voxel_index , int substrate_index , double new_value ) does do this but...
  • update_dirichlet_node( int voxel_index , std::vector<double>& new_value ) does not
@rheiland
Copy link
Collaborator

This goes back to #124 and my refactor of BioFVM_microenvironment.{h/cpp} to fix the DC bug that you had reported then. However, my refactoring did not include making any changes to the two flavors of update_dirichlet_node (one for a scalar and one for a vector), i.e., this from 1.11.0 is the same as the current 1.13.1 version:

void Microenvironment::update_dirichlet_node( int voxel_index , std::vector<double>& new_value )
{
	mesh.voxels[voxel_index].is_Dirichlet = true; 
	dirichlet_value_vectors[voxel_index] = new_value; 
	
	return; 
}

void Microenvironment::update_dirichlet_node( int voxel_index , int substrate_index , double new_value )
{
	mesh.voxels[voxel_index].is_Dirichlet = true; 
	dirichlet_value_vectors[voxel_index][substrate_index] = new_value; 
	
	dirichlet_activation_vectors[voxel_index][substrate_index] = true; 
	
	return; 
}

We need to clearly define and document what updating an entire vector of DCs even means. Does "update" imply they will also always be activated, i.e., set true, or does it mean the values will be updated but not necessarily their activation? I remember spending a LOT of time on the bug fix earlier and just want to make sure we're in agreement on what to do now.

Fwiw, here's a comment from the User Guide (which is somewhat deprecated of course):

Note that turning on or off a Dirichlet condition for a substrate applies it at all Dirichlet nodes for which
is_dirichlet_node(int voxel_index) is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants