How to calculate 3-hour flux values in ERA-Interim?
After my original answer, and some back and forth in the comments, turns out I got the answer right by a bit of fools luck, and we sorted it out...

The thing is, despite flux being commonly thought of in physics as BetterExplained.com suggests:


  Timing: We measure flux at a single point in time. Freeze time and ask
  “Right now, at this moment, how much stuff is passing through my
  surface?”. If your field doesn’t change over time, then all is well.
  If your field does change, then you need to pick a point in time to
  measure the flux.


But, fairly counter-intuitively to many, meteorological models often, despite naming their variables as flux (such as sshf... surface sensible heat flux), actually store them as accumulations.  This ECMWF whitepaper on archive data specifications explains:


  Physical fluxes archived by the ECMWF model are accumulated since the
  start of the relevant forecast, and therefore in units of
  $\mathrm{Jm^{−2}}$ (or $\mathrm{W m^{−2}\cdot s}$).  Thus, a daily
  mean (in $\mathrm{W m^{− 2}}$) is obtained by retrieving the
  accumulated fluxes at $\mathrm{t_1=t}$ and $\mathrm{t_2=t}+ \mathrm{24\;hours}$ (where
  $\mathrm{t}$ is the time of the start of the average), taking the difference
  and dividing by 86400, the number of seconds in a day.


So, though intuitively, you might think the surface sensible heat flux at 6 hours would just be the sshf variable in the 6 hour file, it isn't.  To get the best estimate of the flux, you'd need to calculate it as:

$$\mathrm{\frac{fluxvar_{(this\;timestep)} - fluxvar_{(previous\;timestep)}}{timestep_{(in\;hours)}\cdot3600}}$$

So if you want to find the average flux between hours 3 and 6, you'd do:

$$\mathrm{\frac{fluxvar_{(t=6hr)} - fluxvar_{(t=3hr)}}{3\cdot3600}}$$

A couple of questions that Vidhi asked about that may be worthwhile understanding to others:


Why did the website quoted show the calculation as $\mathrm{({fluxvar_{(t=6hr)} - fluxvar_{(t=3hr)})/10800}}$, but not $\mathrm{({fluxvar_{(t=3hr)} - fluxvar_{(t=0hr)})/10800}}$... instead just using $\mathrm{{fluxvar_{(t=3hr)}}/10800}$


Because indeed, in this strange accumulation form $\mathrm{fluxvar_{(t=0hr)}}$ by definition is zero.  The variable may or may not exist in the $\mathrm{t=0hr}$ file, but if it does, it should be pointless to include as it had better be 0 if it is indeed accumulation.

The site quoted only mentions hours 3, 6, 9, and 12.  I have 15, 18, and 21 as well, how do I deal with this?


The same math applies... but remember, if you're dealing with forecast model archive (rather than reanalysis data), you want to use the shortest future hour possible.  So actually, rather than use 00Z's $\mathrm{t=12hr}$, you want to be using 12Z's $\mathrm{t=0hr}$, such that, when calculating the 9Z to 12Z flux average, best is$\mathrm{({fluxvar_{(12Z\;t=0hr)} - fluxvar_{(00Z\;t=9hr)})/10800}}$.  Because you only need steps 0, 3, 6, and 9 before the next archived model/reanalysis file (for a twice a day model), the 12/15/18/21 values really are the 0/3/6/9 values (just from the next model run).



Anytime derived values (variables that aren't in the model itself, but require a formula to determine) need calculating, such as total surface heat flux, just make sure that when you combine the variables (in this case the shortwave, longwave, sensible, and latent heats), you only divide by the timestep once (don't divide by 10800 in the separate input variables beforehand, then divide by 10800 again after combining them).

The models are strange to many.  I just happened to incorrectly remember what a flux was, and get the "divide by 10800" math right (probably in part due to horror memories of working with similar files in years gone by!).  But hopefully this helps some confused people!