12 double precision,
dimension({^D&:|,},:),
allocatable ::
woneblock
13 double precision,
dimension({^D&:|,},:),
allocatable ::
xoneblock
22 double precision :: time
23 integer :: nctot, ix^D, ixp^D
25 integer,
dimension(^ND) :: sendbuff
26 character(len=*),
intent(in) :: filename
27 character(len=1024) :: outfilehead
29 if (
mype == 0)
write(*,*)
'mod_oneblock: reading ',nw,
' variables on unit:',
unit
35 open(
unit,file=filename,status=
'unknown')
37 read(
unit,
'(A)') outfilehead
60 call mpi_bcast(sendbuff,^nd,mpi_integer,0,icomm,ierrmpi)
67 call mpi_bcast(
xoneblock,{
nc^
d|*}*^nd,mpi_double_precision,0,icomm,ierrmpi)
68 call mpi_bcast(
woneblock,{
nc^
d|*}*nw,mpi_double_precision,0,icomm,ierrmpi)
75 double precision,
dimension(^ND),
intent(in) :: x
76 integer,
intent(in) :: iw
77 double precision,
intent(out) :: out
79 double precision,
dimension(^ND) :: xloc
80 double precision :: xd^D
82 double precision :: c00, c10
85 double precision :: c0, c1, c00, c10, c01, c11
87 integer :: ipivot^D, idir
88 integer :: ic^D, ic1^D, ic2^D
99 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,1)),1,mask=.true.)
105 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,ipivot2,idir)),1,mask=.true.)
107 ic2 = minloc(dabs(xloc(2)-
xoneblock(ipivot1,:,idir)),1,mask=.true.)
109 call mpistop(
"error1 in interpolate_oneblock")
117 ic1 = minloc(dabs(xloc(1)-
xoneblock(:,ipivot2,ipivot3,idir)),1, &
120 ic2 = minloc(dabs(xloc(2)-
xoneblock(ipivot1,:,ipivot3,idir)),1, &
123 ic3 = minloc(dabs(xloc(3)-
xoneblock(ipivot1,ipivot2,:,idir)),1, &
126 call mpistop(
"error1 in interpolate_oneblock")
139 if (
xoneblock({ic^dd},^d) .lt. xloc(^d))
then
152 if (ic1^d .lt. 1)
then
159 if (ic2^d .gt.
nc^d)
then
179 out = c00 * (1.0d0 - xd2) + c10 * xd2
186 c00 =
woneblock(ic11,ic12,ic13,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic12,ic13,iw) * xd1
187 c10 =
woneblock(ic11,ic22,ic13,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic22,ic13,iw) * xd1
188 c01 =
woneblock(ic11,ic12,ic23,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic12,ic23,iw) * xd1
189 c11 =
woneblock(ic11,ic22,ic23,iw) * (1.0d0 - xd1) +
woneblock(ic21,ic22,ic23,iw) * xd1
191 c0 = c00 * (1.0d0 - xd2) + c10 * xd2
192 c1 = c01 * (1.0d0 - xd2) + c11 * xd2
194 out = c0 * (1.0d0 - xd3) + c1 * xd3
subroutine, public 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