Heat source for microwave heating

Numerical methods and mathematical models of Elmer
raback
Site Admin
Posts: 4825
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Heat source for microwave heating

Post by raback »

Hi

Could you post the sif file. That is where everything happenns...

-Peter
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Heat source for microwave heating

Post by kevinarden »

Removing if (mindist<=0.00001)exit
did allow to review each node and find the correct closest node.

HeatControlNode 14137
HeatControlNode Coordinate 4.0000000000000001E-002 2.2499999999999999E-002 0.10199999999999999

The sif was previously posted, but here is my copy
ycase.sif
(6.16 KiB) Downloaded 54 times
raback
Site Admin
Posts: 4825
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Heat source for microwave heating

Post by raback »

Hi

There is quite a bit excess computation happening. Add the following to solvers 1) and 2).

Code: Select all

¨
Exec Solver = Before Simulation
Your setup is linear. Hence rather add to Solver 3)

Code: Select all

Nonlinear System Max Iterations = 1
Otherwise your control temperature will not reflect the previous timestep but the previous iteration. For nonliner problems the F90 would need a small edit.

-Peter
raback
Site Admin
Posts: 4825
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Heat source for microwave heating

Post by raback »

Also, you might use elemental fields and call

Code: Select all

Heat Source = Variable  "Div Poynting Vector e re"
  Real Procedure "heatsource" "heatsource"
and instead of getting this field internally in the sif use the "DummyVariable" you have defined there directly. The treatment of elemental/nodal fields is done on library level. No need to make the F90 routine more complicated....

This is just fine tuning since we don't want the heat source to smear down at the interfaces.

-Peter
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Heat source for microwave heating

Post by kevinarden »

I tried to follow Peter's suggestions, but end in error

ERROR:: ListParseStrToVars: Can't find independent variable:[div poynting vector e re] for dependent variable:[Heat Source]
Note: The following floating-point exceptions are signalling: IEEE_DIVIDE_BY_ZERO IEEE_DENORMAL
STOP 1
ycase.sif
(6.17 KiB) Downloaded 47 times
heatsource.F90
(1.71 KiB) Downloaded 46 times
elelel
Posts: 32
Joined: 23 May 2022, 17:37
Antispam: Yes

Re: Heat source for microwave heating

Post by elelel »

Dear Peter,Kevin
Elmer doesn't seem to know [div poynting vector e re], why I use [div poynting vector re].
On your advice,

Code: Select all

Solver 1,2
Exec Solver = Before Simulation
Solver 3
Nonlinear System Max Iterations = 1
I obtained this result(0.0008m Mesh).(Without a controlled temperature code, the temperature is about 1500K after 10 sec)The calculation time was 220s, and previously it was 520s.
0008m_10sec.png
0008m_10sec.png (59.55 KiB) Viewed 597 times
Compared to the results of the comsol,
comsol—10s.png
comsol—10s.png (43.11 KiB) Viewed 597 times
Kevin and I have previously concluded that"it appears the function is evaluating each element indivudually".
It can be seen that, around the control point, the temperature of Elmer is about 600K.
I used 0.0005 m Mesh(finer mesh) and result changed again.It seems that the mesh.nodes is different and the results will change.
0.0005m_10sec.png
0.0005m_10sec.png (32.22 KiB) Viewed 597 times
And Solver log has a warning.

Code: Select all

WARNING:: SolveEquations: Numerical Error: Coupled system did not converge
I actually doubt this.Why does the REAL (KIND=dp):: Poy(not an array) can have different values at each node?

Code: Select all

Poy = Poyvar % Values(Poyvar % Perm(n))
raback
Site Admin
Posts: 4825
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Heat source for microwave heating

Post by raback »

Hi

To compute the elemental fields with CalcFields solver say

Code: Select all

Calculate Nodal Fields = False
Calculate Elemental Fields = True
This will give you the "e" fields and will omit the standard nodal fields.

The "Poy" is a scalar because this routine is called for each time it is needed. Hence it should be economical and only determine the control node once.

-Peter
elelel
Posts: 32
Joined: 23 May 2022, 17:37
Antispam: Yes

Re: Heat source for microwave heating

Post by elelel »

Dear Peter,
I know why can't find the [div poynting vector e re].It should be the [div poynting vector re e].I finally know what these little squares are for.
elment.png
elment.png (9.5 KiB) Viewed 574 times
If I use

Code: Select all

Heat Source = Variable  "Div Poynting Vector re e"
  Real Procedure "heatsource" "heatsource"
what should it be written in the udf?Neither of these calculations is correctly.

Code: Select all

Poyvar => VariableGet( Model % Mesh % Variables,'Div Poynting Vector re e')
Poyvar => VariableGet( Model % Mesh % Variables,'Div Poynting Vector re')
Peter,I want to try this heatsource, which in microwave heating, in general, is equivalent to div poynting vector.As long as the electric conductivity and relative permittivity im of the material is 0.

Code: Select all

Heat Source = Variable Electric field E
Real MATC "pi*8.8542e-12*2.45e9*20*(tx(0)^2)"+tx(1)^2+tx(2)^2+tx(3)^2+tx(4)^2+tx(5)^2)/1050"
And what should it be written in the udf?That is what I did.

Code: Select all

ElVar1 => VariableGet( Model % Mesh % Variables,'Electric field re E 1')
  ElVar2 => VariableGet( Model % Mesh % Variables,'Electric field re E 2')
  ElVar3 => VariableGet( Model % Mesh % Variables,'Electric field re E 3')
  ElVar4 => VariableGet( Model % Mesh % Variables,'Electric field im E 1')
  ElVar5 => VariableGet( Model % Mesh % Variables,'Electric field im E 2')
  ElVar6 => VariableGet( Model % Mesh % Variables,'Electric field im E 3')
El1 = ElVar1 % Values(Elvar1 % Perm(n))
El2 = ElVar2 % Values(Elvar2 % Perm(n))
El3 = ElVar3 % Values(Elvar3 % Perm(n))
El4 = ElVar4 % Values(Elvar4 % Perm(n))
El5 = ElVar5 % Values(Elvar5 % Perm(n))
El6 = ElVar6 % Values(Elvar6 % Perm(n))
hvar = pi*8.8542e-12*2.45e9*20*(El1**2+El2**2+El3**2+El4**2+El5**2+El6**2)/1050

Code: Select all

Heat Source = Variable "Electric field e re 1,Electric field e re 2,Electric field e re 3,Electric field e im 1,Electric field e im 2,Electric field e im 3,Temperature"
Real Procedure "heatsource" "heatsource"
But Elmer can't find them.

Code: Select all

ERROR:: ListParseStrToVars: Can't find independent variable:[electric field e re 1] for dependent variable:[Heat Source]
 ERROR:: ListParseStrToVars: Can't find independent variable:[electric field e im 1] for dependent variable:[Heat Source]
 ERROR:: ListParseStrToVars: Can't find independent variable:[electric field im] for dependent variable:[Heat Source] 
It seems can only find[electric field e] and [electric field re e 1,2,3]
Best wishes!
Dustin
elelel
Posts: 32
Joined: 23 May 2022, 17:37
Antispam: Yes

Re: Heat source for microwave heating

Post by elelel »

Dear Peter,Kevin
I found out the reason.It is caused by parallel computing.
This is the result of the parallel computing after 10 sec.The initial mesh has to be split into parts.No wonder the grids of different sizes have different results.
parallel computing.png
parallel computing.png (27.72 KiB) Viewed 564 times
This is the result of the serial computing after 10 sec.
serial computing.png
serial computing.png (33.19 KiB) Viewed 564 times
So, if I still can use parallel computing?
Can I only use serial computing? :?
Why, in my case, the decomposed domains cannot communicate between them?
Is it because of this?

Code: Select all

Poy = Poyvar % Values(Poyvar % Perm(n))
Finally control the temperature successfully, although produced a new problem.
Thank you for your help during this time. I have learned a lot about Elmer.
Thank you Peter,Kevin.
Best wishes!
Dustin
raback
Site Admin
Posts: 4825
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Heat source for microwave heating

Post by raback »

Hi,

Knowing that the problem appears only in parallel is sort of essential information. When testing it is best to always start from a small serial case to ensure that problems are not due to incorrect parallel implementation.

In this case the F90 routine for finding the control node is not parallelized. One should use some MPI commands there to communicate this global value. Typically the dependencies in PDEs is just local one so this is not usually a problem. But here you need information not available in the part you're doing the computation in.

-Peter
Post Reply