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

How to access an another patch from fvPatchFields?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By eduardopaiva

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2020, 05:58
Exclamation How to access an another patch from fvPatchFields?
  #1
New Member
 
Eduardo Paiva
Join Date: Jul 2020
Posts: 4
Rep Power: 5
eduardopaiva is on a distinguished road
Hey guys, this is my first post here and I'm beginner on OpenFOAM and undergraduating.

I'm using of1812 and I need to develop a new boundary condition. Basiclly, I have a duct and that boundary condition is for p_rgh of outlet face. So, I need access the wall patch to apply a correlation that outlet face. What can I do for that?

I'm found in this forum something like this:

// Get the mesh
const fvMesh& mesh(patch().boundaryMesh().mesh());

label patchID = mesh.boundaryMesh().findPatchID(wallName_);
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];

const surfaceScalarField& magSf = mesh.magSf();

scalar patchArea = 0.0;
forAll(cPatch, facei)
{
patchArea += magSf.boundaryField()[patchID][facei];
}

I want to do something similar, but I cannot do mesh.p_rgh(), for exampĺe. Someone knows how can I code this?

Thanks for helping
eduardopaiva is offline   Reply With Quote

Old   October 24, 2020, 10:41
Lightbulb The solution
  #2
New Member
 
Eduardo Paiva
Join Date: Jul 2020
Posts: 4
Rep Power: 5
eduardopaiva is on a distinguished road
A colleague helped me, here's the answer:

// Get the mesh
const fvMesh& mesh(patch().boundaryMesh().mesh());

label patchID = mesh.boundaryMesh().findPatchID(wallName_);

const volScalarField& p_rgh_ = this->db().lookupObject<volScalarField>("p_rgh");

const scalarField& pp_rgh_ = p_rgh_.boundaryField()[patchID];

const scalar pWall = gAverage(pp_rgh_);
jherb, dlahaye and RGS like this.
eduardopaiva is offline   Reply With Quote

Old   October 25, 2020, 04:47
Default
  #3
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 730
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Wonderful of you to share!

Question: in which file do you place these statements to make it work? Alternatively, what does "this" refer to here?

Thank you so much! Domenico.
dlahaye is offline   Reply With Quote

Reply

Tags
access, boundary condition., fvpatchfield, patches


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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 15:33
[snappyHexMesh] SHM Layer Addition Phase dickcruz OpenFOAM Meshing & Mesh Conversion 4 November 1, 2018 07:05
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 07:30
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 12:23
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 08:19


All times are GMT -4. The time now is 23:24.