# IMPETUS – Interactive MultiPhysics Simulation Environment

## Tutorials

### Tutorial 0: Using the Tutorial

### Tutorial 1: Creating a simple Molecular Dynamics Simulation

### Tutorial 2: Solving the Diffusion equation using Interactive Field

### Tutorial 3: Simple Chemotaxis Model

### Full PDF tutorial is also available.

### Download IMPETUS and Tutorials.

# Tutorial 3: Simple Chemotaxis Model

## 3.1 Introduction

This section of the tutorial will guide the users to couple the “CellSpace” MID with the “InteractiveField” MID into one simulation. We will demonstrate a numerical model that simulates chemotaxis. Particles from “CellSpace” will detect the concentration field generated by the “InteractiveField” and migrate along the maximum concentration gradient.

This section of the tutorial is located in:

Tutorials/tutorialChemotaxis/

Include the header for the simple molecular dynamics simulation by inserting the following line in main.cpp

#include "../Tutorials/tutorialChemotaxis/chemotaxis.h"

## 3.2 More InteractiveField Functions

·
To get the concentration _{} at a certain coordinate x0, y0, z0,the user should use:

double concentration = c -> getConcentration(x0, y0, z0);

·
To get the gradient of the concentration _{} at a certain coordinate x0, y0, z0, the user should use:

vec3 gradient = c -> getGradient(x0, y0, z0);

## 3.3 Building a Cross-interactive Function using “getPartList”:

The function “getPartList” will use the coordinate of the particles in the “CellSpace” to acquire the gradient vector of the diffusion. The particles will follow this gradient to migrate towards the highest concentration point.

· The function is called as:

Migration_tutorial mg0(s0, c0);

· It is used as:

mg0.apply();

** **

## 3.4 Creating Sinks and Sources

In this example, we introduce a sink and a source in the concentration field. The source is simulated by constantly setting the concentration at the point where the source is located at a specific value. Here, we use the value of 10. The sink is simulated by constantly setting the concentration to -10). The two functions are placed in a “while” loop.

double x_mid = (param->gridinfo->world.lo[0] + param->gridinfo->world.hi[0]) /2;

double y_mid = (param->gridinfo->world.lo[1] + param->gridinfo->world.hi[1]) /2;

double z_mid = (param->gridinfo->world.lo[2] + param->gridinfo->world.hi[2]) /2;

c0->setConcentration(x_mid+0.4*x_mid,y_mid,z_mid,10 );

c0->setConcentration(x_mid-0.4*x_mid,y_mid,z_mid,-10 );

By combining everything that we discussed so far, we can create the following chemotaxis model:

Results
are shown in **EXAMPLES**.