indexField = uw.fevariable.FeVariable( feMesh=linearMesh, nodeDofCount=1)

for index, coord in enumerate(linearMesh.data):
    indexField.data[index] = index


# In[41]:

#figtemp = plt.Figure()
#figtemp.Surface(indexField, elementMesh)
#figtemp.Mesh(linearMesh, colourBar=False)
#figtemp.show()


# In[42]:

#Create an arbitrary temperature field

for index, coord in enumerate(linearMesh.data):
    if coord[1] < 0.5:
        temperatureField.data[index] = 0.7
    else:
        t = 1 - coord[1]
        temperatureField.data[index] = t


figtemp2 = plt.Figure()
figtemp2.Surface(temperatureField, elementMesh)
figtemp2.Mesh(linearMesh, colourBar=False)
figtemp2.save_database('test_mesh_refine.gldb')
        fullpath = os.path.join(outputPath + "files/" + fnamerms)
        rmsField.save(fullpath)
        #Viscosity
        fnamevisc = "viscField" + "_" + str(CASE) + "_" + str(step) + ".hdf5"
        fullpath = os.path.join(outputPath + "files/" + fnamevisc)
        viscField.save(fullpath)
        #Stress
        fnamestress = "stressField" + "_" + str(CASE) + "_" + str(
            step) + ".hdf5"
        fullpath = os.path.join(outputPath + "files/" + fnamestress)
        stressField.save(fullpath)
f_o.close()

# In[37]:

fig1 = plt.Figure()
#fig1.Surface(buoyancyFn[1], elementMesh)
fig1.Surface(viscosityl1, elementMesh)
#fig1.Points( swarm=gSwarm, colourVariable=viscVariable , pointSize=3.0)
#fig1.VectorArrows(velocityField, linearMesh, lengthScale=0.02)
fig1.show()

# In[35]:

system = buoyancyFn[1] / viscosityl1

# In[36]:

fig1 = plt.Figure()
#fig1.Surface(buoyancyFn[1], elementMesh)
fig1.Surface(system, elementMesh)
Exemple #3
0
viscField = uw.fevariable.FeVariable(feMesh=linearMesh, nodeDofCount=1)
viscdata = viscosityFn2.evaluate(linearMesh)
viscField.data[:] = viscdata

stressField = uw.fevariable.FeVariable(feMesh=linearMesh, nodeDofCount=1)
srtdata = fn.tensor.second_invariant(
    fn.tensor.symmetric(velocityField.gradientFn))
rostfield = srtdata.evaluate(linearMesh)
stressinv = 2 * viscdata * rostfield[:]
stressField.data[:] = stressinv

##Gldbs:

viscVariable = gSwarm.add_variable(dataType="float", count=1)
viscVariable.data[:] = viscosityMapFn.evaluate(gSwarm)
figEta = plt.Figure()
figEta.Points(gSwarm, viscVariable)
figEta.Points(gSwarm, materialVariable, colours='brown white red blue')

# Main simulation loop
# =======
#
# The main time stepping loop begins here. Before this the time and timestep are initialised to zero and the output statistics arrays are set up. Also the frequency of outputting basic statistics to the screen is set in steps_output.
#

# In[48]:

realtime = 0.
step = 0
timevals = [0.]
steps_end = 5
Exemple #4
0

# In[135]:


    
#figtemp = plt.Figure()
#figtemp.Surface(temperatureField, elementMesh)
#figtemp.Surface(indexField, elementMesh)
#figtemp.Mesh(linearMesh, colourBar=False)
#figtemp.show()


# In[136]:

figtemp = plt.Figure()
figtemp.Surface(temperatureField, elementMesh)
#figtemp.Surface(indexField, elementMesh)
figtemp.Mesh(linearMesh, colourBar=False)
figtemp.save_database('test_mesh_refine.gldb')


# In[137]:

#indexField = uw.fevariable.FeVariable( feMesh=linearMesh, nodeDofCount=1)

#for index, coord in enumerate(linearMesh.data):
#     indexField.data[index] = ((index % (meshX+1)) % 2 ==0)
#    indexField.data[index] = ((index/(meshX+1) % (meshY+1)) % 2 ==0)