CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] About GroovyBC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2013, 01:42
Default About GroovyBC
  #1
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 13
mmkr825 is on a distinguished road
Hi Foamers,
I am using OpenFOAM2.1.1 version. My solver is steady state and i prepared it by modifying "simpleFoam" solver. I am facing problem with boundary condition for the scalar field (lets say T).
The governing equation for the field T as follows:
Code:
solve ( fvm::div(phi, T) + fvc::div(J) );
At the fixed Walls i need to apply zero flux boundary condition. In the above equation "J" is the flux. So i need to apply J.n=0 at fixed walls. I have little experienced in handling "groovyBC".
Can anyone help me how to write this expression. Thanks in advance.

Regards
M Mallikarjuna Reddy
mmkr825 is offline   Reply With Quote

Old   March 19, 2013, 05:04
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mmkr825 View Post
Hi Foamers,
I am using OpenFOAM2.1.1 version. My solver is steady state and i prepared it by modifying "simpleFoam" solver. I am facing problem with boundary condition for the scalar field (lets say T).
The governing equation for the field T as follows:
Code:
solve ( fvm::div(phi, T) + fvc::div(J) );
At the fixed Walls i need to apply zero flux boundary condition. In the above equation "J" is the flux. So i need to apply J.n=0 at fixed walls. I have little experienced in handling "groovyBC".
Can anyone help me how to write this expression. Thanks in advance.

Regards
M Mallikarjuna Reddy
And J is related to T how?

Assuming that J is a surface field then fvc::div(J) only uses the values on the boundary patches (the situation is not better if J is a volume-field).

Anyway: if you're not doing completely different physics to somebody else then J is somehow related to grad(T) which makes the second term boil down to something like laplacian(lambda,T) for which you can use the fvm-form which makes everything much more stable.

If J is completely unrelated to T then only the actual value of div(J) in the cells matters for the solution of the T-equation and if J is a vector and J=(0,0,0) is not good enough for you then a slip-boundary condition is sufficient
mmkr825 likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 19, 2013, 06:57
Default
  #3
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 13
mmkr825 is on a distinguished road
Quote:
Originally Posted by gschaider View Post
And J is related to T how?

Assuming that J is a surface field then fvc::div(J) only uses the values on the boundary patches (the situation is not better if J is a volume-field).

Anyway: if you're not doing completely different physics to somebody else then J is somehow related to grad(T) which makes the second term boil down to something like laplacian(lambda,T) for which you can use the fvm-form which makes everything much more stable.

If J is completely unrelated to T then only the actual value of div(J) in the cells matters for the solution of the T-equation and if J is a vector and J=(0,0,0) is not good enough for you then a slip-boundary condition is sufficient

Dear gschaider,
Thanks for the quick response. In my case i defined J as volume field:
Code:
volVectorField J
    (
        IOobject
        (
            "J",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        -f1*fvc::div(Epnn1)+fvc::laplacian(f2, U)
    );
Where Epnn1 is defined as:

Quote:
volTensorField Epnn1
(
IOobject
(
"Epnn1",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
f3*Q
);
Where f1,f2 and f3 are functions of T and Q is a tensor. I defined Q as:

Quote:
dimensionedTensor Q
(
"Q",
dimensionSet(0, 0, 0, 0, 0, 0, 0),
tensor(1,0,0,0,0.58,0,0,0,0.38)
);
As you noticed if J is function of grad(T), then my problem could be easy. But in my case i don't have any explicit expression for J in-terms of grad(T). Could you please elaborate the method in which I can use a slip boundary condition for my case by using groovyBC?
Moreover i am struggling with divergence problem. From your valuable suggestion I understood that there is divergence in my case since J is defined as a volume field. Should I define J at the surface field to achieve convergence?


Thanks
Reddy
mmkr825 is offline   Reply With Quote

Old   March 19, 2013, 08:00
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mmkr825 View Post
Dear gschaider,
Thanks for the quick response. In my case i defined J as volume field:
Code:
volVectorField J
    (
        IOobject
        (
            "J",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        -f1*fvc::div(Epnn1)+fvc::laplacian(f2, U)
    );
Where Epnn1 is defined as:

Where f1,f2 and f3 are functions of T and Q is a tensor. I defined Q as:

As you noticed if J is function of grad(T), then my problem could be easy. But in my case i don't have any explicit expression for J in-terms of grad(T). Could you please elaborate the method in which I can use a slip boundary condition for my case by using groovyBC?
Moreover i am struggling with divergence problem. From your valuable suggestion I understood that there is divergence in my case since J is defined as a volume field. Should I define J at the surface field to achieve convergence?


Thanks
Reddy
slip has nothing to do with groovyBC. It is a standard-BC in OpenFOAM. Anyway: to set special boundary conditions for a field it is better to read that field from disc. Everything else is horrible to program.

For convergence: i can only be general here: you mentioned that the functions fX depend on T: the best strategy would be to identify the parts that depend on T, linearize them, put these parts implicitly into the T-equation using fvm-operations and only put the rest of the terms into the explicit source. Also sit down with pen and paper and see if the BC for J can be expressed in terms of T on the boundary. Then implement that BC for T. If you insist on having an all-explicit source term the way you do now you may need veeeery small time-steps (probably)

Yeah: if you know what you're doing a surfaceScalar-field for the flux is better than a volVector-field (see creation and usage of phi in the regular solvers)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 20, 2013, 05:55
Default
  #5
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 13
mmkr825 is on a distinguished road
Quote:
Originally Posted by gschaider View Post
slip has nothing to do with groovyBC. It is a standard-BC in OpenFOAM. Anyway: to set special boundary conditions for a field it is better to read that field from disc. Everything else is horrible to program.

For convergence: i can only be general here: you mentioned that the functions fX depend on T: the best strategy would be to identify the parts that depend on T, linearize them, put these parts implicitly into the T-equation using fvm-operations and only put the rest of the terms into the explicit source. Also sit down with pen and paper and see if the BC for J can be expressed in terms of T on the boundary. Then implement that BC for T. If you insist on having an all-explicit source term the way you do now you may need veeeery small time-steps (probably)

Yeah: if you know what you're doing a surfaceScalar-field for the flux is better than a volVector-field (see creation and usage of phi in the regular solvers)
Dear gschaider
Thanks for your reply. I'll go through your suggestion and let you know if i succeed.

Thanks
Regards
Mallikarjuna Reddy
mmkr825 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 07:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 06:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 08:49


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