CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Applying a retarding shear in a row of cells for incompressible flows (https://www.cfd-online.com/Forums/openfoam-programming-development/253007-applying-retarding-shear-row-cells-incompressible-flows.html)

MMRC November 20, 2023 03:56

Applying a retarding shear in a row of cells for incompressible flows
 
Hello community,
Can you please give me your opinion in this implementation of 'retarding shear stress' proposed by Richard & Hoxey (1993) in the row of cells adyacent to wall that helps to minimize the over production of TKE and so the peak of TKE when plotting against vertical profile: shear = rho * (u_friction)²
I'm running simpleFoam, must I remove or keep rho (density) in the calculation of the source?
By using topoSetDict we can catch the first row of cells adyacent to ground patch (wall): first patchToFace and then setToCellZone.

Then, by using fvOptions codedVectorSource:
PHP Code:

retardingShear{    type            vectorCodedSource;    selectionMode   cellZone;    cellZone        areaSet;  // name of my cellZone    fields          (U);    writeToFile     true;    name            retardingShear;        codeCorrect        #{        #};    codeConstrain    #{    #};        codeInclude        #{        #};    codeAddSup            #{                vectorField& retardingShear = eqn.source();  // will asign calculation to source side of fvMatrix         vector Ufriction (-0.57 0 0); // is the friction velocity near wall         vector diskRetardingShear (-1 0 0); // is the direction opposite to normal wind flow                const labelList& cellIDs = cells();                forAll(cellIDs, i)                {                    label cellI = cellIDs[i];                            retardingShear[cellI] += mag(Ufriction)*diskRetardingShear; // the left side with += is thought to be 'a sink', AND the right side is the value of shear with its current direction                }} 

Is it good practice to combine '+=' (sink assigment) with the current direction of this retarding shear ?
I've seen that some user multiplies the sources term by cell volumes, when is this needed?
I apologize but I lost the original code and this code is what I remember that I could run.
Any ideas are welcome

MMRC November 22, 2023 10:28

Hello community,

Here is my code, in fact, it helped to lower the effect of over production of TKE


codedSource
{
type vectorCodedSource;
selectionMode cellSet;
cellSet groundCellSet;

fields (U);
name retardingshear;
codeInclude
#{
#};

codeCorrect
#{

#};
codeAddSup
#{

vectorField& Usource = eqn.source();
const scalarField& V = mesh_.V();
vector dir(-1,0,0);
// Apply the source
forAll(V, i)
{
// cell volume specific source
Usource[i] -= (0.1*V[i])*dir;
};

#};
codeConstrain
#{

#};
}


The value I used was thinking that I should have input of it without density , because I'll be using density. The use of volume of the cell is something that I copy someone used for their sources on other fields, maybe this is not correct.


Please share your comments, this supposed to be a 'retarding shear stress' applied to the cell adjacent to ground patch


All times are GMT -4. The time now is 14:30.