|
[Sponsors] |
November 7, 2016, 04:53 |
Vector Center Face ---> Cells
|
#1 |
Senior Member
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10 |
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, 09:21 |
|
#2 |
Senior Member
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10 |
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) ) Code:
void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } // const fvsPatchField<scalar>& phiap = // patch().lookupPatchField<surfaceScalarField, scalar>("phia"); const fvPatchField<vector>& Up = patch().lookupPatchField<volVectorField, vector>("U"); const fvPatchField<vector>& Uap = patch().lookupPatchField<volVectorField, vector>("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<IOdictionary>("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, 05:39 |
|
#3 |
Senior Member
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10 |
Hi again,
Can i use something like this? Is it right for my scope? Code:
vectorField r = patch().Cf()-(10 15 30); Code:
patch().Cf() Regards, Roberto |
|
November 14, 2016, 13:41 |
|
#4 | |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
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:
|
||
November 15, 2016, 05:29 |
|
#5 |
Senior Member
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10 |
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); Best Regards, Roberto |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
channelFoam for a 3D pipe | AlmostSurelyRob | OpenFOAM | 3 | June 24, 2011 13:06 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 19:43 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 11:55 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |