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
|
# 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
|
ASCII
|
||||||
DATASET UNSTRUCTURED_GRID
|
DATASET UNSTRUCTURED_GRID
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# vtk DataFile Version 3.0
|
# 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
|
ASCII
|
||||||
DATASET UNSTRUCTURED_GRID
|
DATASET UNSTRUCTURED_GRID
|
||||||
|
|
||||||
|
|||||||
+20
-5
@@ -3,6 +3,7 @@
|
|||||||
#include <deal.II/base/function.h>
|
#include <deal.II/base/function.h>
|
||||||
#include <deal.II/base/quadrature_lib.h>
|
#include <deal.II/base/quadrature_lib.h>
|
||||||
#include <deal.II/base/logstream.h>
|
#include <deal.II/base/logstream.h>
|
||||||
|
#include <deal.II/base/tensor.h>
|
||||||
#include <deal.II/base/utilities.h>
|
#include <deal.II/base/utilities.h>
|
||||||
#include <deal.II/base/tensor_function.h>
|
#include <deal.II/base/tensor_function.h>
|
||||||
#include <deal.II/base/index_set.h>
|
#include <deal.II/base/index_set.h>
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
|
|
||||||
#include <deal.II/dofs/dof_handler.h>
|
#include <deal.II/dofs/dof_handler.h>
|
||||||
#include <deal.II/dofs/dof_tools.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_q.h>
|
||||||
#include <deal.II/fe/fe_values.h>
|
#include <deal.II/fe/fe_values.h>
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
#include <deal.II/numerics/data_out.h>
|
#include <deal.II/numerics/data_out.h>
|
||||||
#include <deal.II/numerics/vector_tools.h>
|
#include <deal.II/numerics/vector_tools.h>
|
||||||
|
|
||||||
|
#include <deal.II/numerics/vector_tools_boundary.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -116,6 +119,16 @@ private:
|
|||||||
const unsigned int Nv;
|
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 =-=-=-=-=
|
// =-=-=-=-= Poisson Solver =-=-=-=-=
|
||||||
|
|
||||||
@@ -147,6 +160,8 @@ private:
|
|||||||
Vector<double> solution; // phi
|
Vector<double> solution; // phi
|
||||||
Vector<double> system_rhs;
|
Vector<double> system_rhs;
|
||||||
|
|
||||||
|
MappingQ<dim> mapping;
|
||||||
|
|
||||||
unsigned int Nv;
|
unsigned int Nv;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -161,6 +176,7 @@ template <int dim>
|
|||||||
PoissonProblem<dim>::PoissonProblem(unsigned int degree, unsigned int Nv)
|
PoissonProblem<dim>::PoissonProblem(unsigned int degree, unsigned int Nv)
|
||||||
: fe(degree)
|
: fe(degree)
|
||||||
, dof_handler(triangulation)
|
, dof_handler(triangulation)
|
||||||
|
, mapping(degree)
|
||||||
, Nv(Nv)
|
, Nv(Nv)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -175,14 +191,16 @@ void PoissonProblem<dim>::create_mesh()
|
|||||||
X_DOMAIN_RIGHT);
|
X_DOMAIN_RIGHT);
|
||||||
|
|
||||||
// Make x-dim boundaries periodic
|
// Make x-dim boundaries periodic
|
||||||
|
Tensor<1, dim> offset;
|
||||||
std::vector<GridTools::PeriodicFacePair<
|
std::vector<GridTools::PeriodicFacePair<
|
||||||
typename Triangulation<dim>::cell_iterator>> periodicity_vector;
|
typename Triangulation<dim>::cell_iterator>> periodicity_vector;
|
||||||
|
|
||||||
GridTools::collect_periodic_faces(triangulation,
|
GridTools::collect_periodic_faces(triangulation,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
periodicity_vector);
|
periodicity_vector,
|
||||||
|
offset);
|
||||||
|
|
||||||
triangulation.add_periodicity(periodicity_vector);
|
triangulation.add_periodicity(periodicity_vector);
|
||||||
|
|
||||||
@@ -215,7 +233,6 @@ void PoissonProblem<dim>::setup_system()
|
|||||||
system_rhs.reinit(dof_handler.n_dofs());
|
system_rhs.reinit(dof_handler.n_dofs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =-=-=-=-= E_field = -dPhi/dx =-=-=-=-=
|
// =-=-=-=-= E_field = -dPhi/dx =-=-=-=-=
|
||||||
|
|
||||||
template <int dim>
|
template <int dim>
|
||||||
@@ -320,7 +337,6 @@ void PoissonProblem<dim>::output_results() const
|
|||||||
// --- extract DoF coordinates ---
|
// --- extract DoF coordinates ---
|
||||||
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
|
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
|
||||||
|
|
||||||
MappingQ1<dim> mapping;
|
|
||||||
DoFTools::map_dofs_to_support_points(mapping,
|
DoFTools::map_dofs_to_support_points(mapping,
|
||||||
dof_handler,
|
dof_handler,
|
||||||
support_points);
|
support_points);
|
||||||
@@ -370,7 +386,6 @@ template <int dim>
|
|||||||
void PoissonProblem<dim>::run()
|
void PoissonProblem<dim>::run()
|
||||||
{
|
{
|
||||||
create_mesh();
|
create_mesh();
|
||||||
|
|
||||||
setup_system();
|
setup_system();
|
||||||
assemble_system();
|
assemble_system();
|
||||||
solve();
|
solve();
|
||||||
|
|||||||
+3
-3
@@ -35,12 +35,12 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "aa222ee6ba03446d87ead5ffb3d25af2",
|
"model_id": "aa88a047e54c4ea7befbb1b0f6e71ec6",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
"text/plain": [
|
"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": {},
|
"metadata": {},
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
"</td></tr> </table>"
|
"</td></tr> </table>"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"UnstructuredGrid (0x7af6f37b7e20)\n",
|
"UnstructuredGrid (0x7901e7e77ee0)\n",
|
||||||
" N Cells: 128\n",
|
" N Cells: 128\n",
|
||||||
" N Points: 256\n",
|
" N Points: 256\n",
|
||||||
" X Bounds: 0.000e+00, 1.200e+01\n",
|
" X Bounds: 0.000e+00, 1.200e+01\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user