Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d41d463
stretching
cjohnson-pi Feb 9, 2026
58fdb32
example works
cjohnson-pi Feb 10, 2026
1d3aa30
tidy
cjohnson-pi Feb 10, 2026
73a15d5
rose
cjohnson-pi Feb 10, 2026
0765224
Update polynomial calculation
cjohnson-pi Feb 13, 2026
0f37fbe
update polynomial
cjohnson-pi Feb 13, 2026
a32d1ba
Correct for all powers
cjohnson-pi Feb 17, 2026
77bd280
tidy
cjohnson-pi Feb 17, 2026
41d57eb
correct versions
cjohnson-pi Feb 18, 2026
62467ad
use PR number
cjohnson-pi Feb 18, 2026
ba667ca
correct rose meta
cjohnson-pi Feb 18, 2026
e6b680e
unit tests run
cjohnson-pi Feb 18, 2026
c0d74c2
unit tests pass
cjohnson-pi Feb 18, 2026
5e08d60
whitespace
cjohnson-pi Feb 18, 2026
ce41044
update domain_extents
cjohnson-pi Mar 4, 2026
12eeb80
Merge remote-tracking branch 'origin/main' into stretching
cjohnson-pi Mar 5, 2026
32cb52d
minor improvements
cjohnson-pi Mar 5, 2026
2cf1072
kgo and whitespace
cjohnson-pi Mar 5, 2026
c2549a2
mesh kgo
cjohnson-pi Mar 5, 2026
75400a4
Merge branch 'main' into stretching
cjohnson-pi Mar 5, 2026
e53cb21
CLA
cjohnson-pi Mar 5, 2026
97d21eb
update versions
cjohnson-pi Mar 5, 2026
38e2537
non-symmetrical
cjohnson-pi Mar 13, 2026
dfa0f47
correct style, rose-meta and kgos
cjohnson-pi Mar 13, 2026
7a7feee
science review response
cjohnson-pi Mar 19, 2026
0cb4c83
More aligning
cjohnson-pi Mar 19, 2026
c14506e
correction
cjohnson-pi Mar 19, 2026
71def5a
response to code review
cjohnson-pi Jun 17, 2026
4554b47
nsew to wsen
cjohnson-pi Jun 17, 2026
169d7bb
nsew to wsen
cjohnson-pi Jun 17, 2026
f87be93
style
cjohnson-pi Jun 17, 2026
182add9
At least 1 stretch cell
cjohnson-pi Jun 17, 2026
26984d4
Update mesh_tools/source/support/polynomial_stretching_mod.F90
cjohnson-pi Jun 26, 2026
2e2203b
Update mesh_tools/source/support/polynomial_stretching_mod.F90
cjohnson-pi Jun 26, 2026
fabca88
Update mesh_tools/source/support/polynomial_stretching_mod.F90
cjohnson-pi Jun 26, 2026
e6f0d6f
Update mesh_tools/source/support/gen_planar_mod.F90
cjohnson-pi Jun 26, 2026
4ab8041
Update mesh_tools/rose-meta/lfric-mesh_tools/HEAD/rose-meta.conf
cjohnson-pi Jun 26, 2026
f6ef315
Update mesh_tools/source/support/gen_planar_mod.F90
cjohnson-pi Jun 26, 2026
1afd119
Update mesh_tools/source/support/gen_planar_mod.F90
cjohnson-pi Jun 26, 2026
50eb1b3
'Boundary enumeration' correction
cjohnson-pi Jun 26, 2026
01d176c
more code review response
cjohnson-pi Jun 26, 2026
fb27efb
Deal with apply_shift and apply_uniform_scaling
cjohnson-pi Jun 26, 2026
b3b7565
Merge remote-tracking branch 'upstream/main' into stretching
cjohnson-pi Jun 29, 2026
85c4d65
validate and style corrections
cjohnson-pi Jun 29, 2026
4b035cf
configuration -> config
cjohnson-pi Jun 29, 2026
ec2841a
reorder subroutines - so make build succeeds
cjohnson-pi Jun 29, 2026
0a620c4
kgos
cjohnson-pi Jun 29, 2026
87da607
removing bugs
cjohnson-pi Jun 29, 2026
4f68a1d
correction
cjohnson-pi Jun 29, 2026
cef9077
kgos
cjohnson-pi Jun 29, 2026
7556bf7
apply macros
james-bruten-mo Jun 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
| Adrian-Lock | Adrian Lock | Met Office | 2026-05-21 |
| ukmo-juan-castillo | Juan M. Castillo | Met Office | 2026-03-24 |
| mcdalvi | Mohit Dalvi | Met Office | 2026-06-19 |
| cjohnson-pi | Christine Johnson | Met Office | 2026-06-29 |
19 changes: 10 additions & 9 deletions applications/lbc_demo/example/mesh_config.nml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
/

&planar_mesh
edge_cells_x = 30
edge_cells_y = 30
domain_size = 24.0, 22.0
domain_centre = 0.0, 0.0
periodic_x = .false.
periodic_y = .false.
create_lbc_mesh = .true.
lbc_rim_depth = 6
lbc_parent_mesh = 'primary'
edge_cells_x = 30
edge_cells_y = 30
domain_size = 24.0, 22.0
domain_centre = 0.0, 0.0
periodic_x = .false.
periodic_y = .false.
create_lbc_mesh = .true.
lbc_rim_depth = 6
lbc_parent_mesh = 'primary'
stretch_function = 'uniform'
Comment thread
mo-rickywong marked this conversation as resolved.
/

&partitions
Expand Down
12 changes: 7 additions & 5 deletions mesh_tools/example/planar_mesh_gen.nml
Comment thread
mo-rickywong marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
! be a factor of the other.

&planar_mesh
edge_cells_x = 48, 24
edge_cells_y = 24, 12
edge_cells_x = 48,24
edge_cells_y = 24,12
domain_size = 48.0, 24.0
domain_centre = 0.0, 0.0
periodic_x = .false.
periodic_y = .false.
create_lbc_mesh = .true.
lbc_rim_depth = 1
lbc_parent_mesh = 'mesh_A'
apply_stretch_transform = .false.
stretch_function = 'uniform'
/

&partitions
Expand All @@ -81,8 +81,10 @@
&stretch_transform
cell_size_inner = 2.0, 2.0
cell_size_outer = 3.0, 3.0
n_cells_outer = 2, 2
n_cells_stretch = 5, 5
n_cells_outer_wsen = 2, 2, 2, 2
n_cells_stretch_wsen = 5, 5, 5, 5
stretching_on = 'cell_centres'
poly_power = 3
transform_mesh = 'mesh_A'
stretching_on = 'cell_nodes'
/
98 changes: 82 additions & 16 deletions mesh_tools/rose-meta/lfric-mesh_tools/HEAD/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,6 @@ ns=namelist/mesh/planar
sort-key=Section-A03
title=Planar

[namelist:planar_mesh=apply_stretch_transform]
compulsory=true
description=Apply stretched grid transformation.
help=Enables using a larger cell spacing in the outer region of the domain,
=compared to the inner region.
!kind=default
sort-key=Panel-D01
trigger=namelist:stretch_transform: .true.;
type=logical

[namelist:planar_mesh=create_lbc_mesh]
compulsory=true
description=Create LBC mesh
Expand Down Expand Up @@ -470,6 +460,36 @@ help=Specifies whether the topology of the mesh should be periodic in the y dire
sort-key=Panel-A10
type=logical

[namelist:planar_mesh=stretch_function]
Comment thread
mo-rickywong marked this conversation as resolved.
compulsory=true
description=Type of stretch transformation applied to the unit mesh
!enumeration=true
help=The function applied is:
= * "Uniform"
= Uniform resolution mesh
= y = ax
=
= * "Inflation"
= Low resolution outer and a high resolution interior
= with a stretch region in between.
= y_n = y_n-1 + dy * inflation ** stretch
=
= * "Polynomial"
= Low resolution outer and a high resolution interior
= with a stretch region in between.
= y = bx + ax^n
= where n is the power
!kind=default
Comment thread
mo-rickywong marked this conversation as resolved.
trigger=namelist:stretch_transform: this != "'uniform'";
=namelist:stretch_transform=stretching_on: this == "'inflation'";
=namelist:stretch_transform=n_cells_outer: this == "'inflation'";
=namelist:stretch_transform=n_cells_stretch: this == "'inflation'";
=namelist:stretch_transform=poly_power: this == "'polynomial'";
=namelist:stretch_transform=n_cells_outer_wsen: this == "'polynomial'";
=namelist:stretch_transform=n_cells_stretch_wsen: this == "'polynomial'";
value-titles=uniform, inflation, polynomial
values='uniform','inflation','polynomial'

[namelist:rotation]
compulsory=true
ns=namelist/mesh/Rotation
Expand Down Expand Up @@ -578,20 +598,34 @@ type=real

[namelist:stretch_transform=n_cells_outer]
compulsory=true
description=Depth (in cells) of outer region
description=Depth of outer region [cells]
help=[n_outer_x, n_outer_y]
=This is the number of cells in an outer region
=near to a domain edge. i.e. There are
=Number of cells in an outer region
=adjacent to domain boundary. i.e. There are
=2*n_cells_outer along the whole axis
!kind=default
length=2
range=2:
range=1:
sort-key=Panel-A04
type=integer

[namelist:stretch_transform=n_cells_outer_wsen]
compulsory=true
description=Depth of outer region [cells]
help=[n_outer_w, n_outer_s, n_outer_e, n_outer_n]
=Number of cells in an outer region
=adjacent to domain boundary. Values are ordered
=for the domain boundaries as West, South,
=East and North.
!kind=default
length=4
range=1:
sort-key=Panel-A04
type=integer

[namelist:stretch_transform=n_cells_stretch]
compulsory=true
description=Depth (in cells) of stretch region
description=Depth of stretch region [cells]
help=[n_stretch_x, n_stretch_y]
=A stretch region is defined to be the
=cells in between the inner region and an
Expand All @@ -601,7 +635,39 @@ help=[n_stretch_x, n_stretch_y]
=and 2*n_cells_stretch along the whole axis
!kind=default
length=2
range=0:
range=1:
sort-key=Panel-A04
type=integer

[namelist:stretch_transform=n_cells_stretch_wsen]
compulsory=true
description=Depth of stretch region [cells]
help=[n_stretch_w, n_stretch_s, n_stretch_e, n_stretch_n]
=
=Number of cells in stretch region toward a give domain
=boundary. These are ordered for the West, South
=East and North boundaries of the domain.
=
=A stretch region is defined to be the
=cells in between the inner region and an
=outer region. Cell sizes within the stretch
=region will lie between cell sizes within
=the inner/outer regions.
=i.e. cell_size_outer > size > cell_size_inner
!kind=default
length=4
range=1:
sort-key=Panel-A04
type=integer

[namelist:stretch_transform=poly_power]
compulsory=true
description=Polynomial Power
help=Integer polynomial power, n, for
=stretch transform function
= y = bx + ax^n
!kind=default
range=2:
sort-key=Panel-A04
type=integer

Expand Down
33 changes: 30 additions & 3 deletions mesh_tools/rose-meta/lfric-mesh_tools/versions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import sys

from metomi.rose.upgrade import MacroUpgrade # noqa: F401
Expand All @@ -20,14 +21,40 @@ def __repr__(self):

"""
Copy this template and complete to add your macro

class vnXX_txxx(MacroUpgrade):
# Upgrade macro for <TICKET> by <Author>

BEFORE_TAG = "vnX.X"
AFTER_TAG = "vnX.X_txxx"

def upgrade(self, config, meta_config=None):
# Add settings
return config, self.reports
"""


class vn31_t270(MacroUpgrade):
"""Upgrade macro for ticket #270 by cjohnson-pi."""

BEFORE_TAG = "vn3.1"
AFTER_TAG = "vn3.1_t270"

def upgrade(self, config, meta_config=None):
# Commands From: rose-meta/lfric-mesh_tools
nml = "namelist:planar_mesh"
apply_stretch_transform = self.get_setting_value(
config, [nml, "apply_stretch_transform"]
)
if apply_stretch_transform == ".true.":
self.add_setting(
config,
[nml, "stretch_function"],
"'inflation'",
)
else:
self.add_setting(
config,
[nml, "stretch_function"],
"'uniform'",
)
self.remove_setting(config, [nml, "apply_stretch_transform"])

return config, self.reports
Comment thread
mo-rickywong marked this conversation as resolved.
39 changes: 21 additions & 18 deletions mesh_tools/source/planar_mesh_generator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ program planar_mesh_generator
key_from_geometry
use rotation_config_mod, only: ROTATION_TARGET_NULL_ISLAND, &
ROTATION_TARGET_NORTH_POLE
use planar_mesh_config_mod, &
only: STRETCH_FUNCTION_INFLATION, &
STRETCH_FUNCTION_POLYNOMIAL

implicit none

Expand Down Expand Up @@ -169,11 +172,9 @@ program planar_mesh_generator
logical :: periodic_y
logical :: create_lbc_mesh
integer(i_def) :: lbc_rim_depth
integer(i_def) :: stretch_function

character(str_def) :: lbc_parent_mesh

logical :: apply_stretch_transform

character(str_def) :: transform_mesh

type(local_mesh_collection_type) :: local_mesh_collection
Expand Down Expand Up @@ -226,17 +227,16 @@ program planar_mesh_generator
topology = config%mesh%topology()
geometry = config%mesh%geometry()

edge_cells_x = config%planar_mesh%edge_cells_x()
edge_cells_y = config%planar_mesh%edge_cells_y()
periodic_x = config%planar_mesh%periodic_x()
periodic_y = config%planar_mesh%periodic_y()
domain_size = config%planar_mesh%domain_size()
domain_centre = config%planar_mesh%domain_centre()
create_lbc_mesh = config%planar_mesh%create_lbc_mesh()
lbc_rim_depth = config%planar_mesh%lbc_rim_depth()
lbc_parent_mesh = config%planar_mesh%lbc_parent_mesh()

apply_stretch_transform = config%planar_mesh%apply_stretch_transform()
edge_cells_x = config%planar_mesh%edge_cells_x()
edge_cells_y = config%planar_mesh%edge_cells_y()
periodic_x = config%planar_mesh%periodic_x()
periodic_y = config%planar_mesh%periodic_y()
domain_size = config%planar_mesh%domain_size()
domain_centre = config%planar_mesh%domain_centre()
create_lbc_mesh = config%planar_mesh%create_lbc_mesh()
lbc_rim_depth = config%planar_mesh%lbc_rim_depth()
lbc_parent_mesh = config%planar_mesh%lbc_parent_mesh()
stretch_function = config%planar_mesh%stretch_function()

if (partition_mesh) then
max_stencil_depth = config%partitions%max_stencil_depth()
Expand All @@ -251,7 +251,8 @@ program planar_mesh_generator
target_null_island = config%rotation%target_null_island()
end if

if (apply_stretch_transform) then
if (stretch_function == STRETCH_FUNCTION_INFLATION .or. &
stretch_function == STRETCH_FUNCTION_POLYNOMIAL) then
transform_mesh = config%stretch_transform%transform_mesh()
end if

Expand Down Expand Up @@ -408,9 +409,9 @@ program planar_mesh_generator
call log_event( log_scratch_space, LOG_LEVEL_ERROR )
end if

if (apply_stretch_transform) then
! This enables support meshes to be created with a variable
! resolution stretching function.
! This enables support meshes to be created with a variable
! resolution stretching function.
if (config%namelist_exists('stretch_transform')) then
do j=1, n_meshes
if (trim(mesh_names(j)) == trim(transform_mesh)) then
fine_mesh_edge_cells_x = edge_cells_x(j)
Expand Down Expand Up @@ -743,6 +744,7 @@ program planar_mesh_generator
periodic_y = periodic_y, &
domain_size = domain_size, &
domain_centre = domain_centre, &
stretch_function = stretch_function, &
rotate_mesh = rotate_mesh, &
target_north_pole = set_north_pole, &
target_null_island = set_null_island )
Expand Down Expand Up @@ -779,6 +781,7 @@ program planar_mesh_generator
fine_mesh_edge_cells_y, &
periodic_x, periodic_y, &
domain_size, domain_centre, &
stretch_function = stretch_function, &
target_mesh_names = target_mesh_names, &
target_edge_cells_x = target_edge_cells_x, &
target_edge_cells_y = target_edge_cells_y, &
Expand Down
Loading
Loading