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

How to get the derivation over y in Openfoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2018, 03:54
Default How to get the derivation over y in Openfoam
  #1
Member
 
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12
marialhm is on a distinguished road
Dear all,

I need to do some programming in the Openfoam, but I'm not good at it. Now I need the equation shown in the attachment, but I don't know how to get the derivation over y. I think the command of fvc::grad() is to get the derivation over three directions, right?

Then how can I write the codes?

Many thanks.

Maria
Attached Images
File Type: jpg 1.jpg (9.6 KB, 45 views)
marialhm is offline   Reply With Quote

Old   August 9, 2018, 11:06
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
I think it will be :


Code:
 volScalarField u1u2 = u1*u2; //product of u1 and u2, assuming scalar fields
 volScalarField meanu1u2 = gSum(u1u2)/mesh.C().size(); // arithmetic mean of u1u2, assuming serial computation
 volScalarField Q = meanu1u2 /sigma // quantity, assuming all are scalars and you have defined volScalarFields for u1, u2, and sigma
 volVectorField gradQ = fvc::grad(Q); // gradient
 volScalarField gradQy = gradQ.component(1); // y component of gradQ
Caelan
clapointe is offline   Reply With Quote

Old   August 9, 2018, 22:08
Default
  #3
Member
 
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12
marialhm is on a distinguished road
Quote:
Originally Posted by clapointe View Post
I think it will be :


Code:
 volScalarField u1u2 = u1*u2; //product of u1 and u2, assuming scalar fields
 volScalarField meanu1u2 = gSum(u1u2)/mesh.C().size(); // arithmetic mean of u1u2, assuming serial computation
 volScalarField Q = meanu1u2 /sigma // quantity, assuming all are scalars and you have defined volScalarFields for u1, u2, and sigma
 volVectorField gradQ = fvc::grad(Q); // gradient
 volScalarField gradQy = gradQ.component(1); // y component of gradQ
Caelan
Dear Caelan,

Many thanks for your help. I will try this.

Maria
marialhm is offline   Reply With Quote

Old   August 9, 2018, 22:23
Default
  #4
Member
 
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12
marialhm is on a distinguished road
Quote:
Originally Posted by clapointe View Post
I think it will be :


Code:
 volScalarField u1u2 = u1*u2; //product of u1 and u2, assuming scalar fields
 volScalarField meanu1u2 = gSum(u1u2)/mesh.C().size(); // arithmetic mean of u1u2, assuming serial computation
 volScalarField Q = meanu1u2 /sigma // quantity, assuming all are scalars and you have defined volScalarFields for u1, u2, and sigma
 volVectorField gradQ = fvc::grad(Q); // gradient
 volScalarField gradQy = gradQ.component(1); // y component of gradQ
Caelan

Dear Caelan,

You mean that the type of u1, u2, and sigma must be volScalarField, right? What if they are scalars? Any possible way to do this?

Thanks.

Maria
marialhm is offline   Reply With Quote

Old   August 12, 2018, 22:58
Default
  #5
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
Yes, I meant volScalarField. I am not sure if it will work for a scalarField.

Caelan
clapointe is offline   Reply With Quote

Reply


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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
OpenFOAM 5.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 11 June 5, 2018 23:48
OpenFOAM Foundation Releases OpenFOAM v2.3.0 opencfd OpenFOAM Announcements from OpenFOAM Foundation 3 December 23, 2014 03:43
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52


All times are GMT -4. The time now is 18:55.