CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Viscous Force Calculation

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

LinkBack Thread Tools Display Modes
Old   May 4, 2010, 04:23
Default Viscous Force Calculation
John Wang
Join Date: Mar 2009
Location: Singapore
Posts: 71
Rep Power: 8
cwang5 is on a distinguished road
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:

00438         const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
00439         const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
00441         const fvMesh& mesh = U.mesh();
00443         const surfaceVectorField::GeometricBoundaryField& Sfb =
00444             mesh.Sf().boundaryField();
00446         tmp<volSymmTensorField> tdevRhoReff = devRhoReff();
00447         const volSymmTensorField::GeometricBoundaryField& devRhoReffb
00448             = tdevRhoReff().boundaryField();
00450         forAllConstIter(labelHashSet, patchSet_, iter)
00451         {
00452             label patchi = iter.key();
00454             vectorField Md = mesh.C().boundaryField()[patchi] - CofR_;
00456             vectorField pf = Sfb[patchi]*p.boundaryField()[patchi];
00458             fm.first().first() += rho(p)*sum(pf);
00459             fm.second().first() += rho(p)*sum(Md ^ pf);
00461             vectorField vf = Sfb[patchi] & devRhoReffb[patchi];
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.
00059     else if (obr_.foundObject<incompressible::RASModel>("RASProperties"))
00060     {
00061         const incompressible::RASModel& ras
00062             = obr_.lookupObject<incompressible::RASModel>("RASProperties");
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

cwang5 is offline   Reply With Quote

Old   May 4, 2010, 04:59
John Wang
Join Date: Mar 2009
Location: Singapore
Posts: 71
Rep Power: 8
cwang5 is on a distinguished road
Solved... I must have been more sleep deprived than I thought I am...

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

cwang5 is offline   Reply With Quote


Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how does Fluent calculate the pressure and viscous force vector? Ralf Schmidt FLUENT 2 May 17, 2010 15:49
Viscous force enry Fluent UDF and Scheme Programming 1 November 15, 2009 11:53
Forces viscous calculation in VWT with OpenFOAM 15x terrybarnaby OpenFOAM Running, Solving & CFD 0 November 28, 2008 09:39
pressure force and viscous force CFD FLUENT 0 March 7, 2006 02:03
Warning 097- AB CD-adapco 6 November 15, 2004 05:41

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