CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Different inlet U values steady state

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2011, 19:53
Question Different inlet U values steady state
  #1
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
Hi everyone, I'm a new user of OpenFOAM and I have to make a lot of simulation to validate the use of OF for my case instead of software like Fluent or CFX.
I'm using simpleFoam and I'm looking for an way to make a yaw study.
I want to create a file with all the u_x u_y u_z values for yaws from 0 to 20 deg and to ask Of to take these values for the inlet automatically. For example every 2000 timestep, 0deg for 2000 timestep and restart automatically with the 2deg value for an other 2000 timestep ...

My other idea is to use "timeVaryingUniformFixedValue" for U :
boundaryField
{
SURFACE_INLET
{
type timeVaryingUniformFixedValue
fileName "FOAM_CASE/U_inlet.timeprof";
outOfBounds clamp;
}
and to create a file U_inlet.timeprof with
(
(0 (3.2294 0 0)) 10 (timestep(u_x u_y u_z))
(2000(x y z))
)
but i don't know of to set a cos/sin dependance for x y and z

I hop I'm clear of what I want and you can help me
Thanks
Alex
alex_rubel is offline   Reply With Quote

Old   January 18, 2011, 11:37
Default
  #2
New Member
 
Alton Luder III
Join Date: Oct 2009
Location: Michigan
Posts: 22
Rep Power: 17
sleepdeprivation is on a distinguished road
Have you thought about setting up a script to run the different cases?

check out pyFoam http://openfoamwiki.net/index.php/Contrib_PyFoam
especially pyFoamClearCase.py and pyFoamWriteDictionary.py
sleepdeprivation is offline   Reply With Quote

Old   January 18, 2011, 16:16
Default what about a bash script?
  #3
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Although PyFoam is really great, I found it frustrating to learn OpenFoam and PyFoam at the same time. How about just taking an Allrun script (from many of the tutorials) and setting up your cases that are eventually run by your script? A script could look like:

Code:
#!/bin/bash
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

#move into the first case
cd case1

printf "starting simplFoam"

#print start time
date
#decompose the mesh assuming you have decomposeParDict correct
    runApplication decomposePar

#parallel run with 8 processes
    runParallel simpleFoam 8 system/machines

#reconstruct the domain
    runApplication reconstructPar

#print the end time and date
date

#now move to the second case
cd ../case2

#repeat first set of commands
this of course could be run above the first case and as long as everything has been initialized then it will run well. I suggest getting one working well with all your specifics correct (solver settings, descritization, convergence criteria, initial conditions, etc. ) and then running them in sequence. I really like PyFoam, but it can be tough to get started using without much experience in OF. Good Luck.

Dan
chegdan is offline   Reply With Quote

Old   January 18, 2011, 18:30
Default
  #4
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
Thanks for your answers, I looked at pyFoam but it's seems hard to get something working in one or two days and i need to set that asap.
Thanks a lot Dan it seems a very good idea, I'm going to try today, I started a Java program with eclipse but get some problems.
I'll try to set the Allrun file.
Thanks again
Alex
alex_rubel is offline   Reply With Quote

Old   January 18, 2011, 18:59
Default
  #5
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
I add some thing in your code Dan tell me if it's good. I usually use the following command to run parallel case :
mpirun -np 6 simpleFoam -parallel > log &
I want to know if "runParallel simpleFoam 6 system/machine" will do he same thing

Code:
#!/bin/bash
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

#move into the first case
cd 4deg

printf "starting simplFoam"

#print start time
date
#copy 0 to 0.org
    cp -r 0 0.org
#run potentialFoam
    runApplication potentialFoam -writep
#decompose the mesh assuming you have decomposeParDict correct
    runApplication decomposePar

#parallel run with 8 processes
    runParallel simpleFoam 6 system/machines

#reconstruct the domain
    runApplication reconstructPar -latestTime

#print the end time and date
date

#now move to the second case
cd ../6deg

#repeat first set of commands
alex_rubel is offline   Reply With Quote

Old   January 18, 2011, 19:14
Default
  #6
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
yeah the mpirun command is in the runParallel simpleFoam 6 system/machines command. The machines file in the system folder must be there and that contains the hostname of the computer (it doesn't need the number of processors for this command).
chegdan is offline   Reply With Quote

Old   January 18, 2011, 19:22
Default
  #7
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
I don't have a machine file in my system folder. Can you give a copy of this file ?
Thanks
alex_rubel is offline   Reply With Quote

Old   January 18, 2011, 19:33
Default
  #8
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
go to the terminal and type

hostname > machines

then put that file in your system folders
chegdan is offline   Reply With Quote

Old   January 18, 2011, 19:43
Default
  #9
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
Ok thanks a lot for everything. Hope it will be ok
alex_rubel is offline   Reply With Quote

Old   January 19, 2011, 19:12
Default
  #10
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
Hi, I try to launch it this morning and I got this error message :

Quote:
.: 3: Can't open /bin/tools/RunFunctions
alex_rubel is offline   Reply With Quote

Old   January 19, 2011, 19:40
Default
  #11
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
Originally Posted by alex_rubel View Post
Hi, I try to launch it this morning and I got this error message :
Make sure all of your openfoam variables are sourced properly, in this case its $WM_PROJECT_DIR

if you type

echo $WM_PROJECT_DIR

then something like

/home/dcombest/OpenFOAM/OpenFOAM-1.6-ext

should come up. if not then something is wrong with your install.

Dan
chegdan is offline   Reply With Quote

Old   January 19, 2011, 19:58
Default
  #12
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
I got :
/home/arubel/OpenFOAM/OpenFOAM-1.6
alex_rubel is offline   Reply With Quote

Old   January 19, 2011, 20:30
Default
  #13
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
does /home/arubel/OpenFOAM/OpenFOAM-1.6/bin/tools/RunFuntions exist?
are you calling the script correctly?
If you call it from the directory where is exists then call it by

Code:
./ScriptName
or

Code:
sh ScriptName.sh
are you using the bash shell?
echo $SHELL should give you /bin/bash

It should work if all is set up correctly. Paste the whole script if you want me to try.
chegdan is offline   Reply With Quote

Old   January 19, 2011, 20:37
Default
  #14
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
I'm using ubuntu so it's a bash shell. And The RunFunctions files exist in the /home/arubel/OpenFOAM/OpenFOAM-1.6/bin/tools/
I don't really understans what i have to do with
Code:
 ./ScriptName
here is my Allrun file :
Quote:
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

#move into the first case
cd 4deg

printf "starting simplFoam"

#print start time
date
#copy 0 to 0.org
cp -r 0 0.org
#run potentialFoam
runApplication potentialFoam -writep
#decompose the mesh assuming you have decomposeParDict correct
runApplication decomposePar

#parallel run with 8 processes
runParallel simpleFoam 6 system/machines

#reconstruct the domain
runApplication reconstructPar -latestTime

#print the end time and date
date

#now move to the second case
cd ../6deg

#repeat first set of commands

printf "starting simplFoam"

#print start time
date
#copy 0 to 0.org
cp -r 0 0.org
#run potentialFoam
runApplication potentialFoam -writep
#decompose the mesh assuming you have decomposeParDict correct
runApplication decomposePar

#parallel run with 8 processes
runParallel simpleFoam 6 system/machines

#reconstruct the domain
runApplication reconstructPar -latestTime

#print the end time and date
date
and the RunFunction file :
Quote:
#---------------------------------*- sh -*-------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# RunFunctions
#
# Description
#
#------------------------------------------------------------------------------

getApplication ()
{
grep application system/controlDict | sed "s/application *\([a-zA-Z]*\);/\1/"
}

runApplication ()
{
APP_RUN=$1; shift
APP_NAME=${APP_RUN##*/}

if [ -f log.$APP_NAME ] ; then
echo "$APP_NAME already run on $PWD: remove log file to run"
else
echo "Running $APP_RUN on $PWD"
$APP_RUN $* > log.$APP_NAME 2>&1
fi
}

runParallel ()
{
APP_RUN=$1; shift

if [ -f $log.$APP_RUN ] ; then
echo "$APP_RUN already run on $PWD: remove log file to run"
else
echo "Running $APP_RUN in parallel on $PWD using $1 processes"
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
fi
}

compileApplication ()
{
echo "Compiling $1 application"
wmake $1
}

cloneCase ()
{
if [ -d $2 ] ; then
echo "Case already cloned: remove case directory $2 to clone"
else
echo "Cloning $2 case from $1"
mkdir $2
cpfiles="0 system constant"
for f in $cpfiles
do
cp -r $1/$f $2
done
fi
}

#------------------------------------------------------------------------------
alex_rubel is offline   Reply With Quote

Old   January 19, 2011, 20:56
Default
  #15
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
sorry...the ./ScriptName is actually ./Allrun I just wasnt sure what you called your script. I will try this tomorrow morning....Im out of the office.
chegdan is offline   Reply With Quote

Old   January 19, 2011, 22:50
Default
  #16
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
I tried your script and it worked where it was suppose to work. I'm not sure what the issue is on your system.
chegdan is offline   Reply With Quote

Old   January 19, 2011, 23:01
Default
  #17
New Member
 
Alexandre Rubel
Join Date: Dec 2010
Location: Launceston, Tasmania AUSTRALIA
Posts: 28
Rep Power: 15
alex_rubel is on a distinguished road
Could it be a problem of authorisation because I always have to use sudo to source something ...
alex_rubel is offline   Reply With Quote

Old   January 19, 2011, 23:27
Default
  #18
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
That might be the problem. My install is in my home directory.
chegdan is offline   Reply With Quote

Reply

Tags
automatically, change, inlet, simplefoam, speed


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Arithmetic mean of velocity (steady - state) lentschi CFX 3 January 11, 2011 07:18
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
About the difference between steady and unsteady problems Lisa Main CFD Forum 11 July 5, 2000 15:37
Steady state formulation of turbulence ?? Jitendra Main CFD Forum 1 June 27, 2000 19:49


All times are GMT -4. The time now is 15:30.