38 use json_module,
only : json_file
59 real(kind=
rp),
pointer :: dr(:,:,:,:)
61 real(kind=
rp),
pointer :: ds(:,:,:,:)
63 real(kind=
rp),
pointer :: dt(:,:,:,:)
71 procedure, pass(this) :: init_from_attributes => &
84 type(json_file),
intent(inout) :: json
85 class(
case_t),
intent(inout),
target :: case
86 character(len=:),
allocatable :: fieldname
87 character(len=:),
allocatable :: direction
88 character(len=20) :: fields(1)
92 call json_get(json,
"field", fieldname)
93 call json_get(json,
"direction", direction)
95 fields(1) =
"d" // trim(fieldname) //
"_d" // direction
96 call json%add(
"fields", fields)
98 call this%init_base(json,
case)
99 call this%writer%init(json,
case)
107 character(len=*) :: fieldname
108 character(len=*) :: direction
113 "d" // fieldname //
"_d" // direction)
115 if (direction .eq.
"x")
then
116 this%dr => this%case%fluid%c_Xh%drdx
117 this%ds => this%case%fluid%c_Xh%dsdx
118 this%dt => this%case%fluid%c_Xh%dtdx
119 else if (direction .eq.
"y")
then
120 this%dr => this%case%fluid%c_Xh%drdy
121 this%ds => this%case%fluid%c_Xh%dsdy
122 this%dt => this%case%fluid%c_Xh%dtdy
123 else if (direction .eq.
"z")
then
124 this%dr => this%case%fluid%c_Xh%drdz
125 this%ds => this%case%fluid%c_Xh%dsdz
126 this%dt => this%case%fluid%c_Xh%dtdz
128 call neko_error(
"The direction of the derivative must be x, y or z")
135 call this%free_base()
136 call this%writer%free()
149 real(kind=
rp),
intent(in) :: t
150 integer,
intent(in) :: tstep
152 call dudxyz(this%du%x, this%u%x, this%dr, this%dr, this%dr,&
153 this%case%fluid%c_Xh)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Defines a simulation case.
Implements the derivative_t type.
subroutine derivative_init_from_attributes(this, fieldname, direction)
Actual constructor.
subroutine derivative_free(this)
Destructor.
subroutine derivative_compute(this, t, tstep)
Compute the derivative field.
subroutine derivative_init_from_json(this, json, case)
Constructor from json.
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Implements the field_writer_t type.
Implements fld_file_output_t.
Utilities for retrieving parameters from the case files.
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.
subroutine, public dudxyz(du, u, dr, ds, dt, coef)
Compute derivative of a scalar field along a single direction.
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
A simulation component that computes a derivative of a field. Wraps the duxyz operator.
A simulation component that writes a 3d field to a file.
A simple output saving a list of fields to a .fld file.
Base abstract class for simulation components.