CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   problem using paraview (

zobekenobe December 5, 2009 15:59

problem using paraview
i have created a solver of my own by simply modifying a tutorial case set-up, after running the case and opening paraview for post processing i cant get to view the new variables.i have created a new a variable T (temp) but i can only see the results of p and U and not T.

how do i solve this problem.

rudy December 7, 2009 10:07

I am using Electrostatic solver and in my solution i have got potential and charge density distribution in my domain but now I want to find gradient of the potential distribution(electric field) and I am using "gradient of unstructured dataset" function from parafoam for the purpose but while applying this function in parafoam it stops inbetween and yields the following error:

Generic Warning: In /home/dm2/henry/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/VTK/Common/vtkMath.cxx, line 1645
Unable to factor linear system

can anyone tell me what does it imply and how to solve it.

madad2005 December 7, 2009 10:14

Even though that error appears, you should still have the gradients right? If you want to compute grad(scalar) then use foamCalc instead.

zobekenobe December 7, 2009 10:38

check out this link

your solution is somewhere here

rudy December 9, 2009 11:09

To madad2005:
Yes,it gives me the output error messege and also gives the gradient but looking at the result for gradient i have a doubt that it's not correct or may be not computed till end,I don't know but have some reasons to believe it so I want to confirm the result of potential I tried using foamCalc,but it doesn't seem to work and rightly so as i think it is meant to give scalar components of vector fields while my variable potential is a scalar and i want to find its the way i applied it and got the following messege:

$ foamCalc components phi

but it gives the following error messege:

Create time

Create mesh for time = 0

Time = 0

Unable to process phi
No call to components for fields of type volScalarField

FOAM exiting

I don't exactly know what can i do to get gradient of a scalar field(potential).

To zobekenobe:
Can u be bit more specific please...
i tried to run foamToVTK which worked and then I open parafoam from case dir,but still i get the same solution.I don't know what difference this has made...

thanks to both of u...

madad2005 December 9, 2009 11:38

Yeah, I keep forgetting about that. You'll have to write your own utility to get the grad of a scalar. See these slides by H. Jasak for guidlines how to do so (Walk Through a Post-Utility slides 11/12).

You'll be reading a volScalarField and returning a volVectorField. The command for getting the gradient is fvc::grad(<your varname here>) I think. It is usually best to just copy a utility that already exists and hack the code as you need it.

Good luck with it anyways.

p.s. From my experience, the gradients in ParaView are qualitively good.

rudy December 10, 2009 12:29

Thanks adriano,but I tried to make my own utility file as u said above but when i try to run from inside casefile it gives the following error:

No command 'grad' found, did you mean:
Command 'glrad' from package 'radiance' (universe)
Command 'trad' from package 'radiance' (universe)
Command 'grap' from package 'grap' (universe)
Command 'rad' from package 'radiance' (universe)
grad: command not found

I have generated a new utility named grad in utilities/postprocessing/grad which is as follows:

#include "fvCFD.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
#include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"

forAll(timeDirs, timeI)
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

IOobject phiheader

// Check phi exists
if (phiheader.headerOk())

Info<< " Reading phi" << endl;
volScalarField phi(phiheader, mesh);

Info<< " Calculating gradphi" << endl;

volVectorField gradphi

forAll(gradphi.boundaryField(), patchi)
gradphi.boundaryField()[patchi] =

Info<< " No phi" << endl;

Info<< "End" << endl;

return 0;

I just modified the utility file wall/wallGradU/wallGradU.C accordingly...I am not really good at programming so if u have any idea where i m making a mistake please let me know...

madad2005 December 15, 2009 05:14

Sorry for not replying sooner, but I'm really busy in the run up to Xmas. I have a code that will do this but it is at home on my laptop. I can e-mail it to you later on and/or post it here. If you have managed to get it working, then let me know.

rudy December 15, 2009 17:35

I have something which finds gradient now,following someone's instructions I made a .H file in the case directory and then included it in my main solver .C file(similar to the laplacianfoam solver)...But if u followed a different procedure to find a gradient please let me know,I would like to know new way as well...
thanks a lot...

All times are GMT -4. The time now is 14:36.