CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

from a vecor field to get a gradient of scalar

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2007, 03:37
Default from a vecor field to get a gradient of scalar
  #1
dusky.he
Guest
 
Posts: n/a
I got a problem. How can I get a scalar field so that the gradient of scalar equals a vector field, locally.

thanks
  Reply With Quote

Old   March 30, 2007, 04:26
Default Re: from a vecor field to get a gradient of scalar
  #2
Praveen. C
Guest
 
Posts: n/a
First of all, this is possible if and only if the vector field is irrotational. Assuming this is so in your case, I can suggest two ways, but there may be many details you will have to work out.

If

v = grad(s)

then
  1. Use a line integral of the vector field.

    s<sub>2</sub> - s<sub>1</sub> = line integral of v from 1 to 2
  2. Solve a Poisson equation for s with appropriate boundary conditions

    laplace(s) = div(v)
  Reply With Quote

Old   March 30, 2007, 04:42
Default Re: from a vecor field to get a gradient of scalar
  #3
dusky.he
Guest
 
Posts: n/a
Thank you for your prompt reply. Actually, I used the second method say solving Poissonn equation. However, althogh Laplace(s)= div(v). locally, gradient(s) not equal V in some region. so they are not balanced

I do not know whether it is because of the order of scheme I used to discretize.

  Reply With Quote

Old   March 30, 2007, 10:06
Default Re: from a vecor field to get a gradient of scalar
  #4
rt
Guest
 
Posts: n/a
Hi dusky.he,

>>this is possible if and only if the vector field is irrotational

i am not agree

the second approach proposed by Praveen is good idea but is incomplete.

Based on Hodge decomposition theory any vector field, V, can be decomposed into a divergence-free component, Vd, and a curl-free component, Vc,so Vc is equal to gradient of some scalar, S.

V = Vd + Vc and Vc = grad(S), div(Vd)=0, Curl(Vc)=0.

so the proposed solution is work only if your vector field is divergence free. BC consistency is also essential.

If your vector field is not divergence-free, i don't think that your problem has any solution or unique solution. But in certain condition you can find the best solution by solving the following least square problem:

find S so, minimize 1/2 || grad(S) - V ||

with the aid of suitable regularization you can get sequence of minimizing solution.
  Reply With Quote

Old   March 30, 2007, 10:08
Default Re: from a vecor field to get a gradient of scalar
  #5
Jonas Holdeman
Guest
 
Posts: n/a
Actually, there are more ways. The first might be to project out the rotational part. This is the analog of projecting out the irrotational part to get a (weakly) divergence-free field.

Another way is to do a least-squares fit of a field that is really the gradient of a scalar to your given field. This is a finite element approach.

Set up a rectangular grid over your problem domain. The we use Hermite scalar functions in which the gradient components are actual degrees of freedom. For example, you might use the Melosh element (see O. C. Zienkiewicz, "The Finite Element Method in Engineering Science," (1971), p179 - also in later editions but I only have the old one). This element has the scalar potential and components of the gradient as degrees-of-freedom. Or, you can use the classical bicubic element, which has an additional second cross-derivative DOF. You then construct a vector element by taking the gradient of the scalar functions/elements. Now do a least-squares fit to get the components/DOFs at the mesh points. Then use your irrotational vector elements to interpolate these. This will be pointwise irrotational.

If you have data on a rectangular grid that must be fit exactly, you could fix the gradient components and do least-squares with the potential component only. However, if you force a fit this way, the resulting field may not be as smooth as you would like or expect.

In three dimensions, there is a 3D analog of the Melosh element and, of course, the tri-cubic element/function.

  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compute the gradient of a scalar as a post-processing ayoros OpenFOAM Post-Processing 16 March 21, 2018 07:02
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
Calculated gradient boundary condition similar to gammaContactAngle adona058 OpenFOAM Running, Solving & CFD 0 September 26, 2007 16:23
Gradient of Scalar calculation in 3D BFCskew grids james T Phoenics 0 March 28, 2007 08:12
gradient for scalar quantity tseo FLUENT 6 August 6, 2005 00:15


All times are GMT -4. The time now is 20:08.