View Issue Details

IDProjectCategoryView StatusLast Update
0002111OpenFOAM[All Projects] Bugpublic2016-11-22 02:14
ReporterguinAssigned Tohenry 
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Product Versiondev 
Fixed in Versiondev 
Summary0002111: DPMFoam hangs in parallel when using patchFlowRateInjection model.
DescriptionThe case hangs in parallel runs when using DPMFoam combined with patchFlowRateInjection.

More accurately, the hang happens when calling returnReduce(parcelsAdded, sumOp<label>()) from within the function postInjectCheck(), in the file:

/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
Steps To ReproduceUsing the tutorial case MPPICFoam/injectionCase:

0. File 0/U.air: Corrected Y-component of velocity in upperInlet patch with a "minus" sign (see reported bug with ID 0002110).

1. Decompose in two subdomains using simple method with:
simpleCoeffs
{
    n (1 2 1);
    delta 0.001;
}

2. Modify constant/kinematicCloudProperties:
 2.1.Replace the injection type in both injection models from "patchInjection" to "patchFlowRateInjection":
        model1
        {
// type patchInjection;
// parcelsPerSecond 1390885;
            //-----------------------------------------------------------------
                type patchFlowRateInjection;
                phi phi.air;
                rho rho.air;
                concentration 1;
                parcelConcentration 7e8; // it leads to a similar inlet rate
            //-----------------------------------------------------------------

            [...]
        }

        model2
        {
// type patchInjection;
// parcelsPerSecond 1390885;
            //-----------------------------------------------------------------
                type patchFlowRateInjection;
                phi phi.air;
                rho rho.air;
                concentration 1;
                parcelConcentration 7e8; // it leads to a similar inlet rate
            //-----------------------------------------------------------------

            [...]
        }

 2.2. Add necessary entries required by DPMFoam:
constantProperties
{
    [...]

    // For DPMFoam (taken from DPMFoam/Goldschmidt)
    //-------------------------------------------------------------------------
        poissonsRatio 0.35;
        youngsModulus 1e5; //1e8;
    //-------------------------------------------------------------------------
}
subModels
{
    [...]

    collisionModel none; // For DPMFoam
}

3. Run the simulation in parallel using DPMFoam
Additional Information - The issue only happens in parallel runs.

 - MPPICFoam does not face such problem, neither in parallel nor with single-process simulations.

 - The issue appears to be affecting only the injector "model2", which gets assigned to the processor 0.

 - Last message from logfile is "Solving 3-D cloud kinematicCloud".
TagsNo tags attached.

Activities

guin

2016-06-06 12:05

reporter  

injectionChannel.tar.gz (396,317 bytes)

guin

2016-06-06 12:19

reporter   ~0006378

The issue is not limited to this tutorial case. I experienced similar hangs with other cases (2D- as well as 3D-ones).

tniemi

2016-06-07 08:59

reporter   ~0006399

I found the reason for this problem. In function parcelsToInject at PatchFlowRateInjection.C, the code calculates a random number to check if an additional parcel should be injected. However, each processor can create a different random number and thus some processors may think that a parcel should be injected while others do not. This creates a hang up in the injection loop in setPositionAndCell.

The solution would be to calculate a global probability for additional injection in parcelsToInject function.

tniemi

2016-06-07 09:08

reporter  

PatchFlowRateInjection.C (7,030 bytes)

tniemi

2016-06-07 09:12

reporter   ~0006400

Last edited: 2016-06-07 09:15

View 2 revisions

I uploaded a modified PatchFlowRateInjection.C which uses global randoms. With this the test case won't hang.

Edit: actually a more elegant fix would be to just replace rndGen().position with rndGen().globalPosition

henry

2016-06-07 09:26

manager   ~0006401

Yes, I think making PatchFlowRateInjection consistent with PatchInjection (i.e. using rnd.globalPosition is the best approach. I have implemented this and testing, will push shortly.

tniemi

2016-06-07 09:34

reporter   ~0006402

Yes, I didn't realize that PatchInjection already has the same approach, ie. use globalPosition.

Related to this, the Pstream::master/scatter code in patchInjectionBase::setPositionAndCell could be changed to use globalPosition instead to make it cleaner.

henry

2016-06-07 09:40

manager   ~0006403

OK, I will make that change as well, test and push them both.

henry

2016-06-07 10:59

manager   ~0006404

Thanks for reporting and providing a simple method to reproduce the problem.

Resolved by commit 0e802bc2899c3a033e36e73c2206c91dea90f572

Issue History

Date Modified Username Field Change
2016-06-06 12:05 guin New Issue
2016-06-06 12:05 guin File Added: injectionChannel.tar.gz
2016-06-06 12:19 guin Note Added: 0006378
2016-06-07 08:59 tniemi Note Added: 0006399
2016-06-07 09:08 tniemi File Added: PatchFlowRateInjection.C
2016-06-07 09:12 tniemi Note Added: 0006400
2016-06-07 09:15 tniemi Note Edited: 0006400 View Revisions
2016-06-07 09:26 henry Note Added: 0006401
2016-06-07 09:34 tniemi Note Added: 0006402
2016-06-07 09:40 henry Note Added: 0006403
2016-06-07 10:59 henry Note Added: 0006404
2016-06-07 10:59 henry Status new => resolved
2016-06-07 10:59 henry Fixed in Version => dev
2016-06-07 10:59 henry Resolution open => fixed
2016-06-07 10:59 henry Assigned To => henry