CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] Problem with Transient Heat Source (using swak4Foam expression Source) (https://www.cfd-online.com/Forums/openfoam-community-contributions/121681-problem-transient-heat-source-using-swak4foam-expression-source.html)

ahmmedshakil August 3, 2013 02:04

Problem with Transient Heat Source (using swak4Foam expression Source)
 
2 Attachment(s)
Hi FOAMers,
I am solving energy equation for laser annealing problem. The equation I'm solving is as follows:
fvm::ddt(rhoCp, T) - fvm::laplacian(K,T) - rhoCp*VX*dtdx == heatSource();

Vx= velocity of the frame(I'm moving the the frame instead of source).
Cp & K is function of temperature.
Now, I'm calculating heatSource() using swak expression source(laser heat source)
Q= P*mu*(1-R)* exp(-mu*Z)*exp(-X^2/r^2);
where,
P = total power
mu = absorption co-efficient
R = Reflection.
Both mu and R is function of temperature.
Now, when I run the simulation I get the temperature value unusual(huge value!!!). I have also run the simulation taking mu as constant, in this case it gives reasonable value. Does any one had solve this type of problem? Thanks in advance .

shakil

gschaider August 3, 2013 05:40

Quote:

Originally Posted by ahmmedshakil (Post 443584)
Hi FOAMers,
I am solving energy equation for laser annealing problem. The equation I'm solving is as follows:
fvm::ddt(rhoCp, T) - fvm::laplacian(K,T) - rhoCp*VX*dtdx == heatSource();

Vx= velocity of the frame(I'm moving the the frame instead of source).
Cp & K is function of temperature.
Now, I'm calculating heatSource() using swak expression source(laser heat source)
Q= P*mu*(1-R)* exp(-mu*Z)*exp(-X^2/r^2);
where,
P = total power
mu = absorption co-efficient
R = Reflection.
Both mu and R is function of temperature.
Now, when I run the simulation I get the temperature value unusual(huge value!!!). I have also run the simulation taking mu as constant, in this case it gives reasonable value. Does any one had solve this type of problem? Thanks in advance .

shakil

No time to look at it in detail. Two hints:
1. Is the temperature dependence in such a way that there is a positive feedback? Calculating by hand (or using some program that solves ODEs) for one cell might give hints
2. The explicit nature of the coupling might be a problem. Try to run the simulation with a timestep that is a tenth of the one you're currently using. If the results are approximately the same your physical model has a problem. If the problem is ten times smaller then you have a discretization problem

ahmmedshakil August 3, 2013 06:41

Hi Gschaider,
Thank you for the answer. I guess it may be the explicit nature of coupling. I'm checking with the hints you suggested.

ahmmedshakil August 22, 2013 00:59

Hi,
Just figured out the problem is coming from the "mu" which is absorption coefficient. In my case, mu varies with the temperature with power law:
mu = mu0*(T/T0)^1.2
where,
mu0 = is the initial absorption
T0= is the initial temperature (300K)
Now, when I used this relationship in the heat source equation it causes the problem. Does any one have idea to deal with such situations???

gschaider August 22, 2013 04:57

Quote:

Originally Posted by ahmmedshakil (Post 447319)
Hi,
Just figured out the problem is coming from the "mu" which is absorption coefficient. In my case, mu varies with the temperature with power law:
mu = mu0*(T/T0)^1.2
where,
mu0 = is the initial absorption
T0= is the initial temperature (300K)
Now, when I used this relationship in the heat source equation it causes the problem. Does any one have idea to deal with such situations???

It MIGHT help to linearize the term and make it implicit. Something like

Code:

muPerT=mu0*(1/(T*T0))^1.2
(check arithmetics and adapt syntax) and as the source term use something like
Code:

fvm::Sp(muPerT,T)
That makes mu0 change with the temperature (not exactly, but the tendency).

I THINK (haven't tried yet) that you can still use an expressionSource for muPerT. Ah. And probably the physics in my example is wrong. That is your responsibility

klilla January 7, 2015 08:47

dimensian problems
 
Dear All,

I try to use this feature of swak, but I have the following problem. When I try to run the case, my source term is complaining that pos.x() and T has dimensions, while the source term should not have?

I'm using OF 2.1 and Swak4Foam_2.x_release_0.2.2/

Why this is so?
Thanks,
Lilla

PS: my source term is depending on position and temperature.

ahmmedshakil January 7, 2015 09:07

Can you please explain a bit detail of your problem? Because, if the source term is a function of position and temperature, it may have dimensions.

Cheers
#shakil

klilla January 7, 2015 09:45

Dear Shakil,

indeed, the source itself has dimension (K/s), but in the syntax of expressionSource, it is given separately:

expression "543";
dimensions [0 0 -1 1 0 0 0];

My problem works fine with this constant source, but if I try to use a function

expression "54*(T-473.15)"

I got an error message that expression cannot be evaluated, because T and "473.15" do not have the same dimension. Now, I do not know how to define this constant with a dimension in this HeatSourceDict.

Best,
Lilla

gschaider January 7, 2015 15:01

Quote:

Originally Posted by klilla (Post 526439)
Dear Shakil,

indeed, the source itself has dimension (K/s), but in the syntax of expressionSource, it is given separately:

expression "543";
dimensions [0 0 -1 1 0 0 0];

My problem works fine with this constant source, but if I try to use a function

expression "54*(T-473.15)"

I got an error message that expression cannot be evaluated, because T and "473.15" do not have the same dimension. Now, I do not know how to define this constant with a dimension in this HeatSourceDict.

Best,
Lilla

This seems to be a problem of swak4Foam. Please write a bug-report in the swak bugtracker

In the meantime a feasible workaround should be:
- create an expression field TDiff with value "T-473.15"
- rewrite your expression to "54*TDiff"

klilla January 8, 2015 04:07

Dear Bernard,

thanks for your reply. I'll do the bug report, of course.

Just to be sure that I understood you well. What I did is that - dirty as it may - I defined that variable T-Tref, in my solver and called it expressionSource. In this way I bypassed the problem. That what you have meant, too? In any case, if I submit this report, will I be able to follow the progress of it? At one point I need to go for a newer release of OF - costumer request - and there I'd like to go back to the minimal, clean implementation.

All the best and thanks for this great tool,
Lilla

gschaider January 8, 2015 04:51

Quote:

Originally Posted by klilla (Post 526549)
Dear Bernard,

thanks for your reply. I'll do the bug report, of course.

Just to be sure that I understood you well. What I did is that - dirty as it may - I defined that variable T-Tref, in my solver and called it expressionSource. In this way I bypassed the problem. That what you have meant, too?

Yep.

Quote:

Originally Posted by klilla (Post 526549)
In any case, if I submit this report, will I be able to follow the progress of it?

Yep. As a reporter you get a mail every time something about this report is changed

Quote:

Originally Posted by klilla (Post 526549)
At one point I need to go for a newer release of OF - costumer request - and there I'd like to go back to the minimal, clean implementation.

All the best and thanks for this great tool,
Lilla


klilla January 8, 2015 05:01

Great, thanks!
Lilla

klilla January 22, 2015 04:38

I'd like to update the previous problem.

In fact, it works fine with:

- single phase model, one region
- single phase model, multi-region

It is not working fine (meaning takes the dimensions)

- multiphase model, multi-region

I have not tried the multiphase, one region, I'll do so, if I have a bit of time.

So I do not know now, if it is really a bug, or rather I have use/implemented it wrongly?

Best,
Lilla


All times are GMT -4. The time now is 06:53.