Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dg
dg
Commits
4390a1d0
Commit
4390a1d0
authored
Sep 29, 2016
by
Valentin Vallaeys
Committed by
Philippe Delandmeter
Oct 21, 2016
Browse files
slim3D: remove time zone and add atm pressure
+ small fixes
parent
af8a0081
Changes
3
Hide whitespace changes
Inline
Side-by-side
dgpy/scripts/slim3d.py
View file @
4390a1d0
...
...
@@ -36,6 +36,7 @@ class Slim3d_equations :
self
.
_vertical_viscosity
=
None
self
.
_vertical_diffusivity
=
None
self
.
_coriolis
=
None
self
.
_atmPress
=
None
self
.
_linear_density
=
None
self
.
_reference_density
=
1027
self
.
_initial_elevation
=
None
...
...
@@ -89,6 +90,9 @@ class Slim3d_equations :
def
set_coriolis
(
self
,
coriolis
):
self
.
_coriolis
=
coriolis
def
set_atmospheric_pressure
(
self
,
atmPress
):
self
.
_atmPress
=
atmPress
def
set_bottom_friction
(
self
,
flag
):
self
.
_slimSolver
.
setComputeBottomFriction
(
flag
)
...
...
@@ -158,7 +162,7 @@ class Slim3d_equations :
class
Loop
:
"""Temporal solver"""
def
__init__
(
self
,
equations
,
maximum_2d_time_step
=
3600
,
ratio_3dvs2d_time_step
=
1
,
export_time_step
=
3600
,
ratio_full_export
=-
1
,
initial_time
=
'1970-01-01 00:00:00'
,
final_time
=
0
,
output_directory
=
"./output"
,
time_zone
=
0
):
def
__init__
(
self
,
equations
,
maximum_2d_time_step
=
3600
,
ratio_3dvs2d_time_step
=
1
,
export_time_step
=
3600
,
ratio_full_export
=-
1
,
initial_time
=
'1970-01-01 00:00:00'
,
final_time
=
0
,
output_directory
=
"./output"
):
self
.
_slimSolver
=
equations
.
_slimSolver
self
.
_equations
=
equations
self
.
_max_2d_dt
=
maximum_2d_time_step
...
...
@@ -167,11 +171,11 @@ class Loop:
self
.
_ratio_full_export
=
ratio_full_export
fmt
=
'%Y-%m-%d %H:%M:%S'
date
=
slim_private
.
datetime
.
datetime
.
strptime
(
initial_time
,
fmt
)
self
.
_initial_time
=
slim_private
.
calendar
.
timegm
([
date
.
year
,
date
.
month
,
date
.
day
,
date
.
hour
,
date
.
minute
,
date
.
second
])
+
time_zone
*
3600.
self
.
_initial_time
=
slim_private
.
calendar
.
timegm
([
date
.
year
,
date
.
month
,
date
.
day
,
date
.
hour
,
date
.
minute
,
date
.
second
])
self
.
_initial_date
=
date
if
slim_private
.
_is_string
(
final_time
):
date
=
slim_private
.
datetime
.
datetime
.
strptime
(
final_time
,
fmt
)
self
.
_final_time
=
slim_private
.
calendar
.
timegm
([
date
.
year
,
date
.
month
,
date
.
day
,
date
.
hour
,
date
.
minute
,
date
.
second
])
+
time_zone
*
3600.
self
.
_final_time
=
slim_private
.
calendar
.
timegm
([
date
.
year
,
date
.
month
,
date
.
day
,
date
.
hour
,
date
.
minute
,
date
.
second
])
else
:
self
.
_final_time
=
self
.
_initial_time
+
final_time
self
.
_odir
=
output_directory
...
...
@@ -192,7 +196,6 @@ class Loop:
self
.
_ncExport
=
[]
self
.
_restart_dir
=
None
self
.
_restart_ind
=
-
1
self
.
_time_zone
=
time_zone
def
export_uv
(
self
):
self
.
_export_uv
=
True
def
export_w
(
self
):
self
.
_export_w
=
True
...
...
@@ -220,7 +223,7 @@ class Loop:
dgpy
.
Msg
.
Barrier
()
d
=
slimSolver
.
getDofs
()
self
.
_ncWriter2d
=
dgpy
.
slimNetCDFIO
(
slimSolver
.
groups2d
)
self
.
_ncWriter2d
.
setInitTime
(
self
.
_initial_date
.
year
,
self
.
_initial_date
.
month
,
self
.
_initial_date
.
day
,
self
.
_initial_date
.
hour
,
self
.
_initial_date
.
minute
,
self
.
_initial_date
.
second
,
self
.
_time_zone
,
00
)
self
.
_ncWriter2d
.
setInitTime
(
self
.
_initial_date
.
year
,
self
.
_initial_date
.
month
,
self
.
_initial_date
.
day
,
self
.
_initial_date
.
hour
,
self
.
_initial_date
.
minute
,
self
.
_initial_date
.
second
,
0
,
0
)
self
.
_ncWriter3d
=
dgpy
.
slim3dNetCDFIO
(
slimSolver
.
columnInfo
,
self
.
_ncWriter2d
)
if
self
.
_export_eta_nc
:
self
.
_ncExport
.
append
([
d
.
etaDof2d
,
self
.
_odir
+
'/eta'
,
'eta'
])
if
self
.
_export_uv_nc
:
self
.
_ncExport
.
append
([
d
.
uvDof
,
self
.
_odir
+
'/uv'
,
'uv'
])
...
...
dgpy/scripts/slim3d_setup.py
View file @
4390a1d0
...
...
@@ -92,7 +92,7 @@ def slim3d_setup(loop):
if
eq
.
_horizontal_diffusivity
==
'constant'
:
f
.
kappahTotal
=
dgpy
.
functionConstant
(
eq
.
_hor_diff_const
)
elif
eq
.
_horizontal_diffusivity
==
'okubo'
:
if
eq
.
_areaFunc
:
if
not
eq
.
_areaFunc
:
area2d
=
dgpy
.
dgDofContainer
(
slimSolver
.
groups2d
,
1
)
slimSolver
.
copy2d3d
.
computeArea2d
(
area2d
)
area2d
.
scatter
()
...
...
@@ -108,6 +108,9 @@ def slim3d_setup(loop):
eq
.
_coriolis_PC
=
dgpy
.
functionPrecomputedExtrusion
(
slimSolver
.
extrusion
(),
3
)
eq
.
_coriolis_PC
.
compute
(
coriolisFunc
)
f
.
coriolisFunc
=
eq
.
_coriolis_PC
if
eq
.
_atmPress
:
f
.
atmPressFunc
=
slim_private
.
_load_function
(
eq
.
_atmPress
,
slimSolver
.
groups2d
)
# .-------------------------------.
# | create equations |
...
...
@@ -199,7 +202,7 @@ def slim3d_setup(loop):
eq
.
_flux_section
[
openBnd
]
=
sectionFM
(
0
,
0
)
eq
.
_flux
[
openBnd
]
=
slim_private
.
_load_function
(
openBnd
.
flux
,
slimSolver
.
groups3d
)
eq
.
_flux2d
[
openBnd
]
=
slim_private
.
_load_function
(
openBnd
.
flux
,
slimSolver
.
groups2d
)
eq
.
_uv_open
[
openBnd
]
=
dgpy
.
slimFlowRateToVelocity
(
slimSolver
.
groups
2
d
,
eq
.
_flux_section
[
openBnd
],
eq
.
_flux
[
openBnd
],
f
.
bathFunc2d
,
eta
)
eq
.
_uv_open
[
openBnd
]
=
dgpy
.
slimFlowRateToVelocity
(
slimSolver
.
groups
3
d
,
eq
.
_flux_section
[
openBnd
],
eq
.
_flux
[
openBnd
],
f
.
bathFunc2d
,
eta
)
eq
.
_uvInt2d_open
[
openBnd
]
=
dgpy
.
slimFlowRateToVelocity
(
slimSolver
.
groups2d
,
eq
.
_flux_section
[
openBnd
],
eq
.
_flux2d
[
openBnd
],
f
.
bathFunc2d
,
eta
)
eq
.
_uvAv2d_open
[
openBnd
]
=
dgpy
.
slimFlowRateToVelocity
(
slimSolver
.
groups2d
,
eq
.
_flux_section
[
openBnd
],
eq
.
_flux2d
[
openBnd
],
f
.
bathFunc2d
,
eta
)
eq
.
_eta_open
[
openBnd
]
=
eta
...
...
@@ -262,6 +265,7 @@ def slim3d_setup(loop):
e
.
newRGradEq
.
setBoundarySymmetry
(
topTags
)
e
.
newRGradEq
.
setBoundarySymmetry
(
bottomTags
)
e
.
newRGradEq
.
setBoundarySymmetry
(
eq
.
_boundary_coast
)
e
.
newRGradEq
.
setBoundarySymmetry
(
'vertical_bottom'
)
for
openBnd
in
eq
.
_boundary_open
:
e
.
newRGradEq
.
setBoundarySymmetry
(
openBnd
.
tag
)
# TODO MUST BE CHANGED !!!
#rGradBndOut = e.newRGradEq.newOutsideValueBoundary("", f.rhoFunc)
...
...
dgpy/scripts/slimPre.py
View file @
4390a1d0
...
...
@@ -94,8 +94,8 @@ class Mesh :
isPart
=
slim_private
.
_check_if_partionned
(
mesh_file_name
)
if
(
dgpy
.
Msg
.
GetCommSize
()
>
1
)
and
not
isPart
:
dgpy
.
Msg
.
Fatal
(
"Calling slimPre.Mesh in multiprocessing requires providing a partitioned mesh (first use slimPre.partition_mesh)."
)
elif
(
dgpy
.
Msg
.
GetCommSize
()
==
1
)
and
isPart
:
dgpy
.
Msg
.
Fatal
(
"Calling slimPre.Mesh on a single core requires providing a non-partitioned mesh."
)
#
elif (dgpy.Msg.GetCommSize() == 1) and isPart:
#
dgpy.Msg.Fatal("Calling slimPre.Mesh on a single core requires providing a non-partitioned mesh.")
self
.
_groups
=
dgpy
.
dgGroupCollection
(
mesh_file_name
)
self
.
_mesh_proj
=
mesh_proj
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment