Open tengzhang48 opened 2 years ago
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
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
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;
}
}
}
.....
}
}
You can use paraview to validate the change. Dont forget to reinstall nufeb to apply the change.
Thank @shelllbw a lot for the detailed guidance. I will try to modify the code next week.
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:
Best, Teng