A good example of specifying stage boundary conditions (type 3) is the
suntans/main/examples/ estuary example,
where a stage boundary condition is specified at the ocean boundary to the west of the domain.
A simplified tidal signal is specified via the following code contained within the function
BoundaryVelocities() of suntans/main/examples/estuary/boundaries.c.
for(iptr=grid->celldist[1];iptr<grid->celldist[2];iptr++) {
i = grid->cellp[iptr];
phys->h[i]=-prop->amp*sin(prop->omega*prop->rtime);
}
In this example, type 2 boundary conditions result in indicies to computational cells adjacent
to type 2 boundary condition being stored in [ celldist[1], celldist[2]).
Stage information for these cells can then be specified by setting the cell stage via the cell pointer
i=grid->cellp[iptr]. In this example, prop->amp specifies tidal amplitude
,
prop->omega specifies the frequency
, and prop->rtime the simulation time
within
the prototype function
.