keyword
stringclasses
7 values
repo_name
stringlengths
8
98
file_path
stringlengths
4
244
file_extension
stringclasses
29 values
file_size
int64
0
84.1M
line_count
int64
0
1.6M
content
stringlengths
1
84.1M
language
stringclasses
14 values
2D
hpfem/hermes-examples
2d-benchmarks-nist/05-battery/main.cpp
.cpp
6,695
197
#include "definitions.h" using namespace RefinementSelectors; // This is the fifth in the series of NIST benchmarks with unknown exact solution. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // NIST Report 7668, February 2010. // // PDE...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/05-battery/definitions.cpp
.cpp
12,864
384
#include "definitions.h" template<typename Real, typename Scalar> Scalar CustomMatrixFormVol::matrix_form(int n, double *wt, Func<Scalar> *u_ext[], Func<Real> *u, Func<Real> *v, GeomVol<Real> *e, Func<Scalar>* *ext) const { Scalar result = Scalar(0); double p = 0, q = 0; // integration order calculation. if ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/08-oscillatory/definitions.h
.h
2,520
92
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Right-hand side */ class CustomRightHandSide : public Hermes::Hermes2DFunction<double> { public: CustomRightHandSide(double alpha) : Hermes::Hermes2DFunction<d...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/08-oscillatory/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/08-oscillatory/main.cpp
.cpp
6,817
194
#include "definitions.h" using namespace RefinementSelectors; // This is the eight in the series of NIST benchmarks with known exact solutions. It solves // the Helmholtz equation and has an oscillatory solution. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, //...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/08-oscillatory/generate_rhs.py
.py
307
16
from sympy import var, sqrt, sin, pprint, simplify, ccode var("x y ALPHA") def laplace(f): return f.diff(x, 2) + f.diff(y, 2) r = sqrt(x**2+y**2) u = sin(1/(ALPHA+r)) lhs = -laplace(u) - u/(ALPHA+r)**4 print "lhs, as a formula:" pprint(lhs) print print "-"*60 print "lhs, as C code:" print ccode(lhs)
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/08-oscillatory/definitions.cpp
.cpp
5,306
124
#include "definitions.h" double CustomRightHandSide::value(double x, double y) const { return (-Hermes::sin(1.0 / (alpha + Hermes::pow((Hermes::pow(x, 2) + Hermes::pow(y, 2)), (1.0 / 2.0)))) / Hermes::pow((alpha + Hermes::pow((Hermes::pow(x, 2) + Hermes::pow(y, 2)), (1.0 / 2.0))), 4) + 2 * Hermes::cos(1.0 / ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/07-boundary-line-singularity/definitions.h
.h
961
41
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Right-hand side */ class CustomRightHandSide : public Hermes::Hermes2DFunction<double> { public: CustomRightHandSide(double alpha) : Hermes::Hermes2DFunction<d...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/07-boundary-line-singularity/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/07-boundary-line-singularity/main.cpp
.cpp
7,002
198
#include "definitions.h" using namespace RefinementSelectors; // This is the seventh in the series of NIST benchmarks with known exact solutions. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // NIST Report 7668, February 2010. // // PD...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/07-boundary-line-singularity/definitions.cpp
.cpp
574
27
#include "definitions.h" double CustomRightHandSide::value(double x, double y) const { return alpha * (alpha - 1.) * Hermes::pow(x, alpha - 2.); } Ord CustomRightHandSide::value(Ord x, Ord y) const { return Ord((int)(alpha + 3.1)); } double CustomExactSolution::value(double x, double y) const { return Hermes::...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly/definitions.h
.h
5,601
163
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes::Hermes2D; using namespace WeakFormsH1; using Hermes::Ord; /* Right-hand side */ class CustomWeakForm : public WeakForm<double> { class Jacobian : public MatrixFormVol<double> { public: Jacobian() : MatrixFormVol<double>(0, 0) { this->s...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly/main.cpp
.cpp
10,457
291
#include "definitions.h" // This is the ninth in the series of NIST benchmarks with known exact solutions. This benchmark // has four different versions, use the global variable PROB_PARAM below to switch among them. // It differs from 09-wave-front in the mesh adaptation method. // // Reference: W. Mitchell, A C...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly/definitions.cpp
.cpp
3,547
96
#include "definitions.h" double CustomWeakForm::Jacobian::value(int n, double* wt, Func< double >* u_ext[], Func< double >* u, Func< double >* v, GeomVol< double >* e, Func< double >** ext) const { double result = 0; for (int i = 0; i ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/01-analytic-solution/definitions.h
.h
986
40
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Right-hand side */ class CustomRightHandSide : public Hermes::Hermes2DFunction<double> { public: CustomRightHandSide(double poly_deg) : Hermes::Hermes2DFunctio...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/01-analytic-solution/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/01-analytic-solution/main.cpp
.cpp
6,977
198
#include "definitions.h" using namespace RefinementSelectors; // This is the first in the series of NIST benchmarks with known exact solutions. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // NIST Report 7668, February 2010. // // PDE:...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/01-analytic-solution/definitions.cpp
.cpp
1,445
44
#include "definitions.h" double CustomRightHandSide::value(double x, double y) const { double a = Hermes::pow(2.0, 4.0*poly_deg); double b = Hermes::pow(x - 1.0, 8.0); double c = (38.0*Hermes::pow(x, 2.0) - 38.0*x + 9.0); double d = Hermes::pow(y - 1.0, poly_deg); double e = Hermes::pow(y - 1.0, 8.0); doub...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/06-boundary-layer/definitions.h
.h
2,550
92
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Right-hand side */ class CustomRightHandSide : public Hermes::Hermes2DFunction<double> { public: CustomRightHandSide(double epsilon) : Hermes::Hermes2DFunction...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/06-boundary-layer/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/06-boundary-layer/main.cpp
.cpp
6,841
195
#include "definitions.h" using namespace RefinementSelectors; // This is the sixth in the series of NIST benchmarks with known exact solutions. It solves // a problem with boundary layer. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/06-boundary-layer/generate_rhs.py
.py
651
25
from sympy import var, sqrt, sin, exp, cos, pprint, pi, simplify, ccode var("x y EPSILON") def laplace(f): return f.diff(x, 2) + f.diff(y, 2) # exact solution (given) u = (1 - exp(-(1-x)/EPSILON)) * (1 - exp(-(1-y)/EPSILON)) * cos(pi * (x + y)) # right-hand-side (to be calculated) rhs = -EPSILON * laplace(u) + 2*...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/06-boundary-layer/definitions.cpp
.cpp
4,079
107
#include "definitions.h" double CustomRightHandSide::value(double x, double y) const { return -epsilon*(-2 * Hermes::pow(M_PI, 2)*(1 - exp(-(1 - x) / epsilon))*(1 - exp(-(1 - y) / epsilon))*Hermes::cos(M_PI*(x + y)) + 2 * M_PI*(1 - exp(-(1 - x) / epsilon))*exp(-(1 - y) / epsilon)*Hermes::sin(M_PI*(x + y)) / epsi...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front/definitions.h
.h
2,843
80
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes::Hermes2D; using namespace WeakFormsH1; using Hermes::Ord; /* Alternatively, DefaultWeakFormDiffusion may be used. This is just copied from the Kelly version of this benchmark for one-to-one comparison. */ class CustomWeakForm : public WeakForm...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front/main.cpp
.cpp
8,151
243
#include "definitions.h" using namespace RefinementSelectors; // This is the ninth in the series of NIST benchmarks with known exact solutions. This benchmark // has four different versions, use the global variable "PARAM" (below) to switch among them. // // Reference: W. Mitchell, A Collection of 2D Elliptic Prob...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front/definitions.cpp
.cpp
2,422
74
#include "definitions.h" double CustomWeakForm::Jacobian::value(int n, double* wt, Func<double>* u_ext[], Func<double>* u, Func<double>* v, GeomVol<double>* e, Func<double>** ext) const { double result = 0; for (int i = 0; i < n; i++) result += wt[i] * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); return...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/03-linear-elasticity/definitions.h
.h
8,205
286
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Exact solution */ class CustomExactSolutionU : public ExactSolutionScalar<double> { public: CustomExactSolutionU(MeshSharedPtr mesh, double E, double nu, double lamb...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/03-linear-elasticity/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/03-linear-elasticity/main.cpp
.cpp
10,194
264
#include "definitions.h" using namespace RefinementSelectors; // This is the third in the series of NIST benchmarks with known exact solutions. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // NIST Report 7668, February 2010. // // PDE:...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/03-linear-elasticity/definitions.cpp
.cpp
23,161
595
#include "definitions.h" double E = 1.0; double nu = 0.3; // lambda for mode-1 solution. double lambda = 0.5444837367825; // mu for mode-1 solution (mu is the same as G) double mu = E / (2.0 * (1.0 + nu)); // Q for mode-1 solution. double Q = 0.5430755788367; double k = 3.0 - 4.0 * nu; double A = -E * (1 - nu * nu) / ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly-dealii/definitions.h
.h
5,921
195
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes::Hermes2D; using namespace WeakFormsH1; using Hermes::Ord; /* Right-hand side */ class CustomWeakForm : public WeakForm<double> { class Jacobian : public MatrixFormVol<double> { public: Jacobian() : MatrixFormVol<double>(0, 0) { this->s...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly-dealii/main.cpp
.cpp
10,789
365
#include "definitions.h" // This is the ninth in the series of NIST benchmarks with known exact solutions. This benchmark // has four different versions, use the global variable PROB_PARAM below to switch among them. // It differs from 09-wave-front in the mesh adaptation method. // // Reference: W. Mitchell, A C...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly-dealii/definitions.cpp
.cpp
4,765
130
#include "definitions.h" double CustomWeakForm::Jacobian::value(int n, double* wt, Func< double >* u_ext[], Func< double >* u, Func< double >* v, GeomVol< double >* e, Func< double >** ext) const { double result = 0; for (int i = 0; i ...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/09-wave-front-kelly-dealii/deal.ii/step-6.cc
.cc
19,469
678
/* $Id: step-6.cc 22321 2010-10-12 21:53:08Z kanschat $ */ /* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */ /* $Id: step-6.cc 22321 2010-10-12 21:53:08Z kanschat $ */ /* */ /* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 200...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/02-reentrant-corner/definitions.h
.h
695
31
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Exact solution */ class CustomExactSolution : public ExactSolutionScalar<double> { public: CustomExactSolution(MeshSharedPtr mesh, double alpha) : ExactSolutio...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/02-reentrant-corner/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/02-reentrant-corner/main.cpp
.cpp
7,814
222
#include "definitions.h" using namespace RefinementSelectors; // This is the second in the series of NIST benchmarks with known exact solutions. This benchmark // has four different versions, use the global variable PARAM below to switch among them. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problem...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/02-reentrant-corner/definitions.cpp
.cpp
973
32
#include "definitions.h" double CustomExactSolution::value(double x, double y) const { return (Hermes::pow(Hermes::sqrt(x*x + y*y), alpha) * Hermes::sin(alpha * get_angle(y, x))); } void CustomExactSolution::derivatives(double x, double y, double& dx, double& dy) const { double a = Hermes::sqrt(x*x + y*y); doub...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/11-kellogg/definitions.h
.h
889
36
#include "hermes2d.h" #include "../NIST-util.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; /* Exact solution */ class CustomExactSolution : public ExactSolutionScalar<double> { public: CustomExactSolution(MeshSharedPtr mesh, double sigma, double tau, double r...
Unknown
2D
hpfem/hermes-examples
2d-benchmarks-nist/11-kellogg/plot_graph.py
.py
898
42
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.yscale("log") pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_exact.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="erro...
Python
2D
hpfem/hermes-examples
2d-benchmarks-nist/11-kellogg/main.cpp
.cpp
7,012
197
#include "definitions.h" using namespace RefinementSelectors; // This is the 11th in the series of NIST benchmarks with known exact solutions. // // Reference: W. Mitchell, A Collection of 2D Elliptic Problems for Testing Adaptive Algorithms, // NIST Report 7668, February 2010. // // The s...
C++
2D
hpfem/hermes-examples
2d-benchmarks-nist/11-kellogg/definitions.cpp
.cpp
3,771
71
#include "definitions.h" double CustomExactSolution::value(double x, double y) const { double theta = Hermes::atan2(y, x); if (theta < 0) theta = theta + 2.*M_PI; double r = Hermes::sqrt(x*x + y*y); double mu; if (theta <= M_PI / 2.) mu = Hermes::cos((M_PI / 2. - sigma)*tau) * Hermes::cos((theta - M_PI ...
C++
2D
hpfem/hermes-examples
2d-advanced/wave-equation/wave-1/definitions.h
.h
2,178
74
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; /* Initial condition */ class CustomInitialConditionWave : public ExactSolutionScalar < double > { public: CustomIni...
Unknown
2D
hpfem/hermes-examples
2d-advanced/wave-equation/wave-1/main.cpp
.cpp
8,866
215
#include "definitions.h" // This example solves a simple linear wave equation by converting it // into a system of two first-order equations in time. Time discretization // is performed using arbitrary (explicit or implicit, low-order or higher-order) // Runge-Kutta methods entered via their Butcher's tables. // For a...
C++
2D
hpfem/hermes-examples
2d-advanced/wave-equation/wave-1/definitions.cpp
.cpp
2,963
92
#include "definitions.h" double CustomInitialConditionWave::value(double x, double y) const { return exp(-x*x - y*y); } void CustomInitialConditionWave::derivatives(double x, double y, double& dx, double& dy) const { dx = exp(-x*x - y*y) * (-2 * x); dy = exp(-x*x - y*y) * (-2 * y); } Ord CustomInitialCondition...
C++
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski/definitions.h
.h
2,569
81
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; typedef std::complex<double> complex; /* Initial condition */ class CustomInitialCondition : public ExactSolutionScal...
Unknown
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski/main.cpp
.cpp
5,777
148
#include "definitions.h" // This example uses the Newton's method to solve a nonlinear complex-valued // time-dependent PDE (the Gross-Pitaevski equation describing the behavior // of Einstein-Bose quantum gases). For time-discretization one can use either // the first-order implicit Euler method or the second-ord...
C++
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski/definitions.cpp
.cpp
3,860
98
#include "definitions.h" void CustomInitialCondition::derivatives(double x, double y, std::complex<double> & dx, std::complex<double> & dy) const { std::complex<double> val = exp(-10 * (x*x + y*y)); dx = val * (-20.0 * x); dy = val * (-20.0 * y); } std::complex<double> CustomInitialCondition::value(double x, d...
C++
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski-adapt/definitions.h
.h
2,545
80
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; typedef std::complex<double> complex; class CustomInitialCondition : public ExactSolutionScalar < ::complex > { public...
Unknown
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski-adapt/plot_graph.py
.py
557
30
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.title("Error convergence") pylab.xlabel("Physical time (s)") pylab.ylabel("Error [%]") data = numpy.loadtxt("time_error.dat") x = data[:, 0] y = data[:, 1] plot(x, y, "-s", label="error (est)") legend() # initialize new win...
Python
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski-adapt/main.cpp
.cpp
15,053
360
#include "definitions.h" // This example shows how to combine automatic adaptivity with the Newton's // method for a nonlinear complex-valued time-dependent PDE (the Gross-Pitaevski // equation describing the behavior of Einstein-Bose quantum gases) // discretized implicitly in time (via implicit Euler or Crank-Ni...
C++
2D
hpfem/hermes-examples
2d-advanced/schroedinger/gross-pitaevski-adapt/definitions.cpp
.cpp
3,888
98
#include "definitions.h" void CustomInitialCondition::derivatives(double x, double y, std::complex<double> & dx, std::complex<double> & dy) const { std::complex<double> val = exp(-20 * (x*x + y*y)); dx = val * (-40.0 * x); dy = val * (-40.0 * y); } std::complex<double> CustomInitialCondition::value(double x, d...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group/definitions.h
.h
928
24
////// Weak formulation in axisymmetric coordinate system //////////////////////////////////// #include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; using namespace Hermes::...
Unknown
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group/problem_data.h
.h
2,500
97
#include "hermes2d.h" using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties; using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties::Diffusion; using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties::Definitions; // Referenc...
Unknown
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group/main.cpp
.cpp
7,309
202
#include "definitions.h" #include "problem_data.h" // This example solves a 4-group neutron diffusion equation in the reactor core. // The eigenproblem is solved using power interations. // // The reactor neutronics is given by the following eigenproblem: // // - \nabla \cdot D_g \nabla \phi_g + \Sigma_{Rg}\phi_g - \...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group/definitions.cpp
.cpp
1,849
45
////// Weak formulation in axisymmetric coordinate system //////////////////////////////////// #include "definitions.h" CustomWeakForm::CustomWeakForm(const Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties::Diffusion::MaterialPropertyMaps& matprop, std::vector<MeshFunctionSharedPtr<double> >& i...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group-adapt/definitions.h
.h
6,089
151
////// Weak formulation in axisymmetric coordinate system //////////////////////////////////// #include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; using namespace WeakForm...
Unknown
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group-adapt/plot_graph.py
.py
1,257
60
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="error (est)") legend() # init...
Python
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group-adapt/problem_data.h
.h
2,590
99
#include "hermes2d.h" using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties; using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties::Diffusion; using namespace Hermes::Hermes2D::WeakFormsNeutronics::Multigroup::MaterialProperties::Definitions; // Referenc...
Unknown
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group-adapt/main.cpp
.cpp
16,884
388
#include "definitions.h" #include "problem_data.h" // This example uses automatic adaptivity to solve a 4-group neutron diffusion equation in the reactor core. // The eigenproblem is solved using power interations. // // The reactor neutronics in a general coordinate system is given by the following eigenproblem: // /...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/4-group-adapt/definitions.cpp
.cpp
5,823
181
////// Weak formulation in axisymmetric coordinate system //////////////////////////////////// #include "definitions.h" CustomWeakForm::CustomWeakForm(const MaterialPropertyMaps& matprop, std::vector<MeshFunctionSharedPtr<double> >& iterates, double init_keff, std::string bdy_vacuum) : DefaultWeakFormSourceIter...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/saphir/plot_graph.py
.py
628
32
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_est.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="error (est)") legend() # ...
Python
2D
hpfem/hermes-examples
2d-advanced/neutronics/saphir/main.cpp
.cpp
8,110
236
#include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::WeakFormsH1; using namespace Hermes::Hermes2D::Views; using namespace RefinementSelectors; // This is the IAEA EIR-2 benchmark problem. Note the way of handling different material // parameters. This is...
C++
2D
hpfem/hermes-examples
2d-advanced/neutronics/iron-water/plot_graph.py
.py
628
32
# import libraries import numpy, pylab from pylab import * # plot DOF convergence graph pylab.title("Error convergence") pylab.xlabel("Degrees of freedom") pylab.ylabel("Error [%]") axis('equal') data = numpy.loadtxt("conv_dof_est.dat") x = data[:, 0] y = data[:, 1] loglog(x, y, '-s', label="error (est)") legend() # ...
Python
2D
hpfem/hermes-examples
2d-advanced/neutronics/iron-water/main.cpp
.cpp
8,634
228
#include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::WeakFormsH1; using namespace Hermes::Hermes2D::Views; using namespace RefinementSelectors; // This example is a standard nuclear engineering benchmark describing an external-force-driven // configurati...
C++
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/heat-and-moisture-adapt/definitions.h
.h
1,406
52
#include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::WeakFormsH1; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; /* Weak forms */ class CustomWeakFormHeatMoistureRK : public WeakForm<double> { public: Cust...
Unknown
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/heat-and-moisture-adapt/forms.cpp
.cpp
3,319
92
// first equation: template<typename Real, typename Scalar> Scalar bilinear_form_sym_0_0(int n, double *wt, Func<Real> *u_ext[], Func<Real> *u, Func<Real> *v, Geom<Real> *e, ExtData<Scalar> *ext) { Scalar result = 0; for (int i = 0; i < n; i++) result += wt[i] * e->x[i] * ( (c_TT/TAU) * u->val[i] * v->val[i] + ...
C++
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/heat-and-moisture-adapt/main.cpp
.cpp
13,027
319
#include "definitions.h" using namespace RefinementSelectors; // This example solves adaptively a time-dependent coupled problem of heat and moisture // transfer in massive concrete walls of a nuclear reactor vessel (simplified axi-symmetric // geometry). // // PDE: Lengthy. See the paper P. Solin, L. Dubcova, J. Kru...
C++
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/heat-and-moisture-adapt/definitions.cpp
.cpp
3,263
49
#include "definitions.h" CustomWeakFormHeatMoistureRK::CustomWeakFormHeatMoistureRK(double c_TT, double c_ww, double d_TT, double d_Tw, double d_wT, double d_ww, double k_TT, double k_ww, double T_ext, double w_ext, const std::string bdy_ext) : WeakForm<double>(2) { // Jacobian - volumetric. add_matrix_form(new ...
C++
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/wall-on-fire-adapt/definitions.h
.h
3,281
96
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; /* Space-dependent thermal conductivity */ double lambda(double x, double y); /* Time-dependent fire temperature */ te...
Unknown
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/wall-on-fire-adapt/main.cpp
.cpp
15,493
377
#include "definitions.h" // This example models a nonstationary distribution of temperature within a wall // exposed to ISO fire. Spatial adaptivity is ON by default, adaptivity in time // can be turned ON and OFF using the flag ADAPTIVE_TIME_STEP_ON. // // PDE: non-stationary heat transfer equation // HEATC...
C++
2D
hpfem/hermes-examples
2d-advanced/heat-transfer/wall-on-fire-adapt/definitions.cpp
.cpp
4,747
139
#include "definitions.h" double lambda(double x, double y) { return 1.0; } template<typename Real> Real T_fire_x(Real x) { return -(1. / 32.) * x*x*x + (3. / 16.) * x*x; } template<typename Real> Real T_fire_t(Real t) { if (0. <= t && t <= 100.) return 0.; if (100. <= t && t <= 600.) return 980. ...
C++
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear-dg-adapt/definitions.h
.h
4,119
112
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; class CustomWeakForm : public WeakForm<double> { public: CustomWeakForm(std::string left_bottom_bnd_part, MeshSharedP...
Unknown
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear-dg-adapt/main.cpp
.cpp
4,403
124
#include "definitions.h" // This example solves a linear advection equation using Dicontinuous Galerkin (DG) method. // It is intended to show how evalutation of surface matrix forms that take basis functions defined // on different elements work. It is the same example as linear-advection-dg, but with automatic ad...
C++
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear-dg-adapt/definitions.cpp
.cpp
6,911
193
#include "definitions.h" CustomWeakForm::CustomWeakForm(std::string left_bottom_bnd_part, MeshSharedPtr mesh) : WeakForm<double>(1), mesh(mesh) { add_matrix_form(new CustomMatrixFormVol(0, 0)); add_vector_form(new CustomVectorFormVol(0)); add_matrix_form_surf(new CustomMatrixFormSurface(0, 0)); add_matrix_form...
C++
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear/definitions.h
.h
1,685
56
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; class WeakFormLinearAdvectionDiffusion : public WeakForm < double > { public: // Problem parameters. double const_f...
Unknown
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear/main.cpp
.cpp
6,379
175
#include "definitions.h" // This example solves a linear advection diffusion problem using optional // variational multiscale stabilization. To use the stabilization, you must // uncomment the definition of H2D_SECOND_DERIVATIVES_ENABLED in h2d_common.h // and rebuild this example. Note that in our experience, the...
C++
2D
hpfem/hermes-examples
2d-advanced/advection-diffusion-reaction/linear/definitions.cpp
.cpp
2,766
67
#include "definitions.h" WeakFormLinearAdvectionDiffusion::WeakFormLinearAdvectionDiffusion(bool stabilization_on, bool shock_capturing_on, double b1, double b2, double epsilon) : WeakForm<double>(1), stabilization_on(stabilization_on), shock_capturing_on(shock_capturing_on) { add_matrix_form(new MatrixFormVolAdve...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/euler_util.cpp
.cpp
56,369
1,284
#include "euler_util.h" #include "limits.h" #include <limits> // Calculates energy from other quantities. double QuantityCalculator::calc_energy(double rho, double rho_v_x, double rho_v_y, double pressure, double kappa) { double to_return = pressure / (kappa - 1.0) + (rho_v_x*rho_v_x + rho_v_y*rho_v_y) / (2.0*rho); ...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/forms_implicit.cpp
.cpp
74,425
1,508
#include "hermes2d.h" // Numerical fluxes. #include "numerical_flux.h" // Utility functions for the Euler equations. #include "euler_util.h" class EulerEquationsWeakFormImplicit : public WeakForm<double> { public: // Constructor. EulerEquationsWeakFormImplicit(NumericalFlux* num_flux, double kappa, double rho_ex...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/initial_condition.cpp
.cpp
1,777
54
/// Essential boundary condition for the coupled problem. class ConcentrationTimedepEssentialBC : public EssentialBoundaryCondition<double> { public: ConcentrationTimedepEssentialBC(std::string marker, double constant, double startup_time) : EssentialBoundaryCondition<double>(std::vector<std::string>()), ...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/euler-init-main-adapt.cpp
.cpp
3,194
63
#pragma region 1. Load mesh and initialize spaces. // Load the mesh. MeshSharedPtr mesh(new Mesh); MeshReaderH2D mloader; mloader.load(MESH_FILENAME, mesh); // Perform initial mesh refinements. for (int i = 0; i < INIT_REF_NUM; i++) mesh->refine_all_elements(0, true); // Initializ...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/euler-time-loop-space-adapt.cpp
.cpp
7,672
190
std::vector<MeshFunctionSharedPtr<double> > prev_slns({ prev_rho, prev_rho_v_x, prev_rho_v_y, prev_e }); WeakFormSharedPtr<double> wf_stabilization(new EulerEquationsWeakFormStabilization(prev_rho)); if(SHOCK_CAPTURING && SHOCK_CAPTURING_TYPE == FEISTAUER) ((EulerEquationsWeakFormSemiImplicit*)(wf.get()))->set_stabili...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/numerical_flux.h
.h
5,477
190
#ifndef NUMERICAL_FLUX_H #define NUMERICAL_FLUX_H #include "euler_util.h" class NumericalFlux { public: NumericalFlux(double kappa); /// Calculates all components of the flux. /// Stores the result in the array result. virtual void numerical_flux(double result[4], double w_L[4], double w_R[4], doubl...
Unknown
2D
hpfem/hermes-examples
2d-advanced/euler/numerical_flux.cpp
.cpp
42,960
1,311
#include "numerical_flux.h" NumericalFlux::NumericalFlux(double kappa) : kappa(kappa) { } void NumericalFlux::Q(double result[4], double state_vector[4], double nx, double ny) { result[0] = state_vector[0]; double temp_result_1 = nx * state_vector[1] + ny * state_vector[2]; double temp_result_2 = -ny * state_ve...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/euler-time-loop.cpp
.cpp
7,126
169
#pragma region 4. Filters for visualization of Mach number, pressure + visualization setup. MeshFunctionSharedPtr<double> Mach_number(new MachNumberFilter(prev_slns, KAPPA)); MeshFunctionSharedPtr<double> pressure(new PressureFilter(prev_slns, KAPPA)); ScalarView pressure_view("Pressure", new WinGeom(0, 0, 600, 3...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/euler-init-main.cpp
.cpp
1,887
32
#pragma region 1. Load mesh and initialize spaces. // Load the mesh. MeshSharedPtr mesh(new Mesh); MeshReaderH2D mloader; mloader.load(MESH_FILENAME, mesh); // Perform initial mesh refinements. for (int i = 0; i < INIT_REF_NUM; i++) mesh->refine_all_elements(0, true); // Initialize boundary condition types and space...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/coupling.h
.h
1,184
42
#include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; enum VelocityComponent { velX = 1, velY = 2 }; class CouplingErrorFormVelocity : public MatrixFormVol<double> { public: CouplingErrorFormVelocity(VelocityComponent component, double c_p); virtual double value(int n, doub...
Unknown
2D
hpfem/hermes-examples
2d-advanced/euler/euler_util.h
.h
15,487
459
#ifndef EULER_UTIL_H #define EULER_UTIL_H #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; // Class calculating various quantities class QuantityCalculator { public: // Calculates energy from other quantities. static double calc_energy(double rho, double rho_v_x, double rho_v_y, do...
Unknown
2D
hpfem/hermes-examples
2d-advanced/euler/coupling.cpp
.cpp
2,765
102
#include "coupling.h" CouplingErrorFormVelocity::CouplingErrorFormVelocity(VelocityComponent component, double c_p) : MatrixFormVol<double>(component, 4), component(component), c_p(c_p) { } double CouplingErrorFormVelocity::value(int n, double *wt, Func<double> *u_ext[], Func<double> *sln_i, Func<double> *sln_j, G...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/forms_explicit.cpp
.cpp
33,502
893
#include "hermes2d.h" // Numerical fluxes. #include "numerical_flux.h" // Utility functions for the Euler equations. #include "euler_util.h" class EulerEquationsWeakFormStabilization : public WeakForm < double > { public: EulerEquationsWeakFormStabilization(MeshFunctionSharedPtr<double> prev_rho) : WeakForm<double>...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/heating-induced-vortex-adapt/main.cpp
.cpp
5,008
144
#define HERMES_REPORT_INFO #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; // This example solves the compressible Euler equations using Discontinuous Galerkin method of higher order with ad...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/reflected-shock/definitions.h
.h
199
8
#include "hermes2d.h" /* Namespaces used */ using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors;
Unknown
2D
hpfem/hermes-examples
2d-advanced/euler/reflected-shock/main.cpp
.cpp
3,912
120
#define HERMES_REPORT_INFO #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; // This example solves the compressible Euler equations using a basic // piecewise-constant finite volume method, or Discontinuous Galerkin // method of higher order with...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/reflected-shock/definitions.cpp
.cpp
0
0
null
C++
2D
hpfem/hermes-examples
2d-advanced/euler/heating-flow-coupling/main.cpp
.cpp
9,217
243
#define HERMES_REPORT_INFO #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Solvers; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::RefinementSelectors; using namespace Hermes::Hermes2D::Views; // Visualization. // Set to "true" to enable Hermes OpenGL visualization. const b...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/forward-step-adapt/main.cpp
.cpp
4,143
119
#define HERMES_REPORT_INFO #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::Views; using namespace Hermes::Hermes2D::RefinementSelectors; // This example solves the compressible Euler equations using Discontinuous Galerkin method of higher order with ad...
C++
2D
hpfem/hermes-examples
2d-advanced/euler/heating-induced-vortex/main.cpp
.cpp
3,465
99
#define HERMES_REPORT_INFO #include "hermes2d.h" using namespace Hermes; using namespace Hermes::Hermes2D; using namespace Hermes::Hermes2D::RefinementSelectors; using namespace Hermes::Hermes2D::Views; // Visualization. // Set to "true" to enable Hermes OpenGL visualization. const bool HERMES_VISUALIZATION = true; /...
C++