diff --git a/examples/2d_sink_map_with_refinement/2d_sink_map_with_refinement.i b/examples/2d_sink_map_with_refinement/2d_sink_map_with_refinement.i new file mode 100644 index 000000000..6354a77de --- /dev/null +++ b/examples/2d_sink_map_with_refinement/2d_sink_map_with_refinement.i @@ -0,0 +1,233 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 20 + ny = 20 +[] + +[Variables] + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_map_aux] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Kernels] + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = MaterialDiffusion + variable = u + diffusivity_name = diffusivity + [../] + + [./sink_map] + type = SinkMapKernel + variable = u + sink_map_user_object = sink_map_uo + [../] + + [./event_inserter_source] + type = EventInserterSource + variable = u + inserter = inserter + gaussian_user_object = gaussian_uo + [../] +[] + +[AuxKernels] + [./sink_map] + type = SinkMapAux + variable = sink_map_aux + sink_map_user_object = sink_map_uo + execute_on = timestep_end + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Materials] + [./simple] + type = GenericConstantMaterial + block = 0 + prop_names = 'diffusivity' + prop_values = '2.0' + [../] +[] + +[UserObjects] + [./inserter_circle_average] + type = CircleAverageMaterialProperty + mat_prop = diffusivity + periodic_variable = u + inserter = inserter + radius = 0.2 + [../] + [./circle_average] + type = CircleAverageMaterialProperty + mat_prop = diffusivity + periodic_variable = u + [../] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + use_random_points = true + random_point_user_object = random_point_uo + periodic_variable = u + scale = 3 + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./circle_max_original_element_size_uo] + type = CircleMaxOriginalElementSize + periodic_variable = u + [../] + [./inserter] + type = EventInserter + insert_initial = true + random_timing = false + mean = 1.2 + random_point_user_object = random_point_uo + seed = 3 + verbose = true + track_old_events = true + removal_method = sigma_element_size_ratio + removal_sigma_element_size_ratio = 2.0 + radius = 3.0 + gaussian_user_object = gaussian_uo + circle_average_material_property_user_object = circle_average + inserter_circle_average_material_property_user_object = inserter_circle_average + circle_max_original_element_size_user_object = circle_max_original_element_size_uo + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 0.05 + sink_placement = inside + gaussian_user_object = sink_gaussian_uo + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + marker = event_marker + cycles_per_step = 10 + max_h_level = 0 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 6.0 + coarsen_events = true + verbose = true + periodic_variable = u + event_sigma_mesh_ratio = 2.0 + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_uo + sink_gaussian_user_object = sink_gaussian_uo + sink_sigma_mesh_ratio = 2.0 + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = 'NEWTON' + + start_time = 0.0 + end_time = 50.0 + + verbose = true + + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + nl_abs_tol = 1.0e-12 + + [./TimeStepper] + type = EventTimeStepper + dt = 0.01 + event_inserter = inserter + growth_factor = 2.0 + [../] +[] + +[Preconditioning] + [./smp] + type = SMP + full = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./solution_integral] + type = ElementIntegralVariablePostprocessor + variable = u + [../] + [./solution_average] + type = ElementAverageValue + variable = u + [../] + [./sink_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_map_aux + [../] + [./sink_average] + type = ElementAverageValue + variable = sink_map_aux + [../] + [./num_elems] + type = NumElems + [../] +[] + +[Outputs] + exodus = true + csv = true + execute_on = 'initial timestep_end' + [./console] + type = Console + print_mesh_changed_info = true + [../] +[] diff --git a/examples/2d_sink_map_with_refinement/plot_concentration.py b/examples/2d_sink_map_with_refinement/plot_concentration.py new file mode 100644 index 000000000..9f95453e4 --- /dev/null +++ b/examples/2d_sink_map_with_refinement/plot_concentration.py @@ -0,0 +1,29 @@ +import numpy as np +import matplotlib.pyplot as plt +import os + +# enter values from simulation here +diffusivity = 2.0 +sink_strength = 0.05 +mean = 1.2 # mean of EventInserter distribution +Lx = 2.0 # length of problem in x +Ly = 2.0 # length of problem in y +scale = 3.0 # scale of Gaussian source term + +# postprocessor output should be the only csv file in directory +for file in os.listdir("."): + if file.endswith(".csv"): + csvfile=file + +data=np.loadtxt(csvfile, delimiter=',', skiprows=1) + +plt.plot(data[:,0], data[:,5], 'r-', label='solution') +plt.xlabel('time') +plt.ylabel('average concentration') + +analytic = scale/diffusivity/sink_strength/mean/Lx/Ly*(1.0 - np.exp(-sink_strength*diffusivity*data[:,0])) +plt.plot(data[:,0], analytic, 'k-', label='analytic') + +plt.legend(loc="lower right") + +plt.show() diff --git a/examples/2d_sink_map_with_refinement/plot_num_elements.py b/examples/2d_sink_map_with_refinement/plot_num_elements.py new file mode 100644 index 000000000..c0b1b38e0 --- /dev/null +++ b/examples/2d_sink_map_with_refinement/plot_num_elements.py @@ -0,0 +1,16 @@ +import numpy as np +import matplotlib.pyplot as plt +import os + +# postprocessor output should be the only csv file in directory +for file in os.listdir("."): + if file.endswith(".csv"): + csvfile=file + +data=np.loadtxt(csvfile, delimiter=',', skiprows=1) + +plt.plot(data[:,0], data[:,2], 'r-o') +plt.xlabel('time') +plt.ylabel('number of elements') + +plt.show() diff --git a/include/auxkernels/SinkMapAux.h b/include/auxkernels/SinkMapAux.h new file mode 100644 index 000000000..5e8b95f61 --- /dev/null +++ b/include/auxkernels/SinkMapAux.h @@ -0,0 +1,42 @@ +/****************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* (c) 2010 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Prepared by Battelle Energy Alliance, LLC */ +/* Under Contract No. DE-AC07-05ID14517 */ +/* With the U. S. Department of Energy */ +/* */ +/* See COPYRIGHT for full restrictions */ +/****************************************************************/ + +#ifndef SINKMAPAUX_H +#define SINKMAPAUX_H + +#include "AuxKernel.h" + +//Forward Declarations +class SinkMapAux; +class SinkMapUserObject; + +template<> +InputParameters validParams(); + +class SinkMapAux : public AuxKernel +{ +public: + SinkMapAux(const InputParameters & parameters); + + virtual ~SinkMapAux() {} + +protected: + virtual void precalculateValue(); + virtual Real computeValue(); + + const SinkMapUserObject & _sink_map_uo; + std::vector _element_sink_map; +}; + +#endif // SINKMAPAUX_H diff --git a/include/kernels/SinkMapKernel.h b/include/kernels/SinkMapKernel.h new file mode 100644 index 000000000..058caedd7 --- /dev/null +++ b/include/kernels/SinkMapKernel.h @@ -0,0 +1,42 @@ +/****************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* (c) 2010 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Prepared by Battelle Energy Alliance, LLC */ +/* Under Contract No. DE-AC07-05ID14517 */ +/* With the U. S. Department of Energy */ +/* */ +/* See COPYRIGHT for full restrictions */ +/****************************************************************/ +#ifndef SINKMAPKERNEL_H +#define SINKMAPKERNEL_H + +#include "Reaction.h" + +//Forward Declarations +class SinkMapKernel; +class SinkMapUserObject; + +template<> +InputParameters validParams(); + +class SinkMapKernel : public Reaction +{ +public: + SinkMapKernel(const InputParameters & parameters); + +protected: + virtual void computeResidual() override; + virtual Real computeQpResidual() override; + virtual void computeJacobian() override; + virtual Real computeQpJacobian() override; + + const SinkMapUserObject & _sink_map_uo; + const MaterialProperty & _diffusivity; + std::vector _element_sink_map; +}; + +#endif //SINKMAPKERNEL_H diff --git a/include/markers/EventMarker.h b/include/markers/EventMarker.h index 034f90d01..ab2395cfd 100644 --- a/include/markers/EventMarker.h +++ b/include/markers/EventMarker.h @@ -18,6 +18,7 @@ #include "Marker.h" #include "EventInserter.h" #include "GaussianUserObject.h" +#include "SinkMapUserObject.h" #include "Coupleable.h" // libmesh includes @@ -71,6 +72,18 @@ class EventMarker : public Marker, public Coupleable const bool _refine_by_ratio; + const bool _refine_sinks; + + const Real _sink_marker_radius; + + const bool _refine_sinks_by_ratio; + + const Real _sink_sigma_mesh_ratio; + + const SinkMapUserObject * _sink_map_user_object_ptr; + + const GaussianUserObject * _sink_gaussian_user_object_ptr; + bool _event_incoming; Point _event_location; @@ -79,7 +92,13 @@ class EventMarker : public Marker, public Coupleable bool _coarsening_needed; + bool _sink_refinement_needed; + EventList _old_event_list; + + Real _sink_refine_distance; + + Real _minimum_sink_element_size; }; #endif /* EVENTMARKER_H */ diff --git a/include/userobjects/GaussianUserObject.h b/include/userobjects/GaussianUserObject.h index 6ed1c6c09..92fba0a79 100644 --- a/include/userobjects/GaussianUserObject.h +++ b/include/userobjects/GaussianUserObject.h @@ -58,6 +58,12 @@ class GaussianUserObject : public GeneralUserObject, public Coupleable */ Real value(const Point & p, const Point & center) const; + /** + * Return the function value for the given distance to center + * @param r The distance to the function center + */ + Real value(const Real r) const; + const Real getSigma() const { return _sigma; } protected: @@ -72,6 +78,9 @@ class GaussianUserObject : public GeneralUserObject, public Coupleable /// Reference to mesh const MooseMesh & _mesh; + + /// Normalization constant + Real _norm; }; #endif // GAUSSIANUSEROBJECT_H diff --git a/include/userobjects/SinkMapUserObject.h b/include/userobjects/SinkMapUserObject.h new file mode 100644 index 000000000..ff0f77042 --- /dev/null +++ b/include/userobjects/SinkMapUserObject.h @@ -0,0 +1,88 @@ +/****************************************************************/ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* All contents are licensed under LGPL V2.1 */ +/* See LICENSE for full restrictions */ +/****************************************************************/ +#ifndef SINKMAPUSEROBJECT_H +#define SINKMAPUSEROBJECT_H + +#include "ElementUserObject.h" + +class SinkMapUserObject; +class GaussianUserObject; + +template<> +InputParameters validParams(); + +/** + * This UserObject maintains a per QP map that holds the sink strength. + */ +class SinkMapUserObject : public ElementUserObject +{ +public: + SinkMapUserObject(const InputParameters & parameters); + + virtual void initialSetup(); + virtual void initialize(); + virtual void execute(); + virtual void threadJoin(const UserObject & y); + virtual void finalize() {} + + virtual void meshChanged(); + + const std::vector & getLocalSinkMap(const Elem *) const; + + Real getDistanceToNearestSink(const Point & p) const; + +protected: + /// Distance between sink centers + const Real _spacing; + + /// Average overall strength of entire map + const Real _strength; + + /// Pointer to GaussianUserObject + const GaussianUserObject * _gaussian_user_object_ptr; + + /// How to place sinks on domain, either "corner" or "inside" + const MooseEnum _sink_placement; + + /// Shape to use for sinks when running a 3D problem, either "spheres" or "lines" + const MooseEnum _sink_shape_3d; + + /// variable number to use for minPeriodicDistance calls (i.e. use the periodicity of this variable) + int _periodic_var; + + /// holds the dimension of the mesh + const unsigned int _dim; + + /// Did the mesh change since the last execution of this User Object? + bool _mesh_changed; + + /// Do we need to rebuild the map during this timestep? + bool _rebuild_map; + + /// Buffer for building the per QP map + std::vector _elem_map; + + /// Dummy map for elements without nuclei + std::vector _zero_map; + + /// list of sink locations + std::vector _sink_location_list; + + ///@{ + /// Per element list of sink strength at qp's + typedef LIBMESH_BEST_UNORDERED_MAP > SinkMap; + SinkMap _sink_strength_map; + ///@} + + /// Sigma of sink Gaussian + Real _sigma; + + /// Normalization constant for spaced sinks + Real _norm; +}; + +#endif //SINKMAPUSEROBJECT_H diff --git a/problems/sink_placement/sink_placement.py b/problems/sink_placement/sink_placement.py new file mode 100644 index 000000000..5ff060567 --- /dev/null +++ b/problems/sink_placement/sink_placement.py @@ -0,0 +1,64 @@ +import numpy as np +import matplotlib.pyplot as plt + +# define some constants +dim = 2 +xmin = -1.0 +xmax = 1.0 +ymin = -2.0 +ymax = 2.0 +spacing = 1.0 +sigma = 0.05 +dx = 0.025 +dy = 0.025 +Q_avg = 3.0 + +# set y range to zero in case you forgot +if dim == 1: + ymin = 0.0 + ymax = 0.0 + +# points to compute map +Lx = xmax-xmin +Ly = ymax-ymin +x_array = np.linspace(xmin, xmax, num=Lx/dx+1,endpoint=True) +y_array = np.linspace(ymin, ymax, num=Ly/dy+1,endpoint=True) + +# corner sinks +#x_centers = np.linspace(xmin, xmax, num=Lx/spacing+1,endpoint=True) +#y_centers = np.linspace(ymin, ymax, num=Ly/spacing+1,endpoint=True) +# or, centered sinks +x_centers = np.linspace(xmin+spacing/2.0, xmax-spacing/2.0, num=Lx/spacing,endpoint=True) +y_centers = np.linspace(ymin+spacing/2.0, ymax-spacing/2.0, num=Ly/spacing,endpoint=True) + +Q=np.zeros((np.size(x_array),np.size(y_array))) + +# centered sinks in 1D can screw up in the y dimension +if np.size(y_centers) == 0: + y_centers = np.array([0.0]); + +for i in range (0,np.size(x_array)): + for j in range (0,np.size(y_array)): + for x_center in x_centers: + for y_center in y_centers: + d_squared = np.power(x_array[i] - x_center, 2) + np.power(y_array[j] - y_center, 2) + Q[i,j] += Q_avg*np.power(spacing/sigma/np.sqrt(2.0*np.pi),dim)*np.exp(-d_squared/2.0/sigma/sigma) + +if dim == 1: + Qint = np.trapz(Q,x_array,axis=0) + Qavg = Qint/Lx + plt.plot(x_array,Q) +if dim == 2: + X, Y = np.meshgrid(y_array,x_array) + plt.contourf(X, Y, Q) + plt.xlim((xmin,xmax)) + plt.ylim((ymin,ymax)) + plt.axis('equal') + Qint = np.trapz(np.trapz(Q,y_array,axis=1),x_array,axis=0) + Qavg = Qint/Lx/Ly + +print "integral: ", Qint +print "average: ", Qavg + + +plt.show() diff --git a/src/auxkernels/SinkMapAux.C b/src/auxkernels/SinkMapAux.C new file mode 100644 index 000000000..7e7eddb95 --- /dev/null +++ b/src/auxkernels/SinkMapAux.C @@ -0,0 +1,43 @@ +/****************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* (c) 2010 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Prepared by Battelle Energy Alliance, LLC */ +/* Under Contract No. DE-AC07-05ID14517 */ +/* With the U. S. Department of Energy */ +/* */ +/* See COPYRIGHT for full restrictions */ +/****************************************************************/ + +#include "SinkMapAux.h" +#include "SinkMapUserObject.h" + +template<> +InputParameters validParams() +{ + InputParameters params = validParams(); + params.addRequiredParam("sink_map_user_object", "The SinkMapUserObject to retrieve values from."); + return params; +} + +SinkMapAux::SinkMapAux(const InputParameters & parameters) : + AuxKernel(parameters), + _sink_map_uo(getUserObject("sink_map_user_object")), + _element_sink_map(0) +{ +} + +void +SinkMapAux::precalculateValue() +{ + _element_sink_map = _sink_map_uo.getLocalSinkMap(_current_elem); +} + +Real +SinkMapAux::computeValue() +{ + return _element_sink_map[_qp]; +} diff --git a/src/base/PrariedogApp.C b/src/base/PrariedogApp.C index 0b58d4edd..fddf0a564 100644 --- a/src/base/PrariedogApp.C +++ b/src/base/PrariedogApp.C @@ -18,6 +18,9 @@ #include "MaterialSinkKernel.h" #include "CircleMaxOriginalElementSize.h" #include "CircleMaxOriginalElementSizePPS.h" +#include "SinkMapUserObject.h" +#include "SinkMapAux.h" +#include "SinkMapKernel.h" template<> InputParameters validParams() @@ -60,11 +63,14 @@ extern "C" void PrariedogApp__registerObjects(Factory & factory) { PrariedogApp: void PrariedogApp::registerObjects(Factory & factory) { + registerAuxKernel(SinkMapAux); + registerFunction(GaussianFunction); registerKernel(EventInserterSource); registerKernel(MaterialDiffusion); registerKernel(MaterialSinkKernel); + registerKernel(SinkMapKernel); registerMarker(EventMarker); @@ -78,6 +84,7 @@ PrariedogApp::registerObjects(Factory & factory) registerUserObject(GaussianUserObject); registerUserObject(CircleAverageMaterialProperty); registerUserObject(CircleMaxOriginalElementSize); + registerUserObject(SinkMapUserObject); } // External entry point for dynamic syntax association diff --git a/src/kernels/SinkMapKernel.C b/src/kernels/SinkMapKernel.C new file mode 100644 index 000000000..977fd983e --- /dev/null +++ b/src/kernels/SinkMapKernel.C @@ -0,0 +1,65 @@ +/****************************************************************/ +/* DO NOT MODIFY THIS HEADER */ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* (c) 2010 Battelle Energy Alliance, LLC */ +/* ALL RIGHTS RESERVED */ +/* */ +/* Prepared by Battelle Energy Alliance, LLC */ +/* Under Contract No. DE-AC07-05ID14517 */ +/* With the U. S. Department of Energy */ +/* */ +/* See COPYRIGHT for full restrictions */ +/****************************************************************/ +#include "SinkMapKernel.h" +#include "SinkMapUserObject.h" + +template<> +InputParameters validParams() +{ + InputParameters params = validParams(); + + params.addRequiredParam("sink_map_user_object", "The name of the SinkMapUserObject."); + + return params; +} + +SinkMapKernel::SinkMapKernel(const InputParameters & parameters) : + Reaction(parameters), + _sink_map_uo(getUserObject("sink_map_user_object")), + _diffusivity(getMaterialProperty("diffusivity")), + _element_sink_map(0) +{ +} + +void +SinkMapKernel::computeResidual() +{ + // get the current element's sink strength vector + _element_sink_map = _sink_map_uo.getLocalSinkMap(_current_elem); + + // now call the base class's function + Reaction::computeResidual(); +} + +Real +SinkMapKernel::computeQpResidual() +{ + return _diffusivity[_qp] * _element_sink_map[_qp] * Reaction::computeQpResidual(); +} + +void +SinkMapKernel::computeJacobian() +{ + // get the current element's sink strength vector + _element_sink_map = _sink_map_uo.getLocalSinkMap(_current_elem); + + // now call the base class's function + Reaction::computeJacobian(); +} + +Real +SinkMapKernel::computeQpJacobian() +{ + return _diffusivity[_qp] * _element_sink_map[_qp] * Reaction::computeQpJacobian(); +} diff --git a/src/markers/EventMarker.C b/src/markers/EventMarker.C index 7c5ead58c..67e30b5c1 100644 --- a/src/markers/EventMarker.C +++ b/src/markers/EventMarker.C @@ -26,6 +26,11 @@ InputParameters validParams() params.addCoupledVar("periodic_variable", "Use perodic boundary conditions of this variable to determine the distance to the function peak location"); params.addParam("coarsen_events", false, "Coarsen events at some later time. If true, set 'track_old_events=true' in EventInserter."); params.addParam("event_sigma_mesh_ratio", 2.0, "Refine elements until ratio of event sigma to element size is equal to or greater than this value."); + params.addParam("refine_sinks", false, "Refine the area around sinks from SinkMapUserObject."); + params.addParam("sink_marker_radius", 3.0, "How many sigmas to mark away from sink center."); + params.addParam("sink_sigma_mesh_ratio", 2.0, "Refine elements until ratio of sink sigma to element size is equal to or greater than this value."); + params.addParam("sink_map_user_object", "The name of the SinkMapUserObject."); + params.addParam("sink_gaussian_user_object", "The name of the GaussianUserObject to use for sink size."); return params; } @@ -44,15 +49,39 @@ EventMarker::EventMarker(const InputParameters & parameters) : _refine_distance(_marker_radius * _gaussian_uo.getSigma()), _minimum_element_size(_gaussian_uo.getSigma() / _sigma_mesh_ratio), _refine_by_ratio(parameters.isParamSetByUser("event_sigma_mesh_ratio")), + _refine_sinks(getParam("refine_sinks")), + _sink_marker_radius(getParam("sink_marker_radius")), + _refine_sinks_by_ratio(parameters.isParamSetByUser("sink_sigma_mesh_ratio")), + _sink_sigma_mesh_ratio(getParam("sink_sigma_mesh_ratio")), + _sink_map_user_object_ptr(NULL), + _sink_gaussian_user_object_ptr(NULL), _event_incoming(false), _event_location(0), _input_cycles_per_step(_adaptivity.getCyclesPerStep()), _coarsening_needed(false), + _sink_refinement_needed(false), _old_event_list(0) { // Check input logic for coarsening events if ((_coarsen_events) && (!_inserter.areOldEventsBeingTracked())) // need to tell EventInserter to track old events mooseError("When coarsening old events ('coarsen_events = true'), EventInserter object needs to track old events. Please set 'track_old_events = true' in EventInserter block."); + + // Check input logic for refining around sinks + if (_refine_sinks) + { + if ((parameters.isParamSetByUser("sink_map_user_object")) && (parameters.isParamSetByUser("sink_gaussian_user_object"))) + { + _sink_map_user_object_ptr = &getUserObject("sink_map_user_object"); + _sink_gaussian_user_object_ptr = &getUserObject("sink_gaussian_user_object"); + _sink_refine_distance = _sink_marker_radius * _sink_gaussian_user_object_ptr->getSigma(); + if (_refine_sinks_by_ratio) + _minimum_sink_element_size = _sink_gaussian_user_object_ptr->getSigma() / _sink_sigma_mesh_ratio; + } + else if (!parameters.isParamSetByUser("sink_map_user_object")) + mooseError("To refine around sinks, need to set 'sink_map_user_object' to the name of the SinkMapUserObject."); + else + mooseError("To refine around sinks, need to set 'sink_gaussian_user_object' to the name of the GaussianUserObject for sinks."); + } } void @@ -60,6 +89,10 @@ EventMarker::initialSetup() { // need to check for initial events checkForEvent(); + + // refine around sinks + if (_refine_sinks) + _sink_refinement_needed = true; } void @@ -95,17 +128,27 @@ EventMarker::timestepSetup() if ((_coarsen_events) && (_inserter.wasOldEventRemoved()) && (_event_incoming)) if (_verbose) _console << "EventMarker detected both refinement and coarsening are needed, so coarsening was skipped..." << std::endl; + + // might need to re-refine around sinks if coarsening is happening to a nearby event + if ((_refine_sinks) && (_coarsening_needed)) + _sink_refinement_needed = true; + else + _sink_refinement_needed = false; } Marker::MarkerValue EventMarker::computeElementMarker() { + // default marker value + MarkerValue marker_value = DO_NOTHING; + + // get centroid for this element + // optionally do qp's Point centroid = _current_elem->centroid(); // refine mesh if event is incoming if (_event_incoming) { - // distance to center depends on perodicity Real r; if (_periodic_var < 0) @@ -114,36 +157,50 @@ EventMarker::computeElementMarker() r = _mesh.minPeriodicDistance(_periodic_var, _event_location, centroid); if (r < _refine_distance) // we are near the event - if (!_refine_by_ratio) // refine if the distance is the only critereon - return REFINE; + if (!_refine_by_ratio) // refine if distance is the only critereon + marker_value = REFINE; else if (_current_elem->hmax() > _minimum_element_size) // or if screening by element size, check the element size - return REFINE; - - return DO_NOTHING; // default + marker_value = REFINE; } if (_coarsening_needed) { + // default to coarsen + marker_value = COARSEN; + // coarsen everywhere except inside old events for (unsigned int i=0; i<_old_event_list.size(); i++) { - _event_location = _old_event_list[i].second; + Point old_event_location = _old_event_list[i].second; // TODO: remove code duplication // distance to center depends on perodicity Real r; if (_periodic_var < 0) - r = (_event_location - centroid).norm(); + r = (old_event_location - centroid).norm(); else - r = _mesh.minPeriodicDistance(_periodic_var, _event_location, centroid); + r = _mesh.minPeriodicDistance(_periodic_var, old_event_location, centroid); if (r < _refine_distance) - return DO_NOTHING; + marker_value = DO_NOTHING; } + } - return COARSEN; + if (_sink_refinement_needed) + { + // get distance to nearest sink + Real r = _sink_map_user_object_ptr->getDistanceToNearestSink(centroid); + + // refine if close enough + if (r < _sink_refine_distance) // we are near a sink + if (marker_value == COARSEN) // no coarsening occurs during initial refinement, so sinks are already refined and we need to negate coarsening of nearby event + marker_value = DO_NOTHING; + else if (!_refine_sinks_by_ratio) // refine if distance is the only critereon + marker_value = REFINE; + else if (_current_elem->hmax() > _minimum_sink_element_size) // or if screening by element size, check the element size + marker_value = REFINE; } - return DO_NOTHING; // satisfy compiler + return marker_value; } void diff --git a/src/userobjects/GaussianUserObject.C b/src/userobjects/GaussianUserObject.C index 369fa3650..c221fe189 100644 --- a/src/userobjects/GaussianUserObject.C +++ b/src/userobjects/GaussianUserObject.C @@ -43,6 +43,9 @@ GaussianUserObject::GaussianUserObject(const InputParameters & parameters) : _periodic_var(isCoupled("periodic_variable") ? (int) coupled("periodic_variable") : -1), _mesh(_fe_problem.mesh()) { + // normalization constant so integral over domain (theoretically) equals 1 + unsigned int dim = _mesh.dimension(); + _norm = 1.0/(pow(_sigma,dim)*pow(pow(2.0*pi,dim),0.5)); } GaussianUserObject::~GaussianUserObject() @@ -52,10 +55,6 @@ GaussianUserObject::~GaussianUserObject() Real GaussianUserObject::value(const Point & p, const Point & center) const { - // normalization constant so integral over domain (theoretically) equals 1 - unsigned int dim = _mesh.dimension(); - Real norm = 1.0/(pow(_sigma,dim)*pow(pow(2.0*pi,dim),0.5)); - // distance to center depends on perodicity Real r; if (_periodic_var < 0) @@ -65,5 +64,13 @@ GaussianUserObject::value(const Point & p, const Point & center) const Real f = exp(-r*r/2.0/_sigma/_sigma); - return f*norm*_scale; + return f*_norm*_scale; +} + +Real +GaussianUserObject::value(const Real r) const +{ + Real f = exp(-r*r/2.0/_sigma/_sigma); + + return f*_norm*_scale; } diff --git a/src/userobjects/SinkMapUserObject.C b/src/userobjects/SinkMapUserObject.C new file mode 100644 index 000000000..f823699ae --- /dev/null +++ b/src/userobjects/SinkMapUserObject.C @@ -0,0 +1,187 @@ +/****************************************************************/ +/* MOOSE - Multiphysics Object Oriented Simulation Environment */ +/* */ +/* All contents are licensed under LGPL V2.1 */ +/* See LICENSE for full restrictions */ +/****************************************************************/ + +#include "SinkMapUserObject.h" +#include "MooseMesh.h" +#include "GaussianUserObject.h" + +// libmesh includes +#include "libmesh/quadrature.h" + +template<> +InputParameters validParams() +{ + MooseEnum sink_placement("corner inside", "corner"); + MooseEnum sink_shape_3d("spheres lines", "lines"); + + InputParameters params = validParams(); + params.addRequiredParam("spacing", "Distance to space sink centers"); + params.addRequiredParam("strength", "Average strength of the overall sink map."); + params.addRequiredParam("gaussian_user_object", "Name of the GaussianUserObject to use for sink shapes."); + params.addParam("sink_placement", sink_placement, "How to place sinks on domain, choices are 'corner' to place them in the corners (and wrap around), and 'inside' to keep them away from edges."); + params.addParam("sink_shape_3d", sink_shape_3d, "Shape to use for sinks in 3D, choices are 'spheres' or 'lines'."); + params.addCoupledVar("periodic_variable", "Use the periodicity settings of this variable to populate the sink map"); + + MultiMooseEnum setup_options(SetupInterface::getExecuteOptions()); + // the mapping needs to run at timestep begin, which is after the adaptivity + // run of the previous timestep. + setup_options = "timestep_begin"; + params.set("execute_on") = setup_options; + return params; +} + +SinkMapUserObject::SinkMapUserObject(const InputParameters & parameters) : + ElementUserObject(parameters), + _spacing(getParam("spacing")), + _strength(getParam("strength")), + _gaussian_user_object_ptr(NULL), + _sink_placement(getParam("sink_placement")), + _sink_shape_3d(getParam("sink_shape_3d")), + _periodic_var(isCoupled("periodic_variable") ? coupled("periodic_variable") : -1), + _dim(_mesh.dimension()), + _mesh_changed(true) +{ + _zero_map.assign(_fe_problem.getMaxQps(), 0.0); +} + +void +SinkMapUserObject::initialSetup() +{ + // get sink sigma + _gaussian_user_object_ptr = &getUserObject("gaussian_user_object"); + _sigma = _gaussian_user_object_ptr->getSigma(); + + // calculate sink locations + if (_sink_placement == "corner") + { + // yes this is dumb, but it works + for (Real x_center = _mesh.getMinInDimension(0); x_center <= _mesh.getMinInDimension(0) + _mesh.dimensionWidth(0); x_center += _spacing) + for (Real y_center = _mesh.getMinInDimension(1); y_center <= _mesh.getMinInDimension(1) + _mesh.dimensionWidth(1); y_center += _spacing) + if ((_dim == 3) && (_sink_shape_3d == "spheres")) + for (Real z_center = _mesh.getMinInDimension(2); z_center <= _mesh.getMinInDimension(2) + _mesh.dimensionWidth(2); z_center += _spacing) + _sink_location_list.push_back(Point(x_center, y_center, z_center)); + else + _sink_location_list.push_back(Point(x_center, y_center, 0.0)); + } + else // centered sink placement + { + if (_dim == 1) + for (Real x_center = _mesh.getMinInDimension(0) + _spacing/2.0; x_center <= _mesh.getMinInDimension(0) + _mesh.dimensionWidth(0) - _spacing/2.0; x_center += _spacing) + _sink_location_list.push_back(Point(x_center, 0.0, 0.0)); + else + for (Real x_center = _mesh.getMinInDimension(0) + _spacing/2.0; x_center <= _mesh.getMinInDimension(0) + _mesh.dimensionWidth(0) - _spacing/2.0; x_center += _spacing) + for (Real y_center = _mesh.getMinInDimension(1) + _spacing/2.0; y_center <= _mesh.getMinInDimension(1) + _mesh.dimensionWidth(1) - _spacing/2.0; y_center += _spacing) + if ((_dim == 3) && (_sink_shape_3d == "spheres")) + for (Real z_center = _mesh.getMinInDimension(2) + _spacing/2.0; z_center <= _mesh.getMinInDimension(2) + _mesh.dimensionWidth(2) - _spacing/2.0; z_center += _spacing) + _sink_location_list.push_back(Point(x_center, y_center, z_center)); + else + _sink_location_list.push_back(Point(x_center, y_center, 0.0)); + } + + // compute normalization constant + _norm = _strength*std::pow(_spacing, (double) _dim); + + // normalization constant from GaussianUserObject has an additional 1/(sigma*sqrt(2*pi)) since mesh is in 3D but lines are in 2D + if ((_dim == 3) && (_sink_shape_3d == "lines")) + _norm *= _sigma*std::sqrt(2.0*libMesh::pi); + + // print sink centers + for (unsigned int i=0; i<_sink_location_list.size(); i++) + _console << _sink_location_list[i] << std::endl; +} + +void +SinkMapUserObject::initialize() +{ + if (_mesh_changed) + { + _rebuild_map = true; + _sink_strength_map.clear(); + } + else + _rebuild_map = false; + + _mesh_changed = false; +} + +void +SinkMapUserObject::execute() +{ + if (_rebuild_map) + { + // reserve space for each quadrature point in the element + _elem_map.assign(_qrule->n_points(), 0); + + // loop over quadrature points in this element + for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp) + { + // find distance to nearest sink from this point + Real rmin = getDistanceToNearestSink(_q_point[qp]); + + // compute sink strength at this location + _elem_map[qp] = _norm*_gaussian_user_object_ptr->value(rmin); + } + + // insert vector into map + _sink_strength_map.insert(std::pair >(_current_elem->id(), _elem_map)); + } +} + +void +SinkMapUserObject::threadJoin(const UserObject &y) +{ + // if the map needs to be updated we merge the maps from all threads + if (_rebuild_map) + { + const SinkMapUserObject & uo = static_cast(y); + _sink_strength_map.insert(uo._sink_strength_map.begin(), uo._sink_strength_map.end()); + } +} + +void +SinkMapUserObject::meshChanged() +{ + _mesh_changed = true; +} + +const std::vector & +SinkMapUserObject::getLocalSinkMap(const Elem * elem) const +{ + SinkMap::const_iterator i = _sink_strength_map.find(elem->id()); + + // if no entry in the map was found then something went wrong + if (i == _sink_strength_map.end()) + mooseError("no sinks found in element " << elem->id()); + + return i->second; +} + +Real +SinkMapUserObject::getDistanceToNearestSink(const Point & p) const +{ + Real r, rmin = std::numeric_limits::max(); + + // to do 3D lines, need to change z-component of point to that of a sink + // so the distance to the line is based on the xy-plane distance + Point new_p; + if ((_dim == 3) && (_sink_shape_3d == "lines")) + new_p = Point(p(0), p(1), 0.0); + else + new_p = p; + + // find the distance to the closest sink location + for (unsigned i = 0; i < _sink_location_list.size(); ++i) + { + // use a non-periodic or periodic distance + r = _periodic_var < 0 ? + (new_p - _sink_location_list[i]).norm() : + _mesh.minPeriodicDistance(_periodic_var, new_p, _sink_location_list[i]); + if (r < rmin) + rmin = r; + } + return rmin; +} diff --git a/tests/kernels/material_sink_kernel/gold/material_sink_kernel_out.e b/tests/kernels/material_sink_kernel/gold/material_sink_kernel_out.e new file mode 100644 index 000000000..c8fc80166 Binary files /dev/null and b/tests/kernels/material_sink_kernel/gold/material_sink_kernel_out.e differ diff --git a/tests/kernels/material_sink_kernel/material_sink_kernel.i b/tests/kernels/material_sink_kernel/material_sink_kernel.i new file mode 100644 index 000000000..d50d20e1d --- /dev/null +++ b/tests/kernels/material_sink_kernel/material_sink_kernel.i @@ -0,0 +1,105 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -0.5 + xmax = 0.5 + ymin = -0.5 + ymax = 0.5 + nx = 40 + ny = 40 +[] + +[Variables] + [./u] + initial_condition = 1.0 + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./matdiffusion] + type = MaterialDiffusion + variable = u + diffusivity_name = diffusivity + [../] + [./sinkmap] + type = MaterialSinkKernel + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = MaterialRealAux + variable = sink_strength + property = sink_strength + execute_on = 'timestep_end' + [../] +[] + +[Functions] + [./gaussian_2d] + # 2D gaussian function, centered at origin, sigma=0.05, integrates to 3 + type = ParsedFunction + value = 3.0/0.05/0.05/2.0/pi*exp(-(x*x+y*y)/2/0.05/0.05) + [../] +[] + +[Materials] + [./uniform_diffusivity] + type = GenericConstantMaterial + prop_names = diffusivity + prop_values = 0.5 + [../] + [./gaussian_sink] + type = GenericFunctionMaterial + block = 0 + prop_names = sink_strength + prop_values = gaussian_2d + [../] +[] + +[Postprocessors] + [./integral_sink_strength] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average_solution] + type = ElementAverageValue + variable = u + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 3 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/kernels/material_sink_kernel/tests b/tests/kernels/material_sink_kernel/tests new file mode 100644 index 000000000..2082e6a05 --- /dev/null +++ b/tests/kernels/material_sink_kernel/tests @@ -0,0 +1,7 @@ +[Tests] + [./material_sink_kernel] + type = 'Exodiff' + input = 'material_sink_kernel.i' + exodiff = 'material_sink_kernel_out.e' + [../] +[] diff --git a/tests/kernels/sink_map_kernel/gold/sink_map_kernel_out.e b/tests/kernels/sink_map_kernel/gold/sink_map_kernel_out.e new file mode 100644 index 000000000..a6aa27468 Binary files /dev/null and b/tests/kernels/sink_map_kernel/gold/sink_map_kernel_out.e differ diff --git a/tests/kernels/sink_map_kernel/sink_map_kernel.i b/tests/kernels/sink_map_kernel/sink_map_kernel.i new file mode 100644 index 000000000..d89e1034b --- /dev/null +++ b/tests/kernels/sink_map_kernel/sink_map_kernel.i @@ -0,0 +1,112 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 50 + ny = 50 +[] + +[Variables] + [./u] + initial_condition = 1.0 + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./matdiffusion] + type = MaterialDiffusion + variable = u + diffusivity_name = diffusivity + [../] + [./sinkmap] + type = SinkMapKernel + variable = u + sink_map_user_object = sink_map_uo + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[Materials] + [./uniform_diffusivity] + type = GenericConstantMaterial + prop_names = diffusivity + prop_values = 0.5 + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + [../] +[] + +[Postprocessors] + [./integral_sink_strength] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average_sink_strength] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average_solution] + type = ElementAverageValue + variable = u + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 3 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/kernels/sink_map_kernel/tests b/tests/kernels/sink_map_kernel/tests new file mode 100644 index 000000000..49bb99f37 --- /dev/null +++ b/tests/kernels/sink_map_kernel/tests @@ -0,0 +1,7 @@ +[Tests] + [./sink_map_kernel] + type = 'Exodiff' + input = 'sink_map_kernel.i' + exodiff = 'sink_map_kernel_out.e' + [../] +[] diff --git a/tests/markers/event_marker_sigma_coarsening_near_refined_sink.i b/tests/markers/event_marker_sigma_coarsening_near_refined_sink.i new file mode 100644 index 000000000..263e89af0 --- /dev/null +++ b/tests/markers/event_marker_sigma_coarsening_near_refined_sink.i @@ -0,0 +1,227 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 20 + ny = 20 +[] + +[Variables] + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_map_aux] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Kernels] + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = MaterialDiffusion + variable = u + diffusivity_name = diffusivity + [../] + + [./sink_map] + type = SinkMapKernel + variable = u + sink_map_user_object = sink_map_uo + [../] + + [./event_inserter_source] + type = EventInserterSource + variable = u + inserter = inserter + gaussian_user_object = gaussian_uo + [../] +[] + +[AuxKernels] + [./sink_map] + type = SinkMapAux + variable = sink_map_aux + sink_map_user_object = sink_map_uo + execute_on = timestep_end + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Materials] + [./simple] + type = GenericConstantMaterial + block = 0 + prop_names = 'diffusivity' + prop_values = '2.0' + [../] +[] + +[UserObjects] + [./inserter_circle_average] + type = CircleAverageMaterialProperty + mat_prop = diffusivity + periodic_variable = u + inserter = inserter + radius = 0.2 + [../] + [./circle_average] + type = CircleAverageMaterialProperty + mat_prop = diffusivity + periodic_variable = u + [../] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + use_random_points = true + random_point_user_object = random_point_uo + periodic_variable = u + scale = 3 + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./circle_max_original_element_size_uo] + type = CircleMaxOriginalElementSize + periodic_variable = u + [../] + [./inserter] + type = EventInserter + insert_initial = true + random_timing = false + mean = 1.2 + random_point_user_object = random_point_uo + seed = 3 + verbose = true + track_old_events = true + removal_method = sigma_element_size_ratio + removal_sigma_element_size_ratio = 2.0 + radius = 3.0 + gaussian_user_object = gaussian_uo + circle_average_material_property_user_object = circle_average + inserter_circle_average_material_property_user_object = inserter_circle_average + circle_max_original_element_size_user_object = circle_max_original_element_size_uo + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 0.05 + sink_placement = inside + gaussian_user_object = sink_gaussian_uo + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + marker = event_marker + cycles_per_step = 10 + max_h_level = 0 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 6.0 + coarsen_events = true + verbose = true + periodic_variable = u + event_sigma_mesh_ratio = 1.0 + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_uo + sink_gaussian_user_object = sink_gaussian_uo + sink_sigma_mesh_ratio = 1.0 + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = 'NEWTON' + + start_time = 0.0 + num_steps = 4 + + verbose = true + + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + nl_abs_tol = 1.0e-12 + + [./TimeStepper] + type = EventTimeStepper + dt = 0.01 + event_inserter = inserter + growth_factor = 2.0 + [../] +[] + +[Preconditioning] + [./smp] + type = SMP + full = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./solution_integral] + type = ElementIntegralVariablePostprocessor + variable = u + [../] + [./solution_average] + type = ElementAverageValue + variable = u + [../] + [./sink_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_map_aux + [../] + [./sink_average] + type = ElementAverageValue + variable = sink_map_aux + [../] + [./num_elems] + type = NumElems + [../] +[] + +[Outputs] + exodus = true +[] diff --git a/tests/markers/gold/event_marker_sigma_coarsening_near_refined_sink_out.e-s002 b/tests/markers/gold/event_marker_sigma_coarsening_near_refined_sink_out.e-s002 new file mode 100644 index 000000000..b72635b23 Binary files /dev/null and b/tests/markers/gold/event_marker_sigma_coarsening_near_refined_sink_out.e-s002 differ diff --git a/tests/markers/gold/sink_marker_3d_out.e b/tests/markers/gold/sink_marker_3d_out.e new file mode 100644 index 000000000..48cda7d32 Binary files /dev/null and b/tests/markers/gold/sink_marker_3d_out.e differ diff --git a/tests/markers/gold/sink_marker_inside_out.e b/tests/markers/gold/sink_marker_inside_out.e new file mode 100644 index 000000000..67f523254 Binary files /dev/null and b/tests/markers/gold/sink_marker_inside_out.e differ diff --git a/tests/markers/gold/sink_marker_out.e b/tests/markers/gold/sink_marker_out.e new file mode 100644 index 000000000..7fd3bfce5 Binary files /dev/null and b/tests/markers/gold/sink_marker_out.e differ diff --git a/tests/markers/gold/sink_marker_sigma_ratio_refinement_out.e b/tests/markers/gold/sink_marker_sigma_ratio_refinement_out.e new file mode 100644 index 000000000..0a1952bc8 Binary files /dev/null and b/tests/markers/gold/sink_marker_sigma_ratio_refinement_out.e differ diff --git a/tests/markers/sink_marker.i b/tests/markers/sink_marker.i new file mode 100644 index 000000000..663608376 --- /dev/null +++ b/tests/markers/sink_marker.i @@ -0,0 +1,203 @@ +########################################################### +# This is a simple test with a time-dependent problem +# demonstrating the use of a "Transient" Executioner. +# +# @Requirement F1.10 +########################################################### + + +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 20 + ny = 20 +[] + +[Variables] + active = 'u' + + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Functions] + [./forcing_fn] + type = ParsedFunction + # dudt = 3*t^2*(x^2 + y^2) + value = 3*t*t*((x*x)+(y*y))-(4*t*t*t) + [../] + + [./exact_fn] + type = ParsedFunction + value = t*t*t*((x*x)+(y*y)) + [../] +[] + +[Kernels] + active = 'diff ie ffn' + + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = Diffusion + variable = u + [../] + + [./ffn] + type = UserForcingFunction + variable = u + function = forcing_fn + [../] +[] + +[AuxKernels] + [./sink_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_user_object + execute_on = 'timestep_end' + [../] +[] + +[BCs] + active = 'all' + + [./all] + type = FunctionDirichletBC + variable = u + boundary = '0 1 2 3' + function = exact_fn + [../] + + [./left] + type = DirichletBC + variable = u + boundary = 3 + value = 0 + [../] + + [./right] + type = DirichletBC + variable = u + boundary = 1 + value = 1 + [../] +[] + +[UserObjects] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./inserter] + type = EventInserter + distribution = 'uniform' + mean = 0.4 + insert_test = true + test_time = 0.15 + test_location = '0.1 0.2 0.0' + random_point_user_object = random_point_uo + verbose = true + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.1 + peak_location = '0.1 0.2 0.0' + periodic_variable = u + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_user_object] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + max_h_level = 2 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 3.0 + verbose = true + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_user_object + sink_gaussian_user_object = sink_gaussian_uo + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + #start_time = 0.0 + #end_time = 0.39 + num_steps = 1 + + verbose = true + [./TimeStepper] + type = EventTimeStepper + dt = 0.1 + event_inserter = inserter + verbose = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./sink_strength_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + [../] + [./sink_strength_average] + type = ElementAverageValue + variable = sink_strength + [../] +[] + +[Outputs] + exodus = true + [./console] + type = Console + print_mesh_changed_info = true + [../] +[] diff --git a/tests/markers/sink_marker_3d.i b/tests/markers/sink_marker_3d.i new file mode 100644 index 000000000..de9b7027d --- /dev/null +++ b/tests/markers/sink_marker_3d.i @@ -0,0 +1,206 @@ +########################################################### +# This is a simple test with a time-dependent problem +# demonstrating the use of a "Transient" Executioner. +# +# @Requirement F1.10 +########################################################### + + +[Mesh] + type = GeneratedMesh + dim = 3 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + zmin = -1 + zmax = 1 + nx = 20 + ny = 20 + nz = 20 +[] + +[Variables] + active = 'u' + + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Functions] + [./forcing_fn] + type = ParsedFunction + # dudt = 3*t^2*(x^2 + y^2) + value = 3*t*t*((x*x)+(y*y))-(4*t*t*t) + [../] + + [./exact_fn] + type = ParsedFunction + value = t*t*t*((x*x)+(y*y)) + [../] +[] + +[Kernels] + active = 'diff ie' + + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = Diffusion + variable = u + [../] + + [./ffn] + type = UserForcingFunction + variable = u + function = forcing_fn + [../] +[] + +[AuxKernels] + [./sink_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_user_object + execute_on = 'timestep_end' + [../] +[] + +[BCs] + active = '' + + [./all] + type = FunctionDirichletBC + variable = u + boundary = '0 1 2 3' + function = exact_fn + [../] + + [./left] + type = DirichletBC + variable = u + boundary = 3 + value = 0 + [../] + + [./right] + type = DirichletBC + variable = u + boundary = 1 + value = 1 + [../] +[] + +[UserObjects] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./inserter] + type = EventInserter + distribution = 'uniform' + mean = 0.4 + insert_test = true + test_time = 0.15 + test_location = '0.1 0.2 0.0' + random_point_user_object = random_point_uo + verbose = true + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.1 + peak_location = '0.1 0.2 0.0' + periodic_variable = u + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_user_object] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + max_h_level = 1 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 3.0 + verbose = true + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_user_object + sink_gaussian_user_object = sink_gaussian_uo + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + #start_time = 0.0 + #end_time = 0.39 + num_steps = 1 + + verbose = true + [./TimeStepper] + type = EventTimeStepper + dt = 0.1 + event_inserter = inserter + verbose = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./sink_strength_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + [../] + [./sink_strength_average] + type = ElementAverageValue + variable = sink_strength + [../] +[] + +[Outputs] + exodus = true + [./console] + type = Console + print_mesh_changed_info = true + [../] +[] diff --git a/tests/markers/sink_marker_inside.i b/tests/markers/sink_marker_inside.i new file mode 100644 index 000000000..e5112d6d8 --- /dev/null +++ b/tests/markers/sink_marker_inside.i @@ -0,0 +1,204 @@ +########################################################### +# This is a simple test with a time-dependent problem +# demonstrating the use of a "Transient" Executioner. +# +# @Requirement F1.10 +########################################################### + + +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 20 + ny = 20 +[] + +[Variables] + active = 'u' + + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Functions] + [./forcing_fn] + type = ParsedFunction + # dudt = 3*t^2*(x^2 + y^2) + value = 3*t*t*((x*x)+(y*y))-(4*t*t*t) + [../] + + [./exact_fn] + type = ParsedFunction + value = t*t*t*((x*x)+(y*y)) + [../] +[] + +[Kernels] + active = 'diff ie ffn' + + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = Diffusion + variable = u + [../] + + [./ffn] + type = UserForcingFunction + variable = u + function = forcing_fn + [../] +[] + +[AuxKernels] + [./sink_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_user_object + execute_on = 'timestep_end' + [../] +[] + +[BCs] + active = 'all' + + [./all] + type = FunctionDirichletBC + variable = u + boundary = '0 1 2 3' + function = exact_fn + [../] + + [./left] + type = DirichletBC + variable = u + boundary = 3 + value = 0 + [../] + + [./right] + type = DirichletBC + variable = u + boundary = 1 + value = 1 + [../] +[] + +[UserObjects] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./inserter] + type = EventInserter + distribution = 'uniform' + mean = 0.4 + insert_test = true + test_time = 0.15 + test_location = '0.1 0.2 0.0' + random_point_user_object = random_point_uo + verbose = true + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.1 + peak_location = '0.1 0.2 0.0' + periodic_variable = u + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_user_object] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + max_h_level = 2 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 3.0 + verbose = true + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_user_object + sink_gaussian_user_object = sink_gaussian_uo + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + #start_time = 0.0 + #end_time = 0.39 + num_steps = 1 + + verbose = true + [./TimeStepper] + type = EventTimeStepper + dt = 0.1 + event_inserter = inserter + verbose = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./sink_strength_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + [../] + [./sink_strength_average] + type = ElementAverageValue + variable = sink_strength + [../] +[] + +[Outputs] + exodus = true + [./console] + type = Console + print_mesh_changed_info = true + [../] +[] diff --git a/tests/markers/sink_marker_sigma_ratio_refinement.i b/tests/markers/sink_marker_sigma_ratio_refinement.i new file mode 100644 index 000000000..f6eff471c --- /dev/null +++ b/tests/markers/sink_marker_sigma_ratio_refinement.i @@ -0,0 +1,204 @@ +########################################################### +# This is a simple test with a time-dependent problem +# demonstrating the use of a "Transient" Executioner. +# +# @Requirement F1.10 +########################################################### + + +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + nx = 20 + ny = 20 +[] + +[Variables] + active = 'u' + + [./u] + order = FIRST + family = LAGRANGE + + [./InitialCondition] + type = ConstantIC + value = 0 + [../] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[Functions] + [./forcing_fn] + type = ParsedFunction + # dudt = 3*t^2*(x^2 + y^2) + value = 3*t*t*((x*x)+(y*y))-(4*t*t*t) + [../] + + [./exact_fn] + type = ParsedFunction + value = t*t*t*((x*x)+(y*y)) + [../] +[] + +[Kernels] + active = 'diff ie ffn' + + [./ie] + type = TimeDerivative + variable = u + [../] + + [./diff] + type = Diffusion + variable = u + [../] + + [./ffn] + type = UserForcingFunction + variable = u + function = forcing_fn + [../] +[] + +[AuxKernels] + [./sink_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_user_object + execute_on = 'timestep_end' + [../] +[] + +[BCs] + active = 'all' + + [./all] + type = FunctionDirichletBC + variable = u + boundary = '0 1 2 3' + function = exact_fn + [../] + + [./left] + type = DirichletBC + variable = u + boundary = 3 + value = 0 + [../] + + [./right] + type = DirichletBC + variable = u + boundary = 1 + value = 1 + [../] +[] + +[UserObjects] + [./random_point_uo] + type = RandomPointUserObject + seed = 1 + [../] + [./inserter] + type = EventInserter + distribution = 'uniform' + mean = 0.4 + insert_test = true + test_time = 0.15 + test_location = '0.1 0.2 0.0' + random_point_user_object = random_point_uo + verbose = true + [../] + [./gaussian_uo] + type = GaussianUserObject + sigma = 0.1 + peak_location = '0.1 0.2 0.0' + periodic_variable = u + [../] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_user_object] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + [../] +[] + +[Adaptivity] + initial_marker = event_marker + initial_steps = 10 + max_h_level = 0 + recompute_markers_during_cycles = true + [./Markers] + [./event_marker] + type = EventMarker + inserter = inserter + gaussian_user_object = gaussian_uo + marker_radius = 3.0 + verbose = true + refine_sinks = true + sink_marker_radius = 6.0 + sink_map_user_object = sink_map_user_object + sink_gaussian_user_object = sink_gaussian_uo + sink_sigma_mesh_ratio = 1.0 + [../] + [../] +[] + +[Executioner] + type = Transient + scheme = 'implicit-euler' + + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' + + #start_time = 0.0 + #end_time = 0.39 + num_steps = 1 + + verbose = true + [./TimeStepper] + type = EventTimeStepper + dt = 0.1 + event_inserter = inserter + verbose = true + [../] +[] + +[Postprocessors] + [./dt] + type = TimestepSize + [../] + [./sink_strength_integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + [../] + [./sink_strength_average] + type = ElementAverageValue + variable = sink_strength + [../] +[] + +[Outputs] + exodus = true + [./console] + type = Console + print_mesh_changed_info = true + [../] +[] diff --git a/tests/markers/tests b/tests/markers/tests index 822ccf497..deacdb82e 100644 --- a/tests/markers/tests +++ b/tests/markers/tests @@ -39,4 +39,30 @@ input = 'event_marker_sigma_ratio_coarsening.i' exodiff = 'event_marker_sigma_ratio_coarsening_out.e-s002' [../] + [./sink_marker] + type = 'Exodiff' + input = 'sink_marker.i' + exodiff = 'sink_marker_out.e' + [../] + [./sink_marker_inside_placement] + type = 'Exodiff' + input = 'sink_marker_inside.i' + exodiff = 'sink_marker_inside_out.e' + [../] + [./sink_marker_sigma_ratio_refinement] + type = 'Exodiff' + input = 'sink_marker_sigma_ratio_refinement.i' + exodiff = 'sink_marker_sigma_ratio_refinement_out.e' + [../] + [./sink_marker_3d] + type = 'Exodiff' + input = 'sink_marker_3d.i' + exodiff = 'sink_marker_3d_out.e' + heavy = true + [../] + [./event_marker_sigma_coarsening_near_refined_sink] + type = 'Exodiff' + input = 'event_marker_sigma_coarsening_near_refined_sink.i' + exodiff = 'event_marker_sigma_coarsening_near_refined_sink_out.e-s002' + [../] [] diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_1d_inside_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_1d_inside_out.e new file mode 100644 index 000000000..2719c7943 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_1d_inside_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_1d_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_1d_out.e new file mode 100644 index 000000000..820995328 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_1d_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_2d_inside_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_2d_inside_out.e new file mode 100644 index 000000000..ba355e388 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_2d_inside_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_2d_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_2d_out.e new file mode 100644 index 000000000..a6fc39e23 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_2d_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_lines_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_lines_out.e new file mode 100644 index 000000000..e3534ea2d Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_lines_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_spheres_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_spheres_out.e new file mode 100644 index 000000000..a9d953f08 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_inside_spheres_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_3d_lines_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_lines_out.e new file mode 100644 index 000000000..1f7d6157b Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_lines_out.e differ diff --git a/tests/userobjects/sink_map/gold/sink_map_user_object_3d_spheres_out.e b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_spheres_out.e new file mode 100644 index 000000000..b537435b4 Binary files /dev/null and b/tests/userobjects/sink_map/gold/sink_map_user_object_3d_spheres_out.e differ diff --git a/tests/userobjects/sink_map/sink_map_user_object_1d.i b/tests/userobjects/sink_map/sink_map_user_object_1d.i new file mode 100644 index 000000000..ee5b9fc3d --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_1d.i @@ -0,0 +1,110 @@ +[Mesh] + type = GeneratedMesh + dim = 1 + xmin = -2 + xmax = 2 + #ymin = -1 + #ymax = 1 + nx = 100 + #ny = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.0 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = corner + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_1d_inside.i b/tests/userobjects/sink_map/sink_map_user_object_1d_inside.i new file mode 100644 index 000000000..7b94d9a7f --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_1d_inside.i @@ -0,0 +1,110 @@ +[Mesh] + type = GeneratedMesh + dim = 1 + xmin = -2 + xmax = 2 + #ymin = -1 + #ymax = 1 + nx = 100 + #ny = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.0 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_2d.i b/tests/userobjects/sink_map/sink_map_user_object_2d.i new file mode 100644 index 000000000..23d0d06ff --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_2d.i @@ -0,0 +1,110 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -2 + xmax = 2 + ymin = -1 + ymax = 1 + nx = 100 + ny = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = corner + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_2d_inside.i b/tests/userobjects/sink_map/sink_map_user_object_2d_inside.i new file mode 100644 index 000000000..09882adc0 --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_2d_inside.i @@ -0,0 +1,110 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + xmin = -2 + xmax = 2 + ymin = -1 + ymax = 1 + nx = 100 + ny = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_3d_inside_lines.i b/tests/userobjects/sink_map/sink_map_user_object_3d_inside_lines.i new file mode 100644 index 000000000..2c5fbf3ae --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_3d_inside_lines.i @@ -0,0 +1,114 @@ +[Mesh] + type = GeneratedMesh + dim = 3 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + zmin = -1 + zmax = 1 + nx = 50 + ny = 50 + nz = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y z' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + sink_shape_3d = lines + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_3d_inside_spheres.i b/tests/userobjects/sink_map/sink_map_user_object_3d_inside_spheres.i new file mode 100644 index 000000000..17df52a4f --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_3d_inside_spheres.i @@ -0,0 +1,114 @@ +[Mesh] + type = GeneratedMesh + dim = 3 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + zmin = -1 + zmax = 1 + nx = 50 + ny = 50 + nz = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y z' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = inside + sink_shape_3d = spheres + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_3d_lines.i b/tests/userobjects/sink_map/sink_map_user_object_3d_lines.i new file mode 100644 index 000000000..53ecfa042 --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_3d_lines.i @@ -0,0 +1,114 @@ +[Mesh] + type = GeneratedMesh + dim = 3 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + zmin = -1 + zmax = 1 + nx = 50 + ny = 50 + nz = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y z' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = corner + sink_shape_3d = lines + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/sink_map_user_object_3d_spheres.i b/tests/userobjects/sink_map/sink_map_user_object_3d_spheres.i new file mode 100644 index 000000000..012a67493 --- /dev/null +++ b/tests/userobjects/sink_map/sink_map_user_object_3d_spheres.i @@ -0,0 +1,114 @@ +[Mesh] + type = GeneratedMesh + dim = 3 + xmin = -1 + xmax = 1 + ymin = -1 + ymax = 1 + zmin = -1 + zmax = 1 + nx = 50 + ny = 50 + nz = 50 +[] + +[Variables] + [./u] + [../] +[] + +[AuxVariables] + [./sink_strength] + order = CONSTANT + family = MONOMIAL + [../] +[] + +[ICs] + [./gaussianIC] + type = FunctionIC + variable = u + function = gaussian + [../] +[] + +[BCs] + [./Periodic] + [./all] + variable = u + auto_direction = 'x y z' + [../] + [../] +[] + +[Functions] + [./gaussian] + type = GaussianFunction + sigma = 0.05 + scale = 2.0 + peak_location = '0.05 0.95 0.0' + periodic_variable = u + [../] +[] + +[Kernels] + [./dt] + type = TimeDerivative + variable = u + [../] + [./diffusion] + type = Diffusion + variable = u + [../] +[] + +[AuxKernels] + [./sink_map_aux] + type = SinkMapAux + variable = sink_strength + sink_map_user_object = sink_map_uo + execute_on = 'timestep_end' + [../] +[] + +[UserObjects] + [./sink_gaussian_uo] + type = GaussianUserObject + sigma = 0.05 + [../] + [./sink_map_uo] + type = SinkMapUserObject + spacing = 1.0 + strength = 3.0 + gaussian_user_object = sink_gaussian_uo + periodic_variable = u + sink_placement = corner + sink_shape_3d = spheres + [../] +[] + +[Postprocessors] + [./integral] + type = ElementIntegralVariablePostprocessor + variable = sink_strength + execute_on = 'initial timestep_end' + [../] + [./average] + type = ElementAverageValue + variable = sink_strength + execute_on = 'initial timestep_end' + [../] +[] + +[Executioner] + type = Transient + num_steps = 1 + dt = 0.001 + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/tests/userobjects/sink_map/tests b/tests/userobjects/sink_map/tests new file mode 100644 index 000000000..7dee9c2e7 --- /dev/null +++ b/tests/userobjects/sink_map/tests @@ -0,0 +1,50 @@ +[Tests] + [./sink_map_1d_corner_placement] + type = 'Exodiff' + input = 'sink_map_user_object_1d.i' + exodiff = 'sink_map_user_object_1d_out.e' + [../] + [./sink_map_1d_inside_placement] + type = 'Exodiff' + input = 'sink_map_user_object_1d_inside.i' + exodiff = 'sink_map_user_object_1d_inside_out.e' + [../] + [./sink_map_2d_corner_placement] + type = 'Exodiff' + input = 'sink_map_user_object_2d.i' + exodiff = 'sink_map_user_object_2d_out.e' + [../] + [./sink_map_2d_inside_placement] + type = 'Exodiff' + input = 'sink_map_user_object_2d_inside.i' + exodiff = 'sink_map_user_object_2d_inside_out.e' + [../] + [./sink_map_3d_corner_placement_spheres] + type = 'Exodiff' + input = 'sink_map_user_object_3d_spheres.i' + exodiff = 'sink_map_user_object_3d_spheres_out.e' + heavy = true + max_parallel = 1 + [../] + [./sink_map_3d_inside_placement_spheres] + type = 'Exodiff' + input = 'sink_map_user_object_3d_inside_spheres.i' + exodiff = 'sink_map_user_object_3d_inside_spheres_out.e' + heavy = true + max_parallel = 1 + [../] + [./sink_map_3d_corner_placement_lines] + type = 'Exodiff' + input = 'sink_map_user_object_3d_lines.i' + exodiff = 'sink_map_user_object_3d_lines_out.e' + heavy = true + max_parallel = 1 + [../] + [./sink_map_3d_inside_placement_lines] + type = 'Exodiff' + input = 'sink_map_user_object_3d_inside_lines.i' + exodiff = 'sink_map_user_object_3d_inside_lines_out.e' + heavy = true + max_parallel = 1 + [../] +[]