CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

terms with the second derivative

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ziemowitzima

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2013, 12:26
Default terms with the second derivative
  #1
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Dear Foamers,
I need to discretize/calculate terms which contain second derivative (not Laplacian), as follows:
1.
\frac{\partial }{\partial y} \left( \frac{\partial f}{\partial x} \right)
2.
\frac{\partial }{\partial x} \left( \frac{\partial f}{\partial x} \right) - \frac{\partial }{\partial y} \left( \frac{\partial f}{\partial y} \right)

3.
and non-linear term with first derivative:
\left( \frac{\partial f}{\partial x}  \right)^2 - \left( \frac{\partial f}{\partial  y} \right)^2

For now the only way which works for me is to calculate twice the gradient of the function:
HTML Code:
gradf = fvc::grad(f); \\ it gives (f_x, f_y)
gradgradf0 = fvc::grad(gradf.component(0)); \\it gives (f_xx, f_yx)
gradgradf1 = fvc::grad(gradf.component(1)); \\it gives (f_xy, f_yy)
then term 1. is:
HTML Code:
gradgradf1.component(1); \\ f_xy
term 2. is:
HTML Code:
gradgradf0.component(0) - gradgradf1.component(1); \\ (f_xx - f_yy)
term 3. is:
HTML Code:
gradf.component(0)*gradf.component(0) - gradf.component(1)*gradf.component(1); \\ (f_x)^2- (f_y)^2
but unfortunately second derivative calculated as above gives me non-smooth results...

Is there any other/better way to compute terms like the one above ?

Thanks
ZZM
chitransh_atre likes this.

Last edited by ziemowitzima; February 14, 2013 at 12:46. Reason: post was not finished
ziemowitzima is offline   Reply With Quote

Reply

Tags
double gradient, nonlinear terms, second derivative


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
Derivative of a scalar or a variable through UDF fevi84 Fluent UDF and Scheme Programming 7 February 3, 2015 22:39
Implicit treatment of advection terms and pressure correction nikosb Main CFD Forum 0 January 17, 2010 17:07
Using source terms jsm Main CFD Forum 4 August 20, 2009 07:44
Question in definition of terms in solve titio OpenFOAM Running, Solving & CFD 0 March 19, 2009 17:02
K-Epsilon model? Brindaban Ghosh Main CFD Forum 2 June 24, 2000 05:22


All times are GMT -4. The time now is 12:32.