Interpolation onto reference grid
Interpolation onto reference grid
Hello,
I am trying to find out how to interpolate results onto the reference mesh with the same size as mesh used for the simulation but finer/coarser and non-deformed (mesh update solver is involved) and use it as a restart file for new simulation. Do you have any test example for that? Is there a simple way how to do that with already developed tools in elmer?
Send you regards,
Martina.
I am trying to find out how to interpolate results onto the reference mesh with the same size as mesh used for the simulation but finer/coarser and non-deformed (mesh update solver is involved) and use it as a restart file for new simulation. Do you have any test example for that? Is there a simple way how to do that with already developed tools in elmer?
Send you regards,
Martina.
Re: Interpolation onto reference grid
Hi Martina,
one (addmittedly somewhat "hackish") way that works for me: To interpolate a scalar
field "Poison" from mesh "a" to mesh "b", with mesh "a" having results in file "test.result" you
could use a small solver and sif files below. (BTW: can't attach these: "The extension f90 (etc...)
is not allowed.")
Regards, Juha
one (addmittedly somewhat "hackish") way that works for me: To interpolate a scalar
field "Poison" from mesh "a" to mesh "b", with mesh "a" having results in file "test.result" you
could use a small solver and sif files below. (BTW: can't attach these: "The extension f90 (etc...)
is not allowed.")
Code: Select all
SUBROUTINE Interpolate( Model,Solver,dt,TransientSimulation )
USE DefUtils
IMPLICIT NONE
TYPE(Solver_t) :: Solver
TYPE(Model_t) :: Model
REAL(KIND=dp) :: dt
LOGICAL :: TransientSimulation
TYPE(Mesh_t), POINTER :: Mesh
TYPE(Variable_t), POINTER :: Var
Mesh => GetMesh()
Var => VariableGet( Mesh % Variables, GetString(GetSolverParams(),'Interpolant'))
END SUBROUTINE Interpolate
Code: Select all
Check Keywords Warn
Header
Mesh DB "." "a"
End
Simulation
Coordinate System = Cartesian
Simulation Type = Steady
Steady State Max Iterations = 1
Output File = "intp.dat"
Post File = "intp.ep"
Restart File = test.result
Restart Position = 0
End
Body 1 :: Equation=1
Equation 1 :: Active Solvers=1
Solver 1
Equation = intp
Procedure = "./intp" "Interpolate"
Mesh = "b"
Interpolant = String "Poison"
End
Re: Interpolation onto reference grid
Hello Juha!
thanks a lot for your support!
It seems that the above described works unless velocity field (Navier-Stokes solver) is involved. I tried your method for heat eqation and for solidification without convection and these two cases work fine. However, if I try to add Navier-Stokes solver and interpolate velocity field, it doesn't work and it already crashes when trying to read a restart file - Bus error appears. Can you confirm me that your tests crash as well if you let velocity involved to your simulation? Why could be so?
Best regards, Martina.
thanks a lot for your support!
It seems that the above described works unless velocity field (Navier-Stokes solver) is involved. I tried your method for heat eqation and for solidification without convection and these two cases work fine. However, if I try to add Navier-Stokes solver and interpolate velocity field, it doesn't work and it already crashes when trying to read a restart file - Bus error appears. Can you confirm me that your tests crash as well if you let velocity involved to your simulation? Why could be so?
Code: Select all
dhcp-101-230:fsi_beam martina$ ElmerSolver interpolate.sif
ELMER SOLVER (v 5.5.0) STARTED AT: 2010/01/26 20:59:46
MAIN:
MAIN: ==========================================
MAIN: E L M E R S O L V E R S T A R T I N G
MAIN: Library version: 5.5.0 (Rev: 4267)
MAIN: ==========================================
MAIN:
MAIN:
MAIN: -----------------------
MAIN: Reading Model ...
Model Input: Unlisted keyword: [interpolant] in section: [solver 1]
MAIN: Done
MAIN: -----------------------
Loading user function library: [./intp]...[Interpolate_Init]
Loading user function library: [./intp]...[Interpolate]
LoadRestartFile:
LoadRestartFile: --------------------------------------------
LoadRestartFile: Reading data from file: fsi/data.result
LoadRestartFile: ASCII 1
LoadRestartFile:
Bus error
Re: Interpolation onto reference grid
Hello,
it works!
However, I am a bit puzzled how it works. Within my test simulation following solvers are used: Heat solver, N-S solver, Phase Change solver and Mesh Update solver (in this order). The way the interpolation works for me is that variables Temperature, Flow solution and Phase Surface (Phase change solver) are used as Interpolant in the Juha's subroutine. So NO variable Mesh Update is interpolated and this variable is completely absent in interpolation file that serves as a restart file for fine mesh (see headers below). I wonder what's happening with this variable. Why the mesh update solver doesn't need it within restart procedure?
best regards
-Martina-
header of output file for coarse mesh
header of interpolated file that is used afterwards as a restart file for fine mesh
it works!
However, I am a bit puzzled how it works. Within my test simulation following solvers are used: Heat solver, N-S solver, Phase Change solver and Mesh Update solver (in this order). The way the interpolation works for me is that variables Temperature, Flow solution and Phase Surface (Phase change solver) are used as Interpolant in the Juha's subroutine. So NO variable Mesh Update is interpolated and this variable is completely absent in interpolation file that serves as a restart file for fine mesh (see headers below). I wonder what's happening with this variable. Why the mesh update solver doesn't need it within restart procedure?
best regards
-Martina-
header of output file for coarse mesh
Code: Select all
ASCII 1
!File started at: 2010/01/30 14:19:31
Degrees of freedom:
mesh update 2 :fs
mesh velocity 2 :fs
flow solution 3 :fs
mesh update 1 1 :fs
mesh update 2 1 :fs
mesh velocity 1 1 :fs
mesh velocity 2 1 :fs
temperature 1 :fs
temperature loads 1 :fs
velocity 1 1 :fs
velocity 2 1 :fs
pressure 1 :fs
phasesurface 1 :fs
Total DOFs: 10
Number Of Nodes: 6191
Time: 1 1 0.601000000000E-001
header of interpolated file that is used afterwards as a restart file for fine mesh
Code: Select all
ASCII 1
!File started at: 2010/01/30 20:13:51
Degrees of freedom:
flow solution 3 :fs
temperature 1 :fs
velocity 1 1 :fs
velocity 2 1 :fs
pressure 1 :fs
phasesurface 1 :fs
Total DOFs: 5
Number Of Nodes: 24381
Time: 1 1 0.602000000000E-001
-
- Site Admin
- Posts: 4825
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Interpolation onto reference grid
Hi Martina
If I remember correctly the MeshUpdate was the 1st active solver for you. Its totally determined by the BCs. However, I would be slightly worried whether the Mesh Velocity is also computed correctly. That might create a slight discontinuity for your case. compared to a case with no restart.
-Peter
If I remember correctly the MeshUpdate was the 1st active solver for you. Its totally determined by the BCs. However, I would be slightly worried whether the Mesh Velocity is also computed correctly. That might create a slight discontinuity for your case. compared to a case with no restart.
-Peter
Re: Interpolation onto reference grid
Hello Peter,
you are right that I used Mesh Update solver as a 1st solver. However, if it is the first active solver, interpolation doesn't work well. As you pointed out there are discontinuities created. Hence, I moved it to last position hoping that the solution and all stuff around (restart thing etc.) will remain good (what do you think?). If mesh update is the last active solver, interpolation is then correct (at least from quick view in paraview and some basic checks at the boundary).
I also tried to Interpolate Mesh Update variable and Mesh velocity variable and use Mesh Update solver as the first active solver but results were not correct. It seems that if I touch these variables it then messes Coordinate variable. If you are interested I can attach some snapshots.
Best regard, Martina.
you are right that I used Mesh Update solver as a 1st solver. However, if it is the first active solver, interpolation doesn't work well. As you pointed out there are discontinuities created. Hence, I moved it to last position hoping that the solution and all stuff around (restart thing etc.) will remain good (what do you think?). If mesh update is the last active solver, interpolation is then correct (at least from quick view in paraview and some basic checks at the boundary).
I also tried to Interpolate Mesh Update variable and Mesh velocity variable and use Mesh Update solver as the first active solver but results were not correct. It seems that if I touch these variables it then messes Coordinate variable. If you are interested I can attach some snapshots.
Best regard, Martina.
-
- Site Admin
- Posts: 4825
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Interpolation onto reference grid
Ok. In fact if your reference mesh should be undeformed at start it makes sense to not take into account the MeshUpdate in the interpolation. If successfull this would map the deformation to the reference mesh and it would not be reference mesh anymore, as it would have exactly the same deformation as the original one
So in your reference computation if you continue the simulation the MeshVelocity is computed for the 1st time at the end of the timestep. This could have some effect. One thing that you should be aware of is that in the standard call of VariableGet an interpolation matrix is created. So if you interpolate the same field many times the same interpolation is used. What defines the interpolation matrix is the nodal coordinates at the time of 1st calling. You can skip the interpolation matrix part by some optional argument. Might be good also for saving memory, if you anaway need it once only.
-Peter
So in your reference computation if you continue the simulation the MeshVelocity is computed for the 1st time at the end of the timestep. This could have some effect. One thing that you should be aware of is that in the standard call of VariableGet an interpolation matrix is created. So if you interpolate the same field many times the same interpolation is used. What defines the interpolation matrix is the nodal coordinates at the time of 1st calling. You can skip the interpolation matrix part by some optional argument. Might be good also for saving memory, if you anaway need it once only.
-Peter
-
- Posts: 97
- Joined: 05 Nov 2011, 16:50
- Antispam: Yes
- Location: Nimes, France
Re: Interpolation onto reference grid
Hello dear elmer fellows...
i'm ressuscitating (or more familiar "rising from the dead") this thread!
I've been away for a while working on other subjects and FEM software but i don't forget elmer!
All right, i tried to do what was said in this post but unsuccessfully!!!!! I have a simple heat transfer case that i ran on MeshA (see attached file). My simple heat transfer problem consist in heating (moving heat source) the top of my geometry while the other boundaries expect heat loss (radiation and convection).
At the end of my simulation, tf=3s, i want to export the final temperature field from MeshA to MeshB. MeshB has the same geometry but a different meshgrid.
I used the trick of Juha but... my interpolated temperature filed on meshB is quite scattered... i don't understand why!!!
i don't know exactly how to use these juha's files (interpolate and its sif ...).
If someone can help, i thank you in advance
i'm ressuscitating (or more familiar "rising from the dead") this thread!
I've been away for a while working on other subjects and FEM software but i don't forget elmer!
All right, i tried to do what was said in this post but unsuccessfully!!!!! I have a simple heat transfer case that i ran on MeshA (see attached file). My simple heat transfer problem consist in heating (moving heat source) the top of my geometry while the other boundaries expect heat loss (radiation and convection).
At the end of my simulation, tf=3s, i want to export the final temperature field from MeshA to MeshB. MeshB has the same geometry but a different meshgrid.
I used the trick of Juha but... my interpolated temperature filed on meshB is quite scattered... i don't understand why!!!
i don't know exactly how to use these juha's files (interpolate and its sif ...).
If someone can help, i thank you in advance
- Attachments
-
- elmerforum.tar.gz
- mesh files & heat_transfer.sif
- (488.78 KiB) Downloaded 290 times
-
- TestMovDataNewMesh.sif
- juha's sif file to interpolate data
- (480 Bytes) Downloaded 275 times
-
- interpol.f90
- juha's interpolation fortran file
- (403 Bytes) Downloaded 262 times
Rouquette Sébastien
University of Montpellier / Mechanical and Civil Engineering Lab. / Welding Group
University of Montpellier / Mechanical and Civil Engineering Lab. / Welding Group
Re: Interpolation onto reference grid
Hi,
you might also try to do it in ParaView. I am almost sure one of their filters does that. If not, you might search their mailing list and forum or ask there for support. This might be easier than to do it in Elmer.
HTH,
Matthias
you might also try to do it in ParaView. I am almost sure one of their filters does that. If not, you might search their mailing list and forum or ask there for support. This might be easier than to do it in Elmer.
HTH,
Matthias
-
- Posts: 97
- Joined: 05 Nov 2011, 16:50
- Antispam: Yes
- Location: Nimes, France
Re: Interpolation onto reference grid
thank you for you answer Mathias... i'm gonna explore this possibility!
But if anyone has the answer with juha's approach, i'll take it!
But if anyone has the answer with juha's approach, i'll take it!
Rouquette Sébastien
University of Montpellier / Mechanical and Civil Engineering Lab. / Welding Group
University of Montpellier / Mechanical and Civil Engineering Lab. / Welding Group