# Vector Center Face ---> Cells

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 7, 2016, 05:53 Vector Center Face ---> Cells #1 Senior Member     Join Date: Mar 2016 Location: Bergamo Posts: 157 Rep Power: 7 Hello to all, i'm going to modify the equations at the boundary to run an adjoint simulation. One of these equations includes a term r which is defined as the position vector starting from the center of the outlet surface. I know the face center can be accessed by the function Cf() but i don't know how to set it for the entire outlet boundary and for the single cell. Could someone help me defyning it? Thanks for help, Roberto

 November 9, 2016, 10:21 #2 Senior Member     Join Date: Mar 2016 Location: Bergamo Posts: 157 Rep Power: 7 Sorry for Bump, i have not resolved the problem yet here my equation: Code: `u_tw = 1/(v_n - nu/h)*(-nu/h*u_(tw-1) + 2*(n x r)/|| r x v_t ||^(3) )` and here what i implemented Code: ```void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } // const fvsPatchField& phiap = // patch().lookupPatchField("phia"); const fvPatchField& Up = patch().lookupPatchField("U"); const fvPatchField& Uap = patch().lookupPatchField("Ua"); const scalarField& deltainv = patch().deltaCoeffs(); // Distance^(-1) vectorField Uaneigh = Uap.patchInternalField(); // Vettore vectorField Uaneigh_n = (Uaneigh & patch().nf())*patch().nf(); // Normale vectorField Uaneigh_t = Uaneigh - Uaneigh_n; // Tangente vectorField Up_n = (Up & patch().nf())*patch().nf(); // Normale vectorField Up_t = Up - Up_n; // Tangente scalarField U_t = mag(Up_t); scalarField U_n = mag(Up_n); vectorField n = patch().nf(); scalar nu = readScalar(db().lookupObject("transportProperties").lookup ("nu")); vectorField :: operator = (1 /(U_n - nu * deltainv) * (-nu * Uaneigh_t * deltainv + 2*(n^Uaneigh) / pow (mag(Uaneigh ^ Up_t),3))); fixedValueFvPatchVectorField::updateCoeffs(); }``` I have only to define r

 November 10, 2016, 06:39 #3 Senior Member     Join Date: Mar 2016 Location: Bergamo Posts: 157 Rep Power: 7 Hi again, Can i use something like this? Is it right for my scope? Code: `vectorField r = patch().Cf()-(10 15 30);` Where Code: `patch().Cf()` is the face cell center (if i understood the command) coordinates and (10 15 30) the center coordinates of my boundary. Unfortunately it gives me an error i think it could derived from how i define the vector (10 15 30); Regards, Roberto

November 14, 2016, 14:41
#4
Senior Member

Mahdi Hosseinali
Join Date: Apr 2009
Posts: 272
Rep Power: 15
Hi,
To get the center of the patch try using a bounding box, then average the limits. it would be your center. For the code you have up there, change it to this:

Quote:
 vectorField r = patch().Cf()-vector(10 15 30);

 November 15, 2016, 06:29 #5 Senior Member     Join Date: Mar 2016 Location: Bergamo Posts: 157 Rep Power: 7 Hi Mahdi, thanks for your reply. Your solution is almost perfect but it's necessary to insert a comma between the elements vectors. Code: `vectorField r = patch().Cf()-vector(10,15,30);` Many thanks. Best Regards, Roberto

 Thread Tools Search this Thread Search this Thread: Advanced Search 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 Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06 [snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43 SSL FLUENT 2 January 26, 2008 12:55 [blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00

All times are GMT -4. The time now is 22:20.

 Contact Us - CFD Online - Privacy Statement - Top