Exemplo n.º 1
0
#ridgeMaskFn, boundMaskFn, velMaskFn

maskFnVar1 = uw.mesh.MeshVariable(mesh=mesh, nodeDofCount=1)
maskFnVar1.data[:] = faultRmfn.evaluate(mesh)

plate_id_fn = tm.plate_id_fn()
maskFnVar2 = uw.mesh.MeshVariable(mesh=mesh, nodeDofCount=1)
maskFnVar2.data[:] = plate_id_fn.evaluate(mesh)

viscSwarmVar = swarm.add_variable(dataType="double", count=1)
viscSwarmVar.data[:] = viscosityMapFn.evaluate(swarm)

# In[79]:

store1 = glucifer.Store('output/subduction1')
store2 = glucifer.Store('output/subduction2')
store3 = glucifer.Store('output/subduction3')

#these figures are mainly intended for understanding how the interface is controlled,
#i.e. through the spatial mask functions

#in this figure we'll track the proximity variable
figProx = glucifer.Figure(store1, figsize=(960, 300))
figProx.append(glucifer.objects.Points(swarm, proximityVariable))
for f in fCollection:
    figProx.append(glucifer.objects.Points(f.swarm, pointSize=5))

figVisc = glucifer.Figure(store2, figsize=(960, 300))
figVisc.append(glucifer.objects.Points(swarm, viscSwarmVar, logScale=True))
Exemplo n.º 2
0
                         'strainrate',
                         mh,
                         'mesh',
                         modeltime=time)
    viscosityField.xdmf(fullpath + "visc_" + str(step),
                        viscH,
                        'visc',
                        mh,
                        'mesh',
                        modeltime=time)


# In[62]:

fullpath = os.path.join(outputPath + "gldbs/")
store1 = glucifer.Store(fullpath + 'subduction1.gldb')

fig1 = glucifer.Figure(store1)
fig1.append(glucifer.objects.Points(swarm, proximityVariable, pointSize=2))
fig1.append(glucifer.objects.Mesh(mesh))

# In[63]:


def viz_update(step):
    #save gldbs
    fullpath = os.path.join(outputPath + "gldbs/")

    store1.step = step
    fig1.save(fullpath + "Temp" + str(step).zfill(5))
Exemplo n.º 3
0
        mySet.add(ind)

# In[5]:

vField.data[top.data] = [-1.0, 0.]
vField.data[mySet.data] = [1.0, 0.]

# In[6]:

vBCs = uw.conditions.DirichletCondition(vField,
                                        indexSetsPerDof=(mySet + top,
                                                         top + base))

# In[7]:

store = glucifer.Store('model')

# In[8]:

fig = glucifer.Figure(store)

# In[9]:

fig.append(glucifer.objects.VectorArrows(q1_mesh, vField))
# fig.append( glucifer.objects.Mesh(q1_mesh, nodeNumbers=True))

# In[10]:

fig.show()

# In[11]:
Exemplo n.º 4
0
perturbationFn = offset + amplitude*fn.math.cos( k*coord[0] )

# Setup the conditions list. 
# If z is less than the perturbation, set to lightIndex.
conditions = [ ( perturbationFn > coord[1] , lightIndex ),
               (                      True , denseIndex ) ]

# The swarm is passed as an argument to the evaluation, providing evaluation on each particle.
# Results are written to the materialIndex swarm variable.
fnc = fn.branching.conditional( conditions )
ts = time()
matdat = fnc.evaluate(swarm)
add_timing("Function.evaluate()", time()-ts)
materialIndex.data[:] = matdat

store = glucifer.Store('RT')

fig = glucifer.Figure( store, name="firstFig" )
fig.append( glucifer.objects.Points(swarm, materialIndex, pointSize=2, colourBar=False) )
fig.append( glucifer.objects.Surface(mesh, pressureField))
fig.append( glucifer.objects.VectorArrows( mesh, velocityField, scaling=1.0e2))


# Set a density of '0.' for light material, '1.' for dense material.
densityMap   = { lightIndex:0., denseIndex:1. }
densityFn    = fn.branching.map( fn_key = materialIndex, mapping = densityMap )

# Set a viscosity value of '1.' for both materials.
viscosityMap = { lightIndex:1., denseIndex:1. }
fn_viscosity  = fn.branching.map( fn_key = materialIndex, mapping = viscosityMap )
Exemplo n.º 5
0
coord = fn.coord()

# Define the material perturbation, a function of the x coordinate (accessed by `coord[0]`).
perturbationFn = offset + amplitude * fn.math.cos(k * coord[0])

# Setup the conditions list.
# If z is less than the perturbation, set to lightIndex.
conditions = [(perturbationFn > coord[1], lightIndex), (True, denseIndex)]

# The swarm is passed as an argument to the evaluation, providing evaluation on each particle.
# Results are written to the materialIndex swarm variable.
fnc = fn.branching.conditional(conditions)
matdat = fnc.evaluate(swarm)
materialIndex.data[:] = matdat

store = glucifer.Store('{}_RT'.format(PREFIX), compress=False)

fig = glucifer.Figure(store, name="firstFig")
fig.append(
    glucifer.objects.Points(swarm, materialIndex, pointSize=2,
                            colourBar=False))
fig.append(glucifer.objects.Surface(mesh, pressureField))
fig.append(glucifer.objects.VectorArrows(mesh, velocityField, scaling=1.0e2))

# Set a density of '0.' for light material, '1.' for dense material.
densityMap = {lightIndex: 0., denseIndex: 1.}
densityFn = fn.branching.map(fn_key=materialIndex, mapping=densityMap)

# Set a viscosity value of '1.' for both materials.
viscosityMap = {lightIndex: 1., denseIndex: 1.}
fn_viscosity = fn.branching.map(fn_key=materialIndex, mapping=viscosityMap)
    if slabCore.evaluate(tuple(coord)):
             materialVariable.data[index] =coreSlabIndex
    if slabUpper.evaluate(tuple(coord)):
             materialVariable.data[index] = upperSlabIndex
    if slabLower.evaluate(tuple(coord)):
            materialVariable.data[index]  = lowerSlabIndex
    if overslabLower.evaluate(tuple(coord)):
            materialVariable.data[index]  =  lowerOverslabIndex
    if overslabUpper.evaluate(tuple(coord)):
            materialVariable.data[index]  =  upperOverslabIndex
    if overslabCore.evaluate(tuple(coord)):
            materialVariable.data[index]  =  coreOverslabIndex
    elif weakZone.evaluate(tuple(coord)):
            materialVariable.data[index]  =  weakZoneIndex
			
store = glucifer.Store('output/over-ride plate')
figParticle = glucifer.Figure( store, figsize=(960,300), name="Particles")
figParticle.append( glucifer.objects.Points(swarm, materialVariable, pointSize=2, colours='white green gray yellow purple orange red blue'))
figParticle.show()

upperMantleViscosity =    1.0
lowerMantleViscosity =  100.0
slabViscosity        =  500.0
coreViscosity        =  500.0
weakZoneViscosity    =  100.0

# The yielding of the upper slab is dependent on the strain rate.
strainRate_2ndInvariant = fn.tensor.second_invariant(
                           fn.tensor.symmetric(
                           velocityField.fn_gradient))
cohesion = 0.06
# **Analysis tools**

# In[15]:

#The root mean square Velocity
velSquared = uw.utils.Integral(fn.math.dot(velocityField, velocityField), mesh)
area = uw.utils.Integral(1., mesh)
Vrms = math.sqrt(velSquared.evaluate()[0] / area.evaluate()[0])

# **Set up visualisation of the particle swarm coloured by material type**
#
# We are using a vis store object to keep all our figures together and allow them to be revisualised later so create this here and pass it to all the figures created later. We'll also name this figure to make it easy to find later when revisualising.

# In[16]:

store = glucifer.Store(outputPath + 'ozBench')
figMaterialStrain = glucifer.Figure(store,
                                    figsize=(800, 400),
                                    name="MaterialStrain",
                                    facecolour='white',
                                    quality=2)

#When plotting an isosurface, a second function can be passed to colour the surface
surf = figMaterialStrain.IsoSurface(
    mesh,
    materialField,
    strainRate_2ndInvariant,
    isovalues=[0.5],
    isowalls=True,
    colours='grey Purple Blue Green Yellow Orange Red Black')