CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   LES inlet boundary conditions (http://www.cfd-online.com/Forums/openfoam/109073-les-inlet-boundary-conditions.html)

hz283 November 8, 2012 12:29

LES inlet boundary conditions
 
Hi everyone,

I am new here. Can I ask a question about how to implement the LES inlet boundary conditions in openfoam? To my limited knowledge, there are two methods: TurbulentInlet and Mapped.

I am simulating a swirling flow, and so in the inlet I should specify the axial and tengential velocities, which is realized through swak4foam. However, in order to use mapped boundary condition, I think I need to designate the inlet boundary as mapped. This will require me to change the groovyBC type for the inlet. These two things conflict. I do not how to solve this problem. Does anyone have the related experience about this problem? In other words, my question is: in the type of TurbulentInlet or mapped boundary condition, how to use groovy or swak4foam at the same time? Thank you in advance.

hz

hfs December 1, 2012 18:06

I have the same question!
How can I use a logarithmic inlet profile using groovy, and in the same time use TurbulentInlet to create fluctuations??

Did you get an answer?

nsf December 2, 2012 05:06

turbulentRadialProfile
 
1 Attachment(s)
Hi!

A while back I wrote an BC that combined the turbulentInlet from 2.0 and timeVaryingUniform. The former has synthetic turbulence and the latter interpolates a fixedValue as a function of time from a user supplied list.

What this bc (turbulentRadialProfile) does is to read a list (tuple) which has a field as a function of radius. It uses the list as a reference field and then applies the same turbulence as turbulentInlet. The user has to supply the center of the inlet and the radius is calculated as

r =|| \bar{p} - \bar{c} ||,

where \bar{p} is the positionvector.

In the attached gz there are two similar BCs, radialProfile which is the same as the above but doesn't use turbulence. xyzTurbulentProfile takes an unstructured list (tuple) of position and field. The interpolation is rubbish but works with unstructured data, just use many points.

just extract the file and go into each directory and run

Code:

wmake libso
there is an working example with each BC.

I haven't tested it with 2.1 but I suspect it only requires minor modifications.

Edit: hope fully added file =)

Best

Nicolas

hz283 December 2, 2012 19:47

Hi nsf,

Thank you very much for your reply, but I did not find the attachment you mentioned... I really appreciate if you can nicely attach it again.

hz

k.kshitij August 20, 2013 09:08

Using the BC for turbulent inlet for LES-VOF
 
I'm simulating a liquid atomization inside a cylindrical nozzle with inlet of 0.6 mm. I have run a few cases where I found that the turbulence for my case is on the lower side, when specifying a normal fixedValue inlet. From the forum I found that a synthetic turbulent boundary condition for the velocity inlet can be useful for my case. I'm specifying a uniform velocity of 50 m/s at the inlet.

Do you think the boundary condition written by you would be useful for my case.
If yes how can implement it for my case.

Any help regarding above would be of a great use.

Thanking in anticipation

Joachim August 20, 2013 12:20

If you want, I just finished implementing Lund's recycling method in OpenFOAM (thanks to Perry Johnson). It seems to work just fine on a single processor, but I still can't run it in parallel. As soon as I find the solution, I'll upload it if you want.

Maybe one of you might be able to help. Actually, everything works just fine. The velocity field URecycled at the inlet is computed just as it should (I checked). However, when I do

operator==(URecycled);

I receive the following error.

[1] #0 Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #1 Foam::sigFpe::sigHandler(int) in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #2 in "/lib/x86_64-linux-gnu/libc.so.6"
[1] #3 Foam::scaledMappedVelocityFixedValueFvPatchField:: updateCoeffs() in "/home/gatech/OpenFOAM/gatech-2.2.0/platforms/linux64GccDPOpt/lib/libScaledMappedVelocityBCMPI.so"
[1] #4 Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<doub le>, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/bin/pimpleFoam"
[1] #5
[1] in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/bin/pimpleFoam"
[1] #6
[1] in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/bin/pimpleFoam"
[1] #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[1] #8
[1] in "/opt/OpenFOAM/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/bin/pimpleFoam"
[shorthair:14372] *** Process received signal ***
[shorthair:14372] Signal: Floating point exception (8)
[shorthair:14372] Signal code: (-6)
[shorthair:14372] Failing at address: 0x3e800003824
[shorthair:14372] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7f350a6044a0]
[shorthair:14372] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f350a604425]
[shorthair:14372] [ 2] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7f350a6044a0]
[shorthair:14372] [ 3] /home/gatech/OpenFOAM/gatech-2.2.0/platforms/linux64GccDPOpt/lib/libScaledMappedVelocityBCMPI.so(_ZN4Foam42scaledMa ppedVelocityFixedValueFvPatchField12updateCoeffsEv +0x2ba) [0x7f350295ce1a]
[shorthair:14372] [ 4] pimpleFoam(_ZN4Foam8fvMatrixINS_6VectorIdEEEC1ERKN S_14GeometricFieldIS2_NS_12fvPatchFieldENS_7volMes hEEERKNS_12dimensionSetE+0x26e) [0x434a5e]
[shorthair:14372] [ 5] pimpleFoam() [0x434c13]
[shorthair:14372] [ 6] pimpleFoam() [0x41991c]
[shorthair:14372] [ 7] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f350a5ef76d]
[shorthair:14372] [ 8] pimpleFoam() [0x41c9bd]
[shorthair:14372] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 1 with PID 14372 on node shorthair exited on signal 8 (Floating point exception).


Would someone know how to solve this??
Thank you very much!!

Joachim

k.kshitij August 21, 2013 05:11

Hi

Can you please upload those files, I can try it on my case and see if it runs.
As far as the error is concerned I'm not that great at debugging and cannot tell you why it is not working.

Joachim August 21, 2013 13:38

Hum, your domain is a circular cylinder? Then Lund's method will not work. You can only use it on flat plates or similar geometries. There might be some analogous recycling methods though for your specific case.

Good luck!

Joachim August 26, 2013 14:15

problem solved. It seems that you cannot use any loop other than forAll in your code, if you want to parallelize it...

for example, I had something like

label k;
for (k = 0; k < N; k ++)
{
lala[k] = ...;
etc
}

Apparently, OpenFOAM did not like that. I don't really know why yet.

nsf August 26, 2013 14:50

Quote:

Originally Posted by Joachim (Post 448157)
problem solved. It seems that you cannot use any loop other than forAll in your code, if you want to parallelize it...

for example, I had something like

label k;
for (k = 0; k < N; k ++)
{
lala[k] = ...;
etc
}

Apparently, OpenFOAM did not like that. I don't really know why yet.

As far as I can tell "forAll" is just a macro defined in UList.H

Code:


/**
 * \def forAll(list, i)
 * Loop across all elements in \a list
 * \par Usage
 * \code
 * forAll(anyList, i)
 * {
 *      statements;
 * }
 * \endcode
 * \sa forAllReverse
*/
#define forAll(list, i) \
    for (Foam::label i=0; i<(list).size(); i++)

There is no apparent magic there (to me at least) so maybe there is something else that differs?

Joachim August 26, 2013 14:58

While debugging, I isolated the lines that were generating the error. The problem basically came from all my loops.

Changing

label k;
for (k = 0; k < N; k ++)
{
lala[k] = ...;
etc
}

to

forAll (patch(), patchI)
{
lala[patchI] = ...;
etc
if(patchI == N-1) { break; }
}

solved my problem. However, the solution is really not that elegant!

openfoammaofnepo August 26, 2013 19:00

Hi

I think this is related the parallel running, since forAll can be directly used in parallel computations. Can you use your own looping in the serial computations?

Quote:

Originally Posted by Joachim (Post 448167)
While debugging, I isolated the lines that were generating the error. The problem basically came from all my loops.

Changing

label k;
for (k = 0; k < N; k ++)
{
lala[k] = ...;
etc
}

to

forAll (patch(), patchI)
{
lala[patchI] = ...;
etc
if(patchI == N-1) { break; }
}

solved my problem. However, the solution is really not that elegant!


Joachim August 26, 2013 20:13

Yep, the "k-loop" works just fine on a single processor. The problem only appears when using mpirun.


All times are GMT -4. The time now is 13:33.