CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to visualize the difference of fields btween two simulation (http://www.cfd-online.com/Forums/openfoam-post-processing/122286-how-visualize-difference-fields-btween-two-simulation.html)

msarkar August 16, 2013 06:43

How to visualize the difference of fields btween two simulation
 
Hi Foamers,
Could you please tell me how to visualize the difference of fields (T, U etc.) between two OF simulations using Paraview? Same mesh used for both.

Thanks in advance.

Bernhard August 16, 2013 06:52

I would just copy some files for the cases you want to compare and then use foamCalc.

You can subtract two fields by
Code:

foamCalcEx addSubtract field1 subtract -field field2

msarkar August 16, 2013 06:58

Quote:

Originally Posted by Bernhard (Post 446086)
I would just copy some files for the cases you want to compare and then use foamCalc.

You can subtract two fields by
Code:

foamCalcEx addSubtract field1 subtract -field field2

Hi Bernhard,
Thanks a lot for your quick reply. Could you please tell me in little details. Suppose I have two cases (case1 & case2) and I want to compare T and U between case 1 & case2. How do I proceed?

Bernhard August 16, 2013 07:03

Well, easiest is to copy T en U from case 1 to case 2 (but with a different name), especially if you want to do this only once, it is a quick and dirty solution.

msarkar August 16, 2013 07:34

Thanks Bernhard, I will try this.

msarkar August 16, 2013 08:01

Hi Bernhard,

I did the followings and got error. Please let me know what I am missing.

My cases are multi region case. I copied latest T from case2 to case1 in corresponding regions with name T_reg1, T_reg2 and T_reg3 in the latest time directory. The tried the following commands and every time getting error.

foamCalc addSubtract T subtract -T T_reg1 -region reg1 -latestTime
foamCalc addSubtract T subtract T_reg1 -region reg1 -latestTime
foamCalc -region reg1 -latestTime addSubtract T subtract -T T_reg1
foamCalc addSubtract -region reg1 -latestTime T subtract -T T_reg1

Bernhard August 16, 2013 08:03

Instead of -T and -region use always -field. I'm sorry if this was unclear.

msarkar August 19, 2013 08:19

Hi Bernhard,

Thanks a lot for your help. Finally it worked.

immortality August 21, 2013 05:21

Hi all
I want to compare p fields between two similar time's of two successive cycles in my case to see if the solution has converged well or not yet,how to do what has told here only for one case in different times?

immortality August 30, 2013 07:06

this error occurred when I wanted to have access to help:
Code:

ehsan@Ehsan-com:~$ foamCalcEx -help
foamCalcEx: command not found
ehsan@Ehsan-com:~$ foamCalcEx --help
foamCalcEx: command not found
ehsan@Ehsan-com:~$ foamCalcEX --help
foamCalcEX: command not found
ehsan@Ehsan-com:~$ foamCalcEX addSubtract --help
foamCalcEX: command not found
ehsan@Ehsan-com:~$


wyldckat August 31, 2013 12:46

Hi Ehsan,

foamCalc is one of the few applications in OpenFOAM that do not respond directly to help requests :(
This is due to how it was designed to work, namely it first must strictly receive the name of the operation name for the calculation. For example, these two commands should work for getting help:
Code:

foamCalc -help
foamCalc addSubtract -help

The first one indicates which operators exist and the second one gives the help for this operation.

For additional help reference on how to use these kinds of applications:


In particular to your problem about foamCalcEx, I believe there is a thread where building it is discussed... well, not exactly dedicated to it, but here it is: http://www.cfd-online.com/Forums/ope...l-mag-u-2.html



Best regards,
Bruno

immortality August 31, 2013 15:35

Hi Bruno
thanks,but whats foamCalcEx?
Quote:

I would just copy some files for the cases you want to compare and then use foamCalc.

You can subtract two fields by
Code:
foamCalcEx addSubtract field1 subtract -field field2
Code:

ehsan@Ehsan-com:~$ foamCalcEx addSubtract -help
foamCalcEx: command not found
ehsan@Ehsan-com:~$ foamCalcEx -help
foamCalcEx: command not found

and how I have to use options for one field in two times of one case?how to use -time option?:confused:

immortality August 31, 2013 16:02

the link for download is banned!:eek:
http://openfoamwiki.net/index.php/Co...amCalcEx#Usage
Code:

ehsan@Ehsan-com:~$ hg clone https://code.google.com/p/foamcalcex/
abort: HTTP Error 403: Forbidden

is there another way to download it?

wyldckat August 31, 2013 16:12

Doesn't work for the same reason has you mentioned here: http://www.cfd-online.com/Forums/ope...tml#post443306 - post #59

But this is a good opportunity to see if you can download from the correct location. Try these two possibilities:
  • While still using hg, run without the HTTPS connection and use HTTP:
    Code:

    hg clone http://code.google.com/p/foamcalcex/
  • Or try the download from the zip snapshot:
    Code:

    wget http://foamcalcex.googlecode.com/archive/tip.zip
With any luck, at least of these still work.

immortality August 31, 2013 16:28

thanks,the second way answered well:
Code:

ehsan@Ehsan-com:~$ hg clone http://code.google.com/p/foamcalcex/
abort: HTTP Error 403: Forbidden
ehsan@Ehsan-com:~$ wget http://foamcalcex.googlecode.com/archive/tip.zip
--2013-09-01 00:56:36--  http://foamcalcex.googlecode.com/archive/tip.zip
Resolving foamcalcex.googlecode.com... 173.194.70.82, 2a00:1450:4001:c02::52
Connecting to foamcalcex.googlecode.com|173.194.70.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-compressed]
Saving to: `tip.zip'

    [                        <=>            ] 95,283      4.46K/s  in 22s   

2013-09-01 00:57:02 (4.26 KB/s) - `tip.zip' saved [95283]

now what should I do to compile it?it has downloaded in another place except to downolads folder.

wyldckat August 31, 2013 16:54

I've updated the wiki page. Check the updated build instructions: http://openfoamwiki.net/index.php/Co...alcEx#Download

immortality August 31, 2013 17:05

thanks a lot, I wonder how code.google worked altough that's good!
I have to use sudo?
Code:

ehsan@Ehsan-com:~/foamcalcex-2c7dd0c903db$ ./Allwmake
~/foamcalcex-2c7dd0c903db/postProcessing ~/foamcalcex-2c7dd0c903db
./Allwmake: line 5: ./Allwmake: Permission denied


wyldckat August 31, 2013 17:14

Ooops, I forgot to test the commands myself... there was a file missing from the chmod command line... the fixed one is:
Code:

chmod +x Allwmake postProcessing/Allwmake

As for googlecode.com vs code.google.com: if I'm not mistaken, the problem is that "code.google.com" switches to HTTPS by default, and HTTPS apparently is banned in your country.
But "googlecode.com" does not rely on HTTPS to work, so you can download files from the Google Code repositories from that server.

immortality August 31, 2013 17:45

thanks,it compiled well,but I don't know how to use it for my purpose yet!:(
Quote:

and how I have to use options for one field in two times of one case?how to use -time option?

wyldckat August 31, 2013 19:06

Hi Ehsan,

Quote:

Originally Posted by immortality (Post 449124)
thanks,it compiled well,but I don't know how to use it for my purpose yet!:(

:confused: ... Oooohh... you wanted to compare times... you don't need foamCalcEx for that, OpenFOAM's foamCalc is enough.

Bernhard had already explained this in post #4:
Quote:

Originally Posted by Bernhard (Post 446092)
Well, easiest is to copy T en U from case 1 to case 2 (but with a different name), especially if you want to do this only once, it is a quick and dirty solution.

For example, in the tutorial "incompressible/icoFoam/cavity" case, I ran the following commands:
Code:

cp 0.1/p 0.2/p_0.1
foamCalc addSubtract p subtract -field p_0.1 -time 0.2

Which results in the field "p_subtract_p_0.1".

If you want to do this for all time instances, then... er... then some scripting is required... let's see if I can do this half-asleep :(:
Code:

fieldToCopy="p"
a=0
for b in $(foamListTimes); do

  cp $a/${fieldToCopy} $b/${fieldToCopy}_prev

  a=$b

done

foamCalc addSubtract ${fieldToCopy} subtract -field ${fieldToCopy}_prev

In this example, the field name specified in "fieldToCopy" will be copied between time snapshots with the new named "${fieldToCopy}_prev". For this specific case, the resulting difference field will be named "p_subtract_p_prev".

What you know... I did it half-asleep :cool:

Best regards,
Bruno


All times are GMT -4. The time now is 03:37.