44 use json_module,
only : json_file
64 class(
ksp_t),
allocatable :: shared_ksp
86 numerics_params, user, chkp, ulag, vlag, wlag, time_scheme, rho)
88 integer,
intent(in) :: n_scalars
89 type(
mesh_t),
target,
intent(in) :: msh
90 type(
coef_t),
target,
intent(in) :: coef
91 type(
gs_t),
target,
intent(inout) :: gs
92 type(json_file),
target,
intent(inout) :: params
93 type(json_file),
target,
intent(inout) :: numerics_params
94 type(
user_t),
target,
intent(in) :: user
97 TYPE(
field_t),
TARGET,
INTENT(IN) :: rho
98 type(
chkp_t),
target,
intent(inout) :: chkp
99 type(json_file) :: json_subdict
101 character(len=:),
allocatable :: field_name
102 character(len=:),
allocatable :: field_names(:)
103 character(len=256) :: error_msg, buffer
106 allocate(this%scalar_fields(n_scalars))
109 allocate(
character(len=256) :: field_names(n_scalars))
119 if (len_trim(field_name) == 0)
then
120 if (n_scalars == 1)
then
123 write(
buffer,
'(A,I0)')
's_', i
128 field_names(i) = trim(field_name)
131 if (n_scalars > 1)
then
134 if (trim(field_names(i)) == trim(field_names(j)))
then
135 call neko_error(
"Duplicate scalar field name detected: "// &
136 trim(field_names(i)) // &
137 ". Please provide unique names for each scalar field.")
149 call json_subdict%add(
'name', trim(field_names(i)))
152 call this%scalar_fields(i)%init(msh, coef, gs, json_subdict, &
158 user, chkp, ulag, vlag, wlag, time_scheme, rho)
160 type(
mesh_t),
target,
intent(in) :: msh
161 type(
coef_t),
target,
intent(in) :: coef
162 type(
gs_t),
target,
intent(inout) :: gs
163 type(json_file),
target,
intent(inout) :: params
164 type(json_file),
target,
intent(inout) :: numerics_params
165 type(
user_t),
target,
intent(in) :: user
166 type(
chkp_t),
target,
intent(inout) :: chkp
169 TYPE(
field_t),
TARGET,
INTENT(IN) :: rho
172 allocate(this%scalar_fields(1))
175 if (.not. params%valid_path(
'name'))
then
176 call params%add(
'name',
's')
180 call this%scalar_fields(1)%init(msh, coef, gs, params, numerics_params, &
191 type(
ksp_monitor_t),
dimension(size(this%scalar_fields)) :: ksp_results
192 logical :: all_frozen
197 do i = 1,
size(this%scalar_fields)
198 all_frozen = all_frozen .and. this%scalar_fields(i)%scalar%freeze
199 call this%scalar_fields(i)%scalar%step(time, ext_bdf, dt_controller, &
203 if (.not. all_frozen)
then
204 call ksp_results(i)%print_header()
207 do i = 1,
size(this%scalar_fields)
208 if (this%scalar_fields(i)%scalar%freeze) cycle
216 type(
chkp_t),
intent(inout) :: chkp
217 integer :: i, n_scalars
219 n_scalars =
size(this%scalar_fields)
220 do i = 1,
size(this%scalar_fields)
221 call this%scalar_fields(i)%scalar%restart(chkp)
230 type(
user_t),
intent(in) :: user
231 logical,
intent(in) :: is_restart
232 integer :: i, running_scalar_index, scalar_index
234 call neko_log%section(
"Scalar initial condition ")
237 call neko_log%message(
"Restart file specified, " // &
238 "initial conditions ignored")
240 running_scalar_index = 0
241 do i = 1,
size(this%scalar_fields)
242 if (trim(this%scalar_fields(i)%scalar%name) .eq.
'temperature')
then
245 running_scalar_index = running_scalar_index + 1
246 scalar_index = running_scalar_index
249 call this%scalar_fields(i)%scalar%set_initial_condition(
user, &
263 do i = 1,
size(this%scalar_fields)
264 call this%scalar_fields(i)%scalar%slag%set( &
265 this%scalar_fields(i)%scalar%s)
266 call this%scalar_fields(i)%scalar%validate()
276 if (
allocated(this%scalar_fields))
then
277 do i = 1,
size(this%scalar_fields)
278 call this%scalar_fields(i)%free()
280 deallocate(this%scalar_fields)
283 if (
allocated(this%shared_ksp))
then
284 call this%shared_ksp%free()
285 deallocate(this%shared_ksp)
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.
Generic buffer that is extended with buffers of varying rank.
Defines format-independent checkpoint registration and restart state.
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.
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, public scalar_step_info(time, ksp_results, strict_convergence, allow_stabilization)
Prints for prs, velx, vely, velz the following: Number of iterations, start residual,...
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 scalars_set_initial_conditions(this, user, is_restart)
Set initial conditions for all scalar fields.
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.
Collection of live simulation data registered for checkpointing.
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 .
A helper type that is needed to have an array of polymorphic objects.
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...