CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   moving reference frame - weird results! (http://www.cfd-online.com/Forums/openfoam/91024-moving-reference-frame-weird-results.html)

Amir July 28, 2011 03:53

moving reference frame - weird results!
 
Hi experts,

I'm a newbie in OF and I have tried to change simpleFoam solver to achieve oscillatory reference frame, it seems that it's not a big deal but I faced weird results.
I did these changes:

Code:

scalar Pi = mathematicalConstant::pi;
                    dimensionedVector omega
                        (
                      "omega",
                      dimensionSet(0, 0, -1, 0, 0, 0, 0),
                      vector (0.0, 0.0, (amp*(2.0*Pi*freq)*Foam::cos((2.0*Pi*freq)*runTime.value())))
                    );
                    dimensionedVector alpha
                        (
                      "alpha",
                      dimensionSet(0, 0, -2, 0, 0, 0, 0),
                      vector (0.0, 0.0, (-amp*pow(2.0*Pi*freq,2)*Foam::sin((2.0*Pi*freq)*runTime.value())))
                    ); 
volVectorField source = (2.0*omega ^ U) + (omega ^ (omega ^ mesh.C())) + (alpha ^ mesh.C());

and:

Code:

  tmp<fvVectorMatrix> UEqn
    (
                        fvm::ddt(U)
                + fvm::div(phi, U)
                - fvm::laplacian(nu, U)
                == -source
    );

did I make any mistake? :confused:
Any suggestion or experience in this field is really appreciated.

Amir

Amir July 29, 2011 01:54

I'm waiting for your kind response .....

alberto July 30, 2011 03:21

Oscillatory system (=unsteady) in steady state solver (simpleFoam)?

Amir July 30, 2011 04:23

Quote:

Originally Posted by alberto (Post 318120)
Oscillatory system (=unsteady) in steady state solver (simpleFoam)?

Dear Alberto,

I have added the transient term to UEqn., fvm::ddt(U); I have used unsteady simpleFoam instead of icoFoam because it's more stable and I could use larger time steps. Do you mean this procedure is incorrect?


Amir

alberto July 30, 2011 04:34

Are you doing sub-interations inside each time step? You can find it already done in pimpleFoam.

Best,

Amir July 30, 2011 04:44

Quote:

Originally Posted by alberto (Post 318124)
Are you doing sub-interations inside each time step? You can find it already done in pimpleFoam.

Best,

Is it really necessary? pimpleFoam is a combination of piso and simple algorithms and I don't want to engage in small time steps?!

Thanks

alberto July 30, 2011 15:32

Hi,

to answer your question you should know if your system reaches a steady state or not. Since it is intrinsically unsteady, it might never reach one.

Anyway, to use SIMPLE for unsteady calculations you should:
  1. Start the time step
    1. Define UEqn
    2. Relax and solve UEqn
    3. Define fluxes
    4. Solve pEqn
    5. Correct fluxes
    6. Explicitly relax p
    7. Correct U
    8. Repeat from 1 until convergence at the given time-step is reached
  2. Advance time-step
PIMPLE is a combination of SIMPLE and PISO for unsteady calculations with larger time-steps or for pseudo-transient cases, which is why I suggested it.

Best,

Amir July 30, 2011 15:45

Dear Alberto,

Thanks a lot for your valuable comments.


Amir

Amir August 3, 2011 07:29

4 Attachment(s)
Dear Alberto,
I did your recommandations, but now, I have a problem in convergency.
I change both pimpleFoam and also pisoFoam but convergency issues exist. I couldn't reduce initail residuals in this case, consequently, there are some differences between results and analytic solution.
Do you have any recommendation about another schemes or others?
I used different grids and also schemes but I couldn't achieve better convergency.

alberto August 3, 2011 10:17

The residual behaviour seems to show the solution is oscillating, which might indicate also a problem in the case setup.

However, you are using inconsistent numerical schemes:

  1. "linearUpwind" should use the same gradient scheme you use for the variable, so: "div(phi, U) Gauss linearUpwindV leastSquares".
  2. you should use "linear" instead than "fourth" for Laplacian.
My two cents: start with "Euler" for time integration, and use "cellLimited Gauss linear 1" for gradients, and, if necessary, upwind for convection.

Best,

Amir August 3, 2011 11:39

Quote:

Originally Posted by alberto (Post 318720)
The residual behaviour seems to show the solution is oscillating, which might indicate also a problem in the case setup.

However, you are using inconsistent numerical schemes:

  1. "linearUpwind" should use the same gradient scheme you use for the variable, so: "div(phi, U) Gauss linearUpwindV leastSquares".
  2. you should use "linear" instead than "fourth" for Laplacian.
My two cents: start with "Euler" for time integration, and use "cellLimited Gauss linear 1" for gradients, and, if necessary, upwind for convection.

Best,

Thank you very much Alberto,
Although the results are better know but there are some differences between this results and analytic one.
Anyway, I just want to ensure that whether the solution is converged or not; you said before that in unsteady cases, initial residuals should be around 0.001. Is this criteria acceptable in such cases (oscillatory nature)? (if your answer is No; how can we ensure that the solution is converged?)

Thanks again

alberto August 3, 2011 11:53

Yes, if you perform an unsteady calculation, the residuals should go down at each time step, until they reach the specified tolerance.

Residuals clearly won't do that in a steady-state solver, simply because your system does not have a steady state solution.

Best,

Amir August 3, 2011 14:35

Quote:

Originally Posted by alberto (Post 318739)
Yes, if you perform an unsteady calculation, the residuals should go down at each time step, until they reach the specified tolerance.

Residuals clearly won't do that in a steady-state solver, simply because your system does not have a steady state solution.

Best,

I imply from your answer that my result hasn't converged yet ... . I think you mean that initial residuals should oscillate around desired criteria, right? it's very difficult to reach this point even with your recommended schemes and different grids and time steps.:(

Amir August 6, 2011 11:32

Dear friends,
The problem is solved by implementing transientSimpleFoam solver instead of pimpleFoam or icoFoam.

Thanks

alberto August 6, 2011 16:33

Were you having problems with pimpleFoam? If yes, what kind of problems? There should be little difference compared to a "transient SIMPLE".

Amir August 7, 2011 03:15

Quote:

Originally Posted by alberto (Post 319150)
Were you having problems with pimpleFoam? If yes, what kind of problems? There should be little difference compared to a "transient SIMPLE".

Hi,

As I said before, my problem in both pimpleFoam and icoFoam was reducing initial residuals of p and U, I tried different schemes and solution controls and also time steps but I didn't achieve acceptable result particularly peak values in analytic solution; on the other hand, by transientSimpleFoam and with the same time step and schemes I achieved nice results matched with analytic one and both residuals reduced to about 0.01; I know that PISO algorithm is more precise that SIMPLE one but maybe my management for this algorithm was not efficient!
Can you explain the reason of that?

alberto August 7, 2011 03:29

Are you using the same relaxation factors in pimpleFoam and transient SIMPLE?

If the setup is the same, they should give the same result.

Amir August 7, 2011 04:22

Quote:

Originally Posted by alberto (Post 319169)
Are you using the same relaxation factors in pimpleFoam and transient SIMPLE?

If the setup is the same, they should give the same result.

Of course it is; URF,schemes,... are similar, even I examine pimpleFoam with lower time steps than transienSimpleFoam but the results are not acceptable. Maybe pimpleFoam needs different schemes for better convergence and accuracy.


Thanks,


All times are GMT -4. The time now is 21:52.