Spatiotemporal Modeling of Cancer Immunotherapy: Partial Differential Equation Analysis in R [1st ed.] 978-3-030-17635-8;978-3-030-19080-4

The focus of this book is a detailed discussion of a dual cancer vaccine (CV)-immune checkpoint inhibitor (ICI) mathemat

308 134 4MB

English Pages VIII, 112 [116] Year 2019

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Spatiotemporal Modeling of Cancer Immunotherapy: Partial Differential Equation Analysis in R [1st ed.]
 978-3-030-17635-8;978-3-030-19080-4

Table of contents :
Front Matter ....Pages i-viii
Fixed Boundary PDE Model Formulation (William E. Schiesser)....Pages 1-15
Fixed Boundary PDE Model Implementation (William E. Schiesser)....Pages 17-41
Fixed Boundary PDE Model Output (William E. Schiesser)....Pages 43-67
Moving Boundary PDE Model Implementation (William E. Schiesser)....Pages 69-89
Moving Boundary PDE Model Output (William E. Schiesser)....Pages 91-108
Back Matter ....Pages 109-112

Citation preview

William E. Schiesser

Spatiotemporal Modeling of Cancer Immunotherapy Partial Differential Equation Analysis in R

Spatiotemporal Modeling of Cancer Immunotherapy

William E. Schiesser

Spatiotemporal Modeling of Cancer Immunotherapy Partial Differential Equation Analysis in R

123

William E. Schiesser Department of Chemical and Biomolecular Engineering Lehigh University Bethlehem, PA, USA

ISBN 978-3-030-17635-8 ISBN 978-3-030-19080-4 (eBook) https://doi.org/10.1007/978-3-030-19080-4 © Springer Nature Switzerland AG 2019 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors, and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Switzerland AG. The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland

Preface

A major direction of the current research in oncology [1] is the use of therapeutic drugs that activate the immune system against cancer. The focus of this book is a detailed discussion of a dual cancer vaccine (CV)-immune checkpoint inhibitor (ICI) mathematical model, reported in [2], which consists of a system of partial differential equations (PDEs) that define the spatiotemporal distribution of cells and biochemicals during tumor growth. It intends to provide a computer implementation of the model that can be used for the quantitative evaluation of CV-ICI therapy. The reference for the CV-ICI/PDE model [2] follows the usual format of (1) stating the model PDEs, with associated boundary condition (BCs), initial conditions (ICs), and parameters (constants) and (2) presenting a numerical solution to (1). What is required for the general use of the model are the essential intermediate steps of (3) describing numerical methods (algorithms) to compute the reported numerical solution and (4) providing computer programs (routines) to compute the reported solution. Without (3) and (4), the reader/analyst/researcher cannot reproduce the reported numerical solution, with reasonable effort, and then extend the model, e.g., by varying the parameters and modifying/extending the equations. (3) and (4) are provided in this book so that solutions to the model PDEs can be computed without having to first study numerical methods and programming (coding). The routines are programmed in R, a quality open-source scientific computing system that is readily available as a download from the Internet, are explained in detail, and are provided with a link so that the reader can reproduce the reported solution and then experiment with the model. In other words, by providing (3) and (4) above, the model is rendered accessible for further study. The routines are based on the method of lines (MOL), a general PDE algorithm that can be executed on modest computers within the basic R system. In the initial book chapters, the model is discussed and implemented with a fixed (in space) tumor outer radial boundary, which is presented as an introduction and then extended in the later chapters to the case of a moving outer radial boundary so that the expansion of the tumor is a feature of the model output. The moving boundary PDE (MBPDE) algorithm is discussed in [3], including the mathematical details and example applications. v

vi

Preface

In summary, the computation of numerical solutions of a CV-ICI/PDE model is presented in this book. The author’s intent is to facilitate the use of the model, and more generally, computer-based analysis of CV-ICI mathematical models, as a step toward the development and quantitative evaluation of the immunotherapy approach to the treatment of cancer. Bethlehem, PA, USA June 1, 2019

W. E. Schiesser

References 1. Society for Immunotherapy of Cancer. The source of the Journal for ImmunoTherapy of Cancer. https://jitc.biomedcentral.com/ 2. Lai, X., and A. Friedman 2017. Combination therapy of cancer with cancer vaccine and immune checkpoint inhibitors: A mathematical model. PLoS One 12(5): e0178479. 3. Schiesser, W.E. 2019 Moving Boundary PDE analysis: Biomedical applications in R. Boca Raton: CRC Press.

Contents

1 Fixed Boundary PDE Model Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Model PDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Model Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Model Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Summary and Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 1 2 14 14 15 15

2

Fixed Boundary PDE Model Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Main Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 ODE/MOL Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Subordinate Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Summary and Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17 17 18 30 40 41 41

3

Fixed Boundary PDE Model Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Case 1: No Drug Therapy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Case 2: Cancer Vaccine Added, No Immune Checkpoint Inhibitor . . 3.4 Case 3: No Cancer Vaccine, Immune Checkpoint Inhibitor Added . . 3.5 Case 4: Cancer Vaccine and Immune Checkpoint Inhibitor Added . . 3.6 Case 5: Cancer Vaccine and Immune Checkpoint Inhibitor Dosage Increased. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7 Summary and Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43 43 44 49 53 57

Moving Boundary PDE Model Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Main Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Summary and Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

69 69 69 89 89

4

62 67 67

vii

viii

5

Contents

Moving Boundary PDE Model Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 5.2 No Boundary Movement, Case 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 5.3 Constant Velocity Boundary Movement, Case 2 . . . . . . . . . . . . . . . . . . . . . . 97 5.4 Variable Velocity Boundary Movement, Case 3 . . . . . . . . . . . . . . . . . . . . . . . 102 5.5 Summary and Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

Chapter 1

Fixed Boundary PDE Model Formulation

Abstract This chapter details a dual cancer vaccine (CV)-immune checkpoint inhibitor (ICI) mathematical model formulated as a system of partial differential equations (PDEs) defining the spatiotemporal distribution of cells and biochemicals during tumor growth. The PDEs, initial conditions (ICs) and boundary conditions (BCs) are specified. The outer BC for the tumor specifies a fixed boundary (FBPDE) which is the starting point for subsequent chapters in which the outer boundary moves (MBPDE) as the tumor grows. Keywords Cancer vaccine (CV) · Immune checkpoint inhibitor (ICI) · Mathematical model · Partial differential equation (PDE) · Initial condition (IC) · Boundary condition (BC) · Fixed boundary · Moving boundary

1.1 Introduction A mathematical model is presented in this book for the two-drug immunotherapy of cancer that is a variant of the immunotherapy model reported in [1]. The model is formulated as a set of partial differential equations (PDEs) that define the space and time (spatiotemporal) variation of the cell densities and biochemical concentrations expressed as 12 dependent variables (listed in the following Table 1.1). The features of the model are discussed/explained in detail in [1]. The following summary of the model features is from this reference. In this paper we consider a combination therapy of cancer. One drug is a vaccine which activates dendritic cells so that they induce more T cells to infiltrate the tumor. The other drug is a checkpoint inhibitor, which enables the T cells to remain active against the cancer cells. The two drugs are positively correlated in the sense that an increase in the amount of each drug results in a reduction in the tumor volume. We consider the question whether a treatment with combination of the two drugs at certain levels is preferable to a treatment by one of the drugs alone at ‘roughly’ twice the dosage level; if that is the case, then we say that there is a positive ‘synergy’ for this combination of dosages. To address this question, we develop a mathematical model using a system of partial differential equations. The variables include dendritic and cancer cells, CD4+ and CD8+ T cells, IL-12 and IL-2, GM-CSF produced by the vaccine, and a T cell checkpoint inhibitor associated with PD-1.

© Springer Nature Switzerland AG 2019 W. E. Schiesser, Spatiotemporal Modeling of Cancer Immunotherapy, https://doi.org/10.1007/978-3-030-19080-4_1

1

2

1 Fixed Boundary PDE Model Formulation

The twelve PDEs are presented next, along with the initial conditions (ICs) and boundary conditions (BCs). The computer implementation of the model is then discussed in Chap. 2.

1.2 Model PDEs The twelve PDE dependent variables are listed in Table 1.1 (the equation for L(r, t) is algebraic). Table 1.1 PDE dependent and independent variables [1] Dependent variable D T1 T8 C NC H G I12 I2 P L Q A Independent variable r t

Description Density of DCs (dendritic cells) Density of activated CD4+ T cells Density of activated CD8+ T cells Density of tumor cancer cells Density of necrotic cancer cells HMGB-1 concentration GM-CSF concentration IL-12 concentration IL-2 concentration PD-1 concentration PD-L1 concentration PD-1-PD-L1 concentration Anti-PD-1 concentration Description Radial position in the tumor Time

A brief explanation of the variables in Table 1.1 follows, with a more complete discussion/explanation in [1]. • HMGB-1: High mobility group box-1 with concentration H (r, t) that contributes to the production of dendritic cells with concentration D(r, t). • GM-CSF: Activator for dendritic cells with concentration G(r, t). • GVAX: Cancer vaccine composed of tumor cells genetically modified to secrete GM-CSF and then irradiated to prevent further cell division. • IL-12: Activator for the production of CD4+ T and CD8+ T cells. • IL-2: Activator for the production of CD4+ T and CD8+ T cells. • PD-1: Immunoinhibitory receptor with concentration P (r, t). • PD-L1: Immunoinhibitory receptor (the ligand of PD-1) with concentration L(r, t).

1.2 Model PDEs

3

• PD-1-PD-L1: Complex with concentration Q(r, t) that forms an immune checkpoint for T cells from IL-12 and IL-2. • A: Anti-PD-1 agent with concentration A(r, t) determined in part by therapeutic injection that inhibits PD-1 formation and thus in turn inhibits PD-1-PD-L1 production, i.e., A(r, t) acts as a checkpoint inhibitor. • γG : Injection rate of the cancer vaccine (source term in the G(r, t) PDE). • γA : Injection rate of the immune checkpoint inhibitor (source term in the A(r, t) PDE). A schematic diagram of the model is given in Fig. 1 in [1]. The PDE for the dendritic cells with density D(r, t) follows.1 ∂D H G +∇·(vD)−δD ∇ 2 D = λDH D0 +λDG D0 −dD D ∂t KH + H KG + G

(1.2-1)

where Table 1.2a Terms in Eq. (1.2-1) Notation ∂D ∂t ∇ · (vD) v −δD ∇ 2 D δD λDH D0

H KH + H

λDC D0 KH λDG D0

G KG + G

λDG KG −dD D dD 1 The

Description Net accumulation or depletion of dendritic cells in a differential volume Net convection of dendritic cells into or out of a differential volume Velocity field Net diffusion of dendritic cells into or out of a differential volume Diffusivity Rate of dendritic cell activation by HMGB-1 Rate constant Immature dendritic cell density Michaelis-Menten constant Rate of dendritic cell promotion by GM-CSF Rate constant Michaelis-Menten constant Rate of death of dendritic cells Rate constant

term from [1] λDC D0

C KC + C

λDH D0

H KH + H

is replaced with

to account for the rate of dendritic cell activation by HMGB-1.

4

1 Fixed Boundary PDE Model Formulation

Equation (1.2-1) is stated in coordinate-free format. If 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) are selected (to represent a spherical volume), Table 1.2b Radial terms in Eq. (1.2-1) Coordinate-free ∇ · (vD)

−δD ∇ 2 D

1D spherical   1 r 2 vr D = ∂r r2 ∂D ∂vr 2 vr +D + vr D ∂r ∂r r  2  ∂ D 2 ∂D −δD + r ∂r ∂r 2

The PDE for the activated CD4+ T cells with density T1 (r, t) follows.   I12 I2 ∂T1 2 + ∇ · (vT1 ) − δT ∇ T1 = λT1 I12 T10 + λT1 I2 T1 ∂t KI12 + I12 KI2 + I2 ×

1 − dT1 T1 1 + Q/KT Q

(1.2-2)

where Table 1.3a Terms in Eq. (1.2-2) Notation

Description

∂T1 ∂t

Net accumulation or depletion of activated CD4+ T cells in a differential volume

∇ · (vT1 )

Net convection of activated CD4+ T cells into or out of a differential volume Velocity field Net diffusion of activated CD4+ T cells into or out of a differential volume Diffusivity

v −δT ∇ 2 T1 δT λT1 I12 T10

I12 KI12 + I12

Rate constant Density of naive CD4+ T cells Michaelis-Menten constant

λT1 I12 T10 KI12 λT1 I2 T1

Rate of activation of CD4+ T cells by IL-12

I2 KI2 + I2

Rate of proliferation of CD4+ T cells by IL-2

λT1 I2 K I2

Rate constant Michaelis-Menten constant

1 1 + Q/KT Q KT Q −dT1 T1 dT1

Rate of inhibition of CD4+ T cells by PD-1-PD-L1 Constant for inhibition at steady state Rate of death of CD4+ T cells Rate constant

1.2 Model PDEs

5

The radial terms of Eq. (1.2-2) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as Table 1.3b Radial terms in Eq. (1.2-2) Coordinate-free ∇ · (vT1 )

−δT ∇ 2 T1

1D spherical   1 r 2 vr T1 = ∂r r2 ∂T1 ∂vr 2 vr + T1 + vr T1 ∂r ∂r r   2 2 ∂T1 ∂ T1 −δT + r ∂r ∂r 2

The PDE for the activated CD8+ T cells with density T8 (r, t) follows.   I12 I2 ∂T8 + ∇ · (vT8 ) − δT ∇ 2 T8 = λT8 I12 T80 + λT8 I2 T8 ∂t KI12 + I12 KI2 + I2 ×

1 − dT8 T8 1 + Q/KT Q

(1.2-3)

where Table 1.4a Terms in Eq. (1.2-3) Notation

Description

∂T8 ∂t

Net accumulation or depletion of activated CD8+ T cells in a differential volume

∇ · (vT8 )

Net convection of activated CD4+ T cells into or out of a differential volume Velocity field Net diffusion of activated CD4+ T cells into or out of a differential volume Diffusivity

v −δT ∇ 2 T8 δT λT8 I12 T80

I12 KI12 + I12

Rate constant Density of naive CD8+ T cells Michaelis-Menten constant

λT8 I12 T80 KI12 λT8 I2 T8

Rate of activation of CD8+ T cells by IL-12

I2 KI2 + I2

Rate of proliferation of CD8+ T cells by IL-2

λT8 I2 K I2

Rate constant Michaelis-Menten constant

1 1 + Q/KT Q KT Q −dT8 T8 dT8

Inhibition of CD8+ T cells by PD-1-PD-L1 Constant for inhibition at steady state Rate of death of CD8+ T cells Rate constant

6

1 Fixed Boundary PDE Model Formulation

The radial terms of Eq. (1.2-3) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as Table 1.4b Radial terms in Eq. (1.2-3) Coordinate-free ∇ · (vT8 )

−δT ∇ 2 T8

1D spherical   1 r 2 vr T8 = ∂r r2 ∂T8 ∂vr 2 vr + T8 + vr T8 ∂r ∂r r  2  ∂ T8 2 ∂T8 −δT + r ∂r ∂r 2

The PDE for the tumor cancer cells with density C(r, t) follows.   C ∂C −(η1 T1 C + η8 T8 C)−dC C +∇ ·(vC)−δC ∇ 2 C = λC C 1 − ∂t Cm

(1.2-4)

where Table 1.5a Terms in Eq. (1.2-4) Notation

Description

∂C ∂t ∇ · (vC) v −δC ∇ 2 C δC   C λC C 1 − Cm λC CM − (η1 T1 C + η8 T8 C) −dC C dC

Net accumulation or depletion of cancer cells Net convection of cancer cells into or out of a differential volume Velocity field Net diffusion of cancer cells into or out of a differential volume Diffusivity Rate of cancer cell proliferation Logistic rate constant Logistic carrying capacity Cancer cell killing rate by T1 , T8 Death rate of cancer cells Rate constant

The radial terms of Eq. (1.2-4) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as

1.2 Model PDEs

7 Table 1.5b Radial terms in Eq. (1.2-4) Coordinate-free ∇ · (vC)

−δC ∇ 2 C

1D spherical   1 r 2 vr C = ∂r r2 ∂C ∂vr 2 vr +C + vr C ∂r ∂r r  2  ∂ C 2 ∂C −δC + r ∂r ∂r 2

The PDE for the necrotic cancer cells with density NC (r, t) follows. ∂NC + ∇ · (vNC ) − δNC ∇ 2 NC = λNC C − dNC NC ∂t

(1.2-5)

where Table 1.6a Terms in Eq. (1.2-5) Notation t

Description Time

∂NC ∂t ∇ · (vNC ) v −δNC ∇ 2 NC δNC λNC C λNC −dNC NC dNC

Net accumulation or depletion of necrotic cancer cells in a differential volume Net convection of necrotic cancer cells into or out of a differential volume Velocity field Net diffusion of necrotic cancer cells into or out of a differential volume Diffusivity Rate of necrotic cancer cells derived from cancer cells Rate constant Rate of removal of necrotic cancer cells Rate constant

The radial terms of Eq. (1.2-5) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as Table 1.6b Radial terms in Eq. (1.2-5) Coordinate-free ∇ · (vNC )

−δNC ∇ 2 NC

1D spherical   1 r 2 vr NC = ∂r r2 ∂NC ∂vr 2 vr + NC + vr NC ∂r ∂r r  2  2 ∂NC ∂ NC −δNC + r ∂r ∂r 2

8

1 Fixed Boundary PDE Model Formulation

The PDE for HMGB-1 with concentration H (r, t) follows. ∂H − δH ∇ 2 H = λH NC NC − dH H ∂t

(1.2-6)

where Table 1.7a Terms in Eq. (1.2-6) Notation

Description

∂H ∂t

Net accumulation or depletion of HMGB-1 in a differential volume

−δH

∇2H

δH λH NC NC λH NC −dH H dH

Net diffusion of HMBG-1 into or out of a differential volume Diffusivity Rate of release of HMGB-1 from necrotic cancer cells Rate constant Rate of degradation of HMGB-1 Rate constant

The radial term of Eq. (1.2-6) stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) is Table 1.7b Radial term in Eq. (1.2-6) Coordinate-free −δH

∇2H

1D spherical   2 ∂ H 2 ∂H −δH + r ∂r ∂r 2

The PDE for GM-CSF with concentration G(r, t) follows. ∂G − δG ∇ 2 G = λG + γG (t) − dG G ∂t with

⎧ ⎪ γ if t ≤ 30, ⎪ ⎨ Gc 33 − t γG (t) = γGc × if 30 < t ≤ 33, ⎪ 3 ⎪ ⎩0 if t > 33

(t in days and γGc a constant).

(1.2-7)

1.2 Model PDEs

9

where Table 1.8a Terms in Eq. (1.2-7) Notation

Description

∂G ∂t

Net accumulation or depletion of GM-CSF

−δG ∇ 2 G

Net diffusion of GM-CSF into or out of a differential volume Diffusivity Constant source for GM-CSF Rate of GM-CSF (GVAX) injected transdermally Rate of GM-CSF degradation Rate constant

in a differential volume

δG λG γG (t) −dG G dG

The radial term of Eq. (1.2-7) stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) is Table 1.8b Radial term in Eq. (1.2-7) Coordinate-free −δG

∇2G

1D spherical   2 2 ∂G ∂ G −δG + r ∂r ∂r 2

The PDE for IL-12 with concentration I12 (r, t) follows. ∂I12 − δI12 ∇ 2 I12 = λI12 D D − dI12 I12 ∂t

(1.2-8)

where Table 1.9a Terms in Eq. (1.2-8) Notation ∂I12 ∂t −δI12 ∇ 2 I12 δI12 λI12 D D λI12 D −dI12 I12 dI12

Description Net accumulation or depletion of IL-12 in a differential volume Net diffusion of IL-12 into or out of a differential volume Diffusivity Rate of production of IL-12 by D Rate constant Rate of degradation of IL-12 Rate constant

The radial term of Eq. (1.2-8) stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) is

10

1 Fixed Boundary PDE Model Formulation Table 1.9b Radial term in Eq. (1.2-8) Coordinate-free −δI12 ∇ 2 I12

1D spherical  2  ∂ I12 2 ∂I12 −δI12 + r ∂r ∂r 2

The PDE for IL-2 with concentration I2 (r, t) follows. ∂I2 − δI2 ∇ 2 I2 = λI2 T1 T1 − dI2 I2 ∂t

(1.2-9)

where Table 1.10a Terms in Eq. (1.2-9) Notation ∂I2 ∂t −δI2 ∇ 2 I2 δ I2 λI2 T1 T1 λI2 T1 −dI2 I2 dI2

Description Net accumulation or depletion of IL-2 in a differential volume Net diffusion of IL-2 into or out of a differential volume Diffusivity Rate of production of IL-2 by T1 Rate constant Rate of degradation of IL-2 Rate constant

The radial term of Eq. (1.2-9) stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) is Table 1.10b Radial term in Eq. (1.2-9) Coordinate-free −δI2 ∇ 2 I2

1D spherical   2 ∂ I2 2 ∂I2 −δI2 + r ∂r ∂r 2

The PDE for PD-1 with concentration P (r, t) follows. ∂P + ∇ · (vP ) − δT ∇ 2 P = ∂t

P I12 I2 (λT1 I12 T10 + λT8 I12 T80 ) + (λT1 I2 T1 + λT8 I2 T8 ) T 1 + T8 KI12 + I12 KI2 + I2 ×

P 1 − (dT T1 + dT8 T8 ) − μP A P A 1 + Q/KT Q T1 + T8 1

(1.2-10)

1.2 Model PDEs

11

where Table 1.11a Terms in Eq. (1.2-10) Notation

Description

∂P ∂t

Net accumulation or depletion of PD-1 in a differential volume

∇ · (vP )

Net convection of activated PD-1 into or out of a differential volume Velocity field Net diffusion of activated PD-1 into or out of a differential volume Diffusivity

v −δT ∇ 2 P δT I12 P (λT1 I12 T10 + λT8 I12 T80 ) T1 + T8 KI12 + I12 1 × 1 + Q/KT Q P I2 (λT1 I2 T1 + λT8 I2 T8 ) T1 + T8 KI2 + I2 1 1 + Q/KT Q P − (dT T1 + dT8 T8 ) T1 + T8 1 −μP A P A −μP A

Activation of PD-1 cells by T1 , T8 , IL-12

Activation of PD-1 cells by T1 , T8 , IL-2

×

Deactivation of PD-1 cells by T1 , T8 Rate of depletion of PD-1 cells by anti-PD-1 Rate at which P is depleted/blocked by A

The radial terms of Eq. (1.2-10) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as Table 1.11b Radial terms in Eq. (1.2-10) Coordinate-free ∇ · (vP )

−δT ∇ 2 P

1D spherical   1 r 2 vr P = ∂r r2 ∂P ∂vr 2 vr +P + vr P ∂r ∂r r  2  2 ∂P ∂ P −δT + 2 r ∂r ∂r

The PDE for PD-1-PD-L1 with concentration Q(r, t) follows. ∂Q + ∇ · (vQ) − δT ∇ 2 Q = αP L P L − dQ Q ∂t

(1.2-11a)

L with concentration L(r, t) is given by an algebraic equation. L = ρL (T1 + T8 + C)

(1.2-11b)

12

1 Fixed Boundary PDE Model Formulation

where Table 1.12a Terms in Eq. (1.2-11) Notation ∂Q ∂t

Description Net accumulation or depletion of PD-1-PD-L1 in a differential volume

∇ · (vQ)

Net convection of PD-1-PD-L1 into or out of a differential volume Velocity field Net diffusion of dendritic cells into or out of a differential volume Diffusivity Rate of increase of PD-1-PD-L1 by P and L Rate constant Rate of depletion of PD-1-PD-L1 Rate constant Concentration of PD-L1 Constant depending on the specific type of tumor

v −δT ∇ 2 Q δT αP L P L αP L −dQ Q dQ L

The radial terms of Eq. (1.11-3) are stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) as Table 1.12b Radial terms in Eq. (1.2-11) Coordinate-free ∇ · (vQ)

−δT ∇ 2 Q

1D spherical   1 r 2 vr Q = ∂r r2 ∂Q ∂vr 2 vr +Q + vr Q ∂r ∂r r  2  ∂ Q 2 ∂Q −δT + r ∂r ∂r 2

The PDE for anti-PD-1 with concentration A(r, t) is ∂A − δA ∇ 2 A = γA (t) − μP A P A − dA A ∂t with

⎧ ⎪ γ ⎪ ⎨ Ac

if t ≤ 30, 33 − t γA (t) = γAc × if 30 < t ≤ 33, ⎪ 3 ⎪ ⎩0 if t > 33 (t in days and γAc a constant).

(1.2-12)

1.2 Model PDEs

13

where Table 1.13a Terms in Eq. (1.2-12) Notation ∂A ∂t

Description Net accumulation or depletion of anti-PD-1 in a differential volume

−δA ∇ 2 G

Net diffusion of anti-PD-1 into or out of a differential volume Diffusivity Rate of anti-PD-1 injected transdermally Rate of depletion of anti-PD-1 from P and A Rate constant Rate of anti-PD-1 degradation Rate constant

δA γA (t) −μP A P A μP A −dA A dA

The radial term of Eq. (1.2-12) stated in 1D spherical coordinates ((r, θ, φ) with angular terms in θ, φ neglected) is Table 1.13b Radial term in Eq. (1.2-12) Coordinate-free −δA ∇ 2 A

1D spherical   2 2 ∂A ∂ A −δA + r ∂r ∂r 2

Equation (1) of [1] specifies that the sum of the four cell densities D(r, t), T1 (r, t), T8 (r, t), C(r, t) is constant. D + T1 + T8 + C However, this appears to neglect the effect of the tumor extra cellular matrix (ECM). Therefore, this equation is not used and the radial velocity vr is not included in the implementation of PDEs (1.2). The velocity of movement of the tumor outer radial boundary, R(t), is specified as proportional to the cancer cell density C(r, t) at the outer boundary (as implemented in ODE/MOL routine pde1a discussed in Chaps. 2 and 4).

14

1 Fixed Boundary PDE Model Formulation

1.3 Model Initial Conditions The numerical values of the ICs for the 12 PDEs are listed next (Eqs. (1.3)). D(r, t = 0) = 2.61 × 10−10 ; T1 (r, t = 0) = 4.0 × 10−3

(1.3-1,2)

T8 (r, t = 0) = 2.0 × 10−3 ; C = 0.3968

(1.3-3,4)

NC (r, t = 0) = 0; H (r, t = 0) = 0 −10

G(r, t = 0) = 2.61 × 10

−11

I2 (r, t = 0) = 4.74 × 10

(1.3-5,6) −10

(1.3-7,8)

−10

(1.3-9,10)

; I12 (r, t = 0) = 1.8 × 10

; P (r, t = 0) = 11.2 × 10

Q(r, t = 0) = 0; A(r, t = 0) = 0

(1.3-11,12)

1.4 Model Boundary Conditions Homogeneous (zero) Neumann (zero flux) BCs are defined at r = 0 to specify symmetry at r = 0 (Eqs. (1.4)). ∂D(r = 0, t) ∂T1 (r = 0, t) = 0; =0 ∂r ∂r ∂C(r = 0, t) ∂T8 (r = 0, t) = 0; =0 ∂r ∂r ∂NC (r = 0, t) ∂H (r = 0, t) = 0; =0 ∂r ∂r ∂I12 (r = 0, t) ∂G(r = 0, t) = 0; =0 ∂r ∂r ∂I2 (r = 0, t) ∂P (r = 0, t) = 0; =0 ∂r ∂r ∂Q(r = 0, t) ∂A(r = 0, t) = 0; =0 ∂r ∂r

(1.4-1,2) (1.4-3,4) (1.4-5,6) (1.4-7,8) (1.4-9,10) (1.4-11,12)

At the outer boundary R(t), homogeneous Neumann BCs are specified for D, C, NC , H, G, I12 , I2 , P , Q, A and Robin (mass transfer) BCs for T1 , T8 (Eqs. (1.5)). ∂D(r = R, t) =0 ∂r ∂T1 (r = R, t) + σT (I12 )(T1 (r = R, t) − T1s ) = 0 ∂r

(1.5-1)

(1.5-2a)

Reference

15

σT (I12 ) = σ0

I12 I12 + K12

∂T8 (r = R, t) + σT (I12 )(T8 (r = R, t) − T8s ) = 0 ∂r ∂NC (r = R, t) ∂C(r = R, t) = 0; =0 ∂r ∂r ∂H (r = R, t) ∂G(r = R, t) = 0; =0 ∂r ∂r ∂I2 (r = R, t) ∂I12 (r = R, t) = 0; =0 ∂r ∂r ∂P (r = R, t) ∂Q(r = R, t) = 0; =0 ∂r ∂r ∂A(r = R, t) =0 ∂r

(1.5-2b)

(1.5-3) (1.5-4,5) (1.5-6,7) (1.5-8,9) (1.5-10,11) (1.5-12)

T1s , T8s are exterior (extra cellular) T1 , T8 cell densities. This completes the specification of the PDE immunotherapy model.

1.5 Summary and Conclusions The system of twelve PDEs, Eqs. (1.2), is derived from the conservation of cells (D, T1 , T2 , C, NC ) and biochemicals H, G, I12 , I2 , P , Q, A. ICs (1.3) and BCs (1.4), (1.5) are also specified. The computer implementation of the model is discussed in Chap. 2.

Reference 1. Lai, X., and A. Friedman. 2017. Combination therapy of cancer with cancer vaccine and immune checkpoint inhibitors: A mathematical model. PLoS One 12(5):e0178479.

Chapter 2

Fixed Boundary PDE Model Implementation

Abstract The computer implementation of the PDE cancer vaccine-immune checkpoint inhibitor (CV-ICI) PDE model developed in Chap. 1 is discussed in this chapter for the case of a tumor fixed outer boundary. The implementation is formulated as a set of routines that can be compiled and executed within the basic R system (R is a quality, open-source scientific computing system that is readily available from the Internet.). The numerical algorithm for the solution of the PDEs is the method of lines (MOL). The PDE solutions are in numerical and graphical (plotted) form. In addition to the ODE/MOL routine, routines are also provided for drug source functions and spatial averaging. Keywords Cancer vaccine (CV) · Immune checkpoint inhibitor (ICI) · Mathematical model · Partial differential equation (PDE) · R routines · Method of lines (MOL) · Ordinary differential equation (ODE) · Fixed boundary

2.1 Introduction The computer implementation of the PDE immune checkpoint inhibitor (ICI) fixed boundary PDE (FBPDE) model developed in Chap. 1 is discussed in this chapter. The implementation is formulated as a set of routines that can be compiled and executed within the basic R system.1 The discussion of the R implementation starts with a main program.

1R

is a quality, open-source scientific computing system that is readily available from the Internet [3]. The Rstudio editor is recommended when using R and producing graphical (plotted) output in the standard formats, e.g., png, pdf. © Springer Nature Switzerland AG 2019 W. E. Schiesser, Spatiotemporal Modeling of Cancer Immunotherapy, https://doi.org/10.1007/978-3-030-19080-4_2

17

18

2 Fixed Boundary PDE Model Implementation

2.2 Main Program A main program for Eqs. (1.2), (1.3) follows. # # Twelve PDE model # # Delete previous workspaces rm(list=ls(all=TRUE)) # # Access ODE integrator library("deSolve"); # # Access functions for numerical solution setwd("f:/checkpoint/chap2/fbpde"); source("pde1a.R"); source("sigT.R"); source("gamA.R"); source("gamG.R"); source("simp.R"); # # Parameters # # Diffusion delta_D =8.64e-07; delta_T =8.64e-07; delta_C =8.64e-07; delta_NC =8.64e-07; delta_H =9.8495e-02; delta_G =9.8495e-02; delta_I12 =6.0472e-02; delta_I2 =9.9956e-02; delta_A =7.85e-02; # # D PDE lamDH =0.364; D0 =2.0e-05; lamDG =20.02; dD =0.1; KH =0.4; KG =1.74e-09; # # T1 PDE lamT1I12 =4.66; T10 =4.0e-04;

2.2 Main Program KI12 =1.5e-10; lamT1I2 =0.25; KI2 =2.37e-11; KTQ =1.365e-18; dT1 =0.197; # # T8 PDE lamT8I12 =4.15; T80 =2.0e-04; lamT8I2 =0.25; dT8 = 0.18; # # C PDE lamC=0.616; Cm =0.8; eta1 =11.5; eta8 =46; dC =0.17; # # NC PDE lamNC=0.001; dNC =0.001; # # H PDE lamHNC=1.0e-10; dH =1.0; # # G PDE lamG=2.23e-10; dG =1.28; # # I12 PDE lamI12D=5.18e-07; dI12 =1.38; # # I2 PDE lamI2T2=2.82e-08; dI2 =2.376; # # P PDE muPA=6.87e+06; # # Q PDE rhoL=5.22e-07; eps =0;

19

20

2 Fixed Boundary PDE Model Implementation alpPL=1.0e-01; dQ =1.0; # # A PDE muPA=6.87e+06; dA =0.0462; # # BCs sig0 =1; T1s=4.0e-03; T8s=2.0e-03; # # Spatial grid (in r) nr=21;rl=0;ru=0.01;dr=(ru-rl)/(nr-1); r=seq(from=rl,to=ru,by=dr); # # Independent variable for ODE integration t0=0;tf=100;nout=26; tout=seq(from=t0,to=tf,by=(tf-t0)/(nout-1)); # # Initial condition (t=0) u0=rep(0,12*nr); for(i in 1:nr){ u0[i]=2.61e-10; # D(r,t=0) u0[i+nr]= 4.0e-03; # T1(r,t=0) u0[i+2*nr]= 4.0e-03; # T8(r,t=0) u0[i+3*nr]= 0.3968; # C(r,t=0) u0[i+4*nr]= 0.0; # NC(r,t=0) u0[i+5*nr]= 0.0; # H(r,t=0) u0[i+6*nr]=2.61e-10; # G(r,t=0) u0[i+7*nr]= 1.8e-10; # I12(r,t=0) u0[i+8*nr]=4.74e-11; # I2(r,t=0) u0[i+9*nr]=11.2e-10; # P(r,t=0) u0[i+10*nr]=11.2e-11; # Q(r,t=0) u0[i+11*nr]= 0.0; # A(r,t=0) } ncall=0; # # ODE integration out=lsodes(y=u0,times=tout,func=pde1a, sparsetype="sparseint",rtol=1e-8, atol=1e-8,maxord=5); nrow(out) ncol(out)

2.2 Main Program # # Arrays for plotting numerical solution D=matrix(0,nrow=nr,ncol=nout); T1=matrix(0,nrow=nr,ncol=nout); T8=matrix(0,nrow=nr,ncol=nout); C=matrix(0,nrow=nr,ncol=nout); NC=matrix(0,nrow=nr,ncol=nout); H=matrix(0,nrow=nr,ncol=nout); G=matrix(0,nrow=nr,ncol=nout); I12=matrix(0,nrow=nr,ncol=nout); I2=matrix(0,nrow=nr,ncol=nout); P=matrix(0,nrow=nr,ncol=nout); Q=matrix(0,nrow=nr,ncol=nout); A=matrix(0,nrow=nr,ncol=nout); for(it in 1:nout){ for(i in 1:nr){ D[i,it]= out[it,i+1]; T1[i,it]= out[it,i+1+nr]; T8[i,it]=out[it,i+1+2*nr]; C[i,it]=out[it,i+1+3*nr]; NC[i,it]=out[it,i+1+4*nr]; H[i,it]=out[it,i+1+5*nr]; G[i,it]=out[it,i+1+6*nr]; I12[i,it]=out[it,i+1+7*nr]; I2[i,it]=out[it,i+1+8*nr]; P[i,it]=out[it,i+1+9*nr]; Q[i,it]=out[it,i+1+10*nr]; A[i,it]=out[it,i+1+11*nr]; } } # # Calls to ODE routine cat(sprintf("\n\n ncall = %5d\n\n",ncall)); # # Average PDE solutions uavg=rep(0,nr); Davg=rep(0,nout); T1avg=rep(0,nout); T8avg=rep(0,nout); Cavg=rep(0,nout); NCavg=rep(0,nout); Havg=rep(0,nout); Gavg=rep(0,nout); I12avg=rep(0,nout); I2avg=rep(0,nout);

21

22

2 Fixed Boundary PDE Model Implementation Pavg=rep(0,nout); Qavg=rep(0,nout); Aavg=rep(0,nout); for(it in 1:nout){ for(i in 1:nr){ uavg[i]=D[i,it];} Davg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=T1[i,it];} T1avg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=T8[i,it];} T8avg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=C[i,it];} Cavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=NC[i,it];} NCavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=H[i,it];} Havg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=G[i,it];} Gavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=I12[i,it];} I12avg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=I2[i,it];} I2avg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=P[i,it];} Pavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=Q[i,it];} Qavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); for(i in 1:nr){ uavg[i]=A[i,it];} Aavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); } # # D par(mfrow=c(1,1)); matplot(x=tout,y=Davg,type="l",xlab="t",ylab="Davg(t)",

2.2 Main Program xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # T1 par(mfrow=c(1,1)); matplot(x=tout,y=T1avg,type="l",xlab="t",ylab="T1avg(t)", xlim=c(0,tf),lty=1,main="",lwd=2, col="black"); # # T8 par(mfrow=c(1,1)); matplot(x=tout,y=T8avg,type="l",xlab="t",ylab="T8avg(t)", xlim=c(0,tf),lty=1,main="",lwd=2, col="black"); # # C par(mfrow=c(1,1)); matplot(x=tout,y=Cavg,type="l",xlab="t",ylab="Cavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # NC par(mfrow=c(1,1)); matplot(x=tout,y=NCavg,type="l",xlab="t",ylab="NCavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # H par(mfrow=c(1,1)); matplot(x=tout,y=Havg,type="l",xlab="t",ylab="Havg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # G par(mfrow=c(1,1)); matplot(x=tout,y=Gavg,type="l",xlab="t",ylab="Gavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # I12 par(mfrow=c(1,1)); matplot(x=tout,y=I12avg,type="l",xlab="t",ylab="I12avg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # I2 par(mfrow=c(1,1)); matplot(x=tout,y=I2avg,type="l",xlab="t",ylab="I2avg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # P

23

24

2 Fixed Boundary PDE Model Implementation par(mfrow=c(1,1)); matplot(x=tout,y=Pavg,type="l",xlab="t",ylab="Pavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # Q par(mfrow=c(1,1)); matplot(x=tout,y=Qavg,type="l",xlab="t",ylab="Qavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); # # A par(mfrow=c(1,1)); matplot(x=tout,y=Aavg,type="l",xlab="t",ylab="Aavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black");

Listing 2.1: Main program for Eqs. (1.2), (1.3) We can note the following details about Listing 2.1. • Previous workspaces are deleted. # # Twelve PDE model # # Delete previous workspaces rm(list=ls(all=TRUE))

• The R ODE integrator library deSolve is accessed. Then the directory with the files for the solution of Eqs. (1.2)–(1.5) is designated. Note that setwd (set working directory) uses / rather than the usual \. # # Access ODE integrator library("deSolve"); # # Access functions for numerical solution setwd("f:/checkpoint/chap2/fbpde"); source("pde1a.R"); source("sigT.R"); source("gamA.R"); source("gamG.R"); source("simp.R");

pde1a.R is the routine for the method of lines (MOL) approximation of PDEs (1.2) (discussed subsequently). sigT, gamA, gamG, simp are subordinate routines called by pde1a.

2.2 Main Program

25

• The model parameters are specified numerically, starting with the diffusivities in Eqs. (1.2) (taken from [1]). # # Parameters # # Diffusion delta_D =8.64e-07; delta_T =8.64e-07; delta_C =8.64e-07; delta_NC =8.64e-07; delta_H =9.8495e-02; delta_G =9.8495e-02; delta_I12 =6.0472e-02; delta_I2 =9.9956e-02; delta_A =7.85e-02;

• The parameters in the RHSs of Eqs. (1.2) are specified numerically. # # D PDE lamDH =0.364; D0 =2.0e-05; lamDG =20.02; dD =0.1; KH =0.4; KG =1.74e-09; # # T1 PDE lamT1I12 =4.66; T10 =4.0e-04; KI12 =1.5e-10; lamT1I2 =0.25; KI2 =2.37e-11; KTQ =1.365e-18; dT1 =0.197; # # T8 PDE lamT8I12 =4.15; T80 =2.0e-04; lamT8I2 =0.25; dT8 = 0.18; # # C PDE lamC=0.616; Cm =0.8;

26

2 Fixed Boundary PDE Model Implementation eta1 =11.5; eta8 =46; dC =0.17; # # NC PDE lamNC=0.001; dNC =0.001; # # H PDE lamHNC=1.0e-10; dH =1.0; # # G PDE lamG=2.23e-10; dG =1.28; # # I12 PDE lamI12D=5.18e-07; dI12 =1.38; # # I2 PDE lamI2T2=2.82e-08; dI2 =2.376; # # P PDE muPA=6.87e+06; # # Q PDE rhoL=5.22e-07; eps =0; alpPL=1.0e-01; dQ =1.0; # # A PDE muPA=6.87e+06; dA =0.0462;

Since the parameters for the NC (r, t) PDE (Eq. (1.2-5)) and the H (r, t) PDE (Eq. (1.2-6)) are not specified in [1], they are given the values lamNC=0.1, dNC=0.1 and lamHNC=1.0e-10, dH=1.0, respectively. • The parameters in BCs (1.5-2), (1.5-3) are specified. # # BCs sig0 =1; T1s=4.0e-03; T8s=2.0e-03;

2.2 Main Program

27

• A spatial grid of 21 points is defined for xl = 0 ≤ x ≤ xu = 0.01, so that x = 0, 0.01/20, . . . , 0.01. # # Spatial grid (in r) nr=21;rl=0;ru=0.01;dr=(ru-rl)/(nr-1); r=seq(from=rl,to=ru,by=dr);

• An interval in t of 26 points is defined for 0 ≤ t ≤ 100 so that tout = 0, 100/25, . . . , 100. # # Independent variable for ODE integration t0=0;tf=100;nout=26; tout=seq(from=t0,to=tf,by=(tf-t0)/(nout-1));

• ICs (1.3) are defined (from [1]). # # Initial condition (t=0) u0=rep(0,12*nr); for(i in 1:nr){ u0[i]=2.61e-10; u0[i+nr]= 4.0e-03; u0[i+2*nr]= 4.0e-03; u0[i+3*nr]= 0.3968; u0[i+4*nr]= 0.0; u0[i+5*nr]= 0.0; u0[i+6*nr]=2.61e-10; u0[i+7*nr]= 1.8e-10; u0[i+8*nr]=4.74e-11; u0[i+9*nr]=11.2e-10; u0[i+10*nr]=11.2e-11; u0[i+11*nr]= 0.0;

# D(r,t=0) # T1(r,t=0) # T8(r,t=0) # C(r,t=0) # NC(r,t=0) # H(r,t=0) # G(r,t=0) # I12(r,t=0) # I2(r,t=0) # P(r,t=0) # Q(r,t=0) # A(r,t=0)

} ncall=0;

Since ICs for Eq. (1.2-5) (NC (r, t = 0)) and Eq. (1.2-6) (H (r, t = 0)) are not indicated in [1], they are given the values u0[i+4*nr]=0.0, u0[i+5*nr]=0.0. Also, the counter for the calls to pde1a is initialized. • The system of (12)(21) = 252 MOL/ODEs is integrated by the library integrator lsodes (available in deSolve, [3]). As expected, the inputs to lsodes are the ODE function, pde1a, the IC vector u0, and the vector of output values of

28

2 Fixed Boundary PDE Model Implementation

t, tout. The length of u0 (252) informs lsodes how many ODEs are to be integrated. func,y,times are reserved names. # # ODE integration out=lsodes(y=u0,times=tout,func=pde1a, sparsetype="sparseint",rtol=1e-8, atol=1e-8,maxord=5); nrow(out) ncol(out)

The numerical solution to the ODEs is returned in matrix out. In this case, out has the dimensions nout × (12nr + 1) = 26 × 12(21) + 1 which are confirmed by the output from nrow(out),ncol(out) (included in the numerical output considered subsequently). The offset 12(21) + 1 = 252 + 1 is required since the first element of each column has the output t (also in tout), and the 2, . . . , 12(21) + 1 = 2, . . . , 253 column elements have the 252 ODE solutions. • 2D arrays (matrices) are defined for the computed PDE solution (in array out returned by lsodes). The solution is then placed in these arrays. # # Arrays for plotting numerical solution D=matrix(0,nrow=nr,ncol=nout); T1=matrix(0,nrow=nr,ncol=nout); T8=matrix(0,nrow=nr,ncol=nout); C=matrix(0,nrow=nr,ncol=nout); NC=matrix(0,nrow=nr,ncol=nout); H=matrix(0,nrow=nr,ncol=nout); G=matrix(0,nrow=nr,ncol=nout); I12=matrix(0,nrow=nr,ncol=nout); I2=matrix(0,nrow=nr,ncol=nout); P=matrix(0,nrow=nr,ncol=nout); Q=matrix(0,nrow=nr,ncol=nout); A=matrix(0,nrow=nr,ncol=nout); for(it in 1:nout){ for(i in 1:nr){ D[i,it]= out[it,i+1]; T1[i,it]= out[it,i+1+nr]; T8[i,it]=out[it,i+1+2*nr]; C[i,it]=out[it,i+1+3*nr]; NC[i,it]=out[it,i+1+4*nr]; H[i,it]=out[it,i+1+5*nr]; G[i,it]=out[it,i+1+6*nr]; I12[i,it]=out[it,i+1+7*nr]; I2[i,it]=out[it,i+1+8*nr];

2.2 Main Program

29

P[i,it]=out[it,i+1+9*nr]; Q[i,it]=out[it,i+1+10*nr]; A[i,it]=out[it,i+1+11*nr]; } }

Again, the offset +1 is required since the first element of each solution vector (for a particular index it) is the value of t associated with the solution. • The number of calls to pde1a is displayed at the end of the solution. # # Calls to ODE routine cat(sprintf("\n\n ncall = %5d\n\n",ncall));

• Vectors are defined for the integral average of each PDE dependent variable, for example, 1 Davg (t) = ru − rl



ru

D(r, t)dr

(2.1)

rl

# # Average PDE solutions uavg=rep(0,nr); Davg=rep(0,nout); T1avg=rep(0,nout); T8avg=rep(0,nout); Cavg=rep(0,nout); NCavg=rep(0,nout); Havg=rep(0,nout); Gavg=rep(0,nout); I12avg=rep(0,nout); I2avg=rep(0,nout); Pavg=rep(0,nout); Qavg=rep(0,nout); Aavg=rep(0,nout);

• Each integral average is calculated as a function of t by Simpson’s rule in function simp (discussed subsequently). for(it in 1:nout){ for(i in 1:nr){ uavg[i]=D[i,it];} Davg[it]=simp(rl,ru,nr,uavg)/(ru-rl); . . . for(i in 1:nr){

30

2 Fixed Boundary PDE Model Implementation uavg[i]=A[i,it];} Aavg[it]=simp(rl,ru,nr,uavg)/(ru-rl); }

• Each integral average is plotted against t with matplot. # # D par(mfrow=c(1,1)); matplot(x=tout,y=Davg,type="l",xlab="t",ylab="Davg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black"); . . . # # A par(mfrow=c(1,1)); matplot(x=tout,y=Aavg,type="l",xlab="t",ylab="Aavg(t)", xlim=c(0,tf),lty=1,main="",lwd=2,col="black");

This completes the discussion of the main program os Listing 2.1. The ODE/MOL routine called by lsodes is considered next.

2.3 ODE/MOL Routine The routine for the ordinary differential equation (ODE) approximation of PDEs (1.2) by the method of lines (MOL) follows. pde1a=function(t,u,parms){ # # Function pde1a computes the t derivative # vectors of the 12 PDE model # # One vector to 12 vectors D=rep(0,nr); T1=rep(0,nr);T8=rep(0,nr); C=rep(0,nr); NC=rep(0,nr); H=rep(0,nr); G=rep(0,nr);I12=rep(0,nr);I2=rep(0,nr); P=rep(0,nr); Q=rep(0,nr); A=rep(0,nr); for(i in 1:nr){ D[i]= u[i]; T1[i]= u[i+nr]; T8[i]= u[i+2*nr]; C[i]= u[i+3*nr]; NC[i]= u[i+4*nr]; H[i]= u[i+5*nr]; G[i]= u[i+6*nr];

2.3 ODE/MOL Routine I12[i]= u[i+7*nr]; I2[i]= u[i+8*nr]; P[i]= u[i+9*nr]; Q[i]=u[i+10*nr]; A[i]=u[i+11*nr]; } # # First derivatives in r Dr=rep(0,nr); T1r=rep(0,nr); T8r=rep(0,nr); Cr=rep(0,nr); NCr=rep(0,nr); Hr=rep(0,nr); Gr=rep(0,nr);I12r=rep(0,nr); I2r=rep(0,nr); Pr=rep(0,nr); Qr=rep(0,nr); Ar=rep(0,nr); tableD= splinefun(r,D); Dr= tableD(r,deriv=1); tableT1= splinefun(r,T1); T1r= tableT1(r,deriv=1); tableT8= splinefun(r,T8); T8r= tableT8(r,deriv=1); tableC= splinefun(r,C); Cr= tableC(r,deriv=1); tableNC= splinefun(r,NC); NCr= tableNC(r,deriv=1); tableH= splinefun(r,H); Hr= tableH(r,deriv=1); tableG= splinefun(r,G); Gr= tableG(r,deriv=1); tableI12=splinefun(r,I12); I12r=tableI12(r,deriv=1); tableI2= splinefun(r,I2); I2r= tableI2(r,deriv=1); tableP= splinefun(r,P); Pr= tableP(r,deriv=1); tableQ= splinefun(r,Q); Qr= tableQ(r,deriv=1); tableA= splinefun(r,A); Ar= tableA(r,deriv=1); # # BCs, r=0 Dr[1]=0; T1r[1]=0; T8r[1]=0; Cr[1]=0; NCr[1]=0; Hr[1]=0; Gr[1]=0; I12r[1]=0; I2r[1]=0; Pr[1]=0; Qr[1]=0; Ar[1]=0; # # BCs, r=R Dr[nr]=0.0; T1r[nr]=-sigT(I12[nr])*(T1[nr]-T1s); T8r[nr]=-sigT(I12[nr])*(T8[nr]-T8s); Cr[nr]=0.0; NCr[nr]=0.0; Hr[nr]=0.0; Gr[nr]=0.0; I12r[nr]=0.0; I2r[nr]=0.0; Pr[nr]=0.0;

31

32

2 Fixed Boundary PDE Model Implementation Qr[nr]=0.0; Ar[nr]=0.0; # # Second derivatives in r Drr=rep(0,nr); T1rr=rep(0,nr); T8rr=rep(0,nr); Crr=rep(0,nr); NCrr=rep(0,nr); Hrr=rep(0,nr); Grr=rep(0,nr);I12rr=rep(0,nr); I2rr=rep(0,nr); Prr=rep(0,nr); Qrr=rep(0,nr); Arr=rep(0,nr); tableDr= splinefun(r,Dr); Drr= tableDr(r,deriv=1); tableT1r= splinefun(r,T1r); T1rr= tableT1r(r,deriv=1); tableT8r= splinefun(r,T8r); T8rr= tableT8r(r,deriv=1); tableCr= splinefun(r,Cr); Crr= tableCr(r,deriv=1); tableNCr= splinefun(r,NCr); NCrr= tableNCr(r,deriv=1); tableHr= splinefun(r,Hr); Hrr= tableHr(r,deriv=1); tableGr= splinefun(r,Gr); Grr= tableGr(r,deriv=1); tableI12r=splinefun(r,I12r); I12rr=tableI12r(r,deriv=1); tableI2r= splinefun(r,I2r); I2rr= tableI2r(r,deriv=1); tablePr= splinefun(r,Pr); Prr= tablePr(r,deriv=1); tableQr= splinefun(r,Qr); Qrr= tableQr(r,deriv=1); tableAr= splinefun(r,Ar); Arr= tableAr(r,deriv=1); # # PDEs Dt=rep(0,nr); T1t=rep(0,nr);T8t=rep(0,nr); Ct=rep(0,nr); NCt=rep(0,nr); Ht=rep(0,nr); Gt=rep(0,nr);I12t=rep(0,nr);I2t=rep(0,nr); Pt=rep(0,nr); Qt=rep(0,nr); At=rep(0,nr); for(i in 1:nr){ # # PDE RHSs Drhs=lamDH*D0*H[i]/(KH+H[i])+lamDG*D0*G[i]/(KG+G[i])-dD*D[i]; nlf1=I12[i]/(KI12+I12[i]); nlf2=I2[i]/(KI2+I2[i]); nlf3=1/(1+Q[i]/KTQ); T1rhs=(lamT1I12*T10*nlf1+lamT1I2*T1[i]*nlf2)*nlf3-dT1*T1[i]; T8rhs=(lamT8I12*T80*nlf1+lamT8I2*T8[i]*nlf2)*nlf3-dT8*T8[i]; Crhs=lamC*(1-C[i]/Cm)-(eta1*T1[i]*C[i]+eta8*T8[i]*C[i]) -dC*C[i] NCrhs=lamNC*C[i]-dNC*NC[i]; Hrhs=lamHNC*NC[i]-dH*H[i]; Grhs=lamG+gamG(t)-dG*G[i]; I12rhs=lamI12D*D[i]-dI12*I12[i]; I2rhs=lamI2T2*T1[i]-dI2*I2[i]; nlf4=P[i]/(T1[i]+T8[i]);

2.3 ODE/MOL Routine Prhs=nlf4*(lamT1I12*T10*nlf1+lamT8I12*T80*nlf2+ lamT1I2*T1[i]*nlf2+lamT8I2*T8[i]*nlf2)*nlf3nlf4*(dT1*T1[i]+dT8*T8[i])-muPA*P[i]*A[i]; L=rhoL*(T1[i]+T8[i]+eps*C[i]); Qrhs=alpPL*P[i]*L-dQ*Q[i]; Arhs=gamA(t)-muPA*P[i]*A[i]-dA*A[i]; sumrhs=Drhs+T1rhs+T8rhs+Crhs+NCrhs+ Hrhs+Grhs+I12rhs+I2rhs+Arhs; sumrhs 1){ rc=2/r[i]; Dt[i]=delta_D *(Drr[i]+rc* Dr[i])+ Drhs; T1t[i]=delta_T *(T1rr[i]+rc* T1r[i])+ T1rhs; T8t[i]=delta_T *(T8rr[i]+rc* T8r[i])+ T8rhs; Ct[i]=delta_C *(Crr[i]+rc* Cr[i])+ Crhs; NCt[i]=delta_NC *(NCrr[i]+rc* NCr[i])+ NCrhs; Ht[i]=delta_H *(Hrr[i]+rc* Hr[i])+ Hrhs; Gt[i]=delta_G *(Grr[i]+rc* Gr[i])+ Grhs; I12t[i]=delta_I12*(I12rr[i]+rc*I12r[i])+I12rhs; I2t[i]=delta_I2 *(I2rr[i]+rc* I2r[i])+ I2rhs; Pt[i]=delta_T *(Prr[i]+rc* Pr[i])+ Prhs; Qt[i]=delta_T *(Qrr[i]+rc* Qr[i])+ Qrhs; At[i]=delta_A *(Arr[i]+rc* Ar[i])+ Arhs; } }

33

34

2 Fixed Boundary PDE Model Implementation # # 12 vectors to one vector ut=rep(0,12*nr); for(i in 1:nr){ ut[i]= Dt[i]; ut[i+nr]= T1t[i]; ut[i+2*nr]= T8t[i]; ut[i+3*nr]= Ct[i]; ut[i+4*nr]= NCt[i]; ut[i+5*nr]= Ht[i]; ut[i+6*nr]= Gt[i]; ut[i+7*nr]=I12t[i]; ut[i+8*nr]= I2t[i]; ut[i+9*nr]= Pt[i]; ut[i+10*nr]= Qt[i]; ut[i+11*nr]= At[i]; } # # Increment calls to pde1a ncall