Skip to content

Get quadrature points and weights #883

Discussion options

You must be logged in to vote

The command topo.integral('x_0^2 dV' @ ns, degree=2) is short for topo.sample('gauss', 2).integral('x_0^2 dV' @ ns); from there it's a small step to topo.sample('gauss', 2).eval('x_0' @ ns) to get a vector of point coordinates. The weights are a bit more involved because there is no ready made evaluable for it, so we will have to make one. I modified your MWE below to include such a construction.

from nutils import mesh, function
from nutils.expression_v2 import Namespace

nelems = 10
topo, x = mesh.unitsquare(nelems, etype='square')
ns = Namespace()
ns.x = x
ns.define_for('x', gradient='∇', normal='n', jacobians=('dV', 'dS'))

gauss = topo.sample('gauss', 2)
I = gauss.integral('x_0^2 dV' @ 

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@gertjanvanzwieten
Comment options

@MichaelLoibl
Comment options

@joostvanzwieten
Comment options

@gertjanvanzwieten
Comment options

@MichaelLoibl
Comment options

Answer selected by IvanBioli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants