Commit 9cfc1354 authored by Philippe Delandmeter's avatar Philippe Delandmeter

slim3d: adaption on a rofi

parent 084731f0
Pipeline #2404 failed with stage
in 1 minute and 30 seconds
L = 30e3;
l = 1e3/5;
Point(1) = {-L, -l, 0};
Point(2) = {L, -l, 0};
Point(3) = {L, l, 0};
Point(4) = {-L, l, 0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(1) = {3, 4, 1, 2};
Plane Surface(1) = {1};
Transfinite Line{2} = 2;
Transfinite Line{4} = 2;
Transfinite Line{1} = 25*5;
Transfinite Line{3} = 25*5;
Mesh.Algorithm=8;
Recombine Surface{1};
Physical Surface("sea")={1};
Physical Line("open") = {2};
Physical Line("river") = {4};
Physical Line("cut") = {3};
Physical Line("paste") = {1};
General.ExecutableFileName = "/home/delandmeter/sources/gmsh/projects/dg/build/gmsh/gmsh";
General.FileName = "output_sigma/mesh3d_show.msh";
General.RecentFile0 = "output_sigma/mesh3d_show.msh";
General.RecentFile1 = "data/mesh3d_show.msh";
General.RecentFile2 = "box.geo";
General.RecentFile3 = "box.msh";
General.RecentFile4 = "boxShow.msh";
General.RecentFile5 = "boxSigma.msh";
General.RecentFile6 = "sigmaShow.msh";
General.RecentFile7 = "sigmaShow.msh";
General.RecentFile8 = "sigmaShow.msh";
General.RecentFile9 = "sigmaShow.msh";
General.BoundingBoxSize = 60828.94048066266;
General.ClipPositionX = 1555;
General.ClipPositionY = 676;
General.ColorScheme = 0;
General.ContextPositionX = 1485;
General.FieldPositionX = 84;
General.FieldPositionY = 187;
General.FieldHeight = 601;
General.FieldWidth = 903;
General.GraphicsHeight = 531;
General.GraphicsPositionX = 2085;
General.GraphicsPositionY = 124;
General.GraphicsWidth = 1674;
General.MaxX = 30000;
General.MaxY = 200;
General.MenuWidth = 167;
General.MenuPositionX = 665;
General.MenuPositionY = 624;
General.MessageHeight = 140;
General.MinX = -30000;
General.MinY = -200;
General.MinZ = -10000;
General.OptionsPositionX = 2400;
General.OptionsPositionY = 591;
General.PluginPositionX = 4475;
General.PluginPositionY = 1598;
General.PluginHeight = 641;
General.PluginWidth = 1284;
General.RotationX = 270;
General.ScaleX = 1.351610329695492;
General.ScaleY = 1.351610329695492;
General.ScaleZ = 1.351610329695492;
General.StatisticsPositionX = 347;
General.StatisticsPositionY = 561;
General.TrackballQuaternion0 = 0.7071067811865475;
General.TrackballQuaternion3 = 0.7071067811865476;
General.TranslationX = -134.7443156599955;
General.TranslationY = 1433.670218212546;
General.VisibilityPositionX = 1235;
General.VisibilityPositionY = 410;
Mesh.ChacoHypercubeDim = 0;
Mesh.ChacoMeshDim1 = 1;
Mesh.NbHexahedra = 1240;
Mesh.NbNodes = 2750;
Mesh.NbQuadrangles = 2748;
Mesh.RemeshParametrization = 0;
Mesh.SurfaceEdges = 0;
Mesh.VolumeEdges = 0;
PostProcessing.NbViews = 2;
View[0].FileName = "output_sigma/salinity/salinity-000018/salinity-000018_COMP_0.msh";
View[0].GeneralizedRaiseX = "0";
View[0].GeneralizedRaiseY = "0";
View[0].GeneralizedRaiseZ = "v0";
View[0].Name = "salinity";
View[0].GeneralizedRaiseFactor = 500;
View[0].GeneralizedRaiseView = 1;
View[0].Max = 35.00406862767804;
View[0].MaxVisible = 35;
View[0].MaxX = 30000;
View[0].MaxY = 200;
View[0].Min = -3.751830043999003;
View[0].MinVisible = 35;
View[0].MinX = -30000;
View[0].MinY = -200;
View[0].MinZ = -10000;
View[0].NbTimeStep = 19;
View[0].ShowElement = 1;
View[0].Time = 0;
View[0].TransformZZ = 0;
View[0].UseGeneralizedRaise = 1;
View[1].FileName = "output_sigma/z/z-000018/z-000018_COMP_0.msh";
View[1].Name = "z";
View[1].Max = 0.2580902842766859;
View[1].MaxX = 30000;
View[1].MaxY = 200;
View[1].Min = -20;
View[1].MinVisible = -20;
View[1].MinX = -30000;
View[1].MinY = -200;
View[1].MinZ = -10000;
View[1].NbTimeStep = 19;
View[1].Time = 0;
View[1].Visible = 0;
import slimPre
import numpy as np
import math
data_dir = 'data/'
slimPre.make_directory(data_dir)
### Generate Mesh ###
from dgpy.scripts import Common
Common.genMesh("box.geo", 2)
mesh_file = 'box.msh'
print('Extruding mesh')
def shiftOperation(node, iPerBound) :
n = [node[0], node[1] - 400, node[2]]
return n
cutTags = ["cut"]
pasteTags = ["paste"]
mapFilename = data_dir+"periodicMesh.txt"
periodicity = (shiftOperation, cutTags, pasteTags, mapFilename)
nPart = 1
if nPart > 1:
slimPre.dgpy.dgMeshPartition(mesh_file, nPart)
mesh_file = mesh_file[:-4] + '_' + str(nPart) + '.msh'
mesh2d = slimPre.Mesh(mesh_file)
region_global = slimPre.Region(mesh2d)
xyz = region_global.coordinates
bath = np.where(xyz[:,0] <=-2e4, 2,
np.where(xyz[:,0] < 2e4, 11 + 9 * np.sin( (xyz[:,0]/2e4 * np.pi/2) ),
20))
slimPre.write_file(data_dir+'bath_2d.nc', region=region_global, time=None, data=[('bath',bath)])
slimPre.netcdf_to_msh(mesh_file, data_dir+'bath_2d.nc', 'bath', 'bath')
#slimPre.extrude(mesh_file, (data_dir+'bath_2d.nc','bath'), nb_layers=int(10), mesh_file_name_out=data_dir+'mesh3d.msh', factor_show=500, periodicity=periodicity)
zLayers = [.5 * i for i in range(4)]
zLayers += [1 * i for i in range(2,100)]
print(zLayers)
slimPre.extrude(mesh_file, (data_dir+'bath_2d.nc','bath'), z_layers=zLayers, mesh_file_name_out=data_dir+'mesh3d.msh', factor_show=200, periodicity=periodicity)
slimPre.write_file(data_dir+'open_bnd.nc', region=None, time=None, data=[('u',.5), ('v',0), ('Sriv', 0), ('Ssea', 35)])
print('preprocessing done')
slimPre.exit(0)
import slim3d
from slimPre import make_directory
import shutil
output_dir = 'output/'
data_dir = 'data/'
make_directory(output_dir)
shutil.copyfile(data_dir+'mesh3d.msh', output_dir+'mesh3d.msh')
shutil.copyfile(data_dir+'mesh3d_show.msh', output_dir+'mesh3d_show.msh')
domain = slim3d.Domain(data_dir+'mesh3d.msh', data_dir+'periodicMesh.txt')
equations = slim3d.Slim3d_equations(domain, temperature=False, salinity=True)
equations.set_implicit_vertical(True)
#equations.set_vertical_viscosity('gotm')
#equations.set_vertical_diffusivity('gotm')
equations.set_boundary_open(['river'], u=(data_dir+'open_bnd.nc', 'u'), v=(data_dir+'open_bnd.nc', 'v'), salinity=(data_dir+'open_bnd.nc', 'Sriv'))
equations.set_boundary_open(['open'], salinity=(data_dir+'open_bnd.nc', 'Ssea'))
equations.set_bottom_friction(False)
#equations.set_lax_friedrichs_factor(0.05)
equations.set_limiter(True)
equations.set_initial_temperature('vertical_gradient', None, 20, 0)
equations.set_initial_salinity('vertical_gradient', None, 35, 0.)
equations.set_vertical_adaptation(tau=200, uv_factor=0, rho_factor=1, minimum_height=.1, maximum_height=15, resize_factor=3, background_error=1e-4)
#equations.set_vertical_adaptation(tau=5, minimum_height=.1, maximum_height=15, resize_factor=3, background_error=1e-3)
time_loop = slim3d.Loop(equations,
time_step=60,
export_time_step=300,
final_time=86400,
output_directory=output_dir)
time_loop.export_elevation()
time_loop.export_salinity()
time_loop.export_uv(False)
time_loop.export_w()
time_loop.export_z_coordinate()
time_loop.export_uv2d(False)
time_loop.loop()
#time_loop.setup()
#while time_loop.get_time() < time_loop.final_time:
# time_loop.advance_one_time_step()
# time_loop.check_sanity()
# #print('******************')
# #print(time_loop.equations._slimSolver.getUseConservativeALE())
# if time_loop.check_export():
# time_loop.print_iter_info()
# [relVolErr, relSErr, relTErr] = time_loop.check_mass_conservation()
# [absSDev, absTDev] = time_loop.check_tracer_consistency()
# time_loop.export_fields()
#time_loop.terminate()
#!/bin/bash
odir=output
#gmsh $odir/mesh3d_show.msh $odir/uv/uv_COMP_0.idx $odir/z/z.idx opt.opt
gmsh $odir/mesh3d_show.msh $odir/salinity/salinity.idx $odir/z/z.idx opt.opt
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