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-advanced/euler/joukowski-profile-adapt/main.cpp | .cpp | 16,892 | 408 | #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-flow-coupling-adapt/main.cpp | .cpp | 17,398 | 384 | #define HERMES_REPORT_INFO
#include "hermes2d.h"
#include "../coupling.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 HERM... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/forward-step/main.cpp | .cpp | 4,084 | 127 | #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 no... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/euler-coupled-adapt/main.cpp | .cpp | 25,672 | 571 | #define HERMES_REPORT_INFO
#include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace RefinementSelectors;
// This example solves the compressible Euler equations coupled with an advection-diffution equation
// using a basic piecewise-const... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/gamm-channel/main.cpp | .cpp | 3,377 | 102 | #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
// Discontinuous Galerkin method of higher order with no adaptivity.
//
// Equations: Compressible Euler equations, perfect gas... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/reflected-shock-adapt/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-adapt/main.cpp | .cpp | 8,084 | 208 | #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-adapt/definitions.cpp | .cpp | 0 | 0 | null | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/joukowski-profile/main.cpp | .cpp | 10,988 | 279 | #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 no... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/gamm-channel-adapt/main.cpp | .cpp | 4,055 | 123 | #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... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/euler/euler-coupled/main.cpp | .cpp | 13,364 | 332 | #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 coupled with an advection-diffution equation
// using a basic piecewise-constant finite volume method for the flow... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/crack/definitions.h | .h | 520 | 17 | #include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::RefinementSelectors;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::WeakFormsElasticity;
using namespace Hermes::Hermes2D::Views;
using namespace RefinementSelectors;
cla... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/crack/main.cpp | .cpp | 11,558 | 282 | #include "definitions.h"
// This example uses adaptive multimesh hp-FEM to solve a simple problem
// of linear elasticity. Note that since both displacement components
// have similar qualitative behavior, the advantage of the multimesh
// discretization is less striking.
//
// PDE: Lame equations of linear elasticity... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/crack/definitions.cpp | .cpp | 1,477 | 27 | #include "definitions.h"
CustomWeakFormLinearElasticity::CustomWeakFormLinearElasticity(double E, double nu, double rho_g,
std::string surface_force_bdy, double f0, double f1) : WeakForm<double>(2)
{
double lambda = (E * nu) / ((1 + nu) * (1 - 2 * nu));
double mu = E / (2 * (1 + nu));
// Jacobian.
add_matri... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/bracket/definitions.h | .h | 465 | 16 | #include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::WeakFormsElasticity;
using namespace Hermes::Hermes2D::Views;
using namespace RefinementSelectors;
class CustomWeakFormLinearElasticity : public WeakForm <do... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/bracket/main.cpp | .cpp | 9,750 | 247 | #include "definitions.h"
// This example uses adaptive multimesh hp-FEM to solve a simple problem
// of linear elasticity. Note that since both displacement components
// have similar qualitative behavior, the advantage of the multimesh
// discretization is less striking than for example in the tutorial
// example P04... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/bracket/definitions.cpp | .cpp | 1,477 | 27 | #include "definitions.h"
CustomWeakFormLinearElasticity::CustomWeakFormLinearElasticity(double E, double nu, double rho_g,
std::string surface_force_bdy, double f0, double f1) : WeakForm<double>(2)
{
double lambda = (E * nu) / ((1 + nu) * (1 - 2 * nu));
double mu = E / (2 * (1 + nu));
// Jacobian.
add_matri... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/elasticity/bracket/generate_constants.py | .py | 682 | 31 | from numpy import arctan, sqrt, pi, sin, cos
t = 0.1 # thickness
l = 0.7 # length
a = sqrt(l**2 - (l - t)**2)
print "a =", a
alpha = arctan(t/l)
print "alpha =", alpha
beta = delta - alpha
print "beta =", beta
gamma = pi/2 - 2*delta
print "gamma =", gamma
delta = arctan(a/(l-t))
print "delta =", delta
print "alpha_d... | Python |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/horn-axisym/definitions.h | .h | 434 | 20 | #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;
/* Weak forms */
class CustomWeakFormAcoustics : public WeakForm < ::complex >
... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/horn-axisym/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/acoustics/horn-axisym/main.cpp | .cpp | 6,752 | 185 | #include "definitions.h"
// This problem describes the distribution of the vector potential in
// a 2D domain comprising a wire carrying electrical current, air, and
// an iron which is not under voltage.
//
// PDE: -div(1/rho grad p) - omega**2 / (rho c**2) * p = 0.
//
// Domain: Axisymmetric geometry of a horn,... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/horn-axisym/definitions.cpp | .cpp | 1,183 | 17 | #include "definitions.h"
CustomWeakFormAcoustics::CustomWeakFormAcoustics(std::string bdy_newton, double rho,
double sound_speed, double omega) : WeakForm<::complex>(1)
{
std::complex<double> ii = std::complex<double>(0.0, 1.0);
// Jacobian.
add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion<::complex... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/wave-propagation/definitions.h | .h | 12,354 | 286 | #include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
#pragma region forms
template<typename Scalar>
class volume_matrix_acoustic_transient_planar_linear_form_1_1 : public MatrixFormVol < Scalar >
{
public:
volume_matrix_acoustic_transient_planar_linear_form_1_1(unsigned int i, unsigned i... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/wave-propagation/test_acoustic_transient_planar.py | .py | 3,120 | 69 | import agros2d
# problem
problem = agros2d.problem(clear = True)
problem.coordinate_type = "planar"
problem.mesh_type = "triangle"
problem.matrix_solver = "umfpack"
problem.time_step_method = "fixed"
problem.time_method_order = 2
problem.time_method_tolerance = 1
problem.time_total = 0.001
problem.time_steps = 250
# ... | Python |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/wave-propagation/main.cpp | .cpp | 2,903 | 87 | #include "definitions.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
const int P_INIT = 2;
const double time_step = 4e-5;
const double end_time = 1.;
int main(int argc, char* argv[])
{
// Load the mesh.
MeshSharedPtr mesh(new Mesh);
std::vector<MeshShared... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/wave-propagation/definitions.cpp | .cpp | 10,683 | 263 | #include "definitions.h"
template <typename Scalar>
volume_matrix_acoustic_transient_planar_linear_form_1_1<Scalar>::volume_matrix_acoustic_transient_planar_linear_form_1_1(unsigned int i, unsigned int j, double ac_rho, double ac_vel)
: MatrixFormVol<Scalar>(i, j), ac_rho(ac_rho), ac_vel(ac_vel)
{
}
template <typen... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/apartment/definitions.h | .h | 430 | 19 | #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;
/* Weak forms */
class CustomWeakFormAcoustics : public WeakForm < ::complex >
... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/apartment/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/acoustics/apartment/main.cpp | .cpp | 14,364 | 391 | #include "definitions.h"
// This problem describes the distribution of the vector potential in
// a 2D domain comprising a wire carrying electrical current, air, and
// an iron which is not under voltage.
//
// PDE: -div(1/rho grad p) - omega**2 / (rho c**2) * p = 0.
//
// Domain: Floor plan of an existing apartm... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/acoustics/apartment/definitions.cpp | .cpp | 1,181 | 16 | #include "definitions.h"
CustomWeakFormAcoustics::CustomWeakFormAcoustics(std::string bdy_newton, double rho, double sound_speed, double omega) : WeakForm<::complex>(1)
{
std::complex<double> ii = std::complex<double>(0.0, 1.0);
// Jacobian.
add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion<::complex>(... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/nernst-planck/poisson-timedep-adapt/definitions.h | .h | 177 | 7 | #include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
| Unknown |
2D | hpfem/hermes-examples | 2d-advanced/nernst-planck/poisson-timedep-adapt/timestep_controller.h | .h | 3,734 | 118 | #include "definitions.h"
#define PID_DEFAULT_TOLERANCE 0.25
#define DEFAULT_STEP 0.1
class PidTimestepController {
public:
PidTimestepController(double final_time, bool pid_on = true,
double default_step = DEFAULT_STEP, double tolerance = PID_DEFAULT_TOLERANCE) {
this->delta = tolerance;
this->final_... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/nernst-planck/poisson-timedep-adapt/main.cpp | .cpp | 15,042 | 412 | #include "definitions.h"
#include "timestep_controller.h"
/** \addtogroup e_newton_np_timedep_adapt_system Newton Time-dependant System with Adaptivity
\{
\brief This example shows how to combine the automatic adaptivity with the Newton's method for a nonlinear time-dependent PDE system.
This example shows how to com... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/nernst-planck/poisson-timedep-adapt/definitions.cpp | .cpp | 16,171 | 465 | #include "definitions.h"
class ScaledWeakFormPNPCranic : public WeakForm<double> {
public:
ScaledWeakFormPNPCranic(double* tau, double epsilon,
MeshFunctionSharedPtr<double> C_prev_time, MeshFunctionSharedPtr<double> phi_prev_time) : WeakForm<double>(2) {
for(unsigned int i = 0; i < 2; i++) {
S... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/bearing/definitions.h | .h | 11,067 | 326 | #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::Hermes2D::WeakFormsH1;
class WeakFormNSSimpleLinearization : public WeakForm < double >
{
publi... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/bearing/main.cpp | .cpp | 7,825 | 204 | #include "definitions.h"
// Flow in between two circles, inner circle is rotating with surface
// velocity VEL. The time-dependent laminar incompressible Navier-Stokes equations
// are discretized in time via the implicit Euler method. The Newton's method is
// used to solve the nonlinear problem at each time step. We... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/bearing/definitions.cpp | .cpp | 19,507 | 530 | #include "definitions.h"
WeakFormNSSimpleLinearization::WeakFormNSSimpleLinearization(bool Stokes, double Reynolds, double time_step, MeshFunctionSharedPtr<double> x_vel_previous_time,
MeshFunctionSharedPtr<double> y_vel_previous_time) : WeakForm<double>(3), Stokes(Stokes),
Reynolds(Reynolds), time_step(time_ste... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/rayleigh-benard/definitions.h | .h | 246 | 9 | #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::Hermes2D::WeakFormsH1; | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/rayleigh-benard/main.cpp | .cpp | 7,351 | 186 | #include "definitions.h"
// This example solves the Rayleigh-Benard convection problem
// http://en.wikipedia.org/wiki/Rayleigh%E2%80%93B%C3%A9nard_convection.
// In this problem, a steady fluid is heated from the bottom and
// it starts to move. The time-dependent laminar incompressible Navier-Stokes
// equations are... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/rayleigh-benard/definitions.cpp | .cpp | 22,362 | 522 | #include "definitions.h"
/* Weak forms */
class WeakFormRayleighBenard : public WeakForm < double >
{
public:
WeakFormRayleighBenard(double Pr, double Ra, std::string bdy_top, double temp_ext, double alpha_air,
double time_step, MeshFunctionSharedPtr<double> x_vel_previous_time,
MeshFunctionSharedPtr<doubl... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle-adapt/definitions.h | .h | 10,196 | 314 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
class WeakFormNSSimpleLinearization : public WeakForm < double >
{
public:
WeakFormNSSimpleLinearization(bool Stokes,... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle-adapt/main.cpp | .cpp | 14,706 | 337 | #include "definitions.h"
// The time-dependent laminar incompressible Navier-Stokes equations are
// discretized in time via the implicit Euler method. The Newton's method
// is used to solve the nonlinear problem at each time step. We show how
// to use discontinuous ($L^2$) elements for pressure and thus make the
//... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle-adapt/definitions.cpp | .cpp | 20,303 | 522 | #include "definitions.h"
WeakFormNSSimpleLinearization::WeakFormNSSimpleLinearization(bool Stokes, double Reynolds, double time_step, MeshFunctionSharedPtr<double> x_vel_previous_time,
MeshFunctionSharedPtr<double> y_vel_previous_time) : WeakForm<double>(3), Stokes(Stokes),
Reynolds(Reynolds), time_step(time_ste... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/heat-subdomains/definitions.h | .h | 25,143 | 714 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* These numbers must be compatible with mesh file */
// These numbers must be compatible with mesh file.
const double... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/heat-subdomains/main.cpp | .cpp | 10,938 | 236 | #include "definitions.h"
// This example shows the use of subdomains. It models a round graphite object that is
// heated through internal heat sources and cooled with a fluid (air or water) flowing
// past it. This model is semi-realistic, double-check all parameter values and equations
// before using it for your ap... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/heat-subdomains/definitions.cpp | .cpp | 6,626 | 164 | #include "definitions.h"
/* Custom initial condition for temperature*/
CustomInitialConditionTemperature::CustomInitialConditionTemperature(MeshSharedPtr mesh, double mid_x, double mid_y, double radius, double temp_fluid, double temp_graphite)
: ExactSolutionScalar<double>(mesh), mid_x(mid_x), mid_y(mid_y), radius(... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/driven-cavity/definitions.h | .h | 7,823 | 231 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
class WeakFormNSNewton : public WeakForm < double >
{
public:
WeakFormNSNewton(bool Stokes, double Reynolds, double t... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/driven-cavity/main.cpp | .cpp | 7,454 | 200 | #include "definitions.h"
// Flow inside a rotating circle. Both the flow and the circle are not moving
// at the beginning. As the circle starts to rotate at increasing speed. also
// the flow starts to move. We use time-dependent laminar incompressible Navier-Stokes
// equations discretized in time via the implicit E... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/driven-cavity/definitions.cpp | .cpp | 13,498 | 367 | #include "definitions.h"
WeakFormNSNewton::WeakFormNSNewton(bool Stokes, double Reynolds, double time_step, MeshFunctionSharedPtr<double> x_vel_previous_time,
MeshFunctionSharedPtr<double> y_vel_previous_time) : WeakForm<double>(3), Stokes(Stokes),
Reynolds(Reynolds), time_step(time_step), x_vel_previous_time(x_... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle/definitions.h | .h | 10,449 | 303 | #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::Hermes2D::WeakFormsH1;
class WeakFormNSSimpleLinearization : public WeakForm < double >
{
publi... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle/main.cpp | .cpp | 7,352 | 194 | #include "definitions.h"
// The time-dependent laminar incompressible Navier-Stokes equations are
// discretized in time via the implicit Euler method. If NEWTON == true,
// the Newton's method is used to solve the nonlinear problem at each time
// step. We also show how to use discontinuous ($L^2$) elements for press... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/navier-stokes/circular-obstacle/definitions.cpp | .cpp | 18,941 | 509 | #include "definitions.h"
WeakFormNSSimpleLinearization::WeakFormNSSimpleLinearization(bool Stokes, double Reynolds, double time_step, MeshFunctionSharedPtr<double> x_vel_previous_time,
MeshFunctionSharedPtr<double> y_vel_previous_time) : WeakForm<double>(3), Stokes(Stokes),
Reynolds(Reynolds), time_step(time_ste... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/constitutive.h | .h | 19,616 | 478 | #define HERMES_REPORT_ALL
class ConstitutiveRelations
{
public:
ConstitutiveRelations(double alpha, double theta_s, double theta_r, double k_s) : alpha(alpha), theta_s(theta_s), theta_r(theta_r), k_s(k_s)
{}
virtual double K(double h) = 0;
virtual double dKdh(double h) = 0;
virtual double ddKdhh(double h) = 0;
... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-newton/definitions.h | .h | 2,128 | 77 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
/* Custom non-constant Dirichlet condition */
class CustomEssentialBCNonConst : public EssentialBoundaryCondition < doub... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-newton/main.cpp | .cpp | 4,864 | 145 | #include "definitions.h"
// This example solves a simple version of the time-dependent
// Richard's equation using the backward Euler method in time
// combined with the Newton's method in each time step. It describes
// infiltration into an initially dry soil. The example has a exact
// solution that is given in... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-newton/definitions.cpp | .cpp | 3,838 | 94 | #include "definitions.h"
// The pressure head is raised by H_OFFSET
// so that the initial condition can be taken
// as the zero vector. Note: the resulting
// pressure head will also be greater than the
// true one by this offset.
double H_OFFSET = 1000;
/* Custom non-constant Dirichlet condition */
EssentialBCValu... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-adapt/definitions.h | .h | 17,758 | 449 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
// The first part of the file dontains forms for the Newton's
// m... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-adapt/extras.cpp | .cpp | 14,101 | 415 | #include "definitions.h"
using namespace std;
//Debugging matrix printer.
bool printmatrix(double** A, int n, int m){
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
printf(" %lf ", A[i][j]);
}
printf(" \n");
}
printf("----------------------------------\n");
return true;
}
//Debug... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-adapt/main.cpp | .cpp | 20,846 | 503 | #include "definitions.h"
// This example uses adaptivity with dynamical meshes to solve
// the time-dependent Richard's equation. The time discretization
// is backward Euler or Crank-Nicolson, and the nonlinear solver
// in each time step is either Newton or Picard.
//
// PDE: C(h)dh/dt - div(K(h)grad(h)) - (dK/... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-adapt/definitions.cpp | .cpp | 24 | 1 | #include "definitions.h" | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-picard/definitions.h | .h | 2,124 | 77 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
/* Custom non-constant Dirichlet condition */
class CustomEssentialBCNonConst : public EssentialBoundaryCondition < doub... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-picard/main.cpp | .cpp | 4,673 | 140 | #include "definitions.h"
// This example is similar to basic-ie-newton except it uses the
// Picard's method in each time step.
//
// PDE: C(h)dh/dt - div(K(h)grad(h)) - (dK/dh)*(dh/dy) = 0
// where K(h) = K_S*exp(alpha*h) for h < 0,
// K(h) = K_S ... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-ie-picard/definitions.cpp | .cpp | 3,046 | 89 | #include "definitions.h"
// The pressure head is raised by H_OFFSET
// so that the initial condition can be taken
// as the zero vector. Note: the resulting
// pressure head will also be greater than the
// true one by this offset.
double H_OFFSET = 1e3;
/* Custom non-constant Dirichlet condition */
EssentialBCValue... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-rk/definitions.h | .h | 2,435 | 85 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
/* Custom non-constant Dirichlet condition */
class RichardsEssentialBC : public EssentialBoundaryCondition < double > {... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-rk/extras.cpp | .cpp | 13,236 | 415 | #include "definitions.h"
using namespace std;
//Debugging matrix printer.
bool printmatrix(double** A, int n, int m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
printf(" %lf ", A[i][j]);
}
printf(" \n");
}
printf("----------------------------------\n");
return true;
}
//Debugging vecto... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-rk/main.cpp | .cpp | 13,560 | 326 | #include "definitions.h"
// This example solves the time-dependent Richard's equation using
// adaptive time integration (no dynamical meshes in space yet).
// Many different time stepping methods can be used. The nonlinear
// solver in each time step is the Newton's method.
//
// PDE: C(h)dh/dt - div(K(h)grad(h)... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/capillary-barrier-rk/definitions.cpp | .cpp | 3,767 | 118 | #include "definitions.h"
// The pressure head is raised by H_OFFSET
// so that the initial condition can be taken
// as the zero vector. Note: the resulting
// pressure head will also be greater than the
// true one by this offset.
double H_OFFSET = 1000;
/* Custom weak forms */
CustomWeakFormRichardsRK::CustomWeakF... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton/definitions.h | .h | 2,161 | 78 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
/* Custom non-constant Dirichlet condition */
class CustomEssentialBCNonConst : public EssentialBoundaryCondition < doub... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton/main.cpp | .cpp | 6,649 | 169 | #include "definitions.h"
// This example solves the Tracy problem with arbitrary Runge-Kutta
// methods in time.
//
// PDE: C(h)dh/dt - div(K(h)grad(h)) - (dK/dh)*(dh/dy) = 0
// where K(h) = K_S*exp(alpha*h) for h < 0,
// K(h) = K_S for h >= 0,
... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton/definitions.cpp | .cpp | 4,329 | 108 | #include "definitions.h"
// The pressure head is raised by H_OFFSET
// so that the initial condition can be taken
// as the zero vector. Note: the resulting
// pressure head will also be greater than the
// true one by this offset.
double H_OFFSET = 1000;
/* Custom non-constant Dirichlet condition */
EssentialBCValu... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton-adapt/definitions.h | .h | 2,215 | 78 | #include "hermes2d.h"
#include "../constitutive.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* Custom non-constant Dirichlet condition */
class CustomEssenti... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton-adapt/plot_graph.py | .py | 666 | 32 | # import libraries
import numpy, pylab
from pylab import *
# plot DOF convergence graph
pylab.title("Number of DOF as a function of physical time")
pylab.xlabel("Physical time")
pylab.ylabel("Number of DOF")
axis('equal')
data = numpy.loadtxt("conv_dof_est.dat")
x = data[:, 0]
y = data[:, 1]
loglog(x, y, '-s', label="... | Python |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton-adapt/main.cpp | .cpp | 11,162 | 277 | #include "definitions.h"
// This example uses adaptivity with dynamical meshes to solve
// the Tracy problem with arbitrary Runge-Kutta methods in time.
//
// PDE: C(h)dh/dt - div(K(h)grad(h)) - (dK/dh)*(dh/dy) = 0
// where K(h) = K_S*exp(alpha*h) for h < 0,
// K(h) = K_S ... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/basic-rk-newton-adapt/definitions.cpp | .cpp | 4,259 | 108 | #include "definitions.h"
// The pressure head is raised by H_OFFSET
// so that the initial condition can be taken
// as the zero vector. Note: the resulting
// pressure head will also be greater than the
// true one by this offset.
double H_OFFSET = 1000;
/* Custom non-constant Dirichlet condition */
EssentialBCValu... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/definitions.h | .h | 20,821 | 698 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
// Global variables for forms.
double K_S, ALPHA, THETA_R, THETA_S, N, M;
// Problem parameters.
const double TAU = 5e... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/constitutive_genuchten.cpp | .cpp | 4,722 | 113 | // K (van Genuchten).
double K(double h)
{
double alpha;
double n;
double m;
alpha = ALPHA;
n = N;
m = M;
if (h < 0) return
K_S*pow((1 + pow((-alpha*h),n)),(-m/2))*pow((1 -
pow((-alpha*h),(m*n))*pow((1 + pow((-alpha*h),n)),(-m))),2) ;
else return K_S;
}
// dK/dh (van Genuchten).
double ... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/main.cpp | .cpp | 12,877 | 355 | #include "definitions.h"
// This example uses adaptivity with dynamical meshes to solve
// the time-dependent Richard's equation. The time discretization
// is backward Euler or Crank-Nicolson, and the Newton's method
// is applied to solve the nonlinear problem in each time step.
//
// PDE: C(h)dh/dt - div(K(... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/constitutive_gardner.cpp | .cpp | 634 | 37 | // K (Gardner).
double K(double h)
{
if (h < 0) return K_S*exp(ALPHA*h);
else return K_S;
}
// dK/dh (Gardner).
double dKdh(double h)
{
if (h < 0) return K_S*ALPHA*exp(ALPHA*h);
else return 0;
}
// ddK/dhh (Gardner).
double ddKdhh(double h)
{
if (h < 0) return K_S*ALPHA*ALPHA*exp(ALPHA*h);
else return... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/constitutive.cpp | .cpp | 3,703 | 115 | // K (Gardner).
double K_Gardner(double h)
{
if (h < 0) return K_S*exp(ALPHA*h);
else return K_S;
}
// K (van Genuchten).
double K(double h)
{
if (h < 0) return (1-pow(-ALPHA*h,M*N)*pow((1+pow(-ALPHA*h,N)),-M))*
(1-pow(-ALPHA*h,M*N)*pow((1+pow(-ALPHA*h,N)),-M))/
(pow(1 + p... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/richards/seepage-adapt/definitions.cpp | .cpp | 0 | 0 | null | C++ |
2D | hpfem/hermes-examples | 2d-advanced/helmholtz/waveguide/definitions.h | .h | 10,046 | 277 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* Essential boundary conditions */
class EssentialBCNonConst : public EssentialBoundaryCondition < double >
{
public:... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/helmholtz/waveguide/main.cpp | .cpp | 5,604 | 165 | #include "definitions.h"
// This example shows how to model harmonic steady state in parallel plate waveguide.
// The complex-valued Helmholtz equation is solved by decomposing it into two equations
// for the real and imaginary part of the E field. Two typical boundary conditions used in
// high-frequency problems ar... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/helmholtz/waveguide/definitions.cpp | .cpp | 11,360 | 285 | #include "definitions.h"
EssentialBCNonConst::EssentialBCNonConst(std::string marker)
: EssentialBoundaryCondition<double>(std::vector<std::string>())
{
markers.push_back(marker);
}
EssentialBCValueType EssentialBCNonConst::get_value_type() const
{
return BC_FUNCTION;
}
double EssentialBCNonConst::value(double... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/maxwell-debye-rk/definitions.h | .h | 7,507 | 222 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* Global function alpha */
double alpha(double omega, double k);
/* Initial condition for E */
class CustomInitialC... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/maxwell-debye-rk/main.cpp | .cpp | 15,007 | 348 | #include "definitions.h"
// This example is a simple test case for the Debye-Maxwell model solved in terms of
// E, H and P. Here E is electric field (vector), H magnetic field (scalar), and P
// electric polarization (vector). The example comes with a known exact solution.
// Time discretization is performed using an... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/maxwell-debye-rk/definitions.cpp | .cpp | 11,472 | 325 | #include "definitions.h"
template<typename Real, typename Scalar>
static Scalar int_e_f(int n, double *wt, Func<Real> *u, Func<Real> *v)
{
Scalar result = Scalar(0);
for (int i = 0; i < n; i++)
result += wt[i] * (u->val0[i] * conj(v->val0[i]) + u->val1[i] * conj(v->val1[i]));
return result;
}
/* Global func... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/magnetostatics-actuator/definitions.h | .h | 1,186 | 34 | #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::Hermes2D::WeakFormsH1;
using namespace Hermes::Hermes2D::WeakFormsMaxwell;
/* Weak forms */
cl... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/magnetostatics-actuator/main.cpp | .cpp | 5,390 | 145 | #include "definitions.h"
// This example shows how to handle stiff nonlinear problems.
//
// PDE: magnetostatics with nonlinear magnetic permeability
// curl[1/mu curl u] = current_density.
// The following parameters can be changed:
// Initial polynomial degree.
const int P_INIT = 3;
// Stopping criterion for t... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/magnetostatics-actuator/definitions.cpp | .cpp | 2,051 | 45 | #include "definitions.h"
CustomWeakFormMagnetostatics::CustomWeakFormMagnetostatics(std::string material_iron_1, std::string material_iron_2,
CubicSpline* mu_inv_iron, std::string material_air,
std::string material_copper, double mu_vacuum,
double current_density, int order_inc) : WeakForm<double>(1)
{
// Jaco... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/magnetostatics-actuator/plot_spline.py | .py | 299 | 18 | # import libraries
import numpy, pylab
from pylab import *
data = numpy.loadtxt("spline.dat")
x = data[:, 0]
y = data[:, 1]
plot(x, y, '-o', label="cubic spline")
data = numpy.loadtxt("spline_der.dat")
x = data[:, 0]
y = data[:, 1]
plot(x, y, '-*', label="derivative")
legend()
# finalize
show()
| Python |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-II-ie/definitions.h | .h | 4,008 | 124 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* Weak forms */
class CustomWeakFormWaveIE : public WeakForm < double >
{
public:
CustomWeakFormWaveIE(double tau,... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-II-ie/main.cpp | .cpp | 5,421 | 149 | #include "definitions.h"
// This example solves a time-domain resonator problem for the Maxwell's equation.
// It is very similar to resonator-time-domain-I but B is eliminated from the
// equations, thus converting the first-order system into one second -order
// equation in time. The second-order equation in time is... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-II-ie/definitions.cpp | .cpp | 6,494 | 180 | #include "definitions.h"
template<typename Real, typename Scalar>
static Scalar int_e_f(int n, double *wt, Func<Real> *u, Func<Real> *v)
{
Scalar result = Scalar(0);
for (int i = 0; i < n; i++)
result += wt[i] * (u->val0[i] * conj(v->val0[i]) + u->val1[i] * conj(v->val1[i]));
return result;
}
template<typen... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/profile-conductor/definitions.h | .h | 32,103 | 611 | #include "hermes2d.h"
using namespace Hermes;
using namespace Hermes::Hermes2D;
template<typename Scalar>
class volume_matrix_magnetic_harmonic_planar_linear_harmonic_laplace_1_1_1_1 : public MatrixFormVol<Scalar>
{
public:
volume_matrix_magnetic_harmonic_planar_linear_harmonic_laplace_1_1_1_1(unsigned int i, unsig... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/profile-conductor/main.cpp | .cpp | 0 | 0 | null | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/profile-conductor/definitions.cpp | .cpp | 69,070 | 1,430 | #include "definitions.h"
template <typename Scalar>
volume_matrix_magnetic_harmonic_planar_linear_harmonic_laplace_1_1_1_1<Scalar>::volume_matrix_magnetic_harmonic_planar_linear_harmonic_laplace_1_1_1_1(unsigned int i, unsigned int j, int offsetI, int offsetJ)
: MatrixFormVolAgros<Scalar>(i, j, offsetI, offsetJ)
{
}
... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-I/definitions.h | .h | 3,520 | 114 | #include "hermes2d.h"
/* Namespaces used */
using namespace Hermes;
using namespace Hermes::Hermes2D;
using namespace Hermes::Hermes2D::Views;
using namespace Hermes::Hermes2D::RefinementSelectors;
/* Initial condition for E */
class CustomInitialConditionWave : public ExactSolutionVector < double >
{
public:
Cus... | Unknown |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-I/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/maxwell/resonator-time-domain-I/main.cpp | .cpp | 5,623 | 139 | #include "definitions.h"
// This example shows how to discretize the first-order time-domain Maxwell's equations
// with vector-valued E (an Hcurl function) and double B (an H1 function). Time integration
// is done using an arbitrary R-K method (see below).
//
// PDE: \partial E / \partial t - SPEED_OF_LIGHT**2 * cur... | C++ |
2D | hpfem/hermes-examples | 2d-advanced/maxwell/resonator-time-domain-I/definitions.cpp | .cpp | 4,898 | 156 | #include "definitions.h"
using namespace WeakFormsHcurl;
Scalar2<double> CustomInitialConditionWave::value(double x, double y) const
{
return Scalar2<double>(std::sin(x) * std::cos(y), -std::cos(x) * std::sin(y));
}
void CustomInitialConditionWave::derivatives(double x, double y, Scalar2<double>& dx, Scalar2<doubl... | C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.