100 INTEGER(INTG) :: number_of_coordinate_systems
107 & (/
"Rectangular Cartesian",&
108 &
"Cylindrical Polar ", &
109 &
"Spherical Polar ", &
110 &
"Prolate Spheroidal ", &
111 &
"Oblate Spheroidal " /)
209 REAL(DP),
INTENT(IN) :: Z(:)
210 INTEGER(INTG),
INTENT(OUT) :: ERR
213 REAL(DP) :: COORDINATE_CONVERT_FROM_RC_DP(size(z,1))
215 REAL(DP) :: A1,A2,A3,A4,A5,A6,A7,A8,A9,FOCUS
217 enters(
"COORDINATE_CONVERT_FROM_RC_DP",err,error,*999)
219 coordinate_convert_from_rc_dp=0.0_dp
221 IF(
SIZE(z,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
222 &
CALL flagerror(
"Size of Z is less than the number of dimensions.",err,error,*999)
224 SELECT CASE(coordinate_system%TYPE)
226 coordinate_convert_from_rc_dp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=z(1:coordinate_system%NUMBER_OF_DIMENSIONS)
228 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
230 coordinate_convert_from_rc_dp(1)=sqrt(z(1)**2+z(2)**2)
231 coordinate_convert_from_rc_dp(2)=atan2(z(1),z(2))
233 coordinate_convert_from_rc_dp(1)=sqrt(z(1)**2+z(2)**2)
234 coordinate_convert_from_rc_dp(2)=atan2(z(1),z(2))
235 coordinate_convert_from_rc_dp(3)=z(3)
237 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
239 IF(coordinate_convert_from_rc_dp(2)<0.0_dp) &
240 & coordinate_convert_from_rc_dp(2)=coordinate_convert_from_rc_dp(2)+2.0_dp*
pi 242 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 243 coordinate_convert_from_rc_dp(1)=sqrt(z(1)**2+z(2)**2+z(3)**2)
245 coordinate_convert_from_rc_dp(2)=atan2(z(2),z(1))
247 coordinate_convert_from_rc_dp(2)=0.0_dp
249 a1=sqrt(z(1)**2+z(2)**2)
251 coordinate_convert_from_rc_dp(3)=atan2(z(3),a1)
253 coordinate_convert_from_rc_dp(3)=0.0_dp
256 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
259 focus=coordinate_system%FOCUS
260 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 261 a1=z(1)**2+z(2)**2+z(3)**2-focus**2
262 a2=sqrt(a1**2+4.0_dp*(focus**2)*(z(2)**2+z(3)**2))
264 a4=max((a2+a1)/a3,0.0_dp)
265 a5=max((a2-a1)/a3,0.0_dp)
267 a7=min(sqrt(a5),1.0_dp)
268 IF(abs(a7)<=1.0_dp)
THEN 272 CALL flag_warning(
"Put A8=0 since ABS(A8)>1.",err,error,*999)
277 IF(abs(a6*a7)>0.0_dp)
THEN 278 a9=z(3)/(focus*a6*a7)
281 CALL flag_warning(
"Put A9=0 since A6*A7=0.",err,error,*999)
285 ELSE IF(a9<=-1.0_dp)
THEN 291 coordinate_convert_from_rc_dp(1)=log(a6+sqrt(a4+1.0_dp))
293 coordinate_convert_from_rc_dp(2)=a8
295 coordinate_convert_from_rc_dp(2)=
pi-a8
298 coordinate_convert_from_rc_dp(3)=mod(a9+2.0_dp*
pi,2.0_dp*
pi)
300 coordinate_convert_from_rc_dp(3)=
pi-a9
303 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
306 CALL flagerror(
"Not implemented.",err,error,*999)
308 CALL flagerror(
"Invalid coordinate type.",err,error,*999)
311 exits(
"COORDINATE_CONVERT_FROM_RC_DP")
313 999 errorsexits(
"COORDINATE_CONVERT_FROM_RC_DP",err,error)
328 REAL(SP),
INTENT(IN) :: Z(:)
329 INTEGER(INTG),
INTENT(OUT) :: ERR
332 REAL(SP) :: COORDINATE_CONVERT_FROM_RC_SP(size(z,1))
334 REAL(SP) :: A1,A2,A3,A4,A5,A6,A7,A8,A9,FOCUS
336 enters(
"COORDINATE_CONVERT_FROM_RC_SP",err,error,*999)
338 coordinate_convert_from_rc_sp=0.0_sp
340 IF(
SIZE(z,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
341 &
CALL flagerror(
"Size of Z is less than the number of dimensions.",err,error,*999)
343 SELECT CASE(coordinate_system%TYPE)
345 coordinate_convert_from_rc_sp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=z(1:coordinate_system%NUMBER_OF_DIMENSIONS)
347 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
349 coordinate_convert_from_rc_sp(1)=sqrt(z(1)**2+z(2)**2)
350 coordinate_convert_from_rc_sp(2)=atan2(z(1),z(2))
352 coordinate_convert_from_rc_sp(1)=sqrt(z(1)**2+z(2)**2)
353 coordinate_convert_from_rc_sp(2)=atan2(z(1),z(2))
354 coordinate_convert_from_rc_sp(3)=z(3)
356 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
358 IF(coordinate_convert_from_rc_sp(2)<0.0_sp) &
359 & coordinate_convert_from_rc_sp(2)=coordinate_convert_from_rc_sp(2)+2.0_sp*
REAL(PI,SP) 361 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 362 coordinate_convert_from_rc_sp(1)=sqrt(z(1)**2+z(2)**2+z(3)**2)
364 coordinate_convert_from_rc_sp(2)=atan2(z(2),z(1))
366 coordinate_convert_from_rc_sp(2)=0.0_sp
368 a1=sqrt(z(1)**2+z(2)**2)
370 coordinate_convert_from_rc_sp(3)=atan2(z(3),a1)
372 coordinate_convert_from_rc_sp(3)=0.0_sp
375 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
378 focus=
REAL(coordinate_system%focus,
sp)
379 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 380 a1=z(1)**2+z(2)**2+z(3)**2-focus**2
381 a2=sqrt(a1**2+4.0_sp*(focus**2)*(z(2)**2+z(3)**2))
383 a4=max((a2+a1)/a3,0.0_sp)
384 a5=max((a2-a1)/a3,0.0_sp)
386 a7=min(sqrt(a5),1.0_sp)
387 IF(abs(a7)<=1.0_sp)
THEN 391 CALL flag_warning(
"Put A8=0 since ABS(A8)>1.",err,error,*999)
397 a9=z(3)/(focus*a6*a7)
400 CALL flag_warning(
"Put A9=0 since A6*A7=0.",err,error,*999)
403 a9=
REAL(
pi,
sp)/2.0_SP
404 ELSE IF(a9<=-1.0_sp)
THEN 405 a9=-
REAL(
pi,
sp)/2.0_SP
410 coordinate_convert_from_rc_sp(1)=log(a6+sqrt(a4+1.0_sp))
412 coordinate_convert_from_rc_sp(2)=a8
414 coordinate_convert_from_rc_sp(2)=
REAL(
pi,
sp)-A8
417 coordinate_convert_from_rc_sp(3)=mod(a9+2.0_sp*
REAL(PI,SP),2.0_SP*&
420 coordinate_convert_from_rc_sp(3)=
REAL(
pi,
sp)-A9
423 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
426 CALL flagerror(
"Not implemented.",err,error,*999)
428 CALL flagerror(
"Invalid coordinate type.",err,error,*999)
431 exits(
"COORDINATE_CONVERT_FROM_RC_SP")
433 999 errorsexits(
"COORDINATE_CONVERT_FROM_RC_SP",err,error)
448 REAL(DP),
INTENT(IN) :: X(:)
449 INTEGER(INTG),
INTENT(OUT) :: ERR
452 REAL(DP) :: COORDINATE_CONVERT_TO_RC_DP(size(x,1))
456 enters(
"COORDINATE_CONVERT_TO_RC_DP",err,error,*999)
458 coordinate_convert_to_rc_dp=0.0_dp
460 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
461 &
CALL flagerror(
"Size of X is less than the number of dimensions.",err,error,*999)
463 SELECT CASE(coordinate_system%TYPE)
465 coordinate_convert_to_rc_dp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=x(1:coordinate_system%NUMBER_OF_DIMENSIONS)
467 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
469 coordinate_convert_to_rc_dp(1)=x(1)*cos(x(2))
470 coordinate_convert_to_rc_dp(2)=x(1)*sin(x(2))
472 coordinate_convert_to_rc_dp(1)=x(1)*cos(x(2))
473 coordinate_convert_to_rc_dp(2)=x(1)*sin(x(2))
474 coordinate_convert_to_rc_dp(3)=x(3)
476 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
479 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 480 coordinate_convert_to_rc_dp(1)=x(1)*cos(x(2))*cos(x(3))
481 coordinate_convert_to_rc_dp(2)=x(1)*sin(x(2))*cos(x(3))
482 coordinate_convert_to_rc_dp(3)=x(1)*sin(x(3))
484 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
487 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 488 focus=coordinate_system%FOCUS
489 coordinate_convert_to_rc_dp(1)=focus*cosh(x(1))*cos(x(2))
490 coordinate_convert_to_rc_dp(2)=focus*sinh(x(1))*sin(x(2))*cos(x(3))
491 coordinate_convert_to_rc_dp(3)=focus*sinh(x(1))*sin(x(2))*sin(x(3))
493 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
496 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 497 focus=coordinate_system%FOCUS
498 coordinate_convert_to_rc_dp(1)=focus*cosh(x(1))*cos(x(2))*cos(x(3))
499 coordinate_convert_to_rc_dp(2)=focus*sinh(x(1))*sin(x(2))
500 coordinate_convert_to_rc_dp(3)=focus*cosh(x(1))*cos(x(2))*sin(x(3))
502 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
505 CALL flagerror(
"Invalid coordinate type.",err,error,*999)
508 exits(
"COORDINATE_CONVERT_TO_RC_DP")
510 999 errorsexits(
"COORDINATE_CONVERT_TO_RC_DP",err,error)
525 REAL(SP),
INTENT(IN) :: X(:)
526 INTEGER(INTG),
INTENT(OUT) :: ERR
529 REAL(SP) :: COORDINATE_CONVERT_TO_RC_SP(size(x,1))
533 enters(
"COORDINATE_CONVERT_TO_RC_SP",err,error,*999)
535 coordinate_convert_to_rc_sp=0.0_sp
537 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
538 &
CALL flagerror(
"Size of X is less than the number of dimensions.",err,error,*999)
540 SELECT CASE(coordinate_system%TYPE)
542 coordinate_convert_to_rc_sp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=x(1:coordinate_system%NUMBER_OF_DIMENSIONS)
544 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
546 coordinate_convert_to_rc_sp(1)=x(1)*cos(x(2))
547 coordinate_convert_to_rc_sp(2)=x(1)*sin(x(2))
549 coordinate_convert_to_rc_sp(1)=x(1)*cos(x(2))
550 coordinate_convert_to_rc_sp(2)=x(1)*sin(x(2))
551 coordinate_convert_to_rc_sp(3)=x(3)
553 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
556 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 557 coordinate_convert_to_rc_sp(1)=x(1)*cos(x(2))*cos(x(3))
558 coordinate_convert_to_rc_sp(2)=x(1)*sin(x(2))*cos(x(3))
559 coordinate_convert_to_rc_sp(3)=x(1)*sin(x(3))
561 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
564 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 565 focus=
REAL(coordinate_system%focus,
sp)
566 coordinate_convert_to_rc_sp(1)=focus*cosh(x(1))*cos(x(2))
567 coordinate_convert_to_rc_sp(2)=focus*sinh(x(1))*sin(x(2))*cos(x(3))
568 coordinate_convert_to_rc_sp(3)=focus*sinh(x(1))*sin(x(2))*sin(x(3))
570 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
573 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 574 focus=
REAL(coordinate_system%focus,
sp)
575 coordinate_convert_to_rc_sp(1)=focus*cosh(x(1))*cos(x(2))*cos(x(3))
576 coordinate_convert_to_rc_sp(2)=focus*sinh(x(1))*sin(x(2))
577 coordinate_convert_to_rc_sp(3)=focus*cosh(x(1))*cos(x(2))*sin(x(3))
579 CALL flagerror(
"Invalid number of coordinates.",err,error,*999)
582 CALL flagerror(
"Invalid coordinate type.",err,error,*999)
585 exits(
"COORDINATE_CONVERT_TO_RC_SP")
587 999 errorsexits(
"COORDINATE_CONVERT_TO_RC_SP",err,error)
601 REAL(DP),
INTENT(IN) :: X(:)
602 REAL(DP),
INTENT(IN) :: Y(:)
603 INTEGER(INTG),
INTENT(OUT) :: ERR
606 REAL(DP) :: COORDINATE_DELTA_CALCULATE_DP(size(x,1))
609 enters(
"COORDINATE_DELTA_CALCULATE_DP",err,error,*999)
611 coordinate_delta_calculate_dp=0.0_dp
613 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
614 &
CALL flagerror(
"Size of X is less than the number of dimensions.",err,error,*999)
616 IF(
SIZE(x,1)/=
SIZE(y,1)) &
617 &
CALL flagerror(
"Size of X is different to the size of Y.",err,error,*999)
619 coordinate_delta_calculate_dp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=y(1:coordinate_system%NUMBER_OF_DIMENSIONS)- &
620 & x(1:coordinate_system%NUMBER_OF_DIMENSIONS)
621 SELECT CASE(coordinate_system%TYPE)
625 CALL flagerror(
"Not implemented.",err,error,*999)
627 CALL flagerror(
"Not implemented.",err,error,*999)
629 CALL flagerror(
"Not implemented.",err,error,*999)
631 CALL flagerror(
"Not implemented.",err,error,*999)
633 CALL flagerror(
"Invalid coordinate type.",err,error,*999)
636 exits(
"COORDINATE_DELTA_CALCULATE_DP")
638 999 errorsexits(
"COORDINATE_DELTA_CALCULATE_DP",err,error)
651 INTEGER(INTG),
INTENT(IN) :: JACOBIAN_TYPE
653 INTEGER(INTG),
INTENT(OUT) :: ERR
656 INTEGER(INTG) :: mi,ni,nu
657 REAL(DP) :: DET_GL,DET_DX_DXI,DX_DXI2(3),DX_DXI3(3),FF,G1,G3,LENGTH,MU,R,RC,RCRC,RR,SCALE
661 NULLIFY(interpolated_point)
663 enters(
"COORDINATE_METRICS_CALCULATE",err,error,*999)
665 IF(
ASSOCIATED(coordinate_system))
THEN 666 IF(
ASSOCIATED(metrics))
THEN 667 interpolated_point=>metrics%INTERPOLATED_POINT
668 IF(
ASSOCIATED(interpolated_point))
THEN 671 SELECT CASE(metrics%NUMBER_OF_XI_DIMENSIONS)
675 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,1)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
677 metrics%GL(1,1)=1.0_dp
681 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,1)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
683 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,2)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
685 metrics%GL(1,1)=1.0_dp
686 metrics%GL(1,2)=0.0_dp
687 metrics%GL(2,1)=0.0_dp
688 metrics%GL(2,2)=1.0_dp
692 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,1)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
694 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,2)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
696 metrics%DX_DXI(1:metrics%NUMBER_OF_X_DIMENSIONS,3)=interpolated_point%VALUES(1:metrics%NUMBER_OF_X_DIMENSIONS,nu)
698 metrics%GL(1,1)=1.0_dp
699 metrics%GL(1,2)=0.0_dp
700 metrics%GL(1,3)=0.0_dp
701 metrics%GL(2,1)=0.0_dp
702 metrics%GL(2,2)=1.0_dp
703 metrics%GL(2,3)=0.0_dp
704 metrics%GL(3,1)=0.0_dp
705 metrics%GL(3,2)=0.0_dp
706 metrics%GL(3,3)=1.0_dp
708 CALL flagerror(
"Not implemented.",err,error,*999)
712 SELECT CASE(coordinate_system%TYPE)
714 SELECT CASE(metrics%NUMBER_OF_X_DIMENSIONS)
716 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
717 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
718 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)
722 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
723 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
724 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+ &
725 & metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni)
729 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
730 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
731 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+ &
732 & metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni)+ &
733 & metrics%DX_DXI(3,mi)*metrics%DX_DXI(3,ni)
738 &
" is an invalid number of dimensions for a rectangular cartesian coordinate system." 739 CALL flagerror(local_error,err,error,*999)
742 r=interpolated_point%VALUES(1,1)
744 IF(metrics%NUMBER_OF_X_DIMENSIONS==2)
THEN 745 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
746 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
747 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+rr*metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni)
750 ELSE IF(metrics%NUMBER_OF_X_DIMENSIONS==3)
THEN 751 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
752 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
753 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+rr*metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni)+ &
754 & metrics%DX_DXI(3,mi)*metrics%DX_DXI(3,ni)
759 &
" is an invalid number of dimensions for a cylindrical polar coordinate system." 760 CALL flagerror(local_error,err,error,*999)
763 r=interpolated_point%VALUES(1,1)
765 rc=r*cos(interpolated_point%VALUES(3,1))
767 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
768 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
769 metrics%GL(mi,ni)=metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+rcrc*metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni)+ &
770 & rr*metrics%DX_DXI(3,mi)*metrics%DX_DXI(3,ni)
777 ff=coordinate_system%FOCUS*coordinate_system%FOCUS
778 r=interpolated_point%VALUES(1,1)
779 mu=interpolated_point%VALUES(2,1)
780 g1=ff*(sinh(r)*sinh(r)+sin(mu)*sin(mu))
781 g3=ff*sinh(r)*sinh(r)*sin(mu)*sin(mu)
782 IF(metrics%NUMBER_OF_X_DIMENSIONS==2)
THEN 783 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
784 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
785 metrics%GL(mi,ni)=g1*(metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni))
788 ELSE IF(metrics%NUMBER_OF_X_DIMENSIONS==3)
THEN 789 DO mi=1,metrics%NUMBER_OF_XI_DIMENSIONS
790 DO ni=1,metrics%NUMBER_OF_XI_DIMENSIONS
791 metrics%GL(mi,ni)=g1*(metrics%DX_DXI(1,mi)*metrics%DX_DXI(1,ni)+metrics%DX_DXI(2,mi)*metrics%DX_DXI(2,ni))+ &
792 & g3*metrics%DX_DXI(3,mi)*metrics%DX_DXI(3,ni)
797 &
" is an invalid number of dimensions for a prolate spheroidal coordinate system." 798 CALL flagerror(local_error,err,error,*999)
802 CALL flagerror(
"Not implemented.",err,error,*999)
804 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
806 CALL flagerror(local_error,err,error,*999)
810 CALL invert(metrics%GL(1:metrics%NUMBER_OF_XI_DIMENSIONS,1:metrics%NUMBER_OF_XI_DIMENSIONS), &
811 & metrics%GU(1:metrics%NUMBER_OF_XI_DIMENSIONS,1:metrics%NUMBER_OF_XI_DIMENSIONS),det_gl, &
815 SELECT CASE(jacobian_type)
820 metrics%JACOBIAN=sqrt(abs(metrics%GL(1,1)))
823 IF(metrics%NUMBER_OF_XI_DIMENSIONS==3)
THEN 824 metrics%JACOBIAN=sqrt(abs(det_gl*metrics%GU(3,3)))
826 metrics%JACOBIAN=sqrt(abs(det_gl))
830 metrics%JACOBIAN=sqrt(abs(det_gl))
835 CALL flagerror(local_error,err,error,*999)
839 IF(metrics%NUMBER_OF_XI_DIMENSIONS==metrics%NUMBER_OF_X_DIMENSIONS)
THEN 840 CALL invert(metrics%DX_DXI,metrics%DXI_DX,det_dx_dxi,err,error,*999)
843 SELECT CASE(metrics%NUMBER_OF_XI_DIMENSIONS)
846 SELECT CASE(metrics%NUMBER_OF_X_DIMENSIONS)
852 dx_dxi2=
normalise(interpolated_point%VALUES(1:2,nu),err,error)
856 dx_dxi2(1)=-1.0_dp*metrics%DX_DXI(2,1)
857 dx_dxi2(2)=metrics%DX_DXI(1,1)
859 det_dx_dxi=metrics%DX_DXI(1,1)*dx_dxi2(2)-metrics%DX_DXI(2,1)*dx_dxi2(1)
861 metrics%DXI_DX(1,1)=dx_dxi2(2)/det_dx_dxi
862 metrics%DXI_DX(1,2)=-1.0_dp*dx_dxi2(1)/det_dx_dxi
864 length=
l2norm(metrics%DXI_DX(1,1:2))
865 scale=sqrt(abs(metrics%GU(1,1)))/length
866 metrics%DXI_DX(1,1:2)=scale*metrics%DXI_DX(1,1:2)
868 CALL flag_warning(
"Zero determinant. Unable to obtain dxi/dx.",err,error,*999)
869 metrics%DXI_DX=0.0_dp
876 dx_dxi2=
normalise(interpolated_point%VALUES(1:3,nu),err,error)
880 det_dx_dxi=metrics%DX_DXI(1,1)*(dx_dxi2(2)*dx_dxi3(3)-dx_dxi2(3)*dx_dxi3(2))+ &
881 & dx_dxi2(1)*(metrics%DX_DXI(3,1)*dx_dxi3(2)-dx_dxi3(3)*metrics%DX_DXI(2,1))+ &
882 & dx_dxi3(1)*(metrics%DX_DXI(2,1)*dx_dxi2(3)-metrics%DX_DXI(3,1)*dx_dxi2(2))
884 metrics%DXI_DX(1,1)=(dx_dxi3(3)*dx_dxi2(2)-dx_dxi2(3)*dx_dxi3(2))/det_dx_dxi
885 metrics%DXI_DX(1,2)=-1.0_dp*(dx_dxi3(3)*dx_dxi2(1)-dx_dxi2(3)*dx_dxi3(1))/det_dx_dxi
886 metrics%DXI_DX(1,3)=(dx_dxi3(2)*dx_dxi2(1)-dx_dxi2(2)*dx_dxi3(1))/det_dx_dxi
888 length=
l2norm(metrics%DXI_DX(1,1:3))
889 scale=sqrt(abs(metrics%GU(1,1)))/length
890 metrics%DXI_DX(1,1:3)=scale*metrics%DX_DXI(1,1:3)
892 CALL flag_warning(
"Zero determinant. Unable to obtain dxi/dx.",err,error,*999)
893 metrics%DXI_DX=0.0_dp
896 metrics%DXI_DX(1,1)=metrics%DX_DXI(1,1)
897 metrics%DXI_DX(1,2)=metrics%DX_DXI(2,1)
898 metrics%DXI_DX(1,3)=metrics%DX_DXI(3,1)
900 length=
l2norm(metrics%DXI_DX(1,1:3))
901 scale=sqrt(abs(metrics%GU(1,1)))/length
902 metrics%DXI_DX(1,1:3)=scale*metrics%DXI_DX(1,1:3)
905 CALL flagerror(
"Invalid embedding of a line in space.",err,error,*999)
909 IF(metrics%NUMBER_OF_X_DIMENSIONS==3)
THEN 915 metrics%DXI_DX(1,1:3)=(metrics%GL(2,2)*metrics%DX_DXI(1:3,1)-metrics%GL(1,2)*metrics%DX_DXI(1:3,2))/det_gl
916 metrics%DXI_DX(2,1:3)=(metrics%GL(1,1)*metrics%DX_DXI(1:3,2)-metrics%GL(2,1)*metrics%DX_DXI(1:3,1))/det_gl
917 SELECT CASE(coordinate_system%TYPE)
921 r=interpolated_point%VALUES(1,1)
923 metrics%DXI_DX(1:2,2)=metrics%DXI_DX(1:2,2)*rr
925 r=interpolated_point%VALUES(1,1)
927 rc=r*cos(interpolated_point%VALUES(3,1))
929 metrics%DXI_DX(1:2,2)=metrics%DXI_DX(1:2,2)*rcrc
930 metrics%DXI_DX(1:2,3)=metrics%DXI_DX(1:2,3)*rr
935 ff=coordinate_system%FOCUS*coordinate_system%FOCUS
936 r=interpolated_point%VALUES(1,1)
937 mu=interpolated_point%VALUES(2,1)
938 g1=ff*(sinh(r)*sinh(r)+sin(mu)*sin(mu))
939 g3=ff*sinh(r)*sinh(r)*sin(mu)*sin(mu)
940 metrics%DXI_DX(1:2,1)=metrics%DXI_DX(1:2,1)*g1
941 metrics%DXI_DX(1:2,2)=metrics%DXI_DX(1:2,2)*g1
942 metrics%DXI_DX(1:2,3)=metrics%DXI_DX(1:2,3)*g3
945 CALL flagerror(
"Not implemented.",err,error,*999)
947 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
949 CALL flagerror(local_error,err,error,*999)
952 CALL flagerror(
"Invalid embedding of a surface in space.",err,error,*999)
955 CALL flagerror(
"Invalid embedding in space.",err,error,*999)
959 CALL flagerror(
"Metrics interpolated point has not been interpolated to include first derivatives.",err,error,*999)
962 CALL flagerror(
"Metrics interpolated point is not associated.",err,error,*999)
965 CALL flagerror(
"Metrics is not associated.",err,error,*999)
968 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
975 & coordinate_system%TYPE)),err,error,*999)
980 &
'(" X :",3(X,E13.6))',
'(17X,3(X,E13.6))',err,error,*999)
983 & 3,3,metrics%DX_DXI,
write_string_matrix_name_and_indices,
'(" dX_dXi',
'(",I1,",:)',
' :",3(X,E13.6))', &
984 &
'(17X,3(X,E13.6))',err,error,*999)
985 IF(metrics%NUMBER_OF_X_DIMENSIONS/=metrics%NUMBER_OF_XI_DIMENSIONS)
THEN 987 SELECT CASE(metrics%NUMBER_OF_XI_DIMENSIONS)
990 SELECT CASE(metrics%NUMBER_OF_X_DIMENSIONS)
993 &
'(" dX_dXi(:,2) :",3(X,E13.6))',
'(17X,3(X,E13.6))',err,error,*999)
996 &
'(" dX_dXi(:,2) :",3(X,E13.6))',
'(17X,3(X,E13.6))',err,error,*999)
998 &
'(" dX_dXi(:,3) :",3(X,E13.6))',
'(17X,3(X,E13.6))',err,error,*999)
1000 CALL flagerror(
"Invalid embedding of a line in space.",err,error,*999)
1004 SELECT CASE(metrics%NUMBER_OF_X_DIMENSIONS)
1007 &
'(" dX_dXi(:,3) :",3(X,E13.6))',
'(17X,3(X,E13.6))',err,error,*999)
1009 CALL flagerror(
"Invalid embedding of a surface in space.",err,error,*999)
1012 CALL flagerror(
"Invalid embedding in space.",err,error,*999)
1018 & 3,3,metrics%DXI_DX,
write_string_matrix_name_and_indices,
'(" dXi_dX',
'(",I1,",:)',
' :",3(X,E13.6))', &
1019 &
'(17X,3(X,E13.6))',err,error,*999)
1022 & 3,3,metrics%GL,
write_string_matrix_name_and_indices,
'(" GL',
'(",I1,",:)',
' :",3(X,E13.6))',
'(17X,3(X,E13.6))', &
1026 & 3,3,metrics%GU,
write_string_matrix_name_and_indices,
'(" GU',
'(",I1,",:)',
' :",3(X,E13.6))',
'(17X,3(X,E13.6))', &
1032 exits(
"COORDINATE_METRICS_CALCULATE")
1034 999 errorsexits(
"COORDINATE_METRICS_CALCULATE",err,error)
1047 LOGICAL,
INTENT(IN) :: REVERSE
1048 REAL(DP),
INTENT(IN) :: X(:,:)
1049 REAL(DP),
INTENT(OUT) :: N(3)
1050 INTEGER(INTG),
INTENT(OUT) :: ERR
1053 INTEGER(INTG) :: NUMBER_OF_X_DIMENSIONS,d_s1,d_s2,d2_s1
1054 REAL(DP) :: LENGTH,R,TANGENT1(3),TANGENT2(3)
1057 enters(
"COORDINATE_SYSTEM_NORMAL_CALCULATE",err,error,*999)
1059 IF(
ASSOCIATED(coordinate_system))
THEN 1060 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1061 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1063 number_of_x_dimensions=coordinate_system%NUMBER_OF_DIMENSIONS
1067 SELECT CASE(coordinate_system%TYPE)
1069 IF(number_of_x_dimensions==2)
THEN 1070 tangent1(1)=x(1,d_s1)
1071 tangent1(2)=x(2,d_s1)
1072 ELSE IF(number_of_x_dimensions==3)
THEN 1073 tangent1(1)=x(1,d_s1)
1074 tangent1(2)=x(2,d_s1)
1075 tangent1(3)=x(3,d_s1)
1076 tangent2(1)=x(1,d_s2)
1077 tangent2(2)=x(2,d_s2)
1078 tangent2(3)=x(3,d_s2)
1081 &
" is an invalid number of dimensions to calculate a normal from in a rectangular cartesian coordinate system." 1082 CALL flagerror(local_error,err,error,*999)
1086 IF(number_of_x_dimensions==2)
THEN 1087 tangent1(1)=x(1,d_s1)*cos(x(1,d_s1))-r*sin(x(1,d_s1))*x(2,d_s1)
1088 tangent1(2)=x(2,d_s1)*sin(x(1,d_s1))+r*cos(x(1,d_s1))*x(2,d_s1)
1089 ELSE IF(number_of_x_dimensions==3)
THEN 1090 tangent1(1)=x(1,d_s1)*cos(x(1,d_s1))-r*sin(x(1,d_s1))*x(2,d_s1)
1091 tangent1(2)=x(2,d_s1)*sin(x(1,d_s1))+r*cos(x(1,d_s1))*x(2,d_s1)
1092 tangent1(3)=x(3,d_s1)
1093 tangent2(1)=x(1,d_s2)*cos(x(1,d_s1))-r*sin(x(1,d_s1))*x(2,d_s2)
1094 tangent2(2)=x(1,d_s2)*sin(x(1,d_s1))+r*cos(x(1,d_s1))*x(2,d_s2)
1095 tangent2(3)=x(3,d_s2)
1098 &
" is an invalid number of dimensions to calculate a normal from in a rectangular cartesian coordinate system." 1099 CALL flagerror(local_error,err,error,*999)
1103 tangent1(1)=x(1,d_s1)*cos(x(1,d2_s1))*cos(x(1,d_s1))- &
1104 & r*sin(x(1,d2_s1))*cos(x(1,d_s1))*x(3,d_s1)- &
1105 & r*cos(x(1,d2_s1))*sin(x(1,d_s1))*x(2,d_s1)
1106 tangent1(2)=x(1,d_s1)*cos(x(1,d2_s1))*sin(x(1,d_s1))- &
1107 & r*sin(x(1,d2_s1))*sin(x(1,d_s1))*x(3,d_s1)+ &
1108 & r*cos(x(1,d2_s1))*cos(x(1,d_s1))*x(2,d_s1)
1109 tangent1(3)=x(1,d_s1)*sin(x(1,d2_s1))+r*cos(x(1,d2_s1))*x(3,d_s1)
1110 tangent2(1)=x(1,d_s2)*cos(x(1,d2_s1))*cos(x(1,d_s1))- &
1111 & r*sin(x(1,d2_s1))*cos(x(1,d_s1))*x(3,d_s2)- &
1112 & r*cos(x(1,d2_s1))*sin(x(1,d_s1))*x(2,d_s2)
1113 tangent2(2)=x(1,d_s2)*cos(x(1,d2_s1))*sin(x(1,d_s1))- &
1114 & r*sin(x(1,d2_s1))*sin(x(1,d_s1))*x(3,d_s2)+ &
1115 & r*cos(x(1,d2_s1))*cos(x(1,d_s1))*x(2,d_s2)
1116 tangent2(3)=x(1,d_s2)*sin(x(1,d2_s1))+r*cos(x(1,d2_s1))*x(3,d_s2)
1118 CALL flagerror(
"Not implemented.",err,error,*999)
1120 CALL flagerror(
"Not implemented.",err,error,*999)
1122 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
1124 CALL flagerror(local_error,err,error,*999)
1126 IF(number_of_x_dimensions==2)
THEN 1129 length=sqrt(n(1)*n(1)+n(2)*n(2))
1139 n(1)=tangent1(2)*tangent2(3)-tangent1(3)*tangent2(2)
1140 n(2)=tangent1(3)*tangent2(1)-tangent1(1)*tangent2(3)
1141 n(3)=tangent1(1)*tangent2(2)-tangent1(2)*tangent2(1)
1142 length=sqrt(n(1)*n(1)+n(2)*n(2)+n(3)*n(3))
1155 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1161 & coordinate_system%TYPE)),err,error,*999)
1163 CALL write_string_vector(
diagnostic_output_type,1,1,number_of_x_dimensions,3,3,x(:,1),
'(" X :",3(X,E13.6))', &
1164 &
'(13X,3(X,E13.6))',err,error,*999)
1165 CALL write_string_vector(
diagnostic_output_type,1,1,number_of_x_dimensions,3,3,tangent1,
'(" Tangent 1 :",3(X,E13.6))', &
1166 &
'(13X,3(X,E13.6))',err,error,*999)
1167 IF(number_of_x_dimensions==3)
THEN 1168 CALL write_string_vector(
diagnostic_output_type,1,1,number_of_x_dimensions,3,3,tangent2,
'(" Tangent 2 :",3(X,E13.6))', &
1169 &
'(13X,3(X,E13.6))',err,error,*999)
1171 CALL write_string_vector(
diagnostic_output_type,1,1,number_of_x_dimensions,3,3,n,
'(" Normal :",3(X,E13.6))', &
1172 &
'(13X,3(X,E13.6))',err,error,*999)
1175 exits(
"COORDINATE_SYSTEM_NORMAL_CALCULATE")
1177 999 errorsexits(
"COORDINATE_SYSTEM_NORMAL_CALCULATE",err,error)
1190 INTEGER(INTG),
INTENT(OUT) :: NUMBER_OF_DIMENSIONS
1191 INTEGER(INTG),
INTENT(OUT) :: ERR
1195 enters(
"COORDINATE_SYSTEM_DIMENSION_GET",err,error,*999)
1197 IF(
ASSOCIATED(coordinate_system))
THEN 1198 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1199 number_of_dimensions=coordinate_system%NUMBER_OF_DIMENSIONS
1201 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1204 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1207 exits(
"COORDINATE_SYSTEM_DIMENSION_GET")
1209 999 errorsexits(
"COORDINATE_SYSTEM_DIMENSION_GET",err,error)
1223 INTEGER(INTG),
INTENT(OUT) :: ERR
1227 enters(
"COORDINATE_SYSTEM_FINALISE",err,error,*999)
1229 IF(
ASSOCIATED(coordinate_system))
THEN 1230 DEALLOCATE(coordinate_system)
1233 exits(
"COORDINATE_SYSTEM_FINALISE")
1235 999 errorsexits(
"COORDINATE_SYSTEM_FINALISE",err,error)
1249 REAL(DP),
INTENT(OUT) :: FOCUS
1250 INTEGER(INTG),
INTENT(OUT) :: ERR
1254 enters(
"COORDINATE_SYSTEM_FOCUS_GET",err,error,*999)
1256 IF(
ASSOCIATED(coordinate_system))
THEN 1257 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1258 SELECT CASE(coordinate_system%TYPE)
1260 focus=coordinate_system%FOCUS
1262 CALL flagerror(
"No focus defined for this coordinate system type.",err,error,*999)
1265 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1268 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1271 exits(
"COORDINATE_SYSTEM_FOCUS_GET")
1273 999 errorsexits(
"COORDINATE_SYSTEM_FOCUS_GET",err,error)
1288 INTEGER(INTG),
INTENT(OUT) :: radialInterpolationType
1289 INTEGER(INTG),
INTENT(OUT) :: ERR
1293 enters(
"Coordinates_RadialInterpolationTypeGet",err,error,*999)
1295 IF(
ASSOCIATED(coordinatesystem))
THEN 1296 IF(coordinatesystem%COORDINATE_SYSTEM_FINISHED)
THEN 1297 SELECT CASE(coordinatesystem%TYPE)
1299 radialinterpolationtype=coordinatesystem%RADIAL_INTERPOLATION_TYPE
1301 CALL flagerror(
"No radial interpolation type defined for this coordinate system interpolation.",err,error,*999)
1304 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1307 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1310 exits(
"Coordinates_RadialInterpolationTypeGet")
1312 999 errorsexits(
"Coordinates_RadialInterpolationTypeGet",err,error)
1326 INTEGER(INTG),
INTENT(OUT) :: SYSTEM_TYPE
1327 INTEGER(INTG),
INTENT(OUT) :: ERR
1331 enters(
"COORDINATE_SYSTEM_TYPE_GET",err,error,*999)
1333 IF(
ASSOCIATED(coordinate_system))
THEN 1334 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1335 system_type=coordinate_system%TYPE
1337 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1340 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1343 exits(
"COORDINATE_SYSTEM_TYPE_GET")
1345 999 errorsexits(
"COORDINATE_SYSTEM_TYPE_GET",err,error)
1359 INTEGER(INTG),
INTENT(IN) :: DIMENSION
1360 INTEGER(INTG),
INTENT(OUT) :: ERR
1364 enters(
"COORDINATE_SYSTEM_DIMENSION_SET",err,error,*999)
1366 IF(
ASSOCIATED(coordinate_system))
THEN 1367 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1368 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1370 SELECT CASE(coordinate_system%TYPE)
1372 IF(dimension>=1.AND.dimension<=3)
THEN 1373 coordinate_system%NUMBER_OF_DIMENSIONS=dimension
1375 CALL flagerror(
"Invalid number of dimensions.",err,error,*999)
1378 IF(dimension>=2.AND.dimension<=3)
THEN 1379 coordinate_system%NUMBER_OF_DIMENSIONS=dimension
1381 CALL flagerror(
"Invalid number of dimensions.",err,error,*999)
1384 IF(dimension==3)
THEN 1385 coordinate_system%NUMBER_OF_DIMENSIONS=dimension
1387 CALL flagerror(
"Invalid number of dimensions.",err,error,*999)
1390 IF(dimension==3)
THEN 1391 coordinate_system%NUMBER_OF_DIMENSIONS=dimension
1393 CALL flagerror(
"Invalid number of dimensions.",err,error,*999)
1396 IF(dimension==3)
THEN 1397 coordinate_system%NUMBER_OF_DIMENSIONS=dimension
1399 CALL flagerror(
"Invalid number of dimensions.",err,error,*999)
1402 CALL flagerror(
"Invalid coordinate system type.",err,error,*999)
1406 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1409 exits(
"COORDINATE_SYSTEM_DIMENSION_SET")
1411 999 errorsexits(
"COORDINATE_SYSTEM_DIMENSION_SET",err,error)
1424 REAL(DP),
INTENT(IN) :: FOCUS
1425 INTEGER(INTG),
INTENT(OUT) :: ERR
1429 enters(
"COORDINATE_SYSTEM_FOCUS_SET",err,error,*999)
1431 IF(
ASSOCIATED(coordinate_system))
THEN 1432 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1433 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1435 SELECT CASE(coordinate_system%TYPE)
1438 coordinate_system%FOCUS=focus
1440 CALL flagerror(
"Focus is less than zero.",err,error,*999)
1444 coordinate_system%FOCUS=focus
1446 CALL flagerror(
"Focus is less than zero.",err,error,*999)
1449 CALL flagerror(
"Invalid coordinate system type.",err,error,*999)
1453 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1456 exits(
"COORDINATE_SYSTEM_FOCUS_SET")
1458 999 errorsexits(
"COORDINATE_SYSTEM_FOCUS_SET",err,error)
1471 INTEGER(INTG),
INTENT(IN) :: radialInterpolationType
1472 INTEGER(INTG),
INTENT(OUT) :: err
1477 enters(
"Coordinates_RadialInterpolationTypeSet",err,error,*999)
1479 IF(
ASSOCIATED(coordinatesystem))
THEN 1480 IF(coordinatesystem%COORDINATE_SYSTEM_FINISHED)
THEN 1481 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1483 SELECT CASE(coordinatesystem%TYPE)
1485 SELECT CASE(radialinterpolationtype)
1489 localerror=
"The radial interpolation type of "//
trim(
number_to_vstring(radialinterpolationtype,
"*",err,error))// &
1490 &
" is invalid for a rectangular cartesian coordinate system." 1491 CALL flagerror(localerror,err,error,*999)
1494 SELECT CASE(radialinterpolationtype)
1500 localerror=
"The radial interpolation type of "//
trim(
number_to_vstring(radialinterpolationtype,
"*",err,error))// &
1501 &
" is invalid for a cylindrical/spherical coordinate system." 1502 CALL flagerror(localerror,err,error,*999)
1505 SELECT CASE(radialinterpolationtype)
1513 localerror=
"The radial interpolation type of "//
trim(
numbertovstring(radialinterpolationtype,
"*",err,error))// &
1514 &
" is invalid for a prolate spheroidal coordinate system." 1515 CALL flagerror(localerror,err,error,*999)
1518 CALL flagerror(
"Not implemented.",err,error,*999)
1520 CALL flagerror(
"Invalid coordinate system type.",err,error,*999)
1524 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1527 exits(
"Coordinates_RadialInterpolationTypeSet")
1529 999 errorsexits(
"Coordinates_RadialInterpolationTypeSet",err,error)
1542 INTEGER(INTG),
INTENT(IN) ::
TYPE 1543 INTEGER(INTG),
INTENT(OUT) :: ERR
1547 enters(
"COORDINATE_SYSTEM_TYPE_SET",err,error,*999)
1549 IF(
ASSOCIATED(coordinate_system))
THEN 1550 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1551 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1565 CALL flagerror(
"Invalid coordinate system type.",err,error,*999)
1569 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1572 exits(
"COORDINATE_SYSTEM_TYPE_SET")
1574 999 errorsexits(
"COORDINATE_SYSTEM_TYPE_SET",err,error)
1587 REAL(DP),
INTENT(OUT) :: ORIGIN(:)
1588 INTEGER(INTG),
INTENT(OUT) :: ERR
1592 enters(
"COORDINATE_SYSTEM_ORIGIN_GET",err,error,*999)
1594 IF(
ASSOCIATED(coordinate_system))
THEN 1595 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1596 IF(
SIZE(origin)>=3)
THEN 1597 origin(1:3)=coordinate_system%ORIGIN
1599 CALL flagerror(
"The origin must have >= 3 components.",err,error,*999)
1602 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1605 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1608 exits(
"COORDINATE_SYSTEM_ORIGIN_GET")
1610 999 errorsexits(
"COORDINATE_SYSTEM_ORIGIN_GET",err,error)
1624 REAL(DP),
INTENT(IN) :: ORIGIN(:)
1625 INTEGER(INTG),
INTENT(OUT) :: ERR
1629 enters(
"COORDINATE_SYSTEM_ORIGIN_SET",err,error,*999)
1631 IF(
ASSOCIATED(coordinate_system))
THEN 1632 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1633 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1635 IF(
SIZE(origin)==3)
THEN 1636 coordinate_system%ORIGIN=origin
1638 CALL flagerror(
"The origin must have exactly 3 components.",err,error,*999)
1642 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1645 exits(
"COORDINATE_SYSTEM_ORIGIN_SET")
1647 999 errorsexits(
"COORDINATE_SYSTEM_ORIGIN_SET",err,error)
1660 REAL(DP),
INTENT(OUT) :: ORIENTATION(:,:)
1661 INTEGER(INTG),
INTENT(OUT) :: ERR
1665 enters(
"COORDINATE_SYSTEM_ORIENTATION_GET",err,error,*999)
1667 IF(
ASSOCIATED(coordinate_system))
THEN 1668 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1669 IF(
SIZE(orientation,1)>=3.AND.
SIZE(orientation,2)>=3)
THEN 1670 orientation(1:3,1:3)=coordinate_system%ORIENTATION
1672 CALL flagerror(
"The orientation matrix must have >= 3x3 components.",err,error,*999)
1675 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
1678 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1681 exits(
"COORDINATE_SYSTEM_ORIENTATION_GET")
1683 999 errorsexits(
"COORDINATE_SYSTEM_ORIENTATION_GET",err,error)
1696 REAL(DP),
INTENT(IN) :: ORIENTATION(:,:)
1697 INTEGER(INTG),
INTENT(OUT) :: ERR
1701 enters(
"COORDINATE_SYSTEM_ORIENTATION_SET",err,error,*999)
1703 IF(
ASSOCIATED(coordinate_system))
THEN 1704 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 1705 CALL flagerror(
"Coordinate system has been finished.",err,error,*999)
1707 IF(
SIZE(orientation,1)==3.AND.
SIZE(orientation,2)==3)
THEN 1709 coordinate_system%ORIENTATION=orientation
1711 CALL flagerror(
"The orientation matrix must have exactly 3x3 components.",err,error,*999)
1715 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1718 exits(
"COORDINATE_SYSTEM_ORIENTATION_SET")
1720 999 errorsexits(
"COORDINATE_SYSTEM_ORIENTATION_SET",err,error)
1739 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
1741 INTEGER(INTG),
INTENT(OUT) :: ERR
1744 INTEGER(INTG) :: coord_system_idx
1749 NULLIFY(new_coordinate_system)
1750 NULLIFY(new_coordinate_systems)
1752 enters(
"COORDINATE_SYSTEM_CREATE_START",err,error,*998)
1754 NULLIFY(new_coordinate_system)
1756 IF(
ASSOCIATED(new_coordinate_system))
THEN 1758 &
" has already been created." 1759 CALL flagerror(local_error,err,error,*998)
1761 IF(
ASSOCIATED(coordinate_system))
THEN 1762 CALL flagerror(
"Coordinate system is already associated.",err,error,*999)
1764 NULLIFY(new_coordinate_system)
1765 ALLOCATE(new_coordinate_system,stat=err)
1766 IF(err/=0)
CALL flagerror(
"Could not allocate new coordinate system.",err,error,*999)
1768 new_coordinate_system%USER_NUMBER=user_number
1769 new_coordinate_system%COORDINATE_SYSTEM_FINISHED=.false.
1772 new_coordinate_system%NUMBER_OF_DIMENSIONS=3
1773 new_coordinate_system%FOCUS=1.0_dp
1774 new_coordinate_system%ORIGIN=(/0.0_dp,0.0_dp,0.0_dp/)
1775 new_coordinate_system%ORIENTATION=reshape(&
1776 & (/1.0_dp,0.0_dp,0.0_dp, &
1777 & 0.0_dp,1.0_dp,0.0_dp, &
1778 & 0.0_dp,0.0_dp,1.0_dp/), &
1781 ALLOCATE(new_coordinate_systems(
coordinate_systems%NUMBER_OF_COORDINATE_SYSTEMS+1),stat=err)
1782 IF(err/=0)
CALL flagerror(
"Could not allocate new coordinate systems.",err,error,*999)
1784 new_coordinate_systems(coord_system_idx)%PTR=>
coordinate_systems%COORDINATE_SYSTEMS(coord_system_idx)%PTR
1786 new_coordinate_systems(
coordinate_systems%NUMBER_OF_COORDINATE_SYSTEMS+1)%PTR=>new_coordinate_system
1791 coordinate_system=>new_coordinate_system
1795 exits(
"COORDINATE_SYSTEM_CREATE_START")
1797 999
IF(
ASSOCIATED(new_coordinate_system))
DEALLOCATE(new_coordinate_system)
1798 IF(
ASSOCIATED(new_coordinate_systems))
DEALLOCATE(new_coordinate_systems)
1799 NULLIFY(coordinate_system)
1800 998 errorsexits(
"COORDINATE_SYSTEM_CREATE_START",err,error)
1813 INTEGER(INTG),
INTENT(OUT) :: ERR
1816 INTEGER(INTG) :: coord_system_idx
1818 enters(
"COORDINATE_SYSTEM_CREATE_FINISH",err,error,*999)
1820 IF(
ASSOCIATED(coordinate_system))
THEN 1821 coordinate_system%COORDINATE_SYSTEM_FINISHED=.true.
1823 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1832 &
coordinate_systems%COORDINATE_SYSTEMS(coord_system_idx)%PTR%USER_NUMBER,err,error,*999)
1836 &
coordinate_systems%COORDINATE_SYSTEMS(coord_system_idx)%PTR%NUMBER_OF_DIMENSIONS,err,error,*999)
1840 exits(
"COORDINATE_SYSTEM_CREATE_FINISH")
1842 999 errorsexits(
"COORDINATE_SYSTEM_CREATE_FINISH",err,error)
1855 INTEGER(INTG),
INTENT(OUT) :: ERR
1858 INTEGER(INTG) :: coord_system_no,new_coord_system_no
1862 enters(
"COORDINATE_SYSTEM_DESTROY",err,error,*999)
1864 IF(
ASSOCIATED(coordinate_system))
THEN 1865 IF(coordinate_system%USER_NUMBER==0)
THEN 1866 CALL flagerror(
"Cannot destroy the world coordinate system.",err,error,*999)
1869 new_coord_system_no=0
1870 ALLOCATE(new_coordinate_systems(
coordinate_systems%NUMBER_OF_COORDINATE_SYSTEMS-1),stat=err)
1871 IF(err/=0)
CALL flagerror(
"Could not allocate new coordianate systems.",err,error,*999)
1873 IF(
coordinate_systems%COORDINATE_SYSTEMS(coord_system_no)%PTR%USER_NUMBER==coordinate_system%USER_NUMBER)
THEN 1876 new_coord_system_no=new_coord_system_no+1
1877 new_coordinate_systems(new_coord_system_no)%PTR=>
coordinate_systems%COORDINATE_SYSTEMS(coord_system_no)%PTR
1886 DEALLOCATE(new_coordinate_systems)
1887 CALL flagerror(
"Coordinate system number to destroy does not exist.",err,error,*999)
1891 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
1894 exits(
"COORDINATE_SYSTEM_DESTROY")
1896 999 errorsexits(
"COORDINATE_SYSTEM_DESTROY",err,error)
1905 FUNCTION dxz_dp(COORDINATE_SYSTEM,I,X,ERR,ERROR)
1909 INTEGER(INTG),
INTENT(IN) :: I
1910 REAL(DP),
INTENT(IN) :: X(:)
1911 INTEGER(INTG),
INTENT(OUT) :: ERR
1914 REAL(DP) :: DXZ_DP(size(x,1))
1916 REAL(DP) :: RD,FOCUS
1918 enters(
"DXZ_DP",err,error,*999)
1922 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
1923 &
CALL flagerror(
"Size of X is less than the number of dimensions", &
1926 SELECT CASE(coordinate_system%TYPE)
1928 IF(i>0.AND.i<=coordinate_system%NUMBER_OF_DIMENSIONS)
THEN 1931 CALL flagerror(
"Invalid i value",err,error,*999)
1934 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
1939 dxz_dp(2)=-sin(x(2))/x(1)
1942 dxz_dp(2)=cos(x(2))/x(1)
1944 CALL flagerror(
"Invalid i value",err,error,*999)
1950 dxz_dp(2)=-sin(x(2))/x(1)
1954 dxz_dp(2)=cos(x(2))/x(1)
1961 CALL flagerror(
"Invalid i value",err,error,*999)
1964 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
1967 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 1970 dxz_dp(1)=cos(x(2))*cos(x(3))
1971 dxz_dp(2)=-sin(x(2))/(x(1)*cos(x(3)))
1972 dxz_dp(3)=-cos(x(2))*sin(x(3))/x(1)
1974 dxz_dp(1)=sin(x(2))*cos(x(3))
1975 dxz_dp(2)=cos(x(2))/(x(1)*cos(x(3)))
1976 dxz_dp(3)=-sin(x(2))*sin(x(3))/x(1)
1980 dxz_dp(3)=cos(x(3))/x(1)
1982 CALL flagerror(
"Invalid i value",err,error,*999)
1985 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
1988 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 1989 focus=coordinate_system%FOCUS
1990 rd=focus*(cosh(x(1))*cosh(x(1))-cos(x(2))*cos(x(2)))
1993 dxz_dp(1)=sinh(x(1))*cos(x(2))/rd
1994 dxz_dp(2)=-cosh(x(1))*sin(x(2))/rd
1997 dxz_dp(1)=cosh(x(1))*sin(x(2))*cos(x(3))/rd
1998 dxz_dp(2)=sinh(x(1))*cos(x(2))*cos(x(3))/rd
1999 dxz_dp(3)=-sin(x(3))/(focus*sinh(x(1))*sin(x(2)))
2001 dxz_dp(1)=cosh(x(1))*sin(x(2))*sin(x(3))/rd
2002 dxz_dp(2)=sinh(x(1))*cos(x(2))*sin(x(3))/rd
2003 dxz_dp(3)=cos(x(3))/(focus*sinh(x(1))*sin(x(2)))
2005 CALL flagerror(
"Invalid i value",err,error,*999)
2008 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2011 CALL flagerror(
"Not implemented",err,error,*999)
2013 CALL flagerror(
"Invalid coordinate type",err,error,*999)
2018 999 errorsexits(
"DXZ_DP",err,error)
2037 FUNCTION d2zx_dp(COORDINATE_SYSTEM,I,J,X,ERR,ERROR)
2049 INTEGER(INTG),
INTENT(IN) :: I,J
2050 REAL(DP),
INTENT(IN) :: X(:)
2051 INTEGER(INTG),
INTENT(OUT) :: ERR
2054 REAL(DP) :: D2ZX_DP(size(x,1))
2058 enters(
"D2ZX_DP",err,error,*999)
2062 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
2063 &
CALL flagerror(
"Size of X is less than the number of dimensions", &
2066 SELECT CASE(coordinate_system%TYPE)
2068 d2zx_dp(1:coordinate_system%NUMBER_OF_DIMENSIONS)=0.0_dp
2070 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2079 d2zx_dp(1)=-sin(x(2))
2080 d2zx_dp(2)=cos(x(2))
2082 CALL flagerror(
"Invalid j value",err,error,*999)
2087 d2zx_dp(1)=-sin(x(2))
2088 d2zx_dp(2)=cos(x(2))
2090 d2zx_dp(1)=-x(1)*cos(x(2))
2091 d2zx_dp(2)=-x(1)*sin(x(2))
2093 CALL flagerror(
"Invalid j value",err,error,*999)
2096 CALL flagerror(
"Invalid i value",err,error,*999)
2107 d2zx_dp(1)=-sin(x(2))
2108 d2zx_dp(2)=cos(x(2))
2115 CALL flagerror(
"Invalid j value",err,error,*999)
2120 d2zx_dp(1)=-sin(x(2))
2121 d2zx_dp(2)=cos(x(2))
2124 d2zx_dp(1)=-x(1)*cos(x(2))
2125 d2zx_dp(2)=-x(1)*sin(x(2))
2132 CALL flagerror(
"Invalid j value",err,error,*999)
2149 CALL flagerror(
"Invalid j value",err,error,*999)
2152 CALL flagerror(
"Invalid i value",err,error,*999)
2155 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2158 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2167 d2zx_dp(1)=-sin(x(2))*cos(x(3))
2168 d2zx_dp(2)=cos(x(2))*cos(x(3))
2171 d2zx_dp(1)=-cos(x(2))*sin(x(3))
2172 d2zx_dp(2)=-sin(x(2))*sin(x(3))
2173 d2zx_dp(3)=cos(x(3))
2175 CALL flagerror(
"Invalid j value",err,error,*999)
2180 d2zx_dp(1)=-sin(x(2))*cos(x(3))
2181 d2zx_dp(2)=cos(x(2))*cos(x(3))
2184 d2zx_dp(1)=-x(1)*cos(x(2))*cos(x(3))
2185 d2zx_dp(2)=-x(1)*sin(x(2))*cos(x(3))
2188 d2zx_dp(1)=x(1)*sin(x(2))*sin(x(3))
2189 d2zx_dp(2)=-x(1)*cos(x(2))*sin(x(3))
2192 CALL flagerror(
"Invalid j value",err,error,*999)
2197 d2zx_dp(1)=-cos(x(2))*sin(x(3))
2198 d2zx_dp(2)=-sin(x(2))*sin(x(3))
2199 d2zx_dp(3)=cos(x(3))
2201 d2zx_dp(1)=x(1)*sin(x(2))*sin(x(3))
2202 d2zx_dp(2)=-x(1)*cos(x(2))*sin(x(3))
2205 d2zx_dp(1)=-x(1)*cos(x(2))*cos(x(3))
2206 d2zx_dp(2)=-x(1)*sin(x(2))*cos(x(3))
2207 d2zx_dp(3)=-x(1)*sin(x(3))
2209 CALL flagerror(
"Invalid j value",err,error,*999)
2212 CALL flagerror(
"Invalid i value",err,error,*999)
2215 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2218 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2219 focus=coordinate_system%FOCUS
2224 d2zx_dp(1)=focus*cosh(x(1))*cos(x(2))
2225 d2zx_dp(2)=focus*sinh(x(1))*sin(x(2))*cos(x(3))
2226 d2zx_dp(3)=focus*sinh(x(1))*sin(x(2))*sin(x(3))
2228 d2zx_dp(1)=-focus*sinh(x(1))*sin(x(2))
2229 d2zx_dp(2)=focus*cosh(x(1))*cos(x(2))*cos(x(3))
2230 d2zx_dp(3)=focus*cosh(x(1))*cos(x(2))*sin(x(3))
2233 d2zx_dp(2)=-focus*cosh(x(1))*sin(x(2))*sin(x(3))
2234 d2zx_dp(3)=focus*cosh(x(1))*sin(x(2))*cos(x(3))
2236 CALL flagerror(
"Invalid j value",err,error,*999)
2241 d2zx_dp(1)=-focus*sinh(x(1))*sin(x(2))
2242 d2zx_dp(2)=focus*cosh(x(1))*cos(x(2))*cos(x(3))
2243 d2zx_dp(3)=focus*cosh(x(1))*cos(x(2))*sin(x(3))
2245 d2zx_dp(1)=-focus*cosh(x(1))*cos(x(2))
2246 d2zx_dp(2)=-focus*sinh(x(1))*sin(x(2))*cos(x(3))
2247 d2zx_dp(3)=-focus*sinh(x(1))*sin(x(2))*sin(x(3))
2250 d2zx_dp(2)=-focus*sinh(x(1))*cos(x(2))*sin(x(3))
2251 d2zx_dp(3)=focus*sinh(x(1))*cos(x(2))*cos(x(3))
2253 CALL flagerror(
"Invalid j value",err,error,*999)
2259 d2zx_dp(2)=-focus*cosh(x(1))*sin(x(2))*sin(x(3))
2260 d2zx_dp(3)=focus*cosh(x(1))*sin(x(2))*cos(x(3))
2263 d2zx_dp(2)=-focus*sinh(x(1))*cos(x(2))*sin(x(3))
2264 d2zx_dp(3)=focus*sinh(x(1))*cos(x(2))*cos(x(3))
2267 d2zx_dp(2)=-focus*sinh(x(1))*sin(x(2))*cos(x(3))
2268 d2zx_dp(3)=-focus*sinh(x(1))*sin(x(2))*sin(x(3))
2270 CALL flagerror(
"Invalid j value",err,error,*999)
2273 CALL flagerror(
"Invalid i value",err,error,*999)
2276 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2279 CALL flagerror(
"Not implemented",err,error,*999)
2281 CALL flagerror(
"Invalid coordinate type",err,error,*999)
2286 999 errorsexits(
"D2ZX_DP",err,error)
2305 FUNCTION dzx_dp(COORDINATE_SYSTEM,I,X,ERR,ERROR)
2317 INTEGER(INTG),
INTENT(IN) :: I
2318 REAL(DP),
INTENT(IN) :: X(:)
2319 INTEGER(INTG),
INTENT(OUT) :: ERR
2322 REAL(DP) :: DZX_DP(size(x,1))
2326 enters(
"DZX_DP",err,error,*999)
2330 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
2331 &
CALL flagerror(
"Size of X is less than the number of dimensions", &
2334 SELECT CASE(coordinate_system%TYPE)
2336 IF(i>0.AND.i<=coordinate_system%NUMBER_OF_DIMENSIONS)
THEN 2339 CALL flagerror(
"Invalid i value",err,error,*999)
2342 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2349 dzx_dp(1)=-x(1)*sin(x(2))
2350 dzx_dp(2)=x(1)*cos(x(2))
2352 CALL flagerror(
"Invalid i value",err,error,*999)
2361 dzx_dp(1)=-x(1)*sin(x(2))
2362 dzx_dp(2)=x(1)*cos(x(2))
2369 CALL flagerror(
"Invalid i value",err,error,*999)
2372 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2375 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2378 dzx_dp(1)=cos(x(2))*cos(x(3))
2379 dzx_dp(2)=sin(x(2))*cos(x(3))
2382 dzx_dp(1)=-x(1)*sin(x(2))*cos(x(3))
2383 dzx_dp(2)=x(1)*cos(x(2))*cos(x(3))
2386 dzx_dp(1)=-x(1)*cos(x(2))*sin(x(3))
2387 dzx_dp(2)=-x(1)*sin(x(2))*sin(x(3))
2388 dzx_dp(3)=x(1)*cos(x(3))
2390 CALL flagerror(
"Invalid i value",err,error,*999)
2393 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2396 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2397 focus=coordinate_system%FOCUS
2400 dzx_dp(1)=focus*sinh(x(1))*cos(x(2))
2401 dzx_dp(2)=focus*cosh(x(1))*sin(x(2))*cos(x(3))
2402 dzx_dp(3)=focus*cosh(x(1))*sin(x(2))*sin(x(3))
2404 dzx_dp(1)=-focus*cosh(x(1))*sin(x(2))
2405 dzx_dp(2)=focus*sinh(x(1))*cos(x(2))*cos(x(3))
2406 dzx_dp(3)=focus*sinh(x(1))*cos(x(2))*sin(x(3))
2409 dzx_dp(2)=-focus*sinh(x(1))*sin(x(2))*sin(x(3))
2410 dzx_dp(3)=focus*sinh(x(1))*sin(x(2))*cos(x(3))
2412 CALL flagerror(
"Invalid i value",err,error,*999)
2415 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2418 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2419 focus=coordinate_system%FOCUS
2422 dzx_dp(1)=focus*sinh(x(1))*cos(x(2))*cos(x(3))
2423 dzx_dp(2)=focus*cosh(x(1))*sin(x(2))
2424 dzx_dp(3)=focus*sinh(x(1))*cos(x(2))*sin(x(3))
2426 dzx_dp(1)=-focus*cosh(x(1))*sin(x(2))*cos(x(3))
2427 dzx_dp(2)=focus*sinh(x(1))*cos(x(2))
2428 dzx_dp(3)=-focus*cosh(x(1))*sin(x(2))*sin(x(3))
2430 dzx_dp(1)=-focus*cosh(x(1))*cos(x(2))*sin(x(3))
2432 dzx_dp(3)=focus*cosh(x(1))*cos(x(2))*cos(x(3))
2434 CALL flagerror(
"Invalid i value",err,error,*999)
2437 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2440 CALL flagerror(
"Invalid coordinate type",err,error,*999)
2445 999 errorsexits(
"DZX_DP",err,error)
2481 INTEGER(INTG),
INTENT(IN) :: PART_DERIV_TYPE
2482 REAL(DP),
INTENT(IN) :: X(:,:)
2483 REAL(DP),
INTENT(OUT) :: Z(:)
2484 INTEGER(INTG),
INTENT(OUT) :: ERR
2489 enters(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_DP",err,error,*999)
2494 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
2495 &
CALL flagerror(
"Size of X is less than the number of dimensions", &
2498 IF(
SIZE(x,1)==
SIZE(z,1))
THEN 2499 SELECT CASE(coordinate_system%TYPE)
2501 IF(
SIZE(x,2)>=part_deriv_type)
THEN 2502 z=x(:,part_deriv_type)
2504 CALL flagerror(
"Invalid derivative type",err,error,*999)
2507 SELECT CASE(part_deriv_type)
2512 IF(
SIZE(x,2)>=2)
THEN 2513 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2515 z(1)=cos(x(2,1))*x(1,2)-x(1,1)*sin(x(2,1))*x(2,2)
2516 z(2)=sin(x(2,1))*x(1,2)+x(1,1)*cos(x(2,1))*x(2,2)
2518 z(1)=cos(x(2,1))*x(1,2)-x(1,1)*sin(x(2,1))*x(2,2)
2519 z(2)=sin(x(2,1))*x(1,2)+x(1,1)*cos(x(2,1))*x(2,2)
2522 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2525 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2528 CALL flagerror(
"Not implemented",err,error,*999)
2530 IF(
SIZE(x,2)>=4)
THEN 2531 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2533 z(1)=cos(x(2,1))*x(1,4)-x(1,1)*sin(x(2,1))*x(2,4)
2534 z(2)=sin(x(2,1))*x(1,4)+x(1,1)*cos(x(2,1))*x(2,4)
2536 z(1)=cos(x(2,1))*x(1,4)-x(1,1)*sin(x(2,1))*x(2,4)
2537 z(2)=sin(x(2,1))*x(1,4)+x(1,1)*cos(x(2,1))*x(2,4)
2540 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2543 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2546 CALL flagerror(
"Not implemented",err,error,*999)
2548 IF(
SIZE(x,2)>=6)
THEN 2549 SELECT CASE(
SIZE(x,1))
2551 z(1)=cos(x(2,1))*x(1,6)-x(1,2)*sin(x(2,1))*x(2,4)-&
2552 & (x(1,4)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
2553 & x(2,2)*x(2,4)+x(1,1)*sin(x(2,1))*x(2,6))
2554 z(2)=sin(x(2,1))*x(1,6)+x(1,2)*cos(x(2,1))*x(2,4)+&
2555 & (x(1,4)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
2556 & x(2,2)*x(2,4)+x(1,1)*cos(x(2,1))*x(2,6))
2558 z(1)=cos(x(2,1))*x(1,6)-x(1,2)*sin(x(2,1))*x(2,4)-&
2559 & (x(1,4)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
2560 & x(2,2)*x(2,4)+x(1,1)*sin(x(2,1))*x(2,6))
2561 z(2)=sin(x(2,1))*x(1,6)+x(1,2)*cos(x(2,1))*x(2,4)+&
2562 & (x(1,4)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
2563 & x(2,2)*x(2,4)+x(1,1)*cos(x(2,1))*x(2,6))
2566 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2569 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2572 IF(
SIZE(x,2)>=7)
THEN 2573 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2578 z(1)=cos(x(2,1))*x(1,7)-x(1,1)*sin(x(2,1))*x(2,7)
2579 z(2)=sin(x(2,1))*x(1,7)+x(1,1)*cos(x(2,1))*x(2,7)
2582 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2585 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2588 CALL flagerror(
"Not implemented",err,error,*999)
2590 IF(
SIZE(x,2)>=9)
THEN 2591 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2596 z(1)=cos(x(2,1))*x(1,9)-x(1,2)*sin(x(2,1))*x(2,7)-&
2597 & (x(1,7)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
2598 & x(2,2)*x(2,7)+x(1,1)*sin(x(2,1))*x(2,9))
2599 z(2)=sin(x(2,1))*x(1,9)+x(1,2)*cos(x(2,1))*x(2,7)+&
2600 & (x(1,7)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
2601 & x(2,2)*x(2,7)+x(1,1)*cos(x(2,1))*x(2,9))
2604 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2607 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2610 IF(
SIZE(x,2)>=10)
THEN 2611 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2616 z(1)=cos(x(2,1))*x(1,10)-x(1,4)*sin(x(2,1))*x(2,7)-&
2617 & (x(1,7)*sin(x(2,1))*x(2,4)+x(1,1)*cos(x(2,1))*&
2618 & x(2,4)*x(2,7)+x(1,1)*sin(x(2,1))*x(2,10))
2619 z(2)=sin(x(2,1))*x(1,10)+x(1,4)*cos(x(2,1))*x(2,7)+&
2620 & (x(1,7)*cos(x(2,1))*x(2,4)-x(1,1)*sin(x(2,1))*&
2621 & x(2,4)*x(2,7)+x(1,1)*cos(x(2,1))*x(2,10))
2624 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2627 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2630 IF(
SIZE(x,2)>=11)
THEN 2631 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
2636 z(1)=-cos(x(2,1))*x(2,2)*x(2,4)*x(1,7)-&
2637 & sin(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))-&
2638 & sin(x(2,1))*x(2,2)*x(1,10)+cos(x(2,1))*x(1,11)-&
2639 & cos(x(2,1))*x(2,2)*x(1,4)*x(2,7)-&
2640 & sin(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
2641 & (-cos(x(2,1))*x(1,2)+sin(x(2,1))*x(1,1)*x(2,2))*&
2642 & x(2,4)*x(2,7)-x(1,1)*cos(x(2,1))*(x(2,6)*x(2,7)+&
2643 & x(2,4)*x(2,9))+(-sin(x(2,1))*x(1,2)-x(1,1)*&
2644 & cos(x(2,1))*x(2,2))*x(2,10)-x(1,1)*&
2645 & sin(x(2,1))*x(2,11)
2646 z(2)=-sin(x(2,1))*x(2,2)*x(2,4)*x(1,7)+&
2647 & cos(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
2648 & cos(x(2,1))*x(2,2)*x(1,10)+sin(x(2,1))*x(1,11)-&
2649 & sin(x(2,1))*x(2,2)*x(1,4)*x(2,7)+&
2650 & cos(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
2651 & (-sin(x(2,1))*x(1,2)-x(1,1)*cos(x(2,1))*x(2,2))*&
2652 & x(2,4)*x(2,7)-x(1,1)*sin(x(2,1))*(x(2,6)*x(2,7)+&
2653 & x(2,4)*x(2,9))+(cos(x(2,1))*x(1,2)-x(1,1)*&
2654 & sin(x(2,1))*x(2,2))*x(2,10)+x(1,1)*&
2655 & cos(x(2,1))*x(2,11)
2658 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2661 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
2664 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
2667 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2668 SELECT CASE(part_deriv_type)
2675 CALL flagerror(
"Not implemented",err,error,*999)
2677 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
2680 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
2683 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 2684 focus=coordinate_system%FOCUS
2685 SELECT CASE(part_deriv_type)
2690 IF(
SIZE(x,2)>=2)
THEN 2691 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,2)-&
2692 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,2)
2693 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2694 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2695 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2697 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
2698 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
2699 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2702 CALL flagerror(
"Invalid derivative type",err,error,*999)
2705 CALL flagerror(
"Not implemented",err,error,*999)
2707 IF(
SIZE(x,2)>=4)
THEN 2708 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,4)-&
2709 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,4)
2710 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,4)+&
2711 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,4)-&
2712 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2714 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,4)+&
2715 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,4)+&
2716 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2719 CALL flagerror(
"Not enough X derivatives supplied",&
2723 CALL flagerror(
"Not implemented",err,error,*999)
2725 IF(
SIZE(x,2)>=6)
THEN 2726 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,6)+&
2727 & x(1,2)*(cosh(x(1,1))*cos(x(2,1))*x(1,4)-&
2728 & sinh(x(1,1))*sin(x(2,1))*x(2,4))-&
2729 & cosh(x(1,1))*sin(x(2,1))*x(2,6)-&
2730 & x(2,2)*(sinh(x(1,1))*sin(x(2,1))*x(1,4)+&
2731 & cosh(x(1,1))*cos(x(2,1))*x(2,4)))
2732 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,6)+&
2733 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2734 & x(1,4)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2735 & x(2,4)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2736 & x(3,4))+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2737 & x(2,6)+x(2,2)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2738 & x(1,4)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,4)-&
2739 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,4))-&
2740 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,6)-&
2741 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2742 & x(1,4)+sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2743 & x(2,4)+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2745 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,6)+&
2746 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2747 & x(1,4)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2748 & x(2,4)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2749 & x(3,4))+sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,6)+&
2750 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2751 & x(1,4)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2752 & x(2,4)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2753 & x(3,4))+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,6)+&
2754 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2755 & x(1,4)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2756 & x(2,4)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2759 CALL flagerror(
"Not enough X derivatives supplied",&
2763 IF(
SIZE(x,2)>=7)
THEN 2764 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,7)-&
2765 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,7)
2766 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
2767 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
2768 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2770 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
2771 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
2772 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2775 CALL flagerror(
"Not enough X derivatives supplied",&
2779 CALL flagerror(
"Not implemented",err,error,*999)
2781 IF(
SIZE(x,2)>=9)
THEN 2782 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,9)+&
2783 & x(1,2)*(cosh(x(1,1))*cos(x(2,1))*x(1,7)-&
2784 & sinh(x(1,1))*sin(x(2,1))*x(2,7))-&
2785 & cosh(x(1,1))*sin(x(2,1))*x(2,9)-&
2786 & x(2,2)*(sinh(x(1,1))*sin(x(2,1))*x(1,7)+&
2787 & cosh(x(1,1))*cos(x(2,1))*x(2,7)))
2788 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,9)+&
2789 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
2790 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
2791 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,7))+&
2792 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,9)+&
2793 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,7)-&
2794 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,7)-&
2795 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,7))-&
2796 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,9)-&
2797 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
2798 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))* x(2,7)+&
2799 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2801 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,9)+&
2802 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
2803 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
2804 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,7))+&
2805 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,9)+&
2806 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,7)-&
2807 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,7)+&
2808 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,7))+&
2809 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,9)+&
2810 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
2811 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
2812 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2815 CALL flagerror(
"Not enough X derivatives supplied",&
2819 IF(
SIZE(x,2)>=10)
THEN 2820 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,10)+&
2821 & x(1,4)*(cosh(x(1,1))*cos(x(2,1))*x(1,7)-&
2822 & sinh(x(1,1))*sin(x(2,1))*x(2,7))-&
2823 & cosh(x(1,1))*sin(x(2,1))*x(2,10)-&
2824 & x(2,4)*(sinh(x(1,1))*sin(x(2,1))*x(1,7)+&
2825 & cosh(x(1,1))*cos(x(2,1))*x(2,7)))
2826 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,10)+&
2827 & x(1,4)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
2828 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
2829 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,7))+&
2830 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,10)+&
2831 & x(2,4)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,7)-&
2832 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,7)-&
2833 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,7))-&
2834 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,10)-&
2835 & x(3,4)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
2836 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
2837 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2839 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,10)+&
2840 & x(1,4)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
2841 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
2842 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,7))+&
2843 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,10)+&
2844 & x(2,4)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,7)-&
2845 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,7)+&
2846 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,7))+&
2847 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,10)+&
2848 & x(3,4)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
2849 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
2850 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2853 CALL flagerror(
"Not enough X derivatives supplied",&
2857 IF(
SIZE(x,2)>=11)
THEN 2858 z(1)=focus*((sinh(x(1,1))*cos(x(2,1))*x(1,2)-&
2859 & cosh(x(1,1))*sin(x(2,1))*x(2,2))*x(1,4)*x(1,7)+&
2860 & cosh(x(1,1))*cos(x(2,1))*(x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
2861 & (-cosh(x(1,1))*sin(x(2,1))*x(1,2)-&
2862 & sinh(x(1,1))*cos(x(2,1))*x(2,2))*x(2,4)*x(1,7)-&
2863 & sinh(x(1,1))*sin(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
2864 & (cosh(x(1,1))*cos(x(2,1))*x(1,2)-&
2865 & sinh(x(1,1))*sin(x(2,1))*x(2,2))*x(1,10)+&
2866 & sinh(x(1,1))*cos(x(2,1))*x(1,11)+&
2867 & (-cosh(x(1,1))*sin(x(2,1))*x(1,2)-&
2868 & sinh(x(1,1))*cos(x(2,1))*x(2,2))*x(1,4)*x(2,7)-&
2869 & sinh(x(1,1))*sin(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
2870 & (-sinh(x(1,1))*cos(x(2,1))*x(1,2)+&
2871 & cosh(x(1,1))*sin(x(2,1))*x(2,2))*x(2,4)*x(2,7)-&
2872 & cosh(x(1,1))*cos(x(2,1))*(x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
2873 & (-sinh(x(1,1))*sin(x(2,1))*x(1,2)-&
2874 & cosh(x(1,1))*cos(x(2,1))*x(2,2))*x(2,10)-&
2875 & cosh(x(1,1))*sin(x(2,1))*x(2,11))
2876 z(2)=focus*((cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2877 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2878 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
2879 & x(1,4)*x(1,7)+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2880 & (x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
2881 & (sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
2882 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
2883 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
2884 & x(2,4)*x(1,7)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2885 & (x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
2886 & (-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
2887 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
2888 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
2889 & x(3,4)*x(1,7)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2890 & (x(3,6)*x(1,7)+x(3,4)*x(1,9))+&
2891 & (sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2892 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2893 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*x(1,10)+&
2894 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,11))+&
2895 & focus*((sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
2896 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
2897 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
2898 & x(1,4)*x(2,7)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2899 & (x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
2900 & (-cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)-&
2901 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)+&
2902 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
2903 & x(2,4)*x(2,7)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2904 & (x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
2905 & (-cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)+&
2906 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)-&
2907 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
2908 & x(3,4)*x(2,7)-sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2909 & (x(3,6)*x(2,7)+x(3,4)*x(2,9))+&
2910 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
2911 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
2912 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*x(2,10)+&
2913 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,11))+&
2914 & focus*((-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
2915 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
2916 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
2917 & x(1,4)*x(3,7)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2918 & (x(1,6)*x(3,7)+x(1,4)*x(3,9))+&
2919 & (-cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)+&
2920 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)-&
2921 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
2922 & x(2,4)*x(3,7)-sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2923 & (x(2,6)*x(3,7)+x(2,4)*x(3,9))+&
2924 & (-cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)-&
2925 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)+&
2926 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
2927 & x(3,4)*x(3,7)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2928 & (x(3,6)*x(3,7)+x(3,4)*x(3,9))+&
2929 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
2930 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
2931 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*x(3,10)-&
2932 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2934 z(3)=focus*((cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
2935 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
2936 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
2937 & x(1,4)*x(1,7)+sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2938 & (x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
2939 & (sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
2940 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
2941 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
2942 & x(2,4)*x(1,7)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2943 & (x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
2944 & (sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2945 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2946 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
2947 & x(3,4)*x(1,7)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2948 & (x(3,6)*x(1,7)+x(3,4)*x(1,9))+&
2949 & (sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
2950 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
2951 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*x(1,10)+&
2952 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,11))+&
2953 & focus*((sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
2954 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
2955 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
2956 & x(1,4)*x(2,7)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
2957 & (x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
2958 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
2959 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
2960 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
2961 & x(2,4)*x(2,7)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2962 & (x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
2963 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
2964 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
2965 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
2966 & x(3,4)*x(2,7)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2967 & (x(3,6)*x(2,7)+x(3,4)*x(2,9))+&
2968 & (cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
2969 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
2970 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*x(2,10)+&
2971 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,11))+&
2972 & focus*((sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2973 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2974 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
2975 & x(1,4)*x(3,7)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2976 & (x(1,6)*x(3,7)+x(1,4)*x(3,9))+&
2977 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
2978 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
2979 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
2980 & x(2,4)*x(3,7)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
2981 & (x(2,6)*x(3,7)+x(2,4)*x(3,9))+&
2982 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
2983 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
2984 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
2985 & x(3,4)*x(3,7)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
2986 & (x(3,6)*x(3,7)+x(3,4)*x(3,9))+&
2987 & (cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
2988 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
2989 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*x(3,10)+&
2990 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
2993 CALL flagerror(
"Not enough X derivatives supplied",&
2997 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3001 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 3002 focus=coordinate_system%FOCUS
3003 SELECT CASE(part_deriv_type)
3010 CALL flagerror(
"Not implemented",err,error,*999)
3012 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3015 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3018 CALL flagerror(
"Invalid coordinate type",err,error,*999)
3021 CALL flagerror(
"The sizes of the vectors X and Z do not match",&
3025 exits(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_DP")
3027 999 errorsexits(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_DP",err,error)
3049 INTEGER(INTG),
INTENT(IN) :: PART_DERIV_TYPE
3050 REAL(SP),
INTENT(IN) :: X(:,:)
3051 REAL(SP),
INTENT(OUT) :: Z(:)
3052 INTEGER(INTG),
INTENT(OUT) :: ERR
3057 enters(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_SP",err,error,*999)
3062 IF(
SIZE(x,1)<coordinate_system%NUMBER_OF_DIMENSIONS) &
3063 &
CALL flagerror(
"Size of X is less than the number of dimensions", &
3066 IF(
SIZE(x,1)==
SIZE(z,1))
THEN 3067 SELECT CASE(coordinate_system%TYPE)
3069 IF(
SIZE(x,2)>=part_deriv_type)
THEN 3070 z=x(:,part_deriv_type)
3072 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3075 SELECT CASE(part_deriv_type)
3080 IF(
SIZE(x,2)>=2)
THEN 3081 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3083 z(1)=cos(x(2,1))*x(1,2)-x(1,1)*sin(x(2,1))*x(2,2)
3084 z(2)=sin(x(2,1))*x(1,2)+x(1,1)*cos(x(2,1))*x(2,2)
3086 z(1)=cos(x(2,1))*x(1,2)-x(1,1)*sin(x(2,1))*x(2,2)
3087 z(2)=sin(x(2,1))*x(1,2)+x(1,1)*cos(x(2,1))*x(2,2)
3090 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3093 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3096 CALL flagerror(
"Not implemented",err,error,*999)
3098 IF(
SIZE(x,2)>=4)
THEN 3099 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3101 z(1)=cos(x(2,1))*x(1,4)-x(1,1)*sin(x(2,1))*x(2,4)
3102 z(2)=sin(x(2,1))*x(1,4)+x(1,1)*cos(x(2,1))*x(2,4)
3104 z(1)=cos(x(2,1))*x(1,4)-x(1,1)*sin(x(2,1))*x(2,4)
3105 z(2)=sin(x(2,1))*x(1,4)+x(1,1)*cos(x(2,1))*x(2,4)
3108 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3111 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3114 CALL flagerror(
"Not implemented",err,error,*999)
3116 IF(
SIZE(x,2)>=6)
THEN 3117 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3119 z(1)=cos(x(2,1))*x(1,6)-x(1,2)*sin(x(2,1))*x(2,4)-&
3120 & (x(1,4)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
3121 & x(2,2)*x(2,4)+x(1,1)*sin(x(2,1))*x(2,6))
3122 z(2)=sin(x(2,1))*x(1,6)+x(1,2)*cos(x(2,1))*x(2,4)+&
3123 & (x(1,4)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
3124 & x(2,2)*x(2,4)+x(1,1)*cos(x(2,1))*x(2,6))
3126 z(1)=cos(x(2,1))*x(1,6)-x(1,2)*sin(x(2,1))*x(2,4)-&
3127 & (x(1,4)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
3128 & x(2,2)*x(2,4)+x(1,1)*sin(x(2,1))*x(2,6))
3129 z(2)=sin(x(2,1))*x(1,6)+x(1,2)*cos(x(2,1))*x(2,4)+&
3130 & (x(1,4)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
3131 & x(2,2)*x(2,4)+x(1,1)*cos(x(2,1))*x(2,6))
3134 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3137 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3140 IF(
SIZE(x,2)>=7)
THEN 3141 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3146 z(1)=cos(x(2,1))*x(1,7)-x(1,1)*sin(x(2,1))*x(2,7)
3147 z(2)=sin(x(2,1))*x(1,7)+x(1,1)*cos(x(2,1))*x(2,7)
3150 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3153 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3156 CALL flagerror(
"Not implemented",err,error,*999)
3158 IF(
SIZE(x,2)>=9)
THEN 3159 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3164 z(1)=cos(x(2,1))*x(1,9)-x(1,2)*sin(x(2,1))*x(2,7)-&
3165 & (x(1,7)*sin(x(2,1))*x(2,2)+x(1,1)*cos(x(2,1))*&
3166 & x(2,2)*x(2,7)+x(1,1)*sin(x(2,1))*x(2,9))
3167 z(2)=sin(x(2,1))*x(1,9)+x(1,2)*cos(x(2,1))*x(2,7)+&
3168 & (x(1,7)*cos(x(2,1))*x(2,2)-x(1,1)*sin(x(2,1))*&
3169 & x(2,2)*x(2,7)+x(1,1)*cos(x(2,1))*x(2,9))
3172 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3175 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3178 IF(
SIZE(x,2)>=10)
THEN 3179 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3184 z(1)=cos(x(2,1))*x(1,10)-x(1,4)*sin(x(2,1))*x(2,7)-&
3185 & (x(1,7)*sin(x(2,1))*x(2,4)+x(1,1)*cos(x(2,1))*&
3186 & x(2,4)*x(2,7)+x(1,1)*sin(x(2,1))*x(2,10))
3187 z(2)=sin(x(2,1))*x(1,10)+x(1,4)*cos(x(2,1))*x(2,7)+&
3188 & (x(1,7)*cos(x(2,1))*x(2,4)-x(1,1)*sin(x(2,1))*&
3189 & x(2,4)*x(2,7)+x(1,1)*cos(x(2,1))*x(2,10))
3192 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3195 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3198 IF(
SIZE(x,2)>=11)
THEN 3199 SELECT CASE(coordinate_system%NUMBER_OF_DIMENSIONS)
3204 z(1)=-cos(x(2,1))*x(2,2)*x(2,4)*x(1,7)-&
3205 & sin(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))-&
3206 & sin(x(2,1))*x(2,2)*x(1,10)+cos(x(2,1))*x(1,11)-&
3207 & cos(x(2,1))*x(2,2)*x(1,4)*x(2,7)-&
3208 & sin(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
3209 & (-cos(x(2,1))*x(1,2)+sin(x(2,1))*x(1,1)*x(2,2))*&
3210 & x(2,4)*x(2,7)-x(1,1)*cos(x(2,1))*(x(2,6)*x(2,7)+&
3211 & x(2,4)*x(2,9))+(-sin(x(2,1))*x(1,2)-x(1,1)*&
3212 & cos(x(2,1))*x(2,2))*x(2,10)-x(1,1)*&
3213 & sin(x(2,1))*x(2,11)
3214 z(2)=-sin(x(2,1))*x(2,2)*x(2,4)*x(1,7)+&
3215 & cos(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
3216 & cos(x(2,1))*x(2,2)*x(1,10)+sin(x(2,1))*x(1,11)-&
3217 & sin(x(2,1))*x(2,2)*x(1,4)*x(2,7)+&
3218 & cos(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
3219 & (-sin(x(2,1))*x(1,2)-x(1,1)*cos(x(2,1))*x(2,2))*&
3220 & x(2,4)*x(2,7)-x(1,1)*sin(x(2,1))*(x(2,6)*x(2,7)+&
3221 & x(2,4)*x(2,9))+(cos(x(2,1))*x(1,2)-x(1,1)*&
3222 & sin(x(2,1))*x(2,2))*x(2,10)+x(1,1)*&
3223 & cos(x(2,1))*x(2,11)
3226 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3229 CALL flagerror(
"Not enough X derivatives supplied",err,error,*999)
3232 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3235 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 3236 SELECT CASE(part_deriv_type)
3243 CALL flagerror(
"Not implemented",err,error,*999)
3245 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3248 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3251 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 3252 focus=
REAL(coordinate_system%focus,
sp)
3253 SELECT CASE(part_deriv_type)
3258 IF(
SIZE(x,2)>=2)
THEN 3259 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,2)-&
3260 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,2)
3261 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3262 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3263 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3265 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
3266 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
3267 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3270 CALL flagerror(
"Not enough X derivatives supplied", &
3274 CALL flagerror(
"Not implemented",err,error,*999)
3276 IF(
SIZE(x,2)>=4)
THEN 3277 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,4)-&
3278 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,4)
3279 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,4)+&
3280 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,4)-&
3281 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3283 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,4)+&
3284 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,4)+&
3285 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3288 CALL flagerror(
"Not enough X derivatives supplied",&
3292 CALL flagerror(
"Not implemented",err,error,*999)
3294 IF(
SIZE(x,2)>=6)
THEN 3295 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,6)+&
3296 & x(1,2)*(cosh(x(1,1))*cos(x(2,1))*x(1,4)-&
3297 & sinh(x(1,1))*sin(x(2,1))*x(2,4))-&
3298 & cosh(x(1,1))*sin(x(2,1))*x(2,6)-&
3299 & x(2,2)*(sinh(x(1,1))*sin(x(2,1))*x(1,4)+&
3300 & cosh(x(1,1))*cos(x(2,1))*x(2,4)))
3301 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,6)+&
3302 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3303 & x(1,4)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3304 & x(2,4)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3305 & x(3,4))+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3306 & x(2,6)+x(2,2)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3307 & x(1,4)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,4)-&
3308 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,4))-&
3309 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,6)-&
3310 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3311 & x(1,4)+sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3312 & x(2,4)+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3314 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,6)+&
3315 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3316 & x(1,4)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3317 & x(2,4)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3318 & x(3,4))+sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,6)+&
3319 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3320 & x(1,4)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3321 & x(2,4)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3322 & x(3,4))+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,6)+&
3323 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3324 & x(1,4)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3325 & x(2,4)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3328 CALL flagerror(
"Not enough X derivatives supplied",&
3332 IF(
SIZE(x,2)>=7)
THEN 3333 z(1)=focus*sinh(x(1,1))*cos(x(2,1))*x(1,7)-&
3334 & focus*cosh(x(1,1))*sin(x(2,1))*x(2,7)
3335 z(2)=focus*cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
3336 & focus*sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
3337 & focus*sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3339 z(3)=focus*cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
3340 & focus*sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
3341 & focus*sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3344 CALL flagerror(
"Not enough X derivatives supplied",&
3348 CALL flagerror(
"Not implemented",err,error,*999)
3350 IF(
SIZE(x,2)>=9)
THEN 3351 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,9)+&
3352 & x(1,2)*(cosh(x(1,1))*cos(x(2,1))*x(1,7)-&
3353 & sinh(x(1,1))*sin(x(2,1))*x(2,7))-&
3354 & cosh(x(1,1))*sin(x(2,1))*x(2,9)-&
3355 & x(2,2)*(sinh(x(1,1))*sin(x(2,1))*x(1,7)+&
3356 & cosh(x(1,1))*cos(x(2,1))*x(2,7)))
3357 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,9)+&
3358 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
3359 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
3360 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,7))+&
3361 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,9)+&
3362 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,7)-&
3363 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,7)-&
3364 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,7))-&
3365 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,9)-&
3366 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
3367 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))* x(2,7)+&
3368 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3370 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,9)+&
3371 & x(1,2)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
3372 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
3373 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,7))+&
3374 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,9)+&
3375 & x(2,2)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,7)-&
3376 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,7)+&
3377 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,7))+&
3378 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,9)+&
3379 & x(3,2)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
3380 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
3381 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3384 CALL flagerror(
"Not enough X derivatives supplied",&
3388 IF(
SIZE(x,2)>=10)
THEN 3389 z(1)=focus*(sinh(x(1,1))*cos(x(2,1))*x(1,10)+&
3390 & x(1,4)*(cosh(x(1,1))*cos(x(2,1))*x(1,7)-&
3391 & sinh(x(1,1))*sin(x(2,1))*x(2,7))-&
3392 & cosh(x(1,1))*sin(x(2,1))*x(2,10)-&
3393 & x(2,4)*(sinh(x(1,1))*sin(x(2,1))*x(1,7)+&
3394 & cosh(x(1,1))*cos(x(2,1))*x(2,7)))
3395 z(2)=focus*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,10)+&
3396 & x(1,4)*(sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
3397 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
3398 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,7))+&
3399 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,10)+&
3400 & x(2,4)*(cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,7)-&
3401 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,7)-&
3402 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,7))-&
3403 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,10)-&
3404 & x(3,4)*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
3405 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
3406 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3408 z(3)=focus*(cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,10)+&
3409 & x(1,4)*(sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,7)+&
3410 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,7)+&
3411 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,7))+&
3412 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,10)+&
3413 & x(2,4)*(cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,7)-&
3414 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,7)+&
3415 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,7))+&
3416 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,10)+&
3417 & x(3,4)*(cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,7)+&
3418 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,7)-&
3419 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3422 CALL flagerror(
"Not enough X derivatives supplied",&
3426 IF(
SIZE(x,2)>=11)
THEN 3427 z(1)=focus*((sinh(x(1,1))*cos(x(2,1))*x(1,2)-&
3428 & cosh(x(1,1))*sin(x(2,1))*x(2,2))*x(1,4)*x(1,7)+&
3429 & cosh(x(1,1))*cos(x(2,1))*(x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
3430 & (-cosh(x(1,1))*sin(x(2,1))*x(1,2)-&
3431 & sinh(x(1,1))*cos(x(2,1))*x(2,2))*x(2,4)*x(1,7)-&
3432 & sinh(x(1,1))*sin(x(2,1))*(x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
3433 & (cosh(x(1,1))*cos(x(2,1))*x(1,2)-&
3434 & sinh(x(1,1))*sin(x(2,1))*x(2,2))*x(1,10)+&
3435 & sinh(x(1,1))*cos(x(2,1))*x(1,11)+&
3436 & (-cosh(x(1,1))*sin(x(2,1))*x(1,2)-&
3437 & sinh(x(1,1))*cos(x(2,1))*x(2,2))*x(1,4)*x(2,7)-&
3438 & sinh(x(1,1))*sin(x(2,1))*(x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
3439 & (-sinh(x(1,1))*cos(x(2,1))*x(1,2)+&
3440 & cosh(x(1,1))*sin(x(2,1))*x(2,2))*x(2,4)*x(2,7)-&
3441 & cosh(x(1,1))*cos(x(2,1))*(x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
3442 & (-sinh(x(1,1))*sin(x(2,1))*x(1,2)-&
3443 & cosh(x(1,1))*cos(x(2,1))*x(2,2))*x(2,10)-&
3444 & cosh(x(1,1))*sin(x(2,1))*x(2,11))
3445 z(2)=focus*((cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3446 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3447 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
3448 & x(1,4)*x(1,7)+sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3449 & (x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
3450 & (sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
3451 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
3452 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
3453 & x(2,4)*x(1,7)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3454 & (x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
3455 & (-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
3456 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
3457 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
3458 & x(3,4)*x(1,7)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3459 & (x(3,6)*x(1,7)+x(3,4)*x(1,9))+&
3460 & (sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3461 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3462 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*x(1,10)+&
3463 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,11))+&
3464 & focus*((sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
3465 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
3466 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
3467 & x(1,4)*x(2,7)+cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3468 & (x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
3469 & (-cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)-&
3470 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)+&
3471 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
3472 & x(2,4)*x(2,7)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3473 & (x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
3474 & (-cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)+&
3475 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)-&
3476 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
3477 & x(3,4)*x(2,7)-sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3478 & (x(3,6)*x(2,7)+x(3,4)*x(2,9))+&
3479 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
3480 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
3481 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*x(2,10)+&
3482 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,11))+&
3483 & focus*((-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
3484 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
3485 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
3486 & x(1,4)*x(3,7)-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3487 & (x(1,6)*x(3,7)+x(1,4)*x(3,9))+&
3488 & (-cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)+&
3489 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)-&
3490 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
3491 & x(2,4)*x(3,7)-sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3492 & (x(2,6)*x(3,7)+x(2,4)*x(3,9))+&
3493 & (-cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)-&
3494 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)+&
3495 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
3496 & x(3,4)*x(3,7)-sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3497 & (x(3,6)*x(3,7)+x(3,4)*x(3,9))+&
3498 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
3499 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
3500 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*x(3,10)-&
3501 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3503 z(3)=focus*((cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
3504 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
3505 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
3506 & x(1,4)*x(1,7)+sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3507 & (x(1,6)*x(1,7)+x(1,4)*x(1,9))+&
3508 & (sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
3509 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
3510 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
3511 & x(2,4)*x(1,7)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3512 & (x(2,6)*x(1,7)+x(2,4)*x(1,9))+&
3513 & (sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3514 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3515 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
3516 & x(3,4)*x(1,7)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3517 & (x(3,6)*x(1,7)+x(3,4)*x(1,9))+&
3518 & (sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)+&
3519 & cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)+&
3520 & cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*x(1,10)+&
3521 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,11))+&
3522 & focus*((sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
3523 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
3524 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*&
3525 & x(1,4)*x(2,7)+cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*&
3526 & (x(1,6)*x(2,7)+x(1,4)*x(2,9))+&
3527 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
3528 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
3529 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
3530 & x(2,4)*x(2,7)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3531 & (x(2,6)*x(2,7)+x(2,4)*x(2,9))+&
3532 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
3533 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
3534 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
3535 & x(3,4)*x(2,7)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3536 & (x(3,6)*x(2,7)+x(3,4)*x(2,9))+&
3537 & (cosh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(1,2)-&
3538 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(2,2)+&
3539 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(3,2))*x(2,10)+&
3540 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,11))+&
3541 & focus*((sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3542 & cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3543 & cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*&
3544 & x(1,4)*x(3,7)+cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3545 & (x(1,6)*x(3,7)+x(1,4)*x(3,9))+&
3546 & (cosh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(1,2)-&
3547 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(2,2)-&
3548 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(3,2))*&
3549 & x(2,4)*x(3,7)+sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*&
3550 & (x(2,6)*x(3,7)+x(2,4)*x(3,9))+&
3551 & (-cosh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(1,2)-&
3552 & sinh(x(1,1))*cos(x(2,1))*sin(x(3,1))*x(2,2)-&
3553 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(3,2))*&
3554 & x(3,4)*x(3,7)-sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*&
3555 & (x(3,6)*x(3,7)+x(3,4)*x(3,9))+&
3556 & (cosh(x(1,1))*sin(x(2,1))*cos(x(3,1))*x(1,2)+&
3557 & sinh(x(1,1))*cos(x(2,1))*cos(x(3,1))*x(2,2)-&
3558 & sinh(x(1,1))*sin(x(2,1))*sin(x(3,1))*x(3,2))*x(3,10)+&
3559 & sinh(x(1,1))*sin(x(2,1))*cos(x(3,1))*&
3562 CALL flagerror(
"Not enough X derivatives supplied",&
3566 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3570 IF(coordinate_system%NUMBER_OF_DIMENSIONS==3)
THEN 3571 SELECT CASE(part_deriv_type)
3578 CALL flagerror(
"Not implemented",err,error,*999)
3580 CALL flagerror(
"Invalid partial derivative type",err,error,*999)
3583 CALL flagerror(
"Invalid number of coordinates",err,error,*999)
3586 CALL flagerror(
"Invalid coordinate type",err,error,*999)
3589 CALL flagerror(
"The sizes of the vectors X and Z do not match",&
3593 exits(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_SP")
3595 999 errorsexits(
"COORDINATE_DERIVATIVE_CONVERT_TO_RC_SP",err,error)
3610 INTEGER(INTG),
INTENT(IN) :: PART_DERIV_INDEX
3612 REAL(DP),
INTENT(OUT) :: DERIV_NORM
3613 INTEGER(INTG),
INTENT(OUT) :: ERR
3616 INTEGER(INTG) :: component_idx,NUMBER_OF_COMPONENTS
3617 REAL(DP) :: FOCUS,SL,SM
3620 enters(
"COORDINATE_DERIVATIVE_NORM",err,error,*999)
3623 IF(
ASSOCIATED(coordinate_system))
THEN 3624 IF(
ASSOCIATED(interpolated_point))
THEN 3626 IF(part_deriv_index<=interpolated_point%MAX_PARTIAL_DERIVATIVE_INDEX)
THEN 3627 number_of_components=
SIZE(interpolated_point%VALUES,1)
3628 SELECT CASE(part_deriv_index)
3630 SELECT CASE(coordinate_system%TYPE)
3632 DO component_idx=1,number_of_components
3633 deriv_norm=deriv_norm+interpolated_point%VALUES(component_idx,part_deriv_index)**2
3636 IF(number_of_components==2)
THEN 3637 deriv_norm=interpolated_point%VALUES(1,part_deriv_index)**2+(interpolated_point%VALUES(1,1)* &
3638 & interpolated_point%VALUES(2,part_deriv_index))**2
3639 ELSE IF(number_of_components==3)
THEN 3640 deriv_norm=interpolated_point%VALUES(1,part_deriv_index)**2+(interpolated_point%VALUES(1,1)* &
3641 & interpolated_point%VALUES(2,part_deriv_index))**2+interpolated_point%VALUES(3,part_deriv_index)**2
3643 local_error=
"The number of components for the interpolated point of "// &
3645 &
" is invalid for a cylindrical polar coordinate system." 3646 CALL flagerror(local_error,err,error,*999)
3649 deriv_norm=interpolated_point%VALUES(1,part_deriv_index)**2+(interpolated_point%VALUES(1,1)* &
3650 & interpolated_point%VALUES(2,part_deriv_index)*cos(interpolated_point%VALUES(3,1)))**2+ &
3651 & (interpolated_point%VALUES(1,1)*interpolated_point%VALUES(3,part_deriv_index))**2
3653 focus=coordinate_system%FOCUS
3654 sl=sinh(interpolated_point%VALUES(1,1))
3655 sm=sin(interpolated_point%VALUES(2,1))
3656 deriv_norm=focus*focus*((sl*sl+sm*sm)*(interpolated_point%VALUES(1,part_deriv_index)**2+ &
3657 & interpolated_point%VALUES(2,part_deriv_index))**2)+(sl*sm*interpolated_point%VALUES(3,part_deriv_index))**2
3659 CALL flagerror(
"Not implemented.",err,error,*999)
3661 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
3663 CALL flagerror(local_error,err,error,*999)
3665 deriv_norm=sqrt(deriv_norm)
3667 local_error=
"The partial derivative index of "//
trim(
number_to_vstring(part_deriv_index,
"*",err,error))// &
3669 CALL flagerror(local_error,err,error,*999)
3672 local_error=
"The partial derivative index of "//
trim(
number_to_vstring(part_deriv_index,
"*",err,error))// &
3673 &
" is invalid. The interpolated point has a maximum number of partial derivatives of "// &
3675 CALL flagerror(local_error,err,error,*999)
3678 CALL flagerror(
"The point has not been interpolated to include first derivative values.",err,error,*999)
3681 CALL flagerror(
"Interpolated point is not associated.",err,error,*999)
3684 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
3687 exits(
"COORDINATE_DERIVATIVE_NORM")
3689 999 errorsexits(
"COORDINATE_DERIVATIVE_NORM",err,error)
3702 INTEGER(INTG),
INTENT(IN) :: PARTIAL_DERIVATIVE_INDEX
3703 REAL(DP),
INTENT(INOUT) ::
VALUE 3704 INTEGER(INTG),
INTENT(OUT) :: ERR
3707 REAL(DP) :: COSHX,CSS,D,DES,FOCUS,R,SS,SINHX,THETA
3710 enters(
"COORDINATE_INTERPOLATION_ADJUST",err,error,*999)
3712 IF(
ASSOCIATED(coordinate_system))
THEN 3713 SELECT CASE(coordinate_system%TYPE)
3717 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3725 VALUE=
VALUE/(2.0_dp*r)
3729 & radial_interpolation_type,
"*",err,error))//
" is invalid for a cylindrical coordinate system." 3730 CALL flagerror(local_error,err,error,*999)
3733 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3737 r=
VALUE**(1.0_dp/3.0_dp)
3741 VALUE=
VALUE/(3.0_dp*r*r)
3745 & radial_interpolation_type,
"*",err,error))//
" is invalid for a cylindrical/spherical coordinate system." 3746 CALL flagerror(local_error,err,error,*999)
3749 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3753 focus=coordinate_system%FOCUS
3754 ss=
VALUE/(focus*focus)
3756 coshx=sqrt(1.0_dp+ss)
3758 VALUE=log(sinhx+coshx)
3760 VALUE=
VALUE/(2.0_dp*focus*focus*sinhx*coshx)
3763 focus=coordinate_system%FOCUS
3764 css=
VALUE/(focus**3.0_dp)
3765 des=css*css-4.0_dp/27.0_dp
3767 d=((css+sqrt(des))/2.0_dp)**(1.0_dp/3.0_dp)
3768 coshx=d+1.0_dp/(3.0_dp*d)
3770 theta=acos(css*sqrt(27.0_dp)/2.0_dp)
3771 coshx=2.0_dp/sqrt(3.0_dp)*cos(theta/3.0_dp)
3773 sinhx=sqrt(abs(coshx*coshx-1.0_dp))
3775 VALUE=log(sinhx+coshx)
3777 VALUE=
VALUE/((3.0_dp*coshx*coshx-1.0_dp)*sinhx)/(focus**3.0_dp)
3781 & radial_interpolation_type,
"*",err,error))//
" is invalid for a prolate spheroidal coordinate system." 3782 CALL flagerror(local_error,err,error,*999)
3785 CALL flagerror(
"Not implemented.",err,error,*999)
3787 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
3789 CALL flagerror(local_error,err,error,*999)
3792 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
3795 exits(
"COORDINATE_INTERPOLATION_ADJUST")
3797 999 errorsexits(
"COORDINATE_INTERPOLATION_ADJUST",err,error)
3811 INTEGER(INTG),
INTENT(OUT) :: ERR
3816 enters(
"COORDINATE_INTERPOLATION_PARAMETERS_ADJUST",err,error,*999)
3820 IF(
ASSOCIATED(coordinate_system))
THEN 3821 IF(
ASSOCIATED(interpolation_parameters))
THEN 3822 SELECT CASE(coordinate_system%TYPE)
3826 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3832 & radial_interpolation_type,
"*",err,error))//
" is invalid for a cylindrical coordinate system." 3833 CALL flagerror(local_error,err,error,*999)
3835 CALL flagerror(
"Not implemented",err,error,*999)
3837 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3843 & radial_interpolation_type,
"*",err,error))//
" is invalid for a spherical coordinate system." 3844 CALL flagerror(local_error,err,error,*999)
3846 CALL flagerror(
"Not implemented.",err,error,*999)
3848 SELECT CASE(coordinate_system%RADIAL_INTERPOLATION_TYPE)
3855 & radial_interpolation_type,
"*",err,error))//
" is invalid for a prolate spheroidal coordinate system." 3856 CALL flagerror(local_error,err,error,*999)
3858 CALL flagerror(
"Not implemented.",err,error,*999)
3860 CALL flagerror(
"Not implemented.",err,error,*999)
3862 local_error=
"The coordinate system type of "//
trim(
number_to_vstring(coordinate_system%TYPE,
"*",err,error))// &
3864 CALL flagerror(local_error,err,error,*999)
3867 CALL flagerror(
"Interpolation parameters is not associated.",err,error,*999)
3870 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
3873 exits(
"COORDINATE_INTERPOLATION_PARAMETERS_ADJUST")
3875 999 errorsexits(
"COORDINATE_INTERPOLATION_PARAMETERS_ADJUST",err,error)
3889 REAL(DP),
INTENT(OUT) :: dNudX(:,:)
3890 REAL(DP),
INTENT(OUT) :: dXdNu(:,:)
3891 REAL(DP),
INTENT(OUT) :: dNudXi(:,:)
3892 REAL(DP),
INTENT(OUT) :: dXidNu(:,:)
3893 INTEGER(INTG),
INTENT(OUT) :: err
3896 INTEGER(INTG) :: numberOfXDimensions,numberOfXiDimensions,numberOfNuDimensions,xiIdx
3897 REAL(DP) :: dNudXiTemp(3,3),Jnuxi
3900 enters(
"Coordinates_MaterialSystemCalculate",err,error,*999)
3902 IF(
ASSOCIATED(geometricinterppointmetrics))
THEN 3904 numberofxdimensions=geometricinterppointmetrics%NUMBER_OF_X_DIMENSIONS
3905 numberofxidimensions=geometricinterppointmetrics%NUMBER_OF_XI_DIMENSIONS
3910 IF(
ASSOCIATED(fibreinterppoint))
THEN 3912 numberofnudimensions=
SIZE(fibreinterppoint%values,1)
3913 SELECT CASE(numberofxdimensions)
3918 & numberofnudimensions,1),dxdnu(1:numberofxdimensions,1:numberofxdimensions),err,error,*999)
3921 & numberofnudimensions,1),dxdnu(1:numberofxdimensions,1:numberofxdimensions),err,error,*999)
3923 localerror=
"The number of dimensions in the geometric interpolated point of "// &
3925 &
" is invalid. The number of dimensions must be >= 1 and <= 3." 3926 CALL flagerror(localerror,err,error,*999)
3930 numberofnudimensions=0
3931 DO xiidx=1,numberofxidimensions
3932 dnudxitemp(1:numberofxdimensions,xiidx)=geometricinterppointmetrics%DX_DXI(1:numberofxdimensions,xiidx)
3933 dxdnu(1:numberofxdimensions,xiidx)=
normalise(dnudxitemp(1:numberofxdimensions,xiidx),err,error)
3937 CALL matrixtranspose(dxdnu(1:numberofxdimensions,1:numberofxdimensions),dnudx(1:numberofxdimensions,1: &
3938 & numberofxdimensions),err,error,*999)
3940 CALL matrixproduct(dnudx(1:numberofxdimensions,1:numberofxdimensions), &
3941 & geometricinterppointmetrics%DX_DXI(1:numberofxdimensions,1:numberofxidimensions), &
3942 & dnudxitemp(1:numberofxdimensions,1:numberofxidimensions),err,error,*999)
3945 dnudxi(1:numberofxdimensions,1:numberofxidimensions)=dnudxitemp(1:numberofxdimensions,1:numberofxidimensions)
3947 IF(numberofxdimensions==numberofxidimensions)
THEN 3948 CALL invert(dnudxi(1:numberofxdimensions,1:numberofxidimensions),dxidnu(1:numberofxidimensions,1:numberofxdimensions), &
3949 & jnuxi,err,error,*999)
3951 CALL flagerror(
"Not implemented",err,error,*999)
3963 &
'(" dX_dNu',
'(",I1,",:)',
' :",3(X,E13.6))',
'(18X,3(X,E13.6))',err,error,*999)
3967 &
'(" dNu_dX',
'(",I1,",:)',
' :",3(X,E13.6))',
'(18X,3(X,E13.6))',err,error,*999)
3969 &
determinant(dnudx(1:numberofxdimensions,1:numberofxdimensions),err,error),err,error,*999)
3973 &
'(" dNu_dXi',
'(",I1,",:)',
' :",3(X,E13.6))',
'(18X,3(X,E13.6))',err,error,*999)
3977 &
'(" dXi_dNu',
'(",I1,",:)',
' :",3(X,E13.6))',
'(18X,3(X,E13.6))',err,error,*999)
3982 CALL flagerror(
"Geometric interpolated point metrics is not associated.",err,error,*999)
3985 exits(
"Coordinates_MaterialSystemCalculate")
3987 999 errorsexits(
"Coordinates_MaterialSystemCalculate",err,error)
4001 REAL(DP),
INTENT(IN) :: angle(:)
4002 REAL(DP),
INTENT(OUT) :: dXdNu(:,:)
4003 INTEGER(INTG),
INTENT(OUT) :: err
4006 REAL(DP) :: det,dXdNuR(2,2),R(2,2),f(2),g(2)
4008 enters(
"Coordinates_MaterialSystemCalculatedXdNu2D",err,error,*999)
4010 IF(
ASSOCIATED(geometricinterppointmetrics))
THEN 4015 f(1:2) = [ geometricinterppointmetrics%DX_DXI(1,1),geometricinterppointmetrics%DX_DXI(2,1) ]
4018 g(1:2) = [ -1.0_dp*f(2),f(1) ]
4020 dxdnur(1:2,1) =
normalise(f(1:2),err,error)
4022 dxdnur(1:2,2) =
normalise(g(1:2),err,error)
4026 r(:,1) = [ cos(angle(1)),-1.0_dp*sin(angle(1)) ]
4027 r(:,2) = [ sin(angle(1)),cos(angle(1)) ]
4031 dxdnu(1:2,1) =
normalise(dxdnu(1:2,1),err,error)
4033 dxdnu(1:2,2) =
normalise(dxdnu(1:2,2),err,error)
4040 CALL writestringvector(
diagnostic_output_type,1,1,2,2,2,f,
'(" f :",2(X,E13.6))',
'(20X,2(X,E13.6))', &
4042 CALL writestringvector(
diagnostic_output_type,1,1,2,2,2,g,
'(" g :",2(X,E13.6))',
'(20X,2(X,E13.6))', &
4045 CALL writestringmatrix(
diagnostic_output_type,1,1,2,1,1,2,2,2,dxdnur,
write_string_matrix_name_and_indices, &
4046 &
'(" dX_dNuR',
'(",I1,",:)',
' :",2(X,E13.6))',
'(20X,2(X,E13.6))',err,error,*999)
4051 CALL writestringmatrix(
diagnostic_output_type,1,1,2,1,1,2,2,2,r,
write_string_matrix_name_and_indices, &
4052 &
'(" R',
'(",I1,",:)',
' :",2(X,E13.6))',
'(20X,2(X,E13.6))',err,error,*999)
4055 CALL writestringmatrix(
diagnostic_output_type,1,1,2,1,1,2,2,2,dxdnu,
write_string_matrix_name_and_indices, &
4056 &
'(" dX_dNu',
'(",I1,",:)',
' :",2(X,E13.6))',
'(20X,2(X,E13.6))',err,error,*999)
4062 CALL flagerror(
"Geometry interpolated point metrics is not associated.",err,error,*999)
4065 exits(
"Coordinates_MaterialSystemCalculatedXdNu2D")
4067 999 errorsexits(
"Coordinates_MaterialSystemCalculatedXdNu2D",err,error)
4081 REAL(DP),
INTENT(IN) :: angle(:)
4082 REAL(DP),
INTENT(OUT) :: dXdNu(:,:)
4083 INTEGER(INTG),
INTENT(OUT) :: err
4086 REAL(DP) :: angles(3),det,dXdNu2(3,3),dXdNu3(3,3),dXdNuR(3,3),f(3),g(3),h(3), &
4087 & Raf(3,3),Rbf(3,3),Rai(3,3),Rbi(3,3),Ras(3,3),Rbs(3,3)
4089 enters(
"Coordinates_MaterialSystemCalculatedXdNu3D",err,error,*999)
4091 IF(
ASSOCIATED(geometricinterppointmetrics))
THEN 4095 angles(1:
SIZE(angle,1))=angle(1:
SIZE(angle,1))
4098 f(1:3)=geometricinterppointmetrics%DX_DXI(1:3,1)
4099 CALL crossproduct(geometricinterppointmetrics%DX_DXI(1:3,1),geometricinterppointmetrics%DX_DXI(1:3,2),h,err,error,*999)
4128 rbf(1,1)=cos(angles(1))
4129 rbf(1,2)=-1.0_dp*sin(angles(1))
4130 rbf(2,1)=sin(angles(1))
4131 rbf(2,2)=cos(angles(1))
4150 rbi(1,1)=cos(angles(2))
4151 rbi(1,3)=sin(angles(2))
4152 rbi(3,1)=-1.0_dp*sin(angles(2))
4153 rbi(3,3)=cos(angles(2))
4172 rbs(2,2)=cos(angles(3))
4173 rbs(2,3)=-1.0_dp*sin(angles(3))
4174 rbs(3,2)=sin(angles(3))
4175 rbs(3,3)=cos(angles(3))
4183 CALL writestringvector(
diagnostic_output_type,1,1,3,3,3,f,
'(" f :",3(X,E13.6))',
'(20X,3(X,E13.6))', &
4185 CALL writestringvector(
diagnostic_output_type,1,1,3,3,3,g,
'(" g :",3(X,E13.6))',
'(20X,3(X,E13.6))', &
4187 CALL writestringvector(
diagnostic_output_type,1,1,3,3,3,h,
'(" h :",3(X,E13.6))',
'(20X,3(X,E13.6))', &
4190 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,dxdnur,
write_string_matrix_name_and_indices, &
4191 &
'(" dX_dNuR',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4196 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,raf,
write_string_matrix_name_and_indices, &
4197 &
'(" Ra',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4199 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,rbf,
write_string_matrix_name_and_indices, &
4200 &
'(" Rb',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4203 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,dxdnu3,
write_string_matrix_name_and_indices, &
4204 &
'(" dX_dNu3',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4209 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,rai,
write_string_matrix_name_and_indices, &
4210 &
'(" Ra',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4212 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,rbi,
write_string_matrix_name_and_indices, &
4213 &
'(" Rb',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4216 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,dxdnu2,
write_string_matrix_name_and_indices, &
4217 &
'(" dX_dNu2',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4222 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,ras,
write_string_matrix_name_and_indices, &
4223 &
'(" Ra',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4225 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,rbs,
write_string_matrix_name_and_indices, &
4226 &
'(" Rb',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4229 CALL writestringmatrix(
diagnostic_output_type,1,1,3,1,1,3,3,3,dxdnu,
write_string_matrix_name_and_indices, &
4230 &
'(" dX_dNu',
'(",I1,",:)',
' :",3(X,E13.6))',
'(20X,3(X,E13.6))',err,error,*999)
4236 CALL flagerror(
"Geometry interpolated point metrics is not associated.",err,error,*999)
4239 exits(
"Coordinates_MaterialSystemCalculatedXdNu3D")
4241 999 errorsexits(
"Coordinates_MaterialSystemCalculatedXdNu3D",err,error)
4255 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
4257 INTEGER(INTG),
INTENT(OUT) :: ERR
4260 INTEGER(INTG) :: coord_system_idx
4262 enters(
"COORDINATE_SYSTEM_USER_NUMBER_FIND",err,error,*999)
4264 IF(
ASSOCIATED(coordinate_system))
THEN 4265 CALL flagerror(
"Coordinate_system is already associated.",err,error,*999)
4267 NULLIFY(coordinate_system)
4269 DO WHILE(coord_system_idx<=
coordinate_systems%NUMBER_OF_COORDINATE_SYSTEMS.AND..NOT.
ASSOCIATED(coordinate_system))
4270 IF(
coordinate_systems%COORDINATE_SYSTEMS(coord_system_idx)%PTR%USER_NUMBER==user_number)
THEN 4273 coord_system_idx=coord_system_idx+1
4278 exits(
"COORDINATE_SYSTEM_USER_NUMBER_FIND")
4280 999 errorsexits(
"COORDINATE_SYSTEM_USER_NUMBER_FIND",err,error)
4292 INTEGER(INTG),
INTENT(OUT) :: ERR
4295 INTEGER(INTG) :: coord_system_idx
4297 enters(
"COORDINATE_SYSTEMS_FINALISE",err,error,*999)
4305 exits(
"COORDINATE_SYSTEMS_FINALISE")
4307 999 errorsexits(
"COORDINATE_SYSTEMS_FINALISE",err,error)
4319 INTEGER(INTG),
INTENT(OUT) :: ERR
4323 enters(
"COORDINATE_SYSTEMS_INITIALISE",err,error,*999)
4327 IF(err/=0)
CALL flagerror(
"Could not allocate coordinate systems.",err,error,*999)
4330 IF(err/=0)
CALL flagerror(
"Could not allocate world coordinate system.",err,error,*999)
4337 & (/1.0_dp,0.0_dp,0.0_dp, &
4338 & 0.0_dp,1.0_dp,0.0_dp, &
4339 & 0.0_dp,0.0_dp,1.0_dp/), &
4344 exits(
"COORDINATE_SYSTEMS_INITIALISE")
4346 999 errorsexits(
"COORDINATE_SYSTEMS_INITIALISE",err,error)
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
real(dp) function, dimension(size(x, 1)) coordinate_convert_to_rc_dp(COORDINATE_SYSTEM, X, ERR, ERROR)
COORDINATE_CONVERT_TO_RC_DP performs a coordinate transformation from a coordinate system identified ...
integer(intg), parameter, public coordinate_no_radial_interpolation_type
No radial interpolation.
This module contains all coordinate transformation and support routines.
integer(intg), parameter, public coordinate_prolate_spheroidal_type
Prolate spheroidal coordinate system type.
Returns the inverse of a matrix.
subroutine coordinate_derivative_convert_to_rc_sp(COORDINATE_SYSTEM, PART_DERIV_TYPE, X, Z, ERR, ERROR,)
real(sp), parameter zero_tolerance_sp
The zero tolerance for single precision zero tests i.e., if(abs(x)>zero_tolerance) then...
Converts a number to its equivalent varying string representation.
subroutine, public coordinate_system_origin_get(COORDINATE_SYSTEM, ORIGIN, ERR, ERROR,)
Returns the origin of a coordinate system.
real(dp) function, dimension(size(x, 1)) d2zx_dp(COORDINATE_SYSTEM, I, J, X, ERR, ERROR)
real(dp), parameter pi
The double precision value of pi.
integer(intg), parameter no_part_deriv
No partial derivative i.e., u.
integer(intg), parameter, public coordinate_jacobian_area_type
Area type Jacobian.
subroutine, public coordinate_systems_initialise(ERR, ERROR,)
Initialises the coordinate systems and creates the world coordinate system.
integer(intg), dimension(4) partial_derivative_second_derivative_map
PARTIAL_DERIVATIVE_SECOND_DERIVATIVE_MAP(nic) gives the partial derivative index for the second deriv...
subroutine, public coordinate_interpolation_parameters_adjust(COORDINATE_SYSTEM, INTERPOLATION_PARAMETERS, ERR, ERROR,)
Adjusts the interpolation parameters for non-rectangular cartesian coordinate systems.
This module contains all string manipulation and transformation routines.
integer(intg), parameter, public coordinate_jacobian_line_type
Line type Jacobian.
integer(intg), parameter first_part_deriv
First partial derivative i.e., du/ds.
A buffer type to allow for an array of pointers to a COORDINATE_SYSTEM_TYPE.
subroutine coordinate_system_normal_calculate(COORDINATE_SYSTEM, REVERSE, X, N, ERR, ERROR,)
Calculates the normal vector, N, at the point X. IF REVERSE is true the reversed normal is returned...
integer(intg), parameter part_deriv_s2
First partial derivative in the s2 direction i.e., du/ds2.
subroutine coordinate_system_finalise(COORDINATE_SYSTEM, ERR, ERROR,)
Finalises a coordinate system and deallocates all memory.
subroutine, public coordinate_derivative_norm(COORDINATE_SYSTEM, PART_DERIV_INDEX, INTERPOLATED_POINT, DERIV_NORM, ERR, ERROR,)
Calculates the norm of a derivative in a coordinate system identified by COORDINATE_SYSTEM at the giv...
integer(intg), parameter, public coordinate_jacobian_no_type
No Jacobian.
real(sp) function, dimension(size(z, 1)) coordinate_convert_from_rc_sp(COORDINATE_SYSTEM, Z, ERR, ERROR)
COORDINATE_CONVERT_FROM_RC_SP performs a coordinate transformation from a rectangular cartesian coord...
This module contains all mathematics support routines.
logical, save, public diagnostics2
.TRUE. if level 2 diagnostic output is active in the current routine
subroutine, public coordinate_system_dimension_set(COORDINATE_SYSTEM, DIMENSION, ERR, ERROR,)
Sets/changes the dimension of the coordinate system.
subroutine, public coordinate_system_user_number_find(USER_NUMBER, COORDINATE_SYSTEM, ERR, ERROR,)
Returns a pointer to the coordinate system identified by USER_NUMBER. If a coordinate system with tha...
type(coordinate_systems_type) coordinate_systems
subroutine, public coordinate_system_create_start(USER_NUMBER, COORDINATE_SYSTEM, ERR, ERROR,)
Starts the creation of and initialises a new coordinate system.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
Contains information on a coordinate system.
This module contains all program wide constants.
Calculates the normalised vector cross product of two vectors.
integer(intg), parameter part_deriv_s1
First partial derivative in the s1 direction i.e., du/ds1.
Flags a warning to the user.
subroutine, public coordinate_system_origin_set(COORDINATE_SYSTEM, ORIGIN, ERR, ERROR,)
Sets/changes the origin of a coordinate system.
Contains the interpolated point coordinate metrics. Old CMISS name GL,GU,RG.
subroutine, public coordinate_system_focus_get(COORDINATE_SYSTEM, FOCUS, ERR, ERROR,)
Returns the coordinate system focus.
subroutine, public coordinate_system_dimension_get(COORDINATE_SYSTEM, NUMBER_OF_DIMENSIONS, ERR, ERROR,)
Gets the coordinate system dimension.
real(dp) function, dimension(size(x, 1)) dxz_dp(COORDINATE_SYSTEM, I, X, ERR, ERROR)
Calculates DX(:)/DZ(I) at X, where Z(I) are rectangular cartesian and X(:) are curvilinear coordinate...
subroutine coordinate_derivative_convert_to_rc_dp(COORDINATE_SYSTEM, PART_DERIV_TYPE, X, Z, ERR, ERROR,)
subroutine, public coordinates_materialsystemcalculate(geometricInterpPointMetrics, fibreInterpPoint, dNudX, dXdNu, dNudXi, dXidNu, err, error,)
Calculates the tensor to get from material coordinate system, nu, to local coordinate system...
integer(intg), parameter, public coordinate_radial_cubed_interpolation_type
r^3 radial interpolation
subroutine, public coordinates_radialinterpolationtypeget(coordinateSystem, radialInterpolationType, err, error,)
Gets the coordinate system radial interpolation type.
subroutine, public coordinate_interpolation_adjust(COORDINATE_SYSTEM, PARTIAL_DERIVATIVE_INDEX, VALUE, ERR, ERROR,)
Adjusts the interpolation for non-rectangular cartesian coordinate systems.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
subroutine, public coordinate_system_orientation_get(COORDINATE_SYSTEM, ORIENTATION, ERR, ERROR,)
Returns the orientation of a coordinate system.
This module contains all type definitions in order to avoid cyclic module references.
integer(intg), parameter part_deriv_s3
First partial derivative in the s3 direction i.e., du/ds3.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
COORDINATE_CONVERT_FROM_RC performs a coordinate transformation from a rectangular cartesian coordina...
character(len=21), dimension(5), public coordinate_system_type_string
integer(intg), parameter, public coordinate_cylindrical_polar_type
Cylindrical polar coordinate system type.
integer(intg), parameter part_deriv_s1_s1
Second partial derivative in the s1 direction i.e., d^2u/ds1ds1.
Calculates DX(:)/DZ(I) at X, where Z(I) are rectangular cartesian and X(:) are curvilinear coordinate...
Returns the transpose of a matrix A in A^T.
integer, parameter sp
Single precision real kind.
subroutine coordinates_materialsystemcalculatedxdnu2d(geometricInterpPointMetrics, angle, dXdNu, err, error,)
Calculates transformation between spatial CS and rotated reference orthogonal material CS in 2D space...
integer(intg), parameter part_deriv_s2_s3
Cross derivative in the s2 and s3 direction i.e., d^2u/ds2ds3.
integer(intg), parameter part_deriv_s1_s3
Cross derivative in the s1 and s3 direction i.e., d^2u/ds1ds3.
subroutine, public coordinate_system_destroy(COORDINATE_SYSTEM, ERR, ERROR,)
Destroys a coordinate system.
subroutine, public coordinate_system_type_get(COORDINATE_SYSTEM, SYSTEM_TYPE, ERR, ERROR,)
Gets the coordinate system type.
integer(intg), dimension(4) partial_derivative_first_derivative_map
PARTIAL_DERIVATIVE_FIRST_DERIVATIVE_MAP(nic) gives the partial derivative index for the first derivat...
subroutine coordinates_materialsystemcalculatedxdnu3d(geometricInterpPointMetrics, angle, dXdNu, err, error,)
Calculates transformation between spatial CS and rotated reference orthogonal material CS in 3D space...
subroutine, public coordinate_metrics_calculate(COORDINATE_SYSTEM, JACOBIAN_TYPE, METRICS, ERR, ERROR,)
Calculates the covariant metric tensor GL(i,j), the contravariant metric tensor GU(i,J), the Jacobian and derivative of the interpolated coordinate system (XI_i) with respect to the given coordinate (X_j) system (DXI_DX) at a point (X - normally a Gauss point). Old cmiss name: XGMG.
integer(intg), parameter, public coordinate_rectangular_cartesian_type
Rectangular Cartesian coordinate system type.
real(dp) function, dimension(size(x, 1)) coordinate_delta_calculate_dp(COORDINATE_SYSTEM, X, Y, ERR, ERROR)
Calculates the difference (or detlta) between the point X and the point Y i.e., Y-X, in the given coordinate system. 0->2Pi discontinuities with polar coordinates are accounted for.
Returns the determinant of a matrix.
COORDINATE_CONVERT_TO_RC performs a coordinate transformation from a coordinate system identified by ...
real(dp) function, dimension(size(x, 1)) dzx_dp(COORDINATE_SYSTEM, I, X, ERR, ERROR)
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
Calculates the vector cross product of two vectors.
Contains the interpolated value (and the derivatives wrt xi) of a field at a point. Old CMISS name XG.
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
integer(intg), parameter part_deriv_s1_s2
Cross derivative in the s1 and s2 direction i.e., d^2u/ds1ds2.
integer(intg), parameter part_deriv_s2_s2
Second partial derivative in the s2 direction i.e., d^2u/ds2ds2.
subroutine, public coordinate_system_type_set(COORDINATE_SYSTEM, TYPE, ERR, ERROR,)
Sets/changes the type of a coordinate system.
subroutine, public coordinate_system_create_finish(COORDINATE_SYSTEM, ERR, ERROR,)
Finishes the creation of a new coordinate system.
Returns the identity matrix.
Calculates the difference (or delta) between two points in a coordinate system. Discontinuities for p...
integer(intg), parameter part_deriv_s3_s3
Second partial derivative in the s3 direction i.e., d^2u/ds3ds3.
Contains the parameters required to interpolate a field variable within an element. Old CMISS name XE.
integer(intg), parameter, public coordinate_oblate_spheroidal_type
Oblate spheroidal coordinate system type.
subroutine, public coordinate_system_orientation_set(COORDINATE_SYSTEM, ORIENTATION, ERR, ERROR,)
Sets/changes the orientation of a coordinate system.
integer(intg), parameter, public coordinate_jacobian_volume_type
Volume type Jacobian.
Returns the L2 norm of a vector.
integer(intg), parameter, public coordinate_radial_squared_interpolation_type
r^2 radial interpolation
Flags an error condition.
subroutine, public coordinate_systems_finalise(ERR, ERROR,)
Finalises the coordinate systems and destroys all coordinate systems.
Calculates and returns the matrix-product A*B in the matrix C.
integer(intg), parameter, public coordinate_radial_interpolation_type
r radial interpolation
real(dp), parameter zero_tolerance
subroutine, public coordinates_radialinterpolationtypeset(coordinateSystem, radialInterpolationType, err, error,)
Sets/changes the radial interpolation type of a coordinate system.
subroutine, public coordinate_system_focus_set(COORDINATE_SYSTEM, FOCUS, ERR, ERROR,)
Sets/changes the focus of a coordinate system.
This module contains all kind definitions.
real(sp) function, dimension(size(x, 1)) coordinate_convert_to_rc_sp(COORDINATE_SYSTEM, X, ERR, ERROR)
COORDINATE_CONVERT_TO_RC_SP performs a coordinate transformation from a coordinate system identified ...
integer(intg), parameter part_deriv_s1_s2_s3
Cross derivative in the s1, s2 and s3 direction i.e., d^3u/ds1ds2ds3.
real(dp) function, dimension(size(z, 1)) coordinate_convert_from_rc_dp(COORDINATE_SYSTEM, Z, ERR, ERROR)
Performs a coordinate transformation from a rectangular cartesian coordinate at the point with coordi...
integer(intg), parameter, public coordinate_spherical_polar_type
Spherical polar coordinate system type.