I have set up a mock-up for the uniformly distributed load:

```
from dolfinx import mesh, fem, plot, io, default_scalar_type
from dolfinx.fem.petsc import LinearProblem
from mpi4py import MPI
import ufl
import numpy as np
# Define domain dimensions and material properties
L = 120 #inches
W = 4 #inches
H = 8 # iches
rho = 0.0624 #lb per ft ^3
delta = W / L
gamma = 0.4 * delta**2
# Young's modulus and Poisson's ratio
# Lames parameters
E = 2000000 # PSI
nu = 0.0
mu = E / (2 * (1 + nu))
lambda_ = E * nu / ((1 + nu) * (1 - 2 * nu))
# Gravity
g = gamma
w = 6.66 # lbs per foot
I = (W * H**3) / 12
# Create a denser mesh and define function space
domain = mesh.create_box(MPI.COMM_WORLD, [np.array([0, 0, 0]), np.array([L, W, H])],
[40, 12, 12], cell_type=mesh.CellType.hexahedron)
V = fem.functionspace(domain, ("Lagrange", 1, (domain.geometry.dim, )))
# Define boundary conditions
def clamped_boundary_left(x):
return np.isclose(x[0], 0)
def clamped_boundary_right(x):
return np.isclose(x[0], L)
fdim = domain.topology.dim - 1
boundary_facets_left = mesh.locate_entities_boundary(domain, fdim, clamped_boundary_left)
boundary_facets_right = mesh.locate_entities_boundary(domain, fdim, clamped_boundary_right)
u_D = np.array([0, 0, 0], dtype=default_scalar_type)
bc_left = fem.dirichletbc(u_D, fem.locate_dofs_topological(V, fdim, boundary_facets_left), V)
bc_right = fem.dirichletbc(u_D, fem.locate_dofs_topological(V, fdim, boundary_facets_right), V)
# Define the load and weak form
T = fem.Constant(domain, default_scalar_type((0, 0, 0)))
ds = ufl.Measure("ds", domain=domain)
def epsilon(u):
return ufl.sym(ufl.grad(u))
def sigma(u):
return lambda_ * ufl.nabla_div(u) * ufl.Identity(len(u)) + 2 * mu * epsilon(u)
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
f = fem.Constant(domain, default_scalar_type((0, 0, -w / (W * H)))) # Distributed load in the z-direction
a = ufl.inner(sigma(u), epsilon(v)) * ufl.dx
L = ufl.dot(f, v) * ufl.dx + ufl.dot(T, v) * ds
# Solve the linear problem
problem = LinearProblem(a, L, bcs=[bc_left, bc_right], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()
# Calculate the moment as the curl of the displacement field
#V_curl = fem.FunctionSpace(domain, ("Lagrange", 1))
V_curl = fem.functionspace(domain, ("Lagrange", 1, (3,))) # Vector function space for 3D vectors
# Define a function to store the curl
curl_uh = fem.Function(V_curl)
# Project the curl onto the function space
w = ufl.TestFunction(V_curl)
v_curl = ufl.TrialFunction(V_curl)
a_curl = ufl.inner(v_curl, w) * ufl.dx
L_curl = ufl.inner(ufl.curl(uh), w) * ufl.dx
# Solve the projection problem
curl_problem = LinearProblem(a_curl, L_curl)
curl_uh = curl_problem.solve()
# Compute the moment
moment = curl_uh
# Extract the moment values, I guess they should be in lbs per inch...
moment_values = moment.x.array.reshape((-1, 3))
max_moment = np.max(moment_values[:, 2]) # Assuming we are interested in the z-component of the moment
# Extract the displacement values
displacement_values = uh.x.array.reshape((-1, 3))
max_displacement = np.max(np.linalg.norm(displacement_values, axis=1))
# Print the results
print(f'Maximum moment (z-component): {max_moment}')
print(f'Maximum displacement: {max_displacement}')
print('Solution and moment distribution were obtained.')
# Analytical results for comparison
awc_max_displacement = (5 * 6.66 * 120.0**4) / (384 * 2000000 * I)
awc_max_moment = (6.66 * 120.0**2) / 8
# Check against the American Wood Council formula worksheet for a
# uniformly distributed load...
print(f'AWC max displacement: {awc_max_displacement}')
print(f'AWC max moment: {awc_max_moment}')
```

The moment values coming out of dolfinx are not the same as what the AWC formulas say. The displacement value is closer however it is still far enough away that I would have to say some adjustment is needed. Ideally I would like to have the values coming out of dolfinx to be as precisely close to what the AWC says as possible. I understand that might mean adjusting some parameters. So far I must have some type of incorrect setup for obtaining moment I would guess.

‘’’

Maximum moment (z-component): 6.547203128877776e-15

Maximum displacement: 0.010254790287438496

Solution and moment distribution were obtained.

AWC max displacement: 0.05268164062499999

AWC max moment: 11988.0

‘’’

*Can I get some assistence to get these output values to line up?*

((w*x)/2)*(l-x) is the induced moment I thin, in inch lbs, where x is a distance along the length from 0. If it is not possible to get the moment out can you show me how to induce it in addition to w? Does moment have to be set or can it just be gotten somehow by the curl method?