62
62
use field_options, only: get_coordinate_field
63
63
use sparsity_patterns_meshes
64
64
use futils, only: int2str
65
use fefields, only: compute_cv_mass
111
112
type(tensor_field) :: l_tfield, tmp_tfield
112
113
type(scalar_field), pointer :: t_cvmass
113
114
type(scalar_field) :: cvmass
116
! Porosity fields, field name, theta value and include flag
117
type(scalar_field), pointer :: porosity_old, porosity_new
118
type(scalar_field) :: porosity_theta
119
character(len=OPTION_PATH_LEN) :: porosity_name
120
real :: porosity_theta_value
121
logical :: include_porosity
115
123
! local copy of option_path for solution field
116
124
character(len=OPTION_PATH_LEN) :: option_path
272
280
sub_dt=adapt_dt/real(no_subcycles)
282
! find the cv mass that is used for the time term derivative
284
! are we including a porosity coefficient on the time term?
285
if (have_option(trim(option_path)//'/porosity')) then
286
include_porosity = .true.
288
! get the name of the field to use as porosity
289
call get_option(trim(option_path)//'/porosity/porosity_field_name', &
291
default = 'Porosity')
293
! get the porosity theta value
294
call get_option(trim(option_path)//'/porosity/temporal_discretisation/theta', &
295
porosity_theta_value, &
298
porosity_new => extract_scalar_field(state, trim(porosity_name), stat = stat)
301
FLExit('Including porosity in Metric_Advection but failed to extract Porosity from state')
304
porosity_old => extract_scalar_field(state, "Old"//trim(porosity_name), stat = stat)
307
FLExit('Including porosity in Metric_Advection but failed to extract OldPorosity from state')
310
call allocate(porosity_theta, porosity_new%mesh)
312
call set(porosity_theta, porosity_new, porosity_old, porosity_theta_value)
314
ewrite_minmax(porosity_theta)
317
call allocate(t_cvmass, tfield%mesh, name="LocalCVMassWithPorosity")
318
call compute_cv_mass(x, t_cvmass, porosity_theta)
320
call deallocate(porosity_theta)
322
include_porosity = .false.
323
t_cvmass => get_cv_mass(state, tfield%mesh)
325
ewrite_minmax(t_cvmass)
275
t_cvmass => get_cv_mass(state, tfield%mesh)
276
327
call allocate(cvmass, tfield%mesh, "LocalCVMass")
277
328
call set(cvmass, t_cvmass)
329
ewrite_minmax(cvmass)
279
331
ewrite(2,*) 'no_subcycles = ', no_subcycles
280
332
ewrite(2,*) 'rk_iterations = ', rk_iterations
393
445
call deallocate(relu)
394
446
call deallocate(x_tfield)
395
447
call deallocate(cvmass)
448
if (include_porosity) then
449
call deallocate(t_cvmass)
397
453
end subroutine form_advection_metric
398
454
! end of solution wrapping subroutines