CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] No particles inserted with groovyBC when using dsmcFOAM (https://www.cfd-online.com/Forums/openfoam-community-contributions/127144-no-particles-inserted-groovybc-when-using-dsmcfoam.html)

Tobias1990 December 4, 2013 10:19

No particles inserted with groovyBC when using dsmcFOAM
 
Hi,

I am trying to run a case where I define a linear velocity gradient on the inlet and outlet, so for example have the velocity at y=0 be 10 and at y=ymax be 100. I am trying to use groovy bc for this. The code runs, but I dont get any particles inserted at my inlet or outlet. My number of equivalent particles is low enough that for a system not using groovyBC I get 150,000 particles. Does anyone know what the problem is?

Here is my code:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object boundaryU;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [ 0 1 -1 0 0 0 0 ];

internalField uniform ( 0 0 0 );

boundaryField
{


outLet
{
type groovyBC;
value uniform (0 0 0);
variables "yp=pts().y;minY=min(yp);maxY=max(yp);wallV=10;str eamV=100;height=pos().y;grad=(steamV-wallV)/(maxY-minY)";
valueExpression "(wallV+grad*height)*normal()";
}

inLet
{
type groovyBC;
value uniform (0 0 0);
variables "yp=pts().y;minY=min(yp);maxY=max(yp);wallV=10;str eamV=100;height=pos().y;grad=(steamV-wallV)/(maxY-minY)";
valueExpression "(wallV+grad*height)*normal()";
}
front
{
type cyclic;
}
back
{
type cyclic;
}
surface
{
type fixedValue;
value uniform (0 0 0);
}
sphere
{
type fixedValue;
value uniform (0 0 0);
}
top
{
type fixedValue;
value uniform (0 0 0);
}

}


// ************************************************** *********************** //


Id be very grateful for any help!

Kind Regards,
Tobias

gschaider December 4, 2013 13:07

Quote:

Originally Posted by Tobias1990 (Post 464817)
Hi,

I am trying to run a case where I define a linear velocity gradient on the inlet and outlet, so for example have the velocity at y=0 be 10 and at y=ymax be 100. I am trying to use groovy bc for this. The code runs, but I dont get any particles inserted at my inlet or outlet. My number of equivalent particles is low enough that for a system not using groovyBC I get 150,000 particles. Does anyone know what the problem is?

Here is my code:

outLet
{
type groovyBC;
value uniform (0 0 0);
variables "yp=pts().y;minY=min(yp);maxY=max(yp);wallV=10;str eamV=100;height=pos().y;grad=(steamV-wallV)/(maxY-minY)";
valueExpression "(wallV+grad*height)*normal()";
}

inLet
{
type groovyBC;
value uniform (0 0 0);
variables "yp=pts().y;minY=min(yp);maxY=max(yp);wallV=10;str eamV=100;height=pos().y;grad=(steamV-wallV)/(maxY-minY)";
valueExpression "(wallV+grad*height)*normal()";
}


Id be very grateful for any help!

Kind Regards,
Tobias

OK. There is a lot of information missing without which it is hard to help you:

- which solver are you using: I guess it is one with lagrangian particles
- how are you injecting the particles: my guess is on the patch

The problem is IMHO not groovyBC but that you're using it wrong and did not check the velocities that you implemented with it.

At a first glance the two BCs look suspiciously similar: not even a sign is different. Haven't looked it through, but seems to me that the expression before normal() in the valueExpressions is always positive. If I'm not mistaken normal() always points out of the geometry. So you set patches where flow goes out. If you inject particles there, where might they go? Hmm …

Tobias1990 December 5, 2013 05:05

Quote:

Originally Posted by gschaider (Post 464843)
OK. There is a lot of information missing without which it is hard to help you:

- which solver are you using: I guess it is one with lagrangian particles
- how are you injecting the particles: my guess is on the patch

The problem is IMHO not groovyBC but that you're using it wrong and did not check the velocities that you implemented with it.

At a first glance the two BCs look suspiciously similar: not even a sign is different. Haven't looked it through, but seems to me that the expression before normal() in the valueExpressions is always positive. If I'm not mistaken normal() always points out of the geometry. So you set patches where flow goes out. If you inject particles there, where might they go? Hmm …

I am sorry for not giving enough information. I am new to this forum and openFoam, so sometimes I forget what is relevant :)

To give you more information:
I am running dsmcFOAM, which creates a "lagrangian" and "uniform" in my /0/ directory. So i guess it is a Lagrangian solver.
Yes, you are correct, I am injecting them on the patch.

Yes the two boundaries are the same. I wanted to impose the same velocity gradient in the inlet and the outlet. I have now changed the inlet boundary condition to point INTO the geometry, by adding a negative sign. When running it this way, I dont get any particles injected either. When initialising the system with particles, they slowly start to dissipate through both patches. I have tried running example cases listed here: http://openfoamwiki.net/index.php/Contrib/groovyBC

,where the simplest one should be the one with a parabolic inlet condition that pulsates:
inlet { type groovyBC; variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();"; valueExpression "10*(1+0.5*sin(500*time()))*para"; value uniform (10 0 0); } outlet { type groovyBC; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "(phi > 0) ? 0 : 1"; value uniform (0 0 0); } These unfortunately don't insert any particles either. I wanted to try and condense my problem to a few questions to make it easier to answer:

1. Am I missing an essential component here for inserting particles? I have looked through the forums, but haven't found any information regarding this.
2. If the inlet/outlet BC's are say both say 10m/s at a certain height, pointing in the same direction, (inlet points into geometry, outlet points out of geometry), would this have been the correct definition? So far I have been using it this way.
3. Is there any more information I you would need to identify the problem?
4. I have defined the rest of my boundary files for the inlet and outlet just as I would for a regular inlet/outlet. (I believe this is zerogradient for all boundary files, apart from temperature, which I set to be 300K and for the pointlevel, which is set as calculated). Do I need to define these as groovyBC as well?

Thank you very much for any help! Its really appreciated!

Tobias

Tobias1990 December 5, 2013 05:08

Quote:

Originally Posted by Tobias1990 (Post 464957)
I am sorry for not giving enough information. I am new to this forum and openFoam, so sometimes I forget what is relevant :)

To give you more information:
I am running dsmcFOAM, which creates a "lagrangian" and "uniform" in my /0/ directory. So i guess it is a Lagrangian solver.
Yes, you are correct, I am injecting them on the patch.

Yes the two boundaries are the same. I wanted to impose the same velocity gradient in the inlet and the outlet. I have now changed the inlet boundary condition to point INTO the geometry, by adding a negative sign. When running it this way, I dont get any particles injected either. When initialising the system with particles, they slowly start to dissipate through both patches. I have tried running example cases listed here: http://openfoamwiki.net/index.php/Contrib/groovyBC

,where the simplest one should be the one with a parabolic inlet condition that pulsates:
inlet { type groovyBC; variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();"; valueExpression "10*(1+0.5*sin(500*time()))*para"; value uniform (10 0 0); } outlet { type groovyBC; valueExpression "vector(0,0,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "(phi > 0) ? 0 : 1"; value uniform (0 0 0); } These unfortunately don't insert any particles either. I wanted to try and condense my problem to a few questions to make it easier to answer:

1. Am I missing an essential component here for inserting particles? I have looked through the forums, but haven't found any information regarding this.
2. If the inlet/outlet BC's are say both say 10m/s at a certain height, pointing in the same direction, (inlet points into geometry, outlet points out of geometry), would this have been the correct definition? So far I have been using it this way.
3. Is there any more information I you would need to identify the problem?
4. I have defined the rest of my boundary files for the inlet and outlet just as I would for a regular inlet/outlet. (I believe this is zerogradient for all boundary files, apart from temperature, which I set to be 300K and for the pointlevel, which is set as calculated). Do I need to define these as groovyBC as well?

Thank you very much for any help! Its really appreciated!

Tobias

I found the problem! I had set the boundary entry for inlet/outlet as "groovyBC" instead of "boundary". Now I just hope the boundary is correct :) thank you for your help!

gschaider December 5, 2013 11:46

Quote:

Originally Posted by Tobias1990 (Post 464959)
I found the problem! I had set the boundary entry for inlet/outlet as "groovyBC" instead of "boundary". Now I just hope the boundary is correct :) thank you for your help!

Don't understand. But if it works: great


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