Computes the derivative in the x1-direction. Note: If input is face-centered (on x1), result is cell-centered (on x1m). If input is cell-centered (on x1m), result is face-centered (on x1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(op_obj), | intent(in) | :: | this |
Differential operators utility |
||
| type(eulerian_obj_r), | intent(in) | :: | in |
Field to differentiate |
Result
impure function op_obj_d1dx1(this,in) result(out) !> Computes the derivative in the x1-direction. ! Note: If input is face-centered (on x1), result is ! cell-centered (on x1m). If input is cell-centered (on x1m), ! result is face-centered (on x1). class(op_obj), intent(in) :: this !! Differential operators utility type(eulerian_obj_r), intent(in) :: in !! Field to differentiate type(eulerian_obj_r) :: out !! Result ! Work variables integer :: i,j,k integer :: slo, shi call out%Initialize('d1dx1',this%block,this%parallel,in%staggering) associate (lo => this%block%lo, hi => this%block%hi) select case (in%staggering) case (0,2,3) ! From xm to x do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) slo = i - this%st shi = i + this%st - 1 out%cell(i,j,k)=dot_product(this%c_d1dx1m(:,i),in%cell(slo:shi,j,k)) end do end do end do case (1) ! From x to xm do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) slo = i - this%st + 1 shi = i + this%st out%cell(i,j,k)=dot_product(this%c_d1dx1 (:,i),in%cell(slo:shi,j,k)) end do end do end do end select end associate return end function op_obj_d1dx1