## We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

#### Notice

The forum is in read only mode.

3 years 11 months ago #1983
Hello,

I am chasing a bug for my Navier-Stokes solver using Hdiv-HDG for a more than a week, and finally found out that for Hdiv-space, the correct way to calculate the gradient is using
Code:
Code:
This is a bit odd, as I am always using the lower-case grad operator... lol

So what's the difference???
Is there any documentation I can found on the source code on the implementation of differential operators?
This kind of bugs are extremely hard find as the lower case grad operator is also stable, but produce inaccurate results...

Best,
Guosheng
3 years 11 months ago #1984
3 years 11 months ago #1985
Hi, there was an inconsistency in the grad, for example in the VectorH1 and H1(..., dim=3) once it is the jacobin and once the transpose.
To not break old code we introduced the Grad as a consistent version over all spaces.
Best
Christopher
3 years 11 months ago #1986
Thanks for the clarification!
5 months 2 days ago - 5 months 2 days ago #4780
Hi Christopher,

I cannot understand when you say grad is transpose? Do you mean that grad(u) is the row vector when u is a scalar field? Thank you.

Best,
Prasanna
Last edit: 5 months 2 days ago by psalasiya.
5 months 2 days ago #4781 by joachim
You can do

to get the vector/matrix/tensor shape of the expression.

grad(u) of a scalar is a vector (i.e. a first order tensor), and we do not distinguish between row or col vector.

A simple method to figure out the ordering of the matrix (tensor) is drawing:

u = GridFunction(VectorH1( ... ))
u.Set( (x+2*y, 0) )