Skip to content
Snippets Groups Projects
Commit 7c372d45 authored by Boris Martin's avatar Boris Martin
Browse files

first draft (FEM only)

parent fa1c885a
No related branches found
No related tags found
1 merge request!17New tutorial case: overlapping DDM (Dirichlet) for Laplace equation
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(tuto CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../tutorial.cmake)
add_executable(tuto main.cpp ${EXTRA_INCS})
target_link_libraries(tuto ${EXTRA_LIBS})
// Gmsh project created on Thu Oct 6 12:29:07 2022
//SetFactory("OpenCASCADE");
//+
Point(1) = {0, 0, 0, 0.05};
//+
Point(2) = {0.8, 0, 0, 0.05};
//+
Point(3) = {1.2, 0, 0, 0.05};
//+
Point(4) = {2.0, 0, 0, 0.05};
//+
Point(5) = {2, 1, 0, 0.05};
//+
Point(6) = {1.2, 1, 0, 0.05};
//+
Point(7) = {0.8, 1, 0, 0.05};
//+
Point(8) = {0.0, 1, 0, 0.05};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 7};
//+
Line(3) = {7, 8};
//+
Line(4) = {8, 1};
//+
Line(5) = {3, 2};
//+
Line(6) = {6, 3};
//+
Line(7) = {6, 7};
//+
Line(8) = {3, 4};
//+
Line(9) = {4, 5};
//+
Line(10) = {5, 6};
//+
Curve Loop(1) = {4, 1, 2, 3};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {7, -2, -5, -6};
//+
Plane Surface(2) = {2};
//+
Curve Loop(3) = {10, 6, 8, 9};
//+
Plane Surface(3) = {3};
//+
Physical Surface("left", 11) = {1};
//+
Physical Surface("center", 12) = {2};
//+
Physical Surface("right", 13) = {3};
//+
Physical Curve("gammaLeft", 14) = {4};
//+
Physical Curve("gammaRight", 15) = {9};
//+
Physical Curve("interface1", 16) = {2};
//+
Physical Curve("interface2", 17) = {6};
#include "gmsh.h"
#include <gmshddm/Formulation.h>
#include <gmshddm/GmshDdm.h>
#include <gmshddm/MPIInterface.h>
#include <gmshfem/Message.h>
#include <gmshfem/GmshFem.h>
#include <gmshfem/Formulation.h>
using namespace gmshfem;
using namespace gmshfem::common;
using namespace gmshfem::problem;
using namespace gmshfem::domain;
using namespace gmshfem::field;
using namespace gmshfem::function;
using namespace gmshfem::post;
using namespace gmshfem::equation;
/*
using namespace gmshddm;
using namespace gmshddm::common;
using namespace gmshddm::domain;
using namespace gmshddm::problem;
using namespace gmshddm::field;
using namespace gmshddm::mpi;
*/
int main(int argc, char **argv)
{
//GmshDdm gmshDdm(argc, argv);
GmshFem gmshFem(argc, argv);
unsigned int nDom = 2;
gmshFem.userDefinedParameter(nDom, "nDom");
double lc = 0.05;
int order = 1;
gmshFem.userDefinedParameter(lc, "lc");
gmshFem.userDefinedParameter(order, "order");
std::string gauss = "Gauss10";
gmshFem.userDefinedParameter(gauss, "gauss");
gmsh::open("../domain.geo");
gmsh::model::mesh::generate();
Formulation< std::complex< double > > formulation("demoFloatingPotential");
Domain left(2, 11), center(2, 12), right(2, 13);
Domain gammaLeft(1, 14), interface1(1, 16), interface2(1, 17), gammaRight(1, 15);
Field<std::complex<double>, Form::Form0> v("v", left|center|interface2|interface1, FunctionSpaceTypeForm0::Lagrange);
v.addConstraint(interface2, 0);
formulation.integral(grad(dof(v)), grad(tf(v)), left|center|interface2|interface1, gauss);
formulation.integral(-1.0, tf(v), gammaLeft, gauss);
formulation.pre();
formulation.assemble();
formulation.solve();
save(v);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment