Skip to content

Commit

Permalink
Added shallow_water_equations.vti
Browse files Browse the repository at this point in the history
  • Loading branch information
timhutton committed Feb 21, 2024
1 parent e6eaae6 commit 7997f82
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ set( PATTERN_FILES
Patterns/KardarParisiZhang1986/erosion.vti
Patterns/KardarParisiZhang1986/uniform_snowfall.vti
Patterns/KardarParisiZhang1986/drainage_erosion.vti
Patterns/shallow_water_equations.vti
)

set( HELP_FILES
Expand Down
1 change: 1 addition & 0 deletions Help/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h3>Changes</h3>
<li>New patterns:
<ul>
<li>The KPZ equation: <a href="open:Patterns/KardarParisiZhang1986/erosion.vti">KardarParisiZhang1986/erosion.vti</a>, <a href="open:Patterns/KardarParisiZhang1986/uniform_snowfall.vti">KardarParisiZhang1986/uniform_snowfall.vti</a> and <a href="open:Patterns/KardarParisiZhang1986/drainage_erosion.vti">KardarParisiZhang1986/drainage_erosion.vti</a>
<li>The shallow water equations: <a href="open:Patterns/shallow_water_equations.vti">shallow_water_equations.vti</a>
</ul>
</ul>

Expand Down
143 changes: 143 additions & 0 deletions Patterns/shallow_water_equations.vti
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<RD format_version="6">
<description>
The shallow water equations:

da/dt = - depth * (db/dx + dc/dy)&lt;br&gt;
db/dt = - g * da/dx - k * b&lt;br&gt;
dc/dt = - g * da/dy - k * c&lt;br&gt;

where:

a is the height of water surface&lt;br&gt;
b is the x-component of the water velocity&lt;br&gt;
c is the y-component of the water velocity&lt;br&gt;
d is the base height&lt;br&gt;
g is the force of gravity&lt;br&gt;
k is the viscosity
</description>
<rule name="Shallow water equations" type="formula" wrap="0" neighborhood_type="vertex">
<param name="timestep">
0.01
</param>
<param name="g">
9.8
</param>
<param name="k">
0.03
</param>
<formula number_of_chemicals="4" block_size_x="4" block_size_y="1" block_size_z="1" accuracy="medium">
delta_a = - max(0, a - d) * (x_gradient_b + y_gradient_c);
delta_b = - g * x_gradient_a - k * b;
delta_c = - g * y_gradient_a - k * c;
</formula>
</rule>
<initial_pattern_generator apply_when_loading="true" zero_first="true">
<overlay chemical="a">
<add/>
<gaussian height="1" sigma="0.05">
<point3D x="0.3" y="0.3" z="0.5"/>
</gaussian>
<everywhere/>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="-1" />
<everywhere/>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="1" />
<rectangle>
<point3D x="0.0" y="0.0" z="0.0" />
<point3D x="0.05" y="1.0" z="1.0" />
</rectangle>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="1" />
<rectangle>
<point3D x="0.0" y="0.0" z="0.0" />
<point3D x="1.0" y="0.05" z="1.0" />
</rectangle>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="1" />
<rectangle>
<point3D x="0.95" y="0.0" z="0.0" />
<point3D x="1.0" y="1.0" z="1.0" />
</rectangle>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="1" />
<rectangle>
<point3D x="0.0" y="0.95" z="0.0" />
<point3D x="1.0" y="1.0" z="1.0" />
</rectangle>
</overlay>
<overlay chemical="d">
<overwrite/>
<constant value="1" />
<rectangle>
<point3D x="0.5" y="0.0" z="0.0" />
<point3D x="0.55" y="0.4" z="1.0" />
</rectangle>
</overlay>
</initial_pattern_generator>
<render_settings>
<surface_color r="1" g="1" b="1"/>
<colormap value="spectral"/>
<color_low r="0" g="0" b="1"/>
<color_high r="1" g="0" b="0"/>
<show_color_scale value="true"/>
<show_multiple_chemicals value="true"/>
<active_chemical value="a"/>
<low value="-1"/>
<high value="1"/>
<vertical_scale_1D value="30"/>
<vertical_scale_2D value="100"/>
<contour_level value="0.25"/>
<cap_contour value="true"/>
<invert_contour_cap value="false"/>
<use_wireframe value="false"/>
<show_cell_edges value="false"/>
<show_bounding_box value="true"/>
<show_chemical_label value="true"/>
<slice_3D value="true"/>
<slice_3D_axis value="z"/>
<slice_3D_position value="0.5"/>
<show_displacement_mapped_surface value="true"/>
<color_displacement_mapped_surface value="false"/>
<use_image_interpolation value="true"/>
<timesteps_per_render value="128"/>
<show_phase_plot value="false"/>
<phase_plot_x_axis value="a"/>
<phase_plot_y_axis value="b"/>
<phase_plot_z_axis value="c"/>
<plot_ab_orthogonally value="false"/>
</render_settings>
</RD>
<ImageData WholeExtent="0 255 0 255 0 0" Origin="0 0 0" Spacing="1 1 1" Direction="1 0 0 0 1 0 0 0 1">
<Piece Extent="0 255 0 255 0 0">
<PointData>
<DataArray type="Float32" Name="a" format="binary" RangeMin="0" RangeMax="0">
CAAAAACAAAAAAAAANAAAADQAAAA0AAAANAAAADQAAAA0AAAANAAAADQAAAA=eJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAE=
</DataArray>
<DataArray type="Float32" Name="b" format="binary" RangeMin="0" RangeMax="0">
CAAAAACAAAAAAAAANAAAADQAAAA0AAAANAAAADQAAAA0AAAANAAAADQAAAA=eJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAE=
</DataArray>
<DataArray type="Float32" Name="c" format="binary" RangeMin="0" RangeMax="0">
CAAAAACAAAAAAAAANAAAADQAAAA0AAAANAAAADQAAAA0AAAANAAAADQAAAA=eJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAE=
</DataArray>
<DataArray type="Float32" Name="d" format="binary" RangeMin="0" RangeMax="0">
CAAAAACAAAAAAAAANAAAADQAAAA0AAAANAAAADQAAAA0AAAANAAAADQAAAA=eJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAF4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiAAAABeJztwQEBAAAAgJD+r+4ICgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYgAAAAXic7cEBAQAAAICQ/q/uCAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGIAAAAE=
</DataArray>
</PointData>
<CellData>
</CellData>
</Piece>
</ImageData>
</VTKFile>

0 comments on commit 7997f82

Please sign in to comment.