CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

domainIntegrate() vs Sum(...)

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By wyldckat
  • 1 Post By Tobi
  • 2 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2014, 10:01
Default domainIntegrate() vs Sum(...)
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hello all together,

just one question.
If I have the following code:
Code:
Info << fvc::domainIntegrate(rho);
This give me the mass in the system, isn't it? If I use that one:
Code:
forAll(rho, cellI)
{
     mass_ += rho[cellI]*mesh.V()[cellI];
}
Info << mass_;
It give me also the mass in the system. But the output is different? Why? If I have a look into the domainIntegrate function it is like:
Code:
  111 template<class Type>   112 dimensioned<Type> domainIntegrate
   113 (
   114     const DimensionedField<Type, volMesh>& df
   115 )
   116 {
   117     return dimensioned<Type>
   118     (
   119         "domainIntegrate(" + df.name() + ')',
   120         dimVol*df.dimensions(),
   121         gSum(fvc::volumeIntegrate(df))
   122     );
   123 }
And in volumeIntegrate its the same as above! Value * VOlume

Tobi
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; November 22, 2014 at 11:17.
Tobi is offline   Reply With Quote

Old   November 22, 2014, 12:09
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
First idea: gSum supports multi-processor runs. Did you test with a single process?
jherb is offline   Reply With Quote

Old   November 22, 2014, 20:17
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi, only on single processor. But maybe I made a mistake because the calculation is exactly the same
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   November 23, 2014, 13:17
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Tobi: This is one of those situations I feel like complaining that I don't have a crystal ball.

My guess is that:
  1. Rookie mistake #1 - assuming a variable starts with 0.0:
    Code:
    forAll(rho, cellI)
    {
         mass_ += rho[cellI]*mesh.V()[cellI];
    }
    Info << mass_;
    It's missing this:
    Code:
    mass_ = 0.0;
    before the forAll cycle.
  2. Rookie mistake #2:
    Quote:
    Originally Posted by Tobi View Post
    But the output is different? Why?
    No scientific exposition to support one's statement. Are you sure you're doing Computational Fluid Dynamics?
    In other words, it's like saying that "a potato is identical to an orange", without even an image or values to support the statement
    Without any specific values for us to assess, the values might actually be as good as identical or actually be completely different, for example:
    • 1.0000001 vs 1.0000000
    • 1.0 vs 100002142134.012312
Best regards,
Bruno
fly_light likes this.
__________________
wyldckat is offline   Reply With Quote

Old   November 23, 2014, 14:30
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Bruno,

I set the mass_ to zero and I build a new model for shrinkage the mesh due to density changes in casting. I made an error but the calculation what I did is correct!
So its solved ... there is no error !
My fault - to tierd all the time and therefor I go to bed now.
wyldckat likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 18, 2016, 11:41
Default
  #6
New Member
 
DANG
Join Date: Apr 2016
Location: Lyon 1, France
Posts: 26
Rep Power: 10
doubledang is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hi Bruno,

I set the mass_ to zero and I build a new model for shrinkage the mesh due to density changes in casting. I made an error but the calculation what I did is correct!
So its solved ... there is no error !
My fault - to tierd all the time and therefor I go to bed now.


Hi Tobi,

I have encountered exactly the same problem as this post,
Could you please disclose what kind of errors did you make leading the difference between the two approaches?
Many thanks!

Best regards,
Dang.
doubledang is offline   Reply With Quote

Old   October 18, 2016, 11:49
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Dang,

I am sorry that i did not post the solution to my problem here and based on the fact that it is already 2 years old, I can no remember how I solved it or what I did wrong.

Maybe I can check out the old stuff and figure out what I did.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 18, 2016, 11:54
Default
  #8
New Member
 
DANG
Join Date: Apr 2016
Location: Lyon 1, France
Posts: 26
Rep Power: 10
doubledang is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hi Dang,

I am sorry that i did not post the solution to my problem here and based on the fact that it is already 2 years old, I can no remember how I solved it or what I did wrong.

Maybe I can check out the old stuff and figure out what I did.

Hi Tobi,

I really appreciate if you could check a little bit (if possible),
I exhausted on this issue. ..

Thanks for your time!

Best regards,
doubledang is offline   Reply With Quote

Old   October 18, 2016, 13:55
Default
  #9
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Dang,

I checked my code and the latest developments. Based on the fact that the first shrinkage model (2014) was not really physical, I switched the development line after some discussions with my colleague and there is no code anymore that includes this lines. However, I found some issues in my bitbucket history that are about that problem. Do you have access to that one: https://bitbucket.org/opencast/tscst...-conservation?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 19, 2016, 04:51
Default
  #10
New Member
 
DANG
Join Date: Apr 2016
Location: Lyon 1, France
Posts: 26
Rep Power: 10
doubledang is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Dear Dang,

I checked my code and the latest developments. Based on the fact that the first shrinkage model (2014) was not really physical, I switched the development line after some discussions with my colleague and there is no code anymore that includes this lines. However, I found some issues in my bitbucket history that are about that problem. Do you have access to that one: https://bitbucket.org/opencast/tscst...-conservation?

Dear Tobi,

Thanks a lot for your kind help and time.
I tried to access the link, but denied.
Is it possible to work around?

Thanks!

Best regards,
doubledang is offline   Reply With Quote

Old   October 19, 2016, 05:45
Default
  #11
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Dang,

the problem was not really critical in my case because it was only around 0.3%. See the bitbucket stuff (I added the pictures) because the project is closed (I forgot).
Attached Images
File Type: png 1.png (102.1 KB, 91 views)
File Type: jpg 2.jpg (40.0 KB, 55 views)
File Type: jpg 3.jpg (79.8 KB, 61 views)
File Type: png 4.png (49.2 KB, 54 views)
File Type: jpg 5.jpg (98.7 KB, 54 views)
luoyang and Teresa.Z like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 19, 2016, 09:37
Default
  #12
New Member
 
DANG
Join Date: Apr 2016
Location: Lyon 1, France
Posts: 26
Rep Power: 10
doubledang is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Dear Dang,

the problem was not really critical in my case because it was only around 0.3%. See the bitbucket stuff (I added the pictures) because the project is closed (I forgot).

Dear Tobi,

Okay, I see.
Thanks a lot for your kind help and time.


Best regards,
Dang.
doubledang is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 22:57.