Extract temperature at variable point on boundary

Numerical methods and mathematical models of Elmer
Post Reply
marechad
Posts: 3
Joined: 05 Nov 2018, 01:41
Antispam: Yes

Extract temperature at variable point on boundary

Post by marechad »

Hello,
I'm running a 3D thermal problem with fixed mesh. For each time step, I'd like to save (in a text file) the temperature corresponding to a variable point in space, on the boundary (the boundary is defined by z=0 in my case). This temperature is required so that I can impose corresponding BC.
I've tried the following without any success :

Code: Select all

Solver 3
  Procedure = "SaveData" "SaveScalars"
  Exec solver = after timestep
  FileName = "Tsurface.dat"
  x = Variable "time" 
	Real MATC "L/2*(1-cos(v/L*tx(0)))"
  Save Coordinates(1,3) = x 0.2 0.0
  Variable 1 = Time
  Variable 2 = Temperature
End
Save Coordinates does not seem to like intermediate variables, like the "x" I've created. Error message is:

Code: Select all

Model Input:  Unlisted keyword: [x] in section: [solver 3]
ERROR:: SectionContents: Problem reading real keyword: save coordinates: x 0.2 0.0
How could I do it correctly ? Many thanks in advance...
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract temperature at variable point on boundary

Post by raback »

Hi

There are two problems.

1) In the code the "Save Coordinates" are fecthed assuming that it is a constant real array so you cannot let it have any functional dependency.

2) Even if you could there is a syntax issue. The parser will just not replaces "x" with the expression. You should have the "Save Coordinates" itself be a function of time and use the MATC expression directly for it (perhaps defining a function).

Unfortunarely 1) requires some coding and no help in just fixing the syntax.

-Peter
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Extract temperature at variable point on boundary

Post by mzenker »

Hi,

there are some operators for SaveScalars which might be interesting - if you can use maximum or minimum temperature over a boundary or body, this is possible, see Models Manual for more information.
Else if it is not feasible in Elmer - do you need the temperature at the varying location inside the current Elmer simulation? If not, you can extract that temperature in the postprocessing step. With a reasonable amount of scripting you can even process the results as they are written to disk during the simulation (if you use an output file format like vtu which writes a separate file for each timestep).

HTH,
Matthias
marechad
Posts: 3
Joined: 05 Nov 2018, 01:41
Antispam: Yes

Re: Extract temperature at variable point on boundary

Post by marechad »

Indeed, I do need the temperature at the varying location within the current Elmer simulation. And not only the minimum or the maximum.
My goal was to compute the exact temperature at each node of the surface so that I could impose a temperature-dependant boundary condition. The boundary condition I had in mind was to impose a flux on the surface which corresponds to a polynomial of the temperature, for each node of the surface.
It looks like it's not feasible without recoding... Am I right ?
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract temperature at variable point on boundary

Post by raback »

Hi

If you just want a temperature dependent BC then that is a standard feature of Elmer, for example 2nd order polynomial with MATC

Code: Select all

Boundary Condition 1
  Heat Flux = Variable "temperature"
    Real MATC "1.23*tx^2+2.34*tx+3.45"
You can use Lua expressions, tables and UDFs as well.

-Peter
marechad
Posts: 3
Joined: 05 Nov 2018, 01:41
Antispam: Yes

Re: Extract temperature at variable point on boundary

Post by marechad »

It looks like what I'd like to implement. I just need one confirmation: with the BC condition you suggested, each node of the boundary will see a heat flux that depends on the temperature at the very same node. Right ?
I guess my difficulty was: "How does Elmer know I need to use the temperature at the boundary ?" But it does know very well, due to the fact the statement is appended inside the BC definition... Sorry for being confused and many thanks for your help.
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Extract temperature at variable point on boundary

Post by raback »

Hi

It knows it because all parameters on finite element assembly are retrieved on each node of each element, and can depend on any field variable. There is some cost to this but the advantages are huge.

-Peter
Post Reply