|
[Sponsors] |
chtMultiRegion same boundary conditions for different regions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 5, 2018, 04:57 |
chtMultiRegion same boundary conditions for different regions
|
#1 |
Senior Member
|
Hello everyone,
I am using chtMultiregion solver to study the heat transfer between fluid and solid. Suppose i am having a closed surface with an inlet and outlet for fluid. This closed surface having 10 solid cylinders enclosed in it. By using SHM for multiregion I have generated 11 regions for this geometry (1 for fluid and 10 for each cylinder inside the closed surface). Now, I want to apply boundary condition for each cylinder like this CYLINDER 1 boundaryField { top {type fixed value; Vaue xxx;} bottom {type fixed value; Vaue xxx;} wall {type fixed value; Vaue xxx;} CYLINDER 2..... It is very time consuming to define each BC for each cylinder separately. Is there a way to define BC only for once and it could be used for all other cylinders. I am sorry, I cannot post my geometry here. Thank you I am using OF5x. Regards |
|
June 5, 2018, 06:14 |
|
#2 |
Member
Ricky
Join Date: Jul 2014
Location: Germany
Posts: 78
Rep Power: 11 |
I haven't used it myself but you can define a global boundray condtion using regular expressions per field file and include them using "#include" in your respective regions!
__________________
If it is easy, then something is fishy! |
|
June 5, 2018, 06:42 |
|
#3 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
Or you can use the changeDictionary utility. You need a changeDictionaryDict for each region in the system folder (system/regionName/changeDictionaryDict). Then you can run: changeDictionary -region regionName for every regions. It can be done with a simple for loop quickly. In your case you need only one Dict, and juts copy them into your region folders if you have the same boundary names. You can use what kera said, but for me the splitMeshRegions always ruins every BC, but in this way you can be sure that you have the boundary conditions you want. And with this you also have some freedom if any of your cylinders should have different boundary conditions. |
|
June 5, 2018, 06:45 |
|
#4 |
Senior Member
|
Hi Kera,
Thank you for your reply. I am not expert in OpenFOAM. I am sorry, If I am asking to obvious or too basic question. What I understand from your comment. I could define a boundary conditions for all field for one region (say cylinder1). For all other regions I can use '#include'. But I don't know how to use '#include' for all other regions. Regards |
|
June 5, 2018, 06:51 |
|
#5 | |
Senior Member
|
Quote:
Hi Simrego, Thank you for your suggestion. I was thinking to use changeDictionary for all fields for one region and copy paste that changeDictionary in every region folder. Suppose, I change a BC in one region, then I have to change in every region. You have mentioned I can use a loop or something. Could you please elaborate little bit, How could I use loop to automate the process. Regards |
||
June 5, 2018, 07:07 |
|
#6 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
I correct my reply a bit. Just checked, you can use one changeDictionaryDict using: changeDictionary -dict pathToYourDict -region regionName You can use for loops in the shell under linux (i hope you are using linux) like: for i in listOfRegionnames // example: for i in solid fluid cyl1 cyl2 etc. do changeDictionary -dict pathToYourDict -region $i done It will loop through your regions What kera said, you can find an example in the tutorials/incompressible/simpleFoam/turbineSiting/ Here some files located in the 0.orig/include folder which are included for example into the U file with $include "include/initialConditions" So you can write field file into every region with only an $include "pathToAFileToInclude" line, and into that file what you include, you can write the field file what you usually do. But also an another example if you just write the field files somewhere, and you can link the files into the folders with a loop. It won't copy the file so you won't waste your space, just tell to the operation system that, "there is a U file which is located somewhere else". So there are a lot of ways to do what you want. |
|
June 5, 2018, 07:27 |
|
#7 |
Senior Member
|
Thank you Simrego. You saved me a lot of time.
Yes i am using Ubuntu 17.1 and OF5x. I will try both approaches and I will check which one suit me better. Regards |
|
June 5, 2018, 07:33 |
|
#8 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
You are welcome! But you should also try links. It's really powerful.
Let's assume you have directory 0 and 1. in 0 directory you have file U, while 1 is empty. so: 0/U 1/ Then if you run ln -s 0/U 1/U Then you will have a link in the 1 directory which points to the U file in the 0 directory. So if you change 0/U, everything will be changed since 1/U is linked to 0/U Good luck! |
|
June 5, 2018, 08:09 |
|
#9 | ||
Senior Member
|
Quote:
Sure, I will keep in mind while linking the files Quote:
I am not expert with Linux Shell environment. I have one more question regarding loop please. Is there a way to implement loop for all regions like this for j in {1, 100} do for i in cyl$j do my command done done What i want to do. instead of writing all the region names in for loop (like for i in cyl1 cyl2...), just want to tell loop, go in every folder and implement "my command" |
|||
June 5, 2018, 08:15 |
|
#10 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
You can do like:
for i in cyl* do command done In this case the shell will replace the cyl* with all the files/folders which is start with cyl. just for try you can write: echo cyl* So you will see what are the folders (or files if you have a file which start with cyl) it'll go through |
|
June 5, 2018, 08:26 |
|
#11 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Sorry!
Since you have to run the changeDict from the root folder, you can't use cyl* because they are located in the system directory. Honestly i don't know how can you solve this elegantly, but a rude version can be like: cd system for i in cyl* do cd .. commands cd system done cd .. in this case cyl* will works, because you have these folders in your system folder, and before every changeDict you just step back one, after changeDict step back into the system folder. it's not a nice solution but it'll work. Maybe some expert can tell you a nicer solution. |
|
June 5, 2018, 08:32 |
|
#12 |
Senior Member
|
No problem...I will experiment with these things. I am sure, i will figure out something.
Or may be I will run for loop from system folder instead of root folder. In the end I have to place only changeDictionary in all region folders. I am really thankful for your help |
|
August 25, 2018, 10:38 |
|
#13 | |
Senior Member
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 08:44 |
Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 04:39 |
Low torque values on Screw Turbine | Shaun Waters | CFX | 34 | July 23, 2015 08:16 |
Waterwheel shaped turbine inside a pipe simulation problem | mshahed91 | CFX | 3 | January 10, 2015 11:19 |
Low Mixing time Problem | Mavier | CFX | 5 | April 29, 2013 00:00 |