CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Question about new viscosity Model (https://www.cfd-online.com/Forums/openfoam-programming-development/118119-question-about-new-viscosity-model.html)

Niels W. May 21, 2013 08:21

Question about new viscosity Model
 
Hi everyone,
I am quite new to openfoam and trying to build a new viscosity Model.

At the moment it is doing the same as the CrossPowerLaw.
I just added the output of the expression "CalcNu".

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::CrossWLF::calcNu() const
{
Info<< "CalcNU\n" << endl;
return (nu0_ - nuInf_)/(scalar(1) + pow(B_*strainRate(), n_)) + nuInf_;
}

I am little bit confused about the output, when i run the interFoam sovler.

"
....

Selecting incompressible transport model CrossTest
CalcNU

Selecting incompressible transport model Newtonian
CalcNU :confused:

...

Starting time loop

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.00119048
Time = 0.00119048

CalcNU

MULES: Solving for alpha1
Phase-1 volume fraction = 0.130194 Min(alpha1) = 0 Max(alpha1) = 1
MULES: Solving for alpha1
Phase-1 volume fraction = 0.130194 Min(alpha1) = 0 Max(alpha1) = 1
DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 0.00538103, No Iterations 1
time step continuity errors : sum local = 0.000862137, global = -1.4572e-12, cumulative = -1.4572e-12
DICPCG: Solving for p_rgh, Initial residual = 0.00241685, Final residual = 0.000103152, No Iterations 13
time step continuity errors : sum local = 3.6859e-05, global = -8.85469e-06, cumulative = -8.85469e-06
DICPCG: Solving for p_rgh, Initial residual = 0.000133469, Final residual = 8.00755e-08, No Iterations 50
time step continuity errors : sum local = 3.8946e-08, global = 4.00945e-09, cumulative = -8.85068e-06
CalcNU:confused:

ExecutionTime = 0.04 s ClockTime = 0 s

...."

First, why is in the Newtonian Model also the output? It should not access the new code?
Second, maybe i am blind, but why is there the output twice? I thought nu is only calculated once (in twoPhaseProperties.correct(); ).

Thanks a lot!
Best regards,
Niels

Tushar@cfd May 22, 2013 05:36

Quote:

Originally Posted by Niels W. (Post 428882)
Hi everyone,
I am quite new to openfoam and trying to build a new viscosity Model.

At the moment it is doing the same as the CrossPowerLaw.
I just added the output of the expression "CalcNu".

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::CrossWLF::calcNu() const
{
Info<< "CalcNU\n" << endl;
return (nu0_ - nuInf_)/(scalar(1) + pow(B_*strainRate(), n_)) + nuInf_;
}

I am little bit confused about the output, when i run the interFoam sovler.

"
....

Selecting incompressible transport model CrossTest
CalcNU

Selecting incompressible transport model Newtonian
CalcNU :confused:

...

Starting time loop

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.00119048
Time = 0.00119048

CalcNU

MULES: Solving for alpha1
Phase-1 volume fraction = 0.130194 Min(alpha1) = 0 Max(alpha1) = 1
MULES: Solving for alpha1
Phase-1 volume fraction = 0.130194 Min(alpha1) = 0 Max(alpha1) = 1
DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 0.00538103, No Iterations 1
time step continuity errors : sum local = 0.000862137, global = -1.4572e-12, cumulative = -1.4572e-12
DICPCG: Solving for p_rgh, Initial residual = 0.00241685, Final residual = 0.000103152, No Iterations 13
time step continuity errors : sum local = 3.6859e-05, global = -8.85469e-06, cumulative = -8.85469e-06
DICPCG: Solving for p_rgh, Initial residual = 0.000133469, Final residual = 8.00755e-08, No Iterations 50
time step continuity errors : sum local = 3.8946e-08, global = 4.00945e-09, cumulative = -8.85068e-06
CalcNU:confused:

ExecutionTime = 0.04 s ClockTime = 0 s

...."

First, why is in the Newtonian Model also the output? It should not access the new code?
Second, maybe i am blind, but why is there the output twice? I thought nu is only calculated once (in twoPhaseProperties.correct(); ).

Thanks a lot!
Best regards,
Niels

Can you please, elaborate your problem? Are you using already available tutorial? Or, you are trying to modify, as per your need..

It appears to me, that you are trying to add a new model to the existing libraries.

The other thing, Have you checked the "/constant" folder of your case? May be somewhere in transportProperties you might have missed something.

:)

Niels W. May 22, 2013 07:09

Hi Tushar@cfd,

atm i build a new viscosity model and adding it to the libraries. In this testversion, i only added the output "Info<< "CalcNU\n" << endl;".
so what i dont understand

First:
Why does the Newtonian model of the libraries generates the output:
CalcNu

It should not access the new model and therefore should not produce the output line, am i right?

Second:
In the calculation loop, there are 2 outputs and i dont know when and where the second calculation of nu comes from.

My code works. No problems with the transport properties or something like this. I just dont understand where the output in the Newtonian model comes from and why there are two outputs in one timestep.

br,
Niels

Tushar@cfd May 22, 2013 07:40

Quote:

Originally Posted by Niels W. (Post 429172)
Hi Tushar@cfd,

atm i build a new viscosity model and adding it to the libraries. In this testversion, i only added the output "Info<< "CalcNU\n" << endl;".
so what i dont understand

First:
Why does the Newtonian model of the libraries generates the output:
CalcNu

It should not access the new model and therefore should not produce the output line, am i right?

Second:
In the calculation loop, there are 2 outputs and i dont know when and where the second calculation of nu comes from.

My code works. No problems with the transport properties or something like this. I just dont understand where the output in the Newtonian model comes from and why there are two outputs in one timestep.

br,
Niels

Even, I don't know much about multiphase flows.
But, If you look at the interFoam(multiphase) you will find 2 phases(newtonian, non-newtonian)...

I think you want to run a complete non-newtonian fluid phase. Am I right? If yes, then try editing the transport file like this..

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
phase1
{
transportModel CrossWLF;

....

CrossWLF
{
....
.....
.....
}

}

....

:)

Niels W. May 22, 2013 07:51

Hi Tushar@cfd,

it has nothing to do with the transport file. The code workes.

I just dont understand why the Newtonian model produces the "CalcNu" output.
The Newtonian model is of the existing libraries.

This is the output after using the interFoam solver:
"
....

Selecting incompressible transport model CrossTest
CalcNU

Selecting incompressible transport model Newtonian
CalcNU <<<<< This output, should not be there. :confused::confused:

....
"
In my understanding it should look like this:
"
....

Selecting incompressible transport model CrossTest
CalcNU

Selecting incompressible transport model Newtonian

....
"

br,
Niels

Tobi May 22, 2013 08:29

Hi Niels,

well at the Moment I have no OpenFOAM on my Computer but as you said the Output should be on the Screen only once.

But, it could be possible that the thermodynamics of the second Phase is calling the calculation of nu from the first Phase again.

Have a look into the thermodynamics!
In the constructor you should see where the function is called the second time!


Tobi


All times are GMT -4. The time now is 08:03.