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

Regarding code

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Antimony
  • 2 Post By Zhiheng Wang

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2016, 20:27
Default Regarding code
  #1
Member
 
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10
Zhiheng Wang is on a distinguished road
Hi, I have stuck in code where I am preprocesing Temperature values.

label patchID = mesh.boundaryMesh().findPatchID("inlet");
scalarField InletTGrad=T.boundaryField()[patchID].snGrad();
const scalarField HEIGHT = 1.0/mesh.deltaCoeffs().boundaryField()[patchID];
const fvBoundaryMesh& myBoundary = mesh.boundary();
forAll( myBoundary, fvPatchID ) /
{
const fvPatch& myPatch = myBoundary[patchID];
const vectorField& position = myPatch.Cf();
forAll( myPatch, i)
{
Ts.boundaryField()[fvPatchID][i] = Ts.boundaryField()[patchID][i]+HEIGHT*InletTGrad;
}
Problem is Ts is volScalarField and Height*InleGrad is scalarField
How can I update my boundary values using this code
plese Send your valuable suggetions.


Can we convert scalarField to volScalarField ?? or Can access scalarField element one by one
Zhiheng Wang is offline   Reply With Quote

Old   May 26, 2016, 03:35
Default
  #2
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

I am not sure how helpful this will be, but you could probably take a look at how OF defines "gh" term in order to compute p_rgh. If I remember correct, it ends up creating a volScalarField in order to do any computations with the 'p' field.

Cheers,
Antimony
Zhiheng Wang likes this.
Antimony is offline   Reply With Quote

Old   May 26, 2016, 17:48
Default
  #3
Member
 
Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10
Zhiheng Wang is on a distinguished road
Hi First I am grateful and Thankful for your quick reply
I have resolved the issue by
T.boundaryField()[patchID][i]=Height[i]*InletGradT[i] gives DT[i] (for ith face-center [facei])
Antimony and Kummi like this.
Zhiheng Wang 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
The FOAM Documentation Project - SHUT-DOWN holger_marschall OpenFOAM 242 March 7, 2013 13:30
How to make code run in parallel? cwang5 OpenFOAM Programming & Development 1 May 30, 2011 05:47
Open Source Vs Commercial Software MechE OpenFOAM 28 May 16, 2011 12:02
Small 3-D code Zdravko Stojanovic Main CFD Forum 2 July 19, 2010 11:11
public CFD Code development Heinz Wilkening Main CFD Forum 38 March 5, 1999 12:44


All times are GMT -4. The time now is 01:39.