Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
adjoint_scalar_pnpn_bc_fctry.f90
1
34!
39submodule(adjoint_scalar_pnpn) adjoint_scalar_pnpn_bc_fctry
40 use dirichlet, only : dirichlet_t
41 use neumann, only : neumann_t
42 use user_intf, only : user_t
43 use utils, only : neko_type_error
44 use field_dirichlet, only : field_dirichlet_t
45 implicit none
46
47 ! List of all possible types created by the boundary condition factories
48 character(len=25) :: ADJOINT_SCALAR_KNOWN_BCS(4) = [character(len=25) :: &
49 "dirichlet", &
50 "user_pointwise", &
51 "user", &
52 "neumann"]
53
54contains
55
63 module subroutine adjoint_bc_factory(object, scheme, json, coef, user)
64 class(bc_t), pointer, intent(inout) :: object
65 type(adjoint_scalar_pnpn_t), intent(in) :: scheme
66 type(json_file), intent(inout) :: json
67 type(coef_t), intent(in) :: coef
68 type(user_t), intent(in) :: user
69 character(len=:), allocatable :: type
70 integer :: i
71 integer, allocatable :: zone_indices(:)
72
73 call json_get(json, "type", type)
74
75 select case (trim(type))
76 case ("user")
77 allocate(field_dirichlet_t::object)
78 select type (obj => object)
79 type is (field_dirichlet_t)
80 obj%update => user%dirichlet_conditions
81 ! Add the name of the dummy field in the bc, matching the scalar
82 ! solved for.
83 call json%add("field_name", scheme%s_adj%name)
84 end select
85 case ("dirichlet")
86 allocate(dirichlet_t::object)
87 case ("neumann")
88 allocate(neumann_t::object)
89 case default
90 call neko_type_error("scalar_pnpn boundary conditions", type, &
91 ADJOINT_SCALAR_KNOWN_BCS)
92 end select
93
94 call json_get(json, "zone_indices", zone_indices)
95 call object%init(coef, json)
96 do i = 1, size(zone_indices)
97 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
98 end do
99 call object%finalize()
100
101 end subroutine adjoint_bc_factory
102
103
104end submodule adjoint_scalar_pnpn_bc_fctry
Contains the adjoint_scalar_pnpn_t type.