37 use json_module,
only : json_file
53 real(kind=
rp) :: lambda
69 type(json_file),
intent(inout) :: params
70 type(
user_t),
target,
intent(in) :: user
71 character(len=LOG_SIZE) :: log_buf
74 logical :: nondimensional
76 call neko_log%section(
'Material properties')
78 nondimensional = .false.
80 if (.not.
associated(user%material_properties, dummy_mp_ptr))
then
82 write(log_buf,
'(A)')
"Material properties must be set in the user&
85 call user%material_properties(0.0_rp, 0, this%rho, this%mu, &
86 this%cp, this%lambda, params)
94 if (params%valid_path(
'case.fluid.Re') .and. &
95 (params%valid_path(
'case.fluid.mu') .or. &
96 params%valid_path(
'case.fluid.rho')))
then
97 call neko_error(
"To set the material properties for the fluid,&
98 & either provide Re OR mu and rho in the case file.")
101 else if (params%valid_path(
'case.fluid.Re'))
then
102 nondimensional = .true.
104 write(log_buf,
'(A)')
'Non-dimensional fluid material properties &
107 write(log_buf,
'(A)')
'Density will be set to 1, dynamic viscosity to&
112 call json_get(params,
'case.fluid.Re', this%mu)
113 write(log_buf,
'(A)')
'Read non-dimensional values:'
115 write(log_buf,
'(A,ES13.6)')
'Re :', this%mu
121 this%mu = 1.0_rp/this%mu
124 call json_get(params,
'case.fluid.mu', this%mu)
125 call json_get(params,
'case.fluid.rho', this%rho)
131 if (.not. params%valid_path(
'case.scalar'))
then
135 call this%write_to_log(.false.)
140 if (nondimensional .and. &
141 (params%valid_path(
'case.scalar.lambda') .or. &
142 params%valid_path(
'case.scalar.cp')))
then
143 call neko_error(
"For non-dimensional setup set the Pe number for&
145 else if (.not. nondimensional .and. &
146 params%valid_path(
'case.scalar.Pe'))
then
147 call neko_error(
"Dimensional material properties input detected,&
148 & because you set rho and mu for the fluid. &
149 & Please set cp and lambda for the scalar.")
152 else if (nondimensional)
then
153 write(log_buf,
'(A)')
'Non-dimensional scalar material properties &
156 write(log_buf,
'(A)')
'Specific heat capacity will be set to 1, &
157 & conductivity to 1/Pe.'
161 call json_get(params,
'case.scalar.Pe', this%lambda)
162 write(log_buf,
'(A,ES13.6)')
'Pe :', this%lambda
169 this%lambda = 1.0_rp/this%lambda
172 call json_get(params,
'case.scalar.lambda', this%lambda)
173 call json_get(params,
'case.scalar.cp', this%cp)
177 call this%write_to_log(.true.)
184 logical,
intent(in) :: scalar
185 character(len=LOG_SIZE) :: log_buf
187 write(log_buf,
'(A)')
'Set dimensional values:'
189 write(log_buf,
'(A,ES13.6)')
'rho :', this%rho
191 write(log_buf,
'(A,ES13.6)')
'mu :', this%mu
194 write(log_buf,
'(A,ES13.6)')
'cp :', this%cp
196 write(log_buf,
'(A,ES13.6)')
'lambda :', this%lambda
Retrieves a parameter by name or throws an error.
Abstract interface for setting material properties.
Utilities for retrieving parameters from the case files.
integer, parameter, public neko_log_verbose
Verbose log level.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
Implements material_properties_t type.
subroutine material_properties_init(this, params, user)
Constructor.
subroutine write_to_log(this, scalar)
Write final dimensional values to the log.
integer, parameter, public rp
Global precision used in computations.
Interfaces for user interaction with NEKO.
subroutine, public dummy_user_material_properties(t, tstep, rho, mu, cp, lambda, params)
subroutine neko_warning(warning_msg)
Contains all the material properties necessary in the simulation.