1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
program Maillage_2D_regulier
implicit none
integer :: i , j , k , l
integer :: imin,imax,jmin,jmax
integer :: xmin,xmax,ymin,ymax
integer :: alloc_stat
real , dimension (:) , allocatable :: xx,yy
real , dimension (:,:) , allocatable :: Temp
real :: dx,dy
!l'affinite de maillage
imax=100
jmax=100
!Allocation des tableaux (xx) et (yy) pour le maillage dans les deux direction X et Y
allocate (xx(1:imax) , stat = alloc_stat )
if (.not.(alloc_stat.eq.0)) then
write(*,*) 'Erreur d''allocation tableau dynamique xx(i)'
stop
endif
allocate (yy(1:jmax) , stat = alloc_stat )
if (.not.(alloc_stat.eq.0)) then
write(*,*) 'Erreur d''allocation tableau dynamique yy(i)'
stop
endif
! le domaine d'étude
xmin=0.0; xmax=500.0
ymin=0.0; ymax=500.0
dx=xmax/(imax-1) ! dx : c'ets le pas de maillage
do i=1,imax !imax : c'est le nombre de noeuds souhaité
xx(i)=(real(i-1)/real(imax-1)) * xmax !dx = real(i-1)/(imax-1)*xmax
write(6,*) 'xx(i)=' , xx(i) , i , dx
enddo
!call REGUM(yy,20)
yy(1)=0 ; yy(jmax)=ymax
dy=(yy(jmax)-yy(1))/(jmax-1)
do j=1,jmax-1
yy(j+1)=yy(j)+dy
write(6,*)'yy(j)', yy(j) ,j , dy
enddo
deallocate (Temp,xx,yy)
end program Maillage_2D_regulier
!---------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------
!------------------------------------Fin du programme pricipale---------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------
!-------------------------------------------------------------------------------------------------------------
!***********************************************************************
subroutine REGUM(nx,x)
!***********************************************************************
! *
! MAILLAGE AUTOMATIQUE REGULIER *
! L. THAIS, VERSION OPENMP - DECEMBRE 2009 *
! *
!***********************************************************************
implicit none
! integer, parameter :: dp = kind(1.0d0)
! DECLARATIONS DES ARGUMENTS
!
integer, intent(in) :: nx
real , dimension(1:nx), intent(inout) :: x
!
! VARIABLES LOCALES
!
integer :: i,nxm1
real :: dx
!-----------------------------------------------------------------------
nxm1 = nx-1
dx = (x(nx)-x(1))/(nx-1) ![x(nx) - x(1)]/[nx -1]
do i=1,(nx-1)
x(i+1)=x(i)+dx
enddo
end subroutine REGUM
! write(1,*) "# ","x ", "z"
! write(3,*) "# ","xp ", "zp"
!
! do i = 1, ix
! do j = 1, iz
! write(1,*) x(i) , z(j)
! write(2,*) x(i) , z(j)
! write(3,*) xp(i), zp(j)
! enddo
! enddo
!
! ! !
! ! !--- DIRECTION-X
! ! !
! ! do i=1,nx
! ! dx(i) = x(i+1)-x(i)
! ! xp(i) = x(i)+dx(i)*0.5_wp
! ! enddo
! !
! ! do i=2,nx
! ! dxp(i) = xp(i)-xp(i-1)
! ! enddo
! !
! ! dxp(1) = dx(1)
! ! dxp(ix) = dx(nx)
! ! xp(ix) = xp(nx)+dxp(ix) |
Partager