save scalars

Numerical methods and mathematical models of Elmer
mark smith
Posts: 215
Joined: 26 Aug 2009, 18:20
Location: Peterborough, England

save scalars

Post by mark smith »

Hi Elmer team & users
I'm doing a coupled fluid flow & heat transfer problem and wondered if there is a way to use save scalars so one can obtain the integral over a boundary of
density*"velocity 3"*Temperature*"heat capacity"
i.e. the heat energy of the fluid passing through a boundary whose normal is in the z direction
I have tried such things as

Operator 1= "boundary int"
Variable 1 = "Velocity 3"
coefficient 1="density"

This won't give the whole answer I want, but it illustrates my approach, but I get a segmentation fault, if I leave out the coefficient 1 line then no problems?

What I'd really like is something like:
Operator 1= "boundary int"
Variable 1 = "Velocity 3"*"Temperature"
coefficient 1="density"*"Heat capacity"

I'm using SaveMaterial to output density, viscosity, Heat conductivity and Heat capacity to my vtu file using ResultsOutputSolver

I can get the result I require if I postprocess in paraview but I'm trying to automate a series of runs where I get elmer to save the results I'm after automatically.
Any suggestions?
Regards
Mark
dmitry
Posts: 53
Joined: 09 Dec 2014, 16:52
Antispam: Yes
Location: Russia

Re: save scalars

Post by dmitry »

Hi!
I'm also model N-S + Heat coupling. As I see, you want to know convective heat flux through boundary.
I guess you need to do following:
  • create dummy material property c_pho, that will present multiplication of dencity and heat capacity. If it depends on other vars., you should give dependency as usual.

    Code: Select all

    $c = 4183.0
    $rho = 1000
    
    Material 2 
      Name = "Water"
      Density = $rho
      Heat Capacity = $c
      c_rho = Real $c*rho
    End
    
  • Create "Save scalars" solver with following lines:

    Code: Select all

     Solver 4
      Equation = "save flux"
      Procedure = "SaveData" "SaveScalars"
      Filename = Conv_flux.dat
    
      Variable 1 = Temperature
      Operator 1 = "convective flux"
      Coefficient 1 = String "c_rho"
    End
    
I think, that in models manual missed field designation "f". If you paste dimensions to 1st formula below, you see, to obtain J/sec (or Watt) dimention Temperature is demanded:
Image
where "c" is "c_rho"; "f" is "Temperature" and "n" is normal to surface.
So, the mean of averege convective flux computation on boundary already exist.
mark smith
Posts: 215
Joined: 26 Aug 2009, 18:20
Location: Peterborough, England

Re: save scalars

Post by mark smith »

Hi Dmitry
Thanks for the tip but unfortunately I get the following warning message (many times) when savescalars is called

WARNING:: ListFind: Requested property: [c_rho], not found

If I omit the coefficient term so unity (1) is used instead, then my results are not just c_rho too small so I'm still confused and unsure of the convective flux calculation written to the savescalars file?

Any other ideas anyone?

Cheers
Mark
dmitry
Posts: 53
Joined: 09 Dec 2014, 16:52
Antispam: Yes
Location: Russia

Re: save scalars

Post by dmitry »

Hi, Mark! It's strange. May you supply your sif?
mark smith
Posts: 215
Joined: 26 Aug 2009, 18:20
Location: Peterborough, England

Re: save scalars

Post by mark smith »

Hi Dmetry,
here are the relevant sections from my sif file

!constants defined above the simulation section
$ Cp = 1632.0 ! Cp & rho for material 1 the fluid
$ rho = 1194.5

!the savescalars solver
Solver 4 !! calculate the temperature loads through the BC faces !
Exec solver = After timestep
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = results.dat !! the name of the saved results file
Operator 1 = "boundary int"
Variable 1 = "Temperature"
Operator 2 = "boundary int"
Variable 2 = "Pressure"
Variable 3 = "Temperature" ! the Temperature is available in both the solid & liquid domains so use this to get the
! area of each BC in each partition
operator 3 = "area" ! sum the boundary integrals for each of the partitions then divide by the boundary area to
!get the mean T & p over each BC
Operator 4 = "diffusive flux" ! The heat flux thro the solid boundary
Variable 4 = "Temperature"
Coefficient 4 = "Heat Conductivity"

Variable 5 = "Temperature"
Operator 5 = "convective flux" ! Heat flow with fluid c_rho=rho*Cp
Coefficient 5 = "c_rho"
End

! material 1 properties
Material 1
Name = "fluid with constant properties"
Viscosity = 11.364e-3
Heat Conductivity = 0.174
Heat Capacity = 1632.0
Density = 1194.5
$ c_rho = Cp*rho
End

hope this helps?
Thanks in advance
Regards
Mark
dmitry
Posts: 53
Joined: 09 Dec 2014, 16:52
Antispam: Yes
Location: Russia

Re: save scalars

Post by dmitry »

In the material section definition for "c_rho" property is not correct:
mark smith wrote: Material 1
Name = "fluid with constant properties"
Viscosity = 11.364e-3
Heat Conductivity = 0.174
Heat Capacity = 1632.0
Density = 1194.5
$ c_rho = Cp*rho
End
"c_rho" should be specified like this:

Code: Select all

 c_rho = Real $Cp*rho
Exactly as I wrote in previous post. Since "c_rho" property is not specified in keyword list of Elmer, you necessarily have to specify its type. In this case it is "Real". Sign "$" means that you enforce calculation of "c_rho" during solution from previously defined constants "Cp" and "rho".
If Heat capacity and density depends on fields you may to introduce "c_rho" as usual by the means of table or MATC language.
Also in the solver section name of parameter "c_rho" should be given with its type as following:

Code: Select all

 Coefficient 5 = String "c_rho"
Models manual describes types of sif file lines.
Good luck! ;)

Best regards!
Dmitry
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: save scalars

Post by annier »

Hi Dmitry,
Very clear and useful elaborations, illustrations and instructions. Thank you.

Yours Sincerely,
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mark smith
Posts: 215
Joined: 26 Aug 2009, 18:20
Location: Peterborough, England

Re: save scalars

Post by mark smith »

Hi Dmitry,
Thank you for your continued help and suggestions but unfortunately it has made no difference, elmersolver_mpi still complains.

WARNING:: ListFind: Requested property: [c_rho], not found

I have upgraded to the latest version, details below to see if this might help
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.2 (Rev: Release, Compiled: 2016-03-15)
MAIN: Running in parallel using 16 tasks.
MAIN: =============================================================

But this has made no difference either.
It is odd that elmersolver_mpi now complains on finishing (unlike before when it just hung) with the error massage shown in the attachment, I don't think this is related but I wonder if this might be linked with reports of elmergui hanging on windows 7 with elmer 8 versions?

Best Regards
Mark
Attachments
elmersolver_mpi error screen shot
elmersolver_mpi error screen shot
elmersolver_mpi error.PNG (13.09 KiB) Viewed 6047 times
dmitry
Posts: 53
Joined: 09 Dec 2014, 16:52
Antispam: Yes
Location: Russia

Re: save scalars

Post by dmitry »

Hi!
I use folloing version:

ELMER SOLVER (v 8.0) STARTED AT: 2016/06/10 15:24:24
ParCommInit: Initialize #PEs: 1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.0 (Rev: Release, Compiled: 2015-05-04)
MAIN: =============================================================

It save convective flux well. So, I do not know what's a matter of your problem.

I use Elmer without parallelization. May be it is parallell copmputation realization issues...
mark smith
Posts: 215
Joined: 26 Aug 2009, 18:20
Location: Peterborough, England

Re: save scalars

Post by mark smith »

Hi Dmitry,
Unfortunately I get the same problem with a serial solve, I will try with an older version of Elmer ver 7 to see if this has the same problems.
Regards
Mark
Post Reply