CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   how to add fields in list as default? (http://www.cfd-online.com/Forums/openfoam-paraview/120008-how-add-fields-list-default.html)

immortality June 28, 2013 04:31

how to add fields in list as default?
 
when we open a case in paraview p and U fields are in field list without need to select them separately,how can i add T field to the list so that it be automatically available whenever i open a case in paraview?

wyldckat June 28, 2013 15:59

Hi Ehsan,

This is one of those situations where there is the simple way and the complicated way :rolleyes:

The simple way is to simply run:
Code:

paraFoam -builtin
This will tell paraFoam to use the extension ".foam" in ParaView, which means that the internal reader will be used to open the case. The controls are somewhat different, but at least all fields are loaded by default.


The complicated way requires hacking the source code:
  1. Edit the file given by the following command:
    Code:

    echo "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H"
  2. Find this block of code:
    Code:

            enabledEntries.setSize(2);
            enabledEntries[0] = "p";
            enabledEntries[1] = "U";

  3. Change it to this:
    Code:

            enabledEntries.setSize(3);
            enabledEntries[0] = "p";
            enabledEntries[1] = "U";
            enabledEntries[2] = "T";

  4. Save and close the file.
  5. Rebuild OpenFOAM's plug-ins for ParaView:
    Code:

    cd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers
    ./Allwclean
    ./Allwmake

Two notes:
  • This hack can lead to a crash when you try to open a case that does not have the "T" field.
  • If you have got the Deb or RPM version of OpenFOAM installed, then you need to edit and rebuild the plug-ins with root powers.
Best regards,
Bruno

immortality June 28, 2013 16:23

Quote:

If you have got the Deb or RPM version of OpenFOAM installed, then you need to edit and rebuild the plug-ins with root powers.
Hi Bruno
How to edit the file with root power?

wyldckat June 28, 2013 16:46

Remember this thread: http://www.cfd-online.com/Forums/ope...nd-solver.html :confused:
Back in April it looked like you knew how to edit files as root...

immortality June 28, 2013 16:51

Quote:

Originally Posted by immortality (Post 436634)
Hi Bruno
How to edit the file with root power?

I found the file you said but it can't be saved.it has only save as.

wyldckat June 28, 2013 17:04

Quote:

Originally Posted by immortality (Post 436642)
I found the file you said but it can't be saved.it has only save as.

OK, then maybe it's better to think this the other way around:
  1. Change the permissions on the file, by running this command:
    Code:

    sudo chmod og+w "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H"
    This will allow you to write to the file.
  2. Modify the file with the text editor you were using and then save the file. If it gives you an error about not being to save a backup file, it doesn't matter much, because we don't need a backup.
  3. Change the permissions on the file once again, by running:
    Code:

    sudo chmod og-w  "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H"
Then for building, run:
Code:

sudo su -c ". $WM_PROJECT_DIR/etc/bashrc ; ./Allwclean; ./Allwmake"

immortality June 28, 2013 17:09

when I click on "save anyway" it doesn't take action and "don't save" button turns red again and again!

wyldckat June 28, 2013 17:12

Then try to change the permissions to the whole folder:
Code:

sudo chmod -R og+w "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/"
Then after saving, undo with:
Code:

sudo chmod -R og-w "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/"

immortality June 28, 2013 17:25

ehsan@Ehsan-com:~$ sudo chmod -R og+w "$FOAM_UTILITIES/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/
>
Bruno the cursor blinks!and it doesn't affect!

wyldckat June 28, 2013 17:33

Sorry, I completely forgot about the closing quote character. I've updated the previous post with the correct code.

immortality June 28, 2013 17:49

thanks a lot Bruno
It works fine now.T field is added to the list automatically.I always prefer to go a long and maybe hard way at first but be relaxed later!
how do you know all these things in different areas?!;)
how many years are you working on your skills?


All times are GMT -4. The time now is 04:56.