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

String or Identifier Replacement with Macro Expansion

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 3, 2022, 19:53
Default String or Identifier Replacement with Macro Expansion
  #1
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 138
Rep Power: 5
Ship Designer is on a distinguished road
Macro expansion is very useful but I see it mostly in use for replacing numbers. I'm wondering it there's a way to use it also for other types of text replacement in dictionaries, such as:
Code:
// setFieldsDict identifier
         PhaseName  Foo;

defaultFieldValues  (volScalarFieldValue  alpha.$PhaseName 0);



// transportProperties dictionary
phases  ($PhaseName1 $PhaseName2);



// fvSolution regular expression
solvers  {
    "alpha.$PhaseName.*"  {
        ...
    }
}



// controlDict systemCall function object
   startTime  123;

MySystemCall  {
    ...
    writeCalls  ("doStuff.sh postProcessing/ResultsFile$startTime.txt");
    ...
}
I tried using curly braces {} and looked up how it would be used in shell scripts which use a similar syntax, but I keep getting error messages. I searched the forum and the documentation and can only find either very simple examples, use with numbers or with codestream in-dictionary calculations.

If this works it would save time by allow to specify a few things that I need to adjust often in one central place and avoid having to correct them in many different places every time. Thanks for any suggestions!
Ship Designer is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Chemkin Reader for 9 polynomial coefficient CEA sanjeev_adhikari OpenFOAM Running, Solving & CFD 0 January 6, 2021 20:37
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 14:43
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 07:11
Errors in UDF shashank312 Fluent UDF and Scheme Programming 6 May 30, 2013 20:30
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24


All times are GMT -4. The time now is 02:17.