Commit 5d92109d authored by Lukas Riedel's avatar Lukas Riedel

Merge branch 'cleanup/dg-operator' into 'master'

add offset to parameter queries at intersections

Closes #20

See merge request !3
parents 12c888a7 ef1b4908
This diff is collapsed.
#ifndef DUNE_DORIE_ERROR_INDICATOR_HH
#define DUNE_DORIE_ERROR_INDICATOR_HH
#include<dune/geometry/referenceelements.hh>
#include<dune/pdelab/common/referenceelements.hh>
#include<dune/pdelab/common/quadraturerules.hh>
#include<dune/pdelab/localoperator/pattern.hh>
#include<dune/pdelab/localoperator/flags.hh>
#include<dune/pdelab/localoperator/idefault.hh>
#include<dune/pdelab/localoperator/defaultimp.hh>
#include<dune/pdelab/finiteelement/localbasiscache.hh>
namespace Dune {
......@@ -85,23 +95,22 @@ namespace Dune {
// geometric factor of penalty
const RF h_F = std::min(ig.inside().geometry().volume(),ig.outside().geometry().volume())/ig.geometry().volume(); // Houston!
// select quadrature rule
Dune::GeometryType gtface = ig.geometry().type();
const Dune::QuadratureRule<DF,dim-1>& rule = Dune::QuadratureRules<DF,dim-1>::rule(gtface,intorder);
// get element geometry
auto gtface = ig.geometry();
// container for sum of errors
RF sum(0.0);
int counter = 0;
// loop over quadrature points and integrate normal flux
for (typename Dune::QuadratureRule<DF,dim-1>::const_iterator it = rule.begin(); it != rule.end(); ++it)
const auto quadrature_rule = quadratureRule(gtface,intorder);
for (const auto& it : quadrature_rule)
{
const Dune::FieldVector<DF,dim> n_F = ig.unitOuterNormal(it->position());
// retrieve unit normal vector
const Dune::FieldVector<DF,dim> n_F = ig.unitOuterNormal(it.position());
// position of quadrature point in local coordinates of elements
const Domain local_s = ig.geometryInInside().global(it->position());
const Domain local_n = ig.geometryInOutside().global(it->position());
const Domain local_s = ig.geometryInInside().global(it.position());
const Domain local_n = ig.geometryInOutside().global(it.position());
// evaluate basis functions
std::vector<Scalar> phi_s(lfsu_s.size());
......@@ -142,15 +151,22 @@ namespace Dune {
for (unsigned int i = 0; i<lfsu_n.size(); i++)
gradu_n.axpy(x_n(lfsu_n,i),tgradphi_n[i]);
// offset for parameter queries
const RF eps = 1e-9;
// parameter queries: inside
const Domain xGlobal_s = ig.inside().geometry().global(local_s);
Domain xGlobal_s = ig.inside().geometry().global(local_s);
xGlobal_s = xGlobal_s.axpy(-eps,n_F);
const RF head_s = param.headMillerToRef(u_s,xGlobal_s);
const RF satCond_s = param.condRefToMiller(param.K(xGlobal_s),xGlobal_s);
const RF saturation_s = param.saturation(head_s,xGlobal_s);
const RF condFactor_s = param.condFactor(saturation_s,xGlobal_s);
// outside
const Domain xGlobal_n = ig.outside().geometry().global(local_n);
Domain xGlobal_n = ig.outside().geometry().global(local_n);
xGlobal_n = xGlobal_n.axpy(eps,n_F);
const RF head_n = param.headMillerToRef(u_n,xGlobal_n);
const RF satCond_n = param.condRefToMiller(param.K(xGlobal_n),xGlobal_n);
const RF saturation_n = param.saturation(head_n,xGlobal_n);
......@@ -182,14 +198,14 @@ namespace Dune {
const RF jump = omega_s * condFactor_s * numFlux_s - omega_n * condFactor_n * numFlux_n;
// integration factor
const RF factor = it->weight() * ig.geometry().integrationElement(it->position());
const RF factor = it.weight() * ig.geometry().integrationElement(it.position());
// add square of error
sum += jump*jump*factor*factor;
counter++;
}
// correct for the number of neighbors
sum *= 1. / counter;
sum *= 1. / quadrature_rule.size();
// what is this variable for?
DF h_T = 1;//std::max( diameter(ig.inside().geometry()),
......@@ -225,3 +241,5 @@ namespace Dune {
}
}
#endif // DUNE_DORIE_ERROR_INDICATOR_HH
\ No newline at end of file
......@@ -34,7 +34,7 @@ namespace Dune {
const InterpolationMethod method;
explicit InterpolatorBase(InterpolationMethod method_, const ParameterTree& config_, const Dune::MPIHelper& helper_, const int verbose_):
config(config_), helper(helper_), verbose(verbose_), eps(1e-8), initialized(false), method(method_)
config(config_), helper(helper_), verbose(verbose_), eps(1e-9), initialized(false), method(method_)
{}
RF evaluate(const Array& field, const Domain& pos)
......
......@@ -76,7 +76,7 @@ def evaluate(iniinfo,runtime):
r_y = []
for t in y:
if t - r.t > 1E-6: # ODE solver can't handle step sizes of ~ 0
if t - r.t > 1E-7: # ODE solver can't handle step sizes of ~ 0
r.integrate(t)
r_y.append(r.y[0])
r_y = np.array(r_y)
......
......@@ -10,8 +10,20 @@ function(dorie_add_system_test_dependency test1 test2)
endfunction()
# dorie run
dorie_add_system_test(dorie ode.mini)
dorie_add_system_test(dorie ode_higherorder.mini)
dorie_add_system_test(dorie ode_homogeneous_1.mini)
dorie_add_system_test(dorie ode_homogeneous_1_adapt.mini)
dorie_add_system_test(dorie ode_homogeneous_2.mini)
dorie_add_system_test(dorie ode_homogeneous_2_adapt.mini)
dorie_add_system_test(dorie ode_homogeneous_3.mini)
dorie_add_system_test(dorie ode_homogeneous_3_adapt.mini)
dorie_add_system_test(dorie ode_heterogeneous_1.mini)
dorie_add_system_test(dorie ode_heterogeneous_1_adapt.mini)
dorie_add_system_test(dorie ode_heterogeneous_2.mini)
dorie_add_system_test(dorie ode_heterogeneous_2_adapt.mini)
dorie_add_system_test(dorie ode_heterogeneous_3.mini)
dorie_add_system_test(dorie ode_heterogeneous_3_adapt.mini)
dorie_add_system_test(dorie ode_evaporation.mini)
dorie_add_system_test(dorie ode_linear_interpolator.mini)
dorie_add_system_test(dorie muphi.mini)
......
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode
__name = ode_heterogeneous_1
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode | unique
output.outputPath = ode | unique
output.fileName = ode_homogeneous_1 | unique
output.outputPath = ode_homogeneous_1 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.threshold = 1E-8
adaptivity.useAdaptivity = false, true | expand distribution
grid.gridType = rectangular, gmsh | expand gridtype
grid.cells = 1 100
grid.initialLevel = 3, 0 | expand distribution
grid.gridFile = "{_asset_path}/meshes/square.msh"
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
adaptivity.useAdaptivity = false
parameters.arrayFile = "{_asset_path}/parfields/sand.h5", "{_asset_path}/parfields/layered.h5" | expand distribution
grid.FEorder = 1
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 10, 1 640 | expand prec
[_ode]
flux = -3e-6
head_abstol = 1E-5, 5E-4 | expand gridtype
flux_abstol = 1E-8, 5E-7 | expand gridtype
head_abstol = 2E-3, 3E-5 | expand prec
flux_abstol = 6E-8, 7E-9 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-8
Reduction = 1E-8
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_higherorder
__name = ode_heterogeneous_1_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_higherorder | unique
output.outputPath = ode_higherorder | unique
output.fileName = ode_heterogeneous_1_adapt | unique
output.outputPath = ode_heterogeneous_1_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.threshold = 1E-8
adaptivity.useAdaptivity = false, true | expand distribution
grid.FEorder = 2, 3 | expand feorder
grid.gridType = gmsh, rectangular | expand distribution
# higher FEorders seem to have a problem with asymmetric grids
grid.cells = 5 20
grid.initialLevel = 2, 0 | expand distribution
grid.gridFile = "{_asset_path}/meshes/square.msh"
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-7, 1E-8 | expand prec
adaptivity.coarseningFraction = 1E-8, 1E-9 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
parameters.arrayFile = "{_asset_path}/parfields/sand.h5", "{_asset_path}/parfields/layered.h5" | expand distribution
grid.FEorder = 1
grid.gridType = rectangular
grid.initialLevel = 2
grid.cells = 1 10
[_ode]
flux = -3e-6
head_abstol = 1E-5
flux_abstol = 2E-8
head_abstol = 3E-4, 4E-5 | expand prec
flux_abstol = 4E-8, 1E-8 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-8
Reduction = 1E-8
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_heterogeneous_2
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_2 | unique
output.outputPath = ode_homogeneous_2 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = false
grid.FEorder = 2
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 10, 1 320 | expand prec
[_ode]
flux = -3e-6
head_abstol = 6E-4, 2E-5 | expand prec
flux_abstol = 4E-8, 4E-9 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_heterogeneous_2_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_heterogeneous_2_adapt | unique
output.outputPath = ode_heterogeneous_2_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-7, 1E-8 | expand prec
adaptivity.coarseningFraction = 1E-8, 1E-9 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
grid.FEorder = 2
grid.gridType = rectangular
grid.initialLevel = 2
grid.cells = 1 10
[_ode]
flux = -3e-6
head_abstol = 3E-5, 5E-6 | expand prec
flux_abstol = 3E-8, 3E-8 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_heterogeneous_3
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_3 | unique
output.outputPath = ode_homogeneous_3 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = false
grid.FEorder = 3
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 10, 1 160 | expand prec
[_ode]
flux = -3e-6
head_abstol = 3E-4, 2E-5 | expand prec
flux_abstol = 2E-8, 4E-9 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_heterogeneous_3_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_heterogeneous_3_adapt | unique
output.outputPath = ode_heterogeneous_3_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/layered.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-7, 5E-8 | expand prec
adaptivity.coarseningFraction = 1E-8, 5E-9 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
grid.FEorder = 3
grid.gridType = rectangular
grid.initialLevel = 2
grid.cells = 1 10
[_ode]
flux = -3e-6
head_abstol = 3E-5, 2E-5 | expand prec
flux_abstol = 1E-8, 7E-9 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_1
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_1 | unique
output.outputPath = ode_homogeneous_1 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = false
grid.FEorder = 1
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 10, 1 640 | expand prec
[_ode]
flux = -3e-6
head_abstol = 6E-4, 2E-7 | expand prec
flux_abstol = 2E-8, 3E-12 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_1_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_1_adapt | unique
output.outputPath = ode_homogeneous_1_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-7, 1E-9 | expand prec
adaptivity.coarseningFraction = 1E-8, 1E-10 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
grid.FEorder = 1
grid.gridType = rectangular
grid.initialLevel = 2
grid.cells = 1 5
[_ode]
flux = -3e-6
head_abstol = 3E-4, 4E-6 | expand prec
flux_abstol = 2E-8, 2E-10 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_2
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_2 | unique
output.outputPath = ode_homogeneous_2 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
grid.FEorder = 2
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 5, 1 40 | expand prec
[_ode]
flux = -3e-6
head_abstol = 7E-5, 3E-8 | expand prec
flux_abstol = 6E-8, 9E-10 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_2_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_2_adapt | unique
output.outputPath = ode_homogeneous_2_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-8, 1E-11 | expand prec
adaptivity.coarseningFraction = 1E-9, 1E-12 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
grid.FEorder = 2
grid.gridType = rectangular
grid.initialLevel = 2
grid.cells = 1 5
[_ode]
flux = -3e-6
head_abstol = 2E-5, 2E-7 | expand prec
flux_abstol = 3E-8, 2E-10 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_3
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_3 | unique
output.outputPath = ode_homogeneous_3 | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
grid.FEorder = 3
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 5, 1 40 | expand prec
[_ode]
flux = -3e-6
head_abstol = 2E-5, 2E-8 | expand prec
flux_abstol = 7E-10, 3E-13 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = ode_homogeneous_3_adapt
_test_command = run
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_evaluation = ode
output.fileName = ode_homogeneous_3_adapt | unique
output.outputPath = ode_homogeneous_3_adapt | unique
output.verbose = 0
boundary.file = "{_asset_path}/bcs/infiltration_2d.dat"
parameters.arrayFile = "{_asset_path}/parfields/sand.h5"
time.end = 1E7
time.maxTimestep = 1E7
time.startTimestep = 1E4
adaptivity.useAdaptivity = true
adaptivity.markingStrategy = threshold
adaptivity.refinementFraction = 1E-9, 1E-10 | expand prec
adaptivity.coarseningFraction = 1E-10, 1E-11 | expand prec
adaptivity.maxLevel = 99
adaptivity.threshold = 1E-16
grid.FEorder = 3
grid.gridType = rectangular
grid.initialLevel = 0
grid.cells = 1 5
[_ode]
flux = -3e-6
head_abstol = 3E-6, 3E-7 | expand prec
flux_abstol = 6E-11, 1E-11 | expand prec
[NewtonParameters]
AbsoluteLimit = 1E-10
Reduction = 1E-10
\ No newline at end of file
......@@ -18,8 +18,9 @@ time.startTimestep = 1E3
adaptivity.useAdaptivity = false, true | expand adaptivity
adaptivity.threshold = 1E-8
adaptivity.refinementFraction = 0.05
adaptivity.maxLevel = 7
grid.initialLevel = 2, 0 | expand adaptivity
grid.initialLevel = 1, 0 | expand adaptivity
grid.gridType = gmsh, rectangular | expand
grid.cells = 20 20
grid.extensions = 1 1
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment