I have this code to solve for the deflection, moments, and shear forces in a square plate with two edges (horizontal) simply-supported (soft) and two remaining (vertical) free.
from ngsolve import *
from ngsolve.webgui import Draw
mesh = Mesh (unit_square.GenerateMesh(maxh=0.05))
order = 2
Sigma = HDivDiv(mesh, order=order, dirichlet="left|right|bottom|top", plus=True)
W = H1(mesh, order=order+1, dirichlet="bottom|top")
V = HCurl(mesh, order=order)
X = Sigma * W * V
t = 1.0/50 # thickness
sigma, w, beta = X.TrialFunction()
tau, v, delta = X.TestFunction()
n = specialcf.normal(2)
def tang(u): return u-(u*n)*n
def DivDiv(sigma,delta):
return div(sigma)*delta*dx - (sigma*n)*tang(delta)*dx(element_boundary=True)
a = BilinearForm(InnerProduct(sigma,tau)*dx + DivDiv(sigma,delta) + DivDiv(tau,beta) \
- 1/t**2 * (grad(w)-beta)*(grad(v)-delta)*dx).Assemble()
f = LinearForm(200*v*dx).Assemble()
gfu = GridFunction(X)
gfu.vec.data = a.mat.Inverse(X.FreeDofs(), inverse="sparsecholesky") * f.vec
gfsigma, gfw, gfbeta = gfu.components
print ("vertical displacement")
Draw (gfw, deformation=True)
print ("rotation vector beta")
Draw (gfbeta, vectors= { "grid_size" : 40 } )
print ("bending moment_xx")
Draw (gfsigma[0,0], mesh);
print ("bending moment_yy")
Draw (gfsigma[1,1], mesh);
print ("twisting moment")
Draw (gfsigma[1,0], mesh);
The code is a tweak of one of the tutorials. The solution is a bit peculiar – I don’t trust it. The deflection should really look like this (on one quarter of the plate):
But what I totally don’t understand is how to plot the bending moment components: am I doing it right? What is the logic? m_yy looks reasonable (even if not correct), but I don’t get anything useful from the other components – they are all zero!? Or, perhaps it all goes with the solution not being quite right, and I did get the correct way of referring to the moment components?
Thanks ![]()


