Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
chkp_output.f90
Go to the documentation of this file.
1! Copyright (c) 2021-2023, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
35 use checkpoint, only : chkp_t
36 use output, only : output_t
37 use num_types, only : rp
38 implicit none
39 private
40
41 type, public, extends(output_t) :: chkp_output_t
42 type(chkp_t), pointer :: chkp
43 contains
44 procedure, pass(this) :: init => chkp_output_init
45 procedure, pass(this) :: free => chkp_output_free
46 procedure, pass(this) :: sample => chkp_output_sample
47 end type chkp_output_t
48
49contains
50
51 subroutine chkp_output_init(this, chkp, name, path, fmt, overwrite)
52 class(chkp_output_t), intent(inout) :: this
53 type(chkp_t), intent(in), target :: chkp
54 character(len=*), intent(in), optional :: name
55 character(len=*), intent(in), optional :: path
56 character(len=*), intent(in), optional :: fmt
57 logical, intent(in), optional :: overwrite
58 character(len=1024) :: fname
59 character(len=10) :: suffix
60
61 suffix = '.chkp'
62 if (present(fmt)) then
63 if (fmt .eq. 'hdf5') then
64 suffix = '.h5'
65 end if
66 end if
67
68 fname = 'fluid'
69 if (present(name)) fname = trim(name)
70 if (present(path)) fname = trim(path) // trim(fname)
71 fname = trim(fname) // trim(suffix)
72
73 call this%init_base(fname, overwrite = overwrite)
74 this%chkp => chkp
75 end subroutine chkp_output_init
76
77 subroutine chkp_output_free(this)
78 class(chkp_output_t), intent(inout) :: this
79
80 call this%free_base()
81 nullify(this%chkp)
82
83 end subroutine chkp_output_free
84
86 subroutine chkp_output_sample(this, t)
87 class(chkp_output_t), intent(inout) :: this
88 real(kind=rp), intent(in) :: t
89
90 call this%chkp%sync_host()
91 call this%file_%write(this%chkp, t)
92
93 end subroutine chkp_output_sample
94
95end module chkp_output
Defines a checkpoint.
Defines an output for a checkpoint.
subroutine chkp_output_free(this)
subroutine chkp_output_init(this, chkp, name, path, fmt, overwrite)
subroutine chkp_output_sample(this, t)
Sample a checkpoint at time t.
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines an output.
Definition output.f90:34
Abstract type defining an output type.
Definition output.f90:41