In this example, the balloons are force to ``breath'' by using a source inside the straw and two sinks outside the apparatus. The file balloon.ibis was modified to read;
domain 0.00 4.00 0.00 2.00 grid 7 0.000165 10000 fluid -m 1.6 -r 1.0 # # graphics variables # visual -h 128 -w 256 -n 500 -p binary -b balloon graphics -n 1000 -p line -b balloon particle -d 4 # # add some sources/sinks # source -n 3 # # some spring constants # spring b -b 1.0e+6 -s 4.0e+7 spring r -b 1.0e+6 -s 4.0e+7 -t 4.0e+6 # # The polygon is activated with -A 1 # polygon -A 1 first 2.50 0.875 carc -n 512 2.50 1.125 0.375 1 ray 1.50 1.125 -n 256 -e 4.0e+6 ray carc -n 512 2.50 1.125 0.375 -1 ray 2.50 0.875 -n 256 -e 4.0e+6 end
Because there are no active entities in this problem, the template subroutine actmov is not modified. The control of the sources is accomplished via the following modifed getsrc code;
c c-------------------------------------------------------------- c subroutine getsrc (xsourc,ysourc,src,ntsrc) c c user routine that specifies the sources c include 'parm.inc' include 'domain.inc' c c global variables c integer ntsrc double precision xsourc(nsrc),ysourc(nsrc),src(nsrc) c c local variables c double precision arg,period,modul c c the number of sources c ntsrc = 3 c c modulate the sources c period = 5000.0d0 arg = 8.0d0*atan(1.0d0)*dble(nt-ntstart)/period modul = dsin(arg) c c Make sure the sum of src(j) over j is zero c xsourc(1) = 2.0d0 ysourc(1) = 1.5d0 src(1) = -5.0d0*modul c xsourc(2) = 2.0d0 ysourc(2) = 1.0d0 src(2) = 10.0d0*modul c xsourc(3) = 2.0d0 ysourc(3) = 0.5d0 src(3) = -5.0d0*modul c return end
Output from this simulation is shown in the next figures. Notice that when the balloons increase and decrease simultaneously due to the increasing and decreasing volume of fluid in the apparatus.