CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Transient boundary conditions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree7Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   February 20, 2005, 21:38
Default I am interested in implementi
  #1
Jarrod Sinclair (Sinclair)
Guest
 
Posts: n/a
I am interested in implementing time varying boundary conditions for a transient simulation. I wish to read in a series of pressure values from a text file, and update the boundary at each timestep.

Is it possible to do this without modifying and recompiling the standard solver? I noticed the "timeVaryingUniformFixedValueFvPatchField" class on the Doxygen notes--- can this be used with any standard solver directly?

Thanks,
Jarrod
Prosper likes this.
  Reply With Quote

Old   February 21, 2005, 12:33
Default Looks like timeVaryingUniform
  #2
Hrvoje Jasak (Hjasak)
Guest
 
Posts: n/a
Looks like timeVaryingUniformFixedValueFvPatchField is exactly what you need - have a look at the timeVaryingUniformFixedValueFvPatchField.C file for the details of what the class actually does. If this is what you want, you can use it on any variable with any application you choose. However, I wouldn't be suprised if there are no examples on how to set it up (and this is not supported by FoamX), but reading error messages carefully and editing the file by hand should do the trick.

Incidentally, the whole idea of foam is to provide a toolkit and example applications, which allow you to configure the code to do precisely what you want it to do, no more and no less. In my opinion, yoiu cannot get far using foam unless you start editing files by hand (FoamX is nowhere near flexible enough...) and compiling your own customised executables.

Enjoy,

Hrv
mm.abdollahzadeh likes this.
  Reply With Quote

Old   February 22, 2005, 04:41
Default The timeVaryingUniformFixedVa
  #3
Henry Weller (Henry)
Guest
 
Posts: n/a
The timeVaryingUniformFixedValueFvPatchField BC I wrote will probably do what you want. It interpolates in time (but not space, it assumes the profile across the patch is uniform) the table of values you supply. It can be used with any OpenFOAM application and if you would like to be able to use it from FoamX it would be quite easy for you to add support for it via the FoamX configuration files as for the other BCs.
  Reply With Quote

Old   February 24, 2005, 01:13
Default Thanks for the support so far-
  #4
Jarrod Sinclair (Sinclair)
Guest
 
Posts: n/a
Thanks for the support so far--- I've tried to apply the boundary condition using the icoFoam solver, but am having some trouble getting it working. I've specified an input file for the pressure value of a boundary patch. The initial field is defined as (/0/p):

inlet
{
type timeVaryingUniformFixedValue;
timeDataFileName "inlet.dat";
value uniform 1e5;
}

Is this correct? When I try to run the case, it faults and gives the following error:

Starting time loop

Time = 1e-06

Max Courant Number = 2.11578e-05
BICCG: Solving for Ux, Initial residual = 1, Final residual = 1.38595e-10, No Iterations 1
BICCG: Solving for Uy, Initial residual = 1, Final residual = 2.02749e-10, No Iterations 1
BICCG: Solving for Uz, Initial residual = 1, Final residual = 2.20734e-10, No Iterations 1


--> FOAM FATAL ERROR : gradientInternalCoeffs cannot be called for a calculatedFvPatchField.
You are probably trying to solve for a field with a calculated or default boundary conditions.

Function: calculatedFvPatchField::gradientInternalCoeffs() const
in file: fields/fvPatchFields/basicFvPatchFields/calculated/calculatedFvPatchField.H at line: 174.

FOAM exiting

Do you have any suggestions?
  Reply With Quote

Old   February 24, 2005, 03:57
Default What boundary condition have
  #5
Henry Weller (Henry)
Guest
 
Posts: n/a
What boundary condition have you specified for the pressure on the other patches?
  Reply With Quote

Old   February 24, 2005, 04:05
Default I think I have worked out wha
  #6
Henry Weller (Henry)
Guest
 
Posts: n/a
I think I have worked out what is going on. The timeVaryingUniformFixedValue BC is defined in the cfdTools library which is not linked into icoFoam so you end up using a default BC which is equivalent to "calculated". Add the line

EXE_LIBS = -lcfdTools

to the Make/options file in icoFoam and recompile and your case should run.
alvariten likes this.
  Reply With Quote

Old   February 24, 2005, 21:27
Default Thanks Henry, it works well n
  #7
Jarrod Sinclair (Sinclair)
Guest
 
Posts: n/a
Thanks Henry, it works well now. Just to let others know, the format for the time series text file is:

(
t0 p0
t1 p1
t2 p2
....
tN pN
)

To use the derived total pressure boundary condition with timeVaryingUniformFixedValue, would I have to create a new mixed boundary condition?
  Reply With Quote

Old   February 25, 2005, 04:42
Default It would probably be best to
  #8
Henry Weller (Henry)
Guest
 
Posts: n/a
It would probably be best to start from the totalPressure fvPatchField type in OpenFOAM-1.0.2/src/OpenFOAM/fields/fvPatchFields/derivedFvPatchFields/totalPressure
Copy those files and rename them as say timeVaryingUniformTotalPressureFvPatchScalarField and do a search/replace for that name in both the H and C file and then add the code which handles the data interpolation from the timeVaryingUniformFixedValue BC in OpenFOAM-1.0.2/src/cfdTools/derivedFvPatchFields/timeVaryingUniformFixedValue
  Reply With Quote

Old   March 2, 2005, 20:10
Default Henry, Would it be a good
  #9
Jarrod Sinclair (Sinclair)
Guest
 
Posts: n/a
Henry,

Would it be a good idea to add timeVaryingUniform to the value field, rather than on a boundary type? If so, the available fixedValue options would be "uniform", "nonuniform", "timeVaryingUniform".
  Reply With Quote

Old   March 2, 2005, 20:17
Default That's two very different thi
  #10
Hrvoje Jasak (Hjasak)
Guest
 
Posts: n/a
That's two very different things. The "uniform" and "nonuniform" you refer to are helpers for writing out the Field class, i.e. if there is only one value for the complete field you will only write it once.

Those are available for ALL things derived from field, e.g. internal field, cell volumes etc. and not just for the boundary condition you are looking at.

Hope this helps - we are talking about class organisation, not just hacking the I/O format.
  Reply With Quote

Old   March 2, 2005, 20:20
Default Hi Hrv, Sorry if this is i
  #11
Ali (Ali)
Guest
 
Posts: n/a
Hi Hrv,

Sorry if this is irrelevant to thread, I had sent you an email and was wondering did you receive it? Regards.
  Reply With Quote

Old   March 3, 2005, 04:43
Default Jarrod, It would be possib
  #12
Henry Weller (Henry)
Guest
 
Posts: n/a
Jarrod,

It would be possible to add timeVaryingUniform to the type of field but not necessarily a good idea. In fact this form is just one option from a much larger set of possibilities which would need a function interpreter to handle, e.g. boundary distributions given as functions of time and/or space which are evaluated on the mesh at run time. Some years ago I made a big effort to write a near-complete C++ interpreter for this and other purposes; it would also allow the top-level FOAM codes to run as scripts and interactive field manipulation in the pre/post processing, but the most important use would be for more flexible boundary condition specification. When I get some time/money I will go back to the interpreter and finish off at least to the point that it can fulfill this last requirement but I cannot promise when this will happen.
  Reply With Quote

Old   June 24, 2005, 08:43
Default Would this also work with a ve
  #13
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 9
duderino is on a distinguished road
Would this also work with a velocity inlet and how would the inlet.dat look in this case?
duderino is offline   Reply With Quote

Old   June 24, 2005, 08:55
Default The same as for a scalar field
  #14
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 14
henry is on a distinguished road
The same as for a scalar field but it assumes the velocity is positive inwards and in a direction normal to the patch.
henry is offline   Reply With Quote

Old   June 24, 2005, 09:10
Default I tried the transient bounary
  #15
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 9
duderino is on a distinguished road
I tried the transient bounary for a scalar (pressure) and everything works fine. But if I use the same inlet.dat file for an velocity inlet, I get the following error:

FOAM FATAL IO ERROR : IOstream::check(const char* operation) : error in IOstream "inlet.dat" for operation Istream::operator()

file: inlet.dat at line 1.

Function: IOstream::check(const char* operation) const
in file: db/IOstreams/IOstreams/IOcheck.C at line: 54.

FOAM exiting


What does it mean?
duderino is offline   Reply With Quote

Old   June 24, 2005, 09:14
Default Are you sure the file is in th
  #16
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 14
henry is on a distinguished road
Are you sure the file is in the correct location?
henry is offline   Reply With Quote

Old   June 24, 2005, 09:22
Default It is at the same location whe
  #17
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 9
duderino is on a distinguished road
It is at the same location where it worked with the pressure inlet. In this case it worked all fine.

I just changed the inlet from an pressure inlet to an velocity inlet.
duderino is offline   Reply With Quote

Old   June 24, 2005, 09:28
Default What message do you get if you
  #18
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 14
henry is on a distinguished road
What message do you get if you remove the file?
henry is offline   Reply With Quote

Old   June 24, 2005, 10:02
Default I am sorry, the file was at th
  #19
Member
 
Duderino
Join Date: Mar 2009
Posts: 40
Rep Power: 9
duderino is on a distinguished road
I am sorry, the file was at the wrong place.

But I am still confused why there was no error message with the pressure boundary, since I didn't change file location when I switched from pressure boundary to velocity boudary.

Thanks anyway!!
duderino is offline   Reply With Quote

Old   July 13, 2005, 07:59
Default Dear Henry, a followup on thi
  #20
Member
 
Marco Kupiainen
Join Date: Mar 2009
Posts: 31
Rep Power: 9
kupiainen is on a distinguished road
Dear Henry,
a followup on this thread...
My problem is the following:
On one boundary I need to set all fields into two states, similar to a shock tube problem, but it describes the exact motion of a shock and hence is time dependent (linear interpolation between two the two states is valid). So it seems that I need to use timeVaryingUniformFixedValueFvPatchField
without the uniform. Is this correct? Or can I use the timeVaryingUniformFixedValueFvPatchField without modification?
Otherwise, can one specify one boundary to be computed? How does one resolve this in the code? I guess that in that case one constructs a special code for a specific application, which I don't mind doing, but I'm not too familiar with OpenFoam programming.
best regards
kupiainen is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transient boundary conditions Dave FLUENT 5 October 30, 2011 09:58
Transient boundary conditions in CFX Sohail Ahmed CFX 2 December 11, 2007 14:01
Transient boundary conditions Yannick FLUENT 6 November 6, 2007 08:47
Transient Boundary Conditions James Date CFX 5 September 13, 2004 11:34


All times are GMT -4. The time now is 19:12.