Is thermodynamic work always defined, even for irreversible processes? Suppose we have a thermodynamic system, and we are capable of doing pressure-volume $(PV)$ work on the system. For a infinitesimal reversible process (where the only type of work done is pressure-volume work), the incremental amount of work done on the system is $\delta W = -P dV$. For an irreversible process of the same type, done slowly enough so that variables like pressure and volume are still easily measurable, the work is now $\delta W = -P_{ext} dV \leq -P dV$, where $P_{ext}$ is the external pressure exerted by the system's environment. Let me know if I'm mistaken about any of this.
In cases like these, and in many other situations, the amount of work done can be easily calculated, as long as pressure and volume measurements have been made on the system during each process. However, I can imagine much more complicated scenarios where it's less obvious how work would be calculated. For example, suppose we have a violent expansion of a gas and a corresponding shrinking of the gas's environment, which is so rapid that the external pressure is no longer uniform across the gas-environment boundary, and where the densities of gas and environment vary so much that volume is hard to measure or even define. (Ok, in this process, maybe we could argue that it occurs so rapidly that no heat exchange occurs, and so the work is just $W= \Delta E$, the change in energy of the system. But suppose I could come up with a better example, where heat flow is possible but quantities like $P$ and $V$ are still ill-defined in this way.)
In such a situation, is thermodynamic work still defined? Even if we can't calculate it directly with a formula like $\delta W = -P_{ext} dV$, I'm wondering if there's a way to get at it indirectly. Or are there certain processes which just don't have a definite value of work, from an operational point of view?
 A: The amount of work done on the system is always the integral of $-P_{ext} dV$ (where $P_{ext}$ represents the force per unit area applied to the gas at the piston face), irrespective of whether the process is reversible or irreversible.  But, if the process is reversible, then the gas pressure and temperature are uniform spatially within the cylinder, and thus $P_{ext}=P$. Under these circumstances, one can use the ideal gas law (or other equation of state) to calculate the work. 
If the process is irreversible (involving, say, a very rapid deformation), the pressure and temperature within the cylinder are not typically uniform spatially, so the equation of state can not be applied globally.  In addition, there are viscous stresses present within the gas that contribute to the force per unit area at the piston face.  This too prevents using an equation of state to determine $P_{ext}$ and the work.  So, using only thermodynamics, unless you can manually control $P_{ext}$ from the outside, you cannot determine the work.  
However, it is still possible to get the work if you are able to apply the laws of fluid mechanics and a differential version of the first law locally within the cylinder.  This involves solving a complicated set of partial differential equations to determine the temperature, pressure, stresses, and deformations as functions of time and position.  Usually, such calculations would be accomplished using Computational Fluid Dynamics (CFD).  The deformations inside the cylinder could be turbulent, and this would require CFD capabilities to approximate turbulent flow and heat transfer.  So, for irreversible processes, predicting the behavior in advance can be much more complicated (but possible).
