underworldcode / underworld2

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

same model setup in UW2 and UWGeo but different outputs in fault patterns #705

Open YangHaibin1102 opened 4 weeks ago

YangHaibin1102 commented 4 weeks ago

Hi Julian, Here are the codes that set the model with same paramters and same solver, same precisions, but have different fault patterns. Can you help check this issue?

Note that, as I set gaussian points in UW2, you have to set gaussian points for swarm in UWGeo as well. I manually change the default setup in my docker environment for UWGeo (in UWGeo you cannot change the default swarm distribution in the python interface). However, as I see it is not the particle distribution that affect the final results, it may be ok to let it be there. Extension_debug.zip

this is the plastic strain from UW2 after 2Ma. Faults tend to dip to left side of the model in UW2. image

the one from UWGeo after 2Ma. image

The maximum plasticstrain strain at the same time running in UW2 and UWGeo is quite different.

Cheers,

Haibin

NengLu commented 4 weeks ago

No idea about this, but you may reset the swarms from the python interface like:

from underworld.swarm import Swarm
from collections import OrderedDict
Model.swarm_variables = OrderedDict()
Model.swarm = Swarm(mesh=Model.mesh, particleEscape=True)
Model.swarm.allow_parallel_nn = True
# or other layout method
Model._swarmLayout = uw.swarm.layouts.PerCellSpaceFillerLayout(swarm=Model.swarm,
    particlesPerCell=particlesPerCell)
Model.swarm.populate_using_layout(layout=Model._swarmLayout)
Model._initialize()
tiannh7 commented 4 weeks ago

Hi Haibin,

It looks like the problem you're experiencing is due to the _cohesionFn function in UWGeodynamics/_rheology.py missing the epsilon1 and epsilon2 parameters. As a result, the cohesion doesn't vary with plastic strain and remains constant, which is certainly not the intended behavior.

To fix this, you can adjust the _cohesionFn so it correctly applies linear cohesion weakening based on accumulated plastic strain. The weakening parameters epsilon1 and epsilon2 should be passed into the function, and the cohesion should be updated accordingly.

Here’s a quick fix to add the missing parameters to _cohesionFn:

def _cohesionFn(self):
    if self.plasticStrain:
        cohesion = self.cohesionWeakeningFn(
            self.plasticStrain,
            Cohesion=nd(self.cohesion),
            CohesionSw=nd(self.cohesionAfterSoftening),
            epsilon1=self.epsilon1,  # Add epsilon1
            epsilon2=self.epsilon2   # Add epsilon2
        )
    else:
        cohesion = fn.misc.constant(self.cohesion)
    return cohesion

Additionally, I noticed that _frictionFn currently returns:

friction = fn.math.atan(nd(self.frictionCoefficient))

In your uw2 file, you're not using atan for the friction coefficient. This may not cause a significant issue, but it's worth double-checking your friction weakening implementation to ensure it's working as expected.

Ninghui,