CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Possible to setup a case with only one masterfile? (https://www.cfd-online.com/Forums/openfoam-pre-processing/232319-possible-setup-case-only-one-masterfile.html)

fanta December 9, 2020 08:04

Possible to setup a case with only one masterfile?
 
Hi,
I do a lot of studies with basically the same OpenFOAM case. I have to setup a lot of cases, and i fill out U, T, p, tranportProperties etc manually for each case. So what i would like to do is use one file to create the case. I heard about changeDictionary, but i have never used it. I want to fill out one file, run a piece of software that changes the entries in my mastercase and then i am finished. The mesh is always different, so there is still some manual work to be done. How to do it? Is changeDictionary an option? Write a python/bash script? I use the OpenFOAM.com Version.



thanks, fanta

fanta December 10, 2020 06:03

I found a very simple solution. I write a file with the structure:
Code:

rho 910;
cp 1700;
...


and place it in the case. Then i include it in every file i have to substitute a variable. I use lines with #calc commands to evaluate certain values.
I am happy with that :)

olesen December 11, 2020 09:04

Quote:

Originally Posted by fanta (Post 790263)
I found a very simple solution. I write a file with the structure:
Code:

rho 910;
cp 1700;
...

and place it in the case. Then i include it in every file i have to substitute a variable. I use lines with #calc commands to evaluate certain values.
I am happy with that :)


What you describe sound a lot like what some of the tutorials already do. For example,
tutorials/incompressible/lumpedPointMotion/building/steady/ where the regular input values and the environment description are split into two files and included back in. In general, you should be able to avoid using #calc (or #eval) if you structure things properly.



The post is pretty old, but might still be helpful
http://olesenm.github.io/2009/11/17/...ludeIfPresent/


If you forget the bit about using "~OpenFOAM/" (which should be written as "<etc>/" these days, you will see that there a number of ways to structure things.


All times are GMT -4. The time now is 03:53.