64 #ifndef MADNESS_INTERIOR_BC_TEST_PROBLEMS_H__INCLUDED
65 #define MADNESS_INTERIOR_BC_TEST_PROBLEMS_H__INCLUDED
84 : leaf_value(leaf_value), parent_value(parent_value) {}
89 if(key.
level() <= 1) {
90 return 100.0*(leaf_value+parent_value);
113 double penalty_prefact,
eps;
135 sdfi(nullptr), penalty_prefact(penalty_prefact), eps(eps),
141 initial_level = ceil(log(4.0 / eps) / log(2.0) - 4);
142 if(initial_level < 6)
148 domain_mask_name =
"LLRV";
152 domain_mask_name =
"Gaussian";
156 error(
"Unknown mask");
181 printf(
"Solving problem: %s\nWavelet Order: %d\nThreshold: %.6e" \
182 "\nEpsilon: %.6e\nPenalty Prefactor, %s: %.6e\nUsing %s " \
183 "domain masking\n%s\n",
184 problem_name.c_str(),
k,
thresh, eps, penalty_name.c_str(),
185 penalty_prefact, domain_mask_name.c_str(),
186 problem_specific_info.c_str());
198 return -DirichletCond(x) * dmi->
surface(sdfi->
sdf(x)) *
201 return dmi->
mask(sdfi->
sdf(x)) * Inhomogeneity(x) -
202 DirichletCond(x) * dmi->
surface(sdfi->
sdf(x)) *
206 return dmi->
surface(sdfi->
sdf(x)) * penalty_prefact;
209 return dmi->
mask(sdfi->
sdf(x));
212 error(
"shouldn't be here...");
232 virtual std::vector< Vector<double, 3> >
check_pts()
const {
233 return std::vector< Vector<double, 3> >();
246 double penalty_prefact,
double radius,
Mask mask)
251 sprintf(str,
"Sphere radius: %.6e\n", radius);
252 problem_specific_info = str;
253 problem_name =
"Constant Sphere";
265 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
285 virtual std::vector< Vector<double, 3> >
check_pts()
const {
286 std::vector< Vector<double, 3> >
vec;
290 pt[2] = 0.1 * radius;
312 double penalty_prefact,
double radius,
Mask mask)
317 sprintf(str,
"Sphere radius: %.6e\n", radius);
318 problem_specific_info = str;
319 problem_name =
"Inhomogeneous Constant Sphere";
331 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
334 return r*r / (radius*radius);
340 return 6.0 / (radius*radius);
351 virtual std::vector< Vector<double, 3> >
check_pts()
const {
352 std::vector< Vector<double, 3> >
vec;
356 pt[2] = 0.1 * radius;
378 double penalty_prefact,
double radius,
Mask mask)
383 sprintf(str,
"Sphere radius: %.6e\n", radius);
384 problem_specific_info = str;
385 problem_name =
"Cosine Sphere";
393 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
402 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
405 return x[2] / radius;
407 return x[2] * radius * radius / (r*r*r);
422 virtual std::vector< Vector<double, 3> >
check_pts()
const {
423 std::vector< Vector<double, 3> >
vec;
427 pt[2] = 0.1 * radius;
449 double penalty_prefact,
double radius,
Mask mask)
454 sprintf(str,
"Sphere radius: %.6e\n", radius);
455 problem_specific_info = str;
456 problem_name =
"Y20 Sphere";
464 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
469 return 3.0* x[2] * x[2] / (r*r) - 1.0;
473 double r = sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
477 return (3.0*x[2]*x[2] - r*r) / (radius * radius);
479 return radius*radius*radius / (r*r*r) * (3.0*x[2]*x[2]/(r*r) - 1.0);
494 virtual std::vector< Vector<double, 3> >
check_pts()
const {
495 std::vector< Vector<double, 3> >
vec;
499 pt[2] = 0.1 * radius;
532 outvec = invec +
G(
f);
The constant on a sphere problem.
Definition: test_problems.h:238
double SurfaceIntegral() const
The surface area of the domain.
Definition: test_problems.h:277
double ExactSol(const Vector< double, 3 > &x) const
Definition: test_problems.h:264
double VolumeIntegral() const
The volume of the domain.
Definition: test_problems.h:281
bool isHomogeneous() const
Definition: test_problems.h:242
double radius
Definition: test_problems.h:240
ConstantSphere(int k, double thresh, double eps, std::string penalty_name, double penalty_prefact, double radius, Mask mask)
Definition: test_problems.h:245
double Inhomogeneity(const Vector< double, 3 > &x) const
Definition: test_problems.h:273
virtual std::vector< Vector< double, 3 > > check_pts() const
A list of points where we should compare the computed solution to the exact solution.
Definition: test_problems.h:285
double DirichletCond(const Vector< double, 3 > &x) const
Definition: test_problems.h:260
The cos(theta) on a sphere problem.
Definition: test_problems.h:370
CosineSphere(int k, double thresh, double eps, std::string penalty_name, double penalty_prefact, double radius, Mask mask)
Definition: test_problems.h:377
virtual std::vector< Vector< double, 3 > > check_pts() const
A list of points where we should compare the computed solution to the exact solution.
Definition: test_problems.h:422
double DirichletCond(const Vector< double, 3 > &x) const
Definition: test_problems.h:392
double SurfaceIntegral() const
The surface area of the domain.
Definition: test_problems.h:414
double ExactSol(const Vector< double, 3 > &x) const
Definition: test_problems.h:401
double VolumeIntegral() const
The volume of the domain.
Definition: test_problems.h:418
bool isHomogeneous() const
Definition: test_problems.h:374
double radius
Definition: test_problems.h:372
double Inhomogeneity(const Vector< double, 3 > &x) const
Definition: test_problems.h:410
The operator needed for solving for with GMRES.
Definition: test_problems.h:513
DirichletCondIntOp(const SeparatedConvolution< double, 3 > &gin, const Function< double, 3 > &bin)
Definition: test_problems.h:539
void action(const Function< double, 3 > &invec, Function< double, 3 > &outvec) const
Applies the operator to invec.
Definition: test_problems.h:526
const SeparatedConvolution< double, 3 > & G
The Green's function.
Definition: test_problems.h:516
const Function< double, 3 > & b
The surface function (normalized)
Definition: test_problems.h:518
Abstract base class for embedded Dirichlet problems.
Definition: test_problems.h:102
double thresh
Definition: test_problems.h:107
EmbeddedDirichlet()
Definition: test_problems.h:104
int k
Definition: test_problems.h:106
virtual double VolumeIntegral() const =0
The volume of the domain.
FunctorOutput fop
Definition: test_problems.h:127
virtual double Inhomogeneity(const Vector< double, 3 > &x) const =0
double eps
Definition: test_problems.h:113
virtual double ExactSol(const Vector< double, 3 > &x) const =0
SignedDFInterface< 3 > * sdfi
Definition: test_problems.h:112
EmbeddedDirichlet(double penalty_prefact, std::string penalty_name, double eps, int k, double thresh, Mask mask)
Sets up the data for the problem-inspecific parts.
Definition: test_problems.h:132
virtual std::vector< Vector< double, 3 > > check_pts() const
A list of points where we should compare the computed solution to the exact solution.
Definition: test_problems.h:232
DomainMaskInterface * dmi
Definition: test_problems.h:111
virtual double DirichletCond(const Vector< double, 3 > &x) const =0
std::string penalty_name
Definition: test_problems.h:108
virtual double SurfaceIntegral() const =0
The surface area of the domain.
void printout() const
Do a standard Printout of the problem details.
Definition: test_problems.h:180
std::string problem_name
Definition: test_problems.h:114
void load_balance(World &world, const Function< double, 3 > &f) const
Load balances using the provided Function.
Definition: test_problems.h:169
virtual bool isHomogeneous() const =0
std::string domain_mask_name
Definition: test_problems.h:116
std::string problem_specific_info
Definition: test_problems.h:115
virtual ~EmbeddedDirichlet()
Definition: test_problems.h:161
int initial_level
Definition: test_problems.h:105
Definition: test_derivative.cc:24
Definition: dataloadbal.cc:141
The constant on a sphere problem, with inhomogeneity.
Definition: test_problems.h:304
double DirichletCond(const Vector< double, 3 > &x) const
Definition: test_problems.h:326
bool isHomogeneous() const
Definition: test_problems.h:308
double radius
Definition: test_problems.h:306
double SurfaceIntegral() const
The surface area of the domain.
Definition: test_problems.h:343
virtual std::vector< Vector< double, 3 > > check_pts() const
A list of points where we should compare the computed solution to the exact solution.
Definition: test_problems.h:351
double Inhomogeneity(const Vector< double, 3 > &x) const
Definition: test_problems.h:339
double ExactSol(const Vector< double, 3 > &x) const
Definition: test_problems.h:330
double VolumeIntegral() const
The volume of the domain.
Definition: test_problems.h:347
InhomoConstantSphere(int k, double thresh, double eps, std::string penalty_name, double penalty_prefact, double radius, Mask mask)
Definition: test_problems.h:311
The Y_2^0 on a sphere problem.
Definition: test_problems.h:441
bool isHomogeneous() const
Definition: test_problems.h:445
double radius
Definition: test_problems.h:443
virtual std::vector< Vector< double, 3 > > check_pts() const
A list of points where we should compare the computed solution to the exact solution.
Definition: test_problems.h:494
double SurfaceIntegral() const
The surface area of the domain.
Definition: test_problems.h:486
double DirichletCond(const Vector< double, 3 > &x) const
Definition: test_problems.h:463
double ExactSol(const Vector< double, 3 > &x) const
Definition: test_problems.h:472
double Inhomogeneity(const Vector< double, 3 > &x) const
Definition: test_problems.h:482
double VolumeIntegral() const
The volume of the domain.
Definition: test_problems.h:490
Y20Sphere(int k, double thresh, double eps, std::string penalty_name, double penalty_prefact, double radius, Mask mask)
Definition: test_problems.h:448
The interface for masking functions defined by signed distance functions.
Definition: sdf_domainmask.h:104
virtual double mask(double d) const =0
Returns the characteristic mask function.
virtual double surface(double d) const =0
Returns the value of the normalized surface layer function.
static void redistribute(World &world, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &newpmap)
Sets the default process map and redistributes all functions using the old map.
Definition: funcdefaults.h:513
static void set_initial_level(int value)
Sets the default initial projection level.
Definition: funcdefaults.h:303
Abstract base class interface required for functors used as input to Functions.
Definition: function_interface.h:68
FunctionNode holds the coefficients, etc., at each node of the 2^NDIM-tree.
Definition: funcimpl.h:124
bool is_leaf() const
Returns true if this does not have children.
Definition: funcimpl.h:209
Function< T, NDIM > & scale(const Q q, bool fence=true)
Inplace, scale the function by a constant. No communication except for optional fence.
Definition: mra.h:953
Function< T, NDIM > & truncate(double tol=0.0, bool fence=true)
Truncate the function with optional fence. Compresses with fence if not compressed.
Definition: mra.h:602
Use a Gaussian for the surface function and the corresponding erf for the domain mask.
Definition: sdf_domainmask.h:374
Key is the index for a node of the 2^NDIM-tree.
Definition: key.h:66
Level level() const
Definition: key.h:159
Provides the Li-Lowengrub-Ratz-Voight (LLRV) domain mask characteristic functions.
Definition: sdf_domainmask.h:301
std::shared_ptr< WorldDCPmapInterface< keyT > > load_balance(double fac=1.0, bool printstuff=false)
Actually does the partitioning of the tree.
Definition: lbdeux.h:320
void add_tree(const Function< T, NDIM > &f, const costT &costfn, bool fence=false)
Accumulates cost from a function.
Definition: lbdeux.h:289
A generic operator: takes in one T and produces another T.
Definition: gmres.h:62
A spherical surface (3 dimensions)
Definition: sdf_shape_3D.h:103
virtual double sdf(const Vector< double, NDIM > &x) const =0
Returns the signed distance from the surface,.
A parallel world class.
Definition: world.h:132
real_function_3d mask
Definition: dirac-hatom.cc:27
Implements (2nd generation) static load/data balancing for functions.
Main include file for MADNESS and defines Function interface.
const double pi
Mathematical constant .
Definition: constants.h:48
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
NDIM & f
Definition: mra.h:2416
void error(const char *msg)
Definition: world.cc:139
Vector< T, sizeof...(Ts)+1 > vec(T t, Ts... ts)
Factory function for creating a madness::Vector.
Definition: vector.h:711
static const double b
Definition: nonlinschro.cc:119
static const double thresh
Definition: rk.cc:45
static const long k
Definition: rk.cc:44
Implements the SignedDFInterface for common 3-D geometric objects.
Definition: test_problems.h:80
double parent_value
Definition: test_problems.h:82
double leaf_value
Definition: test_problems.h:81
DirichletLBCost(double leaf_value=1.0, double parent_value=1.0)
Definition: test_problems.h:83
pcomplex_operatorT G
Definition: tdse1d.cc:167
Mask
Definition: test_problems.h:74
@ LLRV
Definition: test_problems.h:74
@ Gaussian
Definition: test_problems.h:74
FunctorOutput
Definition: test_problems.h:76
@ EXACT
Definition: test_problems.h:76
@ DIRICHLET_RHS
Definition: test_problems.h:76
@ DOMAIN_MASK
Definition: test_problems.h:76
@ SURFACE
Definition: test_problems.h:76