# DDt

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

 August 14, 2006, 19:49 Is it possible to take the tot #1 Member   Shaun Cooper Join Date: Mar 2009 Posts: 54 Rep Power: 8 Is it possible to take the total derivative of a volVectorField and volScalarField (different equations of course). If not are there any suggestions as to how to overcome this? Also, is it possible to take the time derivative the magnitude of a vector dot product? (ie. ddt(magSqr(U)) where U is the velocity vector?) Thanks in advance, Shaun

 August 15, 2006, 04:35 You can do fvc::ddt(magSqr(U)) #2 Senior Member   Eugene de Villiers Join Date: Mar 2009 Posts: 725 Rep Power: 12 You can do fvc::ddt(magSqr(U)), but not fvm::ddt(magSqr(U)), i.e. you can calculate the term explicitly. What are you ttrying to calculate anyway? Artur likes this.

 August 15, 2006, 04:45 Beep! Not like that: think ab #3 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,758 Rep Power: 21 Beep! Not like that: think about it. In order to successfully evaluate the ddt term, you need to have stored the old-time level. This means the field of which you wish to evaluate the ddt must exist outside the time loop and rely on the oldTime() mechanism to correctly (and automatically) store the old-time level when time is incremented. In your case, magSqr(U) is a TEMPORARY, just created for you. Thus, if you try to evaluate the ddt the way it is written, it will recognise that the field does not have the oldTime() level stored and will use the current value to initialise it. Basically, fvc::ddt(magSqr(U)) will always give you zero, which is wrong. What you need to do is create a field magSqrU outside the time loop, set it to magSqr(U) in each time-step and then evaluate fvc::ddt(magSqrU). The comment on fvc and fvm is, of course, correct. Thanks Eugene. Hrv mm.abdollahzadeh, pfhan, brucechen and 4 others like this. __________________ Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk

 August 15, 2006, 04:49 You learn something every day. #4 Senior Member   Eugene de Villiers Join Date: Mar 2009 Posts: 725 Rep Power: 12 You learn something every day.

 August 15, 2006, 04:51 :-) Sounds good to me - I'll h #5 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,758 Rep Power: 21 :-) Sounds good to me - I'll have a look at your stuff to learn how to get nice pictures out of my LES data. Hope I didn't upset you. Hrv __________________ Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk

 August 15, 2006, 18:06 Thanks for all the help on the #6 Member   Shaun Cooper Join Date: Mar 2009 Posts: 54 Rep Power: 8 Thanks for all the help on the time derivative of magSqr( U ) field. Shaun

 August 15, 2006, 18:13 Is it at all possible to take #7 Member   Shaun Cooper Join Date: Mar 2009 Posts: 54 Rep Power: 8 Is it at all possible to take the Lagrangian (or Convective) derivative of a volScalarField (in one equation) and of a volVectorField (in another equation)? I wish to take the Lagrangian derivative of the velocity vector U and of Temperature T. However, when I try to use: fvc::DDt(U) + .... error: no matching function for call to 'DDt(Foam::volVectorField&)' and for T: fvc::DDt(T)+.... error: no matching function for call to 'DDt(Foam::volScalarField&)' Is it possible to take the Lagrangian derivatives of these fields? If not, how does one overcome this? Do you need to code in the convective term? Thanks once again, Shaun

 August 21, 2006, 14:22 Shaun, The only way that I kn #8 Member   David P. Schmidt Join Date: Mar 2009 Posts: 70 Rep Power: 8 Shaun, The only way that I know to do this is by hand. Use the fact that DDt(T) is fvc::ddt(T)+ (U & fvc::grad(T)) Note the extra parentheses with the dot product. The precedence of the & operator is not what you would expect, but is rather determined by the limitations of C++. Also keep in mind that this is not strongly conservative...you may run into trouble if this DDT is fed back into your numerical scheme. You also have the option of using the continuity equation, combined with the definition of DDT to reformulate this into strongly conservative form. ahmmed04 likes this.

 August 21, 2006, 14:31 One other thing....if you use #9 Member   David P. Schmidt Join Date: Mar 2009 Posts: 70 Rep Power: 8 One other thing....if you use the continuity equation and produce the conservative form, you have the option of doing this implicitly. For example, with constant density flow, you could get fvm::ddt(T)+fvm::div(phi,T) where phi is flux. ahmmed04 likes this.

 August 21, 2006, 19:04 David, Thanks for your help #10 Member   Shaun Cooper Join Date: Mar 2009 Posts: 54 Rep Power: 8 David, Thanks for your help so far. However, I am new to both OpenFOAM and the FVM. Can you please explain a little more what you meant by "Also keep in mind that this is not strongly conservative...you may run into trouble if this DDT is fed back into your numerical scheme. You also have the option of using the continuity equation, combined with the definition of DDT to reformulate this into strongly conservative form." Thanks in advance, Shaun

 August 22, 2006, 03:44 Its to do with the discretisat #11 Senior Member   Gavin Tabor Join Date: Mar 2009 Posts: 181 Rep Power: 8 Its to do with the discretisation of the U & fvc::grad(T) term. In the FVM we discretise this using Gauss theorem, converting it into fluxes into and out of the domain. If we discretise the term written like this then it is not guaranteed to preserve conservation of the quantity being advected (here essentially the energy); i.e. your derivative may be loosing or gaining energy. If you do some manipulation of the term to get it into the form fvc::div(phi, T) where phi is essentially the same as U, then when we apply Gauss we get something which preserves continuity at the _numerical_ level, rather than the mathematical level. This would be a strong conservative implementation. Gavin

 September 6, 2006, 08:51 To add to Gavin's explanation #12 Member   David P. Schmidt Join Date: Mar 2009 Posts: 70 Rep Power: 8 To add to Gavin's explanation and to address your question further, strong conservation is a property of an advection scheme; the concept of strong conservation is not specific to OpenFOAM. If a scheme is strongly conservative, then all the fluxes in the whole domain cancel out perfectly to give you the following result: Change in quantity in domain = Inflow at boundaries - outflow at boundaries Without the property of strong conservation, numerical error can generate or destroy small amounts of whatever quantity you are advecting. This makes physical sense and is a very nice property to have for your scheme. ahmmed04 likes this.

 June 13, 2008, 13:07 An addition to my previous com #13 Member   David P. Schmidt Join Date: Mar 2009 Posts: 70 Rep Power: 8 An addition to my previous comments. Here is an example using OpenFOAM's built-in total derivative operator to find the total derivative of pressure. volScalarField DpDt = fvc::DDt(phiv,p)

 September 4, 2008, 05:06 Hi, The different naming sy #14 Senior Member     Daniel WEI (老魏) Join Date: Mar 2009 Location: South Bend, IN, USA Posts: 688 Blog Entries: 9 Rep Power: 12 Hi, The different naming system of ddt in many textbooks and website makes me quite confused. 1. Could anyone help me out by telling me which ddt scheme is Adams-Bashforth method? 2. I am trying to solve a flow past square-cylinder case with LES, which ddt scheme is supposed to be better? 3. When should I use bounded-backward-differencing ddt, and when backward-differencing? Please help! Thanks in advance. Daniel __________________ ~ Daniel WEI ------------- NatHaz Modeling Laboratory Department of Civil & Environmental Engineering & Earth Sciences University of Notre Dame, USA Email || My Personal CFD Blog

 November 23, 2009, 08:47 #15 New Member   Ali Sh Join Date: Jun 2009 Location: London Posts: 28 Rep Power: 8 Hi there, can anyone check the following equation: fvc:Dt(U, p) = fvc::ddt(p) + fvc::div(p*U) - p * fvc::div(U) Is that right? Thanks

 November 23, 2009, 08:47 #16 New Member   Ali Sh Join Date: Jun 2009 Location: London Posts: 28 Rep Power: 8 Hi there, can anyone check the following equation: fvc:: DDt(U, p) = fvc::ddt(p) + fvc::div(p*U) - p * fvc::div(U) Is that right? Thanks ahmmed04 likes this.

 December 2, 2009, 11:36 What is DDt, #17 Member   Hamed Aghajani Join Date: Mar 2009 Location: London, UK Posts: 77 Rep Power: 8 According to Full energy equation for enthalpy you are right. fvcDt(U, p) = fvc::ddt(p) + fvc::div(p*U) - p * fvc::div(U)

 December 2, 2009, 11:43 #18 New Member   Ali Sh Join Date: Jun 2009 Location: London Posts: 28 Rep Power: 8 The term (fvm::div(phi, h)) largely affects the solution of energy equation and the iteration has stopped after time steps. Any idea? This is the energy equation file hEqn: volTensorField tau = - nu * (gradU + gradU.T()) + (2.0/3.0 * nu * fvc::div(U)) * I; volScalarField tauGradU = tau && gradU; solve ( //fvm::ddt(rho, h) fvm::div(phi, h) //- h * fvc::div(phi) - fvm::laplacian(kl/Cp, h) == //fvc:Dt(phi, p) //fvc::ddt(p) fvc::div(phi/fvc::interpolate(rho) * fvc::interpolate(p)) //fvc::div(phi, p) - p * fvc::div(phi/fvc::interpolate(rho)) - tauGradU ); Courant Number mean: 0.0804511 max: 18829.1 GAMG: Solving for Ux, Initial residual = 0.20952, Final residual = 9.95384e-11, No Iterations 7 GAMG: Solving for Uy, Initial residual = 0.359518, Final residual = 2.31641e-11, No Iterations 8 GAMG: Solving for h, Initial residual = 0.228348, Final residual = 3.69123e+40, No Iterations 20 max(h): 3.22617e+46 min(h): -2.78718e+43 max(T): 1.54762e+43 min(T): -1.33703e+40 GAMG: Solving for p, Initial residual = 0.000963211, Final residual = 0.00317673, No Iterations 20 time step continuity errors : sum local = 0.00137243, global = -4.07819e-06, cumulative = -6.1801e-06 ExecutionTime = 4.55 s ClockTime = 4 s Maximum Pressure = 0.41629, MPa Time = 0.0003 Courant Number mean: 0.150658 max: 34559.5 GAMG: Solving for Ux, Initial residual = 0.109642, Final residual = 5.37149e-11, No Iterations 7 GAMG: Solving for Uy, Initial residual = 0.284941, Final residual = 2.12644e-11, No Iterations 8 #0 Foam::error:rintStack(Foam::Ostream&) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

 February 10, 2011, 12:00 DDt(U,x) DDt(phi,x) DDt (phi//fvc::interpolate(rho),x)? #19 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 174 Rep Power: 7 So what's the correct implementation, if I'm looking for Langangian derivative for a scalar X (DxDt): Code: fvc::DDt(phi,x) or Code: fvc::DDt(U,x) ? And why in i.e. rhoPisoFoam there is an expression: Code: DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); Why is phi divided by rho? DDt(U,x)? DDt(phi,x)? DDt (phi//fvc::interpolate(rho),x)? Regards, Ilya ahmmed04 likes this.

 February 11, 2011, 07:25 #20 Senior Member   Illya Shevchuk Join Date: Aug 2009 Location: Darmstadt, Germany Posts: 174 Rep Power: 7 I tried it out in OF 1.7.1: DDt(U,x) can't be compiled, DDt(phi,x) can. I still don't understand the meaning of DpDt = fvc:: DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); Edit: Got it: because phi isn't a volume but a mass flux in this case. And as I computed DDt(phi,rho) or DDt(phi, alpha1) in interFoam after solving the convection of alpha1, I expected 0 to come out for entire flow because we are dealing with incompressible convective transport problem, but instead of this the result was different: Is it because of the interface compression, which affects the alpha1 and consequently the rho fields, but doesn't affect the fluxes phi? Last edited by linch; February 11, 2011 at 10:49.

 Tags ddt, lagrangian derivative

 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

All times are GMT -4. The time now is 04:39.