diff --git a/src/kernels/MassTransportSourceMMS.C b/src/kernels/MassTransportSourceMMS.C index 2f537ebe..c7893b56 100644 --- a/src/kernels/MassTransportSourceMMS.C +++ b/src/kernels/MassTransportSourceMMS.C @@ -4,7 +4,7 @@ template<> InputParameters validParams() { InputParameters params = validParams(); - params.addParam("water_vapor_diffusion_coefficient_name", "water_vapor_diffusion_coefficient", "The name of the material property that contains the water vapor diffusion coefficient (D_v)"); + params.addParam("diffusion_coefficient_name", "diffusion_coefficient", "The name of the phase dependent material property that contains the water vapor diffusion coefficient (D_v)"); params.addRequiredCoupledVar("phi", "Phase-field variable, phi"); params.addParam("use_dphi_dt", true, "Include the dphi_dt portion of the forcing function"); return params; @@ -12,7 +12,7 @@ InputParameters validParams() MassTransportSourceMMS::MassTransportSourceMMS(const std::string & name, InputParameters parameters) : Kernel(name, parameters), - _D_v(getMaterialProperty(getParam("water_vapor_diffusion_coefficient_name"))), + _D_v(getMaterialProperty(getParam("diffusion_coefficient_name"))), _phi(coupledValue("phi")), _use_dphi_dt(getParam("use_dphi_dt")) { @@ -26,15 +26,12 @@ MassTransportSourceMMS::computeQpResidual() Real t = _t; Real x = _q_point[_qp](0); Real y = _q_point[_qp](1); - Real D_v = _D_v[_qp]; + Real D = _D_v[_qp]; Real Pi = libMesh::pi; Real phi = _phi[_qp]; - Real f = sin(2.*Pi*x)*cos(2.*Pi*y) - + D_v*t*t*y*cos(2.*Pi*x)*Pi*cos(2.*Pi*y) - + 8.*D_v*(0.5-0.5*t*x*y)*t*sin(2.*Pi*x)*Pi*Pi*cos(2.*Pi*y) - - D_v*t*t*sin(2.*Pi*x)*sin(2.*Pi*y)*Pi; - + Real f = + 8.0*pow(pi, 2)*D*t*sin(2.0*pi*x)*cos(2.0*pi*y) + sin(2.0*pi*x)*cos(2.0*pi*y); if (_use_dphi_dt) f += 0.5*x*y; diff --git a/tests/heat_equation/mms/gold/mms_heat_equation_dphi_dt_out.e b/tests/heat_equation/mms/gold/mms_heat_equation_dphi_dt_out.e index 6b267dbd..379d5acb 100644 Binary files a/tests/heat_equation/mms/gold/mms_heat_equation_dphi_dt_out.e and b/tests/heat_equation/mms/gold/mms_heat_equation_dphi_dt_out.e differ diff --git a/tests/heat_equation/mms/gold/mms_heat_equation_out.e b/tests/heat_equation/mms/gold/mms_heat_equation_out.e index 6ee952d2..cd04e6da 100644 Binary files a/tests/heat_equation/mms/gold/mms_heat_equation_out.e and b/tests/heat_equation/mms/gold/mms_heat_equation_out.e differ diff --git a/tests/heat_equation/mms/mms_heat_equation.i b/tests/heat_equation/mms/mms_heat_equation.i index 6c16f158..c7106b40 100644 --- a/tests/heat_equation/mms/mms_heat_equation.i +++ b/tests/heat_equation/mms/mms_heat_equation.i @@ -108,7 +108,6 @@ active = '' output_initial = true exodus = true - file_base = mms_heat_equation_out [./oversample] refinements = 2 oversample = true diff --git a/tests/heat_equation/mms/mms_heat_equation_dphi_dt.i b/tests/heat_equation/mms/mms_heat_equation_dphi_dt.i index 52dee31c..74d1cb8c 100644 --- a/tests/heat_equation/mms/mms_heat_equation_dphi_dt.i +++ b/tests/heat_equation/mms/mms_heat_equation_dphi_dt.i @@ -106,7 +106,6 @@ active = '' output_initial = true exodus = true - file_base = mms_heat_equation_dphi_dt_out [./oversample] refinements = 2 oversample = true diff --git a/tests/mass_transport/mms/MassTransportMMS.py b/tests/mass_transport/mms/MassTransportMMS.py new file mode 100755 index 00000000..7abd3012 --- /dev/null +++ b/tests/mass_transport/mms/MassTransportMMS.py @@ -0,0 +1,68 @@ +'''*************************************** + * Generating Method of MFG-ed * + * Solutions applied to the Heat * + * equation (eqn 34) in Kaempfer 2009 * + * * + * Compile: * + * python MassTransportMMS.py * + * * + ***************************************''' +#!/usr/bin/python + +from sympy import * +from sympy.utilities.codegen import codegen +init_printing() + +x = symbols('x') +y = symbols('y') +t = symbols('t') + +phi = t*x*y +u = t*sin(2.0*pi*x)*cos(2.0*pi*y) +print '\n' +print 'u =\n ' +pprint(u) +print '\n' + +#Chemical diffusion +D = symbols('D') + +#Simplifying Math terms +du_dt = diff(u,t) +grad_u = [diff(u,x), diff(u,y)] +diffuse_D_grad_u =((diff(D*grad_u[0],x) + diff(D*grad_u[1],y))) + +dPhi_dt = diff(phi,t) + +term1 = du_dt +term2 = diffuse_D_grad_u +term3 =-0.5*(dPhi_dt) #yes it is negative in the original eq. + +# Eq. (35) without dPhi_dt +f = term1-term2 + +#Print out equation +print '\n' +print ' F = \n' +pprint(f) +print '\n' +print '\n' +print ' -phi_term = \n' +pprint(-term3) +print '\n' + + +#Generate the C/C++ version of the code. +print('Equation 35 Code : \n') +[(c_name, c_code), (h_name, c_header)] = codegen( + ("f", f), "C", "test", header=False, empty=False) +print(c_code) +print('\n') + +#Generate C/C++ code for term 4 +print('-dPhi_dt term Code : \n') +[(c_name, c_code), (h_name, c_header)] = codegen( + ("f", -term3), "C", "test", header=False, empty=False) +print(c_code) +print('\n') + diff --git a/tests/mass_transport/mms/gold/mms_mass_transport_dphi_dt_out.e b/tests/mass_transport/mms/gold/mms_mass_transport_dphi_dt_out.e index 9fd170ca..9082fa9f 100644 Binary files a/tests/mass_transport/mms/gold/mms_mass_transport_dphi_dt_out.e and b/tests/mass_transport/mms/gold/mms_mass_transport_dphi_dt_out.e differ diff --git a/tests/mass_transport/mms/gold/mms_mass_transport_out.e b/tests/mass_transport/mms/gold/mms_mass_transport_out.e index 45350eba..a84fcd78 100644 Binary files a/tests/mass_transport/mms/gold/mms_mass_transport_out.e and b/tests/mass_transport/mms/gold/mms_mass_transport_out.e differ diff --git a/tests/mass_transport/mms/mms_mass_transport.i b/tests/mass_transport/mms/mms_mass_transport.i index 253a7409..4754aed1 100644 --- a/tests/mass_transport/mms/mms_mass_transport.i +++ b/tests/mass_transport/mms/mms_mass_transport.i @@ -3,6 +3,7 @@ dim = 2 nx = 10 ny = 10 + uniform_refine = 1 elem_type = QUAD8 [] @@ -14,6 +15,7 @@ [AuxVariables] [./phi] + order = SECOND [../] [./abs_error] [../] @@ -26,7 +28,7 @@ [../] [./u_func] type = ParsedFunction - value = t*sin(2*pi*x)*cos(2*pi*y) + value = t*sin(2.0*pi*x)*cos(2.0*pi*y) [../] [] @@ -49,14 +51,14 @@ use_dphi_dt = false [../] [./phi_time] - type = UserForcingFunction + type = PikaTimeDerivative variable = u - function = dphi_dt_func + coefficient = 0.5 + differentiated_variable = phi [../] [] [AuxKernels] - active = 'error_aux phi_kernel' [./phi_kernel] type = FunctionAux variable = phi @@ -68,11 +70,6 @@ function = u_func solution_variable = u [../] - [./u_exact] - type = FunctionAux - variable = u_exact - function = u_func - [../] [] [BCs] @@ -84,13 +81,10 @@ [../] [] - [../] -[] - [PikaMaterials] phi = phi temperature = 273.15 -[../] +[] [Postprocessors] [./L2_errror] @@ -102,19 +96,19 @@ [Executioner] type = Transient - num_steps = 10 - dt = 0.1 + num_steps = 2 + dt = .25 +[] + +[Adaptivity] [] [Outputs] - active = '' output_initial = true exodus = true - console = true - [./oversample] - refinements = 2 - oversample = true - type = Exodus + [./console] + type = Console + linear_residuals = true [../] [] @@ -130,3 +124,4 @@ type = FunctionIC [../] [] + diff --git a/tests/mass_transport/mms/mms_mass_transport_dphi_dt.i b/tests/mass_transport/mms/mms_mass_transport_dphi_dt.i index e0c916f4..157fd2c9 100644 --- a/tests/mass_transport/mms/mms_mass_transport_dphi_dt.i +++ b/tests/mass_transport/mms/mms_mass_transport_dphi_dt.i @@ -27,7 +27,7 @@ [../] [./u_func] type = ParsedFunction - value = t*sin(2*pi*x)*cos(2*pi*y) + value = t*sin(2.0*pi*x)*cos(2.0*pi*y) [../] [] @@ -49,9 +49,10 @@ use_dt_dphi = true [../] [./phi_time] - type = UserForcingFunction + type = PikaTimeDerivative variable = u - function = -0.5*x*y + coefficient = 0.5 + differentiated_variable = phi [../] [] @@ -93,7 +94,7 @@ [Executioner] type = Transient - num_steps = 4 + num_steps = 2 dt = 0.25 [] @@ -121,3 +122,4 @@ type = FunctionIC [../] [] + diff --git a/tests/mass_transport/mms/mms_mass_transport_no_pika_material.i b/tests/mass_transport/mms/mms_mass_transport_no_pika_material.i index 7f78723d..faedc981 100644 --- a/tests/mass_transport/mms/mms_mass_transport_no_pika_material.i +++ b/tests/mass_transport/mms/mms_mass_transport_no_pika_material.i @@ -3,6 +3,7 @@ dim = 2 nx = 10 ny = 10 + uniform_refine = 1 elem_type = QUAD8 [] @@ -14,6 +15,7 @@ [AuxVariables] [./phi] + order = SECOND [../] [./abs_error] [../] @@ -26,7 +28,7 @@ [../] [./u_func] type = ParsedFunction - value = t*sin(2*pi*x)*cos(2*pi*y) + value = t*sin(2.0*pi*x)*cos(2.0*pi*y) [../] [] @@ -49,9 +51,10 @@ use_dphi_dt = false [../] [./phi_time] - type = UserForcingFunction + type = PikaTimeDerivative variable = u - function = dphi_dt_func + coefficient = 0.5 + differentiated_variable = phi [../] [] @@ -124,8 +127,8 @@ [Executioner] type = Transient - num_steps = 10 - dt = 0.1 + num_steps = 2 + dt = 0.25 [] [Adaptivity] @@ -155,3 +158,4 @@ type = FunctionIC [../] [] + diff --git a/tests/phase_evolution/mms/gold/mms_double_well_potential_out.e b/tests/phase_evolution/mms/gold/mms_double_well_potential_out.e index dd4ca5df..a09e0eac 100644 Binary files a/tests/phase_evolution/mms/gold/mms_double_well_potential_out.e and b/tests/phase_evolution/mms/gold/mms_double_well_potential_out.e differ diff --git a/tests/phase_evolution/mms/gold/mms_phase_evolution_out.e b/tests/phase_evolution/mms/gold/mms_phase_evolution_out.e index 3107d520..1c222d09 100644 Binary files a/tests/phase_evolution/mms/gold/mms_phase_evolution_out.e and b/tests/phase_evolution/mms/gold/mms_phase_evolution_out.e differ