GithubHelp home page GithubHelp logo

Comments (3)

DanW97 avatar DanW97 commented on June 3, 2024 1

Oops!

I will investigate.

from up4.

DanW97 avatar DanW97 commented on June 3, 2024

Hi @WJPeace1 can you share the script you were using for the plots?

from up4.

WJPeace1 avatar WJPeace1 commented on June 3, 2024

Hi @DanW97, here you go!

`

Velocity Fields

from math import inf
from re import template
import numpy as np
import plotly as p
import plotly.express as pexp
import plotly.graph_objects as go
import up4
from collections import defaultdict

Import data

hdf_name = '16_190_trajectories.hdf5'

Extract values for plots and tip speed calculation

filename_final = hdf_name.split(".hdf5")[0]
variables = filename_final.split("_")

if int(variables[0]) > 0:
vvm = str(int(variables[0])/10) + str("VVM")
else:
vvm = str("Ungassed")
print(vvm)

speed = int(variables[1])
speed_rpm = str(int(variables[1])) + str("RPM")
statement = str(vvm) + str(" - ") + str(speed_rpm)
tip_speed = (2 * np.pi * speed * (1/60) * 0.033)
save_statement = str(speed_rpm) + str("_") + str(vvm)

Data Load-In

data = up4.Data(hdf_name)

# # Dimension Statistics # #

dim = data.dimensions()
xmin = dim['xmin']
xmax = dim['xmax']
ymin = dim['ymin']
ymax = dim['ymax']
zmin = dim['zmin']
zmax = dim['zmax']
xmed = (xmin + xmax) * 0.5 # midpoint in x-axis
ymed = (ymin + ymax) * 0.5 # midpoint in y-axis
zimpeller = zmin + ((zmax - zmin)/3) # impeller level in the tank

Forming a Grid

cx = 25
cy = cx
cz = cx

grid = up4.Grid.cartesian3d_from_data(data, cells = [cx,cy,cz]) # cartesian co-ordinates
field = data.velocityfield(grid)
xpos,ypos,zpos = field.cell_positions()

CENTRE SLICES

YMed Slice

vel_slice_ymed = np.rot90(field.slice_pos(axis = 1, position = ymed),3)
fig = go.Figure()
fig.add_trace(go.Heatmap(z = vel_slice_ymed, zmin = 0))
fig.update_layout(
title = str(f"{statement}" + ": Central Slice Velocity Field: XZ Plane "),
title_x = 0.5,
width = 1000,
height = 1000,
xaxis_title = " r/R ",
yaxis_title = " z/H ",
xaxis = dict(
tickmode = 'array',
tickvals = [0,int(cx/4),int(cx/2),int((3cx)/4),int(cx-1)],
ticktext = [" -1 ", " -0.5 "," 0 ", " 0.5 "," 1 "],
),
yaxis = dict(
tickmode = 'array',
tickvals = [0,int(cx/4),int(cx/2),int((3
cx)/4),int(cx-1)],
ticktext = [" 0 ", " 0.25 "," 0.5 ", " 0.75 "," 1 "],
),
template = "plotly_white",
font = dict(
family = "Arial",
size = 20,
color = "black",
)
)

fig.show()

`

from up4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.