a script for changing variables in groovyBC in 0 folder
Hi I have some variables(theta0,theta1,...,theta8)in various variable files(p,T,U,k,omega) in 0 folder.I'm wondering if its possible to write a script to change each of these variables I want before a run starts without a need to look into each files separately.
thanks for helps. Code:
right |
Quote:
|
Hi Bernhard
which examples do you talking about? |
Hi Ehsan,
If you go to the location of your swak4Foam installation and type the following in the command line: Code:
find ./Examples | xargs grep globalScope Good luck, Niels |
Quote:
|
You are welcome, Bernhard. Have a nice weekend.
/ Niels |
@Niels:thanks Niels,I thought Bernhard is poiting to OF examples in tutorial!
@Bernhard: wow! really?! Bernhard you should be more patient.:D I can't imagine what did you do if you were in place and position of me.;) |
thanks Both Niels and Bernhard
in an example I found this in controlDict: Code:
defineState { Code:
globalScopes ( |
separate header of variables
I also found a brilliant idea for storing many variables I have in a separate file,
then I should delete theta variables in variable file and only bring them in global variable function,true? but could anyone say what does this part of variables do?I think maybe i will need it in next time. Code:
delayedVariables ( |
Greetings to all!
@Ehsan: Quote:
Code:
**** delayed-t-junction Code:
inlet1 Best regards, Bruno |
don't you know such a simple thing Bruno?:mad:
I knew that I should explain you that! It takes some the value in outlet and put it in inlet after a while each .001s !:D after joking! but whats the role of delay there? |
Quote:
This is a simple case, where the delay can help in reach a better convergence (I think, I'm not sure here), since it's giving a time offset to a boundary condition. This BC acts similarly to OpenFOAM's "directMapped" (or something "mapped" something). The difference is that the original "mapped" will teleport the patch fields in the same time iteration or between consecutive iterations (I'm not sure on this one). The "delay" can give you more control on when the transfer is made. Another possibility - which doesn't have much to do with convergence - is the ability to emulate a longer pipe, without the need to simulate it. For example, if you're simulating a 12 meter pipe that repeats itself with a protuberance of some kind (e.g. convergent or divergence nozzle or a simple obstacle), you can simulate only 2 meters that have the protuberance and calculate the delay it takes to go through the remaining 10 meters, before repeating the flow on the other side! |
so it takes and saves the data in output each .001s but waits and after .1s starts exerting them on inlet.right?
I didn't grasp your example exactly.could you clarify how this feature can be applicable in such situation you mentioned? thanks. |
Quote:
Quote:
Now, for example, we can either have a mesh with around 12 million cells, or trim it down to just 2-3 million cells and simulate only 2m worth of pipe. To fill in the gap of the missing 10m, we need to delay the outlet back into the inlet for about: 10 (m) / 1 (m/s) = 10s. With the "mapped" feature that OpenFOAM has got, you could only map after the full 12m pipe... or you could create a variant of OpenFOAM's "mapped" BC and implement the options and equations directly. But with this groovyBC's feature, there is no need for coding! |
Thank you so much.I figured out what you mean!
what a brilliant idea of using this feature in the example! maybe i need to use it in future. |
2 Attachment(s)
I moved all variables to a file named variables(does it have any problem?)
and this error on wall_right occurred: Code:
Selecting turbulence model type RASModel ---------------------------------------------------------------- I have defined the variable wall_right to be a Boolean variable according to values of time,maybe this is the source of the error? |
(edit: CAUTION - this post was guessing something that apparently isn't true. The problem seems to be something else.)
I haven't tested this yet, but my guess is this: the OpenFOAM feature "#include" does not work in the same way as in C++. It (probably) does not copy-paste the contents of the mentioned file into where we tell it to place. What it (probably) does is load it into memory and process the defined variables within the file. So, I think the correct way to use this would be:
|
I saw it this morning in this example of swak4Foam:Examples/other/OSCFD_cleaningtank2D/0.orig
in its U file it has come these functions: Code:
wall Code:
// -*- C++ -*- |
Hi Ehsan,
As I said, I was only guessing. Without a test case, that's all I can do :rolleyes: Right before copying the variables list into the "variables" file, did you confirm if everything was working as intended? Best regards, Bruno |
I emailed you the case.one time before Bernhard told me something related to Boolean I don't remember,mabe its due to that.
|
All times are GMT -4. The time now is 00:23. |