<p>I'm trying to compute something called the &quot;Drying Ratio&quot; following: <a href="https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2017JD027995" rel="nofollow noreferrer">Eidhammer, 2018</a></p>
<p>The drying ratio is the ratio of the precipitation to the incoming vapor flux. So,</p>
<p><span class="math-container">$DR = \frac{F_{in} - F_{out}}{F_{in}} = \frac{P}{F_{in}}$</span></p>
<p>This makes some assumptions about sources/sinks (minimal evaporation for example). The vapor flux can be expressed as:</p>
<p><span class="math-container">$\vec{F} = \frac{-1}{g} \int_{P_{sfc}}^{P_{top}} q\vec{V}dp$</span></p>
<p>Integrating the vapor transport field along a particular control volume grid-box, and over time yields, length units (same as precipitation).</p>
<p>When the wind component U and V are always coming from the same direction (same sign), the incoming flux into a particular control volume is found by summing up the V components for i,j and i+1, and the U components for i,j and i,j+1.</p>
<p><strong>How can this be done when the vector field changes direction?</strong> In this case the opposite side of the control volume would then be the location of the incoming flux.</p>
<p>One could go grid-cell by grid cell and find the sign of the wind direction, and then sum the incoming flux from the upwind cell using an &quot;if&quot; to find the direction.</p>
<p>Is there another method? I wonder if there is a vector calc identity I am missing. This also seems like a much more general problem and I know it must be addressed in many other situations.</p>
<p>Thanks</p>
<p><a href="https://i.sstatic.net/DVSeP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DVSeP.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-05-26T21:21:40.787Z
I believe for each grid point you'd basically want to calculate the movement across each of the 4 (or 8) surrounding grid cells in a circle around it and sum them... because the flux isn't just what is coming in but what is going out.  And then the sign of u and v will automatically account for which directions are going in and which are coming out in aggregate.
JeopardyTempest
CC BY-SA 4.0
2022-05-26T21:24:54.380Z
Seems (unless I took too cursory a look) to be part of the much larger topic in general of advection across gridpoints, which you can probably find quite a bit about how to do.
JeopardyTempest
CC BY-SA 4.0
2022-05-26T21:37:34.093Z
So basically the four directly adjacent squares would be $q_{i-1, j}u_{i-1,j} - q_{i+1, j}u_{i-1,j} + q_{i, j-1}u_{i,j-1} + q_{i, j+1}u_{i,j+1}$
JeopardyTempest
CC BY-SA 4.0
2022-05-26T21:38:15.367Z
And if you went on to include the four kitty-corner squares it would be $q_{i-1,j-1}(u_{i-1,j-1}+v_{i-1,j-1})\frac{\sqrt{2}}{2} + q_{i-1,j+1}(u_{i-1,j+1}-v_{i-1,j+1})\frac{\sqrt{2}}{2} + q_{i+1,j+1}(-u_{i+1,j+1}-v_{i+1,j+1})\sqrt{2} + q_{i+1,j-1}(-u_{i+1,j-1}+v_{i+1,j-1})\frac{\sqrt{2}}{2}$
JeopardyTempest
CC BY-SA 4.0
2022-05-26T21:43:27.783Z
If I make no mistakes, as a rough idea!  Basically the sign before the u/v are opposite the sign of the grid cell offset in that direction (so for example you add the u term when doing i-1, and subtract it when doing i+1).  Of course in reality, things advect more than one grid point unless using a very small time step, so you need more complex calculations?  I would think there's packages for gradient/advection matrix calculations in most any programming languages?  But it's certainly not my expertise area!
JeopardyTempest
<meteorology><precipitation><fluid-dynamics><atmospheric-circulation>
Compute upwind flux for gridded data
William Rudisill
# Compute upwind flux for gridded data

(Asked by: username_0 on 2022-05-26)

I'm trying to compute something called the "Drying Ratio" following: [Eidhammer, 2018](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2017JD027995)

The drying ratio is the ratio of the precipitation to the incoming vapor flux. So,

$DR = \frac{F\_{in} - F\_{out}}{F\_{in}} = \frac{P}{F\_{in}}$

This makes some assumptions about sources/sinks (minimal evaporation for example). The vapor flux can be expressed as:

$\vec{F} = \frac{-1}{g} \int\_{P\_{sfc}}^{P\_{top}} q\vec{V}dp$

Integrating the vapor transport field along a particular control volume grid-box, and over time yields, length units (same as precipitation).

When the wind component U and V are always coming from the same direction (same sign), the incoming flux into a particular control volume is found by summing up the V components for i,j and i+1, and the U components for i,j and i,j+1.

**How can this be done when the vector field changes direction?** In this case the opposite side of the control volume would then be the location of the incoming flux.

One could go grid-cell by grid cell and find the sign of the wind direction, and then sum the incoming flux from the upwind cell using an "if" to find the direction.

Is there another method? I wonder if there is a vector calc identity I am missing. This also seems like a much more general problem and I know it must be addressed in many other situations.

Thanks

[![enter image description here](https://i.sstatic.net/DVSeP.png)](https://i.sstatic.net/DVSeP.png)

**Tags:** meteorology, precipitation, fluid-dynamics, atmospheric-circulation

> **Comments:**
> **username_1**: I believe for each grid point you'd basically want to calculate the movement across each of the 4 (or 8) surrounding grid cells in a circle around it and sum them... because the flux isn't just what is coming in but what is going out.  And then the sign of u and v will automatically account for which directions are going in and which are coming out in aggregate.  
> **username_1**: Seems (unless I took too cursory a look) to be part of the much larger topic in general of advection across gridpoints, which you can probably find quite a bit about how to do.  
> **username_1**: So basically the four directly adjacent squares would be $q_{i-1, j}u_{i-1,j} - q_{i+1, j}u_{i-1,j} + q_{i, j-1}u_{i,j-1} + q_{i, j+1}u_{i,j+1}$  
> **username_1**: And if you went on to include the four kitty-corner squares it would be $q_{i-1,j-1}(u_{i-1,j-1}+v_{i-1,j-1})\frac{\sqrt{2}}{2} + q_{i-1,j+1}(u_{i-1,j+1}-v_{i-1,j+1})\frac{\sqrt{2}}{2} + q_{i+1,j+1}(-u_{i+1,j+1}-v_{i+1,j+1})\sqrt{2} + q_{i+1,j-1}(-u_{i+1,j-1}+v_{i+1,j-1})\frac{\sqrt{2}}{2}$  
> **username_1**: If I make no mistakes, as a rough idea!  Basically the sign before the u/v are opposite the sign of the grid cell offset in that direction (so for example you add the u term when doing i-1, and subtract it when doing i+1).  Of course in reality, things advect more than one grid point unless using a very small time step, so you need more complex calculations?  I would think there's packages for gradient/advection matrix calculations in most any programming languages?  But it's certainly not my expertise area!  

---

## 0 answers

