Commit fe97b80d authored by Valentin Vallaeys's avatar Valentin Vallaeys Committed by Philippe Delandmeter
Browse files

interface3D: small fixs

parent 57d9f01f
import slim3d
from slimPre import make_directory, exit
from slimPre import make_directory
output_directory = 'outputNew'
make_directory(output_directory)
......
......@@ -61,21 +61,29 @@ class Slim3d_equations :
slimSolver.setFlagTLimiter(flag)
def set_horizontal_viscosity(self, mode, constant=1, factor=0.02, maximum=1e9):
if (mode != "smagorinsky") and (mode != "constant"):
dgpy.Msg.Fatal("Unknown mode for horizontal_viscosity : "+mode)
self._horizontal_viscosity = mode
self._hor_visc_const = constant
self._hor_visc_fact = factor
self._hor_visc_max = maximum
def set_horizontal_diffusivity(self, mode, constant=1, factor=0.0, maximum=1e9):
if (mode != "okubo") and (mode != "constant"):
dgpy.Msg.Fatal("Unknown mode for horizontal_viscosity : "+mode)
self._horizontal_diffusivity = mode
self._hor_diff_const = constant
self._hor_diff_fact = factor
self._hor_diff_max = maximum
def set_vertical_viscosity(self, viscosity):
if viscosity != "gotm":
dgpy.Msg.Fatal("Unknown viscosity for vertical_viscosity : "+viscosity)
self._vertical_viscosity = viscosity
def set_vertical_diffusivity(self, diffusivity):
if diffusivity != "gotm":
dgpy.Msg.Fatal("Unknown diffusivity for vertical_diffusivity : "+diffusivity)
self._vertical_diffusivity = diffusivity
def set_coriolis(self, coriolis):
......@@ -101,7 +109,6 @@ class Slim3d_equations :
def set_initial_temperature(self, mode, temperature, surface_temperature, vertical_gradient):
self._initial_temperature = (mode, temperature, surface_temperature, vertical_gradient)
def set_boundary_coast(self, physical_tags):
if slim_private._is_string(physical_tags):
self._boundary_coast.append(physical_tags)
......
......@@ -5,8 +5,8 @@ import numpy
def slim3d_setup(loop):
slimSolver = loop._slimSolver
eq = loop._equations
if ((eq._vertical_viscosity == 'gotm' and eq._vertical_viscosity != 'gotm') or \
(eq._vertical_viscosity != 'gotm' and eq._vertical_viscosity == 'gotm')) :
if ((eq._vertical_viscosity == 'gotm' and eq._vertical_diffusivity != 'gotm') or \
(eq._vertical_viscosity != 'gotm' and eq._vertical_diffusivity == 'gotm')) :
dgpy.Msg.Fatal('Either both or none of vertical viscosity and diffusivity must be computed with gotm')
if eq._vertical_viscosity == 'gotm' :
slimSolver.setSolveTurbulence(True)
......@@ -30,7 +30,7 @@ def slim3d_setup(loop):
if eq._initial_salinity:
if eq._initial_salinity[0] == 'netcdf':
f.SInitFunc = slim_private._load_function(eq._initial_salinity, slimSolver.groups3d)
f.SInitFunc = slim_private._load_function(eq._initial_salinity[1], slimSolver.groups3d)
elif eq._initial_salinity[0] == 'vertical_gradient':
def zFunc(cmap, val, xyz) :
val[:] = eq._initial_salinity[2] + xyz[:,2] * eq._initial_salinity[3]
......@@ -42,7 +42,7 @@ def slim3d_setup(loop):
if eq._initial_temperature:
if eq._initial_temperature[0] == 'netcdf':
f.TInitFunc = slim_private._load_function(eq._initial_temperature, slimSolver.groups3d)
f.TInitFunc = slim_private._load_function(eq._initial_temperature[1], slimSolver.groups3d)
elif eq._initial_temperature[0] == 'vertical_gradient':
def zFunc(cmap, val, xyz) :
val[:] = eq._initial_temperature[2] + xyz[:,2] * eq._initial_temperature[3]
......@@ -67,7 +67,7 @@ def slim3d_setup(loop):
f.nuh = dgpy.functionConstant(eq._hor_visc_const)
f.nuh2d = dgpy.functionConstant(eq._hor_visc_const)
elif eq._horizontal_viscosity == 'smagorinsky':
area2d = dgDofContainer(slimSolver.groups2d, 1)
area2d = dgpy.dgDofContainer(slimSolver.groups2d, 1)
slimSolver.copy2d3d.computeArea2d( area2d)
area2d.scatter()
eq._areaFunc = dgpy.functionPrecomputedExtrusion(slimSolver.extrusion(), 3, area2d.getFunction())
......@@ -78,7 +78,7 @@ def slim3d_setup(loop):
f.kappahTotal = dgpy.functionConstant(eq._hor_diff_const)
elif eq._horizontal_diffusivity == 'okubo':
if eq._areaFunc:
area2d = dgDofContainer(slimSolver.groups2d, 1)
area2d = dgpy.dgDofContainer(slimSolver.groups2d, 1)
slimSolver.copy2d3d.computeArea2d( area2d)
area2d.scatter()
eq._areaFunc = dgpy.functionPrecomputedExtrusion(slimSolver.extrusion(), 3, area2d.getFunction())
......
......@@ -248,8 +248,6 @@ def _findTopAndBottomTags(mesh_file_name):
fin.close()
return (topTags, bottomTags)
exit(-1)
class OpenBnd_3d:
def __init__(self, tag, uv, eta, salinity, temperature):
self.tag = tag
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment