Calculates the half squared strain rate on l_w-points which is used in determining the Richardson number. CX=1./DX, CY=1./DY, RDZ(K)=1./DZ(K), RDZN(K) =1./DZN(K) _SSQ= 0.5*^^DU_I/DX_J+DU_J/DX_I^^**2 _SSQIJ= (DU_I/DX_J+DU_J/DX_I)**2 _Hence SSQ= SUM(I,J) {0.5*(SSQIJ)}.
409 type(model_state_type),
target,
intent(inout) :: current_state
410 type(prognostic_field_type),
intent(inout) :: u, v, w
411 real(kind=DEFAULT_PRECISION) :: calculate_half_squared_strain_rate(current_state%local_grid%size(z_index))
414 real(kind=DEFAULT_PRECISION) :: ssq11, ssq22, ssq33, ssq13, ssq23, ssq12
416 do k=2,current_state%local_grid%size(z_index)-1
418 ssq11=current_state%global_grid%configuration%horizontal%cx2*(&
419 (u%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
420 u%data(k+1, current_state%column_local_y, current_state%column_local_x-1))**2+&
421 (u%data(k, current_state%column_local_y, current_state%column_local_x)-&
422 u%data(k, current_state%column_local_y, current_state%column_local_x-1))**2)
424 ssq11=0.0_default_precision
427 ssq22=current_state%global_grid%configuration%horizontal%cy2*(&
428 (v%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
429 v%data(k+1, current_state%column_local_y-1, current_state%column_local_x))**2+&
430 (v%data(k, current_state%column_local_y, current_state%column_local_x)-&
431 v%data(k, current_state%column_local_y-1, current_state%column_local_x))**2)
433 ssq22=0.0_default_precision
436 ssq33=((w%data(k, current_state%column_local_y, current_state%column_local_x)-&
437 w%data(k-1, current_state%column_local_y, current_state%column_local_x))*&
438 current_state%global_grid%configuration%vertical%rdz(k))**2 +&
439 ((w%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
440 w%data(k, current_state%column_local_y, current_state%column_local_x))*&
441 current_state%global_grid%configuration%vertical%rdz(k+1))**2
443 ssq33=0.0_default_precision
445 #if defined(U_ACTIVE) && defined(W_ACTIVE) 447 ssq13=(((u%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
448 u%data(k, current_state%column_local_y, current_state%column_local_x))*&
449 current_state%global_grid%configuration%vertical%rdzn(k+1)+&
450 (w%data(k, current_state%column_local_y, current_state%column_local_x+1)-&
451 w%data(k, current_state%column_local_y, current_state%column_local_x))*&
452 current_state%global_grid%configuration%horizontal%cx)**2+&
453 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x-1)-&
454 u%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
455 current_state%global_grid%configuration%vertical%rdzn(k+1)+&
456 (w%data(k, current_state%column_local_y, current_state%column_local_x)-&
457 w%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
458 current_state%global_grid%configuration%horizontal%cx)**2)*0.5_default_precision
459 #elif defined(U_ACTIVE) && !defined(W_ACTIVE) 460 ssq13=(((u%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
461 u%data(k, current_state%column_local_y, current_state%column_local_x))*&
462 current_state%global_grid%configuration%vertical%rdzn(k+1))**2+&
463 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x-1)-&
464 u%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
465 current_state%global_grid%configuration%vertical%rdzn(k+1))**2)*0.5_default_precision
466 #elif !defined(U_ACTIVE) && defined(W_ACTIVE) 467 ssq13=(((w%data(k, current_state%column_local_y, current_state%column_local_x+1)-&
468 w%data(k, current_state%column_local_y, current_state%column_local_x))*&
469 current_state%global_grid%configuration%horizontal%cx)**2+&
470 ((w%data(k, current_state%column_local_y, current_state%column_local_x)-&
471 w%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
472 current_state%global_grid%configuration%horizontal%cx)**2)*0.5_default_precision
474 ssq13=0.0_default_precision
476 #if defined(W_ACTIVE) && defined(V_ACTIVE) 478 ssq23=(((w%data(k, current_state%column_local_y, current_state%column_local_x)-&
479 w%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
480 current_state%global_grid%configuration%horizontal%cy+&
481 (v%data(k+1, current_state%column_local_y-1, current_state%column_local_x)-&
482 v%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
483 current_state%global_grid%configuration%vertical%rdzn(k+1))**2+&
484 ((w%data(k, current_state%column_local_y+1, current_state%column_local_x)-&
485 w%data(k, current_state%column_local_y, current_state%column_local_x))*&
486 current_state%global_grid%configuration%horizontal%cy+&
487 (v%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
488 v%data(k, current_state%column_local_y, current_state%column_local_x))*&
489 current_state%global_grid%configuration%vertical%rdzn(k+1))**2)*0.5_default_precision
490 #elif defined(W_ACTIVE) && !defined(V_ACTIVE) 491 ssq23=(((w%data(k, current_state%column_local_y, current_state%column_local_x)-&
492 w%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
493 current_state%global_grid%configuration%horizontal%cy)**2+&
494 ((w%data(k, current_state%column_local_y+1, current_state%column_local_x)-&
495 w%data(k, current_state%column_local_y, current_state%column_local_x))*&
496 current_state%global_grid%configuration%horizontal%cy)**2)*0.5_default_precision
497 #elif !defined(W_ACTIVE) && defined(V_ACTIVE) 498 ssq23=(((v%data(k+1, current_state%column_local_y-1, current_state%column_local_x)-&
499 v%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
500 current_state%global_grid%configuration%vertical%rdzn(k+1))**2+&
501 ((v%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
502 v%data(k, current_state%column_local_y, current_state%column_local_x))*&
503 current_state%global_grid%configuration%vertical%rdzn(k+1))**2)*0.5_default_precision
505 ssq23=0.0_default_precision
508 #if defined(U_ACTIVE) && defined(V_ACTIVE) 510 ssq12=(((((u%data(k, current_state%column_local_y, current_state%column_local_x-1)-&
511 u%data(k, current_state%column_local_y-1, current_state%column_local_x-1))*&
512 current_state%global_grid%configuration%horizontal%cy+&
513 (v%data(k, current_state%column_local_y-1, current_state%column_local_x)-&
514 v%data(k, current_state%column_local_y-1, current_state%column_local_x-1))*&
515 current_state%global_grid%configuration%horizontal%cx)**2 +&
516 ((u%data(k, current_state%column_local_y+1, current_state%column_local_x-1)-&
517 u%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
518 current_state%global_grid%configuration%horizontal%cy+&
519 (v%data(k, current_state%column_local_y, current_state%column_local_x)-&
520 v%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
521 current_state%global_grid%configuration%horizontal%cx)**2) +(&
522 ((u%data(k, current_state%column_local_y, current_state%column_local_x)-&
523 u%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
524 current_state%global_grid%configuration%horizontal%cy+&
525 (v%data(k, current_state%column_local_y-1, current_state%column_local_x+1)-&
526 v%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
527 current_state%global_grid%configuration%horizontal%cx)**2 +&
528 ((u%data(k, current_state%column_local_y+1, current_state%column_local_x)-&
529 u%data(k, current_state%column_local_y, current_state%column_local_x))*&
530 current_state%global_grid%configuration%horizontal%cy+&
531 (v%data(k, current_state%column_local_y, current_state%column_local_x+1)-&
532 v%data(k, current_state%column_local_y, current_state%column_local_x))*&
533 current_state%global_grid%configuration%horizontal%cx)**2))+((&
534 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x-1)-&
535 u%data(k+1, current_state%column_local_y-1, current_state%column_local_x-1))*&
536 current_state%global_grid%configuration%horizontal%cy+&
537 (v%data(k+1, current_state%column_local_y-1, current_state%column_local_x)-&
538 v%data(k+1, current_state%column_local_y-1, current_state%column_local_x-1))*&
539 current_state%global_grid%configuration%horizontal%cx)**2+&
540 ((u%data(k+1, current_state%column_local_y+1, current_state%column_local_x-1)-&
541 u%data(k+1, current_state%column_local_y, current_state%column_local_x-1))*&
542 current_state%global_grid%configuration%horizontal%cy+&
543 (v%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
544 v%data(k+1, current_state%column_local_y, current_state%column_local_x-1))*&
545 current_state%global_grid%configuration%horizontal%cx)**2)+(&
546 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
547 u%data(k+1, current_state%column_local_y-1, current_state%column_local_x))*&
548 current_state%global_grid%configuration%horizontal%cy+&
549 (v%data(k+1, current_state%column_local_y-1, current_state%column_local_x+1)-&
550 v%data(k+1, current_state%column_local_y-1, current_state%column_local_x))*&
551 current_state%global_grid%configuration%horizontal%cx)**2+&
552 ((u%data(k+1, current_state%column_local_y+1, current_state%column_local_x)-&
553 u%data(k+1, current_state%column_local_y, current_state%column_local_x))*&
554 current_state%global_grid%configuration%horizontal%cy+&
555 (v%data(k+1, current_state%column_local_y, current_state%column_local_x+1)-&
556 v%data(k+1, current_state%column_local_y, current_state%column_local_x))*&
557 current_state%global_grid%configuration%horizontal%cx)**2)))*0.125_default_precision
559 #elif defined(U_ACTIVE) && !defined(V_ACTIVE) 561 ssq12=(((((u%data(k, current_state%column_local_y, current_state%column_local_x-1)-&
562 u%data(k, current_state%column_local_y-1, current_state%column_local_x-1))*&
563 current_state%global_grid%configuration%horizontal%cy)**2 +&
564 ((u%data(k, current_state%column_local_y+1, current_state%column_local_x-1)-&
565 u%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
566 current_state%global_grid%configuration%horizontal%cy)**2) +(&
567 ((u%data(k, current_state%column_local_y, current_state%column_local_x)-&
568 u%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
569 current_state%global_grid%configuration%horizontal%cy)**2 +&
570 ((u%data(k, current_state%column_local_y+1, current_state%column_local_x)-&
571 u%data(k, current_state%column_local_y, current_state%column_local_x))*&
572 current_state%global_grid%configuration%horizontal%cy)**2))+((&
573 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x-1)-&
574 u%data(k+1, current_state%column_local_y-1, current_state%column_local_x-1))*&
575 current_state%global_grid%configuration%horizontal%cy)**2+&
576 ((u%data(k+1, current_state%column_local_y+1, current_state%column_local_x-1)-&
577 u%data(k+1, current_state%column_local_y, current_state%column_local_x-1))*&
578 current_state%global_grid%configuration%horizontal%cy)**2)+(&
579 ((u%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
580 u%data(k+1, current_state%column_local_y-1, current_state%column_local_x))*&
581 current_state%global_grid%configuration%horizontal%cy)**2+&
582 ((u%data(k+1, current_state%column_local_y+1, current_state%column_local_x)-&
583 u%data(k+1, current_state%column_local_y, current_state%column_local_x))*&
584 current_state%global_grid%configuration%horizontal%cy)**2)))*0.125_default_precision
586 #elif !defined(U_ACTIVE) && defined(V_ACTIVE) 588 ssq12=(((((v%data(k, current_state%column_local_y-1, current_state%column_local_x)-&
589 v%data(k, current_state%column_local_y-1, current_state%column_local_x-1))*&
590 current_state%global_grid%configuration%horizontal%cx)**2 +&
591 ((v%data(k, current_state%column_local_y, current_state%column_local_x)-&
592 v%data(k, current_state%column_local_y, current_state%column_local_x-1))*&
593 current_state%global_grid%configuration%horizontal%cx)**2) +&
594 (((v%data(k, current_state%column_local_y-1, current_state%column_local_x+1)-&
595 v%data(k, current_state%column_local_y-1, current_state%column_local_x))*&
596 current_state%global_grid%configuration%horizontal%cx)**2 +&
597 ((v%data(k, current_state%column_local_y, current_state%column_local_x+1)-&
598 v%data(k, current_state%column_local_y, current_state%column_local_x))*&
599 current_state%global_grid%configuration%horizontal%cx)**2))+((&
600 ((v%data(k+1, current_state%column_local_y-1, current_state%column_local_x)-&
601 v%data(k+1, current_state%column_local_y-1, current_state%column_local_x-1))*&
602 current_state%global_grid%configuration%horizontal%cx)**2+&
603 ((v%data(k+1, current_state%column_local_y, current_state%column_local_x)-&
604 v%data(k+1, current_state%column_local_y, current_state%column_local_x-1))*&
605 current_state%global_grid%configuration%horizontal%cx)**2)+(&
606 ((v%data(k+1, current_state%column_local_y-1, current_state%column_local_x+1)-&
607 v%data(k+1, current_state%column_local_y-1, current_state%column_local_x))*&
608 current_state%global_grid%configuration%horizontal%cx)**2+&
609 ((v%data(k+1, current_state%column_local_y, current_state%column_local_x+1)-&
610 v%data(k+1, current_state%column_local_y, current_state%column_local_x))*&
611 current_state%global_grid%configuration%horizontal%cx)**2)))*0.125_default_precision
613 ssq12=0.0_default_precision
615 calculate_half_squared_strain_rate(k)=ssq11+ssq22+ssq33+ssq13+ssq23+ssq12+smallp