DCS
a Driven-Cavity Open source Simulator code
 All Classes Files Functions Variables Groups Pages
Data_Type_Cavity.f90
Go to the documentation of this file.
1 
6 
12 
18 
24 
26 module data_type_cavity
27 !-----------------------------------------------------------------------------------------------------------------------------------
28 USE ir_precision ! Integers and reals precision definition.
29 USE data_type_conservative ! Definition of Type_Conservative.
30 USE data_type_mesh ! Definition of Type_Mesh.
31 !-----------------------------------------------------------------------------------------------------------------------------------
32 
33 !-----------------------------------------------------------------------------------------------------------------------------------
34 private
35 !-----------------------------------------------------------------------------------------------------------------------------------
36 
37 !-----------------------------------------------------------------------------------------------------------------------------------
40 type, public:: type_cavity
41  real(R8P):: re = 500._r8p
42  real(R8P):: beta = 0.6_r8p
43  type(type_mesh):: mesh
44  type(type_conservative), allocatable:: cons(:,:)
45  contains
46  procedure, non_overridable:: initialize ! Procedure for initializing Type_Cavity.
47  procedure, non_overridable:: finalize ! Procedure for finalizing Type_Cavity.
48  procedure, non_overridable:: pprint ! Procedure for printing Type_Cavity components with a "pretty" format.
49 endtype type_cavity
50 !-----------------------------------------------------------------------------------------------------------------------------------
51 contains
55 
59  elemental subroutine initialize(self,Re,beta,N)
60  !---------------------------------------------------------------------------------------------------------------------------------
61  implicit none
62  class(type_cavity), intent(INOUT):: self
63  real(R8P), intent(IN):: re
64  real(R8P), intent(IN):: beta
65  integer(I4P), intent(IN):: n
66  !---------------------------------------------------------------------------------------------------------------------------------
67 
68  !---------------------------------------------------------------------------------------------------------------------------------
69  self%Re = re
70  self%beta = beta
71  call self%mesh%initialize(n=n)
72  if (allocated(self%cons)) deallocate(self%cons) ; allocate(self%cons(0:n,0:n)) ! call self%cons%set(s=,v=)
73  return
74  !---------------------------------------------------------------------------------------------------------------------------------
75  endsubroutine initialize
76 
78  elemental subroutine finalize(self)
79  !---------------------------------------------------------------------------------------------------------------------------------
80  implicit none
81  class(type_cavity), intent(INOUT):: self
82  !---------------------------------------------------------------------------------------------------------------------------------
83 
84  !---------------------------------------------------------------------------------------------------------------------------------
85  self%Re = 1._r8p
86  self%beta = 0.6_r8p
87  call self%mesh%finalize
88  if (allocated(self%cons)) deallocate(self%cons)
89  return
90  !---------------------------------------------------------------------------------------------------------------------------------
91  endsubroutine finalize
92 
95  function pprint(self,unit) result(err)
96  !---------------------------------------------------------------------------------------------------------------------------------
97  implicit none
98  class(type_cavity), intent(IN):: self
99  integer(I4P), intent(IN):: unit
100  integer(I4P):: err
101  integer(I4P):: i,j
102  !---------------------------------------------------------------------------------------------------------------------------------
103 
104  !---------------------------------------------------------------------------------------------------------------------------------
105  write(unit,'(A)',iostat=err)' Re='//str(n=self%Re)
106  write(unit,'(A)',iostat=err)' beta='//str(n=self%beta)
107  write(unit,'(A)',iostat=err)' Mesh data'
108  err = self%mesh%pprint(unit)
109  write(unit,'(A)',iostat=err)' Conservative variables data'
110  do j=0,self%mesh%N
111  do i=0,self%mesh%N
112  err = self%cons(i,j)%pprint(unit)
113  enddo
114  enddo
115  return
116  !---------------------------------------------------------------------------------------------------------------------------------
117  endfunction pprint
119 endmodule data_type_cavity
procedure, non_overridable finalize
This module contains the definition of Type_Cavity and its procedures.
Derived type containing conservative variables.
Procedure for converting number, real and integer, to string (number to string type casting); logical...
Derived type containing conservative variables.
procedure, non_overridable initialize
This module contains the definition of Type_Conservative and its procedures.
Derived type containing conservative variables.
This module contains the definition of Type_Mesh and its procedures.
procedure, non_overridable pprint
Module IR_Precision makes available some portable kind-parameters and some useful procedures to deal ...