CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Cyclic boundary condition for dnsFoam (http://www.cfd-online.com/Forums/openfoam-programming-development/113888-cyclic-boundary-condition-dnsfoam.html)

antoinep76 February 28, 2013 11:22

Cyclic boundary condition for dnsFoam
 
Hi everyone,
I am trying to simulate a channel flow with dnsFoam. I successfully added the transport equation for a passive scalar to simulate the temperature. Since I need to get a stationary flow, I chose cyclic boundary conditions instead of an inlet and an outlet.

My problem is: I don't want the temperature to be cyclic, but it is impossible to create a cyclic velocity field and a non cyclic temperature field only by modifying the case. So I tried to modify the source as follows:


fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);


TEqn.solve();

// force inlet T=300 K
label patchi = mesh.boundaryMesh().findPatchID("inlet");
T.boundaryField()[patchi] = 300. ;

runTime.write();

(extract from my_dnsFoam.C)

I wanted the temperature at the inlet patch to become equal to 300K, but it didn't work at all. Do you have any idea why? And do you have a solution for my problem?

Thank you.

wyldckat March 2, 2013 08:33

Greetings Antoine and welcome to the forum!

I'm not very familiar on the full range of how cyclic patches can be used, but "cyclicFan" comes to mind. Check the tutorial "incompressible/pimpleFoam/TJunctionFan". This will probably mean that you'll need to implement a new boundary condition for this.

Additionally, I think I've seen this question more than once here in the forum...

Best regards,
Bruno

anishtain4 March 2, 2013 15:20

You can't achieve this the way you did it because there is a boundaryCorrection somewhere in the solver which returns the values on boundary by the other side of cyclic bc condition.
Look up the forum, as wyldcat said this question has been addressed more than once.

chegdan March 4, 2013 12:30

Both Wyldckat and anishtain4 are correct in that cyclic isn't what you need. One way around this is to use something like a mapped boundary condition. The values at the outlet of your field (e.g. momentum) are mapped to your inlet to create a pseudo-cyclic BC. I say pseudo because its essentailly one-way coupled and nothing from the inlet will be mapped to the outlet like they would be in pure cyclic. You can add a flow rate to the mapped BC have the flow inlet velocity scaled to a certain value and use regular pressure boudnary conditions. The beauty is that you can use fixedValue and other BCs for other variables i.e. you wont need to make some variables cyclic or pseudo-cyclic. Search for mapped, directMapped bcs (I believe directMapped became mapped in newer versions of OpenFOAM).

Djub March 15, 2013 08:21

Hi Chegdan,
You say "you can [...] use regular pressure boudnary conditions". Saying U=mapped and p=zeroGradient ?
In my opinion, the NS equations are linking both fields. You should not take V without P! For example, there is an under-pressure in the core of a large vortex. If you map U-field, you must have also this depressure, mustn't you? Thus you should have to map also P it in the inlet. Or maybe the NS solver is able to reconstruct it thanks to U-field?
I am still doubtfull, because within the calculated domain, from where you extract the V field, pressure field has no reason to be zerogradient. So it could create a kind of C0 discontinuity (continuous P with discontinuity in grap P).
I know majority of people, including tutorials, are working like this. So maybe I am missing something but I don't find what...
Can I have your opinion about this?

anishtain4 March 15, 2013 15:59

in a channel flow you use constant gradient not zero gradient, this value is what determines your flow rate once it reaches a steady state

chegdan March 17, 2013 09:19

I was using pressure as a classic example of a situation where you could use cyclic on one variable (i.e. U) and fixedValue/zeroGradient on another (i.e. pressure). You could map all variables to the inlet and have a constant pressure gradient from your channel inlet to the outlet. Again, these will be one-way coupled from the outlet to the inlet.

Quote:

Originally Posted by Djub (Post 414169)
Hi Chegdan,
You say "you can [...] use regular pressure boudnary conditions". Saying U=mapped and p=zeroGradient ?
In my opinion, the NS equations are linking both fields. You should not take V without P! For example, there is an under-pressure in the core of a large vortex. If you map U-field, you must have also this depressure, mustn't you? Thus you should have to map also P it in the inlet. Or maybe the NS solver is able to reconstruct it thanks to U-field?
I am still doubtfull, because within the calculated domain, from where you extract the V field, pressure field has no reason to be zerogradient. So it could create a kind of C0 discontinuity (continuous P with discontinuity in grap P).
I know majority of people, including tutorials, are working like this. So maybe I am missing something but I don't find what...
Can I have your opinion about this?


Djub March 18, 2013 06:54

Thanks both for your answers,
By the way, I still don't understand everything.
Within the flow, from where you are mapping pressure has no reason to be homogenous ans constant. In the middle of biggest vortices, the pressure is low (as in the core of a hurricane). So around a vortex, the grad P vector is pointing outside of the vortex. Its x-component (// to the flow, normal to the mapped plane) is non uniform, and due to Taylor's hypothesis, it is changing in time. Thus, forcing the inlet to be with a uniform and constant grad P sounds strange for me. This condition makes a flow different from the one within the flow (mapped plane). Do you agree?


All times are GMT -4. The time now is 16:28.