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

 August 31, 2010, 10:51 Adding acceleration term in icoDyMFoam #1 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Hey guys, real simple question. My moving reference frame is accelerating -0.5*pi*A*T*sin(2*pi*t/T) in x-dirn and -sqrt(3)/2*pi*A*T*sin(2*pi*t/T) in y-dirn. A, T, pi are constants, t is time. I'm trying to add these to the momentum equation but it doesn't compile. Here's what I've got: Ueqn.H Code: ```volScalarField pi = 3.1415926535897932384626433832795028841971693993751; volVectorField acc = -pi*0.1091911*sin(2*pi*runtime.time().value()/1.091911)*(0.5*vector(1,0,0)+pow(3,0.5)*vector(0,1,0)); fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) - acc ); if (momentumPredictor) { solve(UEqn == -fvc::grad(p)); }``` What's wrong with it??

 September 1, 2010, 11:32 #2 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Ok....put it this way, 1. How can I create an empty volScalarField with dimensions acceleration? 2. How do I introduce the runtime class into Ueqn.H? (What header file do I need to introduce) I couldn't find any of this basic stuff in the programmer's guide...

 September 1, 2010, 16:41 #3 New Member   Ozgur Kirlangic Join Date: May 2009 Location: Istanbul Posts: 16 Rep Power: 10 Hi Pavan, I am not expert but if I make some comments on your code, I can say that: 1. I wouldn't define pi as volScalarField, because it is a constant scalar, not a field variable which has different values in time and space. So I think, Code: `scalar pi 3.1415926535897932;` would be sufficient. There might (/or not) also be an already defined macro for the number pi in OpenFOAM but I haven't used it before. 2. I wouldn't define acc as volVectorField neither (if I won't need to use it over and over, or do other calculations with it). Because, if you want to define a volVectorField, then (as far as I understood up to now) then also you will need to construct an IOobjet and make mesh association, defining the dimensions etc., such as: Code: ``` volVectorField acc ( IOobject ( "acc", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh );``` So the code gets more complicated, extra memory is used etc, etc... What can be done may be writing the acc formula directly into the Ueqn. However, I am not sure about how will the expressions like 0.5*vector(1,0,0) compiled. They might need to be verified separately. 3. I haven't used icoDyMFoam so I don't know anything about it, however, I have been using interDyMFoam for a while and I guess the "DyM" stands for dynamic mesh (and it maybe the same in icoDyMFoam). In interDyMFoam the mesh movement is imposed by an additional utility called gen6DoF, which is in turn equivalent to an extra acceleration term to UEqn. Since your acceleration term is also only a function of time, and is independent of space, use of gen6DoF explicitly might also be considered. Regards, Ozgur

 September 1, 2010, 17:43 #4 Member   Simon Lapointe Join Date: May 2009 Location: Québec, Qc, Canada Posts: 33 Rep Power: 10 Hi Pavan, Since your source term is constant in space you don't need to define a volVectorField, a simple vector would do it. You could try something like: Code: ```dimensionedVector accX ( "accX",dimensionSet(0, 1, -2, 0, 0),vector(1, 0, 0) ); dimensionedVector accY ( "accY",dimensionSet(0, 1, -2, 0, 0),vector(0, 1, 0) ); scalar Pi = mathematicalConstant::pi; dimensionedVector acc = -Pi*0.1091911*sin(2*Pi*runTime.value()/1.091911)*(0.5*accX+pow(3,0.5)*accY);```

 September 1, 2010, 18:37 #5 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Thanks, Ozgur! 1. Agreed about the scalar pi thing. 2. I don't know I was referring to this thread: http://www.cfd-online.com/Forums/ope...nce-frame.html (3rd post by Henry) where Fcent is defined as a volVectorField without being a field variable. 3. Yeah icoDyMFoam is just the dynamic mesh version of icoFoam, the incompressible fluid solver with no turbulence.

 September 1, 2010, 18:41 #6 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Also, thanks Simon! Will try this asap

 September 4, 2010, 12:18 #7 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Well, with the extra help of an experienced OF user I got the following to compile: Code: ```scalar Pi = mathematicalConstant::pi; dimensionedScalar accCt("accCt",dimensionSet(0,1,-2,0,0,0,0),10000*Foam::cos(2*Pi*runTime.value()/0.5)); dimensionedVector acc("acc",dimensionSet(0,1,-2,0,0,0,0), vector::zero); acc.component(vector::X) = 0.5 * accCt; acc.component(vector::Y) = 0.5 * Foam::sqrt(3.0) * accCt; fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); solve(UEqn == acc-fvc::grad(p));``` However the acceleration term added does not seem to have any effect whatsoever on the solution. I just start with a stationary 2d cylinder in a rectangular domain with no flow. Solution stays zero the whole time even with the sinusoidally varying acceleration term -- why?? Is there some part of the PISO loop I have to edit?

 September 18, 2010, 23:07 #8 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 I notice in dnsFoam the force term is implemented like so: Code: ``` fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) == acc ); solve(UEqn == -fvc::grad(p));``` As opposed to: Code: ``` fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); solve(UEqn == (acc-fvc::grad(p)));``` What is the difference? They give vastly differing results...

 September 18, 2010, 23:54 #9 Senior Member     su junwei Join Date: Mar 2009 Location: Xi'an China Posts: 151 Rep Power: 12 They are different. In the first, acc is introduced to momentum equation, and in the second acc was introduced into pressure equation and pressure equation should also be altered accordingly (if you don't include acc relative term in pressure, the results should differ much). If acc has effect on the velocity, doing in the second way is more implicit. please see derivation of pressure equation in Henrik Rusche's phd thesis. regards, Junwei

 September 20, 2010, 11:43 #10 Senior Member   Pavan Join Date: May 2009 Location: Melbourne Posts: 101 Rep Power: 10 Thanks for the reply Su Junwei! So I take it the first approach is valid but not as implicit as the second approach (with modification to the pressure equation)?

 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 Joseph CFX 14 April 20, 2010 15:45 fs82 OpenFOAM 6 September 23, 2009 03:29 segersson OpenFOAM Running, Solving & CFD 5 March 3, 2006 00:06 cfp CFX 0 July 14, 2002 10:43 tedmcc CFX 4 September 27, 2001 05:05

All times are GMT -4. The time now is 23:05.