generating gradients
generating gradients
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?

 Site Admin
 Posts: 3499
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Re: generating gradients
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:
(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
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))
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
Re: generating gradients
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.
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))
Re: generating gradients
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?

 Site Admin
 Posts: 3499
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Heat flux over boundary
Again there are at least two ways (copypasting 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=Axb 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.
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.
When you also add to the desired boundary the flag.
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:
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
1) The more accurate and consistant one uses the residual of the discrete system r=Axb 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
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
Code: Select all
Save Scalars = Logical True
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
BR, Peter