45 use json_module,
only: json_file
66 class(
ksp_t),
allocatable :: shared_ksp
88 numerics_params, user, chkp, ulag, vlag, wlag, time_scheme, rho)
90 integer,
intent(in) :: n_scalars
91 type(
mesh_t),
target,
intent(in) :: msh
92 type(
coef_t),
target,
intent(in) :: coef
93 type(
gs_t),
target,
intent(inout) :: gs
94 type(json_file),
target,
intent(inout) :: params
95 type(json_file),
target,
intent(inout) :: numerics_params
96 type(
user_t),
target,
intent(in) :: user
99 TYPE(
field_t),
TARGET,
INTENT(IN) :: rho
100 type(
chkp_t),
target,
intent(inout) :: chkp
101 type(json_file) :: json_subdict
103 character(len=:),
allocatable :: field_name
104 character(len=:),
allocatable :: field_names(:)
105 character(len=256) :: error_msg
112 allocate(
character(len=256) :: field_names(n_scalars))
119 if (json_subdict%valid_path(
'name'))
then
120 call json_get(json_subdict,
'name', field_name)
126 if (len_trim(field_name) == 0)
then
127 if (n_scalars == 1)
then
130 write(field_name,
'(A,I0)')
's_', i
134 field_names(i) = trim(field_name)
137 if (n_scalars > 1)
then
140 if (trim(field_names(i)) == trim(field_names(j)))
then
141 write(field_name,
'(A,I0)') trim(field_names(i))//
'_', j
142 field_names(i) = trim(field_name)
155 call json_subdict%add(
'name', trim(field_names(i)))
157 call this%scalar_fields(i)%init(msh, coef, gs, json_subdict, &
162 if (n_scalars > 1)
then
163 call this%register_lags_with_checkpoint(chkp)
166 select type(scalar => this%scalar_fields(1))
168 call chkp%add_scalar(scalar%s, scalar%slag, scalar%abx1, scalar%abx2)
174 user, chkp, ulag, vlag, wlag, time_scheme, rho)
176 type(
mesh_t),
target,
intent(in) :: msh
177 type(
coef_t),
target,
intent(in) :: coef
178 type(
gs_t),
target,
intent(inout) :: gs
179 type(json_file),
target,
intent(inout) :: params
180 type(json_file),
target,
intent(inout) :: numerics_params
181 type(
user_t),
target,
intent(in) :: user
182 type(
chkp_t),
target,
intent(inout) :: chkp
185 TYPE(
field_t),
TARGET,
INTENT(IN) :: rho
191 if (.not. params%valid_path(
'name'))
then
192 call params%add(
'name',
's')
196 call this%scalar_fields(1)%init(msh, coef, gs, params, numerics_params, &
200 select type(scalar => this%scalar_fields(1))
202 call chkp%add_scalar(scalar%s, scalar%slag, scalar%abx1, scalar%abx2)
213 type(
ksp_monitor_t),
dimension(size(this%scalar_fields)) :: ksp_results
216 do i = 1,
size(this%scalar_fields)
217 call this%scalar_fields(i)%step(time, ext_bdf, dt_controller, &
227 type(
chkp_t),
intent(inout) :: chkp
228 integer :: i, n_scalars
230 n_scalars =
size(this%scalar_fields)
231 do i = 1,
size(this%scalar_fields)
232 call this%scalar_fields(i)%restart(chkp)
241 do i = 1,
size(this%scalar_fields)
242 call this%scalar_fields(i)%slag%set(this%scalar_fields(i)%s)
243 call this%scalar_fields(i)%validate()
253 if (
allocated(this%scalar_fields))
then
254 do i = 1,
size(this%scalar_fields)
255 call this%scalar_fields(i)%free()
257 deallocate(this%scalar_fields)
264 type(
chkp_t),
intent(inout) :: chkp
265 integer :: i, n_scalars
267 n_scalars =
size(this%scalar_fields)
270 allocate(chkp%scalar_abx1(n_scalars))
271 allocate(chkp%scalar_abx2(n_scalars))
275 call chkp%scalar_lags%append(this%scalar_fields(i)%slag)
278 select type(scalar_field => this%scalar_fields(i))
288 type(
chkp_t),
intent(inout) :: chkp
289 integer,
intent(in) :: index
292 chkp%scalar_abx1(index)%ptr => scalar_field%abx1
293 chkp%scalar_abx2(index)%ptr => scalar_field%abx2
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 registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Contains the field_serties_t type.
Utilities for retrieving parameters from the case files.
Implements the base abstract type for Krylov solvers plus helper types.
integer, parameter, public neko_log_verbose
Verbose log level.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public rp
Global precision used in computations.
Auxiliary routines for fluid solvers.
subroutine scalar_step_info(time, ksp_results, strict_convergence)
Prints for prs, velx, vely, velz the following: Number of iterations, start residual,...
Contains the scalar_pnpn_t type.
Contains the scalar_scheme_t type.
Contains the scalars_t type that manages multiple scalar fields.
subroutine scalars_validate(this)
Check if the configuration is valid.
subroutine associate_scalar_abx_fields(chkp, index, scalar_field)
Helper subroutine to associate ABX field pointers with proper TARGET attribute.
subroutine register_lags_with_checkpoint(this, chkp)
Register scalar lag fields with checkpoint.
subroutine scalars_init(this, n_scalars, msh, coef, gs, params, numerics_params, user, chkp, ulag, vlag, wlag, time_scheme, rho)
Initialize the scalars container.
subroutine scalars_init_single(this, msh, coef, gs, params, numerics_params, user, chkp, ulag, vlag, wlag, time_scheme, rho)
subroutine scalars_free(this)
Clean up all resources.
subroutine scalars_step(this, time, ext_bdf, dt_controller)
Perform a time step for all scalar fields.
subroutine scalars_restart(this, chkp)
Restart from checkpoint data.
Defines a function space.
Compound scheme for the advection and diffusion operators in a transport equation.
Base class for time integration schemes.
Module with things related to the simulation time.
Implements type time_step_controller.
Interfaces for user interaction with NEKO.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
field_list_t, To be able to group fields together
Stores a series (sequence) of fields, logically connected to a base field, and arranged according to ...
Type for storing initial and final residuals in a Krylov solver.
Base abstract type for a canonical Krylov method, solving .
Base type for a scalar advection-diffusion solver.
Type to manage multiple scalar transport equations.
The function space for the SEM solution fields.
Implements the logic to compute the time coefficients for the advection and diffusion operators in a ...
A struct that contains all info about the time, expand as needed.
Provides a tool to set time step dt.
A type collecting all the overridable user routines and flag to suppress type injection from custom m...