CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   timeVaryingUniformFixedValue BC questions (

phsieh2005 August 13, 2009 22:10

timeVaryingUniformFixedValue BC questions
Dear OpenFOAM experts:

I am trying to modify timeVaryingUniformFixedValue BC so that it can handle time varying with cycles.

Can someone explaim what "fvPatchField<Type>::operator== " means?

why I cannot do fvPatchField<Type>::operator== 1?

I can read in t1, t2, and tPeriod into the code, then, I want to

1. calculate cycle number: nCycle = int(runTime.value()/tPeriod)
2. localTime = runTime.value() - nCycle * tPeriod;
if(localTime >= 0 && localTime < t1)
operator == 0;
else if (localTime >= t1 && localTime < t2)
operator == 1;
else if(localTime <= tPeriod)
operator = 0;

my problem with 1 above is that, OpenFOAM gave type cast error. If I use floor() function, it is not support in foam name space.
in 2 above, how to assign the patch value to either 0 or 1?

Can someone shed some light on this?


henrik August 17, 2009 03:51

Dear phsieh2005,


why I cannot do fvPatchField<Type>:operator== 1?
Because it's templated and 1 is not valid for a vector or tensor. Use


fvPatchField<Type>:operator== pTraits<Type>::one;
timeVaryingUniformFixedValue also has an option "repeat" which already does what you are looking for.


phsieh2005 August 17, 2009 07:07

Thanks a lot for the answer, Henrik!

I was about to give up on this.


All times are GMT -4. The time now is 09:06.