From 72c6239a1fa8cdaeee8e90378f6a80981146dfe3 Mon Sep 17 00:00:00 2001 From: micahjohnson150 Date: Tue, 8 Jul 2014 09:01:48 -0600 Subject: [PATCH 1/9] A handful of working input files all leading up to a full model of the bubble. --- problems/2D_full/diffused_phi.i | 209 ++++++++++++++++++ problems/2D_full/phi_u_only.i | 252 ++++++++++++++++++++++ problems/2D_full/temperature_diffusion.i | 257 +++++++++++++++++++++++ problems/full.i | 42 ++-- problems/phi_only.i | 246 ++++++++++++++++++++++ src/ics/ChemicalPotentialIC.C | 8 +- src/kernels/PhaseTransition.C | 12 +- 7 files changed, 1001 insertions(+), 25 deletions(-) create mode 100644 problems/2D_full/diffused_phi.i create mode 100644 problems/2D_full/phi_u_only.i create mode 100644 problems/2D_full/temperature_diffusion.i create mode 100644 problems/phi_only.i diff --git a/problems/2D_full/diffused_phi.i b/problems/2D_full/diffused_phi.i new file mode 100644 index 00000000..45317aff --- /dev/null +++ b/problems/2D_full/diffused_phi.i @@ -0,0 +1,209 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + uniform_refine = 2 + elem_type = QUAD4 +[] + +[Variables] + active = 'phi' + [./T] + [../] + [./u] + [../] + [./phi] + initial_from_file_var = diffused_phi + initial_from_file_timestep = 30 + [../] +[] + +[AuxVariables] + active = 'u' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + active = 'phi_double_well phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 10 + dt = 200 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .02 + indicator = phi_grad_indicator + refine = .5 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 1e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = FunctionIC + block = 0 + function = -4.7e-6 + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 1e-5 + temporal_scaling = 1e-4 +[] + diff --git a/problems/2D_full/phi_u_only.i b/problems/2D_full/phi_u_only.i new file mode 100644 index 00000000..1cd8ad68 --- /dev/null +++ b/problems/2D_full/phi_u_only.i @@ -0,0 +1,252 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + uniform_refine = 2 + elem_type = QUAD4 +[] + +[Variables] + active = 'phi u' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = '' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + active = 'vapor_time phi_transition phi_double_well vapor_phi_time vapor_diffusion phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + use_temporal_scaling = true + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + use_temporal_scaling = true + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = 'u_bottom u_top' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./u_bottom] + type = DirichletBC + variable = u + boundary = bottom + value = -4.7e-6 + [../] + [./u_top] + type = DirichletBC + variable = u + boundary = top + value = 4.7e-6 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + dt = 200 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + end_time = 100000 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 1 + [../] +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker u_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .12 + indicator = phi_grad_indicator + refine = .6 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic vapor_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = FunctionIC + block = 0 + function = -4.7e-6+0.00188*y + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 1e-5 + temporal_scaling = 1e-4 +[] + diff --git a/problems/2D_full/temperature_diffusion.i b/problems/2D_full/temperature_diffusion.i new file mode 100644 index 00000000..9f574d08 --- /dev/null +++ b/problems/2D_full/temperature_diffusion.i @@ -0,0 +1,257 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + uniform_refine = 2 + elem_type = QUAD4 +[] + +[Variables] + active = 'T' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = 'phi' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + active = 'heat_diffusion heat_phi_time heat_time' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + use_temporal_scaling = true + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + use_temporal_scaling = true + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = '' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./u_bottom] + type = DirichletBC + variable = u + boundary = bottom + value = -4.7e-6 + [../] + [./u_top] + type = DirichletBC + variable = u + boundary = top + value = 4.7e-6 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .12 + indicator = phi_grad_indicator + refine = .6 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic temperature_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T + interface_thickness = 1e-5 + temporal_scaling = 1e-4 + output_properties = diffusion_coefficient + outputs = all +[] + diff --git a/problems/full.i b/problems/full.i index 06ebb8e3..df3dbce3 100644 --- a/problems/full.i +++ b/problems/full.i @@ -19,9 +19,10 @@ [Kernels] [./heat_diffusion] - type = PikaScaledMatDiffusion + type = PikaDiffusion variable = T - diffusivity = conductivity + use_temporal_scaling = true + property = conductivity [../] [./heat_time] type = PikaTimeDerivative @@ -30,12 +31,12 @@ scale = 1.0 [../] [./heat_phi_time] - type = CoupledPikaTimeDerivative + type = PikaCoupledTimeDerivative variable = T property = latent_heat scale = -0.5 - differentiated_variable = phi use_temporal_scaling = true + coupled_variable = phi [../] [./vapor_time] type = PikaTimeDerivative @@ -44,16 +45,17 @@ scale = 1.0 [../] [./vapor_diffusion] - type = PikaScaledMatDiffusion + type = PikaDiffusion variable = u - diffusivity = diffusion_coefficient + use_temporal_scaling = true + property = diffusion_coefficient [../] [./vapor_phi_time] - type = CoupledPikaTimeDerivative + type = PikaCoupledTimeDerivative variable = u coefficient = 0.5 - differentiated_variable = phi use_temporal_scaling = true + coupled_variable = phi [../] [./phi_time] type = PikaTimeDerivative @@ -85,13 +87,13 @@ type = DirichletBC variable = T boundary = bottom - value = 264.8 # -5 + value = 267.515 # -5 [../] [./T_cold] type = DirichletBC variable = T boundary = top - value = 262.085 # -20 + value = 264.8 # -20 [../] [./insulated_sides] type = NeumannBC @@ -124,16 +126,16 @@ [Executioner] # Preconditioned JFNK (default) type = Transient - dt = 5 + dt = .5 solve_type = PJFNK petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' petsc_options_value = '500 hypre boomeramg' - end_time = 50 + end_time = 200 [] [Adaptivity] - max_h_level = 5 - initial_steps = 5 + max_h_level = 4 + initial_steps = 4 initial_marker = phi_marker marker = combo_mark [./Indicators] @@ -188,6 +190,7 @@ [] [ICs] + active = 'phase_ic vapor_ic temperature_ic' [./phase_ic] x1 = .0025 y1 = .0025 @@ -196,12 +199,12 @@ variable = phi invalue = -1 type = SmoothCircleIC - int_width = 5e-5 + int_width = 1e-4 [../] [./temperature_ic] variable = T type = FunctionIC - function = -543.0*y+264.8 + function = -543.0*y+267.515 [../] [./vapor_ic] variable = u @@ -210,12 +213,17 @@ phase_variable = phi temperature = T [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] [] [PikaMaterials] phi = phi temperature = T interface_thickness = 5e-5 - temporal_scaling = 1e-5 + temporal_scaling = 1e-4 [] diff --git a/problems/phi_only.i b/problems/phi_only.i new file mode 100644 index 00000000..07c1c64a --- /dev/null +++ b/problems/phi_only.i @@ -0,0 +1,246 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + elem_type = QUAD4 +[] + +[Variables] + active = 'phi' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = 'u' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + active = 'phi_transition phi_double_well phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + use_temporal_scaling = true + property = diffusion_coefficient + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = '' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./vapor_ic] + type = DirichletBC + variable = u + boundary = '0 1 2 3 ' + value = 0 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + dt = 200 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + end_time = 100000 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 1 + [../] +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .02 + indicator = phi_grad_indicator + refine = .5 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic vapor_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 1e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = FunctionIC + block = 0 + function = -4.7e-6+0.00188*y + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 1e-5 + temporal_scaling = 1e-4 +[] + diff --git a/src/ics/ChemicalPotentialIC.C b/src/ics/ChemicalPotentialIC.C index 88e2b759..963fdcda 100644 --- a/src/ics/ChemicalPotentialIC.C +++ b/src/ics/ChemicalPotentialIC.C @@ -21,9 +21,7 @@ ChemicalPotentialIC::ChemicalPotentialIC(const std::string & name, InputParamete Real ChemicalPotentialIC::value(const Point & /*p*/) { - if (_phase[_qp]<1.0) - return _property_uo.equilibriumConcentration(_temperature[_qp])*(1-_phase[_qp])*(1-_phase[_qp]); - //return _property_uo.equilibriumConcentration(_temperature[_qp]); - else - return 0; +// return -4.7e-6+ _q_point[_qp](1) * 0.00188; + return _property_uo.equilibriumConcentration(_temperature[_qp]); +// return _property_uo.equilibriumConcentration(_temperature[_qp])*(1-_phase[_qp])/2.0; } diff --git a/src/kernels/PhaseTransition.C b/src/kernels/PhaseTransition.C index dd0ee205..b602d5ff 100644 --- a/src/kernels/PhaseTransition.C +++ b/src/kernels/PhaseTransition.C @@ -25,11 +25,17 @@ Real PhaseTransition::computeDFDOP(PFFunctionType type) { switch (type) - { + { /* + case Residual: + return -(_lambda[_qp]) * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); + + case Jacobian: + return 4.0 * _lambda[_qp] * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); + }*/ case Residual: - return -(_lambda[_qp]) * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); + return -(_lambda[_qp])*_property_uo.temporalScale() * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); case Jacobian: - return 4.0 * _lambda[_qp] * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * (_s[_qp] - (_s_eq[_qp])); + return 4.0 * _lambda[_qp] * _property_uo.temporalScale() * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); } } From 88b1b9376f823fbf402f5600dbfd3f7e438b88b6 Mon Sep 17 00:00:00 2001 From: micahjohnson150 Date: Wed, 9 Jul 2014 07:21:27 -0600 Subject: [PATCH 2/9] Working on phi_u_T_aux.i --- problems/2D_full/Untitled.i | 268 +++++++++++++++++++++ problems/2D_full/almost_full.i | 252 ++++++++++++++++++++ problems/2D_full/phi_u_T_aux.i | 284 +++++++++++++++++++++++ problems/2D_full/temperature_diffusion.i | 18 +- 4 files changed, 819 insertions(+), 3 deletions(-) create mode 100644 problems/2D_full/Untitled.i create mode 100644 problems/2D_full/almost_full.i create mode 100644 problems/2D_full/phi_u_T_aux.i diff --git a/problems/2D_full/Untitled.i b/problems/2D_full/Untitled.i new file mode 100644 index 00000000..9dc803e4 --- /dev/null +++ b/problems/2D_full/Untitled.i @@ -0,0 +1,268 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + uniform_refine = 2 + elem_type = QUAD4 +[] + +[Variables] + active = 'T' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = 'phi' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + active = 'heat_diffusion heat_phi_time heat_time' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + use_temporal_scaling = true + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + use_temporal_scaling = true + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = 'T_hot T_cold' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./u_bottom] + type = DirichletBC + variable = u + boundary = bottom + value = -4.7e-6 + [../] + [./u_top] + type = DirichletBC + variable = u + boundary = top + value = 4.7e-6 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .12 + indicator = phi_grad_indicator + refine = .6 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] + [./exodus] + file_base = temp_diffusion + type = Exodus + [../] + [./results_for_initial] + num_files = 1 + output_input = true + file_base = temp_initial + type = Checkpoint + [../] +[] + +[ICs] + active = 'phase_ic temperature_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T + interface_thickness = 1e-5 + temporal_scaling = 1e-4 + output_properties = diffusion_coefficient + outputs = all +[] + diff --git a/problems/2D_full/almost_full.i b/problems/2D_full/almost_full.i new file mode 100644 index 00000000..7c43790c --- /dev/null +++ b/problems/2D_full/almost_full.i @@ -0,0 +1,252 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 25 + ny = 25 + xmax = .005 + ymax = .005 + uniform_refine = 2 + elem_type = QUAD4 +[] + +[Variables] + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = '' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Kernels] + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + use_temporal_scaling = true + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + use_temporal_scaling = true + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = 'T_hot T_cold' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./u_bottom] + type = DirichletBC + variable = u + boundary = bottom + value = -4.7e-6 + [../] + [./u_top] + type = DirichletBC + variable = u + boundary = top + value = 4.7e-6 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./property_uo] + type = PropertyUserObject + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + dt = 200 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + end_time = 100000 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 1 + percent_change = .25 + [../] +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker u_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .12 + indicator = phi_grad_indicator + refine = .6 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic vapor_ic temperature_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + block = 0 + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 1e-5 + temporal_scaling = 1e-4 +[] + diff --git a/problems/2D_full/phi_u_T_aux.i b/problems/2D_full/phi_u_T_aux.i new file mode 100644 index 00000000..820b3b18 --- /dev/null +++ b/problems/2D_full/phi_u_T_aux.i @@ -0,0 +1,284 @@ +[Mesh] + type = FileMesh + file = temp_initial_cp/0005_mesh.cpr + dim = 2 +[] + +[Variables] + active = 'phi u' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = 'T' + [./phi] + [../] + [./u] + [../] + [./T] + [../] +[] + +[Functions] + active = '' + [./T_func] + type = SolutionFunction + solution = T_initial_uo + [../] +[] + +[Kernels] + active = 'vapor_time phi_transition phi_double_well vapor_phi_time vapor_diffusion phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + coefficient = 1e-7 + use_temporal_scaling = true + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + coupled_variable = phi + use_temporal_scaling = true + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[AuxKernels] + active = '' + [./T_aux] + type = FunctionAux + variable = T + function = T_func + [../] +[] + +[BCs] + active = '' + [./T_hot] + type = DirichletBC + variable = T + boundary = bottom + value = 267.515 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = top + value = 264.8 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'left right' + [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = '0 1 2 3 ' + value = 1.0 + [../] + [./u_bottom] + type = DirichletBC + variable = u + boundary = bottom + value = -4.7e-6 + [../] + [./u_top] + type = DirichletBC + variable = u + boundary = top + value = 4.7e-6 + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + active = 'property_uo' + [./property_uo] + type = PropertyUserObject + [../] + [./T_initial_uo] + type = SolutionUserObject + mesh = temp_diffusion_0005_mesh.xdr + nodal_variables = T + execute_on = custom + es = temp_initial_cp + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .12 + indicator = phi_grad_indicator + refine = .6 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = .02 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic vapor_ic' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] + [./pre_solved_T] + function = T_func_initial + variable = T + type = FunctionIC + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T + interface_thickness = 1e-5 + temporal_scaling = 1e-4 + output_properties = diffusion_coefficient + outputs = all +[] + diff --git a/problems/2D_full/temperature_diffusion.i b/problems/2D_full/temperature_diffusion.i index 9f574d08..969caaa1 100644 --- a/problems/2D_full/temperature_diffusion.i +++ b/problems/2D_full/temperature_diffusion.i @@ -60,7 +60,7 @@ [./vapor_diffusion] type = PikaDiffusion variable = u - coefficient = 1e-7 + property = diffusion_coefficient use_temporal_scaling = true [../] [./vapor_phi_time] @@ -96,7 +96,7 @@ [] [BCs] - active = '' + active = 'T_hot T_cold' [./T_hot] type = DirichletBC variable = T @@ -200,14 +200,26 @@ [] [Outputs] + active = 'exodus console' output_initial = true - exodus = true + file_base = temp_diffusion + xda = true [./console] type = Console perf_log = true nonlinear_residuals = true linear_residuals = true [../] + [./exodus] + file_base = temp_diffusion + type = Exodus + [../] + [./results_for_initial] + num_files = 1 + output_input = true + file_base = temp_initial + type = Checkpoint + [../] [] [ICs] From 30330c136b0eeee8cc4d614d6622acace6e56927 Mon Sep 17 00:00:00 2001 From: Micah Johnson Date: Wed, 9 Jul 2014 14:33:03 -0600 Subject: [PATCH 3/9] Working on adding a SolutionUsserObject --- include/kernels/PhaseTransition.h | 8 ++ problems/2D_full/initialize_u_T_import.i | 116 +++++++++++++++++++++++ problems/2D_full/phi_T_u_aux_import.i | 116 +++++++++++++++++++++++ problems/2D_full/phi_u_T_aux.i | 16 ++-- problems/2D_full/read_T_only.i | 106 +++++++++++++++++++++ problems/2D_full/temperature_diffusion.i | 43 ++------- 6 files changed, 363 insertions(+), 42 deletions(-) create mode 100644 problems/2D_full/initialize_u_T_import.i create mode 100644 problems/2D_full/phi_T_u_aux_import.i create mode 100644 problems/2D_full/read_T_only.i diff --git a/include/kernels/PhaseTransition.h b/include/kernels/PhaseTransition.h index 6f598dca..1622d1f8 100644 --- a/include/kernels/PhaseTransition.h +++ b/include/kernels/PhaseTransition.h @@ -21,6 +21,14 @@ class PhaseTransition : protected: virtual Real computeDFDOP(PFFunctionType type); +/** + * Compute off-diagonal jacobain + * The off-diagonal jacobain term, i.e., the derivative of the coupled time derivative with respect + * to the coupled variable. + */ + virtual Real computeQpOffDiagJacobian(unsigned int jvar); + + private: VariableValue & _s; diff --git a/problems/2D_full/initialize_u_T_import.i b/problems/2D_full/initialize_u_T_import.i new file mode 100644 index 00000000..8b6c67c8 --- /dev/null +++ b/problems/2D_full/initialize_u_T_import.i @@ -0,0 +1,116 @@ +[Mesh] + type = FileMesh + file = temp_diffusion_0001_mesh.xdr + dim = 2 + distribution = serial +[] + +[Variables] + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[Functions] + active = 'T_func' + [./T_func] + type = SolutionFunction + solution = T_initial_uo + from_variable = T + [../] + [./phi_func] + type = SolutionFunction + from_variable = phi + solution = T_initial_uo + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./T_initial_uo] + type = SolutionUserObject + mesh = temp_diffusion_0001_mesh.xdr + nodal_variables = T + execute_on = initial + system = nl0 + es = temp_diffusion_0001.xdr + [../] +[] + +[Problem] + type = FEProblem + solve = false +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Outputs] + output_initial = true + exodus = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'pre_solved_T phase_ic vapor_ic' + [./phase_ic] + x1 = 0.0025 + y1 = 0.0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] + [./pre_solved_T] + function = T_func + variable = T + type = FunctionIC + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T +[] + diff --git a/problems/2D_full/phi_T_u_aux_import.i b/problems/2D_full/phi_T_u_aux_import.i new file mode 100644 index 00000000..8b6c67c8 --- /dev/null +++ b/problems/2D_full/phi_T_u_aux_import.i @@ -0,0 +1,116 @@ +[Mesh] + type = FileMesh + file = temp_diffusion_0001_mesh.xdr + dim = 2 + distribution = serial +[] + +[Variables] + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[Functions] + active = 'T_func' + [./T_func] + type = SolutionFunction + solution = T_initial_uo + from_variable = T + [../] + [./phi_func] + type = SolutionFunction + from_variable = phi + solution = T_initial_uo + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./T_initial_uo] + type = SolutionUserObject + mesh = temp_diffusion_0001_mesh.xdr + nodal_variables = T + execute_on = initial + system = nl0 + es = temp_diffusion_0001.xdr + [../] +[] + +[Problem] + type = FEProblem + solve = false +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Outputs] + output_initial = true + exodus = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'pre_solved_T phase_ic vapor_ic' + [./phase_ic] + x1 = 0.0025 + y1 = 0.0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] + [./pre_solved_T] + function = T_func + variable = T + type = FunctionIC + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T +[] + diff --git a/problems/2D_full/phi_u_T_aux.i b/problems/2D_full/phi_u_T_aux.i index 820b3b18..a04d5fd7 100644 --- a/problems/2D_full/phi_u_T_aux.i +++ b/problems/2D_full/phi_u_T_aux.i @@ -1,7 +1,8 @@ [Mesh] type = FileMesh - file = temp_initial_cp/0005_mesh.cpr + file = temp_diffusion.e dim = 2 + distribution = serial [] [Variables] @@ -99,11 +100,11 @@ [] [AuxKernels] - active = '' [./T_aux] - type = FunctionAux + type = SolutionAux variable = T - function = T_func + execute_on = initial + solution = T_initial_uo [../] [] @@ -150,16 +151,15 @@ [] [UserObjects] - active = 'property_uo' [./property_uo] type = PropertyUserObject [../] [./T_initial_uo] type = SolutionUserObject - mesh = temp_diffusion_0005_mesh.xdr + mesh = temp_diffusion.e nodal_variables = T - execute_on = custom - es = temp_initial_cp + execute_on = initial + system = nl0 [../] [] diff --git a/problems/2D_full/read_T_only.i b/problems/2D_full/read_T_only.i new file mode 100644 index 00000000..30a7231f --- /dev/null +++ b/problems/2D_full/read_T_only.i @@ -0,0 +1,106 @@ +[Mesh] + type = FileMesh + file = temp_diffusion.e + dim = 2 + distribution = serial +[] + +[Variables] + active = 'T' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[Functions] + [./T_func] + type = SolutionFunction + solution = T_initial_uo + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./T_initial_uo] + type = SolutionUserObject + mesh = temp_diffusion.e + nodal_variables = T + execute_on = initial + system = nl0 + [../] +[] + +[Problem] + type = FEProblem + solve = false +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 5 + dt = 10000 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' +[] + +[Outputs] + output_initial = true + exodus = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'pre_solved_T' + [./phase_ic] + x1 = .0025 + y1 = .0025 + radius = 0.0005 + outvalue = 1 + variable = phi + invalue = -1 + type = SmoothCircleIC + int_width = 5e-5 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = -543.0*y+267.515 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + phase_variable = phi + temperature = T + [../] + [./constant_temp_ic] + variable = T + type = ConstantIC + value = 264.8 + [../] + [./vapor_function_ic] + function = -4.7e-6+0.00188*y + variable = u + type = FunctionIC + block = 0 + [../] + [./pre_solved_T] + function = T_func + variable = T + type = FunctionIC + [../] +[] + diff --git a/problems/2D_full/temperature_diffusion.i b/problems/2D_full/temperature_diffusion.i index 969caaa1..d0742507 100644 --- a/problems/2D_full/temperature_diffusion.i +++ b/problems/2D_full/temperature_diffusion.i @@ -1,11 +1,10 @@ [Mesh] type = GeneratedMesh dim = 2 - nx = 25 - ny = 25 + nx = 15 + ny = 15 xmax = .005 ymax = .005 - uniform_refine = 2 elem_type = QUAD4 [] @@ -156,58 +155,34 @@ [Adaptivity] max_h_level = 5 initial_steps = 5 - initial_marker = phi_marker marker = phi_marker + initial_marker = phi_marker [./Indicators] - active = 'phi_grad_indicator' - [./phi_grad_indicator] + [./phi_jump] type = GradientJumpIndicator variable = phi [../] - [./u_jump_indicator] - type = GradientJumpIndicator - variable = u - block = 0 - [../] [../] [./Markers] - active = 'phi_marker' [./phi_marker] type = ErrorFractionMarker coarsen = .12 - indicator = phi_grad_indicator + indicator = phi_jump refine = .6 [../] - [./T_marker] - type = ErrorFractionMarker - coarsen = 0.2 - indicator = T_jump_indicator - refine = 0.7 - [../] - [./u_marker] - type = ErrorFractionMarker - indicator = u_jump_indicator - coarsen = .02 - refine = .5 - block = 0 - [../] - [./combo_mark] - type = ComboMarker - block = 0 - markers = 'u_marker phi_marker' - [../] [../] [] [Outputs] - active = 'exodus console' + active = 'console' output_initial = true + exodus = true file_base = temp_diffusion - xda = true + output_intermediate = false + output_final = true [./console] type = Console perf_log = true - nonlinear_residuals = true linear_residuals = true [../] [./exodus] From ea97a925daa651ba44414dadcd2d1121a1fa52eb Mon Sep 17 00:00:00 2001 From: Micah Johnson Date: Wed, 9 Jul 2014 17:01:22 -0600 Subject: [PATCH 4/9] working almostFull.i, PhaseTransition has not be compiled and needs offDiag --- include/kernels/PhaseTransition.h | 14 +++--- problems/2D_full/almost_full.i | 56 ++++++++++++------------ problems/2D_full/temperature_diffusion.i | 11 ++--- python/DerivativeCheck.py | 6 ++- src/ics/ChemicalPotentialIC.C | 2 +- src/kernels/PhaseTransition.C | 8 ++-- 6 files changed, 46 insertions(+), 51 deletions(-) diff --git a/include/kernels/PhaseTransition.h b/include/kernels/PhaseTransition.h index 1622d1f8..0a779fa2 100644 --- a/include/kernels/PhaseTransition.h +++ b/include/kernels/PhaseTransition.h @@ -21,14 +21,12 @@ class PhaseTransition : protected: virtual Real computeDFDOP(PFFunctionType type); -/** - * Compute off-diagonal jacobain - * The off-diagonal jacobain term, i.e., the derivative of the coupled time derivative with respect - * to the coupled variable. - */ - virtual Real computeQpOffDiagJacobian(unsigned int jvar); - - +/** + * Compute off-diagonal jacobain + * The off-diagonal jacobain term, i.e., the derivative of the coupled time derivative with respect + * to the coupled variable. + */ + virtual Real computeQpOffDiagJacobian(unsigned int jvar); private: VariableValue & _s; diff --git a/problems/2D_full/almost_full.i b/problems/2D_full/almost_full.i index 7c43790c..b7058e13 100644 --- a/problems/2D_full/almost_full.i +++ b/problems/2D_full/almost_full.i @@ -1,12 +1,7 @@ [Mesh] - type = GeneratedMesh + type = FileMesh + file = temp_diffusion_0001_mesh.xdr dim = 2 - nx = 25 - ny = 25 - xmax = .005 - ymax = .005 - uniform_refine = 2 - elem_type = QUAD4 [] [Variables] @@ -18,13 +13,11 @@ [../] [] -[AuxVariables] - active = '' - [./phi] - [../] - [./u] - [../] - [./T] +[Functions] + [./T_func] + type = SolutionFunction + from_variable = T + solution = initial_uo [../] [] @@ -58,8 +51,8 @@ [./vapor_diffusion] type = PikaDiffusion variable = u - coefficient = 1e-7 use_temporal_scaling = true + property = diffusion_coefficient [../] [./vapor_phi_time] type = PikaCoupledTimeDerivative @@ -94,7 +87,7 @@ [] [BCs] - active = 'T_hot T_cold' + active = 'insulated_sides T_hot T_cold' [./T_hot] type = DirichletBC variable = T @@ -136,8 +129,13 @@ [] [UserObjects] - [./property_uo] - type = PropertyUserObject + [./initial_uo] + type = SolutionUserObject + system = nl0 + mesh = temp_diffusion_0001_mesh.xdr + nodal_variables = T + execute_on = initial + es = temp_diffusion_0001.xdr [../] [] @@ -146,21 +144,21 @@ type = Transient dt = 200 solve_type = PJFNK - petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' - petsc_options_value = '500 hypre boomeramg' + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type ' + petsc_options_value = '100 hypre boomeramg' end_time = 100000 [./TimeStepper] type = SolutionTimeAdaptiveDT - dt = 1 - percent_change = .25 + dt = 10 + percent_change = .1 [../] [] [Adaptivity] max_h_level = 5 - initial_steps = 5 initial_marker = phi_marker - marker = phi_marker + marker = combo_mark + initial_steps = 1 [./Indicators] [./phi_grad_indicator] type = GradientJumpIndicator @@ -173,7 +171,7 @@ [../] [../] [./Markers] - active = 'phi_marker u_marker' + active = 'phi_marker combo_mark u_marker' [./phi_marker] type = ErrorFractionMarker coarsen = .12 @@ -189,8 +187,8 @@ [./u_marker] type = ErrorFractionMarker indicator = u_jump_indicator - coarsen = .02 - refine = .5 + coarsen = .12 + refine = .8 block = 0 [../] [./combo_mark] @@ -227,7 +225,7 @@ [./temperature_ic] variable = T type = FunctionIC - function = -543.0*y+267.515 + function = T_func [../] [./vapor_ic] variable = u @@ -245,7 +243,7 @@ [PikaMaterials] phi = phi - temperature = 263.15 + temperature = T interface_thickness = 1e-5 temporal_scaling = 1e-4 [] diff --git a/problems/2D_full/temperature_diffusion.i b/problems/2D_full/temperature_diffusion.i index d0742507..eb23c01f 100644 --- a/problems/2D_full/temperature_diffusion.i +++ b/problems/2D_full/temperature_diffusion.i @@ -136,12 +136,6 @@ [Postprocessors] [] -[UserObjects] - [./property_uo] - type = PropertyUserObject - [../] -[] - [Executioner] # Preconditioned JFNK (default) type = Transient @@ -153,8 +147,8 @@ [] [Adaptivity] - max_h_level = 5 - initial_steps = 5 + max_h_level = 4 + initial_steps = 4 marker = phi_marker initial_marker = phi_marker [./Indicators] @@ -180,6 +174,7 @@ file_base = temp_diffusion output_intermediate = false output_final = true + xdr = true [./console] type = Console perf_log = true diff --git a/python/DerivativeCheck.py b/python/DerivativeCheck.py index 46e02d19..6299a63e 100755 --- a/python/DerivativeCheck.py +++ b/python/DerivativeCheck.py @@ -24,9 +24,13 @@ #Print out equation print '\n' -print ' Term 4 = \n' +print ' d(Term4)/dphi = \n' pprint(diff(term3,phi)) print '\n' +print ' d(Term4)/du = \n' +pprint(diff(term3,u)) +print '\n' + ''' #Generate the C/C++ version of the code. diff --git a/src/ics/ChemicalPotentialIC.C b/src/ics/ChemicalPotentialIC.C index 963fdcda..0f14b7d2 100644 --- a/src/ics/ChemicalPotentialIC.C +++ b/src/ics/ChemicalPotentialIC.C @@ -23,5 +23,5 @@ ChemicalPotentialIC::value(const Point & /*p*/) { // return -4.7e-6+ _q_point[_qp](1) * 0.00188; return _property_uo.equilibriumConcentration(_temperature[_qp]); -// return _property_uo.equilibriumConcentration(_temperature[_qp])*(1-_phase[_qp])/2.0; +// return _property_uo.equilibriumConcentration(_temperature[_qp])*(1-_phase[_qp])/2.0; } diff --git a/src/kernels/PhaseTransition.C b/src/kernels/PhaseTransition.C index b602d5ff..84f20a66 100644 --- a/src/kernels/PhaseTransition.C +++ b/src/kernels/PhaseTransition.C @@ -25,17 +25,17 @@ Real PhaseTransition::computeDFDOP(PFFunctionType type) { switch (type) - { /* + { case Residual: return -(_lambda[_qp]) * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); case Jacobian: return 4.0 * _lambda[_qp] * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); - }*/ - case Residual: + } + /*case Residual: return -(_lambda[_qp])*_property_uo.temporalScale() * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); case Jacobian: return 4.0 * _lambda[_qp] * _property_uo.temporalScale() * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); - } + }*/ } From 1b4e94b97d44d0f184a72461159e5f58716e5afb Mon Sep 17 00:00:00 2001 From: Micah Johnson Date: Thu, 10 Jul 2014 13:25:33 -0600 Subject: [PATCH 5/9] Found a mistake in constants --- include/kernels/PhaseTransition.h | 4 +++- problems/2D_full/almost_full.i | 17 ++++++++++++----- src/ics/ChemicalPotentialIC.C | 6 +++++- src/kernels/PhaseTransition.C | 12 +++++++++++- src/materials/PhaseFieldProperties.C | 2 +- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/include/kernels/PhaseTransition.h b/include/kernels/PhaseTransition.h index 0a779fa2..163a112f 100644 --- a/include/kernels/PhaseTransition.h +++ b/include/kernels/PhaseTransition.h @@ -26,7 +26,7 @@ class PhaseTransition : * The off-diagonal jacobain term, i.e., the derivative of the coupled time derivative with respect * to the coupled variable. */ - virtual Real computeQpOffDiagJacobian(unsigned int jvar); +// virtual Real computeQpOffDiagJacobian(unsigned int jvar); private: VariableValue & _s; @@ -35,5 +35,7 @@ class PhaseTransition : MaterialProperty & _s_eq; + unsigned int _v_var; + }; #endif // PHASETRANSITION_H diff --git a/problems/2D_full/almost_full.i b/problems/2D_full/almost_full.i index b7058e13..8262df3e 100644 --- a/problems/2D_full/almost_full.i +++ b/problems/2D_full/almost_full.i @@ -139,12 +139,19 @@ [../] [] +[Preconditioning] + [./smp_precond] + type = SMP + off_diag_row = u + off_diag_column = T + [../] +[] + [Executioner] # Preconditioned JFNK (default) type = Transient - dt = 200 solve_type = PJFNK - petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type ' + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' petsc_options_value = '100 hypre boomeramg' end_time = 100000 [./TimeStepper] @@ -155,10 +162,10 @@ [] [Adaptivity] - max_h_level = 5 + max_h_level = 2 initial_marker = phi_marker marker = combo_mark - initial_steps = 1 + initial_steps = 2 [./Indicators] [./phi_grad_indicator] type = GradientJumpIndicator @@ -244,7 +251,7 @@ [PikaMaterials] phi = phi temperature = T - interface_thickness = 1e-5 + interface_thickness = 5e-5 temporal_scaling = 1e-4 [] diff --git a/src/ics/ChemicalPotentialIC.C b/src/ics/ChemicalPotentialIC.C index 0f14b7d2..6fa4cc0d 100644 --- a/src/ics/ChemicalPotentialIC.C +++ b/src/ics/ChemicalPotentialIC.C @@ -21,7 +21,11 @@ ChemicalPotentialIC::ChemicalPotentialIC(const std::string & name, InputParamete Real ChemicalPotentialIC::value(const Point & /*p*/) { + // return -4.7e-6+ _q_point[_qp](1) * 0.00188; +/* if(_phase[_qp]) + return _property_uo.equilibriumConcentration(_temperature[_qp]); + else + return 0.0;*/ return _property_uo.equilibriumConcentration(_temperature[_qp]); -// return _property_uo.equilibriumConcentration(_temperature[_qp])*(1-_phase[_qp])/2.0; } diff --git a/src/kernels/PhaseTransition.C b/src/kernels/PhaseTransition.C index 84f20a66..b31c7f23 100644 --- a/src/kernels/PhaseTransition.C +++ b/src/kernels/PhaseTransition.C @@ -32,10 +32,20 @@ PhaseTransition::computeDFDOP(PFFunctionType type) case Jacobian: return 4.0 * _lambda[_qp] * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); } +} +/* Real + PhaseTransition::computeQpOffDiagJacobian(unsigned int jvar) + { + if (jvar == _v_var) + return -_test[_i][_qp]*_phi[_j][_qp] * _lambda[_qp] * (-_u[_qp]*_u[_qp]+1.0) * (-_u[_qp]*_u[_qp]+1.0); + + else + return 0.0; + } +*/ /*case Residual: return -(_lambda[_qp])*_property_uo.temporalScale() * (_s[_qp] - _s_eq[_qp]) * (1.0 - _u[_qp]*_u[_qp])*(1.0 - _u[_qp]*_u[_qp]); case Jacobian: return 4.0 * _lambda[_qp] * _property_uo.temporalScale() * _u[_qp] * (-_u[_qp]*_u[_qp]+1.0) * ( _s[_qp] - (_s_eq[_qp])); }*/ -} diff --git a/src/materials/PhaseFieldProperties.C b/src/materials/PhaseFieldProperties.C index f34ad879..92a54d2d 100644 --- a/src/materials/PhaseFieldProperties.C +++ b/src/materials/PhaseFieldProperties.C @@ -49,7 +49,7 @@ PhaseFieldProperties::computeQpProperties() Real & w = getMaterialProperty("interface_thickness")[_qp]; Real & L_sg = getMaterialProperty("latent_heat")[_qp]; - Real rho_vs = _property_uo.equilibriumWaterVaporConcentrationAtSaturation(_temperature[_qp]); + Real rho_vs = _property_uo.equilibriumWaterVaporConcentrationAtSaturation(_property_uo.referenceTemp()); MaterialProperty & ki = getMaterialProperty("conductivity_ice"); MaterialProperty & ka = getMaterialProperty("conductivity_air"); From a34904efb6b559e52c6b1928a1738ed8380323dd Mon Sep 17 00:00:00 2001 From: micahjohnson150 Date: Mon, 14 Jul 2014 10:16:56 -0600 Subject: [PATCH 6/9] working towards a complete 1D problem --- problems/1D_full/1D_full.i | 139 +++++++++-------- problems/1D_full/Temp_diffusion.i | 187 +++++++++++++++++++++++ problems/1D_full/Untitled.i | 219 +++++++++++++++++++++++++++ problems/1D_full/phi_diffusion.i | 219 +++++++++++++++++++++++++++ python/PhaseScalingChecker.py | 30 ++++ src/ics/ChemicalPotentialIC.C | 4 +- src/materials/PhaseFieldProperties.C | 9 +- 7 files changed, 742 insertions(+), 65 deletions(-) create mode 100644 problems/1D_full/Temp_diffusion.i create mode 100644 problems/1D_full/Untitled.i create mode 100644 problems/1D_full/phi_diffusion.i create mode 100755 python/PhaseScalingChecker.py diff --git a/problems/1D_full/1D_full.i b/problems/1D_full/1D_full.i index 55438345..f5c254f4 100644 --- a/problems/1D_full/1D_full.i +++ b/problems/1D_full/1D_full.i @@ -1,15 +1,10 @@ [Mesh] - type = GeneratedMesh + type = FileMesh + file = phi_diffusion_0021_mesh.xdr dim = 2 - nx = 100 - ny = 2 - xmax = .005 - ymax = .0002 - elem_type = QUAD4 [] [Variables] - active = 'phi T' [./T] [../] [./u] @@ -18,24 +13,25 @@ [../] [] -[AuxVariables] - [./u] - [../] -[] - [Functions] [./T_func] - type = ParsedFunction - value = -200*x+261 + type = SolutionFunction + from_variable = T + solution = intial_T + [../] + [./phi_func] + type = SolutionFunction + from_variable = phi + solution = initial_phi [../] [] [Kernels] - active = 'phi_transition heat_diffusion phi_double_well heat_phi_time heat_time phi_time phi_square_gradient' [./heat_diffusion] - type = MatDiffusion + type = PikaDiffusion variable = T - D_name = conductivity + use_temporal_scaling = true + property = conductivity [../] [./heat_time] type = PikaTimeDerivative @@ -44,11 +40,12 @@ scale = 1.0 [../] [./heat_phi_time] - type = PikaScaledTimeDerivative + type = PikaCoupledTimeDerivative variable = T property = latent_heat scale = -0.5 - differentiated_variable = phi + use_temporal_scaling = true + coupled_variable = phi [../] [./vapor_time] type = PikaTimeDerivative @@ -57,15 +54,18 @@ scale = 1.0 [../] [./vapor_diffusion] - type = MatDiffusion + type = PikaDiffusion variable = u - D_name = diffusion_coefficient + use_temporal_scaling = true + property = diffusion_coefficient [../] [./vapor_phi_time] - type = PikaScaledTimeDerivative + type = PikaCoupledTimeDerivative variable = u coefficient = 0.5 differentiated_variable = phi + use_temporal_scaling = true + coupled_variable = phi [../] [./phi_time] type = PikaTimeDerivative @@ -93,6 +93,7 @@ [] [BCs] + active = 'T_hot T_cold phi_bc' [./T_hot] type = DirichletBC variable = T @@ -110,68 +111,91 @@ variable = T boundary = 'top bottom' [../] + [./phi_bc] + type = DirichletBC + variable = phi + boundary = 'left right' + value = 1 + [../] [] [Postprocessors] [] [UserObjects] - [./property_uo] - type = PropertyUserObject + [./intial_T] + type = SolutionUserObject + system = nl0 + mesh = temp_diffusion_0003_mesh.xdr + nodal_variables = T + es = temp_diffusion_0003.xdr + [../] + [./initial_phi] + type = SolutionUserObject + system = nl0 + mesh = phi_diffusion_0021_mesh.xdr + nodal_variables = phi + es = phi_diffusion_0021.xdr + [../] +[] + +[Preconditioning] + [./smp_precond] + type = SMP + full = true [../] [] [Executioner] # Preconditioned JFNK (default) type = Transient - dt = 5 solve_type = PJFNK petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' - petsc_options_value = '500 hypre boomeramg' - end_time = 10 + petsc_options_value = '100 hypre boomeramg' + end_time = 1300 [] [Adaptivity] - max_h_level = 3 - initial_steps = 3 + max_h_level = 5 + initial_steps = 2 + marker = combo initial_marker = phi_marker - marker = combo_mark [./Indicators] - [./phi_grad_indicator] + [./phi_grad_jump] type = GradientJumpIndicator variable = phi [../] - [./u_jump_indicator] + [./u_grad_jump] type = GradientJumpIndicator variable = u - block = 0 + [../] + [./T_grad_jump] + type = GradientJumpIndicator + variable = T [../] [../] [./Markers] - active = 'phi_marker combo_mark u_marker' [./phi_marker] type = ErrorFractionMarker - coarsen = 0.2 - indicator = phi_grad_indicator - refine = .8 - [../] - [./T_marker] - type = ErrorFractionMarker - coarsen = 0.2 - indicator = T_jump_indicator - refine = 0.7 + coarsen = .01 + indicator = phi_grad_jump + refine = .6 [../] [./u_marker] type = ErrorFractionMarker - indicator = u_jump_indicator - coarsen = 0.2 - refine = 0.8 - block = 0 + coarsen = .01 + indicator = u_grad_jump + refine = 0.6 [../] - [./combo_mark] + [./combo] type = ComboMarker - block = 0 - markers = 'u_marker phi_marker' + markers = 'phi_marker u_marker t_marker' + [../] + [./t_marker] + type = ErrorFractionMarker + coarsen = .01 + indicator = T_grad_jump + refine = .5 [../] [../] [] @@ -179,6 +203,7 @@ [Outputs] output_initial = true exodus = true + file_base = phi_diffusion [./console] type = Console perf_log = true @@ -189,14 +214,9 @@ [ICs] [./phase_ic] - x1 = 0.00214285714 variable = phi - type = KaempferAnalyticPhaseIC - x2 = 0.00285714285 - phi_new = -1 - phi_old = 1 - x3 = 0.00357142857 - x4 = 0.00428571428 + type = FunctionIC + function = phi_func [../] [./temperature_ic] variable = T @@ -215,8 +235,9 @@ [PikaMaterials] phi = phi temperature = T - interface_thickness = 1e-6 - reference_temperature = 263.15 + interface_thickness = 8e-5 + output_properties = 'tau equilibrium_concentration heat_capacity conductivity diffusion_coefficient latent_heat lambda' + outputs = all temporal_scaling = 1e-4 [] diff --git a/problems/1D_full/Temp_diffusion.i b/problems/1D_full/Temp_diffusion.i new file mode 100644 index 00000000..25c69370 --- /dev/null +++ b/problems/1D_full/Temp_diffusion.i @@ -0,0 +1,187 @@ +[Mesh] + type = FileMesh + file = phi_diffusion_0021_mesh.xdr + dim = 2 +[] + +[Variables] + active = 'T' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + [./phi] + [../] +[] + +[Functions] + [./T_func] + type = ParsedFunction + value = -200*x+261 + [../] + [./phi_func] + type = SolutionFunction + from_variable = phi + solution = intial_phi + [../] +[] + +[Kernels] + active = 'heat_diffusion heat_time' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + use_temporal_scaling = true + property = diffusion_coefficient + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + differentiated_variable = phi + use_temporal_scaling = true + coupled_variable = phi + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[BCs] + active = 'T_hot T_cold' + [./T_hot] + type = DirichletBC + variable = T + boundary = left + value = 261 # -5 + [../] + [./T_cold] + type = DirichletBC + variable = T + boundary = right + value = 260 # -20 + [../] + [./insulated_sides] + type = NeumannBC + variable = T + boundary = 'top bottom' + [../] +[] + +[Postprocessors] +[] + +[UserObjects] + [./intial_phi] + type = SolutionUserObject + system = nl0 + mesh = phi_diffusion_0021_mesh.xdr + nodal_variables = phi + es = phi_diffusion_0021.xdr + [../] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + num_steps = 3 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 5 + [../] +[] + +[Outputs] + output_initial = true + exodus = true + file_base = temp_diffusion + xdr = true + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] +[] + +[ICs] + active = 'phase_ic temperature_ic' + [./phase_ic] + variable = phi + type = FunctionIC + function = phi_func + [../] + [./temperature_ic] + variable = T + type = ConstantIC + value = 260 + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + block = 0 + phase_variable = phi + temperature = T + [../] +[] + +[PikaMaterials] + phi = phi + temperature = T + interface_thickness = 5e-5 +[] + diff --git a/problems/1D_full/Untitled.i b/problems/1D_full/Untitled.i new file mode 100644 index 00000000..1ccf5992 --- /dev/null +++ b/problems/1D_full/Untitled.i @@ -0,0 +1,219 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 100 + ny = 2 + xmax = .005 + ymax = .0002 + elem_type = QUAD4 +[] + +[Variables] + active = 'phi' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = '' + [./phi] + [../] +[] + +[Functions] + [./T_func] + type = ParsedFunction + value = -200*x+261 + [../] +[] + +[Kernels] + active = 'phi_double_well phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + use_temporal_scaling = true + property = diffusion_coefficient + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + differentiated_variable = phi + use_temporal_scaling = true + coupled_variable = phi + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[AuxKernels] +[] + +[Postprocessors] +[] + +[UserObjects] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + dt = 5 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + end_time = 300 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 5 + [../] +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .01 + indicator = phi_grad_indicator + refine = .5 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = 0.01 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + file_base = phi_diffusion + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] + [./xdr] + file_base = phi_diffusion + type = XDR + show = phi + [../] +[] + +[ICs] + active = 'phase_ic' + [./phase_ic] + x1 = 0.00214285714 + variable = phi + type = KaempferAnalyticPhaseIC + x2 = 0.00285714285 + phi_new = -1 + phi_old = 1 + x3 = 0.00357142857 + x4 = 0.00428571428 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = T_func + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + block = 0 + phase_variable = phi + temperature = T + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 5e-5 + temporal_scaling = 1e-4 +[] + diff --git a/problems/1D_full/phi_diffusion.i b/problems/1D_full/phi_diffusion.i new file mode 100644 index 00000000..1ccf5992 --- /dev/null +++ b/problems/1D_full/phi_diffusion.i @@ -0,0 +1,219 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 100 + ny = 2 + xmax = .005 + ymax = .0002 + elem_type = QUAD4 +[] + +[Variables] + active = 'phi' + [./T] + [../] + [./u] + [../] + [./phi] + [../] +[] + +[AuxVariables] + active = '' + [./phi] + [../] +[] + +[Functions] + [./T_func] + type = ParsedFunction + value = -200*x+261 + [../] +[] + +[Kernels] + active = 'phi_double_well phi_time phi_square_gradient' + [./heat_diffusion] + type = PikaDiffusion + variable = T + use_temporal_scaling = true + property = conductivity + [../] + [./heat_time] + type = PikaTimeDerivative + variable = T + property = heat_capacity + scale = 1.0 + [../] + [./heat_phi_time] + type = PikaCoupledTimeDerivative + variable = T + property = latent_heat + scale = -0.5 + use_temporal_scaling = true + coupled_variable = phi + [../] + [./vapor_time] + type = PikaTimeDerivative + variable = u + coefficient = 1.0 + scale = 1.0 + [../] + [./vapor_diffusion] + type = PikaDiffusion + variable = u + use_temporal_scaling = true + property = diffusion_coefficient + [../] + [./vapor_phi_time] + type = PikaCoupledTimeDerivative + variable = u + coefficient = 0.5 + differentiated_variable = phi + use_temporal_scaling = true + coupled_variable = phi + [../] + [./phi_time] + type = PikaTimeDerivative + variable = phi + property = tau + scale = 1.0 + [../] + [./phi_transition] + type = PhaseTransition + variable = phi + mob_name = mobility + chemical_potential = u + [../] + [./phi_double_well] + type = DoubleWellPotential + variable = phi + mob_name = mobility + [../] + [./phi_square_gradient] + type = ACInterface + variable = phi + mob_name = mobility + kappa_name = interface_thickness_squared + [../] +[] + +[AuxKernels] +[] + +[Postprocessors] +[] + +[UserObjects] +[] + +[Executioner] + # Preconditioned JFNK (default) + type = Transient + dt = 5 + solve_type = PJFNK + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type' + petsc_options_value = '500 hypre boomeramg' + end_time = 300 + [./TimeStepper] + type = SolutionTimeAdaptiveDT + dt = 5 + [../] +[] + +[Adaptivity] + max_h_level = 5 + initial_steps = 5 + initial_marker = phi_marker + marker = phi_marker + [./Indicators] + active = 'phi_grad_indicator' + [./phi_grad_indicator] + type = GradientJumpIndicator + variable = phi + [../] + [./u_jump_indicator] + type = GradientJumpIndicator + variable = u + block = 0 + [../] + [../] + [./Markers] + active = 'phi_marker' + [./phi_marker] + type = ErrorFractionMarker + coarsen = .01 + indicator = phi_grad_indicator + refine = .5 + [../] + [./T_marker] + type = ErrorFractionMarker + coarsen = 0.2 + indicator = T_jump_indicator + refine = 0.7 + [../] + [./u_marker] + type = ErrorFractionMarker + indicator = u_jump_indicator + coarsen = 0.01 + refine = .5 + block = 0 + [../] + [./combo_mark] + type = ComboMarker + block = 0 + markers = 'u_marker phi_marker' + [../] + [../] +[] + +[Outputs] + output_initial = true + exodus = true + file_base = phi_diffusion + [./console] + type = Console + perf_log = true + nonlinear_residuals = true + linear_residuals = true + [../] + [./xdr] + file_base = phi_diffusion + type = XDR + show = phi + [../] +[] + +[ICs] + active = 'phase_ic' + [./phase_ic] + x1 = 0.00214285714 + variable = phi + type = KaempferAnalyticPhaseIC + x2 = 0.00285714285 + phi_new = -1 + phi_old = 1 + x3 = 0.00357142857 + x4 = 0.00428571428 + [../] + [./temperature_ic] + variable = T + type = FunctionIC + function = T_func + [../] + [./vapor_ic] + variable = u + type = ChemicalPotentialIC + block = 0 + phase_variable = phi + temperature = T + [../] +[] + +[PikaMaterials] + phi = phi + temperature = 263.15 + interface_thickness = 5e-5 + temporal_scaling = 1e-4 +[] + diff --git a/python/PhaseScalingChecker.py b/python/PhaseScalingChecker.py new file mode 100755 index 00000000..b0e9facf --- /dev/null +++ b/python/PhaseScalingChecker.py @@ -0,0 +1,30 @@ +'''*************************************** + * Checking the scaling produced on * + * Phase equation. * + * Execute: * + * python * + * PhaseScalingChecker.py * + * * + ***************************************''' +#!/usr/bin/python + +from sympy import * +from math import * +init_printing() + +tau = symbols('tau') +lamb = symbols('lambda') +u = symbols('u') +u_eq = symbols('u_eq') +phi = symbols('phi') +w = symbols('w') +pi = symbols('pi') +m = symbols('m') +k = symbols('k') +T_ref = symbols('T_ref') +alpha = symbols('alpha') + +b + +#phi_time_derivative +#phi_transition diff --git a/src/ics/ChemicalPotentialIC.C b/src/ics/ChemicalPotentialIC.C index 6fa4cc0d..ae6452cc 100644 --- a/src/ics/ChemicalPotentialIC.C +++ b/src/ics/ChemicalPotentialIC.C @@ -23,9 +23,9 @@ ChemicalPotentialIC::value(const Point & /*p*/) { // return -4.7e-6+ _q_point[_qp](1) * 0.00188; -/* if(_phase[_qp]) +/* if(_phase[_qp]<1.0) return _property_uo.equilibriumConcentration(_temperature[_qp]); else return 0.0;*/ - return _property_uo.equilibriumConcentration(_temperature[_qp]); + return _property_uo.equilibriumConcentration(_temperature[_qp])*(1.0-_phase[_qp])/2.0; } diff --git a/src/materials/PhaseFieldProperties.C b/src/materials/PhaseFieldProperties.C index 92a54d2d..ae430c2e 100644 --- a/src/materials/PhaseFieldProperties.C +++ b/src/materials/PhaseFieldProperties.C @@ -64,13 +64,14 @@ PhaseFieldProperties::computeQpProperties() /// @todo{This needs to be computed} _interface_velocity[_qp] = 1e-9; // [m/s] - _capillary_length[_qp] =(rho_vs/(rho_i[_qp])) * (gamma * std::pow(a, 3.) ) / (k * _property_uo.referenceTemp()); - // _capillary_length[_qp] =_d_o/_xi; - //_capillary_length[_qp] =(1.3e-9); + _capillary_length[_qp] =(rho_vs/(rho_i[_qp])) * (gamma * std::pow(a, 3.) ) / (k * _property_uo.referenceTemp()); + // _capillary_length[_qp] =_d_o/_xi; + //_capillary_length[_qp] =(rho_vs/rho_i) * (1.3e-9); +// _capillary_length[_qp] =(1.3e-9); // std::cout<<"d_o = " <<_capillary_length[_qp]<("interface_free_energy")[_qp]; Real & a = getMaterialProperty("mean_molecular_spacing")[_qp]; Real & k = getMaterialProperty("boltzmann")[_qp]; Real & alpha = getMaterialProperty("condensation_coefficient")[_qp]; Real & m = getMaterialProperty("mass_water_molecule")[_qp]; Real & w = getMaterialProperty("interface_thickness")[_qp]; - Real & L_sg = getMaterialProperty("latent_heat")[_qp]; + const Real & L_sg = (1.0/std::pow(convert_meters,2.0)) * getMaterialProperty("latent_heat")[_qp]; Real rho_vs = _property_uo.equilibriumWaterVaporConcentrationAtSaturation(_property_uo.referenceTemp()); + MaterialProperty & rho_i = getMaterialProperty("density_ice"); MaterialProperty & ki = getMaterialProperty("conductivity_ice"); MaterialProperty & ka = getMaterialProperty("conductivity_air"); @@ -59,41 +61,27 @@ PhaseFieldProperties::computeQpProperties() MaterialProperty & dv = getMaterialProperty("water_vapor_diffusion_coefficient"); - MaterialProperty & rho_i = getMaterialProperty("density_ice"); - - /// @todo{This needs to be computed} - _interface_velocity[_qp] = 1e-9; // [m/s] - - _capillary_length[_qp] =(rho_vs/(rho_i[_qp])) * (gamma * std::pow(a, 3.) ) / (k * _property_uo.referenceTemp()); - // _capillary_length[_qp] =_d_o/_xi; - //_capillary_length[_qp] =(rho_vs/rho_i) * (1.3e-9); -// _capillary_length[_qp] =(1.3e-9); -// std::cout<<"d_o = " <<_capillary_length[_qp]<("capillary_length", 1.3e-9 , "Capillary Length (d_o) "); params.addParam("interface_kinetic_coefficient", 5.5e5, "Interface kinetic coefficient (beta)"); + params.addParam("conversion_factor", 1.0, "Conversion value for switching between spatial units (i.e meters to mm)"); // @todo{Group the above} params.addParamNamesToGroup("atmospheric_pressure", "General"); From e43a321372000386c11337099bed0b5c7c078b1a Mon Sep 17 00:00:00 2001 From: micahjohnson150 Date: Tue, 15 Jul 2014 14:52:08 -0600 Subject: [PATCH 8/9] last bits of meters to mm scaling --- src/materials/PhaseFieldProperties.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/materials/PhaseFieldProperties.C b/src/materials/PhaseFieldProperties.C index 6a01204a..7d7d3810 100644 --- a/src/materials/PhaseFieldProperties.C +++ b/src/materials/PhaseFieldProperties.C @@ -77,7 +77,7 @@ PhaseFieldProperties::computeQpProperties() _interface_thickness_squared[_qp] = (convert_meters) * (convert_meters) * w*w; - _equilibrium_concentration[_qp] = (1.0/std::pow(convert_meters,3.0)) * _property_uo.equilibriumConcentration(_temperature[_qp]); + _equilibrium_concentration[_qp] = _property_uo.equilibriumConcentration(_temperature[_qp]); // x_s, Eq. (1) _specific_humidity_ratio[_qp] = _property_uo.specificHumidityRatio(_temperature[_qp]); From b4795c53c011572cd7708dedb26f15058d6c9363 Mon Sep 17 00:00:00 2001 From: micahjohnson150 Date: Tue, 15 Jul 2014 17:10:47 -0600 Subject: [PATCH 9/9] working on problems, found memory leak --- problems/2D_full/imported_initial_full.i | 12 +++--------- problems/2D_full/phi_T_initial.i | 13 ++++++------- python/KaempferPlapp2009.py | 4 ++-- src/ics/ChemicalPotentialIC.C | 9 +-------- src/kernels/PhaseTransition.C | 4 +++- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/problems/2D_full/imported_initial_full.i b/problems/2D_full/imported_initial_full.i index f37f8b56..ad09cd75 100644 --- a/problems/2D_full/imported_initial_full.i +++ b/problems/2D_full/imported_initial_full.i @@ -2,7 +2,6 @@ type = FileMesh file = phi_temp_diffusion_0010_mesh.xdr dim = 2 - uniform_refine = 1 [] [Variables] @@ -145,14 +144,6 @@ [../] [] -[Preconditioning] - [./smp_precond] - type = SMP - off_diag_row = u - off_diag_column = T - [../] -[] - [Executioner] # Preconditioned JFNK (default) type = Transient @@ -257,5 +248,8 @@ temperature = T interface_thickness = 1e-5 temporal_scaling = 1e-4 + output_properties = 'diffusion_coefficient conductivity latent_heat tau lambda' + outputs = all + conversion_factor = 1000 [] diff --git a/problems/2D_full/phi_T_initial.i b/problems/2D_full/phi_T_initial.i index d54bd4f6..db1eb826 100644 --- a/problems/2D_full/phi_T_initial.i +++ b/problems/2D_full/phi_T_initial.i @@ -1,11 +1,10 @@ [Mesh] type = GeneratedMesh dim = 2 - nx = 15 - ny = 15 + nx = 30 + ny = 30 xmax = 5 # mm ymax = 5 # mm - uniform_refine = 2 elem_type = QUAD4 [] @@ -127,8 +126,8 @@ [] [Adaptivity] - max_h_level = 6 - initial_steps = 6 + max_h_level = 4 + initial_steps = 4 initial_marker = phi_marker marker = phi_marker [./Indicators] @@ -146,9 +145,9 @@ active = 'phi_marker' [./phi_marker] type = ErrorFractionMarker - coarsen = .02 + coarsen = .01 indicator = phi_grad_indicator - refine = .5 + refine = .8 [../] [./T_marker] type = ErrorFractionMarker diff --git a/python/KaempferPlapp2009.py b/python/KaempferPlapp2009.py index 33e80691..e0f9dbd5 100755 --- a/python/KaempferPlapp2009.py +++ b/python/KaempferPlapp2009.py @@ -59,5 +59,5 @@ print "rho_vs(268.15) = ", rho_vs.evalf(subs={T: 263.15}) print "" -print "u_eq(263.15) = ", u_eq.evalf(subs={T: 263.15}) -print "u_eq(268.15) = ", u_eq.evalf(subs={T: 268.15}) +print "u_eq(263.15) = ", u_eq.evalf(subs={T: 264.8}) +print "u_eq(268.15) = ", u_eq.evalf(subs={T: 267.515}) diff --git a/src/ics/ChemicalPotentialIC.C b/src/ics/ChemicalPotentialIC.C index b1bf19f7..d5efae79 100644 --- a/src/ics/ChemicalPotentialIC.C +++ b/src/ics/ChemicalPotentialIC.C @@ -21,12 +21,5 @@ ChemicalPotentialIC::ChemicalPotentialIC(const std::string & name, InputParamete Real ChemicalPotentialIC::value(const Point & /*p*/) { - if (_phase[_qp]<0.95) - { - Real f = _property_uo.equilibriumConcentration(_temperature[_qp]) * (1.0-_phase[_qp])/2.0; - std::cout<<_temperature[_qp]<<' ' <<_phase[_qp]<< ' '<