OGS
LogPenalty.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
7
8namespace MaterialLib
9{
10namespace Fracture
11{
17inline double logPenaltyDerivative(double const aperture0,
18 double const aperture,
19 double const aperture_cutoff)
20{
21 if (aperture >= aperture0)
22 {
23 return 1;
24 }
25
26 // Logarithmic penalty
27 if (aperture > aperture_cutoff)
28 {
29 double const penalty = std::log(aperture / aperture0);
30 return 1 + penalty * penalty +
31 2 * penalty / aperture * (aperture - aperture0);
32 }
33
34 // Linear penalty below aperture cutoff
35 {
36 double const penalty = std::log(aperture_cutoff / aperture0);
37 return 1 + penalty * penalty +
38 2 * penalty / aperture_cutoff *
39 (2 * aperture - aperture_cutoff - aperture0);
40 }
41};
42
43inline double logPenalty(double const aperture0,
44 double const aperture,
45 double const aperture_cutoff)
46{
47 if (aperture >= aperture0)
48 {
49 return 1;
50 }
51
52 // Logarithmic penalty
53 if (aperture > aperture_cutoff)
54 {
55 double const penalty = std::log(aperture / aperture0);
56 return 1 + penalty * penalty;
57 }
58
59 // Linear penalty below aperture cutoff
60 {
61 double const penalty = std::log(aperture_cutoff / aperture0);
62 return 1 + penalty * penalty +
63 2 * penalty / aperture_cutoff * (aperture - aperture_cutoff);
64 }
65};
66} // namespace Fracture
67} // namespace MaterialLib
double logPenalty(double const aperture0, double const aperture, double const aperture_cutoff)
Definition LogPenalty.h:43
double logPenaltyDerivative(double const aperture0, double const aperture, double const aperture_cutoff)
Definition LogPenalty.h:17