lagrange is correct. I thought you were solving a waveguide "eigen-wave" problem and your 2D were the cross-section of the waveguide. Now I recognize in fact 1 of your 2D is actually the longitudinal direction (which was the 3rd dimension that I talked about above), and you are solving a 2D wave propagation problem. Obviously you know beforehand all the modes that could be excited in the waveguide. Yes you can get the s-parameter. Sorry for the misleading comments above.
There are many ways to "EXTRACT" the s-parameter. Each method is appropriate at only a certain circumstance corresponding to:
1. the pusle shape -f(t)- of your excitation.
2. the mode shape -f(x)- of your excitation (are you excitating only 1 mode, or in fact a series of modes?)
3. the way your excitation applied (hard source or soft source).
4. the ability to record the fields at only a few locations or a large number of them.
5. the absorbing boundary condition and the specifics of the problem, which determine the modal contents at the locations where you record the field.
6. other factors... (that I am not able to recall at this point)
Let's denote your 2D as x and z. One assumption in your "project" is that the field distribution along y is known (found in separate analysis). It could be uniform (f
=constant), as pointed out by lagrange. f
could also be non-uniform, but remain unchanged along the longitudinal dimension z. Somebody would call this latter case a 3-D problem that can be solved in 2D, (this might be the source of the confusion in my end.)
In the most simple senario, you implement some absorbing boundary condition, apply some source at z=zs, record the time signals (fields) at z=zin and z=zout. Normally one would make |zin-z0| big so that "higher order modes have decayed significantly". In other words, it is better to carefully select the "measurement" points (zin, zout) so that they are at some distance from any discontinuities. In this way, you can easily get Vin(t), Iin(t), Vout(x,t) and Iout(t) corresponding to the foundametal mode. Then these four V and I are transformed into the frequency domain. With the knowledge of mode-impedance (found from textbook or separate analysis), the V(f) and I(f) are "transformed" into the so-called "wave signals" coming in and out of the planes zin and zout. You can then calculate the s-parameter's in a straightforward manner.
The above senario is most simple because you don't need to pay much attention to the items (1-6) listed earlier. The signals you "measured" at zin and zout are "pure" (only foundamental mode component). It is simple also because you know the mode shape, the propagation constant, the mode impedance. Otherwise, you really need to "extract" the "wave signals" and the s-parameters. I think this "extraction" processe is partially science and partially "art". There are too much to talk about here. If you have any specific question, I would be happy to discuss it further with you.