From 09c2955751605e0d7b6dbbf0e522f74a2dfd8a8b Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Thu, 11 Aug 2016 12:49:35 -0500 Subject: [PATCH] Added 1D current_carrying_wire test. --- include/kernels/AxisymmetricCurlZ.h | 25 ++++++ include/kernels/UserSource.h | 27 +++++++ problems/current_carrying_wire.i | 76 ++++++++++++++++++ src/base/ZapdosApp.C | 4 + src/kernels/AxisymmetricCurlZ.C | 29 +++++++ src/kernels/UserSource.C | 31 +++++++ .../current_carrying_wire.i | 76 ++++++++++++++++++ .../gold/current_carrying_wire_out.e | Bin 0 -> 28612 bytes tests/current_carrying_wire/tests | 7 ++ 9 files changed, 275 insertions(+) create mode 100644 include/kernels/AxisymmetricCurlZ.h create mode 100644 include/kernels/UserSource.h create mode 100644 problems/current_carrying_wire.i create mode 100644 src/kernels/AxisymmetricCurlZ.C create mode 100644 src/kernels/UserSource.C create mode 100644 tests/current_carrying_wire/current_carrying_wire.i create mode 100644 tests/current_carrying_wire/gold/current_carrying_wire_out.e create mode 100644 tests/current_carrying_wire/tests diff --git a/include/kernels/AxisymmetricCurlZ.h b/include/kernels/AxisymmetricCurlZ.h new file mode 100644 index 00000000000..3c9dc602adf --- /dev/null +++ b/include/kernels/AxisymmetricCurlZ.h @@ -0,0 +1,25 @@ +#ifndef AXISYMMETRICCURLZ_H +#define AXISYMMETRICCURLZ_H + +#include "Kernel.h" + +class AxisymmetricCurlZ; + +template<> +InputParameters validParams(); + +class AxisymmetricCurlZ : public Kernel +{ +public: + AxisymmetricCurlZ(const InputParameters & parameters); + virtual ~AxisymmetricCurlZ(); + +protected: + + virtual Real computeQpResidual(); + virtual Real computeQpJacobian(); + +}; + + +#endif /* AXISYMMETRICCURLZ_H */ diff --git a/include/kernels/UserSource.h b/include/kernels/UserSource.h new file mode 100644 index 00000000000..d14eebbe90f --- /dev/null +++ b/include/kernels/UserSource.h @@ -0,0 +1,27 @@ +#ifndef USERSOURCE_H +#define USERSOURCE_H + +#include "Kernel.h" + +class UserSource; + +template<> +InputParameters validParams(); + +class UserSource : public Kernel +{ +public: + UserSource(const InputParameters & parameters); + virtual ~UserSource(); + +protected: + + virtual Real computeQpResidual(); + virtual Real computeQpJacobian(); + + Real _source; + +}; + + +#endif /* USERSOURCE_H */ diff --git a/problems/current_carrying_wire.i b/problems/current_carrying_wire.i new file mode 100644 index 00000000000..67b1dcb8333 --- /dev/null +++ b/problems/current_carrying_wire.i @@ -0,0 +1,76 @@ +[Mesh] + type = GeneratedMesh + dim = 1 + nx = 20 + xmax = 2 + xmin = 0 +[] + +[MeshModifiers] + [./vacuum] + type = SubdomainBoundingBox + bottom_left = '1 0 0' + top_right = '2 0 0' + block_id = 1 + [../] + # [./interface] + # type = SideSetsBetweenSubdomains + # master_block = '1' + # paired_block = '0' + # new_boundary = 'interface' + # depends_on = 'vacuum' + # [../] +[] + + +[Problem] +[] + +[Preconditioning] + [./smp] + type = SMP + full = true + [../] +[] + +[Executioner] + type = Steady + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -ksp_type -snes_linesearch_minlambda' + petsc_options_value = 'lu NONZERO 1.e-10 preonly 1e-3' +[] + +[Outputs] + print_perf_log = true + print_linear_residuals = false + [./out] + type = Exodus + [../] +[] + +[Kernels] + [./curl_z] + type = AxisymmetricCurlZ + variable = Bphi + [../] + [./source] + type = UserSource + variable = Bphi + source_magnitude = 1 + block = 0 + [../] +[] + +[Variables] + [./Bphi] + [../] +[] + +[BCs] + [./center_of_wire] + type = DirichletBC + boundary = left + variable = Bphi + value = 0 + [../] +[] \ No newline at end of file diff --git a/src/base/ZapdosApp.C b/src/base/ZapdosApp.C index 7ae1e7d9f2e..f79ae064b35 100644 --- a/src/base/ZapdosApp.C +++ b/src/base/ZapdosApp.C @@ -5,6 +5,8 @@ // #include "ModulesApp.h" // Kernels +#include "UserSource.h" +#include "AxisymmetricCurlZ.h" #include "TM0CylindricalEz.h" #include "TM0CylindricalEr.h" #include "TM0Cylindrical.h" @@ -144,6 +146,8 @@ void ZapdosApp::registerObjects(Factory & factory) { registerMeshModifier(NodeAndSidesetBetweenSubdomains); + registerKernel(AxisymmetricCurlZ); + registerKernel(UserSource); registerKernel(TM0CylindricalEz); registerKernel(TM0CylindricalEr); registerKernel(TM0Cylindrical); diff --git a/src/kernels/AxisymmetricCurlZ.C b/src/kernels/AxisymmetricCurlZ.C new file mode 100644 index 00000000000..991d2f882c6 --- /dev/null +++ b/src/kernels/AxisymmetricCurlZ.C @@ -0,0 +1,29 @@ +#include "AxisymmetricCurlZ.h" + +template<> +InputParameters validParams() +{ + InputParameters params = validParams(); + return params; +} + +AxisymmetricCurlZ::AxisymmetricCurlZ(const InputParameters & parameters) : + Kernel(parameters) +{ +} + +AxisymmetricCurlZ::~AxisymmetricCurlZ() +{ +} + +Real +AxisymmetricCurlZ::computeQpResidual() +{ + return _test[_i][_qp] * (_u[_qp] / _q_point[_qp](0) + _grad_u[_qp](0)); +} + +Real +AxisymmetricCurlZ::computeQpJacobian() +{ + return _test[_i][_qp] * (_phi[_j][_qp] / _q_point[_qp](0) + _grad_phi[_j][_qp](0)); +} diff --git a/src/kernels/UserSource.C b/src/kernels/UserSource.C new file mode 100644 index 00000000000..84b5ea80f23 --- /dev/null +++ b/src/kernels/UserSource.C @@ -0,0 +1,31 @@ +#include "UserSource.h" + +template<> +InputParameters validParams() +{ + InputParameters params = validParams(); + params.addRequiredParam("source_magnitude", "The numerical value of the source magnitude."); + return params; +} + +UserSource::UserSource(const InputParameters & parameters) : + Kernel(parameters), + _source(getParam("source_magnitude")) +{ +} + +UserSource::~UserSource() +{ +} + +Real +UserSource::computeQpResidual() +{ + return -_test[_i][_qp] * _source; +} + +Real +UserSource::computeQpJacobian() +{ + return 0.; +} diff --git a/tests/current_carrying_wire/current_carrying_wire.i b/tests/current_carrying_wire/current_carrying_wire.i new file mode 100644 index 00000000000..67b1dcb8333 --- /dev/null +++ b/tests/current_carrying_wire/current_carrying_wire.i @@ -0,0 +1,76 @@ +[Mesh] + type = GeneratedMesh + dim = 1 + nx = 20 + xmax = 2 + xmin = 0 +[] + +[MeshModifiers] + [./vacuum] + type = SubdomainBoundingBox + bottom_left = '1 0 0' + top_right = '2 0 0' + block_id = 1 + [../] + # [./interface] + # type = SideSetsBetweenSubdomains + # master_block = '1' + # paired_block = '0' + # new_boundary = 'interface' + # depends_on = 'vacuum' + # [../] +[] + + +[Problem] +[] + +[Preconditioning] + [./smp] + type = SMP + full = true + [../] +[] + +[Executioner] + type = Steady + solve_type = NEWTON + petsc_options_iname = '-pc_type -pc_factor_shift_type -pc_factor_shift_amount -ksp_type -snes_linesearch_minlambda' + petsc_options_value = 'lu NONZERO 1.e-10 preonly 1e-3' +[] + +[Outputs] + print_perf_log = true + print_linear_residuals = false + [./out] + type = Exodus + [../] +[] + +[Kernels] + [./curl_z] + type = AxisymmetricCurlZ + variable = Bphi + [../] + [./source] + type = UserSource + variable = Bphi + source_magnitude = 1 + block = 0 + [../] +[] + +[Variables] + [./Bphi] + [../] +[] + +[BCs] + [./center_of_wire] + type = DirichletBC + boundary = left + variable = Bphi + value = 0 + [../] +[] \ No newline at end of file diff --git a/tests/current_carrying_wire/gold/current_carrying_wire_out.e b/tests/current_carrying_wire/gold/current_carrying_wire_out.e new file mode 100644 index 0000000000000000000000000000000000000000..d431196bd146bbb56bd91c157b16e9edd74c9659 GIT binary patch literal 28612 zcmeHQZHy#E86E_V-Mc+dkx0}ZMKE$C?6P}z9LFW&+}_^YvElZE+dUKx)AsiC%r@84 zJ@m)k?goFDDEiAkhA8SkG@LOpXe1Feenb>7sK7-8qtV2#7zx2(3`BxHZ*|vnPfvHx zRBx+yIV+j%?&|8N-jAxc>aDMxIeg?Tl}d$v+wr@KuBL7&uICt53s05GHTaECoM~7( z?r+EMlBVrDbj5GfGuk>n&^vet15a`l%5l0CrZimRv;>nV69Iq$cn(E*)o{r1Ku$nd=_abf# zzsvC3p>_;qO?Otz}7S2s;t^`Kd$V;h#IoVJ|?=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Nh(i})Ir|J@Afx9ndwlqlm@7m~Fw&l8 z891PtW)+7rG@=CejT(fdaOeTu>-!mdX?aNP$ z-uLK3XKIgqWY1U5TzPx#hcj(w+sV6YPkrKhFTe9!yKB#ke&I9i#Xr{0?t0_7g`MxO zJ%8`}KK$TIXKF8g>h4c!-+r?8>lf~Ob^M8!YrlQ<4{tnYe7g3V9pC-Q>p!@^_Ny-* zePs7VPt{&{;Ll%s;7jkSJ^w=Gl2fPeul-`-M;CwnuOF?QeRJlK>mUAj?YW;hk3Ot_ ewf5|f&1+74{+G39&c5{QjrE6WKmQkn*ZvLjjx2Zp literal 0 HcmV?d00001 diff --git a/tests/current_carrying_wire/tests b/tests/current_carrying_wire/tests new file mode 100644 index 00000000000..49c4de0841c --- /dev/null +++ b/tests/current_carrying_wire/tests @@ -0,0 +1,7 @@ +[Tests] + [./current_carrying_wire] + type = 'Exodiff' + input = 'current_carrying_wire.i' + exodiff = 'current_carrying_wire_out.e' + [../] +[] \ No newline at end of file