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

Apply boundary condition functions

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2005, 15:50
Default Hello, Is there a way to ap
  #1
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
Hello,

Is there a way to apply boundary conditions as a function on specified patch?

Has anyone developed a code to do this?
billy is offline   Reply With Quote

Old   July 18, 2005, 17:16
Default This is the code I am trying t
  #2
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
This is the code I am trying to work with. I want to calculate the non-uniform boundary field of a patch named lid instead of the internal field. So I guess it would be something like:

U.boundaryField = vector(0, 0, 1)*Uz;

instead of:

U.boundaryField = vector(0, 0, 1)*Uz;

Can anyone please tell me the syntax because I can't find it anywhere.

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

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createDatabase.H"
# include "createMesh.H"
# include "createFields.H"

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

volScalarField Ux = mesh.C().component(vector::X);
volScalarField Uy = mesh.C().component(vector::Y);
volScalarField Uz = mesh.C().component(vector::Z);

U.internalField = vector(0, 0, 1)*Uz;
U.internalField = vector(1, 0, 0)*Ux;

U.write();

Info<< "End\n" << endl;

return(0);
}
billy is offline   Reply With Quote

Old   July 18, 2005, 18:07
Default This is the code I am trying t
  #3
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
This is the code I am trying to work with. I want to calculate the non-uniform boundary field of a patch named lid instead of the internal field. So I guess it would be something like:

U.boundaryField = vector(0, 0, 1)*Uz;

instead of:

U.internalField = vector(0, 0, 1)*Uz;

Can anyone please tell me the syntax because I can't find it anywhere.

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

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createDatabase.H"
# include "createMesh.H"
# include "createFields.H"

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

volScalarField Ux = mesh.C().component(vector::X);
volScalarField Uy = mesh.C().component(vector::Y);
volScalarField Uz = mesh.C().component(vector::Z);

U.internalField = vector(0, 0, 1)*Uz;
U.internalField = vector(1, 0, 0)*Ux;

U.write();

Info<< "End\n" << endl;

return(0);
}
billy is offline   Reply With Quote

Old   July 18, 2005, 18:54
Default Search for 'boundaryField' on
  #4
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Search for 'boundaryField' on this board.
mattijs is offline   Reply With Quote

Old   July 18, 2005, 19:57
Default This also does not work. //
  #5
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
This also does not work.

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

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createDatabase.H"
# include "createMesh.H"
# include "createFields.H"

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

label lidPatchID = mesh.boundaryMesh().findPatchID("lid");

//access boundary elements
const polyPatch& cPatch = mesh.boundaryMesh()[lidPatchID];

const vectorField& faceCentres = cPatch.faceCentres();

// Radial velocity
scalar omega = 10;

volScalarField Ux = +omega * faceCentres.component(vector::Z);
volScalarField Uz = -omega * faceCentres.component(vector::X);

//check boundary name
forAll (cPatch, faceI)
{
//calculate boundary velocity
U.boundaryField()[lidPatchID][faceI] = vector(Ux, 0.0, Uz);
}

U.write();

Info<< "End\n" << endl;

return(0);
}


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

Can anyone please help?
billy is offline   Reply With Quote

Old   July 18, 2005, 20:24
Default "Info" is your friend.
  #6
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
"Info" is your friend.
eugene is offline   Reply With Quote

Old   July 18, 2005, 20:33
Default OK. It is now fixed.
  #7
Senior Member
 
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17
billy is on a distinguished road
OK. It is now fixed.
billy is offline   Reply With Quote

Old   December 18, 2005, 22:22
Default Dear Billy, I am also tryi
  #8
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear Billy,

I am also trying to change the value of the X,Y and Z of U. I add the code in icoFoam.C, but it does not work yet. Could you please help me see.

Thanks a lot.
code:
forAll (centers, celli)
{
double angle = 45;
U.component(vector::X) = U.component(vector::X) * Foam::sin(angle);
U.component(vector::Y) = U.component(vector::Y) * Foam::cos(angle);
U.component(vector::Z) = U.component(vector::Z) * 0;
}
liugx212 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to apply a function as boundary condition coompressor OpenFOAM Running, Solving & CFD 9 February 12, 2009 11:22
How to apply a function as boundary condition coompressor OpenFOAM Running, Solving & CFD 0 January 13, 2009 04:50
How can apply mass flow rate boundary condition? Sima Phoenics 1 December 1, 2007 19:55
How Can I Apply Convective Boundary Conditions? noName FLUENT 0 March 31, 2005 17:00
How to apply heat flux condition L. Zhu FLUENT 2 January 8, 2003 11:16


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