Ignore:
Timestamp:
05/06/19 16:53:07 (5 years ago)
Author:
dubos
Message:

devel : moved DYSL into compute_caldyn_fast.F90

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/src/dynamics/compute_caldyn_fast.F90

    r855 r858  
    44  PRIVATE 
    55 
     6#include "../unstructured/unstructured.h90" 
     7 
    68  PUBLIC :: compute_caldyn_fast 
    79 
    810CONTAINS 
     11 
     12#ifdef BEGIN_DYSL 
     13 
     14KERNEL(caldyn_fast) 
     15! 
     16  SELECT CASE(caldyn_thermo) 
     17  CASE(thermo_boussinesq) 
     18    FORALL_CELLS() 
     19      ON_PRIMAL 
     20        berni(CELL) = pk(CELL) 
     21        ! from now on pk contains the vertically-averaged geopotential 
     22        pk(CELL) = .5*(geopot(CELL)+geopot(UP(CELL))) 
     23      END_BLOCK 
     24    END_BLOCK 
     25  CASE(thermo_theta) 
     26    FORALL_CELLS() 
     27      ON_PRIMAL 
     28        berni(CELL) = .5*(geopot(CELL)+geopot(UP(CELL))) 
     29      END_BLOCK 
     30    END_BLOCK 
     31  CASE(thermo_entropy) 
     32    FORALL_CELLS() 
     33      ON_PRIMAL 
     34        berni(CELL) = .5*(geopot(CELL)+geopot(UP(CELL))) 
     35        berni(CELL) = berni(CELL) + pk(CELL)*(cpp-theta(CELL,1)) ! Gibbs = Cp.T-Ts = T(Cp-s) 
     36      END_BLOCK 
     37    END_BLOCK 
     38  CASE(thermo_variable_Cp) 
     39    ! thermodynamics with variable Cp 
     40    !           Cp(T) = Cp0 * (T/T0)^nu 
     41    ! =>            h = Cp(T).T/(nu+1) 
     42 
     43    FORALL_CELLS() 
     44      ON_PRIMAL 
     45        berni(CELL) = .5*(geopot(CELL)+geopot(UP(CELL))) 
     46        cp_ik = cpp*(pk(CELL)/Treff)**nu 
     47        berni(CELL) = berni(CELL) + pk(CELL)*(cp_ik/(nu+1.)-theta(CELL,1)) ! Gibbs = h-Ts = T(Cp/(nu+1)-s) 
     48      END_BLOCK 
     49    END_BLOCK 
     50  CASE DEFAULT 
     51    PRINT *, 'Unsupported value of caldyn_thermo : ',caldyn_thermo  ! FIXME 
     52    STOP 
     53  END SELECT 
     54! 
     55  FORALL_CELLS() 
     56    ON_EDGES 
     57      due = .5*(theta(CELL1,1)+theta(CELL2,1))*(pk(CELL2)-pk(CELL1)) + berni(CELL2)-berni(CELL1) 
     58      du(EDGE) = du(EDGE) - SIGN*due 
     59      u(EDGE) = u(EDGE) + tau*du(EDGE) 
     60    END_BLOCK 
     61  END_BLOCK   
     62! 
     63END_BLOCK 
     64 
     65#endif END_DYSL 
     66 
     67  SUBROUTINE compute_caldyn_fast_unst(tau, pk,berni,theta,geopot, du,u) 
     68    USE ISO_C_BINDING, only : C_DOUBLE, C_FLOAT 
     69    USE earth_const 
     70    USE grid_param, ONLY : nqdyn 
     71    USE data_unstructured_mod, ONLY : enter_trace, exit_trace, & 
     72         id_fast, primal_num, dual_num, edge_num, & 
     73         dual_deg, dual_edge, dual_ne, dual_vertex, & 
     74         up, down, left, right, Av, fv, Riv2 
     75    NUM, INTENT(IN) :: tau 
     76    FIELD_MASS   :: pk,berni  ! INOUT, OUT 
     77    FIELD_THETA  :: theta     ! IN 
     78    FIELD_GEOPOT :: geopot    ! IN 
     79    FIELD_U      :: u,du      ! INOUT,INOUT 
     80    DECLARE_INDICES 
     81    DECLARE_EDGES 
     82    NUM          :: due, cp_ik 
     83    START_TRACE(id_fast, 4,0,2) ! primal, dual, edge 
     84#include "../kernels_unst/caldyn_fast.k90" 
     85    STOP_TRACE 
     86  END SUBROUTINE compute_caldyn_fast_unst 
    987 
    1088  SUBROUTINE compute_caldyn_fast(tau,u,rhodz,theta,pk,geopot,du) 
Note: See TracChangeset for help on using the changeset viewer.