underworldcode / underworld2

underworld2: A parallel, particle-in-cell, finite element code for Geodynamics.
http://www.underworldcode.org/
Other
174 stars 59 forks source link

How to have robust population control? #124

Closed QwZhang closed 8 years ago

QwZhang commented 8 years ago

Hi all, Sorry for troubling again. I have been bothered by the particle regeneration issue as discussed months ago here. This time I ran a similar model but I extended into a 3D one (with 256x64x64 cells, 20 particles per cell), removed the sticky-air layer and simply imposed a free-slip BC on top instead. I have activated the Inflow flag and other related configurations as suggested by @mirkovelic and @OlympusMonds:

    <struct name="weights" mergeType="replace">
        <param name="maxDeletions">0</param>
        <param name="maxSplits">500</param>
        <param name="Inflow">True</param>
        <param name="Type">PCDVC</param>
        <param name="resolutionX">10</param>
        <param name="resolutionY">10</param>
        <param name="resolutionZ">10</param>
        <param name="lowerT">0.6</param>
        <param name="upperT">5</param>
        <param name="Threshold">0.95</param>
        <param name="CentPosRatio">0.01</param>
        <param name="MaterialPointsSwarm">materialSwarm</param>
        <param name="splitInInterfaceCells">True</param>
    </struct>

    <struct name="localLayout">
        <param name="Type">MappedParticleLayout</param>
    </struct> 

    <struct name="picIntegrationPoints">
        <param name="Type">IntegrationPointsSwarm</param>
        <param name="CellLayout">elementCellLayout</param>
        <param name="ParticleLayout">localLayout</param>
        <param name="FeMesh">mesh-linear</param>
        <param name="WeightsCalculator">weights</param>
        <param name="TimeIntegrator">timeIntegrator</param>
        <param name="IntegrationPointMapper">mapper</param>
    </struct> 
    <struct name="mapper">
        <param name="Type">CoincidentMapper</param>
        <param name="IntegrationPointsSwarm">picIntegrationPoints</param>
        <param name="MaterialPointsSwarm">materialSwarm</param>
    </struct> 

but underworld crashes now and then,reporting similar error when crash like:

...
In func SystemLinearEquations_NonLinearExecute: Converged after 6 iterations.
Time Integration
           EP:        SwarmAdvector_AdvectionSetup -    0.0006 [min] /    0.0498 [max] (secs)
           EP:        SwarmAdvector_AdvectionSetup -    0.0010 [min] /    0.0432 [max] (secs)
    2nd order:               materialSwarmAdvector -    0.4510 [min] /    0.5447 [max] (secs)
    2nd order:                 passiveTracerAdvect -    0.0000 [min] /    0.0002 [max] (secs)
           EP:       SwarmAdvector_AdvectionFinish -    0.0033 (secs)
           EP:       SwarmAdvector_AdvectionFinish -    0.0576 (secs)
           EP:          MaterialPointsSwarm_Update -    0.0000 (secs)
           EP:          MaterialPointsSwarm_Update -    0.0553 (secs)
In func WeightsCalculator_CalculateAll(): for swarm "picIntegrationPoints"
    Calculating weights for the particles in the 524288 global cells
        done 10% (461 cells)...
        done 20% (922 cells)...
        done 30% (1383 cells)...
        done 40% (1844 cells)...
51: Something went horribly wrong in _PCDVC_Calculate3D: Problem has an under resolved cell (Cell Id = 2154), check or tune your population control parameters
...

Theoretically, if functioning well, when particles is too few or their distribution in cell is not even, more particles will be repopulated. It seems that repopulation doesn't work properly due to exsitence of the under resolved cell (Cell Id = 2154).

So, how can I tune your population control parameters below to make underworld work more robustly?

    <struct name="weights" mergeType="replace">
        <param name="maxDeletions">0</param>
        <param name="maxSplits">500</param>
        <param name="Inflow">True</param>
        <param name="Type">PCDVC</param>
        <param name="resolutionX">10</param>
        <param name="resolutionY">10</param>
        <param name="resolutionZ">10</param>
        <param name="lowerT">0.6</param>
        <param name="upperT">5</param>
        <param name="Threshold">0.95</param>
        <param name="CentPosRatio">0.01</param>
        <param name="MaterialPointsSwarm">materialSwarm</param>
        <param name="splitInInterfaceCells">True</param>
    </struct>

I have no idea about how lowerT, lowerT, Threshold, maxDeletions, maxSplits, resolutionX, etc., controls the repopulation of the particles.

Best, Qw

julesghub commented 8 years ago

Hi Qw,

These parameters control the Discrete Voronoi diagram that is used to perform population control on particles. A discrete voronoi (DV) diagram is built for each element in the mesh, and evaluates the amount of volume each particle represents in an element. If a particle represents to much volume it is split, if a particle represent too little volume it is deleted.

I have taken this from an old input file in Underworld 1:

<param name="lowerT">0.25</param>  
<!-- lower % threshold volume for deletion of particles. i.e if a particle volume < 0.25% of total then delete it -->

<param name="upperT">15</param>    
<!-- upper % threshold volume for deletion of particles. i.e if a particle volume > 15% of total then split it -->

<param name="Inflow">True</param>  <!-- switches the Inflow flag on -->

<param name="Threshold">0.8</param> 
<!-- Threshold for cell population in an inflow problem: If a cell has less than 80% of its assigned particles then we re-populate -->

maxDeletions and maxSplits set the maximum number of given operations to be performed during a single element's population control step.

resolutionX. etc define the DV resolution mesh per element.

for further details on the algorithm see Velic et.al., A Fast Robust Algorithm for computing Discrete Voronoi Diagrams in N-dimensions, DOI 10.1007/s10852-008-9097-6

jmansour commented 8 years ago

will close this for now. feel free to reopen under the underworld1 project if still an issue.