def water_level 2.3

def waterL {
sweep[fill style=water, style=water] { 1<>, translate([0, 1, 0]) }
polygon(0,0,0)(5,0,0)(5,0,5)(4,0,5)(4,0,1)(0,0,1)
}

def prism {
sweep[fill style=prism]
{ 4<>, rotate(360/4,[0,1,0]) }
line[fill style=prism](0.5,0,0.5)(0.5,1,0.5)
}

def water {
sweep[fill style=water]
{ 4<>, rotate(360/4,[0,1,0]) }
line[fill style=water, style=water](2.52,0,2.52)(2.52, 1, 2.52)
}

def grid {
put { translate([0, 0, 0]) then scale([1, 5, 1])}{ {prism} }
put { translate([1, 0, 0]) then scale([1, 4.5, 1])}{ {prism} }
put { translate([2, 0, 0]) then scale([1, 4.3, 1])}{ {prism} }
put { translate([3, 0, 0]) then scale([1, 4.8, 1])}{ {prism} }
put { translate([4, 0, 0]) then scale([1, 5, 1])}{ {prism} }

put { translate([0, 0, 1]) then scale([1, 4.5, 1])}{ {prism} }
put { translate([1, 0, 1]) then scale([1, 2, 1])}{ {prism} }
put { translate([2, 0, 1]) then scale([1, 2.2, 1])}{ {prism} }
put { translate([3, 0, 1]) then scale([1, 4, 1])}{ {prism} }
put { translate([4, 0, 1]) then scale([1, 4.9, 1])}{ {prism} }

put { translate([0, 0, 2]) then scale([1, 4.5, 1])}{ {prism} }
put { translate([1, 0, 2]) then scale([1, 2, 1])}{ {prism} }
put { translate([2, 0, 2]) then scale([1, 2.2, 1])}{ {prism} }
put { translate([3, 0, 2]) then scale([1, 4, 1])}{ {prism} }
put { translate([4, 0, 2]) then scale([1, 4.5, 1])}{ {prism} }

put { translate([0, 0, 3]) then scale([1, 4.0, 1])}{ {prism} }
put { translate([1, 0, 3]) then scale([1, 3.0, 1])}{ {prism} }
put { translate([2, 0, 3]) then scale([1, 3.2, 1])}{ {prism} }
put { translate([3, 0, 3]) then scale([1, 3.5, 1])}{ {prism} }
put { translate([4, 0, 3]) then scale([1, 3.0, 1])}{ {prism} }

put { translate([0, 0, 4]) then scale([1, 3.5, 1])}{ {prism} }
put { translate([1, 0, 4]) then scale([1, 2.8, 1])}{ {prism} }
put { translate([2, 0, 4]) then scale([1, 3.0, 1])}{ {prism} }
put { translate([3, 0, 4]) then scale([1, 3.5, 1])}{ {prism} }
put { translate([4, 0, 4]) then scale([1, 2.5, 1])}{ {prism} }

% put { translate([2, 0, 2]) then scale([1, water_level, 1])}{ {water} }

put { rotate(270,[0,1,0]) then scale([1,1,1]) then translate([4.51,0,-0.49]) }{ {waterL} }
}

put{ view((10,20,20)) }{{grid}} % Draw it!

global { language tikz }