Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ocean-mixing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
inmcm-mirror
ocean-mixing
Commits
c2adbeb4
Commit
c2adbeb4
authored
7 months ago
by
Evgeny Mortikov
Browse files
Options
Downloads
Patches
Plain Diff
adding time slice container
parent
7b120d70
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
obl_def.fi
+4
-0
4 additions, 0 deletions
obl_def.fi
obl_main.f90
+33
-2
33 additions, 2 deletions
obl_main.f90
obl_richardson.f90
+4
-0
4 additions, 0 deletions
obl_richardson.f90
obl_tslice.f90
+72
-0
72 additions, 0 deletions
obl_tslice.f90
with
114 additions
and
2 deletions
CMakeLists.txt
+
1
−
0
View file @
c2adbeb4
...
...
@@ -13,6 +13,7 @@ set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules/)
set
(
SOURCES
obl_grid.f90
obl_tslice.f90
obl_time_and_space.f90
obl_common_phys_parameters.f90
obl_mathematics.f90
...
...
This diff is collapsed.
Click to expand it.
obl_def.fi
+
4
−
0
View file @
c2adbeb4
! obl model macro definitions
!#define OBL_EXCLUDE_NETCDF
!#define USE_CONFIG_PARSER
!#define OBL_USE_GRID_DATATYPE
!#define OBL_USE_TSLICE_OUTPUT
This diff is collapsed.
Click to expand it.
obl_main.f90
+
33
−
2
View file @
c2adbeb4
...
...
@@ -10,6 +10,9 @@ program obl_main
! modules used
use
obl_grid
#ifdef OBL_USE_TSLICE_OUTPUT
use
obl_tslice
#endif
use
obl_time_and_space
use
obl_initial_conditions
use
obl_forcing_and_boundary
...
...
@@ -37,6 +40,11 @@ program obl_main
type
(
gridDataType
)
::
grid
#ifdef OBL_USE_TSLICE_OUTPUT
! time slice
type
(
oblTimeSlice
)
::
output_Theta
,
output_Salin
#endif
real
::
t
!< time, [s]
integer
::
nt
!< number of time steps
integer
::
nf
!< number of time steps for forcing
...
...
@@ -105,6 +113,9 @@ program obl_main
! screen output parameters
integer
,
parameter
::
nscreen
=
1000
! file output parameters
integer
,
parameter
::
noutput
=
60
! arrays for output
real
,
allocatable
::
Theta_write
(:,:)
real
,
allocatable
::
Salin_write
(:,:)
...
...
@@ -384,6 +395,7 @@ program obl_main
! Theta (k) = Theta(k) + Theta_0
!end do
#ifndef OBL_USE_TSLICE_OUTPUT
Theta_write
(:,
i
)
=
Theta_dev
Salin_write
(:,
i
)
=
Salin_dev
U_write
(:,
i
)
=
U
...
...
@@ -397,6 +409,7 @@ program obl_main
hml_write
(
i
)
=
hml
maxcellnumber_write
(
i
)
=
maxcellnumber
lab_hml_write
(
i
)
=
lab_hml
#endif
!write(199,*) time_current, hml, lab_hml
!write(20,*) time_current, Theta_dev(nz) + Theta_ref
...
...
@@ -412,6 +425,14 @@ program obl_main
(
time_current
/
time_end
)
*
100.0
,
'% ]'
write
(
*
,
'(a)'
)
'-------------------------------------------------'
endif
! time slice output
#ifdef OBL_USE_TSLICE_OUTPUT
if
(
mod
(
i
,
noutput
)
==
0
)
then
call
push_profile_to_tslice
(
output_Theta
,
Theta_dev
,
nz
)
call
push_profile_to_tslice
(
output_Salin
,
Salin_dev
,
nz
)
endif
#endif
enddo
Theta_C_write
=
Theta_write
-
273.15
...
...
@@ -419,6 +440,7 @@ program obl_main
Salin_write
=
Salin_write
+
Salin_ref
!Rho_write = Rho_write + Rho_ref
#ifndef OBL_USE_TSLICE_OUTPUT
! Writing 2D arrays (variables with depth and time)
call
write_2d_real_nc
(
Theta_write
,
'output.nc'
,
meta_theta
)
call
write_2d_real_nc
(
Salin_write
,
'output.nc'
,
meta_salin
)
...
...
@@ -431,6 +453,7 @@ program obl_main
call
write_2d_real_nc
(
Kh_write
,
'output.nc'
,
meta_kh
)
call
write_2d_real_nc
(
Km_write
,
'output.nc'
,
meta_km
)
call
write_2d_real_nc
(
Theta_C_write
,
'output.nc'
,
meta_theta_C
)
#endif
! Writing 1D arrays (scalar variables over time)
call
write_1d_real_nc
(
hml_write
,
'output.nc'
,
meta_hml
)
...
...
@@ -439,6 +462,7 @@ program obl_main
!call write_1d_real_nc(Tau_y_surf, 'output.nc', meta_tau_v)
call
write_1d_real_nc
(
lab_hml_write
,
'output.nc'
,
meta_lab_hml
)
#ifndef OBL_USE_TSLICE_OUTPUT
! Writing 2D arrays (variables with depth and time) to ASCII files
call
write_2d_real_ascii
(
Theta_write
,
'output_Theta.txt'
,
meta_theta
)
call
write_2d_real_ascii
(
Salin_write
,
'output_Salin.txt'
,
meta_salin
)
...
...
@@ -450,6 +474,7 @@ program obl_main
call
write_2d_real_ascii
(
Ri_grad_write
,
'output_Ri_grad.txt'
,
meta_ri_grad
)
call
write_2d_real_ascii
(
Kh_write
,
'output_Kh.txt'
,
meta_kh
)
call
write_2d_real_ascii
(
Km_write
,
'output_Km.txt'
,
meta_km
)
#endif
! Writing 1D arrays (scalar variables over time) to ASCII files
call
write_1d_real_ascii
(
hml_write
,
'output_hml.txt'
,
meta_hml
)
...
...
@@ -458,6 +483,12 @@ program obl_main
!call write_1d_real_ascii(Tau_x_surf, 'output_tau_u.txt', meta_tau_u)
!call write_1d_real_ascii(Tau_y_surf, 'output_tau_v.txt', meta_tau_v)
#ifdef OBL_USE_TSLICE_OUTPUT
! time slice output
call
write_2d_real_ascii
(
output_Theta
%
data
(:,
1
:
output_Theta
%
num
),
'Theta_tslice.txt'
,
meta_theta
)
call
write_2d_real_ascii
(
output_Salin
%
data
(:,
1
:
output_Salin
%
num
),
'Salin_tslice.txt'
,
meta_salin
)
#endif
!close(199)
!close(20)
...
...
This diff is collapsed.
Click to expand it.
obl_richardson.f90
+
4
−
0
View file @
c2adbeb4
...
...
@@ -53,6 +53,7 @@ module obl_richardson
end
subroutine
#ifdef OBL_USE_GRID_DATATYPE
subroutine
get_N2_on_grid
(
N2
,
Rho
,
Rho_dyn_surf
,
Rho_dyn_bot
,
grid
)
!< @brief calculate square of buoyancy frequency
...
...
@@ -87,6 +88,7 @@ module obl_richardson
N2
(
grid
%
cz
)
=
-
g
/
Rho_ref
*
dRho_tmp_surf
end
subroutine
#endif
subroutine
get_S2
(
S2
,
U
,
V
,
flux_u_surf
,
flux_u_bot
,
flux_v_surf
,
flux_v_bot
,
dz
,
nz
)
!< @brief calculate square of shear frequency
...
...
@@ -127,6 +129,7 @@ module obl_richardson
end
subroutine
#ifdef OBL_USE_GRID_DATATYPE
subroutine
get_S2_on_grid
(
S2
,
U
,
V
,
flux_u_surf
,
flux_u_bot
,
flux_v_surf
,
flux_v_bot
,
grid
)
!< @brief calculate square of shear frequency
...
...
@@ -165,6 +168,7 @@ module obl_richardson
call
limit_min_array
(
S2
,
S2_min
,
grid
%
cz
)
end
subroutine
#endif
subroutine
get_Rig
(
Ri_grad
,
N2
,
S2
,
nz
)
!< @brief calculate Richardson gradient number
...
...
This diff is collapsed.
Click to expand it.
obl_tslice.f90
0 → 100644
+
72
−
0
View file @
c2adbeb4
module
obl_tslice
!< @brief obl time slice def.
! --------------------------------------------------------------------------------
! modules used
! --------------------------------------------------------------------------------
! directives list
implicit
none
private
! public interface
! --------------------------------------------------------------------------------
public
::
push_profile_to_tslice
public
::
deallocate_tslice
! --------------------------------------------------------------------------------
!> @brief time slice datatype
type
,
public
::
oblTimeSlice
integer
::
cz
integer
::
num
=
0
integer
::
nalloc
=
0
real
,
allocatable
::
data
(:,
:)
end
type
contains
subroutine
push_profile_to_tslice
(
tslice
,
profile
,
cz
)
!> @brief add profile to time slice
! ----------------------------------------------------------------------------
type
(
oblTimeSlice
),
intent
(
inout
)
::
tslice
integer
,
intent
(
in
)
::
cz
real
,
dimension
(
cz
),
intent
(
in
)
::
profile
real
,
allocatable
::
buf
(:,
:)
! ----------------------------------------------------------------------------
if
(
tslice
%
num
==
0
)
tslice
%
cz
=
cz
if
(
tslice
%
num
==
tslice
%
nalloc
)
then
tslice
%
nalloc
=
tslice
%
nalloc
+
1024
allocate
(
buf
(
tslice
%
cz
,
tslice
%
nalloc
))
if
(
tslice
%
num
>
0
)
then
buf
(:,
1
:
tslice
%
num
)
=
tslice
%
data
(:,
1
:
tslice
%
num
)
deallocate
(
tslice
%
data
)
end
if
call
move_alloc
(
buf
,
tslice
%
data
)
endif
tslice
%
data
(:,
tslice
%
num
+
1
)
=
profile
(:)
tslice
%
num
=
tslice
%
num
+
1
end
subroutine
push_profile_to_tslice
subroutine
deallocate_tslice
(
tslice
)
!> @brief free time slice
! ----------------------------------------------------------------------------
type
(
oblTimeSlice
),
intent
(
inout
)
::
tslice
! ----------------------------------------------------------------------------
if
(
tslice
%
num
>
0
)
then
deallocate
(
tslice
%
data
)
end
if
end
subroutine
deallocate_tslice
end
module
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment