generating gradients

Post processing utility for Elmer
Post Reply
martijn
Posts: 25
Joined: 05 Oct 2009, 21:30

generating gradients

Post by martijn » 05 Oct 2009, 21:49

I am exploring Elmer for thermal analysis and I am impressed. Good interface that makes defining complex problems straightforward. I have solved the heat equation for the geometry I am interested in. Now I want to deduce the heat flows from the temperature distribution, which is basically calculation of the temperature gradient. How can I do this? Can it be done in the (VTK) postprocessor, or do I need external tools such as octave? Is there a convenient interface between Elmer and octave?

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

Re: generating gradients

Post by raback » 05 Oct 2009, 22:17

There are at least two options in Elmer suite (modified from Juha's old mail):

a) Add manually the flux computation solver "FluxSolver" to the .sif file, and let
the ElmerSolver compute the flux. Then you should have the flux ("vector: Flux") in the .ep file. See
Ch. 30 in http://www.nic.funet.fi/pub/sci/physics ... Manual.pdf

b) In the ElmerPost command line (at the bottom of the main window) do the following:

Code: Select all

math Flux=-c*grad(Temperature)
math Flux_abs=sqrt(vdot(Flux,Flux))
(replace "c" with your heat conductivity value).

Both ways you should have the "Flux" vector available for vector display. a) is more consistant as Galerkin is used to compute the fluxes but it must be done as part of the solution and hence b) may be more flexible if applicable (requires constant conductivity).

BR, Peter

mal
Site Admin
Posts: 54
Joined: 21 Aug 2009, 14:21

Re: generating gradients

Post by mal » 05 Oct 2009, 22:28

Just a small addition to Peter's reply.

If you want to use the VTK postprocessor of ElmerGUI, choose "Edit -> MATC..." and type in the above lines without the "math" statement, i.e.

Code: Select all

Flux=-c*grad(Temperature)
Flux_abs=sqrt(vdot(Flux,Flux))

martijn
Posts: 25
Joined: 05 Oct 2009, 21:30

Re: generating gradients

Post by martijn » 05 Oct 2009, 23:12

Thanks for the quick answers. Good software and a nice community make a great combination. It seems there is a lot to be discovered about Elmer. Can I do perform an integration of the normal component of the flux vector over a interface?

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

Heat flux over boundary

Post by raback » 05 Oct 2009, 23:38

Again there are at least two ways (copy-pasting myself). Both may require manual editing of the .sif file.

1) The more accurate and consistant one uses the residual of the discrete system r=Ax-b where A does not include the effect of BCs. For heat equation the residual includes the nodal heat fluxes needed to reproduce the temperature field. To activate the computation add to the Solver section of the heat equation the following keyword.

Code: Select all

  Calculate Loads = Logical True
As a result you should have a 'Temperature Loads' field.

You still need to sum up these contributions. That you can do with the SaveScalars solver (see Models Manual). You should operate on the desired field and sum up the values on a given boundary to give total fluxes.

Code: Select all

Solver 2
  Procedure = "SaveData" "SaveScalars"  
  Filename = normalflux.dat
  Operator 1 = boundary sum
  Variable 1 = Temperature Loads 
End
When you also add to the desired boundary the flag.

Code: Select all

  Save Scalars = Logical True
The overall procedure is far from elegant but most of the functionality was not designed for this purpose. This could be made more transparent for the user with some effort...

2) You can also compute the normal flux using integration points on the boundary using SaveScalars and operator 'diffusive flux'. This currently uses integration points on the surface and thus coinsides with 1) only when h -> 0. This option has the advantage that you may separate forces on junctions. You can combine it within the same SaveScalars solver by adding also the following lines:

Code: Select all

  Operator 2 = diffusive flux
  Variable 2 = Temperature
  Coefficient 2 = Heat Conductivity
At least for some case the two estimates for the total heat flux had the nice property that they approached the solution from different sides.

BR, Peter

Post Reply