SlideShare a Scribd company logo
1 of 27
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 1
Diffusion Simulation with JS:
Writing Your Own ABM Code
S. Viridi1
, F. Haryanto1
, A. Sutresno2
, I. Arif1
1
Department of Physics, Institut Teknologi Bandung, Bandung 40132 Indonesia
2
Department of Physics, Universitas Kristen Satya Wacana, Salatiga 50711, Indonesia
v201890808_2
This slide is part of
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 2
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 3
Outline
• Introduction
• Agent-based model (ABM)
• JavaScript (JS) implementation
• Discussion
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 4
Introduction
Fick’s law
• Original form
• If container cross-section Q is not function of
x
which is the well-known form, Fick’s 2nd law
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 5
( ) ( )
2
2
,,
x
txC
D
t
txC
∂
∂
−=
∂
∂
( ) ( ) ( )








∂
∂
+
∂
∂
−=
∂
∂
x
txC
dx
dQ
Qx
txC
D
t
txC ,1,,
2
2
A. Fick, "Über Diffusion", Annalen der Physik [Ann. Phys. (Leipzig)], vol. 170, no. 1, pp. 59-86, 1855, url
https://doi.org/10.1002/andp.18551700105
Modification
• In order to accomodate finite-time limit, non-
Gaussian distribution, Burnett coefficients,
previous equation will be generalized into
which is reduced to Fick’s 2nd law if N = 1 and
t′ = 0, where φ2 is distribution change kernel
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 6
W. E. Alley, B. J. Alder, "Modification of Fick's Law", Physical Review Letters [Phys. Rev. Lett.] vol. 43, no. 10, pp. 653-
656, Sep 1979, url https://doi.org/10.1103/PhysRevLett.43.653
( ) ( ) ( )
n
nN
n
t
n
x
txC
tttd
D
D
t
txC
2
2
1 0
2
2 ,,
∂
′∂
′−′−=
∂
∂
∑ ∫=
ϕ
Numerical approach: FD
• With finite difference method, partial
differen-tial equation related to diffusion can
be solved
• And the Fick’s 2nd law will be
with j is for time and i is for position
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 7
J. C. Wu, N. A. Peppas, "Numerical Simulation of Anomalous Penetrant Diffusion in Polymers", Journal of Applied
Polymer Science [J. Appl. Polym. Sci.], vol. 49, no. 10, pp. 1845-1856, Sep 1993, url
https://doi.org/10.1002/app.1993.070491015
( ) ( ) j
i
j
i
j
i
j
i
j
i
j
i CCC
x
tD
CC
x
tD
C +−
∆
∆
−−
∆
∆
−= −+
+
1212
1
Illustration of FD approach
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 8
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 9
Agent-based model
Agents as particles
• An agent will represent a particle
• Various behaviours can be defined, even the
not physical ones
• The freedom of this model is an advantage
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 10
Previous work
• ABM has been implemented using matrix
representation to simulate diffusion of gas
and fluid
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 11
S. Viridi, Z. F. T. W. Lestari, T. D. K. Wungu, Suprijadi, "Simple Grid-Based Model of Sandpile Avalanche Due to
Heating Process", International Workshop on Computational Science, 30 June 2018, Kanazawa University, Japan, url
https://doi.org/10.17605/osf.io/nker6
Previous work: Initial condition
• System grid (square with blue line) with object
grid (black rectangle)
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 12
• p← = –1, p→ = +1
• p↑ = +1, p↓ = –1
Previous work: Gas phase
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 13
t = 0.01 t = 0.04 t = 0.2
• p← = –1, p→ = +1
• p↑ = +0.5, p↓ = –1
Previous work: Fluid phase
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 14
t = 0.01 t = 0.1 t = 0.2
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 15
JS Implementation
World matrix W
• Matrix that represents static boundary
condition
• Value of 0: free space, where agents can move
into
• Value of 1: occupied space, where agent are
not allowed to move into
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 16
Agent matrix A
• Matrix that represents position of all agents
• It will have value from 2 to N + 1, where N is
types of agents
• Each type is related to specific diffusion
coefficient D, which indicates how active one
type can be
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 17
Algorithm
• Step 1 t = tbeg
• Step 2 Choose not empty element in A
• Step 3 Generate new position using D
• Step 4 Move agent if destination value is 0
• Step 5 Repeat Step 2 for all agents
• Step 6 t = t + Δt
• Step 7 If t < tend Repeat Step 2
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 18
JavaScript implementation
• url https://bit.do/workshop-biophysics
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 19
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 20
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 21
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 22
JS implementation (cont.)
• In a web browser, use CTRL + U to see the
code
• You can modify the code and implement in
your own way
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 23
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 24
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 25
Discussion
Discussion
• Any suggestion?
• Any idea for collaboration?
• Source is avalable at
https://github.com/dudung/butiran.js
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 26
17th SEACOMP 2019
3rd PIT-FMB 2019
8-10 August 2019, Badung, Indonesia 27
Thank you

More Related Content

Similar to Diffusion Simulation with JS: Writing Your Own ABM Code

Incheon technopark wontack suh-3 minute icn power point template for all
Incheon technopark wontack suh-3 minute icn power point template for all Incheon technopark wontack suh-3 minute icn power point template for all
Incheon technopark wontack suh-3 minute icn power point template for all
WRONG PERSON
 

Similar to Diffusion Simulation with JS: Writing Your Own ABM Code (20)

Resume
ResumeResume
Resume
 
Resume
ResumeResume
Resume
 
Master Program in Computational Science
Master Program in Computational ScienceMaster Program in Computational Science
Master Program in Computational Science
 
Resume
ResumeResume
Resume
 
Simulation of Blood Cell Separation System Based on Inertia and Elasticity us...
Simulation of Blood Cell Separation System Based on Inertia and Elasticity us...Simulation of Blood Cell Separation System Based on Inertia and Elasticity us...
Simulation of Blood Cell Separation System Based on Inertia and Elasticity us...
 
Resume
ResumeResume
Resume
 
Virtual Laboratory for Line Follower Robot Competition
Virtual Laboratory for Line Follower Robot Competition Virtual Laboratory for Line Follower Robot Competition
Virtual Laboratory for Line Follower Robot Competition
 
IRJET- College Campus Event Management System
IRJET- College Campus Event Management SystemIRJET- College Campus Event Management System
IRJET- College Campus Event Management System
 
Eu fp7-h2020-experiences-daeyoung kim-kaist
Eu fp7-h2020-experiences-daeyoung kim-kaistEu fp7-h2020-experiences-daeyoung kim-kaist
Eu fp7-h2020-experiences-daeyoung kim-kaist
 
Slide-ISCMS-2
Slide-ISCMS-2Slide-ISCMS-2
Slide-ISCMS-2
 
Internship_Presentation.pptx
Internship_Presentation.pptxInternship_Presentation.pptx
Internship_Presentation.pptx
 
IRJET- Iot Applied to Logistics using Intelligent Cargo
IRJET-  	  Iot Applied to Logistics using Intelligent CargoIRJET-  	  Iot Applied to Logistics using Intelligent Cargo
IRJET- Iot Applied to Logistics using Intelligent Cargo
 
Sustainable and modern prototype of technologies with less carbon emissions f...
Sustainable and modern prototype of technologies with less carbon emissions f...Sustainable and modern prototype of technologies with less carbon emissions f...
Sustainable and modern prototype of technologies with less carbon emissions f...
 
Dhananjay resume (1)
Dhananjay resume (1)Dhananjay resume (1)
Dhananjay resume (1)
 
REAL ESTATE PRICE PREDICTION
REAL ESTATE PRICE PREDICTIONREAL ESTATE PRICE PREDICTION
REAL ESTATE PRICE PREDICTION
 
Resume
ResumeResume
Resume
 
Android Based Quiz Application
Android Based Quiz ApplicationAndroid Based Quiz Application
Android Based Quiz Application
 
Lp iot-iv-ece- 2019-20
Lp iot-iv-ece- 2019-20Lp iot-iv-ece- 2019-20
Lp iot-iv-ece- 2019-20
 
B-IoT based Green Technology Solutions to Control Pollution by Tracing Carbon...
B-IoT based Green Technology Solutions to Control Pollution by Tracing Carbon...B-IoT based Green Technology Solutions to Control Pollution by Tracing Carbon...
B-IoT based Green Technology Solutions to Control Pollution by Tracing Carbon...
 
Incheon technopark wontack suh-3 minute icn power point template for all
Incheon technopark wontack suh-3 minute icn power point template for all Incheon technopark wontack suh-3 minute icn power point template for all
Incheon technopark wontack suh-3 minute icn power point template for all
 

More from Sparisoma Viridi

More from Sparisoma Viridi (20)

Pembelajaran sains berbasis web
Pembelajaran sains berbasis webPembelajaran sains berbasis web
Pembelajaran sains berbasis web
 
Pemodelan Gaya Casimir dalam Sistem Satu-Dimensi Granular Gravitasi-Diri deng...
Pemodelan Gaya Casimir dalam Sistem Satu-Dimensi Granular Gravitasi-Diri deng...Pemodelan Gaya Casimir dalam Sistem Satu-Dimensi Granular Gravitasi-Diri deng...
Pemodelan Gaya Casimir dalam Sistem Satu-Dimensi Granular Gravitasi-Diri deng...
 
Komputasi Nuklir: Pendekatan dan Perkembangannya
Komputasi Nuklir: Pendekatan dan PerkembangannyaKomputasi Nuklir: Pendekatan dan Perkembangannya
Komputasi Nuklir: Pendekatan dan Perkembangannya
 
Edible and dynamics arts using rice: A proposed idea
Edible and dynamics arts using rice: A proposed ideaEdible and dynamics arts using rice: A proposed idea
Edible and dynamics arts using rice: A proposed idea
 
Interaction between Marine Sectors using System Dynamics for Patimban Deep Se...
Interaction between Marine Sectors using System Dynamics for Patimban Deep Se...Interaction between Marine Sectors using System Dynamics for Patimban Deep Se...
Interaction between Marine Sectors using System Dynamics for Patimban Deep Se...
 
Simulation of cell budding & binary fission: A preliminary study using molecu...
Simulation of cell budding & binary fission:A preliminary study using molecu...Simulation of cell budding & binary fission:A preliminary study using molecu...
Simulation of cell budding & binary fission: A preliminary study using molecu...
 
Molecular Dynamics (MD) Method and Agent-Based Model (AMB) in Simulation of S...
Molecular Dynamics (MD) Method and Agent-Based Model (AMB) in Simulation of S...Molecular Dynamics (MD) Method and Agent-Based Model (AMB) in Simulation of S...
Molecular Dynamics (MD) Method and Agent-Based Model (AMB) in Simulation of S...
 
Constructing Origin-Destination Matrix (ODM) using Agent-Based Model (AMB) in...
Constructing Origin-Destination Matrix (ODM) using Agent-Based Model (AMB) in...Constructing Origin-Destination Matrix (ODM) using Agent-Based Model (AMB) in...
Constructing Origin-Destination Matrix (ODM) using Agent-Based Model (AMB) in...
 
The Relation between ABM (Agent-Based Model) and SIR (Susceptible-Infected-Re...
The Relation between ABM (Agent-Based Model) and SIR (Susceptible-Infected-Re...The Relation between ABM (Agent-Based Model) and SIR (Susceptible-Infected-Re...
The Relation between ABM (Agent-Based Model) and SIR (Susceptible-Infected-Re...
 
Pengelolaan Jurnal Ilmiah
Pengelolaan Jurnal IlmiahPengelolaan Jurnal Ilmiah
Pengelolaan Jurnal Ilmiah
 
25 | Perubahan fasa gelombang
25 | Perubahan fasa gelombang25 | Perubahan fasa gelombang
25 | Perubahan fasa gelombang
 
Ilustrasi penjalaran gelombang
Ilustrasi penjalaran gelombangIlustrasi penjalaran gelombang
Ilustrasi penjalaran gelombang
 
Getaran dan gelombang
Getaran dan gelombangGetaran dan gelombang
Getaran dan gelombang
 
Fisika Dasar dan Nilai-nilai yang Diajarkannya
Fisika Dasar dan Nilai-nilai yang DiajarkannyaFisika Dasar dan Nilai-nilai yang Diajarkannya
Fisika Dasar dan Nilai-nilai yang Diajarkannya
 
Pembelajaran Fisika dalam Era Industri 4.0
Pembelajaran Fisika dalam Era Industri 4.0Pembelajaran Fisika dalam Era Industri 4.0
Pembelajaran Fisika dalam Era Industri 4.0
 
Menulis dan Membaca Berkas Teks Polos dengan Python
Menulis dan Membaca Berkas Teks Polos dengan PythonMenulis dan Membaca Berkas Teks Polos dengan Python
Menulis dan Membaca Berkas Teks Polos dengan Python
 
Strategi Mempersiapkan Diri Menjadi Guru Sains Kreatif & Inovatif di Era Mile...
Strategi Mempersiapkan Diri Menjadi Guru Sains Kreatif & Inovatif di Era Mile...Strategi Mempersiapkan Diri Menjadi Guru Sains Kreatif & Inovatif di Era Mile...
Strategi Mempersiapkan Diri Menjadi Guru Sains Kreatif & Inovatif di Era Mile...
 
Compaction of two-dimensional system of composite spherical particles under i...
Compaction of two-dimensional system of composite spherical particles under i...Compaction of two-dimensional system of composite spherical particles under i...
Compaction of two-dimensional system of composite spherical particles under i...
 
Writing Has Never Been Easier: Penulisan Jurnal Ilmiah
Writing Has Never Been Easier: Penulisan Jurnal IlmiahWriting Has Never Been Easier: Penulisan Jurnal Ilmiah
Writing Has Never Been Easier: Penulisan Jurnal Ilmiah
 
Gravity-driven agent-based model for simulation of economic growth of a point...
Gravity-driven agent-based model for simulation of economic growth of a point...Gravity-driven agent-based model for simulation of economic growth of a point...
Gravity-driven agent-based model for simulation of economic growth of a point...
 

Recently uploaded

Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
cupulin
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 

Diffusion Simulation with JS: Writing Your Own ABM Code

  • 1. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 1 Diffusion Simulation with JS: Writing Your Own ABM Code S. Viridi1 , F. Haryanto1 , A. Sutresno2 , I. Arif1 1 Department of Physics, Institut Teknologi Bandung, Bandung 40132 Indonesia 2 Department of Physics, Universitas Kristen Satya Wacana, Salatiga 50711, Indonesia v201890808_2
  • 2. This slide is part of 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 2
  • 3. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 3 Outline • Introduction • Agent-based model (ABM) • JavaScript (JS) implementation • Discussion
  • 4. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 4 Introduction
  • 5. Fick’s law • Original form • If container cross-section Q is not function of x which is the well-known form, Fick’s 2nd law 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 5 ( ) ( ) 2 2 ,, x txC D t txC ∂ ∂ −= ∂ ∂ ( ) ( ) ( )         ∂ ∂ + ∂ ∂ −= ∂ ∂ x txC dx dQ Qx txC D t txC ,1,, 2 2 A. Fick, "Über Diffusion", Annalen der Physik [Ann. Phys. (Leipzig)], vol. 170, no. 1, pp. 59-86, 1855, url https://doi.org/10.1002/andp.18551700105
  • 6. Modification • In order to accomodate finite-time limit, non- Gaussian distribution, Burnett coefficients, previous equation will be generalized into which is reduced to Fick’s 2nd law if N = 1 and t′ = 0, where φ2 is distribution change kernel 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 6 W. E. Alley, B. J. Alder, "Modification of Fick's Law", Physical Review Letters [Phys. Rev. Lett.] vol. 43, no. 10, pp. 653- 656, Sep 1979, url https://doi.org/10.1103/PhysRevLett.43.653 ( ) ( ) ( ) n nN n t n x txC tttd D D t txC 2 2 1 0 2 2 ,, ∂ ′∂ ′−′−= ∂ ∂ ∑ ∫= ϕ
  • 7. Numerical approach: FD • With finite difference method, partial differen-tial equation related to diffusion can be solved • And the Fick’s 2nd law will be with j is for time and i is for position 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 7 J. C. Wu, N. A. Peppas, "Numerical Simulation of Anomalous Penetrant Diffusion in Polymers", Journal of Applied Polymer Science [J. Appl. Polym. Sci.], vol. 49, no. 10, pp. 1845-1856, Sep 1993, url https://doi.org/10.1002/app.1993.070491015 ( ) ( ) j i j i j i j i j i j i CCC x tD CC x tD C +− ∆ ∆ −− ∆ ∆ −= −+ + 1212 1
  • 8. Illustration of FD approach 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 8
  • 9. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 9 Agent-based model
  • 10. Agents as particles • An agent will represent a particle • Various behaviours can be defined, even the not physical ones • The freedom of this model is an advantage 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 10
  • 11. Previous work • ABM has been implemented using matrix representation to simulate diffusion of gas and fluid 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 11 S. Viridi, Z. F. T. W. Lestari, T. D. K. Wungu, Suprijadi, "Simple Grid-Based Model of Sandpile Avalanche Due to Heating Process", International Workshop on Computational Science, 30 June 2018, Kanazawa University, Japan, url https://doi.org/10.17605/osf.io/nker6
  • 12. Previous work: Initial condition • System grid (square with blue line) with object grid (black rectangle) 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 12
  • 13. • p← = –1, p→ = +1 • p↑ = +1, p↓ = –1 Previous work: Gas phase 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 13 t = 0.01 t = 0.04 t = 0.2
  • 14. • p← = –1, p→ = +1 • p↑ = +0.5, p↓ = –1 Previous work: Fluid phase 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 14 t = 0.01 t = 0.1 t = 0.2
  • 15. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 15 JS Implementation
  • 16. World matrix W • Matrix that represents static boundary condition • Value of 0: free space, where agents can move into • Value of 1: occupied space, where agent are not allowed to move into 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 16
  • 17. Agent matrix A • Matrix that represents position of all agents • It will have value from 2 to N + 1, where N is types of agents • Each type is related to specific diffusion coefficient D, which indicates how active one type can be 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 17
  • 18. Algorithm • Step 1 t = tbeg • Step 2 Choose not empty element in A • Step 3 Generate new position using D • Step 4 Move agent if destination value is 0 • Step 5 Repeat Step 2 for all agents • Step 6 t = t + Δt • Step 7 If t < tend Repeat Step 2 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 18
  • 19. JavaScript implementation • url https://bit.do/workshop-biophysics 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 19
  • 20. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 20
  • 21. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 21
  • 22. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 22
  • 23. JS implementation (cont.) • In a web browser, use CTRL + U to see the code • You can modify the code and implement in your own way 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 23
  • 24. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 24
  • 25. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 25 Discussion
  • 26. Discussion • Any suggestion? • Any idea for collaboration? • Source is avalable at https://github.com/dudung/butiran.js 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 26
  • 27. 17th SEACOMP 2019 3rd PIT-FMB 2019 8-10 August 2019, Badung, Indonesia 27 Thank you