41  use json_module, 
only : json_file
 
   43  use, 
intrinsic :: iso_c_binding, only : c_ptr
 
   62     procedure, pass(this) :: init_from_components => &
 
 
   77    class(
symmetry_t), 
intent(inout), 
target :: this
 
   78    type(
coef_t), 
target, 
intent(in) :: coef
 
   79    type(json_file), 
intent(inout) ::json
 
   81    call this%init_from_components(coef)
 
 
   88    class(
symmetry_t), 
intent(inout), 
target :: this
 
   89    type(
coef_t), 
target, 
intent(in) :: coef
 
   94    call this%init_base(coef)
 
   95    call this%bc_x%init_from_components(this%coef)
 
   96    call this%bc_y%init_from_components(this%coef)
 
   97    call this%bc_z%init_from_components(this%coef)
 
 
  105    class(
symmetry_t), 
target, 
intent(inout) :: this
 
  106    logical, 
optional, 
intent(in) :: only_facets
 
  107    logical :: only_facets_ = .false.
 
  108    integer :: i, m, j, l
 
  110    real(kind=
rp) :: sx, sy, sz
 
  111    real(kind=
rp), 
parameter :: tol = 1e-3_rp
 
  115    if (
present(only_facets)) 
then 
  116       only_facets_ = only_facets
 
  118       only_facets_ = .false.
 
  121    call this%finalize_base(only_facets_)
 
  123    associate(c => this%coef, nx => this%coef%nx, ny => this%coef%ny, &
 
  125      bfp => this%marked_facet%array()
 
  126      do i = 1, this%marked_facet%size()
 
  128         facet = bc_facet%x(1)
 
  130         call this%get_normal_axis(sx, sy, sz, facet, el)
 
  132         if (sx .lt. tol) 
then 
  133            call this%bc_x%mark_facet(facet, el)
 
  136         if (sy .lt. tol) 
then 
  137            call this%bc_y%mark_facet(facet, el)
 
  140         if (sz .lt. tol) 
then 
  141            call this%bc_z%mark_facet(facet, el)
 
  145    call this%bc_x%finalize(only_facets_)
 
  146    call this%bc_y%finalize(only_facets_)
 
  147    call this%bc_z%finalize(only_facets_)
 
 
  154    class(
symmetry_t), 
target, 
intent(inout) :: this
 
  155    real(kind=rp), 
intent(out) :: sx, sy, sz
 
  156    integer, 
intent(in) :: facet
 
  157    integer, 
intent(in) :: el
 
  158    integer :: i, m, j, l
 
  159    type(tuple_i4_t), 
pointer :: bfp(:)
 
  161    real(kind=rp), 
parameter :: tol = 1d-3
 
  162    type(tuple_i4_t) :: bc_facet
 
  164    associate(c => this%coef, nx => this%coef%nx, ny => this%coef%ny, &
 
  171         do l = 2, c%Xh%lx - 1
 
  173               sx = sx + abs(abs(nx(l, j, facet, el)) - 1d0)
 
  174               sy = sy + abs(abs(ny(l, j, facet, el)) - 1d0)
 
  175               sz = sz + abs(abs(nz(l, j, facet, el)) - 1d0)
 
  179         do l = 2, c%Xh%lx - 1
 
  180            do j = 2, c%Xh%lx - 1
 
  181               sx = sx + abs(abs(nx(l, j, facet, el)) - 1d0)
 
  182               sy = sy + abs(abs(ny(l, j, facet, el)) - 1d0)
 
  183               sz = sz + abs(abs(nz(l, j, facet, el)) - 1d0)
 
  187         do l = 2, c%Xh%lx - 1
 
  188            do j = 2, c%Xh%lx - 1
 
  189               sx = sx + abs(abs(nx(l, j, facet, el)) - 1d0)
 
  190               sy = sy + abs(abs(ny(l, j, facet, el)) - 1d0)
 
  191               sz = sz + abs(abs(nz(l, j, facet, el)) - 1d0)
 
  195      sx = sx / (c%Xh%lx - 2)**2
 
  196      sy = sy / (c%Xh%lx - 2)**2
 
  197      sz = sz / (c%Xh%lx - 2)**2
 
 
  208    integer, 
intent(in) :: n
 
  209    real(kind=rp), 
intent(inout), 
dimension(n) :: x
 
  210    type(time_state_t), 
intent(in), 
optional :: time
 
  211    logical, 
intent(in), 
optional :: strong
 
 
  223    integer, 
intent(in) :: n
 
  224    real(kind=rp), 
intent(inout), 
dimension(n) :: x
 
  225    real(kind=rp), 
intent(inout), 
dimension(n) :: y
 
  226    real(kind=rp), 
intent(inout), 
dimension(n) :: z
 
  227    type(time_state_t), 
intent(in), 
optional :: time
 
  228    logical, 
intent(in), 
optional :: strong
 
  231    if (
present(strong)) 
then 
  238       call this%bc_x%apply_scalar(x, n)
 
  239       call this%bc_y%apply_scalar(y, n)
 
  240       call this%bc_z%apply_scalar(z, n)
 
 
  250    class(
symmetry_t), 
intent(inout), 
target :: this
 
  251    type(c_ptr), 
intent(inout) :: x_d
 
  252    type(time_state_t), 
intent(in), 
optional :: time
 
  253    logical, 
intent(in), 
optional :: strong
 
  254    type(c_ptr), 
intent(inout) :: strm
 
 
  265    class(
symmetry_t), 
intent(inout), 
target :: this
 
  266    type(c_ptr), 
intent(inout) :: x_d
 
  267    type(c_ptr), 
intent(inout) :: y_d
 
  268    type(c_ptr), 
intent(inout) :: z_d
 
  269    type(time_state_t), 
intent(in), 
optional :: time
 
  270    logical, 
intent(in), 
optional :: strong
 
  271    type(c_ptr), 
intent(inout) :: strm
 
  274    if (
present(strong)) 
then 
  280    if (strong_ .and. (this%msk(0) .gt. 0)) 
then 
  281       call device_symmetry_apply_vector(this%bc_x%msk_d, this%bc_y%msk_d, &
 
  282            this%bc_z%msk_d, x_d, y_d, z_d, &
 
  283            this%bc_x%msk(0), this%bc_y%msk(0), this%bc_z%msk(0), strm)
 
 
  289    class(
symmetry_t), 
target, 
intent(inout) :: this
 
  291    call this%free_base()
 
  292    call this%bc_x%free()
 
  293    call this%bc_y%free()
 
  294    call this%bc_z%free()
 
 
Defines a boundary condition.
 
subroutine device_symmetry_apply_vector(xmsk, ymsk, zmsk, x, y, z, m, n, l, strm)
 
Defines a dirichlet boundary condition.
 
integer, parameter, public rp
Global precision used in computations.
 
Mixed Dirichlet-Neumann axis aligned symmetry plane.
 
subroutine symmetry_apply_vector(this, x, y, z, n, time, strong)
Apply symmetry conditions (axis aligned)
 
subroutine symmetry_apply_scalar(this, x, n, time, strong)
No-op scalar apply.
 
subroutine symmetry_init_from_components(this, coef)
Constructor from components.
 
subroutine symmetry_init(this, coef, json)
Constructor.
 
subroutine symmetry_apply_scalar_dev(this, x_d, time, strong, strm)
No-op scalar apply (device version)
 
subroutine symmetry_apply_vector_dev(this, x_d, y_d, z_d, time, strong, strm)
Apply symmetry conditions (axis aligned) (device version)
 
subroutine symmetry_free(this)
Destructor.
 
subroutine symmetry_finalize(this, only_facets)
Finalize. Marks the appropriate faces for application of a homogeneous Dirchlet condition based on th...
 
subroutine symmetry_get_normal_axis(this, sx, sy, sz, facet, el)
Compute the average normal for a facet of an element.
 
Module with things related to the simulation time.
 
Defines a zero-valued Dirichlet boundary condition.
 
Base type for a boundary condition.
 
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
 
Generic Dirichlet boundary condition  on .
 
Mixed Dirichlet-Neumann symmetry plane condition.
 
A struct that contains all info about the time, expand as needed.
 
Zero-valued Dirichlet boundary condition. Used for no-slip walls, but also for various auxillary cond...