# Viscous Force Calculation

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

 May 4, 2010, 04:23 Viscous Force Calculation #1 Member   John Wang Join Date: Mar 2009 Location: Singapore Posts: 71 Rep Power: 8 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(UName_); 00439 const volScalarField& p = obr_.lookupObject(pName_); 00440 00441 const fvMesh& mesh = U.mesh(); 00442 00443 const surfaceVectorField::GeometricBoundaryField& Sfb = 00444 mesh.Sf().boundaryField(); 00445 00446 tmp 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("RASProperties")) 00060 { 00061 const incompressible::RASModel& ras 00062 = obr_.lookupObject("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

 May 4, 2010, 04:59 #2 Member   John Wang Join Date: Mar 2009 Location: Singapore Posts: 71 Rep Power: 8 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

 Thread Tools 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 On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Ralf Schmidt FLUENT 2 May 17, 2010 15:49 enry Fluent UDF and Scheme Programming 1 November 15, 2009 11:53 terrybarnaby OpenFOAM Running, Solving & CFD 0 November 28, 2008 09:39 CFD FLUENT 0 March 7, 2006 02:03 AB CD-adapco 6 November 15, 2004 05:41

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