CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

terms with the second derivative

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

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

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 ?


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


double gradient, nonlinear terms, second derivative

Thread Tools
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 On
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 06: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 04:22

All times are GMT -4. The time now is 09:57.