Presentation is loading. Please wait.

Presentation is loading. Please wait.

Description Language of Calculation Scheme for Automatic Simulation Code Generation Akira Amano College of Lifescience, Ritsumeikan University 1 CellML.

Similar presentations


Presentation on theme: "Description Language of Calculation Scheme for Automatic Simulation Code Generation Akira Amano College of Lifescience, Ritsumeikan University 1 CellML."— Presentation transcript:

1 Description Language of Calculation Scheme for Automatic Simulation Code Generation Akira Amano College of Lifescience, Ritsumeikan University 1 CellML workshop 2012

2 CellML workshop 20122 HD Physiology Project Project Leader: Prof. Y. Kurachi (Osaka Univ.) 2010-2015 http://hd-physiology.jp/

3 HD Physiology Project Japanese title of this project “Integrative Multi-level Systems Biology for …” target –Multiscale in Biology –construct comprehensive simulation model of drug induced heart arrhythmia CellML workshop 20123

4 HD Physiology Project groups –platform (Kitano (SBML), Asai (isML PHML)) –cardiac biology –pharmacokinetics integrate models of... –whole heart excitation propagation –cell model including drug effect –circulation model –pharmacokinetics / pharmacodynamics CellML workshop 20124

5 Biological function simulations are different from conventional models in: The complexity of the models Multiple scale and physics (nano-sec, hour, Chemistry, dynamics, fluid...) Characteristics of Biological Function Models (from IT view) 5CellML workshop 2012

6 The complexity of the model Multiple scale and physics cardiac cell model ion channels energy metabolism ion transporters contraction mechanism latest model number of equations : more than 400 number of variables : more than 400 Characteristics of Biological Function Models (from IT view) 6CellML workshop 2012

7 The complexity of the model Multiple scale and physics Characteristics of Biological Function Models Coupling Calculation Scheme is usually built in in the simulation tools. fluid mechanics structural mechanics chemical reaction electrophysiology Coupling Calculation Simulation of the heart beat 7CellML workshop 2012

8 Software Crisis! CellML workshop 20128 Merlin Dorfman ”Software Engineering” IEEE, 1997. in 1970s: Software size increased exponentially. Large scale software project failed. Software Engineering Structured Programming Languages Integrated Software Tools

9 Efficient handling of complex models ⇒ use of Markup Languages Software Engineering Tools for Complex Biological Models 9CellML workshop 2012 CellML FieldML PHML SBML Cell physiological model description Field (Organ) model description Systems Biology model description Declarative Description Models

10 Declarative description: every equation is true at any time High flexibility from mathematical description combination of models, boundary cond. Avoiding bugs by automatic processing of models Software Engineering Tools for Complex Biological Models 10CellML workshop 2012 not declarativedeclarative

11 Lumped parameter models (ODE) simulation tools and markup languages CellML,... calculation methods are simple (usually builtin) Distributed parameter models (PDE) simulation tools and markup languages (complex) FieldML?,... calculation methods are complex no general simulation software? Coupling simulation models simulation software are developed manually Our approach: propose description language for calculation methods What to be supported CellML workshop 201211

12 Method: Designing declarative description of coupling calculation schemes. use recurrence relations 1.start from single model discretization 2.next consider coupling calculation What to be supported 12CellML workshop 2012

13 Lumped parameter models (ODE) discretize in time Euler, Runge Kutta,... Distributed parameter models (PDE) discretize in space (and time) center difference, upwind difference,... Single Model Input Equations 13CellML workshop 2012

14 FTCS (forward time center space) original model equation discretized equation Discretization 14CellML workshop 2012

15 Crank-Nicolson original model equation discretized equation Discretization 15CellML workshop 2012 calculation method becomes complex we can separate discretization scheme from calculation method

16 CellML/ PHML TecML Relation (RelML) Process of combining Model Equation with Calculation Scheme Recurrence Relation Equations Calculation Scheme Model Equations Variable Correspondence information between two files Executable code 1 st step 2 nd step 16CellML workshop 2012 CellML Compiler available at sourceforge equation to program easy! CPU, GPU PC cluster, super computer (K?) low efficiency but high and safe productivity

17 Single Model Calculation schemes: 1.mathematical relation between discretized variables 2.calculation method of unknown variables TecML (Time Evolution Calculation Markup Language): Description language to describe time evolution calculation method Euler, RungeKutta … spatial difference scheme center difference, upwind difference,... Declarative Description of Calculation Schemes 17CellML workshop 2012

18 model equations time discretization Concept of Calculation Scheme Description by Recurrence Relation 18CellML workshop 2012 relation Recurrence relation (declarative description) 1 st step: generate recurrence relation from model equations TecML RelML

19 Recurrence relationExecutable code 2 nd step: generate program to calculate recurrence relations x[0] = xinit; tn=0; do{ r[tn] = x[tn]*x[tn]*x[tn]; k[tn] = - r[tn]; x[tn+1] = x[tn] + k[tn] * delta; tn = tn + 1; } while(!((tn-1) == 1000)); xend = x[tn-1]; Concept of Calculation Scheme Description by Recurrence Relation 19CellML workshop 2012 (declarative description)

20 CellML workshop 201220 Experiments on FHN, LR-I

21 Coupling Calculation Schemes 21CellML workshop 2012 Coupling calculation schemes: 1. also mathematical relation between discretized variables in several models 2.calculation method of unknown variables TecML Description language to describe coupling calculation scheme cell model + mechanical model convergence calculation different time step models

22 Example: Double Time Loop Physiologically based Pharmacokinetic model calculation 22 time order: hour time order: millisec CellML workshop 2012

23 do { dose concentration calculate whole body model with large time step do { concentration cell state calculate each cell model with small time step } while ( !time1end() ); } while ( !time2end() ); Example: Double Time Loop CellML workshop 201223

24 Recurrence relationExecutable code c[0] = 1.0; tn=0; do { s[tn][0] = s[tn-1]; tm = 0; do { ks[tn][tm] = f2(c[tn],s[tn][tm]); s[tn][tm+1] = s[tn][tm] + ks[tn][tm]*delta1; tm++; } while (!(tm-1)==1000); s[tn] = s[tn][tm]; kc[tn] = f1(c[tn],s[tn]); c[tn+1] = c[tn] + kc[tn]*delta2; tn = tn + 1; } while(!((tn-1) == 1000)); cend = c[tn-1]; Example: Double Time Loop 24 outer while loop inner while loop CellML workshop 2012

25 CellML1:Cardiac Cell Model CellML2:Blood Circulation Model CellML3:Heart Finite Element (FE) Model Example: Convergence Calculation The dynamic model of the simple heart 25CellML workshop 2012

26 CellML1:Cardiac Cell Model Example: Convergence Calculation 26CellML workshop 2012 CellML1: Cardiac Cell Model dT/dt = k T = f 1 (L, T) CellML2:Blood Circulation Model dV/dt = k V = f 3 (P)

27 Example: Convergence Calculation 27 CellML workshop 2012 CellML3:Heart Finite Element (FE) Model CellML3: Heart FE Model V= f 4 (P, T) L = f 5 (V) nP = f Pnext (P, V, V target, P 1, P 2 ) nP 1 = P nP 2 = P 1 e = |V – V target | FE model can only calculate volume from pressure. P LV is calculated by searching. P1P1 P2P2 f pnext (P 1,P 2 ) V1V1 V next V target

28 28CellML workshop 2012 Recurrence relation

29 Executable code T[0]=Tinit; V[0]=Vinit; P[0]=Pinit; tn = 0; do{ Pr[tn][0]=P[tn]; P1r[tn][0]=P[tn]; P2r[tn][0]=P[tn]; tm = 0; do{ Vr[tn][tm]=f4(Pr[tn][tm],T[tn]); Lr[tn][tm]=f5(Vr[tn][tm]); nPr1[tn][tm]=fPnext((Pr[tn][tm],Vr[tn][tm], V[tn],P1r[tn][tm],P2r[tn][tm]); nP1r1[tn][tm]=Pr[tn][tm]; nP2r1[tn][tm]=P1r[tn][tm]; er[tn][tm]=|Vr[tn][tm]-V[tn]|; Pr[tn][tm+1]=nPr1; P1r[tn][tm+1]=nP1r1; P2r[tn][tm+1]=nP2r1; tm = tm + 1; }while(!((er[tn][tm-1])<epsilon)); P[tn]=Pr[tn][tm-1]; L[tn]=L[rtn][tm-1]; dTdt0[tn]=f1(L[tn],T[tn]); dVdt0[tn]=f3(P[tn]); T[tn+1]=T[tn]+(dTdt0[tn]*delta); V[tn+1]=V[tn]+(dVdt0[tn]*delta); tn = tn + 1; }while(!((tn-1)==1000)); Tend=T[tn-1]; Vend=V[tn-1]: 29CellML workshop 2012

30 2 nd step: calculation method 30CellML workshop 2012 Coupling calculation schemes: 1. also mathematical relation between discretized variables of several models 2.calculation method of unknown variables current status: order of calculating eqns are analyzed partly DAE calculation is supported (numerical differential method) simple GPU support

31 advantages of our approach 31CellML workshop 2012 1.use of declarative description is flexible in... combination of various models combining with boundary conditions 2.two step approach various target language / hardwares / libraries language: C, C++, Java, Java BigDecimal hardware: GPU, super computers library: various math library

32 Example: parallel code (GPGPU) 32 2D excitation propagation (LR1) GPU was 60 times faster than single CPU We can use any cell model to generate GPGPU 2D excitation propagation program. CellML Simulation Program Generator C language CUDA C Single CPU GPU CPU (core i7 880) GPU (Tesla C2050) The 1st HD Physiology International Symposium 20th Jan, 2012

33 CellML workshop 201233 available at sourceforge (http://sourceforge.net/projects/cellmlcompiler/)http://sourceforge.net/projects/cellmlcompiler/ only single model time discretization available Euler, Runge Kutta (explicit method only) fixed geometry excitation propagation with GPU current project webpage

34 Summary Declarative description models are useful for simulation with complex models. –CellML, SBML, FieldML, PHML,... Declarative description of coupling calculation scheme –proposed: TecML With declarative description coupling calculation scheme, simulation program can be generated with high flexibility. –various boundary conditions –parallel code for super computers CellML workshop 201234


Download ppt "Description Language of Calculation Scheme for Automatic Simulation Code Generation Akira Amano College of Lifescience, Ritsumeikan University 1 CellML."

Similar presentations


Ads by Google