# Problem with Transient Heat Source (using swak4Foam expression Source)

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

August 3, 2013, 02:04
Problem with Transient Heat Source (using swak4Foam expression Source)
#1
Senior Member

Join Date: Oct 2012
Location: AU
Posts: 121
Rep Power: 5
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
Attached Files
 mefFoam.tar.gz (7.3 KB, 9 views) TestCase.tar.gz (5.0 KB, 9 views)

August 3, 2013, 05:40
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,905
Rep Power: 40
Quote:
 Originally Posted by ahmmedshakil 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
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 August 3, 2013, 06:41 #3 Senior Member   Mohammad Shakil Ahmmed Join Date: Oct 2012 Location: AU Posts: 121 Rep Power: 5 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.

 August 22, 2013, 00:59 #4 Senior Member   Mohammad Shakil Ahmmed Join Date: Oct 2012 Location: AU Posts: 121 Rep Power: 5 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???

August 22, 2013, 04:57
#5
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,905
Rep Power: 40
Quote:
 Originally Posted by ahmmedshakil 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
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 January 7, 2015, 09:47 dimensian problems #6 Member   Kapa Lilla Join Date: Mar 2009 Location: Bruxelles, Belgium Posts: 41 Rep Power: 8 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.

 January 7, 2015, 10:07 #7 Senior Member   Mohammad Shakil Ahmmed Join Date: Oct 2012 Location: AU Posts: 121 Rep Power: 5 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

 January 7, 2015, 10:45 #8 Member   Kapa Lilla Join Date: Mar 2009 Location: Bruxelles, Belgium Posts: 41 Rep Power: 8 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

January 7, 2015, 16:01
#9
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,905
Rep Power: 40
Quote:
 Originally Posted by klilla 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"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 January 8, 2015, 05:07 #10 Member   Kapa Lilla Join Date: Mar 2009 Location: Bruxelles, Belgium Posts: 41 Rep Power: 8 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

January 8, 2015, 05:51
#11
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,905
Rep Power: 40
Quote:
 Originally Posted by klilla 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 In any case, if I submit this report, will I be able to follow the progress of it?

Quote:
 Originally Posted by klilla 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
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 January 8, 2015, 06:01 #12 Member   Kapa Lilla Join Date: Mar 2009 Location: Bruxelles, Belgium Posts: 41 Rep Power: 8 Great, thanks! Lilla

 January 22, 2015, 05:38 #13 Member   Kapa Lilla Join Date: Mar 2009 Location: Bruxelles, Belgium Posts: 41 Rep Power: 8 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

 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

 Similar Threads Thread Thread Starter Forum Replies Last Post tayo OpenFOAM 39 December 3, 2012 06:18 Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18 gschaider OpenFOAM Installation 120 December 2, 2009 11:23 kamal FLUENT 2 June 29, 2008 14:55 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51

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