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)
95 if (params%valid_path(
'case.fluid.Re') .and. &
96 (params%valid_path(
'case.fluid.mu') .or. &
97 params%valid_path(
'case.fluid.rho')))
then
98 call neko_error(
"To set the material properties for the fluid,&
99 & either provide Re OR mu and rho in the case file.")
102 else if (params%valid_path(
'case.fluid.Re'))
then
103 nondimensional = .true.
105 write(log_buf,
'(A)')
'Non-dimensional fluid material properties &
108 write(log_buf,
'(A)')
'Density will be set to 1, dynamic viscosity to&
113 call json_get(params,
'case.fluid.Re', this%mu)
114 write(log_buf,
'(A)')
'Read non-dimensional values:'
116 write(log_buf,
'(A,ES13.6)')
'Re :', this%mu
122 this%mu = 1.0_rp/this%mu
125 call json_get(params,
'case.fluid.mu', this%mu)
126 call json_get(params,
'case.fluid.rho', this%rho)
132 if (.not. params%valid_path(
'case.scalar'))
then
136 call this%write_to_log(.false.)
142 if (nondimensional .and. &
143 (params%valid_path(
'case.scalar.lambda') .or. &
144 params%valid_path(
'case.scalar.cp')))
then
145 call neko_error(
"For non-dimensional setup set the Pe number for&
147 else if (.not. nondimensional .and. &
148 params%valid_path(
'case.scalar.Pe'))
then
149 call neko_error(
"Dimensional material properties input detected,&
150 & because you set rho and mu for the fluid. &
151 & Please set cp and lambda for the scalar.")
154 else if (nondimensional)
then
155 write(log_buf,
'(A)')
'Non-dimensional scalar material properties &
158 write(log_buf,
'(A)')
'Specific heat capacity will be set to 1, &
159 & conductivity to 1/Pe.'
163 call json_get(params,
'case.scalar.Pe', this%lambda)
164 write(log_buf,
'(A,ES13.6)')
'Pe :', this%lambda
171 this%lambda = 1.0_rp/this%lambda
174 call json_get(params,
'case.scalar.lambda', this%lambda)
175 call json_get(params,
'case.scalar.cp', this%cp)
178 call this%write_to_log(.true.)
188 logical,
intent(in) :: scalar
189 character(len=LOG_SIZE) :: log_buf
191 write(log_buf,
'(A)')
'Set dimensional values:'
193 write(log_buf,
'(A,ES13.6)')
'rho :', this%rho
195 write(log_buf,
'(A,ES13.6)')
'mu :', this%mu
198 write(log_buf,
'(A,ES13.6)')
'cp :', this%cp
200 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, public neko_warning(warning_msg)
Contains all the material properties necessary in the simulation.