CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   modeling a gate (

Alex May 21, 2003 05:45

modeling a gate

I wish to model an opening gate (vertical) in a reservoir. Since sliding mesh capability of CFX4.4 (unmatched grid) cannot be used near the boundaries of the domain, I thought about using a porous media in the vincinity of the outlet, with porosity = 1 or 0.

How specifying a time dependant porosity, since usrpor is called only one time at the begining of the computation ?



Glenn Horrocks May 21, 2003 18:42

Re: modeling a gate
Hi Alex,

I don't think using porous media is a good idea. In CFX4.4, you can change the boundary cell conditions (ie wall, inlet, outlet etc) on a restart. Using this feature you can model the opening gate by having the boundary fully closed, then restarting the simulation with the first cell made into a inlet/outlet, then restart with the second cell made into an inlet/outlet etc.

As this type of simulation requires many restarts, I recommend running it using a batch file (if you are on windows) or the equivalent in UNIX. It's a bit awkward, but it works OK. The only trick is that the values in the dummy nodes can diverge when changing the boundary condition type. If you get unexplained divergence I can show you how keep this under control.

Regards, Glenn Horrocks

Alex May 22, 2003 10:44

Re: modeling a gate
Hi Glenn,

Thank you for these advices. I've tried some "hand made" restarts : it works. But, I don't know how running it using a batch file (I am on windows).

Best regards,


Glenn Horrocks May 22, 2003 18:21

Re: modeling a gate
Hi Alex,

Below is the command line to run the CFX4 solver. (This is covered in the documentation somewhere, but I'll repeat it anyway). The -command option selects which command file to use. -release selects between single and double precision. -fort selects the user fortran file, -geom is the geometry file, -enviro is the number which will be given to the output and dump files, -dir is the temporary directory to use and -restart is the restart dump file to use. There are also a few other options, but these are the main ones.

runsolve4 -command m01.fc -release 4.3dp -fort ../m01.f -geom ../geo.32b -enviro 12 -dir ./.cfx_tmpdir -restart m11.dmp


Alex May 23, 2003 08:45

Re: modeling a gate
Hi Glenn,

Thank you very much.



Alex May 26, 2003 06:01

Re: modeling a gate
Hi Glenn,

I am still having some problems.

The runsolve4 command does not work from a MSdos Windows. So the bath file I wrote "cfxrun.bat" (with a list of runsolve4 commands) becomes useless.

The only way for using cfx outside of its environment, is running a command prompt from the cfx-Launcher (Tools->Command Line). Within this Msdos-like windows, the runsolve4 command works. But since it is an emulated unix environment, the I can not execute the "cfxrun.bat" batch file. At this stage, my problem is that I can not automate restarts.

May be you have an idea ?



(Rq : On unix system, I only know how running batch jobs with the "qsub" command)

zxaar May 26, 2003 10:43

Re: modeling a gate


it will run :-D

Alex May 26, 2003 10:55

Re: modeling a gate

It doesn't work. Neither on MSdos Prompt, nor on unix-like prompt.



Glenn Horrocks May 26, 2003 18:24

Re: modeling a gate

The reason you run the batch file from inside the command window from the CFX4 launcher is it sets up all the correct paths to the executables. If you start cfx from a command window not from the launcher it won't find the executables (or you have to explicitly locate them).

The command line I gave you was used on a UNIX machine. I assumed it was the same for windows, but I might be wrong. You will note that some of the files have filenames "../m01.f" etc - this is because at the time these files are called CFX4 is running in a temporary directory created in the directory it was called from. That is why you need to go back a directory. This might be different under windows.

Also, I don't know what you mean by a "UNIX like prompt". If you mean the command line from the CFX launcher, it is just a normal command line window, just with some PATH statements so it can find the CFX executables.


Alex May 27, 2003 05:33

Re: modeling a gate
Hi Glenn,

First, I would like to thank you for the time that you spent for all your messages. I really appreciate that.

What I called an "unix-like prompt" is a MSdos windows, in which unix (bash) environment is emulated thanks to cygwin (I believe ??).

At present, I have found the tip to run my jobs, using a batch file : The batch file must be created in the "CFX_dir\cygnus\cygwin-b20\H-i586-cygwin32\bin" directory. Therefore, I can use the Command Line windows (ran from the Cfx Launcher) to submit the batch file.

I don't know if this is due to a bad installation, because in the past, I used to run the jobs from a MSdos windows (but it was CFX4.2).

I write the method below (It might be usefull for someone else)

Best Regards



1/ create a text file (name : batchjob for instance) whith a script shell heading and whith the serial of command lines :

#!/bin/sh runsolve4 -rel 4.3 -c m01.fc -g m01.geo -enviro 01 -dir ./cfx_tmpdir runsolve4 -rel 4.3 -c m01.fc -g m02.geo -enviro 02 -restart m01.dmp -dir ./cfx_tmpdir" etc....

2/ Copy this file in the CFX_dir\cygnus\cygwin-b20\H-i586-cygwin32\bin

3/ From the CFX launcher (in the working directory) run a Command Line Windows.

4/ Type the name of the batch file (batchjob)

5/ If you want to stop the job before it ends type from another Command Line windows (ran from the Launcher too) type : touch cfx_tmpdir/cfx4.STP

Alex May 28, 2003 13:22

Re: modeling a gate
Hi Glenn,

I have still problems with this computation (modeling a gate). The batch jobs with several geometries files work when using one phase computation (only water).

Now I am trying to compute the draining of a reservoir (air/water using the homogeneous model) with this opening gate.

Restarting with a new geometrie file leads to some problems :

1/ the starting volume fraction field is not the same as at last time step of the former computation

2/ the result are non physical (even if the numerical solution is well converged)

Thank you.


Glenn Horrocks May 28, 2003 18:23

Re: modeling a gate
Hi Alex,

You may have to zero the values of the solution variables in the dummy nodes for the cells which have just become walls. If you don't they can go unstable and cause the solution to go berko - despite the fact they are behind a wall! Anyway, below is the fortran I used to zero the dummy nodes. You put this code in USRBCS.



+ ipt,npt,cwork,iwork)

call getsca('ANYSCALARS',iscalar,cwork)

do i=1,npt














print*,'USRBCS *** dummy node data zeroed'


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