V3FIT
sxrem.f
Go to the documentation of this file.
1 !*******************************************************************************
4 !
5 ! Note separating the Doxygen comment block here so detailed decription is
6 ! found in the Module not the file.
7 !
11 !*******************************************************************************
12 
13  MODULE sxrem
14 
15  USE stel_kinds, only: rprec
17  USE model
18  USE signal
19 
20  IMPLICIT NONE
21 
22 !*******************************************************************************
23 ! DERIVED-TYPE DECLARATIONS
24 ! 1) sxrem base class
25 ! 2) sxrem emiss class
26 ! 3) sxrem ti class
27 ! 2) sxrem context
28 !
29 !*******************************************************************************
30 !-------------------------------------------------------------------------------
34 !-------------------------------------------------------------------------------
35  TYPE, EXTENDS(signal_class) :: sxrem_class
37  TYPE (vertex), POINTER :: chord_path => null()
39  INTEGER :: profile_number
40  CONTAINS
41  final :: sxrem_destruct
42  END TYPE
43 
44 !-------------------------------------------------------------------------------
48 !-------------------------------------------------------------------------------
49  TYPE, EXTENDS(sxrem_class) :: sxrem_emiss_class
51  REAL (rprec) :: geo
52  CONTAINS
53  PROCEDURE :: &
54  & get_modeled_signal_last => sxrem_emiss_get_modeled_signal
55  PROCEDURE :: get_type => sxrem_emiss_get_type
56  PROCEDURE :: get_gp_i => sxrem_emiss_get_gp_i
57  PROCEDURE :: get_gp_s => sxrem_emiss_get_gp_s
58  PROCEDURE :: get_gp_x => sxrem_emiss_get_gp_x
59  final :: sxrem_emiss_destruct
60  END TYPE
61 
62 !-------------------------------------------------------------------------------
66 !-------------------------------------------------------------------------------
67  TYPE, EXTENDS(sxrem_class) :: sxrem_ti_class
68  CONTAINS
69  PROCEDURE :: &
70  & get_modeled_signal_last => sxrem_ti_get_modeled_signal
71  PROCEDURE :: get_type => sxrem_ti_get_type
72  PROCEDURE :: get_gp_i => sxrem_ti_get_gp_i
73  PROCEDURE :: get_gp_s => sxrem_ti_get_gp_s
74  PROCEDURE :: get_gp_x => sxrem_ti_get_gp_x
75  END TYPE
76 
77 !-------------------------------------------------------------------------------
79 !-------------------------------------------------------------------------------
82  INTEGER :: profile_number
84  TYPE (model_class), POINTER :: model => null()
85  END TYPE
86 
87 !-------------------------------------------------------------------------------
90 !-------------------------------------------------------------------------------
93  INTEGER :: profile_number
95  TYPE (model_class), POINTER :: model => null()
97  INTEGER :: i
99  INTEGER :: flags = model_state_all_off
100  END TYPE
101 
102 !-------------------------------------------------------------------------------
105 !-------------------------------------------------------------------------------
108  INTEGER :: profile_number
110  TYPE (model_class), POINTER :: model => null()
112  class(signal_class), POINTER :: signal => null()
114  INTEGER :: flags
115  END TYPE
116 
117 !-------------------------------------------------------------------------------
120 !-------------------------------------------------------------------------------
123  INTEGER :: profile_number
125  TYPE (model_class), POINTER :: model => null()
127  REAL (rprec), DIMENSION(3) :: xcart
129  INTEGER :: flags
130  END TYPE
131 
132 !*******************************************************************************
133 ! INTERFACE BLOCKS
134 !*******************************************************************************
135 !-------------------------------------------------------------------------------
137 !-------------------------------------------------------------------------------
138  INTERFACE sxrem_emiss_class
139  MODULE PROCEDURE sxrem_emiss_construct
140  END INTERFACE
141 
142 !-------------------------------------------------------------------------------
144 !-------------------------------------------------------------------------------
145  INTERFACE sxrem_ti_class
146  MODULE PROCEDURE sxrem_ti_construct
147  END INTERFACE
148 
149  PRIVATE :: sxr_function, ti_function
153 
154  CONTAINS
155 !*******************************************************************************
156 ! CONSTRUCTION SUBROUTINES
157 !*******************************************************************************
158 !-------------------------------------------------------------------------------
168 !-------------------------------------------------------------------------------
169  FUNCTION sxrem_emiss_construct(start_path, end_path, geo, &
170  & profile_number)
171 
172  IMPLICIT NONE
173 
174 ! Declare Arguments
175  class(sxrem_emiss_class), POINTER :: sxrem_emiss_construct
176  REAL (rprec), DIMENSION(3), INTENT(in) :: start_path
177  REAL (rprec), DIMENSION(3), INTENT(in) :: end_path
178  REAL (rprec), INTENT(in) :: geo
179  INTEGER, INTENT(in) :: profile_number
180 
181 ! local variables
182  REAL (rprec) :: start_time
183 
184 ! Start of executable code
185  start_time = profiler_get_start_time()
186 
187  ALLOCATE(sxrem_emiss_construct)
188 
189  CALL path_append_vertex(sxrem_emiss_construct%chord_path, &
190  & start_path)
191  CALL path_append_vertex(sxrem_emiss_construct%chord_path, &
192  & end_path)
193 
194  sxrem_emiss_construct%geo = geo
195  sxrem_emiss_construct%profile_number = profile_number
196 
197  CALL profiler_set_stop_time('sxrem_emiss_construct', start_time)
198 
199  END FUNCTION
200 
201 !-------------------------------------------------------------------------------
210 !-------------------------------------------------------------------------------
211  FUNCTION sxrem_ti_construct(start_path, end_path, profile_number)
212 
213  IMPLICIT NONE
214 
215 ! Declare Arguments
216  class(sxrem_ti_class), POINTER :: sxrem_ti_construct
217  REAL (rprec), DIMENSION(3), INTENT(in) :: start_path
218  REAL (rprec), DIMENSION(3), INTENT(in) :: end_path
219  INTEGER, INTENT(in) :: profile_number
220 
221 ! local variables
222  REAL (rprec) :: start_time
223 
224 ! Start of executable code
225  start_time = profiler_get_start_time()
226 
227  ALLOCATE(sxrem_ti_construct)
228 
229  CALL path_append_vertex(sxrem_ti_construct%chord_path, &
230  & start_path)
231  CALL path_append_vertex(sxrem_ti_construct%chord_path, end_path)
232 
233  sxrem_ti_construct%profile_number = profile_number
234 
235  CALL profiler_set_stop_time('sxrem_ti_construct', start_time)
236 
237  END FUNCTION
238 
239 !*******************************************************************************
240 ! DESTRUCTION SUBROUTINES
241 !*******************************************************************************
242 !-------------------------------------------------------------------------------
248 !-------------------------------------------------------------------------------
249  SUBROUTINE sxrem_destruct(this)
250 
251  IMPLICIT NONE
252 
253 ! Declare Arguments
254  TYPE (sxrem_class), INTENT(inout) :: this
255 
256 ! Start of executable code
257  IF (ASSOCIATED(this%chord_path)) THEN
258  CALL path_destruct(this%chord_path)
259  this%chord_path => null()
260  END IF
261 
262  this%profile_number = 0
263 
264  END SUBROUTINE
265 
266 !-------------------------------------------------------------------------------
272 !-------------------------------------------------------------------------------
273  SUBROUTINE sxrem_emiss_destruct(this)
274 
275  IMPLICIT NONE
276 
277 ! Declare Arguments
278  TYPE (sxrem_emiss_class), INTENT(inout) :: this
279 
280 ! Start of executable code
281  this%geo = 0.0
282 
283  END SUBROUTINE
284 
285 !*******************************************************************************
286 ! GETTER SUBROUTINES
287 !*******************************************************************************
288 !-------------------------------------------------------------------------------
299 !-------------------------------------------------------------------------------
300  FUNCTION sxrem_emiss_get_modeled_signal(this, a_model, sigma, &
301  & last_value)
302 
303  IMPLICIT NONE
304 
305 ! Declare Arguments
306  REAL (rprec), DIMENSION(4) :: sxrem_emiss_get_modeled_signal
307  CLASS (sxrem_emiss_class), INTENT(inout) :: this
308  TYPE (model_class), POINTER :: a_model
309  REAL (rprec), DIMENSION(4), INTENT(out) :: sigma
310  REAL (rprec), DIMENSION(4), INTENT(in) :: last_value
311 
312 ! local variables
313  CHARACTER(len=1), ALLOCATABLE :: context(:)
314  INTEGER :: context_length
315  TYPE (sxrem_context) :: sxr_context
316  REAL (rprec) :: start_time
317 
318 ! Start of executable code
319  start_time = profiler_get_start_time()
320 
321  sigma = 0.0
322 
323  IF (btest(a_model%state_flags, model_state_vmec_flag) .or. &
324  & btest(a_model%state_flags, model_state_siesta_flag) .or. &
325  & btest(a_model%state_flags, model_state_shift_flag) .or. &
326  & btest(a_model%state_flags, model_state_sxrem_flag + &
327  & (this%profile_number - 1)) .or. &
328  & btest(a_model%state_flags, model_state_signal_flag)) THEN
329 
330 ! The relevant data for the soft x-ray context.
331  sxr_context%profile_number = this%profile_number
332  sxr_context%model => a_model
333 
334 ! Cast data to a context. This is the equivalent to casting to a void pointer
335 ! in C.
336  context_length = SIZE(transfer(sxr_context, context))
337  ALLOCATE(context(context_length))
338  context = transfer(sxr_context, context)
339 
341  & path_integrate(a_model%int_params, this%chord_path, &
342  & sxr_function, context)*this%geo
343 
344  DEALLOCATE(context)
345 
346  CALL this%scale_and_offset(a_model, &
348  ELSE
349  sxrem_emiss_get_modeled_signal = last_value
350  END IF
351 
352  CALL profiler_set_stop_time('sxrem_emiss_get_modeled_signal', &
353  & start_time)
354 
355  END FUNCTION
356 
357 !-------------------------------------------------------------------------------
368 !-------------------------------------------------------------------------------
369  FUNCTION sxrem_ti_get_modeled_signal(this, a_model, sigma, &
370  & last_value)
371 
372  IMPLICIT NONE
373 
374 ! Declare Arguments
375  REAL (rprec), DIMENSION(4) :: sxrem_ti_get_modeled_signal
376  CLASS (sxrem_ti_class), INTENT(inout) :: this
377  TYPE (model_class), POINTER :: a_model
378  REAL (rprec), DIMENSION(4), INTENT(out) :: sigma
379  REAL (rprec), DIMENSION(4), INTENT(in) :: last_value
380 
381 ! local variables
382  CHARACTER(len=1), ALLOCATABLE :: context(:)
383  INTEGER :: context_length
384  TYPE (sxrem_context) :: sxr_context
385  REAL (rprec) :: start_time
386 
387 ! Start of executable code
388  start_time = profiler_get_start_time()
389 
390  sigma = 0.0
391 
392  IF (btest(a_model%state_flags, model_state_vmec_flag) .or. &
393  & btest(a_model%state_flags, model_state_siesta_flag) .or. &
394  & btest(a_model%state_flags, model_state_shift_flag) .or. &
395  & btest(a_model%state_flags, model_state_ti_flag) .or. &
396  & btest(a_model%state_flags, model_state_sxrem_flag + &
397  & (this%profile_number - 1)) .or. &
398  & btest(a_model%state_flags, model_state_signal_flag)) THEN
399 
400 ! The relevant data for the soft x-ray context.
401  sxr_context%profile_number = this%profile_number
402  sxr_context%model => a_model
403 
404 ! Cast model into a data to a context. This is the equivalent to casting to a
405 ! void pointer in C.
406  context_length = SIZE(transfer(sxr_context, context))
407  ALLOCATE(context(context_length))
408  context = transfer(sxr_context, context)
409 
411  & path_integrate(a_model%int_params, this%chord_path, &
412  & ti_function, context)
413 
414  DEALLOCATE(context)
415 
416  CALL this%scale_and_offset(a_model, &
418  ELSE
419  sxrem_ti_get_modeled_signal = last_value
420  END IF
421 
422  CALL profiler_set_stop_time('sxrem_ti_get_modeled_signal', &
423  & start_time)
424 
425  END FUNCTION
426 
427 !-------------------------------------------------------------------------------
434 !-------------------------------------------------------------------------------
435  FUNCTION sxrem_emiss_get_type(this)
437 
438  IMPLICIT NONE
439 
440 ! Declare Arguments
441  CHARACTER (len=data_name_length) :: sxrem_emiss_get_type
442  CLASS (sxrem_emiss_class), INTENT(in) :: this
443 
444 ! local variables
445  REAL (rprec) :: start_time
446 
447 ! Start of executable code
448  start_time = profiler_get_start_time()
449 
450  WRITE (sxrem_emiss_get_type, 1000) this%profile_number
451 
452  CALL profiler_set_stop_time('sxrem_emiss_get_type', start_time)
453 
454 1000 FORMAT('sxrch(',i2,')')
455 
456  END FUNCTION
457 
458 !-------------------------------------------------------------------------------
465 !-------------------------------------------------------------------------------
466  FUNCTION sxrem_ti_get_type(this)
468 
469  IMPLICIT NONE
470 
471 ! Declare Arguments
472  CHARACTER (len=data_name_length) :: sxrem_ti_get_type
473  CLASS (sxrem_ti_class), INTENT(in) :: this
474 
475 ! local variables
476  REAL (rprec) :: start_time
477 
478 ! Start of executable code
479  start_time = profiler_get_start_time()
480 
481  WRITE (sxrem_ti_get_type, 1000) this%profile_number
482 
483  CALL profiler_set_stop_time('sxrem_ti_get_type', start_time)
484 
485 1000 FORMAT('sxrch_ti(',i2,')')
486 
487  END FUNCTION
488 
489 !-------------------------------------------------------------------------------
501 !-------------------------------------------------------------------------------
502  FUNCTION sxrem_emiss_get_gp_i(this, a_model, i, flags)
503 
504  IMPLICIT NONE
505 
506 ! Declare Arguments
507  REAL (rprec) :: sxrem_emiss_get_gp_i
508  CLASS (sxrem_emiss_class), INTENT(in) :: this
509  TYPE (model_class), POINTER :: a_model
510  INTEGER, INTENT(in) :: i
511  INTEGER, INTENT(in) :: flags
512 
513 ! local variables
514  REAL (rprec) :: start_time
515  CHARACTER(len=1), ALLOCATABLE :: context(:)
516  INTEGER :: context_length
517  TYPE (sxrem_gp_context_i) :: gp_context
518 
519 ! Start of executable code
520  start_time = profiler_get_start_time()
521 
522  gp_context%profile_number = this%profile_number
523  gp_context%model => a_model
524  gp_context%i = i
525  gp_context%flags = flags
526 
527 ! Cast data to a context. This is the equivalent to casting to a void pointer
528 ! in C.
529  context_length = SIZE(transfer(gp_context, context))
530  ALLOCATE(context(context_length))
531  context = transfer(gp_context, context)
532 
533  sxrem_emiss_get_gp_i = path_integrate(a_model%int_params, &
534  & this%chord_path, &
536  & context)*this%geo
537 
538  DEALLOCATE(context)
539 
540  CALL this%scale_and_offset(a_model, sxrem_emiss_get_gp_i)
541 
542  CALL profiler_set_stop_time('sxrem_emiss_get_gp_i', start_time)
543 
544  END FUNCTION
545 
546 !-------------------------------------------------------------------------------
558 !-------------------------------------------------------------------------------
559  FUNCTION sxrem_ti_get_gp_i(this, a_model, i, flags)
560 
561  IMPLICIT NONE
562 
563 ! Declare Arguments
564  REAL (rprec) :: sxrem_ti_get_gp_i
565  CLASS (sxrem_ti_class), INTENT(in) :: this
566  TYPE (model_class), POINTER :: a_model
567  INTEGER, INTENT(in) :: i
568  INTEGER, INTENT(in) :: flags
569 
570 ! local variables
571  REAL (rprec) :: start_time
572  CHARACTER(len=1), ALLOCATABLE :: context(:)
573  INTEGER :: context_length
574  TYPE (sxrem_gp_context_i) :: gp_context
575 
576 ! Start of executable code
577  start_time = profiler_get_start_time()
578 
579  gp_context%profile_number = this%profile_number
580  gp_context%model => a_model
581  gp_context%i = i
582  gp_context%flags = flags
583 
584 ! Cast data to a context. This is the equivalent to casting to a void pointer
585 ! in C.
586  context_length = SIZE(transfer(gp_context, context))
587  ALLOCATE(context(context_length))
588  context = transfer(gp_context, context)
589 
590  sxrem_ti_get_gp_i = path_integrate(a_model%int_params, &
591  & this%chord_path, &
592  & gp_ti_function_i, context)
593 
594  DEALLOCATE(context)
595 
596  CALL this%scale_and_offset(a_model, sxrem_ti_get_gp_i)
597 
598  CALL profiler_set_stop_time('sxrem_ti_get_gp_i', start_time)
599 
600  END FUNCTION
601 
602 !-------------------------------------------------------------------------------
614 !-------------------------------------------------------------------------------
615  FUNCTION sxrem_emiss_get_gp_s(this, a_model, signal, flags)
616 
617  IMPLICIT NONE
618 
619 ! Declare Arguments
620  REAL (rprec) :: sxrem_emiss_get_gp_s
621  CLASS (sxrem_emiss_class), INTENT(in) :: this
622  TYPE (model_class), POINTER :: a_model
623  class(signal_class), POINTER :: signal
624  INTEGER, INTENT(in) :: flags
625 
626 ! local variables
627  REAL (rprec) :: start_time
628  CHARACTER(len=1), ALLOCATABLE :: context(:)
629  INTEGER :: context_length
630  TYPE (sxrem_gp_context_s) :: gp_context
631 
632 ! Start of executable code
633  start_time = profiler_get_start_time()
634 
635  gp_context%profile_number = this%profile_number
636  gp_context%model => a_model
637  gp_context%signal => signal
638  gp_context%flags = flags
639 
640 ! Cast data to a context. This is the equivalent to casting to a void pointer
641 ! in C.
642  context_length = SIZE(transfer(gp_context, context))
643  ALLOCATE(context(context_length))
644  context = transfer(gp_context, context)
645 
646  sxrem_emiss_get_gp_s = path_integrate(a_model%int_params, &
647  & this%chord_path, &
649  & context)*this%geo
650 
651  DEALLOCATE(context)
652 
653  CALL this%scale_and_offset(a_model, sxrem_emiss_get_gp_s)
654 
655  CALL profiler_set_stop_time('sxrem_emiss_get_gp_s', start_time)
656 
657  END FUNCTION
658 
659 !-------------------------------------------------------------------------------
670 !-------------------------------------------------------------------------------
671  FUNCTION sxrem_ti_get_gp_s(this, a_model, signal, flags)
672 
673  IMPLICIT NONE
674 
675 ! Declare Arguments
676  REAL (rprec) :: sxrem_ti_get_gp_s
677  CLASS (sxrem_ti_class), INTENT(in) :: this
678  TYPE (model_class), POINTER :: a_model
679  class(signal_class), POINTER :: signal
680  INTEGER, INTENT(in) :: flags
681 
682 ! local variables
683  REAL (rprec) :: start_time
684  CHARACTER(len=1), ALLOCATABLE :: context(:)
685  INTEGER :: context_length
686  TYPE (sxrem_gp_context_s) :: gp_context
687 
688 ! Start of executable code
689  start_time = profiler_get_start_time()
690 
691  gp_context%profile_number = this%profile_number
692  gp_context%model => a_model
693  gp_context%signal => signal
694  gp_context%flags = flags
695 
696 ! Cast data to a context. This is the equivalent to casting to a void pointer
697 ! in C.
698  context_length = SIZE(transfer(gp_context, context))
699  ALLOCATE(context(context_length))
700  context = transfer(gp_context, context)
701 
702  sxrem_ti_get_gp_s = path_integrate(a_model%int_params, &
703  & this%chord_path, &
704  & gp_ti_function_s, context)
705 
706  DEALLOCATE(context)
707 
708  CALL this%scale_and_offset(a_model, sxrem_ti_get_gp_s)
709 
710  CALL profiler_set_stop_time('sxrem_ti_get_gp_s', start_time)
711 
712  END FUNCTION
713 
714 !-------------------------------------------------------------------------------
726 !-------------------------------------------------------------------------------
727  FUNCTION sxrem_emiss_get_gp_x(this, a_model, x_cart, flags)
728 
729  IMPLICIT NONE
730 
731 ! Declare Arguments
732  REAL (rprec) :: sxrem_emiss_get_gp_x
733  CLASS (sxrem_emiss_class), INTENT(in) :: this
734  TYPE (model_class), POINTER :: a_model
735  REAL (rprec), DIMENSION(3), INTENT(in) :: x_cart
736  INTEGER, INTENT(in) :: flags
737 
738 ! local variables
739  REAL (rprec) :: start_time
740  CHARACTER (len=1), ALLOCATABLE :: context(:)
741  INTEGER :: context_length
742  TYPE (sxrem_gp_context_x) :: gp_context
743 
744 ! Start of executable code
745  start_time = profiler_get_start_time()
746 
747  gp_context%profile_number = this%profile_number
748  gp_context%model => a_model
749  gp_context%xcart = x_cart
750 
751 ! Cast data to a context. This is the equivalent to casting to a void pointer
752 ! in C.
753  context_length = SIZE(transfer(gp_context, context))
754  ALLOCATE(context(context_length))
755  context = transfer(gp_context, context)
756 
757  sxrem_emiss_get_gp_x = path_integrate(a_model%int_params, &
758  & this%chord_path, &
760  & context)*this%geo
761 
762  CALL this%scale_and_offset(a_model, sxrem_emiss_get_gp_x)
763 
764  CALL profiler_set_stop_time('sxrem_emiss_get_gp_x', start_time)
765 
766  END FUNCTION
767 
768 !-------------------------------------------------------------------------------
780 !-------------------------------------------------------------------------------
781  FUNCTION sxrem_ti_get_gp_x(this, a_model, x_cart, flags)
782 
783  IMPLICIT NONE
784 
785 ! Declare Arguments
786  REAL (rprec) :: sxrem_ti_get_gp_x
787  CLASS (sxrem_ti_class), INTENT(in) :: this
788  TYPE (model_class), POINTER :: a_model
789  REAL (rprec), DIMENSION(3), INTENT(in) :: x_cart
790  INTEGER, INTENT(in) :: flags
791 
792 ! local variables
793  REAL (rprec) :: start_time
794  CHARACTER (len=1), ALLOCATABLE :: context(:)
795  INTEGER :: context_length
796  TYPE (sxrem_gp_context_x) :: gp_context
797 
798 ! Start of executable code
799  start_time = profiler_get_start_time()
800 
801  gp_context%profile_number = this%profile_number
802  gp_context%model => a_model
803  gp_context%xcart = x_cart
804  gp_context%flags = flags
805 
806 ! Cast data to a context. This is the equivalent to casting to a void pointer
807 ! in C.
808  context_length = SIZE(transfer(gp_context, context))
809  ALLOCATE(context(context_length))
810  context = transfer(gp_context, context)
811 
812  sxrem_ti_get_gp_x = path_integrate(a_model%int_params, &
813  & this%chord_path, &
814  & gp_ti_function_x, context)
815 
816  CALL this%scale_and_offset(a_model, sxrem_ti_get_gp_x)
817 
818  CALL profiler_set_stop_time('sxrem_ti_get_gp_x', start_time)
819 
820  END FUNCTION
821 
822 !*******************************************************************************
823 ! PRIVATE
824 !*******************************************************************************
825 !-------------------------------------------------------------------------------
841 !-------------------------------------------------------------------------------
842  FUNCTION sxr_function(context, xcart, dxcart, length, dx)
843 
844  IMPLICIT NONE
845 
846 ! Declare Arguments
847  REAL (rprec) :: sxr_function
848  CHARACTER (len=1), INTENT(in) :: context(:)
849  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
850  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
851  REAL (rprec), INTENT(in) :: length
852  REAL (rprec), INTENT(in) :: dx
853 
854 ! local variables
855  TYPE (sxrem_context) :: sxr_context
856  REAL (rprec) :: start_time
857 
858 ! Start of executable code
859  start_time = profiler_get_start_time()
860 
861  sxr_context = transfer(context, sxr_context)
862  sxr_function = model_get_sxrem(sxr_context%model, xcart, &
863  & sxr_context%profile_number)*dx
864 
865  CALL profiler_set_stop_time('sxr_function', start_time)
866 
867  END FUNCTION
868 
869 !-------------------------------------------------------------------------------
886 !-------------------------------------------------------------------------------
887  FUNCTION ti_function(context, xcart, dxcart, length, dx)
888 
889  IMPLICIT NONE
890 
891 ! Declare Arguments
892  REAL (rprec) :: ti_function
893  CHARACTER (len=1), INTENT(in) :: context(:)
894  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
895  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
896  REAL (rprec), INTENT(in) :: length
897  REAL (rprec), INTENT(in) :: dx
898 
899 ! local variables
900  TYPE (sxrem_context) :: sxr_context
901  REAL (rprec) :: start_time
902 
903 ! Start of executable code
904  start_time = profiler_get_start_time()
905 
906  sxr_context = transfer(context, sxr_context)
907  ti_function = model_get_sxrem(sxr_context%model, xcart, &
908  & sxr_context%profile_number) &
909  & * model_get_ti(sxr_context%model, xcart)*dx
910 
911  CALL profiler_set_stop_time('ti_function', start_time)
912 
913  END FUNCTION
914 
915 !-------------------------------------------------------------------------------
932 !-------------------------------------------------------------------------------
933  FUNCTION gp_emiss_function_i(context, xcart, dxcart, length, dx)
934 
935  IMPLICIT NONE
936 
937 ! Declare Arguments
938  REAL (rprec) :: gp_emiss_function_i
939  CHARACTER (len=1), INTENT(in) :: context(:)
940  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
941  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
942  REAL (rprec), INTENT(in) :: length
943  REAL (rprec), INTENT(in) :: dx
944 
945 ! local variables
946  TYPE (sxrem_gp_context_i) :: gp_context
947  REAL (rprec) :: start_time
948 
949 ! Start of executable code
950  start_time = profiler_get_start_time()
951 
952  gp_context = transfer(context, gp_context)
954  & model_get_gp_sxrem(gp_context%model, xcart, gp_context%i, &
955  & gp_context%profile_number)*dx
956 
957  CALL profiler_set_stop_time('gp_emiss_function_i', start_time)
958 
959  END FUNCTION
960 
961 !-------------------------------------------------------------------------------
980 !-------------------------------------------------------------------------------
981  FUNCTION gp_ti_function_i(context, xcart, dxcart, length, dx)
982 
983  IMPLICIT NONE
984 
985 ! Declare Arguments
986  REAL (rprec) :: gp_ti_function_i
987  CHARACTER (len=1), INTENT(in) :: context(:)
988  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
989  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
990  REAL (rprec), INTENT(in) :: length
991  REAL (rprec), INTENT(in) :: dx
992 
993 ! local variables
994  TYPE (sxrem_gp_context_i) :: gp_context
995  REAL (rprec) :: start_time
996 
997 ! Start of executable code
998  start_time = profiler_get_start_time()
999 
1000  gp_context = transfer(context, gp_context)
1001  IF (btest(gp_context%flags, model_state_sxrem_flag + &
1002  & (gp_context%profile_number - 1))) THEN
1003  gp_ti_function_i = &
1004  & model_get_gp_sxrem(gp_context%model, xcart, gp_context%i, &
1005  & gp_context%profile_number) * &
1006  & model_get_ti(gp_context%model, xcart)
1007  ELSE IF (btest(gp_context%flags, model_state_ti_flag)) THEN
1008  gp_ti_function_i = model_get_gp_ti(gp_context%model, xcart, &
1009  & gp_context%i) &
1010  & * model_get_sxrem(gp_context%model, xcart, &
1011  & gp_context%profile_number)
1012  ELSE
1013  gp_ti_function_i = 0.0
1014  END IF
1015 
1017 
1018  CALL profiler_set_stop_time('gp_ti_function_i', start_time)
1019 
1020  END FUNCTION
1021 
1022 !-------------------------------------------------------------------------------
1038 !-------------------------------------------------------------------------------
1039  FUNCTION gp_emiss_function_s(context, xcart, dxcart, length, dx)
1041  IMPLICIT NONE
1042 
1043 ! Declare Arguments
1044  REAL (rprec) :: gp_emiss_function_s
1045  CHARACTER (len=1), INTENT(in) :: context(:)
1046  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
1047  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
1048  REAL (rprec), INTENT(in) :: length
1049  REAL (rprec), INTENT(in) :: dx
1050 
1051 ! local variables
1052  TYPE (sxrem_gp_context_s) :: gp_context
1053  REAL (rprec) :: start_time
1054 
1055 ! Start of executable code
1056  start_time = profiler_get_start_time()
1057 
1058  gp_context = transfer(context, gp_context)
1059 
1060  gp_emiss_function_s = gp_context%signal%get_gp(gp_context%model, &
1061  & xcart, &
1062  & gp_context%flags) &
1063  & * dx
1064 
1065  CALL profiler_set_stop_time('gp_function_s', start_time)
1066 
1067  END FUNCTION
1068 
1069 !-------------------------------------------------------------------------------
1084 !-------------------------------------------------------------------------------
1085  FUNCTION gp_ti_function_s(context, xcart, dxcart, length, dx)
1087  IMPLICIT NONE
1088 
1089 ! Declare Arguments
1090  REAL (rprec) :: gp_ti_function_s
1091  CHARACTER (len=1), INTENT(in) :: context(:)
1092  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
1093  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
1094  REAL (rprec), INTENT(in) :: length
1095  REAL (rprec), INTENT(in) :: dx
1096 
1097 ! local variables
1098  TYPE (sxrem_gp_context_s) :: gp_context
1099  REAL (rprec) :: start_time
1100 
1101 ! Start of executable code
1102  start_time = profiler_get_start_time()
1103 
1104  gp_context = transfer(context, gp_context)
1105 
1106  IF (btest(gp_context%flags, model_state_sxrem_flag + &
1107  & (gp_context%profile_number - 1))) THEN
1108  gp_ti_function_s = gp_context%signal%get_gp(gp_context%model, &
1109  & xcart, &
1110  & gp_context%flags) &
1111  & * model_get_ti(gp_context%model, xcart)
1112  ELSE IF (btest(gp_context%flags, model_state_ti_flag)) THEN
1113  gp_ti_function_s = gp_context%signal%get_gp(gp_context%model, &
1114  & xcart, &
1115  & gp_context%flags) &
1116  & * model_get_sxrem(gp_context%model, xcart, &
1117  & gp_context%profile_number)
1118  ELSE
1119  gp_ti_function_s = 0.0
1120  END IF
1121 
1123 
1124  CALL profiler_set_stop_time('gp_function_s', start_time)
1125 
1126  END FUNCTION
1127 
1128 !-------------------------------------------------------------------------------
1143 !-------------------------------------------------------------------------------
1144  FUNCTION gp_emiss_function_x(context, xcart, dxcart, length, dx)
1146  IMPLICIT NONE
1147 
1148 ! Declare Arguments
1149  REAL (rprec) :: gp_emiss_function_x
1150  CHARACTER (len=1), INTENT(in) :: context(:)
1151  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
1152  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
1153  REAL (rprec), INTENT(in) :: length
1154  REAL (rprec), INTENT(in) :: dx
1155 
1156 ! local variables
1157  TYPE (sxrem_gp_context_x) :: gp_context
1158  REAL (rprec) :: start_time
1159 
1160 ! Start of executable code
1161  start_time = profiler_get_start_time()
1162 
1163 ! This is the second signal so put xcart in the second position.
1164  gp_context = transfer(context, gp_context)
1166  & model_get_gp_sxrem(gp_context%model, xcart, gp_context%xcart, &
1167  & gp_context%profile_number)*dx
1168 
1169  CALL profiler_set_stop_time('gp_emiss_function_x', start_time)
1170 
1171  END FUNCTION
1172 
1173 !-------------------------------------------------------------------------------
1189 !-------------------------------------------------------------------------------
1190  FUNCTION gp_ti_function_x(context, xcart, dxcart, length, dx)
1192  IMPLICIT NONE
1193 
1194 ! Declare Arguments
1195  REAL (rprec) :: gp_ti_function_x
1196  CHARACTER (len=1), INTENT(in) :: context(:)
1197  REAL (rprec), DIMENSION(3), INTENT(in) :: xcart
1198  REAL (rprec), DIMENSION(3), INTENT(in) :: dxcart
1199  REAL (rprec), INTENT(in) :: length
1200  REAL (rprec), INTENT(in) :: dx
1201 
1202 ! local variables
1203  TYPE (sxrem_gp_context_x) :: gp_context
1204  REAL (rprec) :: start_time
1205 
1206 ! Start of executable code
1207  start_time = profiler_get_start_time()
1208 
1209 ! This is the second signal so put xcart in the second position.
1210  gp_context = transfer(context, gp_context)
1211  IF (btest(gp_context%flags, model_state_sxrem_flag + &
1212  & (gp_context%profile_number - 1))) THEN
1213  gp_ti_function_x = &
1214  & model_get_gp_sxrem(gp_context%model, xcart, &
1215  & gp_context%xcart, &
1216  & gp_context%profile_number) * &
1217  & model_get_ti(gp_context%model, xcart)
1218  ELSE IF (btest(gp_context%flags, model_state_ti_flag)) THEN
1219  gp_ti_function_x = model_get_gp_ti(gp_context%model, xcart, &
1220  & gp_context%xcart) &
1221  & * model_get_sxrem(gp_context%model, xcart, &
1222  & gp_context%profile_number)
1223  ELSE
1224  gp_ti_function_x = 0.0
1225  END IF
1226 
1228 
1229  CALL profiler_set_stop_time('gp_ti_function_x', start_time)
1230 
1231  END FUNCTION
1232 
1233  END MODULE
sxrem::sxrem_ti_get_modeled_signal
real(rprec) function, dimension(4) sxrem_ti_get_modeled_signal(this, a_model, sigma, last_value)
Calculates the modeled ion temperature signal.
Definition: sxrem.f:371
sxrem::sxrem_context
Structure to hold all memory needed to be sent to the callback function.
Definition: sxrem.f:80
sxrem::sxrem_destruct
subroutine sxrem_destruct(this)
Deconstruct a sxrem_class object.
Definition: sxrem.f:250
sxrem::sxrem_ti_get_gp_s
real(rprec) function sxrem_ti_get_gp_s(this, a_model, signal, flags)
Gets the guassian process kernel for a sxrem ti signal and a signal.
Definition: sxrem.f:672
sxrem::gp_ti_function_i
real(rprec) function, private gp_ti_function_i(context, xcart, dxcart, length, dx)
XICS gaussian process callback function for signal point kernel evaluation.
Definition: sxrem.f:982
sxrem::gp_emiss_function_s
real(rprec) function, private gp_emiss_function_s(context, xcart, dxcart, length, dx)
Soft x-ray gaussian process callback function for emiss signal signal kernel evaluation.
Definition: sxrem.f:1040
sxrem::gp_ti_function_s
real(rprec) function, private gp_ti_function_s(context, xcart, dxcart, length, dx)
Soft x-ray gaussian process callback function for ti signal signal kernel evaluation.
Definition: sxrem.f:1086
model
Defines the base class of the type model_class. The model contains information not specific to the eq...
Definition: model.f:59
sxrem::sxrem_ti_class
Base class representing a soft x-ray ti signal.
Definition: sxrem.f:67
sxrem::gp_emiss_function_x
real(rprec) function, private gp_emiss_function_x(context, xcart, dxcart, length, dx)
Soft x-ray gaussian process callback function for kernel evaluation for an emiss position and positio...
Definition: sxrem.f:1145
model::model_get_sxrem
Interface for the model soft x-ray emissivity profile values.
Definition: model.f:283
sxrem::ti_function
real(rprec) function, private ti_function(context, xcart, dxcart, length, dx)
Ion temperature callback function.
Definition: sxrem.f:888
vertex
A vertex.
Definition: vertex.hpp:21
sxrem::gp_ti_function_x
real(rprec) function, private gp_ti_function_x(context, xcart, dxcart, length, dx)
Soft x-ray gaussian process callback function for kernel evaluation for an ti position and a position...
Definition: sxrem.f:1191
sxrem::gp_emiss_function_i
real(rprec) function, private gp_emiss_function_i(context, xcart, dxcart, length, dx)
Soft x-ray emission gaussian process callback function for signal point kernel evaluation.
Definition: sxrem.f:934
model::model_get_ti
Interface for the model ion temperature profile values.
Definition: model.f:258
sxrem::sxrem_gp_context_i
Structure to hold all memory needed to be sent to the guassian process callback function for point.
Definition: sxrem.f:91
integration_path
Module is part of the LIBSTELL. This modules contains code to define and integrate along an arbitray ...
Definition: integration_path.f:12
sxrem::sxrem_emiss_destruct
subroutine sxrem_emiss_destruct(this)
Deconstruct a sxrem_emiss_class object.
Definition: sxrem.f:274
model::model_class
Base class representing a model.
Definition: model.f:141
sxrem
Defines the base class of the type sxrem_class.
Definition: sxrem.f:13
model::model_get_gp_ti
Interface for the model guassian process ion temperature profile values.
Definition: model.f:266
integration_path::path_integrate
recursive real(rprec) function path_integrate(this, path, integration_function, context)
Integrate along the path.
Definition: integration_path.f:293
sxrem::sxrem_gp_context_s
Structure to hold all memory needed to be sent to the guassian process callback function for signal.
Definition: sxrem.f:106
integration_path::path_append_vertex
recursive subroutine path_append_vertex(this, position)
Append a vertex to a path.
Definition: integration_path.f:253
sxrem::sxrem_emiss_get_gp_x
real(rprec) function sxrem_emiss_get_gp_x(this, a_model, x_cart, flags)
Gets the guassian process kernel for a sxrem emiss signal and a cartesian position.
Definition: sxrem.f:728
sxrem::sxrem_emiss_get_type
character(len=data_name_length) function sxrem_emiss_get_type(this)
Gets a discription of the sxrem emiss type.
Definition: sxrem.f:436
sxrem::sxrem_gp_context_x
Structure to hold all memory needed to be sent to the guassian process callback function for signal.
Definition: sxrem.f:121
sxrem::sxrem_emiss_get_gp_i
real(rprec) function sxrem_emiss_get_gp_i(this, a_model, i, flags)
Gets the guassian process kernel for a sxrem emiss signal and a position.
Definition: sxrem.f:503
sxrem::sxrem_ti_get_type
character(len=data_name_length) function sxrem_ti_get_type(this)
Gets a discription of the sxrem emiss type.
Definition: sxrem.f:467
model::model_get_gp_sxrem
Interface for the mdoel guassian process soft x-ray emissivity profile values.
Definition: model.f:292
data_parameters
This modules contains parameters used by equilibrium models.
Definition: data_parameters.f:10
sxrem::sxrem_ti_get_gp_i
real(rprec) function sxrem_ti_get_gp_i(this, a_model, i, flags)
Gets the guassian process kernel for a sxrem ti signal and a position.
Definition: sxrem.f:560
sxrem::sxr_function
real(rprec) function, private sxr_function(context, xcart, dxcart, length, dx)
Soft x-ray callback function.
Definition: sxrem.f:843
sxrem::sxrem_emiss_construct
class(sxrem_emiss_class) function, pointer sxrem_emiss_construct(start_path, end_path, geo, profile_number)
Construct a sxrem_class object for emission.
Definition: sxrem.f:171
sxrem::sxrem_emiss_get_gp_s
real(rprec) function sxrem_emiss_get_gp_s(this, a_model, signal, flags)
Gets the guassian process kernel for a sxrem emiss signal and a signal.
Definition: sxrem.f:616
sxrem::sxrem_emiss_get_modeled_signal
real(rprec) function, dimension(4) sxrem_emiss_get_modeled_signal(this, a_model, sigma, last_value)
Calculates the modeled emiss signal.
Definition: sxrem.f:302
sxrem::sxrem_ti_get_gp_x
real(rprec) function sxrem_ti_get_gp_x(this, a_model, x_cart, flags)
Gets the guassian process kernel for a sxrem ti signal and a cartesian position.
Definition: sxrem.f:782
sxrem::sxrem_class
Base class representing a soft x-ray signal.
Definition: sxrem.f:35
signal::signal_class
Base class representing a signal.
Definition: signal.f:33
integration_path::path_destruct
Destruct interface using either path_destruct_int or path_destruct_vertex.
Definition: integration_path.f:84
signal
Defines the base class of the type signal_class.
Definition: signal.f:14
sxrem::sxrem_emiss_class
Base class representing a soft x-ray emissivity signal.
Definition: sxrem.f:49
sxrem::sxrem_ti_construct
class(sxrem_ti_class) function, pointer sxrem_ti_construct(start_path, end_path, profile_number)
Construct a sxrem_class object for ti.
Definition: sxrem.f:212