problem specifying alpha at inlet during a parallel run
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; |
Quote:
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 |
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 |
All times are GMT -4. The time now is 19:20. |