11 double precision,
dimension({^D&:|,},:),
allocatable ::
woneblock
12 double precision,
dimension({^D&:|,},:),
allocatable ::
xoneblock
24 character(len=*),
intent(in) :: filename
26 character(len=1024) :: outfilehead
27 integer :: nctot, ix^D, ixp^D
28 double precision :: time
30 integer,
dimension(^ND) :: sendbuff
33 if (
mype == 0)
write(*,*)
'mod_oneblock: reading ',nw,
' variables on unit:',
unit
39 open(
unit,file=filename,status=
'unknown')
41 read(
unit,
'(A)') outfilehead
64 call mpi_bcast(sendbuff,^nd,mpi_integer,0,icomm,ierrmpi)
71 call mpi_bcast(
xoneblock,{
nc^
d|*}*^nd,mpi_double_precision,0,icomm,ierrmpi)
72 call mpi_bcast(
woneblock,{
nc^
d|*}*nw,mpi_double_precision,0,icomm,ierrmpi)
81 double precision,
dimension(^ND),
intent(in) :: x
82 integer,
intent(in) :: iw
83 double precision,
intent(out) :: out
85 double precision,
dimension(^ND) :: xloc
86 integer :: ic^D, ic1^D, ic2^D
87 double precision :: xd^D
89 double precision :: c00, c10
92 double precision :: c0, c1, c00, c10, c01, c11
94 integer :: ipivot^D, idir
106 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,1)),1,mask=.true.)
112 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,ipivot2,idir)),1,mask=.true.)
114 ic2 = minloc(dabs(xloc(2)-
xoneblock(ipivot1,:,idir)),1,mask=.true.)
116 call mpistop(
"error1 in interpolate_oneblock")
124 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,ipivot2,ipivot3,idir)),1, &
127 ic2 = minloc(dabs(xloc(2)-
xoneblock(ipivot1,:,ipivot3,idir)),1, &
130 ic3 = minloc(dabs(xloc(3)-
xoneblock(ipivot1,ipivot2,:,idir)),1, &
133 call mpistop(
"error1 in interpolate_oneblock")
146 if (
xoneblock({ic^dd},^d) .lt. xloc(^d))
then
159 if (ic1^d .lt. 1)
then
166 if (ic2^d .gt.
nc^d)
then
186 out = c00 * (1.0d0 - xd2) + c10 * xd2
193 c00 =
woneblock(ic11,ic12,ic13,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic12,ic13,iw) * xd1
194 c10 =
woneblock(ic11,ic22,ic13,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic22,ic13,iw) * xd1
195 c01 =
woneblock(ic11,ic12,ic23,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic12,ic23,iw) * xd1
196 c11 =
woneblock(ic11,ic22,ic23,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic22,ic23,iw) * xd1
198 c0 = c00 * (1.0d0 - xd2) + c10 * xd2
199 c1 = c01 * (1.0d0 - xd2) + c11 * xd2
201 out = c0 * (1.0d0 - xd3) + c1 * xd3
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer mype
The rank of the current MPI task.
subroutine read_oneblock(filename)
double precision, dimension({^d &:|,},:), allocatable xoneblock
subroutine interpolate_oneblock(x, iw, out)
double precision, dimension({^d &:|,},:), allocatable woneblock