
[Sponsors] 
July 25, 2010, 04:45 
surfaceScalarField into VolumeScalarField

#1 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24 
hi dear foamers
i have an surface Scalar Field i want to change it into a volume Scalar Field whats ur suggestions ? my code is like below .... volVectorField mFlux=K*fvc::grad(T)/L; surfaceVectorField mFluxf=fvc::interpolate(mFlux); const surfaceVectorField& sf=mesh.Sf(); surfaceScalarField mvCoef=(mFluxf & sf); volScalarField mvCoefV= ??? mvCoef .... what should i substitute instead of "???" in above code ? 

July 25, 2010, 11:12 

#2 
New Member
xiang chai
Join Date: Aug 2009
Posts: 13
Rep Power: 17 
Hi,
I think fvc::reconstruct(mvCoef) can do it for you. chai 

November 12, 2011, 07:44 

#3 
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17 
Hi nimasam,
your post is rather old, but I'm facing the same problem right now. I have to convert a surfaceScalarField into a volScalarField to directly save and visualize the Courant number in the cells. Did you find an easy way to interpolate the values? I'm not sure what fvc::reconstruct() is doing, and it also did not compile in the way I used it. A workaround is saving the surfaceScalarField directly and visualize it in ParaView using foamToVTK surfaceFields. But thats just a workaround... Arne 

November 12, 2011, 15:46 

#4 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21 
Can you post your errors+relevant code? fvc::reconstruct is more or less the opposite of fvc::interpolate.
Did you check out the Co utility? 

November 15, 2011, 02:42 

#5 
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17 
Thanks Bernhard,
I did not know the Co utility until now. Just implemented the same functionality within the solver, in if(runTime.outputTime()), and all is fine. Arne 

November 17, 2014, 10:22 

#6 
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 13 
Dear All,
fvc::reconstruct operates only on Vector and Tensor fields. What about scalar fields ? Which command should we use to convert a surface field to volumetric field?
__________________
Thanks and Regards Vignesh 

November 17, 2014, 15:11 

#7  
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 
Greetings Vignesh,
Some years ago I wrote a couple of neat utilities that help test the field reconstruct and interpolate features in OpenFOAM: https://github.com/wyldckat/reconstr...rpolatefields Including a wiki page with some helpful tips on this topic: https://github.com/wyldckat/reconstr...tefields/wiki Regarding your question, I wrote back then: https://github.com/wyldckat/reconstr...ctSurfaceField Quote:
Best regards, Bruno
__________________


November 18, 2014, 01:45 

#8 
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 13 
Dear Bruno,
Thank you very much for the reply and also for the neat explanation about the reconstruct option. Actually i am trying to reconstruct from a scalar surface field. It is not the outcome of the operation fvc::interpolate(volVectorField) & Mesh.Sf() I am sorry to ask again ..... Is there any way to reconstruct a scalarfield ?
__________________
Thanks and Regards Vignesh 

November 23, 2014, 15:12 

#9 
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 
Hi Vignesh,
Can you provide more specific details? Because the answer seems simply to be: Code:
fvc::reconstruct(surfScaField) Best regards, Bruno 

November 24, 2014, 02:40 

#10  
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 13 
Quote:
I was trying to smooth the volume fraction using the relation given below where is the volume fraction and the symbol implies interpolate from cell center to face and the other one is the reverse (interpolate back to center from face). Interpolating back to cell centers is the point where i got stuck. I tried using fvc::reconstruct(alphaF) but i got errors indicating you cannot do this operation. I found this smoothing function for volume fraction in this Paper Thanks for your help
__________________
Thanks and Regards Vignesh 

January 3, 2015, 05:25 

#11 
Senior Member

Dear All,
I need to calculate "volScalarField" from "surfaceScalarField", if I apply "reconstruct" on surfaceScalarField it gives me "volVectorField". Any Idea how I would achieve this? 

January 3, 2015, 11:35 

#12  
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 
Greetings to all!
@vigneshTG: I've finally managed to look into this: Quote:
Curiously, I found about the following methods, which are all used in this file: applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H
Quote:
The other thing that comes to mind is rhoCentralFoam, so you might want to look at it for ideas as well... Anyway, the schematic I came up is in the attached files:
So I went looking for the code that "fvc::reconstruct" has got inside it, and found it here: src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C Quote:
In addition, there is one other interesting method named "fvc::reconstructMag", but this will unlikely give you the desired results. In addition, I very strongly advise you to test these functions with some basic calculations, where you have a simple mesh with simple values inside each cell of the mesh, so that you can then you verify if the calculations are done exactly the way you want them to be.  @Tushar@cfd: Quote:
Which makes me need to ask you: did you even read the past few 45 posts above? And I hope you can look at the explanation I gave above to vigneshTG and that you understand that it isn't as simple as just converting a surface scalar field to a volume scalar field, since otherwise you might be simply be generating garbage values out of a perfectly nice surface field Best regards, Bruno Last edited by wyldckat; January 3, 2015 at 14:14. Reason: attached the missing images 

May 31, 2018, 05:04 

#13 
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16 
Dear Bruno,
I had a look at https://openfoamwiki.net/index.php/C...rpolatefields. It seems that it is for postprocessing. Can I use it for the runtime? I mean as a function in the code? Cheers, Elham Last edited by Elham; June 1, 2018 at 10:54. 

Tags 
surfacescalarfield, volscalarfield 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
MSHArequest for surfaceScalarField phi from objectRegistry  msha  OpenFOAM Running, Solving & CFD  11  March 21, 2014 03:35 
[OpenFOAM] Visualisation of a surfaceScalarField with paraview  sinusmontis  ParaView  3  July 9, 2010 04:09 
[OpenFOAM] surfaceScalarField in paraFoam  danielr  ParaView  1  October 5, 2009 02:08 
sampling a surfaceScalarField  feijooos  OpenFOAM PostProcessing  0  July 22, 2009 13:05 
SurfaceScalarField ghf in interFoam how does it look like  mcchouffe  OpenFOAM Running, Solving & CFD  11  July 3, 2007 10:33 