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

unifomFixedValue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2020, 14:12
Default unifomFixedValue
  #1
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 376
Rep Power: 11
Gerry Kan is on a distinguished road
Howdy Foamers:

I am using uniformFixedValue for one of my boundary conditions so that I can use a time varying profile to describe the evolution of one of my scalar variables.

My question is, while Function1 returns an interpolated value between two points, is there a function that will simply give me a step value until a new point of time is reached.

To illustrate, I have something like this for a generic scalar (phi)

t = 0, phi = 0
t = 1, phi = 0.1
t = 2, phi = 0.2

If this list of points are defined as a Function1 in my uniformFixedValue boundary, at t = 1.2, I would get 0.12. However, I want this value to stay at 0.1 until t = 2, in which case phi will stay 0.2 until a new point of time defined.

Thanks in advance, Gerry.
Gerry Kan is offline   Reply With Quote

Old   August 6, 2020, 14:27
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
I'm not sure about prescribing a step function, but the first thing I thought of is using the tableFile option to read (from e.g. a csv) the values for a given time. You can also just provide the table directly if the number of points is sufficiently small. Here's an example that I've used for reading from a csv :

Code:
        type           uniformFixedValue;
        uniformValue   tableFile;
        uniformValueCoeffs
        {
            file                "$FOAM_CASE/data";
            format              csv;
            nHeaderLine         0;
            refColumn           0;
            componentColumns    (1);
            separator           ",";
            mergeSeparators     yes;
            outOfBounds         clamp;
            interpolationScheme linear;
        };
        value          $internalField;
And it looks like there's a tutorial for providing the table directly : https://github.com/OpenFOAM/OpenFOAM.../propeller/0/U

Caelan
clapointe is offline   Reply With Quote

Old   August 21, 2020, 08:04
Default
  #3
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 376
Rep Power: 11
Gerry Kan is on a distinguished road
Dear Caelan:

Thanks for the clarification, perhaps I wasn't too clear about my question. So this is kind of what I wanted to do. When I use a uniformFixedValue boundary, I define the following Function1 table:

Code:
// PATCH FIELD DEFINITION

uniformFixedValueBoundary  {
   type         uniformFixedValue;
   uniformValue  table  (
      ( 0   0.2 )
      ( 1   0.3 )
      ( 2   0.4 )
      ( 3   0.5 )
   )
}
When you run a simulation for, say, 4 seconds, OpenFOAM will determine the boundary values through interpolation, and the will remain at the closest value should the time be beyond the defined time range. That is, I will expect to get:

Code:
// WHAT I EXPECT TO GET FROM OPENFOAM

 TIME  VALUE
-------------
 0.0   0.20
 0.5   0.25
 1.0   0.30
 1.5   0.35
 2.0   0.40
 2.5   0.45
 3.0   0.50
 3.5   0.50
 4.0   0.50
HOWEVER, I would like to have the fixed values to be presented as a stepwise manner, i.e., not interpolate until the time has reached the next tabulated time value. In other words, this is what I want:

Code:
// WHAT I WANTED TO GET

 TIME  VALUE
-------------
 0.0   0.20
 0.5   0.20
 1.0   0.30
 1.5   0.30
 2.0   0.40
 2.5   0.40
 3.0   0.50
 3.5   0.50
 4.0   0.50
Is there a way to tell the Function1 object to do this? A workaround is to introduce additional points so that OpenFOAM will interpret this as piecewise constant, like this:

Code:
// WORKAROUND

uniformFixedValueBoundary  {
   type         uniformFixedValue;
   uniformValue  table  (
      ( 0      0.2 )
      ( 1      0.2 )
      ( 1.0001 0.3 )
      ( 1.0002 0.3 )
      ( 2      0.3 )
      ( 2.0001 0.4 )
      ( 2.0002 0.4 )
      ( 3      0.4 )
      ( 3.0001 0.5 )
      ( 3.0002 0.5 )
   )
}
The caveat is that OpenFOAM will only accept the first 6 significant figures. If you define extra points at 3.000001 and 3.000002, OpenFOAM will thorw in a fatal error because it cannot distinguish between the two.

Any ideas (wiuthout rewriting Function1) to do this would be most welcome.

Thanks again, Gerry.

Last edited by Gerry Kan; August 23, 2020 at 05:53.
Gerry Kan is offline   Reply With Quote

Old   August 21, 2020, 13:14
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
I am not sure how to do it with Function1 -- perhaps someone else might. Another option if you want it to be instantaneous would be to run it in sections -- run a second, change the bc, and then run another second, etc.

Caelan
clapointe is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 21:36.