Skip to content

Commit fb00fe1

Browse files
committed
Add nominalMinDc to init_atmosphere core, and scale its value for each init case
The init_atmosphere core now includes a new scalar variable, nominalMinDc, which specifies the nominal grid distance in the highest resolution part of the mesh (where mesh_density == 1.0). The nominalMinDc variable is read from the "input" stream and written to the "output" stream. The value of this variable is also scaled by each each initialization case: for real-data initialization the value is scaled by the Earth's radius, 6371.229 km, and for idealize cases the value is scaled by a factor that depends on the specific case.
1 parent 4997327 commit fb00fe1

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/core_init_atmosphere/Registry.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
<var name="cellsOnVertex"/>
385385
<var name="kiteAreasOnVertex"/>
386386
<var name="meshDensity"/>
387+
<var name="nominalMinDc"/>
387388
<var name="bdyMaskCell"/>
388389
<var name="bdyMaskEdge"/>
389390
<var name="bdyMaskVertex"/>
@@ -482,6 +483,7 @@
482483
<var name="cellsOnVertex"/>
483484
<var name="kiteAreasOnVertex"/>
484485
<var name="meshDensity"/>
486+
<var name="nominalMinDc"/>
485487
<var name="bdyMaskCell"/>
486488
<var name="bdyMaskEdge"/>
487489
<var name="bdyMaskVertex"/>
@@ -729,6 +731,9 @@
729731
<var name="meshDensity" type="real" dimensions="nCells" units="unitless"
730732
description="Mesh density function (used when generating the mesh) evaluated at a cell"/>
731733

734+
<var name="nominalMinDc" type="real" dimensions="" units="m"
735+
description="Nominal minimum dcEdge value where meshDensity == 1.0"/>
736+
732737
<!-- coefficients for vertical extrapolation to the surface -->
733738
<var name="cf1" type="real" dimensions="" units="unitless"
734739
description="Surface interpolation weight for level k=1 value"/>

src/core_init_atmosphere/mpas_init_atm_cases.F

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ subroutine init_atm_case_jw(mesh, nCells, nVertLevels, state, diag, configs)
483483
real (kind=RKIND), dimension(:), pointer :: xVertex, yVertex, zVertex
484484
real (kind=RKIND), dimension(:), pointer :: dcEdge, dvEdge, areaCell, areaTriangle
485485
real (kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
486+
real (kind=RKIND), pointer :: nominalMinDc
486487

487488
real (kind=RKIND), dimension(:), pointer :: latCell, latVertex, lonVertex, latEdge, lonEdge
488489
real (kind=RKIND), dimension(:), pointer :: fEdge, fVertex
@@ -517,6 +518,7 @@ subroutine init_atm_case_jw(mesh, nCells, nVertLevels, state, diag, configs)
517518
call mpas_pool_get_array(mesh, 'areaCell', areaCell)
518519
call mpas_pool_get_array(mesh, 'areaTriangle', areaTriangle)
519520
call mpas_pool_get_array(mesh, 'kiteAreasOnVertex', kiteAreasOnVertex)
521+
call mpas_pool_get_array(mesh, 'nominalMinDc', nominalMinDc)
520522
call mpas_pool_get_config(mesh, 'on_a_sphere', on_a_sphere)
521523
call mpas_pool_get_config(mesh, 'sphere_radius', sphere_radius)
522524

@@ -534,6 +536,7 @@ subroutine init_atm_case_jw(mesh, nCells, nVertLevels, state, diag, configs)
534536
areaCell(:) = areaCell(:) * sphere_radius**2.0
535537
areaTriangle(:) = areaTriangle(:) * sphere_radius**2.0
536538
kiteAreasOnVertex(:,:) = kiteAreasOnVertex(:,:) * sphere_radius**2.0
539+
nominalMinDc = nominalMinDc * sphere_radius
537540

538541
call mpas_pool_get_array(mesh, 'weightsOnEdge', weightsOnEdge)
539542
call mpas_pool_get_array(mesh, 'nEdgesOnEdge', nEdgesOnEdge)
@@ -1403,6 +1406,7 @@ subroutine init_atm_case_squall_line(dminfo, mesh, nCells, nVertLevels, state, d
14031406
real (kind=RKIND), dimension(:), pointer :: xVertex, yVertex, zVertex
14041407
real (kind=RKIND), dimension(:), pointer :: dcEdge, dvEdge, areaCell, areaTriangle
14051408
real (kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
1409+
real (kind=RKIND), pointer :: nominalMinDc
14061410
logical, pointer :: on_a_sphere
14071411
real (kind=RKIND), pointer :: sphere_radius
14081412

@@ -1425,6 +1429,7 @@ subroutine init_atm_case_squall_line(dminfo, mesh, nCells, nVertLevels, state, d
14251429
call mpas_pool_get_array(mesh, 'areaCell', areaCell)
14261430
call mpas_pool_get_array(mesh, 'areaTriangle', areaTriangle)
14271431
call mpas_pool_get_array(mesh, 'kiteAreasOnVertex', kiteAreasOnVertex)
1432+
call mpas_pool_get_array(mesh, 'nominalMinDc', nominalMinDc)
14281433

14291434
call mpas_pool_get_config(mesh, 'on_a_sphere', on_a_sphere)
14301435
call mpas_pool_get_config(mesh, 'sphere_radius', sphere_radius)
@@ -1450,6 +1455,7 @@ subroutine init_atm_case_squall_line(dminfo, mesh, nCells, nVertLevels, state, d
14501455
areaCell(:) = areaCell(:) * a_scale**2.0
14511456
areaTriangle(:) = areaTriangle(:) * a_scale**2.0
14521457
kiteAreasOnVertex(:,:) = kiteAreasOnVertex(:,:) * a_scale**2.0
1458+
nominalMinDc = nominalMinDc * a_scale
14531459

14541460
call mpas_pool_get_array(mesh, 'weightsOnEdge', weightsOnEdge)
14551461
call mpas_pool_get_array(mesh, 'nEdgesOnEdge', nEdgesOnEdge)
@@ -2005,6 +2011,7 @@ subroutine init_atm_case_mtn_wave(mesh, nCells, nVertLevels, state, diag, config
20052011
real (kind=RKIND), dimension(:), pointer :: xVertex, yVertex, zVertex
20062012
real (kind=RKIND), dimension(:), pointer :: dcEdge, dvEdge, areaCell, areaTriangle
20072013
real (kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
2014+
real (kind=RKIND), pointer :: nominalMinDc
20082015
logical, pointer :: on_a_sphere
20092016
real (kind=RKIND), pointer :: sphere_radius
20102017
real (kind=RKIND), pointer :: config_coef_3rd_order
@@ -2031,6 +2038,7 @@ subroutine init_atm_case_mtn_wave(mesh, nCells, nVertLevels, state, diag, config
20312038
call mpas_pool_get_array(mesh, 'areaCell', areaCell)
20322039
call mpas_pool_get_array(mesh, 'areaTriangle', areaTriangle)
20332040
call mpas_pool_get_array(mesh, 'kiteAreasOnVertex', kiteAreasOnVertex)
2041+
call mpas_pool_get_array(mesh, 'nominalMinDc', nominalMinDc)
20342042

20352043
call mpas_pool_get_config(mesh, 'on_a_sphere', on_a_sphere)
20362044
call mpas_pool_get_config(mesh, 'sphere_radius', sphere_radius)
@@ -2072,6 +2080,7 @@ subroutine init_atm_case_mtn_wave(mesh, nCells, nVertLevels, state, diag, config
20722080
areaCell(:) = areaCell(:) * a_scale**2.0
20732081
areaTriangle(:) = areaTriangle(:) * a_scale**2.0
20742082
kiteAreasOnVertex(:,:) = kiteAreasOnVertex(:,:) * a_scale**2.0
2083+
nominalMinDc = nominalMinDc * a_scale
20752084

20762085

20772086
call mpas_pool_get_dimension(mesh, 'nEdges', nEdges)
@@ -5857,6 +5866,7 @@ subroutine init_atm_case_cam_mpas(stream_manager, dminfo, block, mesh, &
58575866
real(kind=RKIND), dimension(:), pointer :: xVertex, yVertex, zVertex
58585867
real(kind=RKIND), dimension(:), pointer :: dcEdge, dvEdge, areaCell, areaTriangle
58595868
real(kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
5869+
real(kind=RKIND), pointer :: nominalMinDc
58605870

58615871
real(kind=RKIND), dimension(:), pointer :: fEdge, fVertex
58625872
real(kind=RKIND), dimension(:), pointer :: latEdge
@@ -5943,6 +5953,7 @@ subroutine init_atm_case_cam_mpas(stream_manager, dminfo, block, mesh, &
59435953
call mpas_pool_get_array(mesh, 'areaCell', areaCell)
59445954
call mpas_pool_get_array(mesh, 'areaTriangle', areaTriangle)
59455955
call mpas_pool_get_array(mesh, 'kiteAreasOnVertex', kiteAreasOnVertex)
5956+
call mpas_pool_get_array(mesh, 'nominalMinDc', nominalMinDc)
59465957
call mpas_pool_get_config(mesh, 'on_a_sphere', on_a_sphere)
59475958
call mpas_pool_get_config(mesh, 'sphere_radius', sphere_radius)
59485959

@@ -5960,6 +5971,7 @@ subroutine init_atm_case_cam_mpas(stream_manager, dminfo, block, mesh, &
59605971
areaCell(:) = areaCell(:) * sphere_radius**2
59615972
areaTriangle(:) = areaTriangle(:) * sphere_radius**2
59625973
kiteAreasOnVertex(:,:) = kiteAreasOnVertex(:,:) * sphere_radius**2
5974+
nominalMinDc = nominalMinDc * sphere_radius
59635975

59645976

59655977
!

src/core_init_atmosphere/mpas_init_atm_static.F

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ subroutine init_atm_static(mesh, dims, configs)
165165
real (kind=RKIND), dimension(:), pointer :: latVertex, lonVertex
166166
real (kind=RKIND), dimension(:), pointer :: latEdge, lonEdge
167167
real (kind=RKIND), dimension(:), pointer :: fEdge, fVertex
168+
real (kind=RKIND), pointer :: nominalMinDc
168169
169170
integer (kind=I8KIND), dimension(:,:), pointer :: greenfrac_int
170171
real (kind=RKIND), dimension(:), pointer :: snoalb
@@ -274,6 +275,8 @@ subroutine init_atm_static(mesh, dims, configs)
274275
call mpas_pool_get_dimension(dims, 'nVertices', nVertices)
275276
call mpas_pool_get_dimension(dims, 'maxEdges', maxEdges)
276277
278+
call mpas_pool_get_array(mesh, 'nominalMinDc', nominalMinDc)
279+
277280
xCell = xCell * sphere_radius
278281
yCell = yCell * sphere_radius
279282
zCell = zCell * sphere_radius
@@ -289,6 +292,8 @@ subroutine init_atm_static(mesh, dims, configs)
289292
areaTriangle = areaTriangle * sphere_radius**2.0
290293
kiteAreasOnVertex = kiteAreasOnVertex * sphere_radius**2.0
291294
295+
nominalMinDc = nominalMinDc * sphere_radius
296+
292297
!
293298
! Set max squared distance for k-d tree search to twice the squared cell diameter
294299
! The factor of two is simply a safety factor to account for possible inaccuracies

0 commit comments

Comments
 (0)