Exemple #1
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see COPYING file).  If not,
# see <http://www.gnu.org/licenses/>.

import slim3d
import slimPre
import shutil

output_dir = './output/'
data_dir_base = 'data' + slimPre.partition_nb() + '/'
data_dir = data_dir_base + slimPre.partition_id() + '/'
slimPre.make_directory(output_dir)
shutil.copyfile(data_dir_base + 'mesh3d.msh', output_dir + 'mesh3d.msh')

domain = slim3d.Domain(data_dir_base + 'mesh3d.msh',
                       data_dir_base + 'periodicMesh.txt',
                       reference_density=1001.85)

equations = slim3d.Slim3d_equations(domain, salinity=True)
equations.set_implicit_vertical(False)
#equations.set_horizontal_viscosity('smagorinsky')
equations.set_lax_friedrichs_factor(1)
equations.set_bottom_friction(False)
equations.set_limiter(True)
equations.set_initial_salinity('netcdf', data_dir_base + "Sinit_COMP_0.msh")
#equations.set_initial_salinity('netcdf', data_dir+"initS/initS.idx")
equations.set_initial_temperature('vertical_gradient', None, 10, 0.)
Exemple #2
0
import slimPre
import numpy as np

run_dir = 'data/'
slimPre.make_directory(run_dir)

slimPre.write_file(run_dir + 'bath.nc', None, None, [('bath', 1000)])

mesh_file = 'square.msh'

print('Extruding mesh')


def shiftOperation(node, iPerBound):
    n = [node[0] - 1.6e5, node[1], node[2]]
    return n


cutTags = ["cut"]
pasteTags = ["paste"]
mapFilename = "periodicMesh.txt"
periodicity = (shiftOperation, cutTags, pasteTags, mapFilename)

nPart = 96
slimPre.dgpy.dgMeshPartition(mesh_file, nPart)
mesh_file = mesh_file[:-4] + '_' + str(nPart) + '.msh'

slimPre.extrude(mesh_file, (run_dir + 'bath.nc', 'bath'),
                nb_layers=40,
                mesh_file_name_out=run_dir + 'mesh3d.msh',
                periodicity=periodicity)
Exemple #3
0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see COPYING file).  If not,
# see <http://www.gnu.org/licenses/>.

import slimPre, dgpy
import numpy as np

data_dir_base = 'data' + slimPre.partition_nb() + '/'
data_dir = data_dir_base + slimPre.partition_id() + '/'
slimPre.make_directory(data_dir)

from dgpy.scripts import Common
if (slimPre.partition_id() == 0):
    Common.genMesh("haidvogel.geo", 2)
dgpy.Msg.Barrier()
mesh_file = 'haidvogel.msh'

slimPre.partition_mesh(mesh_file, 'mesh_part.msh')
mesh_file = 'mesh_part.msh'

print('Extruding mesh')


def shiftOperation(node, iPerBound):
    n = [node[0], node[1] - 1000, node[2]]