|
[Sponsors] |
July 18, 2005, 15:50 |
Hello,
Is there a way to ap
|
#1 |
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17 |
Hello,
Is there a way to apply boundary conditions as a function on specified patch? Has anyone developed a code to do this? |
|
July 18, 2005, 17:16 |
This is the code I am trying t
|
#2 |
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17 |
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); } |
|
July 18, 2005, 18:07 |
This is the code I am trying t
|
#3 |
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17 |
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); } |
|
July 18, 2005, 18:54 |
Search for 'boundaryField' on
|
#4 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Search for 'boundaryField' on this board.
|
|
July 18, 2005, 19:57 |
This also does not work.
//
|
#5 |
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17 |
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? |
|
July 18, 2005, 20:24 |
"Info" is your friend.
|
#6 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
"Info" is your friend.
|
|
July 18, 2005, 20:33 |
OK. It is now fixed.
|
#7 |
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 17 |
OK. It is now fixed.
|
|
December 18, 2005, 22:22 |
Dear Billy,
I am also tryi
|
#8 |
Senior Member
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17 |
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; } |
|
|
|
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 |