This is a brief writeup of the LFM accumulate routine used to average LFM values over a certain time to send to the RCM. The routine can be found in the file in the subroutine . This routine was developed by John Lyon.
Let's assume we want a time average of a quantity (which can be density, pressure, velocity, etc). Let the LFM timestep at step be defined as . Let's say we have done steps (since the last call to the RCM) in accumulating, the timestep weighed average is then
where and is the time elapsed. Now we are at timestep and want to compute a new average that takes into account (1) and the new value, so we want to compute
Since we don't have the information for all the steps but we do have (1) we can rewrite (2) as
This also saves use from redoing the averaging at each timestep.
In the code
where is the current timestep (.