diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7a944724d7c29b7d6658b75212cb7de855f76b19..0000000000000000000000000000000000000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.vscode/settings.json -mfem_general/.vscode/settings.json -deal_general/.vscode/settings.json diff --git a/README.md b/README.md index 19ae4cf7fad547a000ac59db9101276e1a7b67e0..990cb1973ce4343451fda52dea8449634c337ab9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ALpDvFEB Collection of Programms using different Finite-Element Libraries to solve partial differential equations. +This is the Uniform refinement branch used to create reference data to compare to the adaptive methods. All programs feature the same functionality as in the main branch but uniformly refine the mesh for each iteration. The used libraries include - deal.ii - For more information and installation instructions visit <https://www.dealii.org> diff --git a/deal_general/CMakeLists.txt b/deal_main/CMakeLists.txt similarity index 98% rename from deal_general/CMakeLists.txt rename to deal_main/CMakeLists.txt index caa2a0755b5401405df1d23003daa7d4d6a7c68d..196a1e6cb7cd295d161c6d3c82dfed53b9cd5985 100644 --- a/deal_general/CMakeLists.txt +++ b/deal_main/CMakeLists.txt @@ -3,7 +3,7 @@ ## # Set the name of the project and target: -SET(TARGET "dealii_general") +SET(TARGET "deal_main") # Declare all source files the target consists of. Here, this is only # the one step-X.cc file, but as you expand your project you may wish diff --git a/deal_general/README.md b/deal_main/README.md similarity index 80% rename from deal_general/README.md rename to deal_main/README.md index d09dd059fc3312920658697e03e2d27289c11b8d..02f006baeee8c6b566a3f69f6e42632ec7c3f136 100644 --- a/deal_general/README.md +++ b/deal_main/README.md @@ -2,7 +2,6 @@ ## Installation of the deal.ii library The parallel build of the deal.ii library requires the `PETSc`, `METIS` and `P4est` libraries to be installed/built. Additionally `PETSc`has to be configured and build with `Hypre` (which is usually the case in when not manually installing). -Optionally one can choose to build only the serial version by ommiting the extra cmake-flags in Step 5. 1. Clone the deal.ii source from https://github.com/dealii/dealii. 2. `cd dealii` 3. `mkdir build` @@ -13,7 +12,7 @@ Optionally one can choose to build only the serial version by ommiting the extra ## Building The programm comes with a CMake-File used to create the buildsystem. -1. `cd deal_general` +1. `cd deal_main` 2. `mkdir build` 3. `cd build` 4. `cmake ..` -> Might require the path to the deal.ii build directory @@ -32,4 +31,8 @@ Usage: `./deal_general <p> <max_dof> [-hp]` ### Parallel Usage: `mpirun -np <num_procs> ./deal_general <p> <max_dof>` -Hint: Currently hp is not yet supported in the parallel version \ No newline at end of file +- _p_: Order of elements to be used. +- _max\_dof_: Maximum number of degrees of freedum until the programm should terminate +- _-hp_: If this flag is set the programm uses hp-refinement instead of the default h-refinement (Parameter _p_ is required but ommited) + +- Hint: HP REFINEMENT IS NOT POSSIBLE FOR THIS UNIFORM REFINEMENT VERSION \ No newline at end of file diff --git a/deal_general/dealii.pbs b/deal_main/dealii.pbs similarity index 64% rename from deal_general/dealii.pbs rename to deal_main/dealii.pbs index 6d597f23d68da3ea2e0035c0354547045445c2a7..56d97a9770d86bc03cd3774b45224bb3e06d7942 100644 --- a/deal_general/dealii.pbs +++ b/deal_main/dealii.pbs @@ -3,13 +3,13 @@ #PBS -l nodes=4:ppn=32 #PBS -l walltime=3:00:00 #PBS -q normal -#PBS -M patrik.rac@fau.de -m abe +#PBS -M <EMAIL> -m abe #PBS -o $PBS_JOBNAME.out -e $PBS_JOBNAME.err module load metis/5.1.0 module load atlas/3.10.3 module load openmpi/4.0.0-gnu -cd /scratch/uh07ugar/ALpDvFEB/deal_general/build -mpirun -np 128 ./dealii_general 2 10000000 +cd <path to executable> +mpirun -np 128 ./dealii_general <order> <dofs> diff --git a/deal_general/source/Timer.hpp b/deal_main/source/Timer.hpp similarity index 100% rename from deal_general/source/Timer.hpp rename to deal_main/source/Timer.hpp diff --git a/deal_general/source/dealii_general.cpp b/deal_main/source/deal_main.cpp similarity index 95% rename from deal_general/source/dealii_general.cpp rename to deal_main/source/deal_main.cpp index 6d9177c34a801a5e3020772c143b459927a417bf..9c9a153249237d4f9e27036c70a1c267e8ce1010 100644 --- a/deal_general/source/dealii_general.cpp +++ b/deal_main/source/deal_main.cpp @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) { if (argc < 3 || argc > 4) { - std::cout << "Usage: ./dealii_general order max_dofs -hp" << std::endl; + std::cout << "Usage: ./deal_main order max_dofs -hp" << std::endl; return -1; } try diff --git a/deal_general/source/evaluation.hpp b/deal_main/source/evaluation.hpp similarity index 100% rename from deal_general/source/evaluation.hpp rename to deal_main/source/evaluation.hpp diff --git a/deal_general/source/poisson_h.hpp b/deal_main/source/poisson_h.hpp similarity index 100% rename from deal_general/source/poisson_h.hpp rename to deal_main/source/poisson_h.hpp diff --git a/deal_general/source/poisson_hp.hpp b/deal_main/source/poisson_hp.hpp similarity index 100% rename from deal_general/source/poisson_hp.hpp rename to deal_main/source/poisson_hp.hpp diff --git a/deal_general/source/problem.hpp b/deal_main/source/problem.hpp similarity index 100% rename from deal_general/source/problem.hpp rename to deal_main/source/problem.hpp diff --git a/mfem_general/CMakeLists.txt b/mfem_main/CMakeLists.txt similarity index 97% rename from mfem_general/CMakeLists.txt rename to mfem_main/CMakeLists.txt index 2dbbcb99651f1372dc4e20ce046614988acb4a3c..b416cf03aec8a73235135c97026670acc989f604 100644 --- a/mfem_general/CMakeLists.txt +++ b/mfem_main/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) set(CMAKE_CXX_STANDARD 11) -SET(TARGET "mfem_general") +SET(TARGET "mfem_main") project(${TARGET}) diff --git a/mfem_general/README.md b/mfem_main/README.md similarity index 81% rename from mfem_general/README.md rename to mfem_main/README.md index 66392b40ec2ea0c7945bc27af8c2a91838915994..bd1a9f04ea0f888c474543cb964d34b540600479 100644 --- a/mfem_general/README.md +++ b/mfem_main/README.md @@ -12,7 +12,7 @@ Optionally one can choose to just build the serial version by ommiting the extra ## Building The programm comes with a CMake-File used to create the buildsystem. -1. `cd mfem_general` +1. `cd mfem_main` 2. `mkdir build` 3. `cd build` 4. `cmake ..` @@ -24,9 +24,11 @@ CMake also takes the optional arguments: ## Execution ### Serial -Usage: `./mfem_general <p> <max_dof>` +Usage: `./mfem_main <p> <max_dof>` - _p_: Order of elements to be used. - _max\_dof_: Maximum number of degrees of freedum until the programm should terminate ### Parallel -Usage: `mpirun -np <num_procs> ./mfem_general <p> <max_dof>` \ No newline at end of file +Usage: `mpirun -np <num_procs> ./mfem_main <p> <max_dof>` +- _p_: Order of elements to be used. +- _max\_dof_: Maximum number of degrees of freedum until the programm should terminate \ No newline at end of file diff --git a/mfem_general/data/unit_cube.mesh b/mfem_main/data/unit_cube.mesh similarity index 100% rename from mfem_general/data/unit_cube.mesh rename to mfem_main/data/unit_cube.mesh diff --git a/mfem_general/mfem.pbs b/mfem_main/mfem.pbs similarity index 61% rename from mfem_general/mfem.pbs rename to mfem_main/mfem.pbs index 49cf6b315e320db7b3ca4a2e76c1772445d6cf72..cbf465d4c1921eebc4455d66404c8cc77139d1ed 100644 --- a/mfem_general/mfem.pbs +++ b/mfem_main/mfem.pbs @@ -3,13 +3,13 @@ #PBS -l nodes=4:ppn=32 #PBS -l walltime=3:00:00 #PBS -q normal -#PBS -M patrik.rac@fau.de -m abe +#PBS -M <EMAIL> -m abe #PBS -o $PBS_JOBNAME.out -e $PBS_JOBNAME.err module load metis/5.1.0 module load atlas/3.10.3 module load openmpi/4.0.0-gnu -cd /scratch/uh07ugar/ALpDvFEB/mfem_general/build -mpirun -np 128 --bind-to-socket ./mfem_general 2 10000000 +cd <path to executable> +mpirun -np 128 --bind-to-socket ./mfem_general <order> <dofs> diff --git a/mfem_general/source/Timer.hpp b/mfem_main/source/Timer.hpp similarity index 100% rename from mfem_general/source/Timer.hpp rename to mfem_main/source/Timer.hpp diff --git a/mfem_general/source/evaluation.cpp b/mfem_main/source/evaluation.cpp similarity index 100% rename from mfem_general/source/evaluation.cpp rename to mfem_main/source/evaluation.cpp diff --git a/mfem_general/source/evaluation.hpp b/mfem_main/source/evaluation.hpp similarity index 100% rename from mfem_general/source/evaluation.hpp rename to mfem_main/source/evaluation.hpp diff --git a/mfem_general/source/mfem_general.cpp b/mfem_main/source/mfem_main.cpp similarity index 89% rename from mfem_general/source/mfem_general.cpp rename to mfem_main/source/mfem_main.cpp index 4425b0f044fa3b6ebb3254eb52f371ab050ffdc7..271431bbffb28f0b1070011f10e3526022736a05 100644 --- a/mfem_general/source/mfem_general.cpp +++ b/mfem_main/source/mfem_main.cpp @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) if (argc != 3) { - std::cout << "Usage: ./mfem_general order max_dofs" << std::endl; + std::cout << "Usage: ./mfem_main order max_dofs" << std::endl; return -1; } diff --git a/mfem_general/source/poisson.cpp b/mfem_main/source/poisson.cpp similarity index 100% rename from mfem_general/source/poisson.cpp rename to mfem_main/source/poisson.cpp diff --git a/mfem_general/source/poisson.hpp b/mfem_main/source/poisson.hpp similarity index 100% rename from mfem_general/source/poisson.hpp rename to mfem_main/source/poisson.hpp diff --git a/mfem_general/source/problem.cpp b/mfem_main/source/problem.cpp similarity index 100% rename from mfem_general/source/problem.cpp rename to mfem_main/source/problem.cpp diff --git a/mfem_general/source/problem.hpp b/mfem_main/source/problem.hpp similarity index 100% rename from mfem_general/source/problem.hpp rename to mfem_main/source/problem.hpp diff --git a/ngsolve_general/adaptive.py b/ngsolve_general/adaptive.py deleted file mode 100644 index 8396e950a451de7514e078d582a96e1f50b4f46a..0000000000000000000000000000000000000000 --- a/ngsolve_general/adaptive.py +++ /dev/null @@ -1,124 +0,0 @@ -from ngsolve import * -from netgen.geom2d import SplineGeometry - - -# point numbers 0, 1, ... 11 -# sub-domain numbers (1), (2), (3) -# -# -# 7-------------6 -# | | -# | (2) | -# | | -# 3------4-------------5------2 -# | | -# | 11 | -# | / \ | -# | 10 (3) 9 | -# | \ / (1) | -# | 8 | -# | | -# 0---------------------------1 -# - -def MakeGeometry(): - geometry = SplineGeometry() - - # point coordinates ... - pnts = [ (0,0), (1,0), (1,0.6), (0,0.6), \ - (0.2,0.6), (0.8,0.6), (0.8,0.8), (0.2,0.8), \ - (0.5,0.15), (0.65,0.3), (0.5,0.45), (0.35,0.3) ] - pnums = [geometry.AppendPoint(*p) for p in pnts] - - # start-point, end-point, boundary-condition, domain on left side, domain on right side: - lines = [ (0,1,1,1,0), (1,2,2,1,0), (2,5,2,1,0), (5,4,2,1,2), (4,3,2,1,0), (3,0,2,1,0), \ - (5,6,2,2,0), (6,7,2,2,0), (7,4,2,2,0), \ - (8,9,2,3,1), (9,10,2,3,1), (10,11,2,3,1), (11,8,2,3,1) ] - - for p1,p2,bc,left,right in lines: - geometry.Append( ["line", pnums[p1], pnums[p2]], bc=bc, leftdomain=left, rightdomain=right) - return geometry - - - -mesh = Mesh(MakeGeometry().GenerateMesh (maxh=0.2)) - - -fes = H1(mesh, order=3, dirichlet=[1], autoupdate=True) -u = fes.TrialFunction() -v = fes.TestFunction() - -# one heat conductivity coefficient per sub-domain -lam = CoefficientFunction([1, 1000, 10]) -a = BilinearForm(fes, symmetric=False) -a += lam*grad(u)*grad(v)*dx - - -# heat-source in sub-domain 3 -f = LinearForm(fes) -f += CoefficientFunction([0, 0, 1])*v*dx - -#c = MultiGridPreconditioner(a, inverse = "sparsecholesky") -c = Preconditioner(a, type="hypre") - -gfu = GridFunction(fes, autoupdate=True) -Draw (gfu) - -# finite element space and gridfunction to represent -# the heatflux: -space_flux = HDiv(mesh, order=2, autoupdate=True) -gf_flux = GridFunction(space_flux, "flux", autoupdate=True) - -def SolveBVP(): - a.Assemble() - f.Assemble() - inv = CGSolver(a.mat, c.mat) - gfu.vec.data = inv * f.vec - Redraw (blocking=True) - - - -l = [] - -def CalcError(): - flux = lam * grad(gfu) - # interpolate finite element flux into H(div) space: - gf_flux.Set (flux) - - # Gradient-recovery error estimator - err = 1/lam*(flux-gf_flux)*(flux-gf_flux) - elerr = Integrate (err, mesh, VOL, element_wise=True) - - maxerr = max(elerr) - l.append ( (fes.ndof, sqrt(sum(elerr)) )) - print ("maxerr = ", maxerr) - - for el in mesh.Elements(): - mesh.SetRefinementFlag(el, elerr[el.nr] > 0.25*maxerr) - - -with TaskManager(): - while fes.ndof < 100000: - SolveBVP() - CalcError() - mesh.Refine() - -SolveBVP() - - - - -## import matplotlib.pyplot as plt - -## plt.yscale('log') -## plt.xscale('log') -## plt.xlabel("ndof") -## plt.ylabel("H1 error-estimate") -## ndof,err = zip(*l) -## plt.plot(ndof,err, "-*") - -## plt.ion() -## plt.show() - -## input("<press enter to quit>") - diff --git a/ngsolve_general/README.md b/ngsolve_main/README.md similarity index 68% rename from ngsolve_general/README.md rename to ngsolve_main/README.md index 4566460b6687f35057e294c4255423a890a903d8..fef1874be50b8c0c107ea3fd017c62c881619054 100644 --- a/ngsolve_general/README.md +++ b/ngsolve_main/README.md @@ -6,10 +6,8 @@ The graphical user interface is not used and hence a source build is sufficient. ## Execution ### Serial -Usage: `python3.8 ngsolve-general.py <p> <max_dof>` -or `netgen ngsolve-general.py <p> <max_dof>` +Usage: `python3.8 ngsolve_main.py <p> <max_dof>` +or `netgen ngsolve_main.py <p> <max_dof>` +or `ngspy ngsolve_main.py <p> <max_dof>` - _p_: Order of elements to be used. -- _max\_dof_: Maximum number of degrees of freedum until the programm should terminate - -### Parallel -tba \ No newline at end of file +- _max\_dof_: Maximum number of degrees of freedum until the programm should terminate \ No newline at end of file diff --git a/ngsolve_general/Timer.py b/ngsolve_main/Timer.py similarity index 100% rename from ngsolve_general/Timer.py rename to ngsolve_main/Timer.py diff --git a/ngsolve_general/ngsolve-general.py b/ngsolve_main/ngsolve-general.py similarity index 99% rename from ngsolve_general/ngsolve-general.py rename to ngsolve_main/ngsolve-general.py index fd6bf03e30f7a553f899b4394e67152366ce296c..600169b4d4a82e11987d190c5da897855d36881c 100644 --- a/ngsolve_general/ngsolve-general.py +++ b/ngsolve_main/ngsolve-general.py @@ -5,7 +5,7 @@ Program using Netgen/NGSolve for the solution of elliptic PDEs using adaptive me The problem is solved using an adaptivity strategy with an gradient recovery error estimator. The adaptivity and Problem geometry can be easily changed without affecting the performance of the programm. -The program runns with the command "netgen ngsolve-general.py" or "python3.8 ngsolve-general.py" +The program runns with the command "ngspy/netgen ngsolve_main.py" or "python3.8 ngsolve_main.py" """ import sys