CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

problem specifying alpha at inlet during a parallel run

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 12, 2009, 20:35
Default problem specifying alpha at inlet during a parallel run
  #1
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 269
Rep Power: 8
phsieh2005 is on a distinguished road
Dear OpenFOAM experts:

I want to specify alpha field at the inlet as a function of time. The following piece of code worked fine when running in a serial case. It also run fine when the inlet is NOT partitioned into different processors. However, got alpha 0() if the inlet is partitioned to different processors.

It will be appreciated if someone can shed some light on how to fix this problem:

Thanks!

Pei
----
code:

label tIndex = label(runTime.value()/tPeriod);
scalar localTime = runTime.value() - tIndex*tPeriod;

// Get index of patch
label inletPatchID = mesh.boundaryMesh().findPatchID("inlet");

// Get reference to boundary value
vectorField& inletU = U.boundaryField()[inletPatchID];

// Manipulate value
if(localTime >= 0 && localTime < time1)
{
velInlet = Wmx*localTime/time1;
}
else if(localTime < time6)
{
velInlet = Wmx;
}
else if(localTime < time7)
{
scalar tempTime = localTime - time6;

velInlet = Wmx*(1.0 - (tempTime/(time7 - time6)));
}
else if(localTime < tPeriod)
{
velInlet = 0.0;
}

inletU = vector(velInlet, 0, 0);
Info<< "inletU:" << velInlet << endl;

scalarField& inletAlpha = alpha1.boundaryField()[inletPatchID];
if(localTime >= 0 && localTime < time3)
{
inletAlpha = 1;
}
else if(localTime < tPeriod)
{
inletAlpha = 0.0;
}
Info<< "inlet alpha = " << inletAlpha << endl;
phsieh2005 is offline   Reply With Quote

Old   August 13, 2009, 05:15
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,889
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by phsieh2005 View Post
Dear OpenFOAM experts:

I want to specify alpha field at the inlet as a function of time. The following piece of code worked fine when running in a serial case. It also run fine when the inlet is NOT partitioned into different processors. However, got alpha 0() if the inlet is partitioned to different processors.

It will be appreciated if someone can shed some light on how to fix this problem:
Am I right in assuming that you're doing this in the actual solver? Such things should be done in a boundary condition. Anyway: an alpha1.correctBoundaryConditions() might help to bring the processor patches to a consistent state.

On the other hand: why don't you use the timeVaryingUniform-boundaryCondition for that? Or groovyBC? Hardcoding boundary conditions into solver code is soooo Fortran

Bernhard
gschaider is offline   Reply With Quote

Old   August 13, 2009, 09:23
Default
  #3
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 269
Rep Power: 8
phsieh2005 is on a distinguished road
Thanks Bernhard!

Yes, this should have been done using timeVaryingUniformFvPatch BC - still learning how to do what I want using this derived BC.

According to Mattijs, Info prints out the info on the priminary processor. In my case, the inlet faces happen to be not on the priminary processor, hence, 0(). I have changed from Info to Pout, and now, it writes out the correct information and the code was correct.

Pei
phsieh2005 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to Run Parallel Jobs in Rocks Cluster asaha OpenFOAM Running, Solving & CFD 12 July 4, 2012 23:51
2D Low Speed Airfoil Problem when altering Inlet mike wilson CFX 12 August 3, 2010 12:06
Parallel moving mesh problem lr103476 OpenFOAM Running, Solving & CFD 29 November 26, 2008 02:55
parallel problem rui CD-adapco 2 July 31, 2007 14:23
PROBLEM IN PARALLEL PROGRAMMING WITH MPI Niavarani Main CFD Forum 1 April 20, 2004 07:51


All times are GMT -4. The time now is 11:50.