- Thank you received: 6
grad vs Grad
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
5 years 2 months ago #1983
by Guosheng Fu
grad vs Grad was created by Guosheng Fu
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
instead of
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
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:
Grad
Code:
grad
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
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
- Thank you received: 6
5 years 2 months ago #1984
by Guosheng Fu
Replied by Guosheng Fu on topic grad vs Grad
Alright, it looks like that Grad is simply grad.trans....
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 2 months ago #1985
by christopher
Replied by christopher on topic grad vs Grad
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
To not break old code we introduced the Grad as a consistent version over all spaces.
Best
Christopher
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
- Thank you received: 6
5 years 2 months ago #1986
by Guosheng Fu
Replied by Guosheng Fu on topic grad vs Grad
Thanks for the clarification!
1 year 7 months ago - 1 year 7 months ago #4780
by psalasiya
Replied by psalasiya on topic grad vs Grad
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
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: 1 year 7 months ago by psalasiya.
1 year 7 months ago #4781
by joachim
Replied by joachim on topic grad vs Grad
You can do
print (Grad(u).dims)
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) )
Draw (Grad(u)[0,1], mesh)
Recommendation: use grad(u) for scalar, and Grad(u) for vectorial functions.
Joachim
print (Grad(u).dims)
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) )
Draw (Grad(u)[0,1], mesh)
Recommendation: use grad(u) for scalar, and Grad(u) for vectorial functions.
Joachim
The following user(s) said Thank You: psalasiya
Time to create page: 0.125 seconds