Skip to content

Projektarbeit: Discontinuous Galerkin (first order) with hyper.deal #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
bfe2d66
test
Sep 10, 2019
40e5a14
new Class DataConverter
Sep 15, 2019
e643ebf
commented unused/untested parts of CombiCom
Sep 17, 2019
21d598b
commented unused/untested parts of DistributedFullGrid and Distribute…
Sep 17, 2019
9c8e38f
stole DistributedHierarchization and DistributedSparseGridUniform fro…
Sep 19, 2019
38ad34c
first version of DistributedFullGridEnsemble
Sep 19, 2019
4f7dd4d
DataConverter fertig
Sep 23, 2019
84de8e7
added enumeration for grids in DFGEnsemble
Sep 26, 2019
d9a3e18
formatted and commented in DistributedHierarchization
Sep 26, 2019
21da286
use DFGEnsemble in TaskEnsemble, set parameters accordingly
Sep 26, 2019
72e8418
merge branch feature...
Sep 27, 2019
f9c90e9
DatConverter added
Nov 12, 2019
27e16cb
it works
Nov 19, 2019
e23d71d
new json generator
Nov 19, 2019
97800ae
hyperdeal problem included
Nov 19, 2019
ef2b362
warnings removed
Nov 19, 2019
ba8c5ad
hyperdeal problem integrated
Nov 19, 2019
794901c
Paraview visualization
Nov 19, 2019
09ecd0e
Point mapping done
Nov 19, 2019
76f3ca4
Seriel is working now
Nov 19, 2019
529e6e1
solution set to zero for testing
Nov 20, 2019
7782364
write pvd
Nov 20, 2019
2534435
parallelized version
Nov 20, 2019
78db289
Discontinuous working
Nov 22, 2019
d1679f2
time measuring
Jan 15, 2020
7b099d8
new Taskinitializing loop in O(n)
Jan 15, 2020
26a1b86
cg working , dg not
Jan 28, 2020
de79783
l2 error calculation: divide by vector length
Feb 13, 2020
9bc2437
actual configuration
Feb 13, 2020
7985e07
Merge branch 'projektarbeit' of https://github.com/SGpp/DisCoTec into…
Feb 13, 2020
d18e0af
testing setup
Mar 24, 2020
7c95e61
Aktueller stand
Dec 15, 2020
fc95c85
Merge branch 'master' of https://github.com/SGpp/DisCoTec into projek…
Dec 16, 2020
2e43252
fix error in test_ftolerance with TIMING
freifrauvonbleifrei Dec 18, 2020
260a737
Parallelization working
Feb 18, 2021
a8b644e
unnecessary files
Feb 18, 2021
cec4e51
Installing advicer
Feb 18, 2021
b9d12cb
DG Improvement
Mar 21, 2021
e733dd7
task: add getDFGEnsemble()
freifrauvonbleifrei Mar 24, 2021
0717251
hierarchization: add discontinuous hierarchization
freifrauvonbleifrei Mar 24, 2021
b6fdc5b
hierarchization: add (commented) stubs for
freifrauvonbleifrei Mar 24, 2021
cbfcd37
Merge remote-tracking branch 'origin/master' into projektarbeit
freifrauvonbleifrei Mar 24, 2021
1d65dcc
test for distributed DG hierarchization
freifrauvonbleifrei Mar 25, 2021
a0645be
ensemble: getNumberOfHigherDimensions
freifrauvonbleifrei Mar 25, 2021
af3290d
hierarchization: implement dist. dehierarchization
freifrauvonbleifrei Mar 25, 2021
d2cf72a
worker: use ensemble (de)hierarchization; untested
freifrauvonbleifrei Mar 25, 2021
baeed95
dealii TaskEnsemble: add getDFGEnsemble
freifrauvonbleifrei Mar 25, 2021
cc41999
Index mapping for DG
Mar 26, 2021
3f4c48f
corrected Index mapping for DG
May 4, 2021
da38e9a
DG: invert last index between DisCoTec + deal.ii
freifrauvonbleifrei May 5, 2021
7060fd3
Testing files
May 5, 2021
5fd933d
accept incoming change
May 5, 2021
a3bdd78
TaskEnsemble commented for better clearance
May 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
872 changes: 872 additions & 0 deletions Makefile

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion adjust_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

dir_path = os.path.dirname(os.path.realpath(__file__))
GLPK_DIR= str(dir_path) + "/glpk"
examples = ["combi_example", "combi_example_faults", "gene_distributed", "gene_distributed_linear"]
examples = ["combi_example", "combi_example_faults", "gene_distributed", "gene_distributed_linear","dealii_example"]
for example in examples:
pfilein = open(str(dir_path)+ "/distributedcombigrid/examples/" + example + "/Makefile.template" ,'r')
temp = pfilein.read()
Expand Down
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/glpk/lib
scons -j 8 ISGENE=0 VERBOSE=1 COMPILE_BOOST_TESTS=1 RUN_BOOST_TESTS=1 RUN_CPPLINT=0 BUILD_STATICLIB=0 CC=mpicc.mpich FC=mpifort.mpich CXX=mpicxx.mpich OPT=1 TIMING=0 UNIFORMDECOMPOSITION=1 ENABLEFT=0 #DEBUG_OUTPUT=1
scons -j 20 ISGENE=0 VERBOSE=1 COMPILE_BOOST_TESTS=1 RUN_BOOST_TESTS=1 RUN_CPPLINT=0 BUILD_STATICLIB=0 CC=mpicc FC=mpifort CXX=mpicxx OPT=1 TIMING=0 UNIFORMDECOMPOSITION=1 ENABLEFT=0 DOC=0 #DEBUG_OUTPUT=1
252 changes: 252 additions & 0 deletions distributedcombigrid/examples/combi_example/DataConverter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
#include <string>
#include <vector>
#include <math.h>
#include <sstream>
#include "sgpp/distributedcombigrid/combischeme/CombiMinMaxScheme.hpp"

#include "sgpp/distributedcombigrid/loadmodel/LinearLoadModel.hpp"
#include "sgpp/distributedcombigrid/manager/CombiParameters.hpp"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>

#include "sgpp/distributedcombigrid/utils/Types.hpp"
#include "DataConverter.hpp"

using namespace combigrid;


Converter::Converter(){};
void Converter::toParam(std::string _filename, std::string newname){
namespace pt = boost::property_tree;

// Create a root
pt::ptree root,ini_root,ini_ct, ini_application, ini_manager;

// Load the json file in this ptree
try{
pt::read_json(_filename, root);
int dimx=root.get<int>("General.DimX");
int dimv=root.get<int>("General.DimV");
int dim=dimx+dimv;
//lmax:
int refineX=root.get<int>("Case.NRefinementsX");
int refineV=root.get<int>("Case.NRefinementsV");
int subX=root.get<int>("Case.NSubdivisionsX.X");
int subV=root.get<int>("Case.NSubdivisionsV.X");
LevelVector lma;

//zur Basis 2 hoch beziehen!
for(int i=0; i<dimx;i++){
lma.push_back(pow(subX*(refineX+1),1.0/3.0));
}
for(int i=0; i<dimx;i++){
lma.push_back(pow(1.0/3.0,subV*(refineV+1)));
}

//lmin=lmax


//ncombi=10

//p for partitions
int partX=root.get<int>("General.PartitionX");
int partY=root.get<int>("General.PartitionV");
LevelVector p_{partX,partY};

//boundary

LevelVector bound;
for(int i=0;i<dimx;i++){
bound.push_back(true);
}
for(int i=0;i<dimv;i++){
bound.push_back(true);
}
std::string levelString;
std::ostringstream vec,p;
vec << lma;
levelString=vec.str();
p<<p_[0]<<" "<<p_[1]<<std::endl;
//leval=lmax;
ini_ct.put("dim",dim);
ini_ct.put("lmin",levelString);
ini_ct.put("lmax",levelString);
ini_ct.put("leval",levelString);
ini_ct.put("p",p.str());
ini_ct.put("ncombi",10);

ini_root.add_child("ct",ini_ct);
ini_application.put("dt",0.001);
ini_application.put("steps",100);
ini_root.add_child("application",ini_application);
ini_manager.put("ngroup",2);
ini_manager.put("nprocs",1);
ini_root.add_child("manager",ini_manager);
pt::write_ini(newname,ini_root);

}
catch(pt::json_parser::json_parser_error error){
std::cout<< "Not a valid json File";
}
catch(...){
std::cout << "Something went wrong";
}
}

//converts the data from the ini file to a json format and stores the data in newname.json
void Converter::toJSON(std::string _fileName, std::string newname){
namespace pt = boost::property_tree;

// Create a root
pt::ptree root;
pt::ptree json_root, json_general, json_case, json_SpatialDiscretization, json_TemporalDiscretization, json_postprocessing;
pt::ptree jsubX, jsubV,jsout, jVTK;

// Load the ini file in this ptree
try{
pt::read_ini(_fileName, root);
std::cout << "Name "<<_fileName;
int dim=root.get<int>("ct.dim",2);
int dimx=root.get<int>("ct.dimx",dim/2);
int dimv=root.get<int>("ct.dimv",dim/2);

//degree is 1 per default
int degx=root.get<int>("ct.degreex",1);
int degv=root.get<int>("ct.degreev",1);

// case is per default hyperrectangle and periodic is per default
//nrefinments is set to 0 and the distribution is controlled via subdivisions

//lmax:
LevelVector lmax(dimx+dimv),p(dimx+dimv);
root.get<std::string>("ct.lmax") >> lmax;
root.get<std::string>("ct.p") >> p;

json_general.put("DimX", dimx);
json_general.put("DimV", dimv);
json_general.put("DegreeX", degx);
json_general.put("DegreeV", degx);
json_general.put("PartitionX", p[0]);
json_general.put("PartitionV", p[1]);
json_general.put("Case","hyperrectangle");
json_root.add_child("General", json_general);

json_case.put("NRefinementsX",0);
json_case.put("NRefinementsV",0);
json_case.put("PeriodicX",true);
json_case.put("PeriodicV",true);
jsubX.put("X",pow(2,lmax[0]));
jsubX.put("Y",pow(2,lmax[0]));
jsubX.put("Z",pow(2,lmax[0]));
jsubV.put("X",pow(2,lmax[1]));
jsubV.put("Y",pow(2,lmax[1]));
jsubV.put("Z",pow(2,lmax[1]));
json_case.add_child("NSubdivisionsX",jsubX);
json_case.add_child("NSubdivisionsV",jsubV);
json_root.add_child("Case", json_case);

json_SpatialDiscretization.put("TriangulationType","FullyDistributed");
json_SpatialDiscretization.put("MappingX",1);
json_SpatialDiscretization.put("MappingV",1);
json_root.add_child("SpatialDiscretization",json_SpatialDiscretization);

json_TemporalDiscretization.put("FinalTime",2);
json_TemporalDiscretization.put("CFLNumber",0.15);
json_root.add_child("TemporalDiscretization",json_TemporalDiscretization);

jsout.put("Tick",0.1);
json_postprocessing.add_child("StandardOutput",jsout);
jVTK.put("Enabled",false);
json_postprocessing.add_child("VTK",jVTK);

json_root.add_child("Postprocessing", json_postprocessing);
pt::write_json(newname,json_root);


}
catch(pt::ini_parser::ini_parser_error error){
std::cout<< "Not a valid file";
}
catch(...){
std::cout << "Something went wrong";
}
}

void Converter::toJSON(std::string _fileName, std::string newname,LevelVector l){
namespace pt = boost::property_tree;

// Create a root
pt::ptree root;
pt::ptree json_root, json_general, json_case, json_SpatialDiscretization, json_TemporalDiscretization, json_postprocessing;
pt::ptree jsubX, jsubV,jsout, jVTK;

// Load the ini file in this ptree
try{
pt::read_ini(_fileName, root);
std::cout << "Name "<<_fileName;
int dim=root.get<int>("ct.dim",2);
int dimx=root.get<int>("ct.dimx",dim/2);
int dimv=root.get<int>("ct.dimv",dim/2);

//degree is 1 per default
int degx=root.get<int>("ct.degreex",1);
int degv=root.get<int>("ct.degreev",1);

// case is per default hyperrectangle and periodic is per default
//nrefinments is set to 0 and the distribution is controlled via subdivisions

//lmax:
LevelVector lmax(dimx+dimv),p(dimx+dimv);
lmax=l;
root.get<std::string>("ct.p") >> p;

json_general.put("DimX", dimx);
json_general.put("DimV", dimv);
json_general.put("DegreeX", degx);
json_general.put("DegreeV", degx);
json_general.put("PartitionX", p[0]);
json_general.put("PartitionV", p[1]);
json_general.put("Case","hyperrectangle");
json_root.add_child("General", json_general);

json_case.put("NRefinementsX",0);
json_case.put("NRefinementsV",0);
json_case.put("PeriodicX",true);
json_case.put("PeriodicV",true);
jsubX.put("X",pow(2,lmax[0]));
jsubX.put("Y",pow(2,lmax[0]));
jsubX.put("Z",pow(2,lmax[0]));
jsubV.put("X",pow(2,lmax[1]));
jsubV.put("Y",pow(2,lmax[1]));
jsubV.put("Z",pow(2,lmax[1]));
json_case.add_child("NSubdivisionsX",jsubX);
json_case.add_child("NSubdivisionsV",jsubV);
json_root.add_child("Case", json_case);

json_SpatialDiscretization.put("TriangulationType","FullyDistributed");
json_SpatialDiscretization.put("MappingX",1);
json_SpatialDiscretization.put("MappingV",1);
json_root.add_child("SpatialDiscretization",json_SpatialDiscretization);

json_TemporalDiscretization.put("FinalTime",2);
json_TemporalDiscretization.put("CFLNumber",0.15);
json_root.add_child("TemporalDiscretization",json_TemporalDiscretization);

jsout.put("Tick",0.1);
json_postprocessing.add_child("StandardOutput",jsout);
jVTK.put("Enabled",false);
json_postprocessing.add_child("VTK",jVTK);

json_root.add_child("Postprocessing", json_postprocessing);
pt::write_json(newname,json_root);


}
catch(pt::ini_parser::ini_parser_error error){
std::cout<< "Not a valid File";
}
catch(...){
std::cout << "Something went wrong";
}
}

36 changes: 36 additions & 0 deletions distributedcombigrid/examples/combi_example/DataConverter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
this function reads in the data from a json file formated like that one from hyperdeal and returns the data
we need for a Combi

*/

#ifndef DATACONVERTER_H
#define DATACONVERTER_H

#include <string>
#include <vector>
#include "sgpp/distributedcombigrid/combischeme/CombiMinMaxScheme.hpp"

#include "sgpp/distributedcombigrid/loadmodel/LinearLoadModel.hpp"
#include "sgpp/distributedcombigrid/manager/CombiParameters.hpp"

#include "sgpp/distributedcombigrid/utils/Types.hpp"

using namespace combigrid;

class Converter{
public:

Converter();
//reads the data from a json file and stores it in param file

void toParam(std::string, std::string);

//reads in data from an ini file and stores it in newname.json file
void toJSON(std::string, std::string);

//
void toJSON(std::string, std::string, LevelVector );

};
#endif
26 changes: 26 additions & 0 deletions distributedcombigrid/examples/combi_example/Make_copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CC=mpicxx
CFLAGS=-std=c++14 -g -fopenmp -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-deprecated -Wno-uninitialized -Wall -DUNIFORMDECOMPOSITION

SGPP_DIR=/home/sgsscratch/goehrims/combi
GLPK_DIR=/home/sgsscratch/goehrims/combi/glpk
DEAL_II_DIR=/home/sgsscratch/goehrims/matrixfree-build
DEAL_II_INC_DIR=/home/sgsscratch/goehrims/matrixfree
LD_DEALLII=-L$(DEAL_II_DIR)/lib
INC_DEALII=-I$(DEAL_II_INC_DIR)/include -I$(DEAL_II_DIR)/include
LD_SGPP=-L$(SGPP_DIR)/lib/sgpp
INC_GLPK=-I$(GLPK_DIR)/include
LD_GLPK=-L$(GLPK_DIR)/lib
INC_SGPP=-I$(SGPP_DIR)/distributedcombigrid/src/

LDIR=$(LD_SGPP) $(LD_GLPK) $(LD_DEALII)
INC=$(INC_SGPP) $(INC_GLPK) $(INC_DEALII)

LIBS=-lsgppdistributedcombigrid -lboost_serialization

all: combi_example

combi_example: combi_example.cpp TaskExample.hpp
mpicxx $(CFLAGS) $(LDIR) $(INC) -o combi_example combi_example.cpp $(LIBS)

clean:
rm -f *.o out/* combi_example
23 changes: 23 additions & 0 deletions distributedcombigrid/examples/combi_example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CC=mpicxx
CFLAGS=-std=c++11 -g -fopenmp -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-deprecated -Wno-uninitialized -Wall -DUNIFORMDECOMPOSITION

SGPP_DIR=/home/sgsscratch/goehrims/combi
GLPK_DIR=/home/sgsscratch/goehrims/combi/glpk

LD_SGPP=-L$(SGPP_DIR)/lib/sgpp
INC_GLPK=-I$(GLPK_DIR)/include
LD_GLPK=-L$(GLPK_DIR)/lib
INC_SGPP=-I$(SGPP_DIR)/distributedcombigrid/src/

LDIR=$(LD_SGPP) $(LD_GLPK)
INC=$(INC_SGPP) $(INC_GLPK)

LIBS=-lsgppdistributedcombigrid -lboost_serialization

all: combi_example

combi_example: combi_example.cpp TaskExample.hpp
mpicxx $(CFLAGS) $(LDIR) $(INC) -o combi_example combi_example.cpp $(LIBS)

clean:
rm -f *.o out/* combi_example
Loading