I am interested in implementi
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 |
Looks like timeVaryingUniform
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 |
The timeVaryingUniformFixedVa
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.
|
Thanks for the support so far-
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? |
What boundary condition have
What boundary condition have you specified for the pressure on the other patches?
|
I think I have worked out wha
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. |
Thanks Henry, it works well n
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? |
It would probably be best to
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 |
Henry,
Would it be a good
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". |
That's two very different thi
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. |
Hi Hrv,
Sorry if this is i
Hi Hrv,
Sorry if this is irrelevant to thread, I had sent you an email and was wondering did you receive it? Regards. |
Jarrod,
It would be possib
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. |
Would this also work with a ve
Would this also work with a velocity inlet and how would the inlet.dat look in this case?
|
The same as for a scalar field
The same as for a scalar field but it assumes the velocity is positive inwards and in a direction normal to the patch.
|
I tried the transient bounary
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? |
Are you sure the file is in th
Are you sure the file is in the correct location?
|
It is at the same location whe
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. |
What message do you get if you
What message do you get if you remove the file?
|
I am sorry, the file was at th
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!! |
Dear Henry,
a followup on thi
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 |
All times are GMT -4. The time now is 09:12. |