MONC
Functions/Subroutines | Variables
damping_mod Module Reference

Damping applied to the W field at some point to stop stuff flying up and off. More...

Functions/Subroutines

type(component_descriptor_type) function, public damping_get_descriptor ()
 Descriptor of this component for registration. More...
 
subroutine init_callback (current_state)
 On initialisation will set up data structures and field values. More...
 
subroutine timestep_callback (current_state)
 For each data column will calculate the damping term and apply this to the source term for that field. More...
 

Variables

real(kind=default_precision) dmptim
 Layer timescale. More...
 
real(kind=default_precision) zdmp
 The point (m) where the damping starts. More...
 
real(kind=default_precision) hdmp
 The height (m) of the damping layer. More...
 

Detailed Description

Damping applied to the W field at some point to stop stuff flying up and off.

Function/Subroutine Documentation

◆ damping_get_descriptor()

type(component_descriptor_type) function, public damping_mod::damping_get_descriptor ( )

Descriptor of this component for registration.

Returns
The damping component descriptor

Definition at line 28 of file damping.F90.

28  damping_get_descriptor%name="damping"
29  damping_get_descriptor%version=0.1
30  damping_get_descriptor%initialisation=>init_callback
31  damping_get_descriptor%timestep=>timestep_callback
Here is the call graph for this function:

◆ init_callback()

subroutine damping_mod::init_callback ( type(model_state_type), intent(inout), target  current_state)
private

On initialisation will set up data structures and field values.

Parameters
current_stateThe current model state_mod

Definition at line 37 of file damping.F90.

37  type(model_state_type), target, intent(inout) :: current_state
38 
39  integer :: k
40 
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")
43  end if
44 
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")
48 
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)
58  end if
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)
62  end if
63  if(current_state%global_grid%configuration%vertical%zn(k).lt. zdmp) exit
64  end do
Here is the caller graph for this function:

◆ timestep_callback()

subroutine damping_mod::timestep_callback ( type(model_state_type), intent(inout), target  current_state)
private

For each data column will calculate the damping term and apply this to the source term for that field.

Parameters
current_stateThe current model state_mod

Definition at line 70 of file damping.F90.

70  type(model_state_type), target, intent(inout) :: current_state
71 
72  integer :: k, i
73 
74  if (current_state%halo_column .and. current_state%timestep <3) return
75 
76  do k=current_state%global_grid%configuration%vertical%kdmpmin,current_state%local_grid%size(z_index)
77 #ifdef U_ACTIVE
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))
82 #endif
83 #ifdef V_ACTIVE
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))
88 #endif
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))
94  end if
95 
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))
103  end if
104  end do
105  end do
106 #ifdef W_ACTIVE
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)
112  end do
113 #endif
Here is the caller graph for this function:

Variable Documentation

◆ dmptim

real(kind=default_precision) damping_mod::dmptim
private

Layer timescale.

Definition at line 17 of file damping.F90.

17  real(kind=DEFAULT_PRECISION) :: dmptim,& !< Layer timescale
18  zdmp,& !< The point (m) where the damping starts
19  hdmp

◆ hdmp

real(kind=default_precision) damping_mod::hdmp
private

The height (m) of the damping layer.

Definition at line 17 of file damping.F90.

◆ zdmp

real(kind=default_precision) damping_mod::zdmp
private

The point (m) where the damping starts.

Definition at line 17 of file damping.F90.