|
[Sponsors] |
July 6, 2015, 13:20 |
interfoam dataType confusion!!
|
#1 |
Senior Member
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12 |
Hi guys;
I am dealing with the interfoam solver and modifying the standard interfoam of 2.3.1 version. I came across a strange piece of code which i have not understood. I appreciate anyone's help here. I calculate the capillary pressure developed from the capillary(surface) forces. I calculate them at the cell center and interpolate them to the face centre. {so conversion from volScalarField to surfaceScalarField}. I solve for the fvScalarMatrix form equation to find the capillary pressure. Till here its looks fine. Compiles and case runs. Now, I would like to use the gradient of the calculated capillary pressure for some filtration process. Just checking the workability for a smaller term I created a new term: surfaceScalarField newTerm = fvc::grad(pcf); I get the following error related to the type declaration which i do not understand: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to non-scalar type ‘Foam::surfaceScalarField {aka Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>}’ requested surfaceScalarField newTerm = fvc::grad(pcf); ^ Though i sense it requests me to change from surface to volScalarField it makes no real meaning. For reference i post the related code. surfaceScalarField fc_0 = mixture.surfaceTensionForce(); fc = fvc::average(fc_0 * mesh.Sf()/mesh.magSf()); fvScalarMatrix pcEqn ( fvm::laplacian(pc) == fvc::div(fc) ); pcEqn.solve(); surfaceScalarField pcf = fvc::interpolate(pc); surfaceScalarField newTerm = fvc::grad(pcf); Appreciate any sort of help. Thanks; Saideep |
|
July 9, 2015, 11:20 |
|
#2 |
Senior Member
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12 |
hi guys;
Just in case if anyone comes across this error! Well i made an obvious mistake by taking the gradient of the scalar and defining it in terms of a scalar again. Firstly "grad of a scalar gives a vector". So, it should be a vol or surface VectorField based if the value is being computed at cell center or at the face centers. -- An another trick or rather something interesting that i came across is using a surfaceVectorField term for the computation of an surfaceScalarField. It is indeed not possible to do so. The obvious choice again is to convert the VectorField into a scalarField and i did it using the dot product of two vectors yielding a scalar. However, this becomes quite tedious as I had to modify several terms along with their dimensions in the process. Saideep |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
InterFoam stops after deltaT goes to 1e14 | francesco_b | OpenFOAM Running, Solving & CFD | 9 | July 25, 2020 06:36 |
interFoam vs. simpleFoam channel flow comparison | DanM | OpenFOAM Running, Solving & CFD | 12 | January 31, 2020 15:26 |
interFoam in parallel | gooya_kabir | OpenFOAM Running, Solving & CFD | 0 | December 9, 2013 05:09 |
Problem of InterFoam with LES SpalartAllmarasIDDES | keepfit | OpenFOAM | 3 | August 29, 2013 11:21 |
Open Channel Flow using InterFoam type solver | sxhdhi | OpenFOAM Running, Solving & CFD | 3 | May 5, 2009 21:58 |