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 2 : Solving the Diffusion equation using Interactive Field
2.1 Introduction
This tutorial will guide users to create a simple simulation to solve the diffusion equation using the “InteractiveField” MID. Where is the concentration and is the constant diffusion coefficient, by using the continuum field component of the program.
· The tutorial is located in:
Tutorials/tutorialHeat/
· For a diffusion simulation, insert the line below in the main.cpp:
#include "../Tutorials/tutorialHeat/heat.h"
2.2. The “InteractiveField” Object
The “InteractiveField” object is the discretized physical space defined by a grid of nodes. Field equations can be solved numerically at the nodes. Here, we follow the explicit finite difference method. The “Parameters” object is required to create the “InteractiveField” object. The following example shows how to create the object using an input file:
vamde::InteractiveField * c0;
vamde::InteractiveField::Cinit continit;
continit.readinput("Tutorials/tutorialHeat/input/cont0.input");
c0 = new vamde::InteractiveField(continit,param);
The required parameters for constructing the “InteractiveField” are
· Minimum number of total nodes on each axis: nx, ny, nz. The simulation engine will divide the continuum to the processors and rounding up so that the number of nodes is the same in every processor. Therefore the resulting number of nx, ny and nz may be slightly higher than the assigned value.
int nx, ny, nz;
· Ghost layer is the size of the shell layer used in processor communication
int ghost_layer;
· A printing path is required for the generated .cfg configuration files but it is not required to construct the field:
char *output_directory_name;
An example for an input file cell0.input is shown below:
Common InteractiveField Functions:
· The diffusivity can be adjusted:
c0->diffusivity = 0.05;
· Several boundary conditions can be used. Examples on how to use sink/source and insulators as boundary conditions are as follows:
c0->setAllGlobalBoundarySink();
c0->setAllGlobalBoundaryInsulated()
· Users can set a concentration value “concentration_val” to a certain location x0, y0, z0 as follow:
c0->setConcentration( x , y , z , concentration_val);
· To print configuration .cfg files to a provided output directory name, we use the function:
c0->cfgwriter->print();
· To copy the nodes of the border of one processor to the shell layer of its adjacent processor as pseudo nodes, we use the function:
c0->copyParticles();
· This function will specifically integrate the parabolic equation.
c0->IterateParabolicPDE();
Creating a Simulation
The following example shows how to use the functions defined above along with what we discussed in (Supplementary Software 2) to build a simple diffusion simulation.
Results are shown in EXAMPLES.