|
[Sponsors] |
May 16, 2018, 11:06 |
Surface gradient (snGrad) calculation
|
#1 |
New Member
Artem
Join Date: Apr 2014
Posts: 29
Rep Power: 12 |
Hello dear Foamers,
I have a following issue, may be somebody could help me. I have a VolScalarField PotE I am trying to calculate surface gradient for this variable. As I read in programmers guide, fvc:: snGrad(PotE) must help me with this. But when I try to create new variable Code:
SurfaceVectorField A = fvc:: snGrad(PotE)*mesh.Sf() ; Thanks in advance. Best regards, Artem |
|
May 16, 2018, 13:57 |
|
#2 |
Member
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 15 |
Hello
Is it possible to show the error? |
|
May 16, 2018, 14:08 |
|
#3 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
It should be surfaceVectorField not SurfaceVectorField. Check it carefully.
|
|
May 17, 2018, 03:45 |
|
#4 | |
New Member
Artem
Join Date: Apr 2014
Posts: 29
Rep Power: 12 |
Hello all, thank you for your answers
Quote:
Sure but is so huge, so I provide only the headline with the most important information (I guess) Code:
mhdEpot2Foam.C: In function ‘int main(int, char**)’: mhdEpot2Foam.C:148:66: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> >’ to non-scalar type ‘Foam::surfaceScalarField {aka Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>}’ requested surfaceScalarField jn = -sigma * fvc::snGrad(PotE)*mesh.Sf() + psiub; ^ |
||
May 17, 2018, 06:00 |
|
#5 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
If you want a dot-product of vector fields you should use
Code:
& Code:
fvc::snGrad(PotE) & mesh.Sf() |
|
May 17, 2018, 07:05 |
|
#6 | |
New Member
Artem
Join Date: Apr 2014
Posts: 29
Rep Power: 12 |
Quote:
Code:
mhdEpot2Foam.C: In function ‘int main(int, char**)’: mhdEpot2Foam.C:148:55: error: no match for ‘operator&’ (operand types are ‘Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >’ and ‘Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> >’) surfaceScalarField jn = -sigma * fvc::snGrad(PotE) & mesh.Sf() + psiub; ^ |
||
May 17, 2018, 15:59 |
|
#7 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
My bad, fvc::snGrad results in a scalar field, you can't dot-product it with a vector field. Stick to your first option. Then fvc::snGrad(PotE)*mesh.Sf() is a vector field, what is psiub, how is it defined? It must be a vector field as well as summation fvc::snGrad(PotE) & mesh.Sf() + psiub only make sense over two vector fields.
|
|
May 22, 2023, 09:03 |
Respond
|
#8 | |
New Member
Alex
Join Date: May 2023
Posts: 1
Rep Power: 0 |
Quote:
Since the snGrad isn't a tensor as you use the scalar "PotE" inside, it still a surfaceScalarField. Thus as you are already "speaking" in projections, use the magnitude of the surface because your snGrad is already oriented with it. Even if its too late ... |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible | velan | OpenFOAM Meshing & Mesh Conversion | 3 | October 22, 2015 11:05 |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 02:09 |
[General] Problem in the calculation of the normal gradient on a boundary face | N1colas | ParaView | 1 | June 28, 2013 09:38 |
[Gmsh] boundaries with gmshToFoam | ouafa | OpenFOAM Meshing & Mesh Conversion | 7 | May 21, 2010 12:43 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 04:41 |