17 real(kind=DEFAULT_PRECISION) ::
dmptim,& !< Layer timescale
18 zdmp,& !< The point (m) where the damping starts
37 type(model_state_type),
target,
intent(inout) :: current_state
41 if (.not. is_component_enabled(current_state%options_database,
"mean_profiles"))
then 42 call log_master_log(log_error,
"Damping requires the mean profiles component to be enabled")
45 dmptim=options_get_real(current_state%options_database,
"dmptim")
46 zdmp=options_get_real(current_state%options_database,
"zdmp")
47 hdmp=options_get_real(current_state%options_database,
"hdmp")
49 allocate(current_state%global_grid%configuration%vertical%dmpco(current_state%local_grid%size(z_index)), &
50 current_state%global_grid%configuration%vertical%dmpcoz(current_state%local_grid%size(z_index)))
51 current_state%global_grid%configuration%vertical%dmpco(:)=0.
52 current_state%global_grid%configuration%vertical%dmpcoz(:)=0.
53 do k=current_state%local_grid%size(z_index),1,-1
54 current_state%global_grid%configuration%vertical%kdmpmin=k
55 if (current_state%global_grid%configuration%vertical%zn(k) .ge.
zdmp)
then 56 current_state%global_grid%configuration%vertical%dmpco(k)=
dmptim*(exp((&
57 current_state%global_grid%configuration%vertical%zn(k)-
zdmp)/
hdmp)-1.0)
59 if (current_state%global_grid%configuration%vertical%z(k) .ge.
zdmp)
then 60 current_state%global_grid%configuration%vertical%dmpcoz(k)=
dmptim*(exp((&
61 current_state%global_grid%configuration%vertical%z(k)-
zdmp)/
hdmp)-1.0)
63 if(current_state%global_grid%configuration%vertical%zn(k).lt.
zdmp)
exit 70 type(model_state_type),
target,
intent(inout) :: current_state
74 if (current_state%halo_column .and. current_state%timestep <3)
return 76 do k=current_state%global_grid%configuration%vertical%kdmpmin,current_state%local_grid%size(z_index)
78 current_state%su%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%su%data(k, &
79 current_state%column_local_y, current_state%column_local_x)-&
80 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zu%data(k, current_state%column_local_y, &
81 current_state%column_local_x)- (current_state%global_grid%configuration%vertical%olzubar(k)-current_state%ugal))
84 current_state%sv%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sv%data(k, &
85 current_state%column_local_y, current_state%column_local_x)-&
86 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zv%data(k, current_state%column_local_y, &
87 current_state%column_local_x)-(current_state%global_grid%configuration%vertical%olzvbar(k)-current_state%vgal))
89 if (current_state%th%active)
then 90 current_state%sth%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sth%data(k, &
91 current_state%column_local_y, current_state%column_local_x)-&
92 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zth%data(k, current_state%column_local_y, &
93 current_state%column_local_x)-current_state%global_grid%configuration%vertical%olzthbar(k))
96 do i=1,current_state%number_q_fields
97 if (current_state%q(i)%active)
then 98 current_state%sq(i)%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sq(i)%data(k, &
99 current_state%column_local_y, current_state%column_local_x)-&
100 current_state%global_grid%configuration%vertical%dmpco(k)*&
101 (current_state%zq(i)%data(k, current_state%column_local_y, current_state%column_local_x)-&
102 current_state%global_grid%configuration%vertical%olzqbar(k,i))
107 do k=current_state%global_grid%configuration%vertical%kdmpmin,current_state%local_grid%size(z_index)-1
108 current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sw%data(k, &
109 current_state%column_local_y, current_state%column_local_x)-&
110 current_state%global_grid%configuration%vertical%dmpcoz(k)*&
111 current_state%zw%data(k, current_state%column_local_y, current_state%column_local_x)
real(kind=default_precision) hdmp
The height (m) of the damping layer.
integer, parameter, public log_error
Only log ERROR messages.
type(component_descriptor_type) function, public damping_get_descriptor()
Descriptor of this component for registration.
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
Contains common definitions for the data and datatypes used by MONC.
The ModelState which represents the current state of a run.
logical function, public is_component_enabled(options_database, component_name)
Determines whether or not a specific component is registered and enabled.
subroutine, public log_master_log(level, message)
Will log just from the master process.
Description of a component.
subroutine timestep_callback(current_state)
For each data column will calculate the damping term and apply this to the source term for that field...
Map data structure that holds string (length 20 maximum) key value pairs.
Interfaces and types that MONC components must specify.
Collection data structures.
real(kind=default_precision) dmptim
Layer timescale.
real(kind=default_precision) function, public options_get_real(options_database, key, index)
Retrieves a real value from the database that matches the provided key.
Functionality to support the different types of grid and abstraction between global grids and local o...
Manages the options database. Contains administration functions and deduce runtime options from the c...
Damping applied to the W field at some point to stop stuff flying up and off.
subroutine init_callback(current_state)
On initialisation will set up data structures and field values.
real(kind=default_precision) zdmp
The point (m) where the damping starts.
The model state which represents the current state of a run.