Commit 9c12e875 authored by Diego Jahn's avatar Diego Jahn
Browse files

Update Miscellaneous models.

parent 6f0ea6c5
<MorpheusModel version="3">
<Description>Conway's Game of Life
---------------------
Classical Cellular Automaton with synchronized updates.
Rules:
- If alive, die when less than 2 live neighbors
- If alive, survive when 2 or 3 live neighbors (no change)
- If alive, die when more than 3 live neighbors
- If dead, become alive when exactly 3 live neighbors
<Title>Example-GameOfLife</Title>
<Details>Simulates Conway's cellular automata model "Game of Life" by
1. summing the states of neighboring cells with NeighborhoodReporter
2. based on this sum, setting the cell state using a System of (synchronously updated) Rules.</Details>
</Description>
<Global>
<Constant symbol="s" value="0"/>
</Global>
<Space>
<Lattice class="square">
<Size symbol="size" value="50 50 0"/>
<BoundaryConditions>
<Condition boundary="x" type="periodic"/>
<Condition boundary="y" type="periodic"/>
</BoundaryConditions>
<Neighborhood>
<Order>2</Order>
</Neighborhood>
</Lattice>
<SpaceSymbol symbol="space"/>
</Space>
<Time>
<StartTime value="0"/>
<StopTime value="500"/>
<SaveInterval value="0"/>
<TimeSymbol symbol="time"/>
</Time>
<CellTypes>
<CellType class="biological" name="cell">
<Property symbol="s" value="0.0" name="State_Living"/>
<Property symbol="sum" value="0.0" name="Sum_Neighbors"/>
<System solver="euler" time-step="1.0" name="Rules of life">
<Rule symbol-ref="s">
<Expression>if((s == 1 and sum &lt; 2), 0,
if((s == 1 and sum > 3), 0,
if((s == 0 and sum == 3), 1, s)
)
)
</Expression>
</Rule>
</System>
<NeighborhoodReporter>
<Input scaling="cell" value="s"/>
<Output symbol-ref="sum" mapping="sum"/>
</NeighborhoodReporter>
</CellType>
</CellTypes>
<CellPopulations>
<Population size="0" type="cell">
<InitProperty symbol-ref="s">
<Expression>if(rand_uni(0,1) > 0.75, 1, 0)</Expression>
</InitProperty>
<InitCellLattice/>
</Population>
</CellPopulations>
<Analysis>
<Gnuplotter time-step="20" decorate="false">
<Terminal name="png"/>
<Plot>
<Cells value="s">
<ColorMap>
<Color value="1" color="black"/>
<Color value="0.0" color="white"/>
</ColorMap>
</Cells>
</Plot>
</Gnuplotter>
</Analysis>
</MorpheusModel>
---
title: "Game of Life: Cellular Automata"
date: "2019-11-10T09:58:00+01:00"
toc: true
menu:
Built-in Examples:
parent: Miscellaneous models
weight: 10
weight: 510
---
## Introduction
This example models probably the best-known classic cellular automaton (CA) model: [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). It shows an alternative use of ```System``` for synchronous updating of ```Equations```.
![](game-of-life.png "Conway´s Game of Life.")
## Model description
In this model, the lattice is filled with cells of size $1$. Each cell counts the number of neighboring cells that are 'alive' and acts accordingly. The rules that make up the Game of Life are implemented in a ```System``` of ```Equations``` in which all ```Equations``` are updated synchronously.
<div style="padding:75% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/47171614?loop=1" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
## Things to try
- Change the ```Neighborhood``` from a Moore (2nd order) to von Neumann (1st order).
\ No newline at end of file
In Morpheus GUI: ```Examples``````Miscellaneous``````GameOfLife.xml```.
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8'?>
<MorpheusModel version="1">
<Description>
<Title></Title>
</Description>
<Space>
<Lattice class="linear">
<Size value="0 0 0"/>
</Lattice>
</Space>
<Time>
<StartTime value="1.0"/>
<StopTime value="1.0"/>
</Time>
</MorpheusModel>
\ No newline at end of file
---
title: "Minimal model"
date: "2019-11-10T09:49:00+01:00"
toc: true
menu:
Built-in Examples:
parent: Miscellaneous models
weight: 40
weight: 540
---
## Introduction
This example does nothing -- expect being the minimal valid Morpheus model. Such a model is generated when choosing ```File``````New```.
{{< figure library="true" src="examples/miscellaneous/minimal_model.png" lightbox="true" title="Minimal valid XML model." >}}
## Model description
The basic model only includes the required nodes ```MorpheusModel```, ```Description```, ```Space``` and ```Time```. Their required nodes and attributes are added recursively, such as ```Lattice``` class and ```StopTime``` value.
## Things to try
- Invalidate this minimal model by editing it (but keeping it well-formed). When opening this model in Morpheus GUI, it triggers a warning saying what went wrong and how it was solved. Check the ```Fixboard``` to see the changes that were made to the model.
## More information
- FAQ: [Your first model](/faq/your-first-model/)
\ No newline at end of file
In Morpheus GUI: ```File``````New```.
\ No newline at end of file
<MorpheusModel version="3">
<Description>
<Title>Example-FrenchFlag</Title>
<Details>Wolpert L (1969). "Positional information and the spatial pattern of cellular differentiation". J. Theor. Biol. 25 (1): 1–47.</Details>
</Description>
<Global>
<Field symbol="m" value="c_0*exp(-k/D*(l.x/size.x))" name="morphogen gradient">
<Diffusion rate="0.0"/>
</Field>
<Constant symbol="c_0" value="1.0"/>
<Constant symbol="D" value="0.75"/>
<Constant symbol="k" value="1"/>
<Constant symbol="celltype" value="0.0"/>
</Global>
<Space>
<Lattice class="square">
<Size symbol="size" value="20 20 0"/>
<NodeLength value="1"/>
<BoundaryConditions>
<Condition boundary="x" type="constant"/>
<Condition boundary="y" type="constant"/>
</BoundaryConditions>
<Neighborhood>
<Order>1</Order>
</Neighborhood>
</Lattice>
<SpaceSymbol symbol="l" name="location"/>
</Space>
<Time>
<StartTime value="0"/>
<StopTime value="0"/>
<TimeSymbol symbol="time"/>
</Time>
<CellTypes>
<CellType class="biological" name="cells">
<Property symbol="p" value="0.0" name="p"/>
<Property symbol="celltype" value="0.0" name="cell type"/>
<Constant symbol="t1" value="0.7"/>
<Constant symbol="t2" value="0.4"/>
<Equation symbol-ref="celltype">
<Expression>if(p>t1,3, if(p>t2, 2, 1))</Expression>
</Equation>
<Mapper name="report morphogen concentration">
<Input value="m"/>
<Output symbol-ref="p" mapping="average"/>
</Mapper>
</CellType>
</CellTypes>
<CellPopulations>
<Population size="0" type="cells">
<InitCellLattice/>
</Population>
</CellPopulations>
<Analysis>
<Gnuplotter time-step="0">
<Terminal opacity="0.5" persist="true" name="png"/>
<Plot>
<Cells value="celltype">
<ColorMap>
<Color value="3" color="blue"/>
<Color value="2" color="white"/>
<Color value="1" color="red"/>
</ColorMap>
</Cells>
<Field symbol-ref="m"/>
</Plot>
</Gnuplotter>
<Logger time-step="0.0">
<Input>
<Symbol symbol-ref="m"/>
<Symbol symbol-ref="celltype"/>
</Input>
<Output>
<TextOutput/>
</Output>
<Restriction>
<Slice value="size.y/2" axis="y"/>
</Restriction>
<Plots>
<Plot>
<Style style="linespoints"/>
<Terminal terminal="png"/>
<X-axis>
<Symbol symbol-ref="l.x"/>
</X-axis>
<Y-axis>
<Symbol symbol-ref="m"/>
<Symbol symbol-ref="celltype"/>
</Y-axis>
</Plot>
</Plots>
</Logger>
</Analysis>
</MorpheusModel>
---
title: "French Flag: Morphogen gradient"
date: "2019-11-10T10:08:00+01:00"
toc: true
menu:
Built-in Examples:
parent: Miscellaneous models
weight: 20
weight: 520
---
## Introduction
This example shows Wolpert's classical [French Flag model](https://en.wikipedia.org/wiki/French_flag_model). Depending on the local concentration of a morphogen, cells adopt one of three cell types based on internal thresholds.
![](french-flag.png "Wolpert´s French Flag.")
## Model description
The model sets up a morphogen gradient in the $x$ direction as a 2D field in the ```Global``` section. Note that no diffusion is used, since we use the steady-state solution of the diffusion and degradation process with fixed boundary source.
The cells in ```CellType``` register the (average) local morphogen concentration using a ```Mapper```. Based on the specified threshold values, they choose an identity $I$ as defined in the ```Equation```.
Note that this model is not time-dependent. ```Time``` is therefore set from ```StartTime``` $0$ to ```StopTime``` $0$.
## Things to try
[//]: # (- Change the physical length of the domain by editing ```Space``` → ```NodeLength``` that controls the physical size per lattice site.)
- Change the model such that the morphogen gradient is set up by production and diffusion, using ```Diffusion``` and a ```System``` with ```DiffEqn```. That is, change the model into a time-dependent model.
\ No newline at end of file
In Morpheus GUI: ```Examples``````Miscellaneous``````FrenchFlag.xml```.
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8'?>
<MorpheusModel version="3">
<Description>
<Title>Example-ParticleAggregation</Title>
<Details>Shows new FlipCells plugin
</Details>
</Description>
<Global>
<Variable symbol="sn" value="0" name="Sum of non-isolated cells"/>
<Constant symbol="s" value="0"/>
</Global>
<Space>
<Lattice class="hexagonal">
<Size symbol="size" value="40, 40, 0"/>
<Neighborhood>
<Order>2</Order>
</Neighborhood>
<BoundaryConditions>
<Condition boundary="x" type="periodic"/>
<Condition boundary="y" type="periodic"/>
</BoundaryConditions>
</Lattice>
<SpaceSymbol symbol="l"/>
</Space>
<Time>
<StartTime value="0"/>
<StopTime value="5000"/>
<!-- <Disabled>
<RandomSeed value="1415712648"/>
</Disabled>
-->
<TimeSymbol symbol="time"/>
</Time>
<CellTypes>
<CellType class="biological" name="spins">
<Property symbol="s" value="0.0" name="state"/>
<DelayProperty symbol="s_n" value="0.0" delay="1" name="state_neighbors"/>
<Property symbol="p" value="2.25" name="probability"/>
<Function symbol="ni" name="non-isolated">
<Expression>if(s==1 and s_n > 1, 1, 0)</Expression>
</Function>
<NeighborhoodReporter>
<Input scaling="cell" value="s"/>
<Output symbol-ref="s_n" mapping="sum"/>
</NeighborhoodReporter>
<FlipCellMotion neighborhood="2" time-step="1">
<Condition>s > 0 and rand_uni(0,1) &lt; (1-(s_n/12)*p)</Condition>
</FlipCellMotion>
<Mapper>
<Input value="ni"/>
<Output symbol-ref="sn" mapping="sum"/>
</Mapper>
</CellType>
</CellTypes>
<CellPopulations>
<Population size="0" type="spins">
<InitProperty symbol-ref="s">
<Expression>if(rand_uni(0,1) &lt; 0.10, 1, 0)</Expression>
</InitProperty>
<InitCellLattice/>
</Population>
</CellPopulations>
<Analysis>
<Gnuplotter time-step="100" decorate="false">
<Terminal name="png"/>
<Plot>
<Cells value="s">
<ColorMap>
<Color value="1" color="black"/>
<Color value="0.0" color="white"/>
</ColorMap>
</Cells>
</Plot>
</Gnuplotter>
<Logger time-step="25">
<Input>
<Symbol symbol-ref="sn"/>
</Input>
<Output>
<TextOutput/>
</Output>
<Plots>
<Plot time-step="250">
<Style style="lines" line-width="3.0"/>
<Terminal terminal="png"/>
<X-axis>
<Symbol symbol-ref="time"/>
</X-axis>
<Y-axis>
<Symbol symbol-ref="sn"/>
</Y-axis>
</Plot>
</Plots>
</Logger>
</Analysis>
</MorpheusModel>
---
title: "FlipCells: Particle Aggregation"
date: "2019-11-10T10:16:00+01:00"
toc: true
menu:
Built-in Examples:
parent: Miscellaneous models
weight: 30
weight: 530
---
## Introduction
This models approximates an interacting particle system (IPS) model of particle aggregation. Each black dot represents a particle that moved due to spin flips with random neighbors. The particles perform random walks in which the probability of moving depends on the number of neighboring cells.
![](particle-aggregation.png "Aggregation of moving particles.")
## Model description
Each lattice site (white or black) counts the number of particles (black neighboring sites) using a ```NeighborsReporter```.
The probability of movement of each particle is made dependent on its number of neighbors by using it in the ```Condition``` of ```FlipCells```. When this condition is satisfied, the particle changes positions with a random neighboring lattice site.
A ```PopulationReporter``` is used to return the fraction of isolated black particles. This number is logged and plotted using the ```Logger```.
<div style="padding:75% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/111263973?loop=1" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
## Things to try
- Change the parameter $p$.
\ No newline at end of file
In Morpheus GUI: ```Examples``````Miscellaneous``````ParticleAggregation.xml```.
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment