Index: /palm/trunk/SOURCE/lpm_exchange_horiz.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 2808)
+++ /palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 2809)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE.
+! Preprocessor directive(__gfortran) for c_sizeof removed.
+! 
+! 2801 2018-02-14 16:01:55Z thiele
 ! Introduce particle transfer in nested models.
 ! 
@@ -446,24 +450,9 @@
     ENDDO
 
-#if defined( __gfortran )
-!
-!--    For the gfortran compiler the function c_sizeof produces strange erros 
-!--    which can probably be attributed to an error in the gfortran compiler.
-!--    Therefore the particle size in bytes is set manually. Attention: A 
-!--    change of the size of the particle type requires an adjustment of 
-!--    this value
-       par_size = 184
-#else
-!      
-!--    This MPI_SENDRECV should work even with odd mixture on 32 and 64 Bit 
-!--    variables in structure particle_type (due to the calculation of par_size).
-!--    Please note, in case of 1D decomposition ( only 1 core along 
-!--    x dimension), array trlp is not allocated, leading to program crash. 
-!--    Hence, check if array is allocated and allocate it temporarily if 
-!--    if required.
-       IF ( .NOT. ALLOCATED( trlp ) )  ALLOCATE( trlp(1:1) )
-
-       par_size = c_sizeof(trlp(1))
-#endif
+!
+!-- STORAGE_SIZE returns the storage size of argument A in bits. However , it 
+!-- is needed in bytes. The function C_SIZEOF which produces this value directly
+!-- causes problems with gfortran. For this reason the use of C_SIZEOF is avoided
+    par_size = STORAGE_SIZE(trlp(1))/8
 
 
Index: /palm/trunk/SOURCE/pmc_child_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_child_mod.f90	(revision 2808)
+++ /palm/trunk/SOURCE/pmc_child_mod.f90	(revision 2809)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
+! 
+! 2801 2018-02-14 16:01:55Z thiele
 ! Introduce particle transfer in nested models.
 ! 
@@ -314,5 +317,5 @@
 
 
-    win_size = C_SIZEOF( dummy )
+    win_size = STORAGE_SIZE( dummy )/8
     CALL MPI_WIN_CREATE( dummy, win_size, iwp, MPI_INFO_NULL, me%intra_comm,   &
                          indwin, ierr )
Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2808)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2809)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
+! 
+! 2806 2018-02-14 17:10:37Z thiele
 ! Bugfixing Write statements
 ! 
@@ -223,5 +226,4 @@
 !       routine
 ! @todo Data transfer of qc and nc is prepared but not activated
-! @todo determine c_sizeof(childgrid(1)) for gfortran
 !------------------------------------------------------------------------------!
  MODULE pmc_interface
@@ -928,24 +930,6 @@
       
        CALL MPI_BCAST( nz_cl, 1, MPI_INTEGER, 0, comm2d, ierr )
-#if defined( __gfortran )
-!
-!--    For the gfortran compiler the function c_sizeof produces strange erros 
-!--    which can probably be attributed to an error in the gfortran compiler.
-!--    Therefore the particle size in bytes is set manually. Attention: A 
-!--    change of the size of the particle type requires an adjustment of 
-!--    this value
-!--    TODO: determine c_sizeof(childgrid(1)) as gfortran can not handle the 
-!--    function
-#else
-!      
-!--    This MPI_SENDRECV should work even with odd mixture on 32 and 64 Bit 
-!--    variables in structure particle_type (due to the calculation of par_size).
-!--    Please note, in case of 1D decomposition ( only 1 core along 
-!--    x dimension), array trlp is not allocated, leading to program crash. 
-!--    Hence, check if array is allocated and allocate it temporarily if 
-!--    if required.
-       CALL MPI_BCAST( childgrid(m), c_sizeof(childgrid(1)), MPI_BYTE, 0, comm2d, ierr )
-#endif
-
+
+       CALL MPI_BCAST( childgrid(m), STORAGE_SIZE(childgrid(1))/8, MPI_BYTE, 0, comm2d, ierr )
 !
 !--    TO_DO: Klaus: please give a comment what is done here
Index: /palm/trunk/SOURCE/pmc_mpi_wrapper_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_mpi_wrapper_mod.f90	(revision 2808)
+++ /palm/trunk/SOURCE/pmc_mpi_wrapper_mod.f90	(revision 2809)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -609,5 +612,5 @@
 
     
-    winsize = idim1 * C_SIZEOF( ierr )
+    winsize = idim1 * STORAGE_SIZE( ierr )/8
 
     CALL MPI_ALLOC_MEM( winsize, MPI_INFO_NULL, p_myind, ierr )
Index: /palm/trunk/SOURCE/pmc_parent_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_parent_mod.f90	(revision 2808)
+++ /palm/trunk/SOURCE/pmc_parent_mod.f90	(revision 2809)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
+! 
+! 2801 2018-02-14 16:01:55Z thiele
 ! Introduce particle transfer in nested models.
 ! 
@@ -1010,5 +1013,5 @@
 !
 !-- Number of child processes * size of INTEGER (i just arbitrary INTEGER)
-    winsize = mychild%inter_npes*c_sizeof(i)*2
+    winsize = mychild%inter_npes*STORAGE_SIZE(i)/8*2
 
     CALL MPI_WIN_CREATE( rldef, winsize, iwp, MPI_INFO_NULL,                   &
@@ -1043,5 +1046,5 @@
 
     CALL MPI_BARRIER( m_model_comm, ierr )
-    CALL MPI_WIN_CREATE( remindw, winsize*c_sizeof(i), iwp, MPI_INFO_NULL,     &
+    CALL MPI_WIN_CREATE( remindw, winsize*STORAGE_SIZE(i)/8, iwp, MPI_INFO_NULL,     &
                          mychild%intra_comm, indwin2, ierr )
 !
Index: /palm/trunk/SOURCE/pmc_particle_interface.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 2808)
+++ /palm/trunk/SOURCE/pmc_particle_interface.f90	(revision 2809)
@@ -24,11 +24,9 @@
 ! 
 ! Former revisions:
-! -----------------
-!
-! Bugfixes gfortran C_SIZEOF(zero_particle)
-! 
-! 
-! 
-! 
+! -----------------! 
+! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE.
+!  
+!
 ! Initial Version (by Klaus Ketelsen)
 !
@@ -235,15 +233,7 @@
 !-- If the model has a parent model prepare the structures for transfer
     IF ( cpl_id > 1 )  THEN 
-#if defined( __gfortran )
-!
-!--    For the gfortran compiler the function c_sizeof produces strange erros 
-!--    which can probably be attributed to an error in the gfortran compiler.
-!--    Therefore the particle size in bytes is set manually. Attention: A 
-!--    change of the size of the particle type requires an adjustment of 
-!--    this value
-       parsize = 184
-#else
-       parsize = C_SIZEOF (zero_particle)
-#endif
+
+       parsize = STORAGE_SIZE(zero_particle)/8
+
        CALL MPI_ALLOC_MEM( parsize , MPI_INFO_NULL, ptr, ierr )
        buf_shape(1) = 1
@@ -273,15 +263,6 @@
        DO  m = 1, nr_childs
           child_id = get_childid(m)
-#if defined( __gfortran )
-!
-!--       For the gfortran compiler the function c_sizeof produces strange erros 
-!--       which can probably be attributed to an error in the gfortran compiler.
-!--       Therefore the particle size in bytes is set manually. Attention: A 
-!--       change of the size of the particle type requires an adjustment of 
-!--       this value
-          parsize = 184
-#else
-          parsize = C_SIZEOF (zero_particle)
-#endif
+          parsize = STORAGE_SIZE(zero_particle)/8
+
           winsize = max_nr_particle_in_rma_win * parsize
           CALL MPI_ALLOC_MEM( winsize , MPI_INFO_NULL, buf_ptr(m), ierr )
@@ -345,15 +326,5 @@
 
                  CALL check_and_alloc_coarse_particle (i, j, nr)
-#if defined( __gfortran )
-!
-!--       For the gfortran compiler the function c_sizeof produces strange erros 
-!--       which can probably be attributed to an error in the gfortran compiler.
-!--       Therefore the particle size in bytes is set manually. Attention: A 
-!--       change of the size of the particle type requires an adjustment of 
-!--       this value
-          parsize = 184
-#else
-          parsize = C_SIZEOF (zero_particle)
-#endif
+                 parsize = STORAGE_SIZE(zero_particle)/8
                  target_disp = part_adrc(j,i) - 1
                  CALL MPI_WIN_LOCK( MPI_LOCK_SHARED , ip - 1, 0, particle_win_child, ierr )
@@ -447,15 +418,5 @@
        max_nr_particle_per_pe = max_nr_particle_in_rma_win / ( n * n )
        disp_offset            = pe_offset * max_nr_particle_per_pe
-#if defined( __gfortran )
-!
-!--       For the gfortran compiler the function c_sizeof produces strange erros 
-!--       which can probably be attributed to an error in the gfortran compiler.
-!--       Therefore the particle size in bytes is set manually. Attention: A 
-!--       change of the size of the particle type requires an adjustment of 
-!--       this value
-          parsize = 184
-#else
-          parsize = C_SIZEOF (zero_particle)
-#endif
+       parsize = STORAGE_SIZE(zero_particle)/8
        DO  ip = 1, me%inter_npes
 
Index: /palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2808)
+++ /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2809)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
+! 
+! 2753 2018-01-16 14:16:49Z suehring
 ! Tile approach for spectral albedo implemented. 
 ! 
@@ -5901,7 +5904,7 @@
 !--             must be in accordance with allocation of lad_s in plant_canopy_model
 !--             optimization of memory should be done
-!--             Argument X of function c_sizeof(X) needs arbitrary REAL(wp) value, set to 1.0_wp for now
-                size_lad_rma = c_sizeof(1.0_wp)*nnx*nny*nzu
-                CALL MPI_Win_allocate(size_lad_rma, c_sizeof(1.0_wp), minfo, comm2d, &
+!--             Argument X of function STORAGE_SIZE(X) needs arbitrary REAL(wp) value, set to 1.0_wp for now
+                size_lad_rma = STORAGE_SIZE(1.0_wp)/8*nnx*nny*nzu
+                CALL MPI_Win_allocate(size_lad_rma, STORAGE_SIZE(1.0_wp)/8, minfo, comm2d, &
                                         lad_s_rma_p, win_lad, ierr)
                 CALL c_f_pointer(lad_s_rma_p, lad_s_rma, (/ nzu, nny, nnx /))
