CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Diverging result for Temperature field in interFoam (https://www.cfd-online.com/Forums/openfoam-solving/69103-diverging-result-temperature-field-interfoam.html)

thejaraju December 23, 2013 00:12

Yes i will surely try and reply you................

I hope it works well

Please also find the visoelasticInterfoam solvers which i am attaching with the reply

Thank you very much for the reply

Regards

Thejaraju.R

thejaraju December 23, 2013 00:19

Quote:

Originally Posted by Bernhard (Post 467036)
You are working in OpenFOAM 2.2.x. The solver you are trying to compare has probably been developed for some older of version of OpenFOAM. Please check what has been changed between this previous version and the one you are using. Incorporate these changes in the solver you are trying to compile. Then you're done :)


Thankyou very much reply .........

I will definitely check this and come back to you

denhelden April 7, 2014 06:09

Hi,

few questions about the InterTempFoam-Solver:

- For which OpenFoam Version the Solver is written?
- Did anybody write a version for 2.2?
- Does anybody have a test case for the solver he likes to share?

and for my understanding:

- why does the solver uses PISO instead of PIMPLE like the actual InterFoam?

Thank you for answering
Regards,
Thilo

seju April 8, 2014 17:21

Quote:

Originally Posted by ovie (Post 280670)
Please check your inbox!
Good luck..

hi ovie
I have same problem can you send me too.
my Email is :sajad.khodadadi23@yahoo.com
thanks alot

ovie April 8, 2014 17:47

Quote:

Originally Posted by seju (Post 484771)
hi ovie
I have same problem can you send me too.
my Email is :sajad.khodadadi23@yahoo.com
thanks alot

Not sure what problem you are referencing. Can you please be more specific?

seju April 9, 2014 01:54

Quote:

Originally Posted by ovie (Post 484778)
Not sure what problem you are referencing. Can you please be more specific?

thanks ovie for reply.
I wanna compile incomprissileTwoPhaseThermalMixture at frist but I cant do that.
can you help me how can I compile that?
my problem similar the Thread 53.
this is my mail: sajad.khodadadi23@yahoo.com
thanks a lot
Sajad

becklei April 30, 2014 05:24

hi ovie,

I try to add the energy equation to my interFoam, which is used to simulate the polymer injection process. I have implemented the two mentioned energy equation, and both results are still undesirability. let me introduce my code:

1. d(rho*T)/dt + div(rho*V*T) = div((kappa/cp)*grad T) + source terms/cp

In my code, this equation is written as:
fvm::ddt(rho,T) +fvm::div(rhoPhi,T)-fvm::laplacian((kappa/Cp),T)==(mu/Cp)*magSqr(fvc::grad(U))
1) rho and rhoPhi is created in the createFields.H just like the source code, and surfaceScalarField rhoPhi is updated after the alphaEqn.H
2) Kappa is the mixture value of the two phase(liquid, Kappa1 [1 1 -3 -1 0 0 0 ] 0.18/air kappa2 [1 1 -3 -1 0 0 0 ] 0.03), volScalarField kappa=alpha1*kappa1+alpha2*kappa2.
3) Cp is also the mixture value, and Cp1 [0 2 -2 -1 0 0 0 ] 3100/Cp2 [0 2 -2 -1 0 0 0 ] 1000. volScalarField Cp=alpha1*Cp1+alpha2*Cp2.
4) volScalarField mu = twoPhaseProperties.mu()

In my case, the inlet temperature is 513K(fixedvalue), and the wall is 323K(fixedvalue). I choose Gauss upwind for div(rhoPhi,T), and Gauss linear corrected for laplacianSchemes.

The result shows that the max temperature is about 900K at the first step near the interface, and it reduces to the normal value 513K after 1/3 computation time. What’s more, I also change the kappa/Cp in the energy diffusion term from volScalarField to surfaceScalarField by interpolate(Kappa) and interpolate(Cp), and the result has no change.

2. d(rho*cp*T)/dt + div(cp*T*rho*V) = div(kappa*grad T) + source terms

In my code, this equation is written as:
fvm::ddt(rhoCp,T) +fvm::div(rhoPhiCp,T)-fvm::laplacian(kappa,T)==mu*magSqr(fvc::grad(U))

1) volScalarField rhoCp and surfaceScalarField rhoPhiCp is created like your code. rhoCp is updated after rho in the alphaEqnSubCycle.H by rhoCp = alpha1*rho1*cp1 + alpha2*rho2*cp2, rhoPhiCp is updated after rhoPhi in the alphaEqn.H by rhoPhiCp = phiAlpha*(rho1*cp1 - rho2*cp2) + phi*rho2*cp2.
2) kappa and mu is also the mixture value like the equation 1.

In my case, I choose Gauss upwind for div(rhoPhiCp,T), and other set is same as the first case above.

The result shows that the max temperature is about 3000K at the first step on the front of interface(in the air area), and it Increase to inf. after about 1/4 computation time.

After run the two different equations, the first one shows better convergence ability, but my code still cannot get a satisfactory result. I think the wide difference of properties of the too phases not only blows up the convective term but also blows up my head!!! Can you help me with error correction or improvement suggestions? Thanks in advance!

becklei May 3, 2014 00:56

add TEqn.H
 
@ovie

A quite simple question:In your code, you add the TEqn.H after UEqn.H. Why not after the PISO loop just like the tutorial( "How to add temperature to icoFoam")?

seju May 3, 2014 05:02

Quote:

Originally Posted by becklei (Post 489559)
@ovie

A quite simple question:In your code, you add the TEqn.H after UEqn.H. Why not after the PISO loop just like the tutorial( "How to add temperature to icoFoam")?

Dear Becklei because interFoam used the pimple loop and its different with piso, and for added TEqn you can't do that similar add TEeqn into icoFoam. you must do that for two phase at the same time.

becklei May 3, 2014 05:29

Quote:

Originally Posted by seju (Post 489569)
Dear Becklei because interFoam used the pimple loop and its different with piso, and for added TEqn you can't do that similar add TEeqn into icoFoam. you must do that for two phase at the same time.

Hi, sajad!

Thanks for your reply!
I will try to understand the PIMPLE loop by myself.
Can you give me some detail explain about the difference between TEqn and TEeqn?

Thanks again for your patience to the novice!:)

seju July 11, 2014 09:01

dear foamer,
I know this post write for many time ago,but I face to this problem right now, I wanna simulation rising bubble with temp, following this boundary conditions:
upper wall 312k and else is zeroGradient and my box have 298k. after few iteration bubble temp be 400k or more and temp unbunded. can you help me plz? how can I solve this problem?
I added energy equation to interFoam following example in this trend,do you have any suggestion for solve this probplem.
Best regards, Sajad

John Degenkolb August 29, 2014 09:38

Hi Foamers,

I found some great tutorial slides for the implementation of heat transfer to interFoam in Openfoam version 2.3.0:

http://www.wolfdynamics.com/images/conf_and_publ/interTempFoam.pdf

the source code is published as well:
http://www.wolfdynamics.com/images/conf_and_publ/source_interTempFoam.tar.gz

Thanks to Damiano Natali and wolf dynamics !!!


The implementation, compiling and running work well, but my results show some strange behavior:
The initial temperature field involves values between 0 K and 300 K. After some steps, however, the temperature range is from around -30 K to 340 K. The negative values can be found near high temperature gradients. In the end of the simulation, the temperature is between -1 K and 20 K.

I tried the following without really changing anything:

1. The procedure described in Ovie’s post: http://www.cfd-online.com/Forums/openfoam-solving/69103-diverging-result-temperature-field-interfoam-2.html#post264901 (thanks!)
2. Changing the temperature range to 1K to 300K
3. Reducing and increasing the specific heat
4. Reducing and increasing the density
5. Reducing the solver tolerances in fvSolution
6. Mesh refinement
7. Reducing maxCo, maxAlphaCo and maxDeltaT in the controlDict. (While compiling the solver, I got the warning that maxDeltaT is an unused variable)

When I …

… set up the case in a way, that no convection, only diffusion occurs, then temperature stays bounded.

… reduce the initial temperature range to (0 K to 20 K) the “over swing” (how is this called in English?) reduces to +-2K.

… reduce the Prandtl number, which is used to calculate the heat conductivity, the temperature equalization in the domain is very quick, hence the gradient is reduced very fast and the “over swing” is reduced.

What else can I do in order to bound the temperature of my simulation?

Thank you in advance!

rama13 September 1, 2014 10:51

1 Attachment(s)
Hi Peter,

Quote:

Originally Posted by John Degenkolb (Post 508363)
I found some great tutorial slides for the implementation of heat transfer to interFoam in Openfoam version 2.3.0:

http://www.wolfdynamics.com/images/conf_and_publ/interTempFoam.pdf

the source code is published as well:
http://www.wolfdynamics.com/images/conf_and_publ/source_interTempFoam.tar.gz


The implementation, compiling and running work well, but my results show some strange behavior:
The initial temperature field involves values between 0 K and 300 K. After some steps, however, the temperature range is from around -30 K to 340 K. The negative values can be found near high temperature gradients. In the end of the simulation, the temperature is between -1 K and 20 K.

You are right, T values gets out of the possible range in a few iterations and then go to convergence. It seems when we did the tutorials we focused on making everything working and not on physics:o

Maybe there are some other ways to bound your values, but this problem can be solved by using another scheme for computing div(rhoCpPhi,T).

For example look in attachment what happens to min/max values of T by changing div(rhoCpPhi,T) from Gauss linearUpwind grad(T) to Gauss limitedLinear 1.

There are a lot of possible schemes in OF, have a look for instance here!

Best regards,
Damiano

kebsiali March 25, 2015 10:20

Dear Foamers,

I have been suffering for two days with this same thing.
I added the energy equation as developed by Ovie making some changes to adapt with OF2.3.0, but it didn't work and just today i saw the work done by wolfdynamics
well! it is like a copy of my work ( or mine a copy of theirs) exactly, with some points missing in the slide provided, like adding the line
tmp<surfaceScalarField> kappaf() const;
in the incompressibleTwoPhaseMixture.H file
So, more presicely, what iv done is i added
Foam::tmp<Foam::surfaceScalarField>
Foam::incompressibleTwoPhaseMixture::kappaf() const
{
const surfaceScalarField alpha1f
(
min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1))
);

return tmp<surfaceScalarField>
(
new surfaceScalarField
(
"kappaf",
(
alpha1f*rho1_*cp1_*(1/Pr1_)*fvc::interpolate(nuModel1_->nu())
+ (scalar(1) - alpha1f)*rho2_*cp2_*(1/Pr2_)*fvc::interpolate(nuModel2_->nu())
)
)
);
}
to incompressibleTwoPhaseMixture.C file
and added cps and Prs in .H file and tmp..... like defined above
and the library is compiled perfectly

in my solver i added the TEqn
where the 1st line is
surfaceScalarField kappaf = twoPhaseProperties.kappaf();

but when i compile my solver it gives my the following massage:

/home/alkebsi/OpenFOAM/alkebsi-2.3.0/applications/solvers/interThermalFoam/TEqn.H:1: référence indéfinie vers « Foam::incompressibleTwoPhaseMixture::kappaf() const »
collect2: error: ld returned 1 exit status
make: *** [/home/alkebsi/OpenFOAM/alkebsi-2.3.0/platforms/linux64GccDPOpt/bin/interThermalFoam] Erreur 1

the system is french but i think it is clear what (référence indéfinie vers) means (undefined reference)


well! stupidly i tried to comment the part in .C file where the method kappaf() is defined, recombiled the library successfully and when i combile the solver it shows the same error. As if he cant access it wether it is there or not:confused:

kebsiali March 26, 2015 03:54

sorry
found my stupid mistake

I did not specify the new library in make/options
and the solver was looking for the method kappaf() in the original library

now it is working
thanks for passing by

MdoNascimento June 30, 2015 14:45

Hello. I have a question about adding the temperature to the interFoam solver with the methods discussed in this thread.

Where exactly are the condition of heat flux continuity of the interface implemented? Can I see those directly in the code?

Something like k1*dT1/dn = k2*dT2/dn.

Thanks

kebsiali June 30, 2015 15:06

Dear Manuel

in VOF method there is no T1 and T2
there is only T of the effective fluid.
I get your point, sperious or parasite fluxes could start from one fluid to the other through the interface, and something like the compression term in the alpha equation should be added.
the solver discussed here however gives good results, with the use of vanleer scheme for the flux term.

MdoNascimento June 30, 2015 15:21

Quote:

Originally Posted by kebsiali (Post 552746)
Dear Manuel

in VOF method there is no T1 and T2
there is only T of the effective fluid.
I get your point, sperious or parasite fluxes could start from one fluid to the other through the interface, and something like the compression term in the alpha equation should be added.
the solver discussed here however gives good results, with the use of vanleer scheme for the flux term.

Hello kepsiali,

you are right, there is no specific T for each phase in this solver. I should have known this ...

But still, is the condition fullfilled somehow, somewhere?

I could ask the same for the shear stresses of both phases at the interface.

behcfd July 31, 2015 15:33

Hi all,

I have followed the similar steps as given in this post by Ovie to add energy equation to interFoam.I use openFOAM2.3. first I compiled new library in src/incompressible/incompressibleTwoPhaseMixture without any error. after that I wanted to implement new solver. But this error occured:

/home/beh/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/fvmLaplacian.C:322:1: note: template argument deduction/substitution failed:
In file included from myinterFoam.C:97:0:
TEqn.H:6:30: note: ‘Foam::surfaceScalarField {aka Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>}’ is not derived from ‘const Foam::tmp<Foam::GeometricField<GType, Foam::fvsPatchField, Foam::surfaceMesh> >’
- fvm::laplacian(kappaf, T)
^
In file included from myinterFoam.C:62:0:
/home/beh/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
scalar maxDeltaT =
^
make: *** [Make/linux64GccDPOpt/myinterFoam.o] Error 1

I would be thankful if you help me

262554842@qq.com June 29, 2017 10:12

nice to meet u
 
Quote:

Originally Posted by metro (Post 264762)
Hey Ovie,

I have implemented your code and I am now having stability issues. When I run my case, the temperature diverges and ends up reaching inf. I tested the case/boundary conditions with interFoam and no issues. When it came to implementing the div(rho*phi*cp,T) in fvScheme, I used a standard linear Gaussian discretisation. Is this correct? Or did you utilise another methodology? Can you think of any other reason why this is happening?

Regards

Metro

hello ,i am new to use openfoam,and i also study about phase change(vapour to water).
firstly,im changing interFoam to interTemFoam some days....:(:(:( failed failed failed ,sad....may i ask u a question?


surfaceScalarField rhoPhiCpf
(
IOobject
(
"rhoPhiCpf",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rhoPhi*cp1
);



why the last line "rhoPhi*cp1"?what's meaning?


All times are GMT -4. The time now is 17:59.