### Linear Gradient

88
views
0
3 months ago by
I was wondering if there is any way to create a linear gradient for chemotaxis.
So far I have tried using a second cell type to secrete a chemoattractant and I managed to make the edges of the window secrete by giving the boundary conditions in the diffusion solver steppable code a value.
But this produces a gradient which is steeper at the sides than in the middle
.

Does anyone know a way to make the gradient linear?

Community: CompuCell3D
Hi Tarqwin!  You should be able to do this by making the boundary conditions not constant, but a zero derivative (zero change at each point along the boundary, so each pixel-length of boundary will stay at the same value as the pixel next to it). The code below is the chunk for a complete field inside of your diffusion solver of choice (I am using DiffusionSolverFE).  The constant boundaries portion is commented out.  I assume you will not need the z-dimension boundaries, either....

Hope this works for you!

  <DiffusionField Name='Chemical'>
<DoNotScaleSecretion/>
<DiffusionData>
<GlobalDiffusionConstant>1.0</GlobalDiffusionConstant>
<GlobalDecayConstant>0</GlobalDecayConstant>
</DiffusionData>
<SecretionData>
<ConstantConcentration Type="Cell">0.0</ConstantConcentration>
</SecretionData>
<BoundaryConditions>
<!-- CONSTANT BOUNDARIES -->
<!-- <Plane Axis="X"> -->
<!--   <ConstantValue PlanePosition="Min" Value="0"/> -->
<!--   <ConstantValue PlanePosition="Max" Value="0"/> -->
<!-- </Plane> -->
<!-- <Plane Axis="Y"> -->
<!--   <ConstantValue PlanePosition="Min" Value="0"/> -->
<!--   <ConstantValue PlanePosition="Max" Value="0"/> -->
<!-- </Plane> -->
<!-- <Plane Axis="Z"> -->
<!--   <ConstantValue PlanePosition="Min" Value="0"/> -->
<!--   <ConstantValue PlanePosition="Max" Value="0"/> -->
<!-- </Plane> -->
<!-- <Plane Axis="X"> ></Plane> <Plane Axis="Y"><Periodic/> </Plane> -->
<!-- CONSTANT DERIVATIVE BOUNDARIES -->
<Plane Axis="X">
<ConstantDerivative PlanePosition="Min" Value="0"/>
<ConstantDerivative PlanePosition="Max" Value="0"/>
</Plane>
<Plane Axis="Y">
<ConstantDerivative PlanePosition="Min" Value="0"/>
<ConstantDerivative PlanePosition="Max" Value="0"/>
</Plane>
<Plane Axis="Z">
<ConstantDerivative PlanePosition="Min" Value="0"/>
<ConstantDerivative PlanePosition="Max" Value="0"/>
</Plane>

</BoundaryConditions>
</DiffusionField>​
written 3 months ago by Kim Kanigel Winner

### 2 Answers

1
3 months ago by
Do you want a static chemical gradient or a changing one? If you want a static gradient, you can set the initial condition to be, e.g. x* constant, and then set the diffusion constant and decay constants to zero.
e.g.

<Steppable Type="DiffusionSolverFE">
<DiffusionField Name="Oxygen">
<DiffusionData>
<FieldName>Oxygen</FieldName>
<DiffusionConstant>0.0</DiffusionConstant>
<DecayConstant>0.0</DecayConstant>
<InitialConcentrationExpression>x*CONSTANT</InitialConcentrationExpression>
</DiffusionData>
</DiffusionField>
</Steppable>​

If you don't want the gradient to be static, because you will do something else to it later, you can use fixed boundary conditions along the X=0 and x=x_max edges and periodic boundaries along the other sides.

<Steppable Type="DiffusionSolverFE">
<DiffusionField Name="Oxygen">
<DiffusionData>
<FieldName>Oxygen</FieldName>
<DiffusionConstant>5.0</DiffusionConstant>
<DecayConstant>0.001</DecayConstant>
<InitialConcentrationExpression>x*10/x_dim</InitialConcentrationExpression>
</DiffusionData>
<BoundaryConditions>
<Plane Axis="Y">
<ConstantValue PlanePosition="Min" Value="0.0"/>
<ConstantValue PlanePosition="Max" Value="10.0"/>
</Plane>
<Plane Axis="X">
<Periodic/>
</Plane>
</BoundaryConditions>
</DiffusionField>
</Steppable>

I don't have CC3D running on this computer, so check that I haven;'t reversed X and Y!

This is the way to do it. You may also set concentration directly in Python but the solution that James presented should do the trick
written 3 months ago by Maciek Swat
Can you specify a gradient in specific regions on a lattice? For example, paper-discs with antibiotic on a petri dish? I imagine it would involve specifying boundary conditions in specific regions.
written 8 weeks ago by Scott H
0
8 weeks ago by
I would add it as a new cell type and then add a diffusing chemical to that cell type. You would initialize your "disc" cell, perhaps with BlobInitializer. Then, assuming reduction in the available antibiotic diffusing from the disc is negligible compared to the length of the simulation, you would set a constant concentration of "antibiotic" for your "disc" cell type in your diffusion solver above. No need to change boundary conditions from what James said above (sorry I missed putting in the constant boundary for your previous question).
Ah ok, that makes sense. I will try that. I have cell layers, so that will work if I put the source underneath at z=0 and put the cell layers at z>1, for a 2D model at least.
written 8 weeks ago by Scott H
yes, that might work if you embed the source into the z=0 boundary, using the boundary definitions. I'm not sure if you can put cells (in this case the disc) into the boundary level; I also have never tried defining a small area of a boundary as constant -- you might also have to define the rest of the plane as 0, or something like that. If you don't want to play with defining constant conditions for all of the z boundary, and instead add the disc cell type, I think it will take up that space in your 2-D domain, and cells will not crawl on top.... however, if your disc is small, I doubt that it would change the result of your simulation (and it would be easier to implement, most likely!).
written 8 weeks ago by Kim Kanigel Winner
Please login to add an answer/comment or follow this question.

Similar posts:
Search »