# problem when decomposing the velocity flux according to the x, y and z directions..

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

 January 24, 2011, 06:48 [solved]problem when decomposing velocity flux according to the x, y and z directions #1 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 262 Rep Power: 11 Hi! I would like to decompose the velocity flux phi into 3 flux, one for each direction: Code: `phi = phi_x + phi_y + phi_z` To do that, I defined phi_x, phi_y and phi_z as: Code: ```surfaceScalarField phi_x = linearInterpolate(U.component(vector::X)*vector(1,0,0)) & mesh.Sf(); surfaceScalarField phi_y = linearInterpolate(U.component(vector::Y)*vector(0,1,0)) & mesh.Sf(); surfaceScalarField phi_z = linearInterpolate(U.component(vector::Z)*vector(0,0,1)) & mesh.Sf();``` Then I update these fields at each time step with the above definition. However, the field Code: `phiTest = phi - (phi_x+phi_y+phi_z)` is not equal to "zero". Which (I suppose) yields in divergence for my applications... Is someone know how to do such a thing ? I was wondering is there is a way to get these fields from the fvScalarMatrix pEqn exactly in the same manner we update the phi flux field : In OpenFOAM, we get the phi flux from the pEqn matrix: Code: ```fvScalarMatrix pEqn ( fvm::laplacian(-M,p) ); pEqn.setReference (....); pEqn.solve(); phi = pEqn.flux();``` I was wondering is there is a way to get these fields (phi_x, phi_y, phi_z) from the fvScalarMatrix pEqn in similar manner ?? Best regards, Cyp PS: in my example, M is a volTensorField Last edited by Cyp; January 25, 2011 at 06:33.

 January 24, 2011, 15:46 #2 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 262 Rep Power: 11 I found a solution : from phi = pEqn.flux() I can create phix, phiy and phiz. First, I defined a flux phi_ex with 1 on the faces concerning x and 0 elsewhere. I can create this flux with this snippet: Code: ``` volVectorField E ( IOobject ( "E", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedVector ("E",dimensionSet(0,0,0,0,0),vector::zero) ); E = vector(1,0,0); surfaceScalarField phi_ex = linearInterpolate(E) & mesh.Sf() / mesh.magSf();``` then I can get phix from phi using : Code: `phix = phi * phi_ex;` And I repeat the operation for y and z. However, I still have problem on my outlet BC....

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post kabat73 FLUENT 8 May 9, 2010 04:26 wanie Fluent UDF and Scheme Programming 0 December 11, 2009 11:40 William177 FLUENT 1 February 3, 2008 07:47 Vedavyasa M FLUENT 0 June 28, 2007 06:33 Geremi FLUENT 0 April 19, 2005 02:13

All times are GMT -4. The time now is 09:48.