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

#1 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,211
Blog Entries: 1
Rep Power: 17 
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: 9 
Hi,
I think fvc::reconstruct(mvCoef) can do it for you. chai 

November 12, 2011, 08:44 

#3 
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 10 
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, 16:46 

#4 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 14 
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, 03:42 

#5 
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 10 
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, 11:22 

#6 
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 63
Rep Power: 6 
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, 16:11 

#7  
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,748
Blog Entries: 39
Rep Power: 103 
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, 02:45 

#8 
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 63
Rep Power: 6 
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, 16:12 

#9 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,748
Blog Entries: 39
Rep Power: 103 
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, 03:40 

#10  
Member
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 63
Rep Power: 6 
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, 06: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, 12:35 

#12  
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,748
Blog Entries: 39
Rep Power: 103 
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 15:14. Reason: attached the missing images 

Tags 
surfacescalarfield, volscalarfield 
Thread Tools  
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 04:35 
Visualisation of a surfaceScalarField with paraview  sinusmontis  OpenFOAM Paraview & paraFoam  3  July 9, 2010 04:09 
surfaceScalarField in paraFoam  danielr  OpenFOAM Paraview & paraFoam  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 