• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CSMMLab / KiT-RT / #95

28 May 2025 02:06AM UTC coverage: 46.655% (-11.1%) from 57.728%
#95

push

travis-ci

web-flow
Release 2025 (#44)

* New neural models (#30)

* extend kitrt script

* added new neural models

* extend to m3 models

* added M3_2D models

* added M2 and M4 models

* configure ml optimizer for high order models

* added configuration for high order models

* add option for rotation postprcessing in neural networks. remove unneccessary python scripts

* started rotational symmetric postprocessing

* added rotational invariance postprocessing for m2 and m1 models

* fix post merge bugs

* created hohlraum mesh

* add hohlraum tes case

* add hohlraum test case

* add hohlraum cfg filees

* fixed hohlraum testcase

* add hohlraum cfg files

* changed hohlraum cfg

* changed hohlraum testcase to isotropic inflow source boundary condition

* added ghost cell bonudary for hohlraum testcase

* update readme and linesource mesh creator

* added proper scaling for linesource reference solution

* regularized newton debugging

* Data generator with reduced objective functional (#33)

* added reduced optimizer for sampling

* remove old debugging comments

* mesh acceleration (#38)

* added new ansatz (#36)

* added new ansatz

* debug new ansatz

* branch should be abandoned here

* debug new ansatz

* fix scaling error new ansatz

* fix config errors

* temporarily fixed dynamic ansatz rotation bug

* fix inheritance error for new ansatz

* mesh acceleration

* add structured hohlraum

* Mesh acc (#41)

* mesh acceleration

* added floor value for starmap moment methods

* enable accelleration

* delete minimum value starmap

* Update README.md

* Spherical harmonics nn (#40)

* added new ansatz

* debug new ansatz

* branch should be abandoned here

* debug new ansatz

* fix scaling error new ansatz

* fix config errors

* temporarily fixed dynamic ansatz rotation bug

* fix inheritance error for new ansatz

* mesh acceleration

* add structured hohlraum

* added sph... (continued)

767 of 3019 new or added lines in 51 files covered. (25.41%)

131 existing lines in 8 files now uncovered.

4422 of 9478 relevant lines covered (46.66%)

57163.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/optimizers/reducednewtonoptimizer.cpp
1
/*!
2
 * @file reducednewtonoptimizer.cpp
3
 * @brief class for solving the minimal entropy optimization problem using a newton optimizer with line search.
4
 * @author S. Schotthöfer
5
 */
6

7
#include "optimizers/reducednewtonoptimizer.hpp"
8
#include "common/config.hpp"
9
#include "entropies/entropybase.hpp"
10
#include "quadratures/quadraturebase.hpp"
11
#include "toolboxes/errormessages.hpp"
12
#include "toolboxes/textprocessingtoolbox.hpp"
13

14
ReducedNewtonOptimizer::ReducedNewtonOptimizer( Config* settings ) : NewtonOptimizer( settings ) {}
×
15

16
ReducedNewtonOptimizer::~ReducedNewtonOptimizer() { delete _quadrature; }
×
17

×
NEW
18
double ReducedNewtonOptimizer::ComputeObjFunc( const Vector& alpha, const Vector& sol, const VectorVector& moments ) {
×
19
    double result = 0.0;
20

×
21
    // Integrate
×
22
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
23
        result += _entropy->EntropyDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad];
24
    }
×
25
    // log
×
26
    result = log( result );
27
    // linear term
28
    result -= dot( alpha, sol );
×
29
    return result + 1.0;
30
}
×
31

×
32
void ReducedNewtonOptimizer::ComputeGradient( const Vector& alpha, const Vector& sol, const VectorVector& moments, Vector& grad ) {
33

34
    // Reset Vector
×
35
    for( unsigned idx_sys = 0; idx_sys < grad.size(); idx_sys++ ) {
36
        grad[idx_sys] = 0.0;
37
    }
×
38

×
39
    // Integrate
40
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
41
        grad += moments[idx_quad] * ( _entropy->EntropyPrimeDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad] );
42
    }
×
43

×
44
    double result = 0.0;
45

46
    // Integrate
×
47
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
48
        result += _entropy->EntropyDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad];
49
    }
×
50

×
51
    grad /= result;    // normalization
52

53
    // linear part
×
54
    grad -= sol;
55
}
56

×
57
void ReducedNewtonOptimizer::ComputeHessian( const Vector& alpha, const VectorVector& moments, Matrix& hessian ) {
58
    // Reset Matrix
59
    unsigned nSize = alpha.size();
×
60

61
    for( unsigned idx_Row = 0; idx_Row < nSize; idx_Row++ ) {
×
62
        for( unsigned idx_Col = 0; idx_Col < nSize; idx_Col++ ) {
63
            hessian( idx_Row, idx_Col ) = 0.0;
×
64
            // if( idx_Col == idx_Row ) hessian( idx_Row, idx_Col ) = 1.0;
×
65
        }
×
66
    }
67
    // Integrate
68
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
69
        hessian +=
70
            outer( moments[idx_quad], moments[idx_quad] ) * ( _entropy->EntropyHessianDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad] );
×
71
    }
72

×
73
    double result = 0.0;
74

75
    // Integrate
×
76
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
77
        result += _entropy->EntropyDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad];
78
    }
×
79

×
80
    hessian /= result;    // normalization
81

82
    // second part
×
83
    Vector grad( nSize, 0.0 );
84
    // Integrate
85
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
×
86
        grad += moments[idx_quad] * ( _entropy->EntropyPrimeDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad] );
87
    }
×
88

×
89
    hessian += -1 * outer( grad, grad ) / ( result * result );
90
}
91

×
92
void ReducedNewtonOptimizer::ReconstructMoments( Vector& sol, const Vector& alpha, const VectorVector& moments ) {
93
    double entropyReconstruction = 0.0;
94
    for( unsigned idx_sys = 0; idx_sys < sol.size(); idx_sys++ ) {
×
95
        sol[idx_sys] = 0.0;
×
96
    }
×
97
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
×
98
        // Make entropyReconstruction a member vector, s.t. it does not have to be re-evaluated in ConstructFlux
99
        entropyReconstruction = _entropy->EntropyPrimeDual( blaze::dot( alpha, moments[idx_quad] ) );
×
100
        sol += moments[idx_quad] * ( _weights[idx_quad] * entropyReconstruction );
101
    }
×
102

×
103
    double result = 0.0;
104

105
    // Integrate
×
106
    for( unsigned idx_quad = 0; idx_quad < _nq; idx_quad++ ) {
107
        result += _entropy->EntropyDual( dot( alpha, moments[idx_quad] ) ) * _weights[idx_quad];
108
    }
×
109

×
110
    sol /= result;    // normalization
111
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc