mirror of
https://codeberg.org/vcbferreira/NuFI_deal.ii
synced 2026-08-12 14:33:18 +02:00
corrected periodic boundaries, more to be done on this
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
# vtk DataFile Version 3.0
|
||||
#This file was generated by the deal.II library on 2026/2/23 at 20:47:29
|
||||
#This file was generated by the deal.II library on 2026/2/24 at 3:42:25
|
||||
ASCII
|
||||
DATASET UNSTRUCTURED_GRID
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# vtk DataFile Version 3.0
|
||||
#This file was generated by the deal.II library on 2026/2/23 at 20:47:29
|
||||
#This file was generated by the deal.II library on 2026/2/24 at 3:42:25
|
||||
ASCII
|
||||
DATASET UNSTRUCTURED_GRID
|
||||
|
||||
|
||||
+19
-4
@@ -3,6 +3,7 @@
|
||||
#include <deal.II/base/function.h>
|
||||
#include <deal.II/base/quadrature_lib.h>
|
||||
#include <deal.II/base/logstream.h>
|
||||
#include <deal.II/base/tensor.h>
|
||||
#include <deal.II/base/utilities.h>
|
||||
#include <deal.II/base/tensor_function.h>
|
||||
#include <deal.II/base/index_set.h>
|
||||
@@ -21,6 +22,7 @@
|
||||
|
||||
#include <deal.II/dofs/dof_handler.h>
|
||||
#include <deal.II/dofs/dof_tools.h>
|
||||
#include <deal.II/dofs/dof_renumbering.h>
|
||||
|
||||
#include <deal.II/fe/fe_q.h>
|
||||
#include <deal.II/fe/fe_values.h>
|
||||
@@ -28,6 +30,7 @@
|
||||
#include <deal.II/numerics/data_out.h>
|
||||
#include <deal.II/numerics/vector_tools.h>
|
||||
|
||||
#include <deal.II/numerics/vector_tools_boundary.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
@@ -116,6 +119,16 @@ private:
|
||||
const unsigned int Nv;
|
||||
};
|
||||
|
||||
template <int dim>
|
||||
class BoundaryValues : public Function<dim>
|
||||
{
|
||||
public:
|
||||
virtual double value(const Point<dim> &p,
|
||||
const unsigned int component = 0) const override
|
||||
{
|
||||
return 0.; // boundary value at periodic boundary
|
||||
}
|
||||
};
|
||||
|
||||
// =-=-=-=-= Poisson Solver =-=-=-=-=
|
||||
|
||||
@@ -147,6 +160,8 @@ private:
|
||||
Vector<double> solution; // phi
|
||||
Vector<double> system_rhs;
|
||||
|
||||
MappingQ<dim> mapping;
|
||||
|
||||
unsigned int Nv;
|
||||
};
|
||||
|
||||
@@ -161,6 +176,7 @@ template <int dim>
|
||||
PoissonProblem<dim>::PoissonProblem(unsigned int degree, unsigned int Nv)
|
||||
: fe(degree)
|
||||
, dof_handler(triangulation)
|
||||
, mapping(degree)
|
||||
, Nv(Nv)
|
||||
{}
|
||||
|
||||
@@ -175,6 +191,7 @@ void PoissonProblem<dim>::create_mesh()
|
||||
X_DOMAIN_RIGHT);
|
||||
|
||||
// Make x-dim boundaries periodic
|
||||
Tensor<1, dim> offset;
|
||||
std::vector<GridTools::PeriodicFacePair<
|
||||
typename Triangulation<dim>::cell_iterator>> periodicity_vector;
|
||||
|
||||
@@ -182,7 +199,8 @@ void PoissonProblem<dim>::create_mesh()
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
periodicity_vector);
|
||||
periodicity_vector,
|
||||
offset);
|
||||
|
||||
triangulation.add_periodicity(periodicity_vector);
|
||||
|
||||
@@ -215,7 +233,6 @@ void PoissonProblem<dim>::setup_system()
|
||||
system_rhs.reinit(dof_handler.n_dofs());
|
||||
}
|
||||
|
||||
|
||||
// =-=-=-=-= E_field = -dPhi/dx =-=-=-=-=
|
||||
|
||||
template <int dim>
|
||||
@@ -320,7 +337,6 @@ void PoissonProblem<dim>::output_results() const
|
||||
// --- extract DoF coordinates ---
|
||||
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
|
||||
|
||||
MappingQ1<dim> mapping;
|
||||
DoFTools::map_dofs_to_support_points(mapping,
|
||||
dof_handler,
|
||||
support_points);
|
||||
@@ -370,7 +386,6 @@ template <int dim>
|
||||
void PoissonProblem<dim>::run()
|
||||
{
|
||||
create_mesh();
|
||||
|
||||
setup_system();
|
||||
assemble_system();
|
||||
solve();
|
||||
|
||||
+3
-3
@@ -35,12 +35,12 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "aa222ee6ba03446d87ead5ffb3d25af2",
|
||||
"model_id": "aa88a047e54c4ea7befbb1b0f6e71ec6",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
"Widget(value='<iframe src=\"http://localhost:37595/index.html?ui=P_0x7af6f37f0590_0&reconnect=auto\" class=\"pyvi…"
|
||||
"Widget(value='<iframe src=\"http://localhost:37563/index.html?ui=P_0x7901e7af86e0_0&reconnect=auto\" class=\"pyvi…"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@@ -71,7 +71,7 @@
|
||||
"</td></tr> </table>"
|
||||
],
|
||||
"text/plain": [
|
||||
"UnstructuredGrid (0x7af6f37b7e20)\n",
|
||||
"UnstructuredGrid (0x7901e7e77ee0)\n",
|
||||
" N Cells: 128\n",
|
||||
" N Points: 256\n",
|
||||
" X Bounds: 0.000e+00, 1.200e+01\n",
|
||||
|
||||
Reference in New Issue
Block a user