Contrib/swak4Foam/Example sectionalForces

From OpenFOAMWiki

To calculate the forces on selected parts of a patch, insert the following into the "functions" section in controlDict file,

	type patchExpression;
	outputControl timeStep;
	enabled true;
	outputInterval 10;
	patches (
		cylinder      // change to your name or names of patch
	variables (
	"pressure_force= p*rho*normal()*area();"
	"viscous_force= -rho*nu*snGrad(U)*area();"
	"forces= pressure_force+viscous_force;"
  expression "( pos().z > position-3 && pos().z < position+3) ? forces : vector(0,0,0)";
  accumulations ( sum );

That would sum up the force for all faces which are within the range of -3<z<3 on patch "cylinder".