Hello,
Is there a way to ap
Hello,
Is there a way to apply boundary conditions as a function on specified patch? Has anyone developed a code to do this? |
This is the code I am trying t
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); } |
This is the code I am trying t
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); } |
Search for 'boundaryField' on
Search for 'boundaryField' on this board.
|
This also does not work.
//
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? |
"Info" is your friend.
"Info" is your friend.
|
OK. It is now fixed.
OK. It is now fixed.
|
Dear Billy,
I am also tryi
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; } |
All times are GMT -4. The time now is 05:31. |