dragonfly_sim.utils.postprocessor_utils

Functions

cross_2D(x, y)

moment_about(force_vec, lever_vec, direction, dimensions)

The component along direction of the moment (lever x force), the

moment_integrand(force_vec, lever_vec, dimensions)

The pitching-moment integrand: the component of (lever x force) about the

Module Contents

dragonfly_sim.utils.postprocessor_utils.cross_2D(x, y)
dragonfly_sim.utils.postprocessor_utils.moment_about(force_vec, lever_vec, direction, dimensions)

The component along direction of the moment (lever x force), the integrand of the moment of a wall force density about a point: M = d . (r x F), right-hand rule.

3D: the full cross product, projected on the (unit) direction vector. 2D: the only nonzero component of r x F is the out-of-plane one,

r_x F_y - r_y F_x, times the z entry of direction.

direction is a UFL-compatible vector of 3 entries in both cases (a dolfinx Constant, say); in 2D only its z entry is read. The nose-up-positive pitching moment of moment_integrand is direction (0, 1, 0) in 3D and (0, 0, -1) in 2D.

dragonfly_sim.utils.postprocessor_utils.moment_integrand(force_vec, lever_vec, dimensions)

The pitching-moment integrand: the component of (lever x force) about the axis the aerofoil/wing pitches around.

This exists because cross_2D above is a genuinely 2D expression – x[0]*y[1] - x[1]*y[0] reads only components 0 and 1 – so applying it unchanged to 3D vectors silently returns the moment about the VERTICAL axis (a yawing moment) rather than the pitching moment. The two coordinate conventions in use here disagree about which index is “vertical”:

2D: x = chordwise, y = vertical
-> the pitch axis is z, and cross_2D(force, lever) is that

component (up to the sign convention baked into compute_cm).

3D: x = chordwise, y = spanwise, z = vertical

(see the mesh note at the top of wing_opt.py) -> the pitch axis is y, i.e. (lever x force)_y = r_z*F_x - r_x*F_z.

The 2D branch returns exactly the previous expression, so 2D results are unchanged bit-for-bit.