Hey Andrés,
I assume your model would be transient and the water table somewhat "well behaved", meaning there is only one (no perched system with more than one free water table at different elevations).
Between time steps, you would have to find that water table, calculate the depth from GS to water table, and then set the boundary condition according to your equation?? The boundary condition would then be assumed to be constant for the next time step. Are parameters A and B constant or variabel over time? They would have to come from an external data source (text file, DB). Is that would you were thinking?
If your FEM isn't too too large, would you mind emailing me a version?
Thanks, Chris