|
[Sponsors] |
August 9, 2018, 03:54 |
How to get the derivation over y in Openfoam
|
#1 |
Member
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12 |
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 |
|
August 9, 2018, 11:06 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 14 |
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 |
|
August 9, 2018, 22:08 |
|
#3 | |
Member
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12 |
Quote:
Many thanks for your help. I will try this. Maria |
||
August 9, 2018, 22:23 |
|
#4 | |
Member
Maria
Join Date: Jul 2013
Posts: 84
Rep Power: 12 |
Quote:
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 |
||
August 12, 2018, 22:58 |
|
#5 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 14 |
Yes, I meant volScalarField. I am not sure if it will work for a scalarField.
Caelan |
|
|
|
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 |