Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ module adjt_apply_helmholtz_op_lookup_alg_mod
use integer_field_mod, only: integer_field_type
use adj_lookup_table_mod, only: adj_lookup_table_type
use sci_r_solver_field_vector_mod, only: r_solver_field_vector_type
use si_operators_alg_mod, only: compute_si_operators, get_helmholtz_operator
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators, &
get_helmholtz_operator
use dycore_constants_mod, only: stepper_siqn

implicit none

Expand Down Expand Up @@ -119,10 +122,11 @@ module adjt_apply_helmholtz_op_lookup_alg_mod
call invoke(setval_random(init_op_moist_dyn(idx)))
end do

call compute_si_operators( config, init_op_t, init_op_d, init_op_p, &
model_clock, init_op_moist_dyn )
call compute_si_operators_common( config, init_op_t, init_op_d, init_op_p, &
init_op_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

Helmholtz_operator => get_helmholtz_operator(level)
Helmholtz_operator => get_helmholtz_operator(stepper_siqn, level)
lam_mesh = .false.

call vector_x%initialise(vector_space_w3_ptr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module adjt_mixed_operator_alg_mod
use function_space_collection_mod, only: function_space_collection
use moist_dyn_mod, only: num_moist_factors
use fs_continuity_mod, only: W2, W3, Wtheta
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use model_clock_mod, only: model_clock_type
use function_space_mod, only: function_space_type
Expand Down Expand Up @@ -115,8 +117,9 @@ contains
call invoke(setval_random(moist_dyn(idx)))
end do

call compute_si_operators( config, rhs(igh_t), rhs(igh_d), rhs(igh_p), &
model_clock, moist_dyn )
call compute_si_operators_common( config, rhs(igh_t), rhs(igh_d), rhs(igh_p), &
moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

! Input fields are r_def fields so preliminary work uses field_types

Expand Down Expand Up @@ -144,7 +147,7 @@ contains
call construct_solver_state( vector_mx, rhs_rsol, import_fields=.false. )
call construct_solver_state( vector_amx, rhs_rsol, import_fields=.false. )

mixed_op = mixed_operator_type()
mixed_op = mixed_operator_type(stepper_siqn)

call vector_mx%set_scalar(0.0_r_def)
call vector_amx%set_scalar(0.0_r_def)
Expand Down Expand Up @@ -184,7 +187,7 @@ contains
! Adjoint code
! --------------------------------------------------------------------------

adj_mixed_op = adj_mixed_operator_type()
adj_mixed_op = adj_mixed_operator_type(stepper_siqn)

call adj_mixed_op%apply( vector_mx, vector_amx )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ module adjt_mixed_schur_preconditioner_alg_mod
use function_space_collection_mod, only: function_space_collection
use driver_modeldb_mod, only: modeldb_type
use fs_continuity_mod, only: W2, W3, Wtheta
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use model_clock_mod, only: model_clock_type
use function_space_mod, only: function_space_type
Expand Down Expand Up @@ -160,17 +162,19 @@ contains
call moisture_fields%get_field( "ls_moist_dyn", ls_moist_dyn_array )
ls_moist_dyn => ls_moist_dyn_array%bundle

call compute_si_operators( modeldb%config, ls_theta, ls_rho, ls_exner, &
model_clock, ls_moist_dyn )
call compute_si_operators_common( modeldb%config, ls_theta, ls_rho, ls_exner, &
ls_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner )
call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner, stepper_siqn )
call create_pressure_solver( pressure_operator, pressure_preconditioner, pressure_solver )
call create_mixed_preconditioner( rhs, pressure_solver, mixed_preconditioner )
call create_mixed_preconditioner( rhs, pressure_solver, mixed_preconditioner, stepper_siqn )

call create_adj_pressure_preconditioner( rhs, adj_lookup_table_cache, &
adj_pressure_operator, adj_pressure_preconditioner )
adj_pressure_operator, adj_pressure_preconditioner, &
stepper_siqn )
call create_adj_pressure_solver( adj_pressure_operator, adj_pressure_preconditioner, adj_pressure_solver )
call create_adj_mixed_preconditioner( rhs, adj_pressure_solver, adj_mixed_preconditioner )
call create_adj_mixed_preconditioner( rhs, adj_pressure_solver, adj_mixed_preconditioner, stepper_siqn )

call construct_solver_state( vector_x, rhs_rsol, import_fields=.true. )
call construct_solver_state( vector_mx, rhs_rsol, import_fields=.false. )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ module adjt_mixed_solver_alg_mod
use driver_modeldb_mod, only: modeldb_type
use solver_constants_mod, only: get_normalisation
use fs_continuity_mod, only: W2, W3, Wtheta
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use operator_mod, only: operator_type
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use model_clock_mod, only: model_clock_type
Expand Down Expand Up @@ -189,19 +191,21 @@ contains
call moisture_fields%get_field( "ls_moist_dyn", ls_moist_dyn_array )
ls_moist_dyn => ls_moist_dyn_array%bundle

call compute_si_operators( modeldb%config, ls_theta, ls_rho, ls_exner, &
model_clock, ls_moist_dyn )
call compute_si_operators_common( modeldb%config, ls_theta, ls_rho, ls_exner, &
ls_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner )
call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner, stepper_siqn )
call create_pressure_solver( pressure_operator, pressure_preconditioner, pressure_solver )
call create_mixed_preconditioner( rhs, pressure_solver, mixed_preconditioner )
call create_mixed_solver( mixed_preconditioner, mixed_operator, mixed_solver )
call create_mixed_preconditioner( rhs, pressure_solver, mixed_preconditioner, stepper_siqn )
call create_mixed_solver( mixed_preconditioner, mixed_operator, mixed_solver, stepper_siqn )

call create_adj_pressure_preconditioner( rhs, adj_lookup_table_cache, &
adj_pressure_operator, adj_pressure_preconditioner )
adj_pressure_operator, adj_pressure_preconditioner, &
stepper_siqn )
call create_adj_pressure_solver( adj_pressure_operator, adj_pressure_preconditioner, adj_pressure_solver )
call create_adj_mixed_preconditioner( rhs, adj_pressure_solver, adj_mixed_preconditioner )
call create_adj_mixed_solver( adj_mixed_preconditioner, adj_mixed_operator, adj_mixed_solver )
call create_adj_mixed_preconditioner( rhs, adj_pressure_solver, adj_mixed_preconditioner, stepper_siqn )
call create_adj_mixed_solver( adj_mixed_preconditioner, adj_mixed_operator, adj_mixed_solver, stepper_siqn )

call construct_solver_state( vector_x, rhs_rsol, import_fields=.true. )
call construct_solver_state( vector_mx, rhs_rsol, import_fields=.false. )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module adjt_pressure_precon_alg_mod
use function_space_collection_mod, only: function_space_collection
use driver_modeldb_mod, only: modeldb_type
use fs_continuity_mod, only: W2, W3, Wtheta
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use model_clock_mod, only: model_clock_type
use function_space_mod, only: function_space_type
Expand Down Expand Up @@ -149,15 +151,17 @@ contains
call moisture_fields%get_field( "ls_moist_dyn", ls_moist_dyn_array )
ls_moist_dyn => ls_moist_dyn_array%bundle

call compute_si_operators( modeldb%config, ls_theta, ls_rho, ls_exner, &
model_clock, ls_moist_dyn )
call compute_si_operators_common( modeldb%config, ls_theta, ls_rho, ls_exner, &
ls_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner )
call create_pressure_preconditioner( rhs, pressure_operator, pressure_preconditioner, stepper_siqn )

call create_adj_pressure_preconditioner( rhs, &
adj_lookup_table_cache, &
adj_pressure_operator, &
adj_pressure_preconditioner )
call create_adj_pressure_preconditioner( rhs, &
adj_lookup_table_cache, &
adj_pressure_operator, &
adj_pressure_preconditioner, &
stepper_siqn )

! Size = 1 as only P field needed
vector_x = r_solver_field_vector_type(1_i_def)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
! (C) Crown copyright 2025 Met Office. All rights reserved.
! The file LICENCE, distributed with this code, contains details of the terms
! under which the code may be used.
!
! Some of the content of this file has been produced with the assistance of
! Met Office GitHub Copilot Enterprise.
!-----------------------------------------------------------------------------

! @todo Causes failure of later test (mixed_schur_preconditioner); not calling until resolved (#616).
Expand All @@ -23,7 +26,11 @@ module adjt_scaled_matrix_vector_alg_mod
use operator_mod, only: r_solver_operator_type
use r_solver_field_mod, only: r_solver_field_type
use sci_r_solver_field_vector_mod, only: r_solver_field_vector_type
use si_operators_alg_mod, only: compute_si_operators, get_div_star, get_Hb_lumped_inv
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators, &
get_div_star, get_Hb_lumped_inv, &
get_tau_u_dt_cp
use dycore_constants_mod, only: stepper_siqn
use solver_constants_mod, only: get_normalisation_r_solver

! Object types
Expand Down Expand Up @@ -83,6 +90,7 @@ module adjt_scaled_matrix_vector_alg_mod
real(kind=r_def) :: machine_tolerance
real(kind=r_def) :: relative_diff
real(kind=r_def), parameter :: overall_tolerance = 1500.0_r_def
real(kind=r_solver) :: const_u

! Setup

Expand All @@ -106,24 +114,28 @@ module adjt_scaled_matrix_vector_alg_mod
call invoke(setval_random(init_op_moist_dyn(idx)))
end do

call compute_si_operators( config, init_op_t, init_op_d, init_op_p, &
model_clock, init_op_moist_dyn )
call compute_si_operators_common( config, init_op_t, init_op_d, init_op_p, &
init_op_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )

call vector_x%initialise(vector_space_w3_ptr)
call vector_mx%initialise(vector_space_w2_ptr)
call vector_x%copy_field_properties(vector_amx)

u_normalisation => get_normalisation_r_solver( W2, vector_mx%get_mesh_id() )
div_star => get_div_star()
Hb_lumped_inv => get_Hb_lumped_inv()
Hb_lumped_inv => get_Hb_lumped_inv(stepper_siqn)

const_u = get_tau_u_dt_cp(stepper_siqn)

call invoke( setval_random(vector_x), &
setval_c( vector_mx, 0.0_r_solver ), &
setval_c( vector_amx, 0.0_r_solver ), &

! Tangent linear (Mx)

scaled_matrix_vector_kernel_type( vector_mx, vector_x, div_star, u_normalisation, Hb_lumped_inv ), &
scaled_matrix_vector_kernel_type( vector_mx, vector_x, div_star, u_normalisation, Hb_lumped_inv, &
const_u ), &

! <Mx,Mx>

Expand All @@ -143,7 +155,8 @@ module adjt_scaled_matrix_vector_alg_mod

! Adjoint (AMx)

adj_scaled_matrix_vector_kernel_type( vector_mx, vector_amx, div_star, u_normalisation, Hb_lumped_inv ), &
adj_scaled_matrix_vector_kernel_type( vector_mx, vector_amx, div_star, u_normalisation, &
Hb_lumped_inv, const_u ), &

! <AMx,x>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ module adjt_semi_implicit_solver_step_alg_mod
use driver_modeldb_mod, only: modeldb_type
use fs_continuity_mod, only: W2, W3, Wtheta
use mr_indices_mod, only: nummr
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use operator_mod, only: operator_type
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use model_clock_mod, only: model_clock_type
Expand Down Expand Up @@ -163,9 +165,10 @@ contains
call moisture_fields%get_field( "ls_moist_dyn", ls_moist_dyn_array )
ls_moist_dyn => ls_moist_dyn_array%bundle

call compute_si_operators( modeldb%config, ls_theta, ls_rho, ls_exner, &
model_clock, ls_moist_dyn )
call adj_semi_implicit_solver%initialise(rhs, adj_lookup_table_cache)
call compute_si_operators_common( modeldb%config, ls_theta, ls_rho, ls_exner, &
ls_moist_dyn )
call compute_helmholtz_operators( model_clock, stepper_siqn )
call adj_semi_implicit_solver%initialise(rhs, adj_lookup_table_cache, stepper_siqn)

! Set up moist_dyn_gas_law & mr
call moist_dyn_gas_law%initialise(vector_space=vector_space_wtheta_ptr)
Expand Down Expand Up @@ -288,7 +291,7 @@ contains
! --------------------------------------------------------------------------

call semi_implicit_solver_alg_step( state, rhs, dry_flux_solver, &
moist_dyn_gas_law, mr, first_iteration )
moist_dyn_gas_law, mr, first_iteration, stepper_siqn )

! --------------------------------------------------------------------------
! Compute <Mx,Mx>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ module atlt_si_timestep_alg_mod
tl_semi_implicit_alg_final
use atl_si_timestep_alg_mod, only: atl_si_timestep_type
use driver_modeldb_mod, only: modeldb_type
use si_operators_alg_mod, only: compute_si_operators
use si_operators_alg_mod, only: compute_si_operators_common, &
compute_helmholtz_operators
use dycore_constants_mod, only: stepper_siqn
use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type
use field_array_mod, only: field_array_type

Expand Down Expand Up @@ -185,10 +187,11 @@ contains

call tl_semi_implicit_alg_init( mesh, u, rho, theta, exner, mr, &
ls_u, ls_rho, ls_theta, ls_exner, &
ls_mr, ls_moist_dyn, (num_steps == 1) )
ls_mr, ls_moist_dyn, modeldb, (num_steps == 1) )

call compute_si_operators( modeldb%config, ls_theta, ls_rho, ls_exner, &
modeldb%clock, ls_moist_dyn )
call compute_si_operators_common( modeldb%config, ls_theta, ls_rho, ls_exner, &
ls_moist_dyn )
call compute_helmholtz_operators( modeldb%clock, stepper_siqn )

do i = 1, num_steps
call tl_semi_implicit_alg_step( modeldb, u, rho, theta, exner, mr, moist_dyn, &
Expand Down
4 changes: 2 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ lfric_apps:
ref:

lfric_core:
source: git@github.com:MetOffice/lfric_core.git
ref: 2026.07.1
source: git@github.com:tommbendall/lfric_core.git
ref: 932de2756a609a4982ce34feb3f1911e0a2ee617

moci:
source: git@github.com:MetOffice/moci.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 40DAA271B7D2549D
Inner product checksum theta = 42418E8247B61657
Inner product checksum u = 43F0A73C1317F206
Inner product checksum rho = 40DAA271B7D254AF
Inner product checksum theta = 42418E8247B61632
Inner product checksum u = 43F0A73C1317F297
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 40E2F2B22471284D
Inner product checksum theta = 4210411A3413C5A2
Inner product checksum u = 4501AC432273CA03
Inner product checksum rho = 40E2F2B224494971
Inner product checksum theta = 4210411A341A1A2D
Inner product checksum u = 4501AC43210280BA
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 4102EEF5FAAF36AB
Inner product checksum theta = 423041DD8254B694
Inner product checksum u = 45017CE3BDCC7471
Inner product checksum rho = 4102EEF5FA87CBE1
Inner product checksum theta = 423041DD825A8404
Inner product checksum u = 45017CE3BA63F0FA
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 4102EEF5FAAF36A3
Inner product checksum theta = 423041DD8254B695
Inner product checksum u = 45017CE3BDCC746C
Inner product checksum rho = 4102EEF5FA87CBE2
Inner product checksum theta = 423041DD825A8403
Inner product checksum u = 45017CE3BA63F106
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 4102EEF5FAAF36AA
Inner product checksum theta = 423041DD8254B693
Inner product checksum u = 45017CE3BDCC746C
Inner product checksum rho = 4102EEF5FA87CBE0
Inner product checksum theta = 423041DD825A8404
Inner product checksum u = 45017CE3BA63F10A
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 40E31B89B4F18C5A
Inner product checksum theta = 42104617DFB2BB0E
Inner product checksum u = 4500F65BA3091AE0
Inner product checksum rho = 40E31B568E5A4E4A
Inner product checksum theta = 4210461E78734A26
Inner product checksum u = 4500F54C439B1A5A
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Inner product checksum rho = 40E2EB31AE9BB095
Inner product checksum theta = 42104262EDD0C3CB
Inner product checksum u = 4501DA5CB7431A79
Inner product checksum rho = 40E2EB31AEBFEF72
Inner product checksum theta = 42104262EDD13B2E
Inner product checksum u = 4501DA5CAEFE8D62
Loading
Loading