3. Researcher GuideΒΆ
HydroUQ presents an interchangeable modular workflow that brings together two-dimensional shallow-water, three-dimensional CFD, and FEA solvers. Suppose you would like to use other shallow-water or CFD solvers than available in HydroUQ. This can be facilitated using the below templates. At present, users can use alternative CFD solvers, flume set up, and different SW-CFD interfacing techniques.
SW / CFD interface
HydroUQ allows an interface between a two-dimensional shallow-water solver (presently, GeoClaw) and a three-dimensional CFD solver (presently, OpenFOAM). Here, depth-averaged velocities obtained as a solution from the shallow-water solver is provided as initial and boundary condition to the CFD solver. HydroUQ uses an interchangeable workflow.
This workflow facilitates the users to use the solutions from other user-defined shallow-water solvers instead of those from GeoClaw. Below is a template for the user to enable the use of the solutions from other user-defined shallow-water solvers. Here, the user will define a child-class that would take precedence over the default class that uses the sw-cfd-interface
. If you would like to integrate your shallow-water solver as input, please write to us through the Message Board for more assistance.
####################################################################
# Import necessary packages for user-solver class
# We are creating a child class (i.e. usersolver)
# of the parent class (i.e. solver) that is used by default
####################################################################
import numpy as np
import pandas as pd
import os
import shutil
from GeoClawOpenFOAM import swcfdinter # Import the parent class
from GenUtilities import genUtilities # General utilities
class userswsolver(swcfdinter):
####################################################################
# Read the bathymetry files
####################################################################
def readbathymetry(self,data):
print("This function is used to read the bathymetry files")
# data: Data from the dakota.json file
# Add your method statements here
# If you do not want to create this method use
# parent.dircreate() or super().dircreate()
####################################################################
# Read the sw-cfd interface data
####################################################################
def interface(self,data):
print("This function is used to read the sw-cfd interface data")
# data: Data from the dakota.json file
# Add your method statements here
# If you do not want to create this method use
# parent.geometry(data) or super().geometry(data)
####################################################################
# Read solutions
####################################################################
def readsolutions(self,data):
print("This function is used to create mesh, if required")
# Add your method statements here
# If you do not want to create this method use
# parent.meshing(data) or super().meshing(data)
####################################################################
# Convert SW solutions to boundary condition on the patch
####################################################################
def swtoboundary(self,data):
print("This function is used to convert the depth averaged velocity to 3D velocity and set them as boundary condition")
# Add your method statements here
# If you do not want to create this method use
# parent.meshing(data) or super().meshing(data)
####################################################################
# Convert SW solutions to initial condition
####################################################################
def swtoinitialalpha(self,data):
print("This function is used to read the water depth and set that as initial condition for the alpha field")
# Add your method statements here
# If you do not want to create this method use
# parent.meshing(data) or super().meshing(data)
Other CFD solvers
HydroUQ uses an interchangeable workflow that relates two-dimensional shallow-water solvers as inputs. The workflow connects three-dimensional CFD (here OpenFOAM) and FEA (here OpenSees) solvers with the UQ engine (here Dakota). However, it is feasible that a user might intend to use a CFD solver other than OpenFOAM. In this case, you can provide a python script that reads the dakota.json
file to write input files required for the user-defined solver.
Below is a template for the user to facilitate the use of the user-defined solver. Here, the user will define a child-class that would take precedence over the default class that uses the OpenFOAM
solver. If you would like to integrate your solver, please write to us through the Message Board for more assistance.
####################################################################
# Import necessary packages for user-solver class
# We are creating a child class (i.e. usersolver)
# of the parent class (i.e. solver) that is used by default
####################################################################
import numpy as np
import pandas as pd
import os
import shutil
from OpenFOAM import solver # Import the parent class
from GenUtilities import genUtilities # General utilities
class usersolver(solver):
####################################################################
# Create the solver directories
####################################################################
def dircreate(self):
print("This function is used to create any solver directories")
# Add your method statements here
# If you do not want to create this method use
# parent.dircreate() or super().dircreate()
####################################################################
# Geometry related files
####################################################################
def geometry(self,data):
print("This function is used to create any geometry files")
# Add your method statements here
# If you do not want to create this method use
# parent.geometry(data) or super().geometry(data)
####################################################################
# Meshing related files
####################################################################
def meshing(self,data):
print("This function is used to create mesh, if required")
# Add your method statements here
# If you do not want to create this method use
# parent.meshing(data) or super().meshing(data)
####################################################################
# Material model related files
####################################################################
def matmodel(self,data):
print("This function is used to create files for material model")
# Add your method statements here
# If you do not want to create this method use
# parent.matmodel(data) or super().matmodel(data)
####################################################################
# Create boundary condition files
####################################################################
def bccondition(self,data):
print("This function is used to create files required for boundary condition")
# Add your method statements here
# If you do not want to create this method use
# parent.bccondition(data) or super().bccondition(data)
####################################################################
# Parallelization related files
####################################################################
def parallel(self,data):
print("This function is used to create files required for parallelization")
# Add your method statements here
# If you do not want to create this method use
# parent.parallel(data) or super().parallel(data)
####################################################################
# Solver control related files
####################################################################
def solvecontrol(self,data):
print("This function is used to create files required to control the solver")
# Add your method statements here
# If you do not want to create this method use
# parent.solvecontrol(data) or super().solvecontrol(data)
####################################################################
# Create any other supplementary files required for the solver
####################################################################
def filecreate(self,data):
print("This function is used to create any other supplementary files required")
# Add your method statements here
# If you do not want to create this method use
# parent.filecreate(data) or super().filecreate(data)
Wave flume: Digital twin
HydroUQ includes a digital twin of the wave flume. This includes a definition of the geometry and the boundary condition for the moving wall. This digital twin is of the Large Wave Flume facility at the O.H. Hinsdale Wave Research Laboratory at the Oregon State University. However, this can be adapted for any other wave flume facility as well.
Below is a template for the user to facilitate the use of the user-defined wave flume. Here, the user will define a child-class that would take precedence over the default class that uses the OSU wave flume
. If you would like to integrate your solver, please write to us through the Message Board for more assistance.
####################################################################
# Import necessary packages for user-flume class
# We are creating a child class (i.e. userflume)
# of the parent class (i.e. OSUWaveFlume) that is used by default
####################################################################
import numpy as np
import pandas as pd
import os
import shutil
from Flume import OSUWaveFlume # Import the parent class
from GenUtilities import genUtilities # General utilities
class userflume(OSUWaveFlume):
####################################################################
# Generate the flume geometry
####################################################################
def generateflume(self,data):
print("This function is used to create the STL files for the flume geometry")
# Add your method statements here
# If you do not want to create this method use
# parent.generateflume() or super().generateflume()
####################################################################
# Create the wavemaker text file
####################################################################
def GENwavemakerfile(self,dispfilename,heightfilename):
print("This function is used to create the wavemakerMovement.txt file that has information about the wall movement & water height")
# dispfilename: File with moving wall displacement with time
# heightfilename: File with height of water at the moving wall with time
# Add your method statements here
# If you do not want to create this method use
# parent.GENwavemakerfile(data) or
# super().GENwavemakerfile(data)
If you would like to interface HydroUQ with alternative modules, please write to us through the Message Board for more assistance.