CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

macro expansion within codeStream for boundary.findPatchID()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2018, 04:33
Default macro expansion within codeStream for boundary.findPatchID()
  #1
Member
 
Fynn
Join Date: Feb 2016
Posts: 48
Rep Power: 10
PanPeter is on a distinguished road
Hello together,

I am using the macro expansion functionality to dynamically set the names for my boundary patches. Now I implement a code stream on a boundary patch. To access the mesh data on the respective patch I use mesh.boundary.findPatchID("patchName"). And here I don't find a way to replace patchName with my marco expansion. It seems the parentheses are not compatible with the macro expansion.

Does anybody have an idea as how to solve this or could suggest a work-around?

patchNames.h
Code:
boundary_names
{
    OUTLET_NAME		outlet;
}
0/p
Code:
#inlcude "../patchNames.h"
$boundary_names.OUTLET_NAME
{
type fixedValue; value #codeStream {
... ... code #{
... ... ... // this is where I want to use my macro expansion instead of writing "outlet" out: const label id = mesh.boundary().findPatchID("outlet"); ...
}#
}
}
PanPeter is offline   Reply With Quote

Old   December 15, 2022, 22:17
Default
  #2
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
It is probably late...

You can access a dictionary name by simply using the dictName member function

Code:
const word patchName = dict.dictName();
...
const label id = mesh.boundary().findPatchID(patchName);
If you take a look at the dictionary class, there are two member functions, name() and dictName()

Code:
...
        //- The dictionary name
        inline const fileName& name() const noexcept;

        //- The dictionary name for modification (use with caution).
        inline fileName& name() noexcept;

        //- The local dictionary name (final part of scoped name)
        inline word dictName() const;
...
The name() member function returns a so called "scoped name"

Code:
"/Volumes/SourceCode/projects/foam/3-weeks-training/week_3/day_11/1_bc_with_codeStream/codeStream_BC/2Delbow_UparabolicInlet/0/U.boundaryField.velocity-inlet-5"
But the dictName() returns the (sub)dictionary name...

Code:
"velocity-inlet-5"
reverseila is offline   Reply With Quote

Reply

Tags
code stream, macro expansion


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
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 15:43
timestep extraction for macro manuc Tecplot 0 August 10, 2016 13:20
Error in compiling new drag model k.farnagh OpenFOAM Programming & Development 13 May 21, 2016 04:08
Add New Pyrolysis Chemistry Type LWhitson2 OpenFOAM Programming & Development 0 April 30, 2015 19:54
Macro problem cfddummy Siemens 1 April 9, 2007 13:37


All times are GMT -4. The time now is 19:40.