1 | ! |
---|
2 | ! $Id: modcurgridfunctions.F 774 2007-12-18 16:45:53Z rblod $ |
---|
3 | ! |
---|
4 | C AGRIF (Adaptive Grid Refinement In Fortran) |
---|
5 | C |
---|
6 | C Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr) |
---|
7 | C Christophe Vouland (Christophe.Vouland@imag.fr) |
---|
8 | C |
---|
9 | C This program is free software; you can redistribute it and/or modify |
---|
10 | C it under the terms of the GNU General Public License as published by |
---|
11 | C the Free Software Foundation; either version 2 of the License, or |
---|
12 | C (at your option) any later version. |
---|
13 | C |
---|
14 | C This program is distributed in the hope that it will be useful, |
---|
15 | C but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | C GNU General Public License for more details. |
---|
18 | C |
---|
19 | C You should have received a copy of the GNU General Public License |
---|
20 | C along with this program; if not, write to the Free Software |
---|
21 | C Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | C |
---|
23 | C |
---|
24 | C |
---|
25 | CCC Module Agrif_CurgridFunctions |
---|
26 | C |
---|
27 | Module Agrif_CurgridFunctions |
---|
28 | C |
---|
29 | CCC Description: |
---|
30 | CCC Module to define some procedures concerning the current grid |
---|
31 | C |
---|
32 | C Modules used: |
---|
33 | C |
---|
34 | Use Agrif_Init |
---|
35 | C |
---|
36 | IMPLICIT NONE |
---|
37 | C |
---|
38 | C |
---|
39 | Contains |
---|
40 | C Define procedures contained in this module |
---|
41 | C |
---|
42 | C ************************************************************************** |
---|
43 | CCC Function Agrif_Rhot |
---|
44 | C ************************************************************************** |
---|
45 | C |
---|
46 | Function Agrif_Rhot() |
---|
47 | C |
---|
48 | CCC Description: |
---|
49 | CCC Function returning the time refinement factor of the current grid. |
---|
50 | C |
---|
51 | C Declarations: |
---|
52 | C |
---|
53 | |
---|
54 | C |
---|
55 | REAL :: Agrif_Rhot ! Result |
---|
56 | C |
---|
57 | C Local scalar |
---|
58 | INTEGER :: res ! Intermediate result |
---|
59 | INTEGER :: iii |
---|
60 | C |
---|
61 | C |
---|
62 | res=1 |
---|
63 | C |
---|
64 | do iii = 1 , Agrif_Probdim |
---|
65 | res = max(res, AGRIF_Curgrid % timeref(iii)) |
---|
66 | enddo |
---|
67 | C |
---|
68 | Agrif_Rhot = float(res) |
---|
69 | C |
---|
70 | C |
---|
71 | End function Agrif_rhot |
---|
72 | C |
---|
73 | C |
---|
74 | C |
---|
75 | C |
---|
76 | C ************************************************************************** |
---|
77 | CCC Function Agrif_IRhot |
---|
78 | C ************************************************************************** |
---|
79 | C |
---|
80 | Function Agrif_IRhot() |
---|
81 | C |
---|
82 | CCC Description: |
---|
83 | CCC Function returning the time refinement factor of the current grid. |
---|
84 | C |
---|
85 | C Declarations: |
---|
86 | C |
---|
87 | |
---|
88 | C |
---|
89 | INTEGER :: Agrif_IRhot ! Result |
---|
90 | C |
---|
91 | C Local scalar |
---|
92 | INTEGER :: res ! Intermediate result |
---|
93 | INTEGER :: iii |
---|
94 | C |
---|
95 | C |
---|
96 | res=1 |
---|
97 | C |
---|
98 | do iii = 1 , Agrif_Probdim |
---|
99 | res = max(res, AGRIF_Curgrid % timeref(iii)) |
---|
100 | enddo |
---|
101 | C |
---|
102 | Agrif_IRhot = res |
---|
103 | C |
---|
104 | C |
---|
105 | End function Agrif_IRhot |
---|
106 | C |
---|
107 | C |
---|
108 | C |
---|
109 | C ************************************************************************** |
---|
110 | CCC Function Agrif_Parent_Rhot |
---|
111 | C ************************************************************************** |
---|
112 | C |
---|
113 | Function Agrif_Parent_Rhot() |
---|
114 | C |
---|
115 | CCC Description: |
---|
116 | CCC Function returning the time refinement factor of the parent grid of the |
---|
117 | CCC current grid. |
---|
118 | C |
---|
119 | C Declarations: |
---|
120 | C |
---|
121 | |
---|
122 | C |
---|
123 | REAL :: Agrif_Parent_Rhot ! Result |
---|
124 | C |
---|
125 | C Local scalar |
---|
126 | INTEGER :: res ! Intermediate result |
---|
127 | INTEGER :: iii |
---|
128 | C |
---|
129 | C |
---|
130 | res=1 |
---|
131 | C |
---|
132 | do iii = 1 , Agrif_Probdim |
---|
133 | res = max(res, AGRIF_Curgrid % parent % timeref(iii)) |
---|
134 | enddo |
---|
135 | C |
---|
136 | Agrif_Parent_Rhot = float(res) |
---|
137 | C |
---|
138 | C |
---|
139 | End function Agrif_Parent_Rhot |
---|
140 | C |
---|
141 | C |
---|
142 | C ************************************************************************** |
---|
143 | CCC Function Agrif_Parent_IRhot |
---|
144 | C ************************************************************************** |
---|
145 | C |
---|
146 | Function Agrif_Parent_IRhot() |
---|
147 | C |
---|
148 | CCC Description: |
---|
149 | CCC Function returning the time refinement factor of the parent grid of the |
---|
150 | CCC current grid. |
---|
151 | C |
---|
152 | C Declarations: |
---|
153 | C |
---|
154 | |
---|
155 | C |
---|
156 | INTEGER :: Agrif_Parent_IRhot ! Result |
---|
157 | C |
---|
158 | C Local scalar |
---|
159 | INTEGER :: res ! Intermediate result |
---|
160 | INTEGER :: iii |
---|
161 | C |
---|
162 | C |
---|
163 | res=1 |
---|
164 | C |
---|
165 | do iii = 1 , Agrif_Probdim |
---|
166 | res = max(res, AGRIF_Curgrid % parent % timeref(iii)) |
---|
167 | enddo |
---|
168 | C |
---|
169 | Agrif_Parent_IRhot = res |
---|
170 | C |
---|
171 | C |
---|
172 | End function Agrif_Parent_IRhot |
---|
173 | C |
---|
174 | C |
---|
175 | C ************************************************************************** |
---|
176 | CCC Function Agrif_Nbstepint |
---|
177 | C ************************************************************************** |
---|
178 | C |
---|
179 | Function Agrif_Nbstepint() |
---|
180 | C |
---|
181 | CCC Description: |
---|
182 | CCC Function for the calculation of the coefficients used for the time |
---|
183 | CCC interpolation (module Agrif_Boundary). |
---|
184 | C |
---|
185 | C Declarations: |
---|
186 | C |
---|
187 | |
---|
188 | C |
---|
189 | INTEGER :: Agrif_nbstepint ! result |
---|
190 | C |
---|
191 | C |
---|
192 | Agrif_nbstepint = mod(AGRIF_CURGRID % ngridstep, |
---|
193 | & int(AGRIF_rhot())) |
---|
194 | C |
---|
195 | C |
---|
196 | End function Agrif_Nbstepint |
---|
197 | C |
---|
198 | C |
---|
199 | C |
---|
200 | CC ************************************************************************** |
---|
201 | CCC Function Agrif_Parent_Nbstepint |
---|
202 | C ************************************************************************** |
---|
203 | C |
---|
204 | Function Agrif_Parent_Nbstepint() |
---|
205 | C |
---|
206 | CCC Description: |
---|
207 | CCC Function for the calculation of the coefficients used for the time |
---|
208 | CCC interpolation (module Agrif_Boundary). |
---|
209 | C |
---|
210 | C Declarations: |
---|
211 | C |
---|
212 | |
---|
213 | C |
---|
214 | INTEGER :: Agrif_Parent_Nbstepint ! result |
---|
215 | C |
---|
216 | C |
---|
217 | Agrif_Parent_Nbstepint = mod(AGRIF_CURGRID % parent % ngridstep, |
---|
218 | & int(AGRIF_Parent_Rhot())) |
---|
219 | C |
---|
220 | C |
---|
221 | End function Agrif_Parent_Nbstepint |
---|
222 | C |
---|
223 | C ************************************************************************** |
---|
224 | CCC Subroutine Agrif_InterpNearBorderX |
---|
225 | C ************************************************************************** |
---|
226 | C |
---|
227 | Subroutine Agrif_InterpNearBorderX() |
---|
228 | C |
---|
229 | CCC Description: |
---|
230 | CCC Subroutine allowing to interpole (in the x direction) on a near border of |
---|
231 | CCC the current grid if this one has a common border with the root coarse |
---|
232 | CCC grid. |
---|
233 | C |
---|
234 | C Declarations: |
---|
235 | C |
---|
236 | |
---|
237 | C |
---|
238 | C |
---|
239 | AGRIF_CURGRID % NearRootBorder(1) = .FALSE. |
---|
240 | C |
---|
241 | C |
---|
242 | End Subroutine Agrif_InterpNearBorderX |
---|
243 | C |
---|
244 | C |
---|
245 | C |
---|
246 | C ************************************************************************** |
---|
247 | CCC Subroutine Agrif_InterpDistantBorderX |
---|
248 | C ************************************************************************** |
---|
249 | C |
---|
250 | Subroutine Agrif_InterpDistantBorderX() |
---|
251 | C |
---|
252 | CCC Description: |
---|
253 | CCC Subroutine allowing to interpole (in the x direction) on a distant border |
---|
254 | CCC of the current grid if this one has a common border with the root coarse |
---|
255 | CCC grid. |
---|
256 | C |
---|
257 | C Declarations: |
---|
258 | C |
---|
259 | |
---|
260 | C |
---|
261 | C |
---|
262 | AGRIF_CURGRID % DistantRootBorder(1) = .FALSE. |
---|
263 | C |
---|
264 | C |
---|
265 | End Subroutine Agrif_InterpDistantBorderX |
---|
266 | C |
---|
267 | C |
---|
268 | C |
---|
269 | C ************************************************************************** |
---|
270 | CCC Subroutine Agrif_InterpNearBorderY |
---|
271 | C ************************************************************************** |
---|
272 | C |
---|
273 | Subroutine Agrif_InterpNearBorderY() |
---|
274 | C |
---|
275 | CCC Description: |
---|
276 | CCC Subroutine allowing to interpole (in the y direction) on a near border of |
---|
277 | CCC the current grid if this one has a common border with the root coarse |
---|
278 | CCC grid. |
---|
279 | C |
---|
280 | C Declarations: |
---|
281 | C |
---|
282 | |
---|
283 | C |
---|
284 | C |
---|
285 | AGRIF_CURGRID % NearRootBorder(2) = .FALSE. |
---|
286 | C |
---|
287 | C |
---|
288 | End Subroutine Agrif_InterpNearBorderY |
---|
289 | C |
---|
290 | C |
---|
291 | C |
---|
292 | C ************************************************************************** |
---|
293 | CCC Subroutine Agrif_InterpDistantBorderY |
---|
294 | C ************************************************************************** |
---|
295 | C |
---|
296 | Subroutine Agrif_InterpDistantBorderY() |
---|
297 | C |
---|
298 | CCC Description: |
---|
299 | CCC Subroutine allowing to interpole (in the y direction) on a distant border |
---|
300 | CCC of the current grid if this one has a common border with the root coarse |
---|
301 | CCC grid. |
---|
302 | C |
---|
303 | C Declarations: |
---|
304 | C |
---|
305 | |
---|
306 | C |
---|
307 | C |
---|
308 | AGRIF_CURGRID % DistantRootBorder(2) = .FALSE. |
---|
309 | C |
---|
310 | C |
---|
311 | End Subroutine Agrif_InterpDistantBorderY |
---|
312 | C |
---|
313 | C |
---|
314 | C |
---|
315 | C ************************************************************************** |
---|
316 | CCC Subroutine Agrif_InterpNearBorderZ |
---|
317 | C ************************************************************************** |
---|
318 | C |
---|
319 | Subroutine Agrif_InterpNearBorderZ() |
---|
320 | C |
---|
321 | CCC Description: |
---|
322 | CCC Subroutine allowing to interpole (in the z direction) on a near border of |
---|
323 | CCC the current grid if this one has a common border with the root coarse |
---|
324 | CCC grid. |
---|
325 | C |
---|
326 | C Declarations: |
---|
327 | C |
---|
328 | |
---|
329 | C |
---|
330 | C |
---|
331 | AGRIF_CURGRID % NearRootBorder(3) = .FALSE. |
---|
332 | C |
---|
333 | C |
---|
334 | End Subroutine Agrif_InterpNearBorderZ |
---|
335 | C |
---|
336 | C |
---|
337 | C |
---|
338 | C ************************************************************************** |
---|
339 | CCC Subroutine Agrif_InterpDistantBorderZ |
---|
340 | C ************************************************************************** |
---|
341 | C |
---|
342 | Subroutine Agrif_InterpDistantBorderZ() |
---|
343 | C |
---|
344 | CCC Description: |
---|
345 | CCC Subroutine allowing to interpole (in the z direction) on a distant border |
---|
346 | CCC of the current grid if this one has a common border with the root coarse |
---|
347 | CCC grid. |
---|
348 | C |
---|
349 | C Declarations: |
---|
350 | C |
---|
351 | |
---|
352 | C |
---|
353 | C |
---|
354 | AGRIF_CURGRID % DistantRootBorder(3) = .FALSE. |
---|
355 | C |
---|
356 | C |
---|
357 | End Subroutine Agrif_InterpDistantBorderZ |
---|
358 | C |
---|
359 | C ************************************************************************** |
---|
360 | CCC Function Agrif_Parent_Nb_Step |
---|
361 | C ************************************************************************** |
---|
362 | C |
---|
363 | Function AGRIF_Parent_Nb_Step() |
---|
364 | C |
---|
365 | CCC Description: |
---|
366 | CCC Function returning the number of time steps of the parent grid of the |
---|
367 | CCC current grid. |
---|
368 | C |
---|
369 | C Declarations: |
---|
370 | C |
---|
371 | |
---|
372 | C |
---|
373 | INTEGER :: AGRIF_Parent_Nb_Step ! Result |
---|
374 | C |
---|
375 | C |
---|
376 | if (Agrif_Root()) then |
---|
377 | C |
---|
378 | Agrif_Parent_Nb_Step = -1 |
---|
379 | C |
---|
380 | else |
---|
381 | C |
---|
382 | Agrif_Parent_Nb_Step = Agrif_Curgrid % parent % ngridstep |
---|
383 | C |
---|
384 | endif |
---|
385 | C |
---|
386 | C |
---|
387 | End function Agrif_Parent_Nb_Step |
---|
388 | C |
---|
389 | C |
---|
390 | C |
---|
391 | C ************************************************************************** |
---|
392 | CCC Function Agrif_Root |
---|
393 | C ************************************************************************** |
---|
394 | C |
---|
395 | Function Agrif_Root() |
---|
396 | C |
---|
397 | CCC Description: |
---|
398 | CCC Function indicating if the current grid is or not the root grid. |
---|
399 | C |
---|
400 | C Declarations: |
---|
401 | C |
---|
402 | |
---|
403 | C |
---|
404 | LOGICAL :: Agrif_Root ! Result |
---|
405 | C |
---|
406 | C |
---|
407 | if (AGRIF_CURGRID % fixedrank .EQ. 0) then |
---|
408 | C |
---|
409 | Agrif_Root = .TRUE. |
---|
410 | C |
---|
411 | else |
---|
412 | C |
---|
413 | Agrif_Root = .FALSE. |
---|
414 | C |
---|
415 | endif |
---|
416 | C |
---|
417 | C |
---|
418 | End function Agrif_Root |
---|
419 | C |
---|
420 | C |
---|
421 | C |
---|
422 | C ************************************************************************** |
---|
423 | CCC Function Agrif_Parent_Root |
---|
424 | C ************************************************************************** |
---|
425 | C |
---|
426 | Function Agrif_Parent_Root() |
---|
427 | C |
---|
428 | CCC Description: |
---|
429 | CCC Function indicating if the parent grid of the current grid is or not the |
---|
430 | CCC root grid. |
---|
431 | C |
---|
432 | C Declarations: |
---|
433 | C |
---|
434 | |
---|
435 | C |
---|
436 | LOGICAL :: Agrif_Parent_Root ! Result |
---|
437 | C |
---|
438 | C |
---|
439 | if (AGRIF_CURGRID % parent % fixedrank .EQ. 0) then |
---|
440 | C |
---|
441 | Agrif_Parent_Root = .TRUE. |
---|
442 | C |
---|
443 | else |
---|
444 | C |
---|
445 | Agrif_Parent_Root = .FALSE. |
---|
446 | C |
---|
447 | endif |
---|
448 | C |
---|
449 | C |
---|
450 | End function Agrif_Parent_Root |
---|
451 | C |
---|
452 | C |
---|
453 | C |
---|
454 | C ************************************************************************** |
---|
455 | CCC Function Agrif_Fixed |
---|
456 | C ************************************************************************** |
---|
457 | C |
---|
458 | Function Agrif_Fixed() |
---|
459 | C |
---|
460 | CCC Description: |
---|
461 | CCC Function returning the number of the current grid. |
---|
462 | C |
---|
463 | C Declarations: |
---|
464 | C |
---|
465 | |
---|
466 | C |
---|
467 | INTEGER Agrif_Fixed ! Result |
---|
468 | C |
---|
469 | C |
---|
470 | if (Agrif_Curgrid % fixed) then |
---|
471 | C |
---|
472 | Agrif_Fixed = Agrif_Curgrid % fixedrank |
---|
473 | C |
---|
474 | else |
---|
475 | C |
---|
476 | Agrif_Fixed = -1 |
---|
477 | C |
---|
478 | endif |
---|
479 | C |
---|
480 | C |
---|
481 | End function Agrif_Fixed |
---|
482 | C |
---|
483 | C |
---|
484 | C |
---|
485 | C ************************************************************************** |
---|
486 | CCC Function Agrif_Parent_Fixed |
---|
487 | C ************************************************************************** |
---|
488 | |
---|
489 | Function Agrif_Parent_Fixed() |
---|
490 | C |
---|
491 | CCC Description: |
---|
492 | CCC Function returning the number of the parent grid of the current grid. |
---|
493 | C |
---|
494 | C Declarations: |
---|
495 | C |
---|
496 | |
---|
497 | C |
---|
498 | INTEGER Agrif_Parent_Fixed ! Result |
---|
499 | C |
---|
500 | C |
---|
501 | if (Agrif_Curgrid % parent % fixed) then |
---|
502 | C |
---|
503 | Agrif_Parent_Fixed = AGRIF_CURGRID % parent % fixedrank |
---|
504 | C |
---|
505 | else |
---|
506 | C |
---|
507 | Agrif_Parent_Fixed = 0 |
---|
508 | C |
---|
509 | endif |
---|
510 | C |
---|
511 | C |
---|
512 | End function Agrif_Parent_Fixed |
---|
513 | C |
---|
514 | C |
---|
515 | C |
---|
516 | C ************************************************************************** |
---|
517 | CCC Function Agrif_Is_Fixed |
---|
518 | C ************************************************************************** |
---|
519 | |
---|
520 | Function Agrif_Is_Fixed() |
---|
521 | C |
---|
522 | CCC Description: |
---|
523 | CCC Function returning true if the current grid is fixed. |
---|
524 | C |
---|
525 | C Declarations: |
---|
526 | C |
---|
527 | |
---|
528 | C |
---|
529 | LOGICAL Agrif_Is_Fixed ! Result |
---|
530 | C |
---|
531 | C |
---|
532 | if (Agrif_Curgrid % fixed) then |
---|
533 | C |
---|
534 | Agrif_Is_Fixed = .true. |
---|
535 | C |
---|
536 | else |
---|
537 | C |
---|
538 | Agrif_Is_Fixed = .false. |
---|
539 | C |
---|
540 | endif |
---|
541 | C |
---|
542 | C |
---|
543 | End function Agrif_Is_Fixed |
---|
544 | C |
---|
545 | C |
---|
546 | C |
---|
547 | C ************************************************************************** |
---|
548 | CCC Function Agrif_Parent_Is_Fixed |
---|
549 | C ************************************************************************** |
---|
550 | |
---|
551 | Function Agrif_Parent_Is_Fixed() |
---|
552 | C |
---|
553 | CCC Description: |
---|
554 | CCC Function returning true if the parent grid of the current grid is fixed. |
---|
555 | C |
---|
556 | C Declarations: |
---|
557 | C |
---|
558 | |
---|
559 | C |
---|
560 | LOGICAL Agrif_Parent_Is_Fixed ! Result |
---|
561 | C |
---|
562 | C |
---|
563 | if (Agrif_Curgrid % parent % fixed) then |
---|
564 | C |
---|
565 | Agrif_Parent_Is_Fixed = .true. |
---|
566 | C |
---|
567 | else |
---|
568 | C |
---|
569 | Agrif_Parent_Is_Fixed = .false. |
---|
570 | C |
---|
571 | endif |
---|
572 | C |
---|
573 | C |
---|
574 | End function Agrif_Parent_Is_Fixed |
---|
575 | C |
---|
576 | C |
---|
577 | C |
---|
578 | C ************************************************************************** |
---|
579 | CCC Function AGRIF_CFixed |
---|
580 | C ************************************************************************** |
---|
581 | |
---|
582 | Function AGRIF_CFixed() |
---|
583 | C |
---|
584 | CCC Description: |
---|
585 | CCC Function returning the number of the current grid. |
---|
586 | C |
---|
587 | C Declarations: |
---|
588 | C |
---|
589 | |
---|
590 | C |
---|
591 | CHARACTER(3) AGRIF_CFixed ! Result |
---|
592 | C |
---|
593 | C Local variables |
---|
594 | CHARACTER(3) cfixed |
---|
595 | INTEGER fixed |
---|
596 | C |
---|
597 | C |
---|
598 | fixed = Agrif_Fixed() |
---|
599 | C |
---|
600 | if(fixed.NE.-1) then |
---|
601 | C |
---|
602 | if (fixed .LE. 9) then |
---|
603 | C |
---|
604 | write(cfixed,'(i1)')fixed |
---|
605 | C |
---|
606 | else |
---|
607 | C |
---|
608 | write(cfixed,'(i2)')fixed |
---|
609 | C |
---|
610 | endif |
---|
611 | C |
---|
612 | AGrif_Cfixed=cfixed |
---|
613 | C |
---|
614 | else |
---|
615 | C |
---|
616 | print*,'Call to AGRIF_CFixed() on a moving grid' |
---|
617 | stop |
---|
618 | C |
---|
619 | endif |
---|
620 | |
---|
621 | End function AGRIF_CFixed |
---|
622 | C |
---|
623 | C |
---|
624 | C |
---|
625 | C ************************************************************************** |
---|
626 | CCC Function AGRIF_Parent_CFixed |
---|
627 | C ************************************************************************** |
---|
628 | |
---|
629 | Function AGRIF_Parent_CFixed() |
---|
630 | C |
---|
631 | CCC Description: |
---|
632 | CCC Function returning the number of the parent grid of the current grid. |
---|
633 | C |
---|
634 | C Declarations: |
---|
635 | C |
---|
636 | |
---|
637 | C |
---|
638 | CHARACTER(3) AGRIF_Parent_CFixed ! Result |
---|
639 | C |
---|
640 | C Local variables |
---|
641 | CHARACTER(3) cfixed |
---|
642 | INTEGER fixed |
---|
643 | C |
---|
644 | C |
---|
645 | fixed = Agrif_Parent_Fixed() |
---|
646 | C |
---|
647 | if(fixed.NE.-1) then |
---|
648 | C |
---|
649 | if (fixed .LE. 9) then |
---|
650 | C |
---|
651 | write(cfixed,'(i1)')fixed |
---|
652 | C |
---|
653 | else |
---|
654 | C |
---|
655 | write(cfixed,'(i2)')fixed |
---|
656 | C |
---|
657 | endif |
---|
658 | C |
---|
659 | AGrif_Parent_Cfixed=cfixed |
---|
660 | C |
---|
661 | else |
---|
662 | C |
---|
663 | print*,'Illegal call to AGRIF_Parent_CFixed()' |
---|
664 | stop |
---|
665 | C |
---|
666 | endif |
---|
667 | |
---|
668 | End function AGRIF_Parent_CFixed |
---|
669 | C |
---|
670 | C |
---|
671 | C |
---|
672 | C ************************************************************************** |
---|
673 | CCC Subroutine Agrif_ChildGrid_to_ParentGrid |
---|
674 | C ************************************************************************** |
---|
675 | C |
---|
676 | Subroutine Agrif_ChildGrid_to_ParentGrid() |
---|
677 | C |
---|
678 | CCC Description: |
---|
679 | CCC Subroutine allowing to make the pointer AGRIF_CURGRID point on the parent |
---|
680 | CCC grid of the current grid. |
---|
681 | C |
---|
682 | C Declarations: |
---|
683 | C |
---|
684 | |
---|
685 | C |
---|
686 | |
---|
687 | Agrif_Curgrid%Parent%save_grid => Agrif_Curgrid |
---|
688 | C |
---|
689 | Call Agrif_Instance(Agrif_Curgrid%parent) |
---|
690 | C |
---|
691 | C |
---|
692 | End Subroutine Agrif_ChildGrid_to_ParentGrid |
---|
693 | C |
---|
694 | C |
---|
695 | C |
---|
696 | C ************************************************************************** |
---|
697 | CCC Subroutine Agrif_ParentGrid_to_ChildGrid |
---|
698 | C ************************************************************************** |
---|
699 | C |
---|
700 | Subroutine Agrif_ParentGrid_to_ChildGrid() |
---|
701 | C |
---|
702 | CCC Description: |
---|
703 | CCC Subroutine allowing to make the pointer AGRIF_CURGRID point on the child |
---|
704 | CCC grid after having called the Agrif_ChildGrid_to_ParentGrid subroutine. |
---|
705 | C |
---|
706 | C Declarations: |
---|
707 | C |
---|
708 | |
---|
709 | C |
---|
710 | C |
---|
711 | Call Agrif_Instance(Agrif_Curgrid%save_grid) |
---|
712 | C |
---|
713 | C |
---|
714 | End Subroutine Agrif_ParentGrid_to_ChildGrid |
---|
715 | C |
---|
716 | C |
---|
717 | C |
---|
718 | C ************************************************************************** |
---|
719 | CCC Function Agrif_Get_Unit |
---|
720 | C ************************************************************************** |
---|
721 | C |
---|
722 | Function Agrif_Get_Unit() |
---|
723 | |
---|
724 | CCC Description : return a unit not connected to any file |
---|
725 | C |
---|
726 | C Declarations |
---|
727 | C |
---|
728 | |
---|
729 | C |
---|
730 | INTEGER Agrif_Get_Unit |
---|
731 | C |
---|
732 | C Local scalars |
---|
733 | INTEGER n |
---|
734 | LOGICAL op |
---|
735 | C |
---|
736 | INTEGER :: nunit |
---|
737 | INTEGER :: iii,out,iiimax |
---|
738 | Logical :: BEXIST |
---|
739 | INTEGER,DIMENSION(1:1000) :: ForbiddenUnit |
---|
740 | C |
---|
741 | C |
---|
742 | C Load forbidden Unit if the file Agrif_forbidenUnit exist |
---|
743 | C |
---|
744 | |
---|
745 | INQUIRE(FILE='Agrif_forbiddenUnit.txt',EXIST=BEXIST) |
---|
746 | If (.not. BEXIST) Then |
---|
747 | c File Agrif_forbiddenUnit.txt not found |
---|
748 | Else |
---|
749 | nunit = 777 |
---|
750 | open(nunit,file='Agrif_forbiddenUnit.txt',form='formatted', |
---|
751 | & status="old") |
---|
752 | iii = 1 |
---|
753 | do while ( .TRUE. ) |
---|
754 | read(nunit,*,END = 99) ForbiddenUnit(iii) |
---|
755 | iii = iii + 1 |
---|
756 | enddo |
---|
757 | 99 CONTINUE |
---|
758 | iiimax = iii |
---|
759 | close(nunit) |
---|
760 | endif |
---|
761 | C |
---|
762 | do n = 7,1000 |
---|
763 | C |
---|
764 | Inquire(Unit=n,Opened=op) |
---|
765 | C |
---|
766 | out = 0 |
---|
767 | if ( BEXIST .AND. .NOT.op) then |
---|
768 | do iii = 1 , iiimax |
---|
769 | if ( n .EQ. ForbiddenUnit(iii) ) out = 1 |
---|
770 | enddo |
---|
771 | endif |
---|
772 | C |
---|
773 | if (.NOT.op .AND. out .EQ. 0) exit |
---|
774 | C |
---|
775 | enddo |
---|
776 | C |
---|
777 | Agrif_Get_Unit=n |
---|
778 | C |
---|
779 | C |
---|
780 | End Function Agrif_Get_Unit |
---|
781 | |
---|
782 | Subroutine Agrif_Set_Efficiency(eff) |
---|
783 | REAL :: eff |
---|
784 | |
---|
785 | IF ((eff.LT.0.).OR.(eff.GT.1)) THEN |
---|
786 | write(*,*)'Error Efficiency should be between 0 and 1' |
---|
787 | stop |
---|
788 | ELSE |
---|
789 | Agrif_efficiency = eff |
---|
790 | ENDIF |
---|
791 | End Subroutine Agrif_Set_Efficiency |
---|
792 | |
---|
793 | Subroutine Agrif_Set_Regridding(regfreq) |
---|
794 | INTEGER :: regfreq |
---|
795 | |
---|
796 | IF (regfreq.LT.0) THEN |
---|
797 | write(*,*)'Regridding frequency should be positive' |
---|
798 | stop |
---|
799 | ELSE |
---|
800 | Agrif_regridding = regfreq |
---|
801 | ENDIF |
---|
802 | End Subroutine Agrif_Set_Regridding |
---|
803 | C |
---|
804 | C |
---|
805 | C ************************************************************************** |
---|
806 | CCC subroutine Agrif_Set_coeffref_x |
---|
807 | C ************************************************************************** |
---|
808 | subroutine Agrif_Set_coeffref_x(coefref) |
---|
809 | |
---|
810 | integer :: coefref |
---|
811 | |
---|
812 | if (coefref.LT.0) then |
---|
813 | write(*,*)'Coefficient of raffinement should be positive' |
---|
814 | stop |
---|
815 | else |
---|
816 | AGRIF_coeffref(1) = coefref |
---|
817 | endif |
---|
818 | end subroutine Agrif_Set_coeffref_x |
---|
819 | C |
---|
820 | C ************************************************************************** |
---|
821 | CCC subroutine Agrif_Set_coeffref_y |
---|
822 | C ************************************************************************** |
---|
823 | subroutine Agrif_Set_coeffref_y(coefref) |
---|
824 | |
---|
825 | integer :: coefref |
---|
826 | |
---|
827 | if (coefref.LT.0) then |
---|
828 | write(*,*)'Coefficient of raffinement should be positive' |
---|
829 | stop |
---|
830 | else |
---|
831 | AGRIF_coeffref(2) = coefref |
---|
832 | endif |
---|
833 | end subroutine Agrif_Set_coeffref_y |
---|
834 | C |
---|
835 | C ************************************************************************** |
---|
836 | CCC subroutine Agrif_Set_coeffref_z |
---|
837 | C ************************************************************************** |
---|
838 | subroutine Agrif_Set_coeffref_z(coefref) |
---|
839 | |
---|
840 | integer :: coefref |
---|
841 | |
---|
842 | if (coefref.LT.0) then |
---|
843 | write(*,*)'Coefficient of raffinement should be positive' |
---|
844 | stop |
---|
845 | else |
---|
846 | AGRIF_coeffref(3) = coefref |
---|
847 | endif |
---|
848 | end subroutine Agrif_Set_coeffref_z |
---|
849 | C |
---|
850 | C ************************************************************************** |
---|
851 | CCC subroutine Agrif_Set_coeffreft_x |
---|
852 | C ************************************************************************** |
---|
853 | subroutine Agrif_Set_coeffreft_x(coefref) |
---|
854 | |
---|
855 | integer :: coefref |
---|
856 | |
---|
857 | if (coefref.LT.0) then |
---|
858 | write(*,*)'Coefficient of time raffinement should be positive' |
---|
859 | stop |
---|
860 | else |
---|
861 | AGRIF_coeffreft(1) = coefref |
---|
862 | endif |
---|
863 | end subroutine Agrif_Set_coeffreft_x |
---|
864 | C |
---|
865 | C ************************************************************************** |
---|
866 | CCC subroutine Agrif_Set_coeffreft_y |
---|
867 | C ************************************************************************** |
---|
868 | subroutine Agrif_Set_coeffreft_y(coefref) |
---|
869 | |
---|
870 | integer :: coefref |
---|
871 | |
---|
872 | if (coefref.LT.0) then |
---|
873 | write(*,*)'Coefficient of time raffinement should be positive' |
---|
874 | stop |
---|
875 | else |
---|
876 | AGRIF_coeffreft(2) = coefref |
---|
877 | endif |
---|
878 | end subroutine Agrif_Set_coeffreft_y |
---|
879 | C |
---|
880 | C ************************************************************************** |
---|
881 | CCC subroutine Agrif_Set_coeffreft_z |
---|
882 | C ************************************************************************** |
---|
883 | subroutine Agrif_Set_coeffreft_z(coefref) |
---|
884 | |
---|
885 | integer :: coefref |
---|
886 | |
---|
887 | if (coefref.LT.0) then |
---|
888 | write(*,*)'Coefficient of time raffinement should be positive' |
---|
889 | stop |
---|
890 | else |
---|
891 | AGRIF_coeffreft(3) = coefref |
---|
892 | endif |
---|
893 | end subroutine Agrif_Set_coeffreft_z |
---|
894 | C |
---|
895 | C ************************************************************************** |
---|
896 | CCC subroutine Agrif_Set_Minwidth |
---|
897 | C ************************************************************************** |
---|
898 | subroutine Agrif_Set_Minwidth(coefminwidth) |
---|
899 | |
---|
900 | integer :: coefminwidth |
---|
901 | |
---|
902 | if (coefminwidth.LT.0) then |
---|
903 | write(*,*)'Coefficient of Minwidth should be positive' |
---|
904 | stop |
---|
905 | else |
---|
906 | Agrif_Minwidth = coefminwidth |
---|
907 | endif |
---|
908 | end subroutine Agrif_Set_Minwidth |
---|
909 | C |
---|
910 | C ************************************************************************** |
---|
911 | CCC subroutine Agrif_Set_Rafmax |
---|
912 | C ************************************************************************** |
---|
913 | subroutine Agrif_Set_Rafmax(coefrafmax) |
---|
914 | |
---|
915 | integer :: coefrafmax |
---|
916 | integer :: i |
---|
917 | real :: res |
---|
918 | |
---|
919 | if (coefrafmax.LT.0) then |
---|
920 | write(*,*)'Coefficient of should be positive' |
---|
921 | stop |
---|
922 | else |
---|
923 | res = 1. |
---|
924 | do i = 1 , coefrafmax - 1 |
---|
925 | res = res * FLOAT(AGRIF_coeffref(1)) |
---|
926 | enddo |
---|
927 | if ( res .EQ. 0 ) res = 1 |
---|
928 | Agrif_Mind(1) = 1. / res |
---|
929 | C |
---|
930 | res = 1. |
---|
931 | do i = 1 , coefrafmax - 1 |
---|
932 | res = res * FLOAT(AGRIF_coeffref(2)) |
---|
933 | enddo |
---|
934 | if ( res .EQ. 0 ) res = 1 |
---|
935 | Agrif_Mind(2) = 1. / res |
---|
936 | C |
---|
937 | res = 1. |
---|
938 | do i = 1 , coefrafmax - 1 |
---|
939 | res = res * FLOAT(AGRIF_coeffref(3)) |
---|
940 | enddo |
---|
941 | if ( res .EQ. 0 ) res = 1 |
---|
942 | Agrif_Mind(3) = 1. / res |
---|
943 | C |
---|
944 | endif |
---|
945 | end subroutine Agrif_Set_Rafmax |
---|
946 | C |
---|
947 | C ************************************************************************** |
---|
948 | CCC subroutine Agrif_Open_File |
---|
949 | C ************************************************************************** |
---|
950 | subroutine Agrif_Open_File(num_id,name_file) |
---|
951 | |
---|
952 | integer :: num_id |
---|
953 | character(*) :: name_file |
---|
954 | |
---|
955 | num_id = Agrif_Get_Unit() |
---|
956 | if ( .NOT. Agrif_Root() ) then |
---|
957 | name_file = TRIM(Agrif_CFixed())//'_'//TRIM(name_file) |
---|
958 | endif |
---|
959 | |
---|
960 | end subroutine Agrif_Open_File |
---|
961 | |
---|
962 | C ************************************************************************** |
---|
963 | CCC subroutine Agrif_Set_MaskMaxSearch |
---|
964 | C ************************************************************************** |
---|
965 | subroutine Agrif_Set_MaskMaxSearch(mymaxsearch) |
---|
966 | integer mymaxsearch |
---|
967 | MaxSearch = mymaxsearch |
---|
968 | end subroutine Agrif_Set_MaskMaxSearch |
---|
969 | |
---|
970 | C ***************************************************************** |
---|
971 | CCC subroutine Agrif_Level |
---|
972 | C ***************************************************************** |
---|
973 | Function Agrif_Level() |
---|
974 | Integer :: Agrif_Level |
---|
975 | |
---|
976 | Agrif_Level = Agrif_Curgrid % level |
---|
977 | |
---|
978 | End Function Agrif_Level |
---|
979 | |
---|
980 | C ***************************************************************** |
---|
981 | CCC subroutine Agrif_MaxLevel |
---|
982 | C ***************************************************************** |
---|
983 | Function Agrif_MaxLevel() |
---|
984 | Integer :: Agrif_MaxLevel |
---|
985 | |
---|
986 | Agrif_MaxLevel = Agrif_MaxLevelLoc |
---|
987 | |
---|
988 | End Function Agrif_MaxLevel |
---|
989 | |
---|
990 | End Module Agrif_CurgridFunctions |
---|