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

Diffusion in solids and biofilms #6

Open
tengzhang48 opened this issue Jun 13, 2022 · 5 comments
Open

Diffusion in solids and biofilms #6

tengzhang48 opened this issue Jun 13, 2022 · 5 comments

Comments

@tengzhang48
Copy link

Hello,

I am learning the examples and the codes. My interests are biofilm growth and spread on a solid substrate and mechanically breaking biofilm with active solid deformation. I can already simulate nonlinear elastic solids in lammps/nufeb and understand most parts of the nufeb but have some questions about the diffusion/reaction parts:

  1. I noticed that there is a "dynamic" in the coefficient code. This seems to consider the effect of the solid biofilm parts. Do you have examples of using this?
  2. The initial values of the chemical components can be set by "grid_modify". From the example, it seems this command will set the concentration for all the simulation box. If I would like to set up concentrations at different locations of the box, such as the solid substrate and initial biofilm?

Best,
Teng

@shelllbw
Copy link
Member

Hi Teng, the dynamic diffusion coeff implements the equation (2) in https://doi.org/10.1016/j.watres.2013.10.053
Basically the value at each diffusion grid depends on its biomass density. You could use the following command to apply the setting:
fix coeff_sub all nufeb/diffusion_coeff sub dynamics

For 2, unfortunately, nufeb does not support such flexible setting. The only way is to hack the code. I can write a simple instruction if you want.

Bowen

@tengzhang48
Copy link
Author

Hi Bowen,

Thanks a lot for your quick reply. Yes, I am interested in modifying the code. Could you please share some instruction for me?

Best,
Teng

@shelllbw
Copy link
Member

shelllbw commented Jun 16, 2022

When using grid_style command, the computational domain will be discretised into cubic mesh with an extended grid layer (ghost grids) at each surface to store boundary values. Also, iterating over a mesh starts from the grid with minimum x y z coordinates, then follow left-to-right (x), front-to-back (y), bottom-to-top (z).

To customize initial concentration, you need to modify GridVecChemostat::set_grid function in NUFEB-dev/src/USER-NUFEB/grid_vec_chemostat.cpp file. The function loops over all the grids and initialise their concentration values.

@param isub: index of substrate
@param domain: initial concentration of non-dirichlet grids
@param bulk: initial (bulk) concentration of dirichlet grids
variable grid->subbox[3]: number of grids (including ghost grids) in x y z.

Below is an example of assigning 10kg/m3 my_sub to the bottom layer and extended bottom layer grids, the rest of the grids are still based on the parameters defined in input file.

void GridVecChemostat::set_grid(int isub, double domain, double bulk) 
{
  for (int i = 0; i < grid->ncells; i++) {
    if (!(mask[i] & CORNER_MASK)) {
      // set bulk concentration to dirichlet boundary grids
      if (((mask[i] & X_NB_MASK) && (boundary[isub][0] == DIRICHLET)) ||
	  ((mask[i] & X_PB_MASK) && (boundary[isub][1] == DIRICHLET)) ||
	  ((mask[i] & Y_NB_MASK) && (boundary[isub][2] == DIRICHLET)) ||
	  ((mask[i] & Y_PB_MASK) && (boundary[isub][3] == DIRICHLET)) ||
	  ((mask[i] & Z_NB_MASK) && (boundary[isub][4] == DIRICHLET)) ||
	  ((mask[i] & Z_PB_MASK) && (boundary[isub][5] == DIRICHLET))) {
	conc[isub][i] = bulk;
      } else {
	conc[isub][i] = domain;
        // set 10kg/m3 my_sub to the grids of bottom layer and extended bottom layers
	if (!strcmp(grid->sub_names[isub], "my_sub")
            && (i < grid->subbox[0] * grid->subbox[1] * 2)) {
	  conc[isub][i] = 10;
	}
      }
    }
    grid->reac[isub][i] = 0.0;
    grid->diff_coeff[isub][i] = 0.0;
  }
}

Here is an example of assigning 10kg/m3 my_sub to the top layer grids only (extended top layer is excluded)

void GridVecChemostat::set_grid(int isub, double domain, double bulk) 
{
  for (int i = 0; i < grid->ncells; i++) {
    if (!(mask[i] & CORNER_MASK)) {
     ......
      } else {
	conc[isub][i] = domain;
        // set 10kg/m3 my_sub to top layer grids
	if (!strcmp(grid->sub_names[isub], "my_sub") 
            && (i > grid->subbox[0] * grid->subbox[1] * (grid->subbox[2]-2)) 
            && (i < grid->subbox[0] * grid->subbox[1] * (grid->subbox[2]-1))) {
	  conc[isub][i] = 10;
	}
      }
    }
  .....
  }
}

@shelllbw
Copy link
Member

You can use paraview to validate the change. Dont forget to reinstall nufeb to apply the change.

@tengzhang48
Copy link
Author

Thank @shelllbw a lot for the detailed guidance. I will try to modify the code next week.

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