22
Václav Štumbauer 14 December 2010 Supported by European Social Fund - Education for Competitiveness OP - under project Education for South Bohemia research capacity - CZ.1.07/2.3.00/09.0203

Simulation software for microalgae cultivation in ... · Simulation software for microalgae cultivation in photobioreactor A student project Václav Štumbauer 14 December 2010 Supported

Embed Size (px)

Citation preview

Simulation software for microalgae cultivation in

photobioreactorA student project

Václav Štumbauer

14 December 2010

Supported by European Social Fund - Education for Competitiveness OP -under project Education for South Bohemia research capacity -CZ.1.07/2.3.00/09.0203

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 1 / 22

Project introduction

Overall goal

Project’s overall aim is having a computationally efficient photobioreactorsimulation software.

What does that imply?

Simulation of hydrodynamicsReaction simulationEfficient - parallel architectureCalibration and validation - real world experiments

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 2 / 22

Financial resources usage

Financial resources usage

20.000 CZK - oxygen evolution measurement probe

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 3 / 22

Methods and technologies

Methods and technologies

Hydrodynamics: Lattice-Boltzmann method (LBM)Reaction: Photosynthetic factory (PSF)Efficient implementation: CUDA - GPU based parallel architecture

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 4 / 22

Project roadmap

Project roadmap

LBM functional prototype - CPU C/C++PSF functional prototype - CPU C/C++LBM and PSF efficient implementation - GPU C/C++Real experiments for calibration and validation

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 5 / 22

LBM

Basics

Boltzmann eq. based CFDParticles confined to discrete lattice

LBM applicability properties

Complex geometries - blood flow,...Multicomponent and multiphase flowsParallelismShear stress tensor (from ineq. flow densities)

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 6 / 22

LBM

Boltzmann

Single particle distribution function.

f1(x + dx,p + dp, t+ dt)dxdp = f1(x,p, t)dxdp + [Γ(+) − Γ(−)]dxdpdt

f1(x,p, t)dxdp - probable # of molecules in phase space regionΓ(+) - # of molecules added by collissionsΓ(−) - # of molecules "stolen" by collissions

LBM

fa(x + ea, n+ 1) = fa(x, n) − [fa(x, n) − feqa (x, n)]

τ

ν =13

(τ − 12

)

ν - fluid kinematic viscositySafe range for τ is ( 1

2 , 1 >

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 7 / 22

LBM

D2Q9

Two dimensions, nine discrete directions.Locality of the collission operator makes LBMparallelisation friendly.

BGK

BGK relaxation model to local equilibria.

feqa (x, n) = waρ(x, n)[1 + 3

ea · u(x,n)c2

+92

(ea · u(x, n))2

c4− 3

2u2(x, n)

c2]

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 8 / 22

PSF

PSF

Probabilistic 3-state description of growingmicroorganism.

1 = xA + xI + xR

dxR

dt= γxA + δxI − αuxR

dxA

dt= −γxA + αuxR − βuxA

dxI

dt= −δxI + βuxA

Average amount of activated state => growth rate:

µ = κγxA −Me

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 9 / 22

PSF transformation

PSF transformation

Each particle is in one of the possible statesOnly 3 state integer per particle instead of 2 partial probabilities

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 10 / 22

Implementation - Results

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 11 / 22

Phase 1 - Prototype

LBM Prototype

C/C++ basedOpenGL visualisationOnly bounce-back and periodic boundariesInnefficient implementationNo particle trackingNo GUI - all definitions in #includes

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 12 / 22

Phase 2 - E�cient implementation

Bioractor simulation software

C/C++ GUI applicationCUDA basedOpenGL visualisation - CUDA->GLinterop.Strain and illumination parameters,domain size may be specifiedSplit into 3 logical parts - GUI code,LBM and PSF modules

Developed under 32-bit GNU Linux, but with multiplatformity in mind:CMake, wxWidgets, OpenGL, CUDA, Glew, PLPlot (+its wxWidgetsextension) Haven’t been attempted yet, but should be portable to Windows R©.

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 13 / 22

Phase 2 - E�cient implementation

LBM module

lbmkernels.hMain LBM module interface methods:

lbmInit(LBMParams& lbmParams, );lbmDestroy();lbmSimulationStep();lbmRenderOutputIntoTexture(int *d_particleStates);float *lbmGetDeviceParticlePositionsX();float *lbmGetDeviceParticlePositionsY();

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 14 / 22

LBM module simulation step

LBM module simulation step

All hydrodynamics simulation parts are done on CUDA.The LBM simulation step is split into 5 kernels:

kern_streaming - streaming stepkern_boundaries - bounce-back, inlet, outletkern_updateMacroVariables - macro velocities and densitieskern_collissions - modifying micro flow densities according to D2Q9 BGKkern_updateParticlePositions - particle tracker

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 15 / 22

LBM module - streaming

LBM module - streaming

Streaming utilizes texture memory.Current micro flow densities are copied into cuda arraysArrays are mapped as texturesAll the threads in a warp access nearby pointsPerformance boost - texture memory optimised for 2D spatial locality

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 16 / 22

LBM module

LBM module - simulation use case

2D LBM solver can successfully simulate karman vortex shedding -formation of alternating eddies behind an obstacle.Solver can track particles present in the flow - raw tracking - currentvelocity vector+noise

@see also karman_flow_with_particles.avi

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 17 / 22

PSF module

PSF module

psfkernels.h Main PSF module methods:psfInit(PSFParams &psfParams, float timeStep, ...)psfDestroy()psfSimulationStep()float psfGetGrowthRate(long stepsTaken)int *psfGetDeviceParticlePhotoStates()

cuRand PRGN library is used for state switching.@see also: video_particles_only.avi

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 18 / 22

Growth rate

Growth rate

Following growth curve was obtained for the test setup of flat panel 40x10 cm,0.2m/s overall flow speed. Strain Porphyridium sp., Surface illuminationcalculated so that average irradiance in the vessel was 250 µEm−2s−1

Curve is both qualitatively and quantitavely in agreement with older resultsbased on Random Walk models.

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 19 / 22

Experiments

Experiments

Unfortunately even though Tomáš Zavrel triedreally hard, we were not able to obtain anyreasonable data that could be used forsoftware validation.Experiments which began as measurement ofpositive effect of mixing on culture growthended up as measurement of negative effectsof mixing on culture growth.Experimental device need to be adjusted sothat it can rotate slower before theexperimental work can resume.

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 20 / 22

Results and conclusions

I’ve successfully implemented efficient LBM and PSF solver.Calibration and validation experiment morphed into shear stress effectanalysis - need for experimental device adjustmentsNext steps: 3D flow, variable angle constant velocity boundary,Couette-Taylor...

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 21 / 22

Thank you

Thank you for your attention.

Many thanks to Tomáš Zavrel for the experimental work

Thanks to European Social Fund that supported this work under theEducation for Competitiveness OP. (Project Education for South Bohemia

research capacity - CZ.1.07/2.3.00/09.0203)

Václav �tumbauer () Simulation software for microalgae cultivation in photobioreactor 22 / 22