Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocburn_load_module.f90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !
24 ! ---------------------------------------------------------------------------
25 !
26 ! Purpose: Registering subroutines of ROCBURN with Roccom. This (hopefully)
27 ! is the only file need to be changed to add another 1D model.
28 !
29 ! Author: X. Jiao
30 !
31 ! Creation Date: Aug. 30, 2002
32 !
33 ! Modifications:
34 !
35 ! No. Date Programmer Description
36 !
37 ! ---------------------------------------------------------------------------
38 !
39 
41  USE m_rocburn_2d
42  IMPLICIT NONE
43 
44  INTERFACE
45  SUBROUTINE com_set_data( attr, ptr) ! Must be explicitly declared here
47  CHARACTER(*), INTENT(IN) :: attr
48  EXTERNAL ptr
49  END SUBROUTINE com_set_data
50  END INTERFACE
51 
52 CONTAINS
53 
54 !
55 ! The following subroutines registers subroutines of indiviudal 1-D burning
56 ! rate model to Roccom. Rocman calls corresponding subroutine
57 ! related to the burning rate model used.
58 !
59 
60  SUBROUTINE rocburn_init_funcs_apn( mname)
62  CHARACTER(*), INTENT(IN) :: mname
63 
64  CALL com_set_external( mname//".init_0d", 0, initialize_0d)
65  CALL com_set_external( mname//".init_1d", 0, initialize_1d)
66  CALL com_set_external( mname//".finalize_0d", 0, finalize_0d)
67  CALL com_set_external( mname//".get_burn_rate", 0, get_burning_rate_1d)
68 
69  END SUBROUTINE rocburn_init_funcs_apn
70 
71  SUBROUTINE rocburn_init_funcs_py( mname)
72  USE m_rocburn_1d_py
73  CHARACTER(*), INTENT(IN) :: mname
74 
75  CALL com_set_external( mname//".init_0d", 0, initialize_0d)
76  CALL com_set_external( mname//".init_1d", 0, initialize_1d)
77  CALL com_set_external( mname//".finalize_0d", 0, finalize_0d)
78  CALL com_set_external( mname//".get_film_coeff", 0, get_film_coeff_1d)
79  CALL com_set_external( mname//".get_time_step", 0, get_time_step_1d)
80  CALL com_set_external( mname//".get_burn_rate", 0, get_burning_rate_1d)
81 
82  END SUBROUTINE rocburn_init_funcs_py
83 
84  SUBROUTINE rocburn_init_funcs_zn( mname)
85  USE m_rocburn_1d_zn
86  CHARACTER(*), INTENT(IN) :: mname
87 
88  CALL com_set_external( mname//".init_0d", 0, initialize_0d)
89  CALL com_set_external( mname//".init_1d", 0, initialize_1d)
90  CALL com_set_external( mname//".finalize_0d", 0, finalize_0d)
91  CALL com_set_external( mname//".get_film_coeff", 0, get_film_coeff_1d)
92  CALL com_set_external( mname//".get_time_step", 0, get_time_step_1d)
93  CALL com_set_external( mname//".get_burn_rate", 0, get_burning_rate_1d)
94 
95  END SUBROUTINE rocburn_init_funcs_zn
96 END MODULE m_init_1dmodules
97 
98 SUBROUTINE rocburn_load_module( module_name)
99 
100  USE m_init_1dmodules
102  IMPLICIT NONE
103 
104  CHARACTER(*), INTENT(IN) :: module_name
105  TYPE(list_block), POINTER :: g_b
106  INTEGER :: types(7)
107 
108  INTERFACE
109  SUBROUTINE com_set_pointer( attr, ptr, asso)
111  CHARACTER(*), INTENT(IN) :: attr
112  TYPE(list_block), POINTER :: ptr
113  EXTERNAL asso
114  END SUBROUTINE com_set_pointer
115  END INTERFACE
116 
117  ALLOCATE( g_b)
118  g_b%mname = module_name
119  g_b%TBL_flag = no_tbl
120  IF ( module_name == "RocburnAPN") THEN
121  g_b%burn_model = model_apn
122  ELSE IF ( module_name == "RocburnPY") THEN
123  g_b%burn_model = model_py
124  ELSE IF ( module_name == "RocburnZN") THEN
125  g_b%burn_model = model_zn
126  ELSE
127  print *, "Rocburn-2D: Unknown module name", module_name
128  print *, "Rocburn-2D: Use APN instead", module_name
129  g_b%burn_model = model_apn
130  END IF
131 
132  CALL com_new_window( module_name)
133 !!! Create an attribute for global data
134  CALL com_new_attribute( module_name//".global", 'w', com_f90pointer, 1, '')
135  CALL com_resize_array( module_name//".global")
136 
137  CALL com_new_attribute( module_name//".init_0d", 'w', com_void, 1, '')
138  CALL com_new_attribute( module_name//".init_1d", 'w', com_void, 1, '')
139  CALL com_new_attribute( module_name//".finalize_0d", 'w', com_void, 1, '')
140  CALL com_new_attribute( module_name//".get_film_coeff", 'w', com_void, 1, '')
141  CALL com_new_attribute( module_name//".get_time_step", 'w', com_void, 1, '')
142  CALL com_new_attribute( module_name//".get_burn_rate", 'w', com_void, 1, '')
143 
144  CALL com_resize_array( module_name//".init_0d")
145  CALL com_resize_array( module_name//".init_1d")
146  CALL com_resize_array( module_name//".finalize_0d")
147  CALL com_resize_array( module_name//".get_film_coeff")
148  CALL com_resize_array( module_name//".get_time_step")
149  CALL com_resize_array( module_name//".get_burn_rate")
150 
151 
152 !!! Now initialize the 1D module
153  IF ( g_b%burn_model == model_py) THEN
154  CALL rocburn_init_funcs_py( module_name)
155  ELSE IF ( g_b%burn_model == model_zn) THEN
156  CALL rocburn_init_funcs_zn( module_name)
157  ELSE
158  CALL rocburn_init_funcs_apn( module_name)
159  END IF
160 
161  types(1) = com_f90pointer
162  types(2) = com_double_precision
163  types(3) = com_mpi_comm
164  types(4) = com_integer
165  types(5) = com_string
166  types(6) = com_string
167  types(7) = com_integer
168 
169  CALL com_set_member_function( module_name//".initialize", &
170  init_wrapper, module_name//".global", "biiiiii", types)
171 
172  types(1) = com_f90pointer
173  types(2) = com_integer
174  types(3) = com_string
175  types(4) = com_string
176  types(5) = com_rawdata
177  types(6) = com_rawdata
178  types(7) = com_integer
179 
180  CALL com_set_member_function( module_name//".init_internal", &
181  initialize, module_name//".global", "biiiiii", types)
182 
183  types(1) = com_f90pointer
184  types(2) = com_double_precision
185  types(3) = com_double_precision
186  types(4) = com_integer
187 
188  CALL com_set_member_function( module_name//".update_solution", &
189  update_wrapper, module_name//".global", "biii", types)
190 
191  types(1) = com_f90pointer
192  types(2) = com_double_precision
193  types(3) = com_double_precision
194  types(4) = com_integer
195  types(5) = com_rawdata
196  types(6) = com_rawdata
197  types(7) = com_rawdata
198 
199  CALL com_set_member_function( module_name//".update_internal", &
200  update, module_name//".global", "biiiiii", types)
201 
202 
203  types(1) = com_f90pointer
204  types(2) = com_rawdata
205  CALL com_set_member_function( module_name//".finalize", &
206  finalize, module_name//".global", "b", types)
207 
208  CALL com_window_init_done( module_name)
209 
210  g_b%INIT = com_get_function_handle(module_name//".init_internal")
211  g_b%UPDATE = com_get_function_handle(module_name//".update_internal")
212  g_b%INIT_1D = com_get_attribute_handle(module_name//".init_1d")
213  g_b%INIT_0D = com_get_attribute_handle(module_name//".init_0d")
214  g_b%GET_FILM_COEFF = com_get_attribute_handle(module_name//".get_film_coeff")
215  g_b%GET_BURN_RATE = com_get_attribute_handle(module_name//".get_burn_rate")
216  g_b%GET_TIME_STEP = com_get_attribute_handle(module_name//".get_time_step")
217 
218  CALL com_set_pointer( module_name//".global", g_b, associate_pointer)
219 END SUBROUTINE rocburn_load_module
220 
221 SUBROUTINE rocburn_unload_module( module_name)
223  IMPLICIT NONE
224 
225  CHARACTER(*), INTENT(IN) :: module_name
226 
227  TYPE( list_block), POINTER :: glb
228 
229  INTERFACE
230  SUBROUTINE com_get_pointer( attr, ptr, asso)
232  CHARACTER(*), INTENT(IN) :: attr
233  TYPE(list_block), POINTER :: ptr
234  EXTERNAL asso
235  END SUBROUTINE com_get_pointer
236  END INTERFACE
237 
238  CALL com_get_pointer( module_name//".global", glb, associate_pointer)
239  DEALLOCATE( glb)
240 
241  CALL com_delete_window( module_name)
242 
243 END SUBROUTINE rocburn_unload_module
244 
245 
246 
247 
248 
249 
subroutine get_burning_rate_1d(G_APN, delt, P_mks, To, Tn, qc_mks, qc_old_mks, qr_mks, qr_old_mks, rhoc_mks, Toa, rb_mks, fr, bflag, Tnp1, Tflame, p_coor)
subroutine initialize(G_b, MAN_INIT, inSurf, inInt, INIT_0D, INIT_1D, IN_obt_attr)
Definition: rocburn_2D.f90:83
subroutine update_wrapper(G_b, timestamp, dt, MAN_UPDATE)
Definition: rocburn_2D.f90:399
subroutine get_time_step_1d(bp, rb, Toa, dt_max)
Definition: setup_py.f90:30
subroutine initialize_0d(G_APN, comm, Indir, nxmax, To_read)
subroutine initialize_1d(G_APN, bflag, P_mks, To, rhoc_mks, p_coor, rb_mks, Toa, fr, Tn, Tflame)
subroutine rocburn_init_funcs_zn(mname)
subroutine get_film_coeff_1d(G_ZN, p_coor, Ts, T_euler, P, qc, qcPrime)
const COM::Attribute * attr(const COM::Attribute *a) const
Obtain the attribute on the parent pane of the node.
Definition: Manifold_2.h:404
subroutine rocburn_init_funcs_apn(mname)
subroutine rocburn_init_funcs_py(mname)
subroutine associate_pointer(attr, ptr)
subroutine update(G_b, timestamp, dt, MAN_UPDATE, GET_FILM_COEFF_1D, GET_TIME_STEP_1D, GET_BURNING_RATE_1D)
Definition: rocburn_2D.f90:412
subroutine rocburn_load_module(module_name)
subroutine finalize(G_b)
Definition: rocburn_2D.f90:374
Aff_transformation_rep_baseS2< FT > * ptr() const
virtual std::ostream & print(std::ostream &os) const
subroutine finalize_0d(G_APN)
subroutine init_wrapper(G_b, initial_time, comm, MAN_INIT, inSurf, inInt, IN_obt_attr)
Definition: rocburn_2D.f90:61
subroutine rocburn_unload_module(module_name)