CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Setting time varying flow field in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-pre-processing/187001-setting-time-varying-flow-field-openfoam.html)

Tings_ April 26, 2017 10:01

Setting time varying flow field in OpenFOAM
 
Hello everyone,

I'm a newbie in OpenFoam. There is a problem which I have already searched from the internet for many days and still have not been solved.

The problem is : whether OpenFOAM is able to achieve the velocity like the following

U=sin(2*pi*y)*sin(pi*x)*cos(pi*t/T)

pi = 3.14
T is the period
t is the current time

Thanks
Tings

alexeym April 26, 2017 11:22

Hi,

Guess, you need this velocity at the inlet boundary and x, y denote centres of faces. Use codedFixedValue BC. You can find an example in $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H.

Access to time is shown in example, you can access to face centres using patch().Cf() vector field.

phemt84 May 5, 2017 05:48

Hi to all,
i'm also interested on this topic. I trying to impose an internal (non bc!!), non-uniform, time varying, velocity field.

specifically the field will should be

Ux = 2sin^2(pi*x)*sin(2*pi*y)*sin(2*pi*z)*cos(2*pi*t/T)
Uy = -sin(2*pi*x)*sin^2(pi*y)*sin(2*pi*z)*cos(2*pi*t/T)
Uz = -sin(2*pi*x)*sin(2*pi*y)*sin^2(pi*z)*cos(2*pi*t/T)

Any idea?

Thanks
Francesco

alexeym May 6, 2017 05:01

Hi,

@phemt84

It depends. If it is your own solver: just set velocity, cycle through cells, get centres, calculate velocity. If you need this velocity in standard solver, you can use codedFunctionObject (you add code to codeExecute section, so you set velocity on every runTime++).

phemt84 May 8, 2017 09:37

Quote:

Originally Posted by alexeym (Post 647864)
Hi,

@phemt84

It depends. If it is your own solver: just set velocity, cycle through cells, get centres, calculate velocity. If you need this velocity in standard solver, you can use codedFunctionObject (you add code to codeExecute section, so you set velocity on every runTime++).

Hi alexeym,
first of all thanks for your answer. I will should use it with interFoam solver, specifically the result that i would like to obtain is this:

https://www.youtube.com/watch?v=tW0S6V6tg9E

I'm quite new in openFoam programming. Could you better explain the use of codedFunctionObject??

Thanks

alexeym May 8, 2017 10:21

interFoam solves NS for get velocity. You want to impose internal field. It looks a little bit bizarre. If you need something calculated with isoAdvector, why don't you got to isoAdvector repository and just download case files?

Quote:

Could you better explain the use of codedFunctionObject??
Pardon?


All times are GMT -4. The time now is 15:05.