dragonfly_sim.core.postprocessor

Classes

DG_postprocessor

Forces, and moments about user-given points and directions, of the wall

MomentSpec

One moment of the wall force: about point, along unit direction

Module Contents

class dragonfly_sim.core.postprocessor.DG_postprocessor(Mesh_obj, sim_model, wall_meshtag_val, moments=None, ref_area_dim=None, ref_chord_dim=None, testing_mode=False, p_inf_dim=None, L_ref_dim=1.0)

Bases: csdl_alpha.CustomExplicitOperation

Forces, and moments about user-given points and directions, of the wall force (pressure, plus the viscous traction for a viscous model), with their derivatives for CSDL.

moments: sequence of (name, point, direction[, ref_length]) tuples, each giving the moment M = d . (r x F), r = X - point, of the wall force F along the direction d (right-hand rule); CSDL outputs M_<name> and c_m_<name>. point has one entry per dimension; direction is a nonzero vector, normalised to unit length, or the string “pitch”: the nose-up-positive pitching moment, (0, 1, 0) in 3D (y spanwise) and (0, 0, -1) in 2D. In 2D only the out-of-plane direction (0, 0, +-1) exists. c_m_<name> is M / (q S_ref ref_length), the reference chord by default. The directions are fixed in the geometry axes and the points fixed in space, also while a shape design variable moves the wall. Only M_<name> is differentiated: S_ref and the reference chord change with the 3D geometry, so constrain M_<name>, not c_m_<name>. For a half-wing on a symmetry plane y = 0, the root bending moment is (“root_bending”, (x0, 0, 0), (1, 0, 0)).

Each moment costs its own value, state-derivative and mesh-derivative assembly (a chain-rule evaluation per form for derived-field models). Since M_k = d_k . int(X x f) - (d_k x x0_k) . int(f), all moments are linear combinations of 6 base functionals (3 in 2D), so only 6 derivative evaluations would suffice regardless of the number of moments; this is not yet exploited.

_assemble_alpha_derivative(form)

d(form)/dalpha at fixed U through the derived fields, e.g. a reconstructed gradient whose boundary facets carry the alpha-dependent far-field state; zero without derived fields. The force directions are Constants (set_angle_of_attack), so their rotation is not part of it.

_assemble_mesh_derivative(form, label)
_assemble_state_derivative(form, label)
_assemble_value_and_coefficient(form, normalizer)
_compute_S_ref()
_compute_chord_ref(S_ref_value)
_moment_normalizer(spec)
_parse_moments(moments)
_pressure_force_vector(u_dof_vec)

The force density on the wall: pressure, plus the viscous traction for a viscous model (sim_model.wall_force_density).

compute(input_vals, output_vals)
compute_D_deriv(u_dof_vec)
compute_D_meshderiv(u_dof_vec)
compute_L_deriv(u_dof_vec)
compute_L_meshderiv(u_dof_vec)
compute_cd(u_dof_vec)
compute_cl(u_dof_vec)
compute_derivatives(input_vals, outputs_vals, derivatives)
compute_force_in_direction(u_dof_vec, direction_vec)
compute_initial_and_constant_quantities()
compute_moment(u_dof_vec, spec)

(M, c_m) of one moment.

compute_moment_alphaderiv(u_dof_vec, spec)
compute_moment_deriv(u_dof_vec, spec)
compute_moment_form(u_dof_vec, spec)

The moment M = d . (r x F) of the wall force about spec.point along spec.direction, as a scalar form.

compute_moment_meshderiv(u_dof_vec, spec)
evaluate(u_vec, mesh_deformation=None, alpha=None, shape_param_inputs=None)

Forces and coefficients of the state u_vec. mesh_deformation is the volume mesh motion of a shape optimization; leave it out (None) for a forward analysis on the fixed mesh. alpha is required.

forces_and_coefficients(u_dof_vec=None, alpha=None)

Lift and drag and their coefficients of a flow state, and the moments and their coefficients, outside any CSDL graph: no FFD block, mesh motion or recorder needed.

u_dof_vec: the owned state entries (default: the model’s current u_vec); alpha: angle of attack in radians (default: the model’s). For a viscous model, D_friction / c_d_friction is the part of the drag from the viscous wall traction. Collective. Returns a dict; “moments” maps each moment name to dict(M=…, c_m=…).

refresh_geometry_dependent_reference_quantities()
set_angle_of_attack(alpha)
L_ref_dim = 1.0
mesh_obj
moment_specs = []
ordered_callbacks = True
p_inf_dim = None
ref_area_dim = None
ref_chord_dim = None
sim_model
testing_mode = False
wall_meshtag_val
class dragonfly_sim.core.postprocessor.MomentSpec(mesh, name, point, direction, ref_length=None)

One moment of the wall force: about point, along unit direction (a 3-vector in 2D too, where only the z entry is read), normalised in the coefficient by q*S_ref*ref_length. The values are dolfinx Constants, so the forms built on them stay valid when they change.

direction
direction_array
name
point
point_array
ref_length = None