|
[Sponsors] |
Help with writing a macro/UDF_file/script to change BC at regular time step intervals |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 24, 2014, 11:07 |
Help with writing a macro/UDF_file/script to change BC at regular time step intervals
|
#1 |
New Member
Join Date: Apr 2014
Posts: 2
Rep Power: 0 |
First of all, Hello to everyone !
This is my first post on this forum so I do apologise for any rude-ness, inconsiderations, transgressions I may have unknowingly committed. Also, please keep in mind I am relatively new to the world of CFD so bear with any 'amatuer' questions. So here goes. I am modeling a 2D multi-phase VOF simulation. I have 2 pressure inlets, one for Air and one for Water. These inlets are never open at the same time and follow a regular time step interval. The strategy I am adopting for this is changing the BC for the inlets so they are converted from a pressure inlet to a wall and vice-versa to represent their closing and opening respectively. To illustrate what I mean, as an example, Initial condition as I start the run from the GUI: Air Inlet Open (Pressure Inlet), Water Inlet Close (Wall) What I want to automate: After w no. of timesteps, change Air Inlet from pressure inlet to wall After x no. of timesteps, change Water Inlet from wall to pressure inlet After y no. of timesteps, change Water inlet from pressure inlet to wall After z no. of timesteps, change Air inlet from wall to pressure inlet where w,x,y,z are timesteps in sequence Assuming that is 1 cycle, and the last step is the end of cycle 1 and start of cycle 2, I want to run 5 cycles maintaining the same variation in timesteps between each macro. Now, I managed to use the 'define macro' function in the 'Calculation Activities' tab to define the 4 steps described above as 4 macros. FLUENT allows me to run each of the 4 macros at regular timestep intervals (this setting found in the same window where I defined the macros), but that method only works for the first cycle. To ensure the cycle maintains its timestep interval between each macro in all cycles, not just the first one, My idea is to create a series of IF statements and incorporate it into the macros so that I can define how many timesteps after the 1st macro is executed the next macro will run and so on and so forth. In other words, I want to use IF statements to tell FLUENT that when it runs each macro, after a certain no. of time steps I want it to run the next macro, so by writing out statements for each macro, it will flow onto the next macro. i.e. IF macro 1 is run, after X no. of time steps, run macro 2. Question 1: Assuming the strategy above is sound, how would I go about executing it ? I have no coding background/experience and have no idea how to construct logical statements using the coorect syntax which FLUENT can recognise. Could you please give me a few lines as example to show what sort of code would give me the timestep variation between each macro that I am looking for ? Question 2: Is this strategy which I have described so far a good strategy ? If not, are there any alternate methods I could look into, such as writing a UDF file from scratch ? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to determine time step size and Max. iterations per time step. | pratik c | FLUENT | 46 | January 21, 2024 13:21 |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 11:08 |
Unstabil Simulation with chtMultiRegionFoam | mbay101 | OpenFOAM Running, Solving & CFD | 13 | December 28, 2013 14:12 |
AMI interDyMFoam for mixer nu problem | danny123 | OpenFOAM Programming & Development | 8 | September 6, 2013 03:34 |
calculation diverge after continue to run | zhajingjing | OpenFOAM | 0 | April 28, 2010 05:35 |