Extract datas along an arbitrary polyline

 Posts: 71
 Joined: 18 Nov 2014, 18:18
 Antispam: Yes
Extract datas along an arbitrary polyline
Hello,
I want to check heat flux value on a simple 2D heat tranfer model. Everything is ok to extract temperatures and fluxes and average boundary fluxes with saveline and savescalars along existing boundaries.
In ElmerModelsManual in savescalars section
"Polyline Coordinates(n,DIM) Real:
This keyword may be used to create line segments that are defined by points x1, y1, x2, and y2. For each line different kinds of fluxes trough the elements may be computed. This makes it possible, for example, to check the mass flux even though no boundary has a priori been defined."
My question is: How can I do this ? I can define a polyline in savescalars section. But I can not specify savescalars = Logical true this arbitrary boundary.
Datas are not writen in the file.dat
Someone can share a simple example please? Thank you very much
Julien
I want to check heat flux value on a simple 2D heat tranfer model. Everything is ok to extract temperatures and fluxes and average boundary fluxes with saveline and savescalars along existing boundaries.
In ElmerModelsManual in savescalars section
"Polyline Coordinates(n,DIM) Real:
This keyword may be used to create line segments that are defined by points x1, y1, x2, and y2. For each line different kinds of fluxes trough the elements may be computed. This makes it possible, for example, to check the mass flux even though no boundary has a priori been defined."
My question is: How can I do this ? I can define a polyline in savescalars section. But I can not specify savescalars = Logical true this arbitrary boundary.
Datas are not writen in the file.dat
Someone can share a simple example please? Thank you very much
Julien

 Site Admin
 Posts: 3416
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Re: Extract datas along an arbitrary polyline
Hi Julien
You should use the SaveLine solver. It saves either polylines or existing BC lines with the flag active. Hence polyline does not need any additional flag.
Peter
You should use the SaveLine solver. It saves either polylines or existing BC lines with the flag active. Hence polyline does not need any additional flag.
Peter

 Posts: 71
 Joined: 18 Nov 2014, 18:18
 Antispam: Yes
Re: Extract datas along an arbitrary polyline
Thank you Peter for your quick answer,
It works for variables. But if I want to check a heat flux or a mass flux for example? I have to define a new boundary in the geometry?
Regards
Julien
It works for variables. But if I want to check a heat flux or a mass flux for example? I have to define a new boundary in the geometry?
Regards
Julien
Re: Extract datas along an arbitrary polyline
Hi,
alternatively to using the SaveLine solver, you can write vtu output data, open it with ParaView and use the "plot over line" filter.
HTH,
Matthias
alternatively to using the SaveLine solver, you can write vtu output data, open it with ParaView and use the "plot over line" filter.
HTH,
Matthias

 Site Admin
 Posts: 3416
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Re: Extract datas along an arbitrary polyline
Hi
Looking at the code it seems that you cannot compute heat flux for the polylines. For ordinary nodes it is easier to compute the gradients as their association with the bulk elements is known. For the polylines this association is somewhat more complicated and has not been programmed.
You could rather use FluxSolver to compute the heat flux to a field and thereafter save it on the polyline.
Peter
Looking at the code it seems that you cannot compute heat flux for the polylines. For ordinary nodes it is easier to compute the gradients as their association with the bulk elements is known. For the polylines this association is somewhat more complicated and has not been programmed.
You could rather use FluxSolver to compute the heat flux to a field and thereafter save it on the polyline.
Peter

 Posts: 71
 Joined: 18 Nov 2014, 18:18
 Antispam: Yes
Re: Extract datas along an arbitrary polyline
Thank you very much Peter and Matthias,
I try Peter solution:
It works. It is a stationnary study.
Solver 5
Equation = Flux and Gradient
Calculate Flux = Logical True
Calculate Flux Abs = Logical True
Calculate Grad = Logical True
Target Variable = String "Temperature"
Flux Coefficient = String "Heat Conductivity"
Procedure = "FluxSolver" "FluxSolver"
Exec Solver = Always
Solver 2
Equation = SaveLine
Procedure = "SaveData" "SaveLine"
Filename = saveline_flux_diri.dat
Filename Numbering = True
Save Flux = Logical True
!Flux Variable = String Temperature
!Flux Coefficient = String "Heat Conductivity"
Variable 1 = Coordinate 1
Variable 2 = Coordinate 2
Variable 3 = String Temperature
Variable 4 = Temperature flux 1
Variable 5 = Temperature flux 2
Polyline Coordinates (2,2) = Real 0.0 0.05 0.1 0.06
Exec Solver = After Timestep
Solver 3
Equation = Result Output
Save Geometry Ids = True
Output Format = Vtu
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = comp_elmer_comsol
Scalar Field 1 = Temperature loads
Scalar Field 2 = Temperature
Scalar Field 3 = Temperature grad
Vector Field 1 = Temperature flux
Single Precision = True
Exec Solver = After Timestep
In the output data list from saveline solver.
Variables in file: ./saveline_flux_diri6.dat
File started at: 2015/02/23 14:47:05
41 boundary nodes for each step
41 polyline nodes for each step
1: Iteration step
2: Boundary condition
3: Node index
4: coordinate 1
5: coordinate 2
6: temperature
7: temperature flux 1
8: temperature flux 2
9: Flux 1
10: Flux 2
11: Flux normal
What are Flux 1, 2 and Flux normal? It seems different. On a vertical boundary in 2D; Flux 1=Normal Flux but almost 4% different of temperature flux1. Some comparison with Comsol shows that temperature flux 1 is the correct one.
Saveline => polyline + temperature flux is ok.
How can I access to normal flux on a defined boundary? and on an polyline (if possible)?
Thank you again
Julien
I try Peter solution:
It works. It is a stationnary study.
Solver 5
Equation = Flux and Gradient
Calculate Flux = Logical True
Calculate Flux Abs = Logical True
Calculate Grad = Logical True
Target Variable = String "Temperature"
Flux Coefficient = String "Heat Conductivity"
Procedure = "FluxSolver" "FluxSolver"
Exec Solver = Always
Solver 2
Equation = SaveLine
Procedure = "SaveData" "SaveLine"
Filename = saveline_flux_diri.dat
Filename Numbering = True
Save Flux = Logical True
!Flux Variable = String Temperature
!Flux Coefficient = String "Heat Conductivity"
Variable 1 = Coordinate 1
Variable 2 = Coordinate 2
Variable 3 = String Temperature
Variable 4 = Temperature flux 1
Variable 5 = Temperature flux 2
Polyline Coordinates (2,2) = Real 0.0 0.05 0.1 0.06
Exec Solver = After Timestep
Solver 3
Equation = Result Output
Save Geometry Ids = True
Output Format = Vtu
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = comp_elmer_comsol
Scalar Field 1 = Temperature loads
Scalar Field 2 = Temperature
Scalar Field 3 = Temperature grad
Vector Field 1 = Temperature flux
Single Precision = True
Exec Solver = After Timestep
In the output data list from saveline solver.
Variables in file: ./saveline_flux_diri6.dat
File started at: 2015/02/23 14:47:05
41 boundary nodes for each step
41 polyline nodes for each step
1: Iteration step
2: Boundary condition
3: Node index
4: coordinate 1
5: coordinate 2
6: temperature
7: temperature flux 1
8: temperature flux 2
9: Flux 1
10: Flux 2
11: Flux normal
What are Flux 1, 2 and Flux normal? It seems different. On a vertical boundary in 2D; Flux 1=Normal Flux but almost 4% different of temperature flux1. Some comparison with Comsol shows that temperature flux 1 is the correct one.
Saveline => polyline + temperature flux is ok.
How can I access to normal flux on a defined boundary? and on an polyline (if possible)?
Thank you again
Julien

 Site Admin
 Posts: 3416
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Re: Extract datas along an arbitrary polyline
Hi
I guess the "Flux i" is something computed by SaveLine. This is not as accurate as the integration points on the line are used whereas for consistency the integration points of the bulk elements should be used. This is done by the FluxSolver and therefore it is more accurate.
If you do some subroutines you could obtain the normal vector for each element. Or you could use NormalSolver to compute the normal vector to a field and take the dot product using some MATC expression.
If you are interested in the nodal fluxes you might as well say "Calculate Loads" to obtain the nodal fluxes in the normal direction to "Temperature Load". These could be used directly as BCs but you should note that they really are in units of W rather than W/m^2.
Peter
I guess the "Flux i" is something computed by SaveLine. This is not as accurate as the integration points on the line are used whereas for consistency the integration points of the bulk elements should be used. This is done by the FluxSolver and therefore it is more accurate.
If you do some subroutines you could obtain the normal vector for each element. Or you could use NormalSolver to compute the normal vector to a field and take the dot product using some MATC expression.
If you are interested in the nodal fluxes you might as well say "Calculate Loads" to obtain the nodal fluxes in the normal direction to "Temperature Load". These could be used directly as BCs but you should note that they really are in units of W rather than W/m^2.
Peter

 Posts: 71
 Joined: 18 Nov 2014, 18:18
 Antispam: Yes
Re: Extract datas along an arbitrary polyline
Ok, I use already "Calculate Loads" associated with boundary sum in savescalar solver.
I will have a look on NormalSolver.
Thank you again
I will have a look on NormalSolver.
Thank you again