|
[Sponsors] |
![]() |
![]() |
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 360
Rep Power: 11 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 ![]() |
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; Caelan |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 360
Rep Power: 11 ![]() |
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 ) ) } 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 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 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 ) ) } Any ideas (wiuthout rewriting Function1) to do this would be most welcome. Thanks again, Gerry. Last edited by Gerry Kan; August 23, 2020 at 04:53. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 ![]() |
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 |
|
![]() |
![]() |
![]() |
|
|