CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

How to calculate laplacian of a scalar in cfx?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2010, 13:55
Question How to calculate laplacian of a scalar in cfx?
  #1
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Hi all:

I am trying to calculate a laplacian of a scalar (for example, temperature) to be used in a source term. The CFX manual shows how to get value of gradient through user fortran, but not laplacian.

Has anyone done this calculation before?

Thanks.

Jun

Last edited by Jun; October 3, 2010 at 22:44.
Jun is offline   Reply With Quote

Old   October 3, 2010, 15:28
Default
  #2
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Quote:
Originally Posted by Jun View Post
Hi all:

I am trying to calculate a laplacian of a scalar (for example, temperature) to be used in a source term. The CFX manual shows how to get value of gradient through user fortran, but not laplacian.

Has anyone done this calculation before?

Thanks.

Jun
Anybody? Please help with an answer or a potential place to get an answer. Any information?

Thanks.

Last edited by Jun; October 3, 2010 at 22:54. Reason: delete
Jun is offline   Reply With Quote

Old   October 3, 2010, 22:45
Default
  #3
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Quote:
Originally Posted by Jun View Post
Hi all:

I am trying to calculate a laplacian of a scalar (for example, temperature) to be used in a source term. The CFX manual shows how to get value of gradient through user fortran, but not laplacian.

Has anyone done this calculation before?

Thanks.

Jun
Anybody? Please help with an answer or a potential place to get an answer. Any information?

Thanks.
Jun is offline   Reply With Quote

Old   October 4, 2010, 19:10
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
In CFX V12 you should be able to get the gradients in CEL rather than fortran. Not sure if you are going to be able to get the Laplacian from that, I have never tried. Give it a go and see if it works. Otherwise I would discuss with CFX support, there probably is a way and it might not be documented.
ghorrocks is offline   Reply With Quote

Old   October 5, 2010, 11:07
Default
  #5
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
USER_GETVAR is the function can be used to get the gradient of a variable. But I can not find the explanation of the meaning of "gradient" of a vector variable.
I tried to use USER_GETVAR with option "gradient" on a vector variable, say "phase.velocity.gradient", USER_GETVAR did not give error message and there were outputs. But I dont know the meaning of the outputs and dont know how to use them.

I am waiting the response from ANSYS support team, but hope somebody here can help.

One other option of the USER_GETVAR function is "curl", which is easy to understand for a vector variable.
Jun is offline   Reply With Quote

Old   October 5, 2010, 14:50
Default
  #6
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Finally, I have figured out one way.

First, three scalar additional variables are defined to represent x, y, z gradient of Temprerature.

Then, selected components from the gradients of those three additional varialbes are combined to get the laplacian of the temperature.

Hope it will be helpful for others. Or please let me know there is any problem.

Jun

Last edited by Jun; October 5, 2010 at 16:42.
Jun is offline   Reply With Quote

Old   October 5, 2010, 21:14
Default
  #7
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
As I said, you don't need fortran to do this. In V12 you can get gradients from CEL.

It sounds like you have no idea about gradients of vector fields - I recommend you do some reading into gradients of vector fields before proceeding or you will be wasting your time.
ghorrocks is offline   Reply With Quote

Old   October 5, 2010, 21:32
Default
  #8
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
As I said, you don't need fortran to do this. In V12 you can get gradients from CEL.

It sounds like you have no idea about gradients of vector fields - I recommend you do some reading into gradients of vector fields before proceeding or you will be wasting your time.
Hi Glenn:

Thank you for your input.

Could you explain more how to use cel to get the gradient?

I am using v12 and the CEL #2 example in the HELP shows how to define a cel function to call a UDF, in which USER_GETVAR is called to get the gradient of a variable.

Can you do it in a simpler way?

About gradient, I have done enough reading I think. My understanding is that gradient operator is a vector. So when the gradient of a vector variable is called, there are only two possible ways: one is divergence of the vector variable, the other one is curl of the vector variable.

Laplacian of a scalar variable, is the divergence of the gradient of that scalar variable and the laplacian is a scalar.

Is there any thing wrong?
Jun is offline   Reply With Quote

Old   October 5, 2010, 21:39
Default
  #9
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Try Temperature.Gradient_x. I think that should do it - all discussed in the CFX documentation.
ghorrocks is offline   Reply With Quote

Old   October 5, 2010, 21:51
Default
  #10
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
Try Temperature.Gradient_x. I think that should do it - all discussed in the CFX documentation.
But laplacian is needed, which is some kind of second gradient of the gradient of a scalar variable.

Temperature.Gradient_x.Gradient_x is unrecognised name.

You know what, I tried Temperature.Laplacian, and there is no error message, so maybe it is defined already in the system. But it is not very comfortable, just to assume Laplacian is indeed calculated. I think it can be tested.

Thank you, Glenn, for all these discussion.

Last edited by Jun; October 5, 2010 at 22:13.
Jun is offline   Reply With Quote

Old   October 5, 2010, 22:17
Default
  #11
Jun
New Member
 
Jun
Join Date: Aug 2010
Posts: 12
Rep Power: 16
Jun is on a distinguished road
Quote:
Originally Posted by Jun View Post
But laplacian is needed, which is some kind of second gradient of the gradient of a scalar variable.

Temperature.Gradient_x.Gradient_x is unrecognised name.

You know what, I tried Temperature.Laplacian, and there is no error message, so maybe it is defined already in the system. But it is not very comfortable, just to assume Laplacian is indeed calculated. I think it can be tested.

Thank you, Glenn, for all these discussion.
Update.

Temperature.Laplacian does not work. Solver quits after a bunch of message: ##,MASSOU_CALVAR,VEL

## is number from 1 to several hundreds.
Jun is offline   Reply With Quote

Old   October 6, 2010, 07:13
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Sorry, yes, you are right - the built in functions will not do second order derivatives like this. Maybe you will need fortran after all.
ghorrocks is offline   Reply With Quote

Old   June 20, 2013, 23:21
Default
  #13
New Member
 
Join Date: Mar 2012
Posts: 18
Rep Power: 14
hustxinxin is on a distinguished road
You can use “USER_GETVAR” to get the Laplacian by User Fortran in CFX14.0. But laplacian is not available in CFX of lower edition

Last edited by hustxinxin; June 23, 2013 at 23:23.
hustxinxin is offline   Reply With Quote

Old   October 17, 2013, 08:54
Default
  #14
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by hustxinxin View Post
You can use “USER_GETVAR” to get the Laplacian by User Fortran in CFX14.0. But laplacian is not available in CFX of lower edition
But how? I tried to get it in fortran subroutine but solver raise error "Segmentation violation" when USER_GETVAR is called. Name of the variable for which I call USER_GETVAR is "Fluid 1.Electric Potential.Laplacian".

UPDATE: Segmentation violation error was due to some other reason. Actually when I try to get variable laplacian USER_GETVAR sets CRESLT = OPER. Anyone knows what does OPER mean?

Last edited by Antanas; October 21, 2013 at 04:57.
Antanas is offline   Reply With Quote

Old   October 24, 2013, 18:16
Default
  #15
New Member
 
Join Date: Mar 2012
Posts: 18
Rep Power: 14
hustxinxin is on a distinguished road
Unfortunately, I came across the same problem with you, so I gave up. I think it's a terrible bug in CFX.

Quote:
Originally Posted by Antanas View Post
But how? I tried to get it in fortran subroutine but solver raise error "Segmentation violation" when USER_GETVAR is called. Name of the variable for which I call USER_GETVAR is "Fluid 1.Electric Potential.Laplacian".

UPDATE: Segmentation violation error was due to some other reason. Actually when I try to get variable laplacian USER_GETVAR sets CRESLT = OPER. Anyone knows what does OPER mean?
hustxinxin is offline   Reply With Quote

Old   October 24, 2013, 18:18
Default
  #16
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You will probably have to talk to ANSYS support to get this working. And if it is a bug you definitely should report it so it can be fixed for the next version.
ghorrocks is offline   Reply With Quote

Old   October 24, 2013, 18:21
Default
  #17
New Member
 
Join Date: Mar 2012
Posts: 18
Rep Power: 14
hustxinxin is on a distinguished road
By the way, CRESLT = OPER means that there is some wrong with your operater. I think that there is no other possibility for this error except the inner bug!

Quote:
Originally Posted by Antanas View Post
But how? I tried to get it in fortran subroutine but solver raise error "Segmentation violation" when USER_GETVAR is called. Name of the variable for which I call USER_GETVAR is "Fluid 1.Electric Potential.Laplacian".

UPDATE: Segmentation violation error was due to some other reason. Actually when I try to get variable laplacian USER_GETVAR sets CRESLT = OPER. Anyone knows what does OPER mean?
hustxinxin is offline   Reply With Quote

Old   March 2, 2018, 05:30
Default
  #18
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
I know this's old post, but I have some obvious idea. Let Phi be our scalar field. To calculate laplacian we create two additional variables gradPhi (vector) and laplPhi (scalar). Then we set components of gradPhi to be Phi.Gradient X, Phi.Gradient Y, Phi.Gradient Z and laplPhi = gradPhi_x.Gradient X + gradPhi_y.Gradient Y + gradPhi_z.Gradient Z.
Antanas is offline   Reply With Quote

Old   March 2, 2018, 08:30
Default
  #19
Senior Member
 
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33
Opaque will become famous soon enough
You can also try the Laplacian operation, ie.

Temperature.Laplacian

or

Velocity u.Laplacian
Opaque is offline   Reply With Quote

Old   March 2, 2018, 09:07
Default
  #20
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by Opaque View Post
You can also try the Laplacian operation, ie.

Temperature.Laplacian

or

Velocity u.Laplacian
Is it already working?
Antanas is offline   Reply With Quote

Reply

Tags
laplacian, user fortran


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
using CFX to calculate NPSHR for pump sandy CFX 0 March 19, 2008 13:52
How CFX calculate TKE and Epsilon from intensity? David CFX 0 November 24, 2005 05:53
Laplacian of a scalar value J. Park FLUENT 0 September 17, 2003 13:39
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07
UDFs for Scalar Eqn - Fluid/Solid HT Greg Perkins FLUENT 0 October 14, 2000 00:03


All times are GMT -4. The time now is 16:34.