30 #include "sll_assert.h"
31 #include "sll_memory.h"
32 #include "sll_working_precision.h"
57 sll_real64,
dimension(:),
pointer :: params
58 character(len=64) :: name
64 logical :: present_derivative
67 procedure, pass(field) :: get_cartesian_mesh => &
71 procedure, pass(field) :: derivative_value_at_point => &
73 procedure, pass(field) :: derivative_value_at_indices => &
76 procedure, pass(field) :: update_interpolation_coefficients => &
83 sll_real64,
dimension(:),
pointer :: values
87 character(len=64) :: name
90 sll_real64,
dimension(:),
pointer :: point
97 procedure, pass(field) :: get_cartesian_mesh => &
101 procedure, pass(field) :: derivative_value_at_point => &
103 procedure, pass(field) :: derivative_value_at_indices => &
106 procedure, pass(field) :: update_interpolation_coefficients => &
116 sll_real64,
intent(in) :: eta
117 sll_real64,
dimension(:),
intent(in),
optional :: params
135 sll_real64,
intent(in) :: eta
142 sll_int32,
intent(in) :: i
145 eta = field%mesh%eta_min + real(i - 1, f64)*field%mesh%delta_eta
151 sll_real64,
intent(in) :: eta
154 if (field%present_derivative)
then
156 field%first_derivative(eta, field%params)
158 print *,
' first derivative is not given in the initialization'
165 sll_int32,
intent(in) :: i
169 eta = field%mesh%eta_min + real(i - 1, f64)*field%mesh%delta_eta
171 if (field%present_derivative)
then
173 field%first_derivative(eta, field%params)
175 print *,
' first derivative is not given in the initialization'
187 first_derivative)
result(obj)
192 character(len=*),
intent(in) :: field_name
193 sll_real64,
dimension(:),
intent(in),
optional,
target :: func_params
194 sll_int32,
intent(in) :: bc_left
195 sll_int32,
intent(in) :: bc_right
199 sll_allocate(obj, ierr)
212 sll_real64,
dimension(:),
intent(in) :: values
213 print *,
'WARNING: set_field_data_analytic_1d(): it is useless to ', &
214 'call this function on an analytic scalar field.'
215 print *, field%bc_left*values(1)
220 print *,
'WARNING: update_interpolation_coefficients_1d_analytic(): ', &
221 ' it is useless to call this function on an analytic scalar field.'
222 print *, field%bc_left
250 character(len=*),
intent(in) :: field_name
251 sll_real64,
dimension(:),
intent(in),
optional,
target :: func_params
254 sll_int32,
intent(in) :: bc_left
255 sll_int32,
intent(in) :: bc_right
258 if (
present(func_params))
then
259 field%params => func_params
265 allocate (field%params(0))
267 field%name = trim(field_name)
268 field%bc_left = bc_left
269 field%bc_right = bc_right
271 if (
present(first_derivative))
then
272 field%first_derivative => first_derivative
273 field%present_derivative = .true.
299 sll_int32,
intent(in) :: tag
301 sll_real64,
dimension(:),
allocatable :: xcoords
302 sll_real64,
dimension(:),
allocatable :: values
311 nptsx = field%mesh%num_cells + 1
314 sll_allocate(xcoords(nptsx), ierr)
315 sll_allocate(values(nptsx), ierr)
319 eta = field%mesh%eta_min + (i - 1)*field%mesh%delta_eta
321 values(i) = field%value_at_point(eta)*tag
324 print *,
'not implemented sll_gnuplot_curv_1d'
333 sll_deallocate_array(xcoords, ierr)
334 sll_deallocate_array(values, ierr)
351 sz_point)
result(obj)
355 character(len=*),
intent(in) :: field_name
358 sll_real64,
dimension(:),
optional :: point_1d
359 sll_int32,
optional :: sz_point
361 sll_int32,
intent(in) :: bc_left
362 sll_int32,
intent(in) :: bc_right
365 sll_allocate(obj, ierr)
390 character(len=*),
intent(in) :: field_name
393 sll_real64,
dimension(:),
optional :: point_1d
394 sll_int32,
optional :: sz_point
395 sll_int32,
intent(in) :: bc_left
396 sll_int32,
intent(in) :: bc_right
400 field%interp_1d => interpolator_1d
402 field%name = trim(field_name)
403 field%bc_left = bc_left
404 field%bc_right = bc_right
408 sll_allocate(field%values(field%mesh%num_cells + 1), ierr)
426 sll_assert(
present(point_1d))
427 sll_assert(
present(sz_point))
433 sll_real64,
dimension(:),
intent(in) :: values
434 if (
size(field%values, 1) .ne.
size(values, 1))
then
435 print *,
'WARNING, set_field_data_discrete_1d(), passed array ', &
436 'is not of the size originally declared for this field.'
438 field%values(:) = values(:)
450 nullify (field%values)
451 nullify (field%interp_1d)
457 call field%interp_1d%compute_interpolants(field%values)
468 sll_real64,
intent(in) :: eta
476 sll_int32,
intent(in) :: i
479 eta = field%mesh%eta_min + real(i - 1, f64)*field%mesh%delta_eta
485 sll_real64,
intent(in) :: eta
489 field%interp_1d%interpolate_from_interpolant_derivative_eta1(eta)
494 sll_int32,
intent(in) :: i
497 eta = field%mesh%eta_min + real(i - 1, f64)*field%mesh%delta_eta
499 field%interp_1d%interpolate_from_interpolant_derivative_eta1(eta)
504 sll_int32,
intent(in) :: tag
506 sll_real64,
dimension(:),
allocatable :: xcoords
507 sll_real64,
dimension(:),
allocatable :: values
515 mesh => field%get_cartesian_mesh()
516 nptsx = mesh%num_cells + 1
518 sll_allocate(xcoords(nptsx), ierr)
519 sll_allocate(values(nptsx), ierr)
523 eta = mesh%eta_min + (i - 1)*mesh%delta_eta
525 values(i) = field%value_at_point(eta)*tag
528 print *,
'not implement the sll_gnuplot_curv_1d '
537 sll_deallocate_array(xcoords, ierr)
538 sll_deallocate_array(values, ierr)
Cartesian mesh basic types.
Module for 1D interpolation and reconstruction.
Implements the geometry and mesh descriptor types.
subroutine set_field_data_analytic_1d(field, values)
subroutine delete_field_1d_discrete(field)
type(sll_t_scalar_field_1d_discrete) function, pointer, public sll_f_new_scalar_field_1d_discrete(field_name, interpolator_1d, bc_left, bc_right, mesh, point_1d, sz_point)
type(sll_t_scalar_field_1d_analytic) function, pointer, public sll_f_new_scalar_field_1d_analytic(func, field_name, bc_left, bc_right, mesh, func_params, first_derivative)
real(kind=f64) function value_at_pt_analytic_1d(field, eta)
real(kind=f64) function derivative_value_at_pt_analytic_1d(field, eta)
type(sll_t_cartesian_mesh_1d) function, pointer get_cartesian_mesh_1d_analytic(field)
subroutine update_interp_coeffs_1d_discrete(field)
function value_at_index_discrete_1d(field, i)
type(sll_t_cartesian_mesh_1d) function, pointer get_cartesian_mesh_1d_discrete(field)
subroutine update_interp_coeffs_1d_analytic(field)
subroutine write_to_file_discrete_1d(field, tag)
subroutine delete_field_1d_analytic(field)
subroutine set_field_data_discrete_1d(field, values)
subroutine initialize_scalar_field_1d_analytic(field, func, field_name, bc_left, bc_right, mesh, func_params, first_derivative)
function derivative_value_at_index_discrete_1d(field, i)
subroutine write_to_file_analytic_1d(field, tag)
subroutine initialize_scalar_field_1d_discrete(field, field_name, interpolator_1d, bc_left, bc_right, mesh, point_1d, sz_point)
real(kind=f64) function value_at_index_analytic_1d(field, i)
function derivative_value_at_pt_discrete_1d(field, eta)
real(kind=f64) function derivative_value_at_index_analytic_1d(field, i)
function value_at_pt_discrete_1d(field, eta)
Module to select the kind parameter.
Abstract class for 1D interpolation and reconstruction.