CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Flux Boundary Conditions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By nandiganavishal

Reply
 
LinkBack Thread Tools Display Modes
Old   December 2, 2008, 19:05
Default Hi All, I have a square dom
  #1
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Hi All,

I have a square domain and I am having the following equation

fvm::ddt(C1) == fvm::laplacian(D1,C1) + K1 * fvc::laplacian(Phi) * fvm::Sp(1.0,C1)+ K1 * (fvc::grad(Phi) & fvc::grad(C1))

where D1,K1 are constants...

Now I want to set b.cs at the wall of my C1 variable. The b.c is to set the flux = 0, which is given as

-D1*grad(C1) - K1*C1*grad(Phi) = 0

at the upperwall and lowerwall of the square domain. Can anyone help me out how exactly should I go about doing this.

Thanks

Regards

Vishal
ahmmed04 likes this.
nandiganavishal is offline   Reply With Quote

Old   December 3, 2008, 21:07
Default Hi, I saw your direct email c
  #2
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Hi,
I saw your direct email contact to me. I do not have so much to suggest without the knowledge of the physics you are trying to solve, but what looks strange to me is that you have three sets of equations on the boundaries
-D1*dC1/dx - K1*C1*dPhi/dx = 0
-D1*dC1/dy - K1*C1*dPhi/dy = 0
-D1*dC1/dz - K1*C1*dPhi/dz = 0
to determine C1 (assuming C1 is a scalar variable). If that in fact means a surface-normal gradient, you would be able to write a derived b.c. of mixed type.

Takuya
7islands is offline   Reply With Quote

Old   December 4, 2008, 13:13
Default Hi Takuya, >> "If that in f
  #3
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Hi Takuya,

>> "If that in fact means a surface-normal gradient, you would be able to write a derived b.c. of mixed type. "

Thanks a lot for the reply. May I know how exactly should we go about incorporating the above statement. (I am fairly new to OpenFoam). Could you tell me which tutorial I can follow or how exactly should I get started.

Kindly do the needful.

Thanks

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   December 4, 2008, 15:15
Default Dear Takuya, I just would l
  #4
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Dear Takuya,

I just would like to add on my previous mail. I would like to make flux in the normal direction to be zero. i.e since my problem is 2-d, i want to make flux in the y direction to be zero. Hence my equation is
-D1*dC1/dy - K1*C1*dPhi/dy = 0

or
-D1*dC1/dn - K1*C1*dPhi/dn = 0 in general where n is normal direction.

Kindly do the needful help.

Regards

Vishal Nandigana
nandiganavishal is offline   Reply With Quote

Old   December 11, 2008, 10:20
Default The mixed type bc code is in $
  #5
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
The mixed type bc code is in $FOAM_SRC/finiteVolume/fields/fvPatchFields/basic/mixed. You'll also find several examples of its derived types under $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived (grep -r mixedFvPatch is your friend). Besides if you have knowledge about basic C++ and a bit of persistence, they just should be more than enough.

T
7islands is offline   Reply With Quote

Old   December 11, 2008, 12:58
Default Thanks for the tip Takuya. I w
  #6
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Thanks for the tip Takuya. I will certainly go through it.


Vishal
nandiganavishal is offline   Reply With Quote

Old   February 6, 2009, 02:44
Default Dear Takuya, I have coded m
  #7
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Dear Takuya,

I have coded my flux boundary condition which I had mentioned before. The following is how my code looks, but I don't know why I get an error, I would like to know whether I have coded it in the correct way.. Kindly give your suggestions

Boundary condition code looks like this:


const polyPatchList& patches = mesh.boundaryMesh();

forAll (patches, patchI){

if(C1.boundaryField()[patchI].type()=="fixedGradient"){
fixedGradientFvPatchScalarField& nameOfYourChoice =
refCast<fixedgradientfvpatchscalarfield>(C1.bounda ryField()[patchI]);
scalarField& otherNameOfYourChoice = nameOfYourChoice.gradient();
otherNameOfYourChoice = -C1*Z1*fvc::snGrad(Phi);
}

}
Kindly let me know what is the mistake I am making... As the error I get is something like this

C1 Residual C2 Residual Phi Residual
Begin to solve C11#0 Foam::error::printStack(Foam::-Ostream&) in
"/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in
"/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted: [0xb7f12420]
#3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&,
Foam::UList<double> const&) in
"/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#4 Foam::operator/(Foam::UList<double> const&, Foam::UList<double>
const&) in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#5 Foam::fixedGradientFvPatchField<double>::evaluate( Foam::Pstream::commsTypes)
in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libfiniteVolume.so"
#6 Foam::GeometricField<double, Foam::fvPatchField,
Foam::volMesh>::GeometricBoundaryField::evaluate() in
"/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/electroosmoticF oam"
#7 Foam::fvMatrix<double>::solve(Foam::Istream&) in
"/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libfiniteVolume.so"
#8 main in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/electroosmoticF oam"
#9 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#10 Foam::regIOobject::readIfModified() in
"/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/electroosmoticF oam"
Floating point exception

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   February 6, 2009, 10:01
Default Hi Vishal, Not so sure as I h
  #8
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Hi Vishal,
Not so sure as I have never tried this way, but at least shouldn't
otherNameOfYourChoice = -C1*Z1*fvc::snGrad(Phi);
be
otherNameOfYourChoice = -nameOfYourChoice*Z1*fvc::snGrad(Phi);
?

Takuya
7islands is offline   Reply With Quote

Old   February 6, 2009, 13:34
Default http://www.cfd-online.com/Ope
  #9
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
ionFluxFvPatchScalarField.H
ionFluxFvPatchScalarField.C
C1
blockMeshDict

Dear Takuya,

Thanks a lot for your suggestion. I tried as you have suggested but I get the following error...

vishal@kiwi2:~/OpenFOAM/vishal-1.5/run/PNP_code_sending_to_jing/coupledFoam_modified/coupledFoam$ wmake
SOURCE=coupledFoam.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/vishal/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/coupledFoam.o
In file included from coupledFoam.C:69:
C1Eqn.H: In function 'int main(int, char**)':
C1Eqn.H:12: error: no match for 'operator*' in 'Foam::operator-(const Foam::UList<t>&) [with Type = double]() * Z1'
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionSet.H:266: note: candidates are: Foam::dimensionSet Foam::operator*(const Foam::dimensionSet&, const Foam::dimensionSet&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedScalar.H:56: note: Foam::dimensionedScalar Foam::operator*(const Foam::dimensionedScalar&, Foam::scalar)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/scalarField.H:81: note: Foam::tmp<foam::field<double> > Foam::operator*(const Foam::UList<double>&, const Foam::UList<double>&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/scalarField.H:81: note: Foam::tmp<foam::field<double> > Foam::operator*(const Foam::UList<double>&, const Foam::tmp<foam::field<double> >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/scalarField.H:81: note: Foam::tmp<foam::field<double> > Foam::operator*(const Foam::tmp<foam::field<double> >&, const Foam::UList<double>&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/scalarField.H:81: note: Foam::tmp<foam::field<double> > Foam::operator*(const Foam::tmp<foam::field<double> >&, const Foam::tmp<foam::field<double> >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/symmTensorField.H:70: note: Foam::tmp<foam::field<foam::vector<double> > > Foam::operator*(const Foam::UList<foam::symmtensor<double> >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/symmTensorField.H:70: note: Foam::tmp<foam::field<foam::vector<double> > > Foam::operator*(const Foam::tmp<foam::field<foam::symmtensor<double> > >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/tensorField.H:75: note: Foam::tmp<foam::field<foam::vector<double> > > Foam::operator*(const Foam::UList<foam::tensor<double> >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/tensorField.H:75: note: Foam::tmp<foam::field<foam::vector<double> > > Foam::operator*(const Foam::tmp<foam::field<foam::tensor<double> > >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/tensorField.H:76: note: Foam::tmp<foam::field<foam::tensor<double> > > Foam::operator*(const Foam::UList<foam::vector<double> >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/tensorField.H:76: note: Foam::tmp<foam::field<foam::tensor<double> > > Foam::operator*(const Foam::tmp<foam::field<foam::vector<double> > >&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedSymmTensor.H:68: note: Foam::dimensionedVector Foam::operator*(const Foam::dimensionedSymmTensor&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedTensor.H:74: note: Foam::dimensionedVector Foam::operator*(const Foam::dimensionedTensor&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedTensor.H:77: note: Foam::dimensionedTensor Foam::operator*(const Foam::dimensionedVector&)
/home/vishal/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/initContinuityErrs.H:38: warning: unused variable 'cumulativeContErr'
make: *** [Make/linuxGccDPOpt/coupledFoam.o] Error 1


Further, I also tried to incorporate the boundary condition as given in the tutorials where they have incorporated the traction boundary condition or chtmultiregion tutorials... I am attaching those files too... but even there I get some errors like


Reading field C1

keyword gradient is undefined in dictionary
"/home/vishal/OpenFOAM/vishal-1.5/run/electroosmotic_transient_navier_stokes_jing_code/electroosmoticFoam_Steady/0/C1::upperwall"

file: /home/vishal/OpenFOAM/vishal-1.5/run/electroosmotic_transient_navier_stokes_jing_code/electroosmoticFoam_Steady/0/C1::upperwall
from line 37 to line 41.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 213.

FOAM exiting

Kindly give your suggestions with regard to this....

Kindly do the needful.

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   February 6, 2009, 21:55
Default As to your solver complaining
  #10
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
As to your solver complaining about "keyword gradient is undefined in dictionary" in the entry upperwall, I do not see the boundaryField upperwall in your C1 file. Is this really the file in question? Anyway, as your ionNormalFlux BC is a derived type of fixedGradient you need a gradient entry as a placeholder. So the entry should look like

upperwall
{
type ionNormalFlux;
gradient uniform ...;
...
}
.

T
7islands is offline   Reply With Quote

Old   February 6, 2009, 22:10
Default Yep you need a gradient entry
  #11
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Yep you need a gradient entry in upperwall as I wrote in my previous post.

T
7islands is offline   Reply With Quote

Old   February 6, 2009, 22:14
Default Dear Takuya, Thanks for the
  #12
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Dear Takuya,

Thanks for the quick reply. So now does it look something like this...

upperwall
{
type ionNormalFlux;
Phi WallElectricField;
Zi Z1;
Di D1;
gradient uniform 0;

}

Thanks

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   February 7, 2009, 03:53
Default Hi Vishal, the error says t
  #13
Member
 
Luca M.
Join Date: Mar 2009
Location: Luzern, Switzerland
Posts: 59
Rep Power: 8
luca is on a distinguished road
Hi Vishal,

the error says that you search for an object (i.e. a volScalarField ) that is not yet instantiated. You have to be consistent in your creatFields.H and your class member "void Foam::ionFluxFvPatchScalarField::updateCoeffs()".

Moreover in your case you have not a clear coding: you search for a volScalarField Di_ that is defined as a word if I checked right and Di_ is a private data that you can access easily without "lookupPatchField". Foam in this case searches for a Di_ volScalarField defined in the main code that I guess is not what you want.

L.
luca is offline   Reply With Quote

Old   February 7, 2009, 13:00
Default Hi Luca, Thanks for the sug
  #14
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 9
nandiganavishal is on a distinguished road
Hi Luca,

Thanks for the suggestions..

Di_ is my transport property.. I have two variables D1 and D2 under my transport property...

Do could throw some light as to what exactly I have to do to solve my problem.. I am looking to incorporate a boundary condition like
grad(C1) = - Z1*C1*snGrad(Phi)/D1 = 0
grad(C2) = - Z2*C2*snGrad(Phi)/D2 = 0

Kindly suggest how I have to make changes in my files to solve my problem.. I am relatively new to OpenFOAM.

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   February 2, 2011, 20:10
Default
  #15
New Member
 
Kelvin
Join Date: Jan 2011
Posts: 5
Rep Power: 6
Kelvin_mk is on a distinguished road
Hi Vishal,

I have the same problem. I want to set the same flux BC at the wall. Did you write this type of b.c. in OpenFoam. I am very new to OpenFoam. I have to write this b.c. to solve my problem. I'm ver pleased if you reply to me.

Thank you very much...
Kelvin_mk is offline   Reply With Quote

Old   September 6, 2012, 13:03
Default About zero flux boundary condition...
  #16
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 5
mmkr825 is on a distinguished road
Hi everyone,
I am new to OpenFoam and i am doing my project on flow through channels. For my project i need to give zero flux boundary condition at walls (for variable T). And i applied zero flux in my governing equation and i got an expression like

grad(T)=f(T,strainRate)

where f=some function.

I saw your previous posts. I think you had found solution. please guide me how to write this boundary condition.
mmkr825 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what specified flux mean in boundary condition? lucy FLUENT 0 January 5, 2009 05:13
Heat Flux Boundary Conditions braennstroem OpenFOAM Running, Solving & CFD 7 November 27, 2008 11:44
Burgerbs equation non constant Boundary Conditions Initial Conditions arkangel OpenFOAM Running, Solving & CFD 1 October 2, 2008 14:48
Wall Heat Flux Boundaries conditions Abigail FLUENT 2 July 24, 2007 09:34
Integral boundary conditions turbulent intensitylength boundary conditions olesen OpenFOAM Running, Solving & CFD 0 July 27, 2006 07:18


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