CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Viscous Force Calculation (http://www.cfd-online.com/Forums/openfoam-programming-development/75729-viscous-force-calculation.html)

cwang5 May 4, 2010 04:23

Viscous Force Calculation
 
Hi guys,

I'm trying to implement a force-balance type subroutine into the pimpleDyMFoam solver based on the code from forces.C. I am having trouble with the calculation of the viscous force, though, as the forces.C uses the following code for the viscous force:

Code:

00438        const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
00439        const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
00440
00441        const fvMesh& mesh = U.mesh();
00442
00443        const surfaceVectorField::GeometricBoundaryField& Sfb =
00444            mesh.Sf().boundaryField();
00445
00446        tmp<volSymmTensorField> tdevRhoReff = devRhoReff();
00447        const volSymmTensorField::GeometricBoundaryField& devRhoReffb
00448            = tdevRhoReff().boundaryField();
00449
00450        forAllConstIter(labelHashSet, patchSet_, iter)
00451        {
00452            label patchi = iter.key();
00453
00454            vectorField Md = mesh.C().boundaryField()[patchi] - CofR_;
00455
00456            vectorField pf = Sfb[patchi]*p.boundaryField()[patchi];
00457
00458            fm.first().first() += rho(p)*sum(pf);
00459            fm.second().first() += rho(p)*sum(Md ^ pf);
00460
00461            vectorField vf = Sfb[patchi] & devRhoReffb[patchi];
00462
00463            fm.first().second() += sum(vf);
00464            fm.second().second() += sum(Md ^ vf);
00465        }

since I will only use the solver under incompressible condition, the devRhoReff() should just be rho()*ras.devReff() with ras.devReff() obtained from RASModel.H based on the RAS model in RASProperties.
Code:

00059    else if (obr_.foundObject<incompressible::RASModel>("RASProperties"))
00060    {
00061        const incompressible::RASModel& ras
00062            = obr_.lookupObject<incompressible::RASModel>("RASProperties");
00063
00064        return rho()*ras.devReff();
00065    }

As I am not that familiar with the object oriented programming part of C++ (I have just switched over from using C), I am not sure how to define the obr_ objectRegistry pointer. Can someone point me to a source code/thread that contains such information? Thanks

John

cwang5 May 4, 2010 04:59

Solved... I must have been more sleep deprived than I thought I am...

Anyway, defining the devRhoReff() using rhoInf*turbulence->devReff() did the trick.

John


All times are GMT -4. The time now is 16:50.