MOM6
mom_ale_sponge Module Reference

Detailed Description

This module contains the routines used to apply sponge layers when using the ALE mode. Applying sponges requires the following: (1) initialize_ALE_sponge (2) set_up_ALE_sponge_field (tracers) and set_up_ALE_sponge_vel_field (vel) (3) apply_ALE_sponge (4) init_ALE_sponge_diags (not being used for now) (5) ALE_sponge_end (not being used for now)

Data Types

type  ale_sponge_cs
 SPONGE control structure. More...
 
type  p2d
 
type  p3d
 

Functions/Subroutines

subroutine, public initialize_ale_sponge (Iresttime, data_h, nz_data, G, param_file, CS)
 This subroutine determines the number of points which are within. More...
 
subroutine, public init_ale_sponge_diags (Time, G, diag, CS)
 Initialize diagnostics for the ALE_sponge module. More...
 
subroutine, public set_up_ale_sponge_field (sp_val, G, f_ptr, CS)
 This subroutine stores the reference profile at h points for the variable. More...
 
subroutine, public set_up_ale_sponge_vel_field (u_val, v_val, G, u_ptr, v_ptr, CS)
 This subroutine stores the reference profile at uand v points for the variable. More...
 
subroutine, public apply_ale_sponge (h, dt, G, CS)
 This subroutine applies damping to the layers thicknesses, temp, salt and a variety of tracers for every column where there is damping. More...
 
subroutine, public ale_sponge_end (CS)
 GMM: I could not find where sponge_end is being called, but I am keeping. More...
 

Function/Subroutine Documentation

◆ ale_sponge_end()

subroutine, public mom_ale_sponge::ale_sponge_end ( type(ale_sponge_cs), pointer  CS)

GMM: I could not find where sponge_end is being called, but I am keeping.

Definition at line 447 of file MOM_ALE_sponge.F90.

447  type(ale_sponge_cs), pointer :: cs
448 ! (in) CS - A pointer to the control structure for this module that is
449 ! set by a previous call to initialize_sponge.
450  integer :: m
451 
452  if (.not.associated(cs)) return
453 
454  if (associated(cs%col_i)) deallocate(cs%col_i)
455  if (associated(cs%col_i_u)) deallocate(cs%col_i_u)
456  if (associated(cs%col_i_v)) deallocate(cs%col_i_v)
457  if (associated(cs%col_j)) deallocate(cs%col_j)
458  if (associated(cs%col_j_u)) deallocate(cs%col_j_u)
459  if (associated(cs%col_j_v)) deallocate(cs%col_j_v)
460 
461  if (associated(cs%Iresttime_col)) deallocate(cs%Iresttime_col)
462  if (associated(cs%Iresttime_col_u)) deallocate(cs%Iresttime_col_u)
463  if (associated(cs%Iresttime_col_v)) deallocate(cs%Iresttime_col_v)
464 
465  do m=1,cs%fldno
466  if (associated(cs%Ref_val(cs%fldno)%p)) deallocate(cs%Ref_val(cs%fldno)%p)
467  enddo
468 
469  deallocate(cs)
470 

◆ apply_ale_sponge()

subroutine, public mom_ale_sponge::apply_ale_sponge ( real, dimension( g %isd: g %ied, g %jsd: g %jed, g %ke), intent(inout)  h,
real, intent(in)  dt,
type(ocean_grid_type), intent(inout)  G,
type(ale_sponge_cs), pointer  CS 
)

This subroutine applies damping to the layers thicknesses, temp, salt and a variety of tracers for every column where there is damping.

Parameters
[in,out]gThe ocean's grid structure (in).
[in,out]hLayer thickness, in m (in)
[in]dtThe amount of time covered by this call, in s (in).
csA pointer to the control structure for this module that is set by a previous call to initialize_sponge (in).

Definition at line 360 of file MOM_ALE_sponge.F90.

Referenced by mom_diabatic_driver::diabatic().

360  type(ocean_grid_type), intent(inout) :: g !< The ocean's grid structure (in).
361  real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: h !< Layer thickness, in m (in)
362  real, intent(in) :: dt !< The amount of time covered by this call, in s (in).
363  type(ale_sponge_cs), pointer :: cs !<A pointer to the control structure for this module that is set by a previous call to initialize_sponge (in).
364 
365  real :: damp !< The timestep times the local damping coefficient. ND.
366  real :: i1pdamp !< I1pdamp is 1/(1 + damp). Nondimensional.
367  real :: idt !< 1.0/dt, in s-1.
368  real :: tmp_val1(cs%nz) !< data values remapped to model grid
369  real :: tmp_val2(cs%nz_data) ! data values remapped to model grid
370  real :: hu(szib_(g), szj_(g), szk_(g)) !> A temporary array for h at u pts
371  real :: hv(szi_(g), szjb_(g), szk_(g)) !> A temporary array for h at v pts
372  integer :: c, m, nkmb, i, j, k, is, ie, js, je, nz
373  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
374 
375  if (.not.associated(cs)) return
376 
377  do c=1,cs%num_col
378 ! c is an index for the next 3 lines but a multiplier for the rest of the loop
379 ! Therefore we use c as per C code and increment the index where necessary.
380  i = cs%col_i(c) ; j = cs%col_j(c)
381  damp = dt*cs%Iresttime_col(c)
382  i1pdamp = 1.0 / (1.0 + damp)
383  do m=1,cs%fldno
384  tmp_val2(1:cs%nz_data) = cs%Ref_val(m)%p(1:cs%nz_data,c)
385  call remapping_core_h(cs%remap_cs, &
386  cs%nz_data, cs%Ref_h(:,c), tmp_val2, &
387  cs%nz, h(i,j,:), tmp_val1)
388 
389  !Backward Euler method
390  cs%var(m)%p(i,j,:) = i1pdamp * &
391  (cs%var(m)%p(i,j,:) + tmp_val1 * damp)
392 
393 ! CS%var(m)%p(i,j,k) = I1pdamp * &
394 ! (CS%var(m)%p(i,j,k) + tmp_val1 * damp)
395  enddo
396 
397  enddo ! end of c loop
398  ! for debugging
399  !c=CS%num_col
400  !do m=1,CS%fldno
401  ! write(*,*)'APPLY SPONGE,m,CS%Ref_h(:,c),h(i,j,:),tmp_val2,tmp_val1',m,CS%Ref_h(:,c),h(i,j,:),tmp_val2,tmp_val1
402  !enddo
403 
404  if (cs%sponge_uv) then
405 
406  ! u points
407  do j=cs%jsc,cs%jec; do i=cs%iscB,cs%iecB; do k=1,nz
408  hu(i,j,k) = 0.5 * (h(i,j,k) + h(i+1,j,k))
409  enddo; enddo; enddo
410 
411  do c=1,cs%num_col_u
412  i = cs%col_i_u(c) ; j = cs%col_j_u(c)
413  damp = dt*cs%Iresttime_col_u(c)
414  i1pdamp = 1.0 / (1.0 + damp)
415  tmp_val2(1:cs%nz_data) = cs%Ref_val_u(1:cs%nz_data,c)
416  call remapping_core_h(cs%remap_cs, &
417  cs%nz_data, cs%Ref_hu(:,c), tmp_val2, &
418  cs%nz, hu(i,j,:), tmp_val1)
419 
420  !Backward Euler method
421  cs%var_u(i,j,:) = i1pdamp * (cs%var_u(i,j,:) + tmp_val1 * damp)
422  enddo
423 
424  ! v points
425  do j=cs%jscB,cs%jecB; do i=cs%isc,cs%iec; do k=1,nz
426  hv(i,j,k) = 0.5 * (h(i,j,k) + h(i,j+1,k))
427  enddo; enddo; enddo
428 
429  do c=1,cs%num_col_v
430  i = cs%col_i_v(c) ; j = cs%col_j_v(c)
431  damp = dt*cs%Iresttime_col_v(c)
432  i1pdamp = 1.0 / (1.0 + damp)
433  tmp_val2(1:cs%nz_data) = cs%Ref_val_v(1:cs%nz_data,c)
434  call remapping_core_h(cs%remap_cs, &
435  cs%nz_data, cs%Ref_hv(:,c), tmp_val2, &
436  cs%nz, hv(i,j,:), tmp_val1)
437  !Backward Euler method
438  cs%var_v(i,j,:) = i1pdamp * (cs%var_v(i,j,:) + tmp_val1 * damp)
439  enddo
440 
441  endif
Here is the caller graph for this function:

◆ init_ale_sponge_diags()

subroutine, public mom_ale_sponge::init_ale_sponge_diags ( type(time_type), intent(in), target  Time,
type(ocean_grid_type), intent(in)  G,
type(diag_ctrl), intent(inout), target  diag,
type(ale_sponge_cs), pointer  CS 
)

Initialize diagnostics for the ALE_sponge module.

Parameters
[in]gThe ocean's grid structure

Definition at line 274 of file MOM_ALE_sponge.F90.

Referenced by mom::initialize_mom().

274  type(time_type), target, intent(in) :: time
275  type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure
276  type(diag_ctrl), target, intent(inout) :: diag
277  type(ale_sponge_cs), pointer :: cs
278 
279  if (.not.associated(cs)) return
280 
281  cs%diag => diag
282 
Here is the caller graph for this function:

◆ initialize_ale_sponge()

subroutine, public mom_ale_sponge::initialize_ale_sponge ( real, dimension(szi_(g),szj_(g)), intent(in)  Iresttime,
real, dimension(szi_(g),szj_(g),nz_data), intent(in)  data_h,
integer, intent(in)  nz_data,
type(ocean_grid_type), intent(in)  G,
type(param_file_type), intent(in)  param_file,
type(ale_sponge_cs), pointer  CS 
)

This subroutine determines the number of points which are within.

Parameters
[in]nz_dataThe total number of arbritary layers (in).
[in]gThe ocean's grid structure (in).
[in]iresttimeThe inverse of the restoring time, in s-1 (in).
[in]data_hThe thickness to be used in the sponge. It has arbritary layers (in).
[in]param_fileA structure indicating the open file to parse for model parameter values (in).
csA pointer that is set to point to the control structure for this module (in/out).

Definition at line 93 of file MOM_ALE_sponge.F90.

References mom_remapping::initialize_remapping(), and mom_error_handler::mom_error().

Referenced by dense_water_initialization::dense_water_initialize_sponges(), dome2d_initialization::dome2d_initialize_sponges(), and isomip_initialization::isomip_initialize_sponges().

93 
94  integer, intent(in) :: nz_data !< The total number of arbritary layers (in).
95  type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure (in).
96  real, dimension(SZI_(G),SZJ_(G)), intent(in) :: iresttime !< The inverse of the restoring time, in s-1 (in).
97  real, dimension(SZI_(G),SZJ_(G),nz_data), intent(in) :: data_h !< The thickness to be used in the sponge. It has arbritary layers (in).
98  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file to parse for model parameter values (in).
99  type(ale_sponge_cs), pointer :: cs !< A pointer that is set to point to the control structure for this module (in/out).
100 
101 
102 ! This include declares and sets the variable "version".
103 #include "version_variable.h"
104  character(len=40) :: mdl = "MOM_sponge" ! This module's name.
105  logical :: use_sponge
106  real, dimension(SZIB_(G),SZJ_(G),nz_data) :: data_hu !< thickness at u points
107  real, dimension(SZI_(G),SZJB_(G),nz_data) :: data_hv !< thickness at v points
108  real, dimension(SZIB_(G),SZJ_(G)) :: iresttime_u !< inverse of the restoring time at u points, s-1
109  real, dimension(SZI_(G),SZJB_(G)) :: iresttime_v !< inverse of the restoring time at v points, s-1
110  logical :: bndextrapolation = .true. ! If true, extrapolate boundaries
111  integer :: i, j, k, col, total_sponge_cols, total_sponge_cols_u, total_sponge_cols_v
112  character(len=10) :: remapscheme
113  if (associated(cs)) then
114  call mom_error(warning, "initialize_sponge called with an associated "// &
115  "control structure.")
116  return
117  endif
118 
119 ! Set default, read and log parameters
120  call log_version(param_file, mdl, version, "")
121  call get_param(param_file, mdl, "SPONGE", use_sponge, &
122  "If true, sponges may be applied anywhere in the domain. \n"//&
123  "The exact location and properties of those sponges are \n"//&
124  "specified from MOM_initialization.F90.", default=.false.)
125 
126  if (.not.use_sponge) return
127 
128  allocate(cs)
129 
130  call get_param(param_file, mdl, "SPONGE_UV", cs%sponge_uv, &
131  "Apply sponges in u and v, in addition to tracers.", &
132  default=.false.)
133 
134  call get_param(param_file, mdl, "REMAPPING_SCHEME", remapscheme, &
135  "This sets the reconstruction scheme used \n"//&
136  " for vertical remapping for all variables.", &
137  default="PLM", do_not_log=.true.)
138 
139  call get_param(param_file, mdl, "BOUNDARY_EXTRAPOLATION", bndextrapolation, &
140  "When defined, a proper high-order reconstruction \n"//&
141  "scheme is used within boundary cells rather \n"// &
142  "than PCM. E.g., if PPM is used for remapping, a \n" //&
143  "PPM reconstruction will also be used within boundary cells.", &
144  default=.false., do_not_log=.true.)
145 
146  cs%nz = g%ke
147  cs%isc = g%isc ; cs%iec = g%iec ; cs%jsc = g%jsc ; cs%jec = g%jec
148  cs%isd = g%isd ; cs%ied = g%ied ; cs%jsd = g%jsd ; cs%jed = g%jed
149  cs%iscB = g%iscB ; cs%iecB = g%iecB; cs%jscB = g%jscB ; cs%jecB = g%jecB
150 
151  ! number of columns to be restored
152  cs%num_col = 0 ; cs%fldno = 0
153  do j=g%jsc,g%jec ; do i=g%isc,g%iec
154  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) &
155  cs%num_col = cs%num_col + 1
156  enddo ; enddo
157 
158 
159  if (cs%num_col > 0) then
160 
161  allocate(cs%Iresttime_col(cs%num_col)) ; cs%Iresttime_col = 0.0
162  allocate(cs%col_i(cs%num_col)) ; cs%col_i = 0
163  allocate(cs%col_j(cs%num_col)) ; cs%col_j = 0
164 
165  ! pass indices, restoring time to the CS structure
166  col = 1
167  do j=g%jsc,g%jec ; do i=g%isc,g%iec
168  if ((iresttime(i,j)>0.0) .and. (g%mask2dT(i,j)>0)) then
169  cs%col_i(col) = i ; cs%col_j(col) = j
170  cs%Iresttime_col(col) = iresttime(i,j)
171  col = col +1
172  endif
173  enddo ; enddo
174 
175  ! same for total number of arbritary layers and correspondent data
176  cs%nz_data = nz_data
177  allocate(cs%Ref_h(cs%nz_data,cs%num_col))
178  do col=1,cs%num_col ; do k=1,cs%nz_data
179  cs%Ref_h(k,col) = data_h(cs%col_i(col),cs%col_j(col),k)
180  enddo ; enddo
181 
182  endif
183 
184  total_sponge_cols = cs%num_col
185  call sum_across_pes(total_sponge_cols)
186 
187 ! Call the constructor for remapping control structure
188  call initialize_remapping(cs%remap_cs, remapscheme, boundary_extrapolation=bndextrapolation)
189 
190  call log_param(param_file, mdl, "!Total sponge columns at h points", total_sponge_cols, &
191  "The total number of columns where sponges are applied at h points.")
192 
193  if (cs%sponge_uv) then
194  ! u points
195  cs%num_col_u = 0 ; !CS%fldno_u = 0
196  do j=cs%jsc,cs%jec; do i=cs%iscB,cs%iecB
197  data_hu(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i+1,j,:))
198  iresttime_u(i,j) = 0.5 * (iresttime(i,j) + iresttime(i+1,j))
199  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) &
200  cs%num_col_u = cs%num_col_u + 1
201  enddo; enddo
202 
203  if (cs%num_col_u > 0) then
204 
205  allocate(cs%Iresttime_col_u(cs%num_col_u)) ; cs%Iresttime_col_u = 0.0
206  allocate(cs%col_i_u(cs%num_col_u)) ; cs%col_i_u = 0
207  allocate(cs%col_j_u(cs%num_col_u)) ; cs%col_j_u = 0
208 
209  ! pass indices, restoring time to the CS structure
210  col = 1
211  do j=cs%jsc,cs%jec ; do i=cs%iscB,cs%iecB
212  if ((iresttime_u(i,j)>0.0) .and. (g%mask2dCu(i,j)>0)) then
213  cs%col_i_u(col) = i ; cs%col_j_u(col) = j
214  cs%Iresttime_col_u(col) = iresttime_u(i,j)
215  col = col +1
216  endif
217  enddo ; enddo
218 
219  ! same for total number of arbritary layers and correspondent data
220  allocate(cs%Ref_hu(cs%nz_data,cs%num_col_u))
221  do col=1,cs%num_col_u ; do k=1,cs%nz_data
222  cs%Ref_hu(k,col) = data_hu(cs%col_i_u(col),cs%col_j_u(col),k)
223  enddo ; enddo
224 
225  endif
226  total_sponge_cols_u = cs%num_col_u
227  call sum_across_pes(total_sponge_cols_u)
228  call log_param(param_file, mdl, "!Total sponge columns at u points", total_sponge_cols_u, &
229  "The total number of columns where sponges are applied at u points.")
230 
231  ! v points
232  cs%num_col_v = 0 ; !CS%fldno_v = 0
233  do j=cs%jscB,cs%jecB; do i=cs%isc,cs%iec
234  data_hu(i,j,:) = 0.5 * (data_h(i,j,:) + data_h(i,j+1,:))
235  iresttime_v(i,j) = 0.5 * (iresttime(i,j) + iresttime(i,j+1))
236  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) &
237  cs%num_col_v = cs%num_col_v + 1
238  enddo; enddo
239 
240  if (cs%num_col_v > 0) then
241 
242  allocate(cs%Iresttime_col_v(cs%num_col_v)) ; cs%Iresttime_col_v = 0.0
243  allocate(cs%col_i_v(cs%num_col_v)) ; cs%col_i_v = 0
244  allocate(cs%col_j_v(cs%num_col_v)) ; cs%col_j_v = 0
245 
246  ! pass indices, restoring time to the CS structure
247  col = 1
248  do j=cs%jscB,cs%jecB ; do i=cs%isc,cs%iec
249  if ((iresttime_v(i,j)>0.0) .and. (g%mask2dCv(i,j)>0)) then
250  cs%col_i_v(col) = i ; cs%col_j_v(col) = j
251  cs%Iresttime_col_v(col) = iresttime_v(i,j)
252  col = col +1
253  endif
254  enddo ; enddo
255 
256  ! same for total number of arbritary layers and correspondent data
257  allocate(cs%Ref_hv(cs%nz_data,cs%num_col_v))
258  do col=1,cs%num_col_v ; do k=1,cs%nz_data
259  cs%Ref_hv(k,col) = data_hv(cs%col_i_v(col),cs%col_j_v(col),k)
260  enddo ; enddo
261 
262  endif
263  total_sponge_cols_v = cs%num_col_v
264  call sum_across_pes(total_sponge_cols_v)
265  call log_param(param_file, mdl, "!Total sponge columns at v points", total_sponge_cols_v, &
266  "The total number of columns where sponges are applied at v points.")
267  endif
268 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_up_ale_sponge_field()

subroutine, public mom_ale_sponge::set_up_ale_sponge_field ( real, dimension(szi_(g),szj_(g),cs%nz_data), intent(in)  sp_val,
type(ocean_grid_type), intent(in)  G,
real, dimension(szi_(g),szj_(g),szk_(g)), intent(in), target  f_ptr,
type(ale_sponge_cs), pointer  CS 
)

This subroutine stores the reference profile at h points for the variable.

Parameters
[in]gGrid structure (in).
csSponge structure (in/out).
[in]sp_valField to be used in the sponge, it has arbritary number of layers (in).
[in]f_ptrPointer to the field to be damped (in).

Definition at line 288 of file MOM_ALE_sponge.F90.

Referenced by dense_water_initialization::dense_water_initialize_sponges(), dome2d_initialization::dome2d_initialize_sponges(), and isomip_initialization::isomip_initialize_sponges().

288  type(ocean_grid_type), intent(in) :: g !< Grid structure (in).
289  type(ale_sponge_cs), pointer :: cs !< Sponge structure (in/out).
290  real, dimension(SZI_(G),SZJ_(G),CS%nz_data), intent(in) :: sp_val !< Field to be used in the sponge, it has arbritary number of layers (in).
291  real, dimension(SZI_(G),SZJ_(G),SZK_(G)), target, intent(in) :: f_ptr !< Pointer to the field to be damped (in).
292 
293  integer :: j, k, col
294  character(len=256) :: mesg ! String for error messages
295 
296  if (.not.associated(cs)) return
297 
298  cs%fldno = cs%fldno + 1
299 
300  if (cs%fldno > max_fields_) then
301  write(mesg,'("Increase MAX_FIELDS_ to at least ",I3," in MOM_memory.h or decrease &
302  &the number of fields to be damped in the call to &
303  &initialize_sponge." )') cs%fldno
304  call mom_error(fatal,"set_up_ALE_sponge_field: "//mesg)
305  endif
306 
307  ! stores the reference profile
308  allocate(cs%Ref_val(cs%fldno)%p(cs%nz_data,cs%num_col))
309  cs%Ref_val(cs%fldno)%p(:,:) = 0.0
310  do col=1,cs%num_col
311  do k=1,cs%nz_data
312  cs%Ref_val(cs%fldno)%p(k,col) = sp_val(cs%col_i(col),cs%col_j(col),k)
313  enddo
314  enddo
315 
316  cs%var(cs%fldno)%p => f_ptr
317 
Here is the caller graph for this function:

◆ set_up_ale_sponge_vel_field()

subroutine, public mom_ale_sponge::set_up_ale_sponge_vel_field ( real, dimension(szib_(g),szj_(g),cs%nz_data), intent(in)  u_val,
real, dimension(szi_(g),szjb_(g),cs%nz_data), intent(in)  v_val,
type(ocean_grid_type), intent(in)  G,
real, dimension(szib_(g),szj_(g),szk_(g)), intent(in), target  u_ptr,
real, dimension(szi_(g),szjb_(g),szk_(g)), intent(in), target  v_ptr,
type(ale_sponge_cs), pointer  CS 
)

This subroutine stores the reference profile at uand v points for the variable.

Parameters
[in]gGrid structure (in).
csSponge structure (in/out).
[in]u_valu field to be used in the sponge, it has arbritary number of layers (in).
[in]v_valu field to be used in the sponge, it has arbritary number of layers (in).
[in]u_ptru pointer to the field to be damped (in).
[in]v_ptrv pointer to the field to be damped (in).

Definition at line 323 of file MOM_ALE_sponge.F90.

323  type(ocean_grid_type), intent(in) :: g !< Grid structure (in).
324  type(ale_sponge_cs), pointer :: cs !< Sponge structure (in/out).
325  real, dimension(SZIB_(G),SZJ_(G),CS%nz_data), intent(in) :: u_val !< u field to be used in the sponge, it has arbritary number of layers (in).
326  real, dimension(SZI_(G),SZJB_(G),CS%nz_data), intent(in) :: v_val !< u field to be used in the sponge, it has arbritary number of layers (in).
327  real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), target, intent(in) :: u_ptr !< u pointer to the field to be damped (in).
328  real, dimension(SZI_(G),SZJB_(G),SZK_(G)), target, intent(in) :: v_ptr !< v pointer to the field to be damped (in).
329 
330  integer :: j, k, col
331  character(len=256) :: mesg ! String for error messages
332 
333  if (.not.associated(cs)) return
334 
335  ! stores the reference profile
336  allocate(cs%Ref_val_u(cs%nz_data,cs%num_col_u))
337  cs%Ref_val_u(:,:) = 0.0
338  do col=1,cs%num_col_u
339  do k=1,cs%nz_data
340  cs%Ref_val_u(k,col) = u_val(cs%col_i_u(col),cs%col_j_u(col),k)
341  enddo
342  enddo
343 
344  cs%var_u => u_ptr
345 
346  allocate(cs%Ref_val_v(cs%nz_data,cs%num_col_v))
347  cs%Ref_val_v(:,:) = 0.0
348  do col=1,cs%num_col_v
349  do k=1,cs%nz_data
350  cs%Ref_val_v(k,col) = v_val(cs%col_i_v(col),cs%col_j_v(col),k)
351  enddo
352  enddo
353 
354  cs%var_v => v_ptr
355