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

Passing calculated values in parallel run

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2008, 10:41
Default Hi, I have a problem with the
  #1
New Member
 
Christian Wesemeyer
Join Date: Mar 2009
Posts: 19
Rep Power: 17
wese is on a distinguished road
Hi,
I have a problem with the parallel execution of OpenFOAM.
I've written a new boundary condition with calculated the input velocity profile of a square duct.
If I run my case on one processor I just have to calculate the values a single time when starting my calculation ( if(ldb.timeIndex() < 1)... ).
If I want to run my calculation in parallel mode I need to perform the calculation every time the program accesses the boundary condition (with is very often) and so I "waste" a lot of calculation time with a problem that doesn't change over time.
If I don't do so the velocity at my patch is set to some time varying value, from with I guess that it's calculated during execution.

How can I fix this problem?
I've already consulted the forum and the wiki (I've started with the parabolicinletVelocityprofile fot writing my BC) but was unable to find an appropriate hint how to do this.
Am I right, if I guess, that the problem is connected with the exchange of informations beween the processors?

Thanks in advance
Christian
wese is offline   Reply With Quote

Old   April 2, 2008, 03:13
Default Hi Christian, why do you need
  #2
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Christian,
why do you need to calculate your BC only once in serial and many times in parallel? It sounds strange to me...
However, you can let all your processes to calculate your BC when needed. I mean, do your computation on each processor at the same time, instead of doing it on the master node and send the result to the other processes...

I hope this can help

Francesco
fra76 is offline   Reply With Quote

Old   April 2, 2008, 10:19
Default Hello Francesco, thanks for y
  #3
New Member
 
Christian Wesemeyer
Join Date: Mar 2009
Posts: 19
Rep Power: 17
wese is on a distinguished road
Hello Francesco,
thanks for you reply.
Could you give me a hint how I do so, because I'm neither that much familiar with OpenFOAM nor with C++.
I guess a good idea would be, that the program check whether a file with the calculated values exists and if so reads it as input.
Otherwise the program should perform the calculation and write the output to the specific file.

Thanks in advance
Christian
wese is offline   Reply With Quote

Old   April 3, 2008, 06:43
Default Hello christian. It's not eas
  #4
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hello christian.
It's not easy to give you some hint, because I don't know exactly which is your problem...

If you can calculate the values you need, I guess you can avoid writing them to a file.
If your serial version works as you expect, simply let all the processors of a parallel run to do the same thing. If you rely on a file, you have to be sure that it exists at the beginning of the simulation, if you want to keep thing simple. Otherwise, if the file doesn't exist, simply calculate the values and store them in the BC data structure, without writing them to a file and read them back again.
If you want to store those values for any reason, you can let only the master process to write it:


if (Pstream::master())
{
[put your code here]
}


If you want to make the master to write the file and the rest to wait for it to finish, is a bit more complicated...

I hope this can help,
Francesco
fra76 is offline   Reply With Quote

Old   April 3, 2008, 08:45
Default Hi Francesco, thanks a lot fo
  #5
New Member
 
Christian Wesemeyer
Join Date: Mar 2009
Posts: 19
Rep Power: 17
wese is on a distinguished road
Hi Francesco,
thanks a lot for your help.
I finally managed the problem with the parallel run by creating and writing a variable after the first calculation.
So every processor can perfom the calculation if needed.
Otherwise the data is just read out of the value variable.

For a total beginner in C++ the openFOAM code is really difficult, because everything is coded so efficently.

If you have any interest I can post my new boundary condition for the velocity profile of a square duct.

Greetings
Christian
wese is offline   Reply With Quote

Old   April 3, 2008, 09:47
Default Hi Christian, I started C++ m
  #6
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Christian,
I started C++ mainly for OpenFOAM, and from my point of view it is not so difficult, because everything is coded so efficiently and in an elegant way!
Try to put your hands in a badly written parallel code. It can be a nightmare, believe me...

It would be nice to have a look to the BC, if you can post it, thanks.

Francesco
fra76 is offline   Reply With Quote

Old   April 3, 2008, 11:04
Default Hi Francesco, maybe you're ri
  #7
New Member
 
Christian Wesemeyer
Join Date: Mar 2009
Posts: 19
Rep Power: 17
wese is on a distinguished road
Hi Francesco,
maybe you're right.
At the moment I'm updating the document management system of our institute, which is written in PHP.
The scripts were created quick and dirty by someone several years ago.
Even if PHP is very simple to understand, all the encoded layout options really got me rid.
Compared to that openFOAM code is more than gold .

Attached you can find my new boundary condition which is an adaption of the parabolicVelocityProfile BC.
If you find any mayor mistakes or so please report.

squareVelocityProfile.tar.gz

Greetings
Christian
wese 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
Writting own files calculated value during the run in Parallel anne OpenFOAM Running, Solving & CFD 12 May 27, 2008 16:53
Calculated Values in scalar field arkangel OpenFOAM Running, Solving & CFD 0 June 28, 2007 08:53
how to export calculated values to a file colin Fidelity CFD 1 June 5, 2007 05:14
How have boundary values set for calculated variables olwi OpenFOAM Running, Solving & CFD 5 August 25, 2006 12:56
Parallel UDF data passing causes Fluent to hang Tom FLUENT 2 June 9, 2006 14:17


All times are GMT -4. The time now is 13:44.