ngsolve 6.2.2405.post37.dev1__cp313-cp313-win_amd64.whl → 6.2.2405.post53.dev1__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ngsolve might be problematic. Click here for more details.
- netgen/include/expr.hpp +11 -8
- netgen/include/sparsematrix.hpp +5 -2
- netgen/include/statushandler.hpp +7 -0
- netgen/include/umfpackinverse.hpp +57 -29
- netgen/libngsolve.dll +0 -0
- ngsolve/cmake/NGSolveConfig.cmake +1 -1
- ngsolve/config/config.py +5 -5
- ngsolve/config.py +5 -5
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +44 -0
- ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve/demos/howto/mixed.py +30 -0
- ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve/demos/howto/pickling.py +26 -0
- ngsolve/demos/howto/pml.py +31 -0
- ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve/demos/intro/cmagnet.py +62 -0
- ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve/demos/intro/poisson.py +41 -0
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve/demos/mpi/mpi_navierstokes.py +115 -0
- ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve/demos/mpi/mpi_timeDG.py +79 -0
- ngsolve/ngslib.pyd +0 -0
- {ngsolve-6.2.2405.post37.dev1.dist-info → ngsolve-6.2.2405.post53.dev1.dist-info}/METADATA +2 -3
- {ngsolve-6.2.2405.post37.dev1.dist-info → ngsolve-6.2.2405.post53.dev1.dist-info}/RECORD +74 -43
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/Scripts/ngsolve.tcl +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/beam.geo +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/beam.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/chip.in2d +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/chip.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/coil.geo +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/coil.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/coilshield.geo +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/coilshield.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/cube.geo +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/cube.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d1_square.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d2_chip.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d4_cube.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d5_beam.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d6_shaft.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d7_coil.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/doubleglazing.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/shaft.geo +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/shaft.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/square.in2d +0 -0
- {ngsolve-6.2.2405.post37.dev1.data → ngsolve-6.2.2405.post53.dev1.data}/data/share/ngsolve/square.vol +0 -0
- {ngsolve-6.2.2405.post37.dev1.dist-info → ngsolve-6.2.2405.post53.dev1.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2405.post37.dev1.dist-info → ngsolve-6.2.2405.post53.dev1.dist-info}/WHEEL +0 -0
- {ngsolve-6.2.2405.post37.dev1.dist-info → ngsolve-6.2.2405.post53.dev1.dist-info}/top_level.txt +0 -0
netgen/include/expr.hpp
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#include <core/array.hpp>
|
|
11
11
|
#include <core/localheap.hpp>
|
|
12
|
-
|
|
12
|
+
#include <core/exception.hpp>
|
|
13
13
|
|
|
14
14
|
#include <ngs_stdcpp_include.hpp> // for INLINE
|
|
15
15
|
#include "complex_wrapper.hpp"
|
|
@@ -28,15 +28,18 @@ template <typename T>
|
|
|
28
28
|
struct SafeIndex
|
|
29
29
|
{
|
|
30
30
|
T i;
|
|
31
|
-
SafeIndex(T ai) : i(ai) { };
|
|
32
|
-
operator T() const { return i; }
|
|
33
|
-
auto operator++() { return ++i; }
|
|
34
|
-
auto operator++(int) { return i++; }
|
|
31
|
+
INLINE SafeIndex(T ai) : i(ai) { };
|
|
32
|
+
INLINE operator T() const { return i; }
|
|
33
|
+
INLINE auto operator++() { return ++i; }
|
|
34
|
+
INLINE auto operator++(int) { return i++; }
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
namespace ngcore
|
|
38
|
+
{
|
|
39
|
+
template <typename T>
|
|
40
|
+
struct IsSafe<SafeIndex<T>> {
|
|
41
|
+
constexpr operator bool() const { return true; } };
|
|
42
|
+
} // namespace ngcore
|
|
40
43
|
|
|
41
44
|
/*
|
|
42
45
|
namespace std {
|
netgen/include/sparsematrix.hpp
CHANGED
|
@@ -338,6 +338,8 @@ namespace ngla
|
|
|
338
338
|
{
|
|
339
339
|
return asvec;
|
|
340
340
|
}
|
|
341
|
+
|
|
342
|
+
// tuple<int,int> EntryShape() const { return { entry_height, entry_width }; }
|
|
341
343
|
|
|
342
344
|
FlatVector<TSCAL> GetRowValue (int row, int j)
|
|
343
345
|
{
|
|
@@ -345,9 +347,10 @@ namespace ngla
|
|
|
345
347
|
return FlatVector<TSCAL> (entry_size, p);
|
|
346
348
|
}
|
|
347
349
|
|
|
348
|
-
FlatMatrix<TSCAL> GetRowValueMat (int row, int j)
|
|
350
|
+
FlatMatrix<TSCAL> GetRowValueMat (int row, int j) const
|
|
349
351
|
{
|
|
350
|
-
TSCAL * p = asvec(entry_size * (firsti[row] + j)).Data(0);
|
|
352
|
+
// TSCAL * p = asvec(entry_size * (firsti[row] + j)).Data(0);
|
|
353
|
+
TSCAL * p = &asvec(entry_size * (firsti[row] + j));
|
|
351
354
|
return FlatMatrix<TSCAL> (entry_height, entry_width, p);
|
|
352
355
|
}
|
|
353
356
|
};
|
netgen/include/statushandler.hpp
CHANGED
|
@@ -19,6 +19,13 @@ namespace ngstd
|
|
|
19
19
|
static void SetTerminate(void);
|
|
20
20
|
static void UnSetTerminate(void);
|
|
21
21
|
static bool ShouldTerminate(void);
|
|
22
|
+
|
|
23
|
+
class Region
|
|
24
|
+
{
|
|
25
|
+
public:
|
|
26
|
+
Region(const char * str) { PushStatus(str); }
|
|
27
|
+
~Region() { PopStatus(); }
|
|
28
|
+
};
|
|
22
29
|
};
|
|
23
30
|
|
|
24
31
|
}
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
namespace ngla
|
|
23
23
|
{
|
|
24
24
|
|
|
25
|
-
template<class
|
|
26
|
-
class
|
|
25
|
+
template<class SCAL>
|
|
26
|
+
class S_UmfpackInverse : public SparseFactorization
|
|
27
27
|
{
|
|
28
28
|
public:
|
|
29
|
-
typedef typename mat_traits<TM>::TSCAL TSCAL;
|
|
29
|
+
// typedef typename mat_traits<TM>::TSCAL TSCAL;
|
|
30
|
+
typedef SCAL TSCAL;
|
|
30
31
|
|
|
31
32
|
protected:
|
|
32
33
|
typedef SuiteSparse_long suite_long;
|
|
@@ -42,7 +43,8 @@ namespace ngla
|
|
|
42
43
|
Array<suite_long> rowstart, indices;
|
|
43
44
|
Array<TSCAL> values;
|
|
44
45
|
|
|
45
|
-
bool symmetric
|
|
46
|
+
bool symmetric;
|
|
47
|
+
static constexpr bool is_complex = ngbla::IsComplex<TSCAL>();
|
|
46
48
|
|
|
47
49
|
void SetMatrixType();
|
|
48
50
|
|
|
@@ -52,16 +54,17 @@ namespace ngla
|
|
|
52
54
|
public:
|
|
53
55
|
|
|
54
56
|
///
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
S_UmfpackInverse (shared_ptr<const S_BaseSparseMatrix<TSCAL>> a,
|
|
58
|
+
shared_ptr<BitArray> ainner = nullptr,
|
|
57
59
|
shared_ptr<const Array<int>> acluster = nullptr,
|
|
58
60
|
int symmetric = 0);
|
|
61
|
+
virtual ~S_UmfpackInverse();
|
|
59
62
|
///
|
|
60
63
|
|
|
61
64
|
template <typename TSUBSET>
|
|
62
|
-
void GetUmfpackMatrix (const SparseMatrixTM<TM> & a, TSUBSET subset);
|
|
65
|
+
// void GetUmfpackMatrix (const SparseMatrixTM<TM> & a, TSUBSET subset);
|
|
66
|
+
void GetUmfpackMatrix (const S_BaseSparseMatrix<TSCAL> & a, TSUBSET subset);
|
|
63
67
|
|
|
64
|
-
virtual ~UmfpackInverseTM ();
|
|
65
68
|
///
|
|
66
69
|
int VHeight() const { return height/entrysize; }
|
|
67
70
|
///
|
|
@@ -74,44 +77,69 @@ namespace ngla
|
|
|
74
77
|
|
|
75
78
|
virtual Array<MemoryUsage> GetMemoryUsage () const
|
|
76
79
|
{
|
|
77
|
-
return { MemoryUsage ("Umfpack", nze*sizeof(
|
|
80
|
+
return { MemoryUsage ("Umfpack", nze*sizeof(TSCAL)*entrysize*entrysize, 1) };
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
|
|
85
|
+
|
|
86
|
+
template<class SCAL, class SCAL_VEC>
|
|
87
|
+
class S_UmfpackInverse_SVec : public S_UmfpackInverse<SCAL>
|
|
88
|
+
{
|
|
89
|
+
typedef S_UmfpackInverse<SCAL> BASE;
|
|
90
|
+
protected:
|
|
91
|
+
using typename BASE::TSCAL;
|
|
92
|
+
using BASE::height;
|
|
93
|
+
using BASE::is_complex;
|
|
94
|
+
using BASE::compressed_height;
|
|
95
|
+
using BASE::entrysize;
|
|
96
|
+
using BASE::rowstart;
|
|
97
|
+
using BASE::indices;
|
|
98
|
+
using BASE::compressed;
|
|
99
|
+
using BASE::compress;
|
|
100
|
+
|
|
101
|
+
using S_UmfpackInverse<SCAL>::S_UmfpackInverse;
|
|
102
|
+
static constexpr bool is_vector_complex = ngbla::IsComplex<SCAL_VEC>();
|
|
103
|
+
|
|
104
|
+
AutoVector CreateRowVector () const override { return CreateBaseVector(height/entrysize, is_vector_complex, entrysize); }
|
|
105
|
+
AutoVector CreateColVector () const override { return CreateBaseVector(height/entrysize, is_vector_complex, entrysize); }
|
|
106
|
+
|
|
107
|
+
void Mult (const BaseVector & x, BaseVector & y) const override;
|
|
108
|
+
void MultTrans (const BaseVector & x, BaseVector & y) const override;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
|
|
82
112
|
template<class TM,
|
|
83
113
|
class TV_ROW = typename mat_traits<TM>::TV_ROW,
|
|
84
114
|
class TV_COL = typename mat_traits<TM>::TV_COL>
|
|
85
|
-
class UmfpackInverse : public
|
|
115
|
+
class UmfpackInverse : public S_UmfpackInverse_SVec<typename mat_traits<TM>::TSCAL, typename mat_traits<TV_COL>::TSCAL>
|
|
86
116
|
{
|
|
87
|
-
using UmfpackInverseTM<TM>::height;
|
|
88
|
-
using UmfpackInverseTM<TM>::is_complex;
|
|
89
|
-
using UmfpackInverseTM<TM>::compressed_height;
|
|
90
|
-
using UmfpackInverseTM<TM>::entrysize;
|
|
91
|
-
using UmfpackInverseTM<TM>::rowstart;
|
|
92
|
-
using UmfpackInverseTM<TM>::indices;
|
|
93
|
-
using UmfpackInverseTM<TM>::compressed;
|
|
94
|
-
using UmfpackInverseTM<TM>::compress;
|
|
95
|
-
|
|
96
117
|
public:
|
|
118
|
+
typedef S_UmfpackInverse_SVec<typename mat_traits<TM>::TSCAL, typename mat_traits<TV_COL>::TSCAL> BASE;
|
|
119
|
+
|
|
120
|
+
using typename BASE::TSCAL;
|
|
97
121
|
typedef TV_COL TV;
|
|
98
122
|
typedef TV_ROW TVX;
|
|
99
|
-
|
|
123
|
+
|
|
124
|
+
private:
|
|
125
|
+
using BASE::height;
|
|
126
|
+
using BASE::is_complex;
|
|
127
|
+
using BASE::is_vector_complex;
|
|
128
|
+
using BASE::compressed_height;
|
|
129
|
+
using BASE::entrysize;
|
|
130
|
+
using BASE::rowstart;
|
|
131
|
+
using BASE::indices;
|
|
132
|
+
using BASE::compressed;
|
|
133
|
+
using BASE::compress;
|
|
100
134
|
|
|
101
|
-
|
|
135
|
+
public:
|
|
102
136
|
UmfpackInverse (shared_ptr<const SparseMatrix<TM,TV_ROW,TV_COL>> a,
|
|
103
137
|
shared_ptr<BitArray> ainner = nullptr,
|
|
104
138
|
shared_ptr<const Array<int>> acluster = nullptr,
|
|
105
139
|
int symmetric = 0)
|
|
106
|
-
:
|
|
140
|
+
: BASE (a, ainner, acluster, symmetric) { ; }
|
|
107
141
|
|
|
108
|
-
virtual ~UmfpackInverse () { ; }
|
|
109
|
-
///
|
|
110
|
-
void Mult (const BaseVector & x, BaseVector & y) const override;
|
|
111
|
-
void MultTrans (const BaseVector & x, BaseVector & y) const override;
|
|
112
|
-
///
|
|
113
|
-
AutoVector CreateRowVector () const override { return make_unique<VVector<TV>> (height/entrysize); }
|
|
114
|
-
AutoVector CreateColVector () const override { return make_unique<VVector<TV>> (height/entrysize); }
|
|
142
|
+
// virtual ~UmfpackInverse () { ; }
|
|
115
143
|
};
|
|
116
144
|
|
|
117
145
|
}
|
netgen/libngsolve.dll
CHANGED
|
Binary file
|
ngsolve/config/config.py
CHANGED
|
@@ -30,15 +30,15 @@ NGSOLVE_INSTALL_DIR_INCLUDE = "netgen/include"
|
|
|
30
30
|
NGSOLVE_INSTALL_DIR_CMAKE = "ngsolve/cmake"
|
|
31
31
|
NGSOLVE_INSTALL_DIR_RES = "share"
|
|
32
32
|
|
|
33
|
-
NGSOLVE_VERSION = "6.2.2405-
|
|
34
|
-
NGSOLVE_VERSION_GIT = "v6.2.2405-
|
|
35
|
-
NGSOLVE_VERSION_PYTHON = "6.2.2405.
|
|
33
|
+
NGSOLVE_VERSION = "6.2.2405-53-g86b17e189"
|
|
34
|
+
NGSOLVE_VERSION_GIT = "v6.2.2405-53-g86b17e189"
|
|
35
|
+
NGSOLVE_VERSION_PYTHON = "6.2.2405.post53.dev1"
|
|
36
36
|
|
|
37
37
|
NGSOLVE_VERSION_MAJOR = "6"
|
|
38
38
|
NGSOLVE_VERSION_MINOR = "2"
|
|
39
|
-
NGSOLVE_VERSION_TWEAK = "
|
|
39
|
+
NGSOLVE_VERSION_TWEAK = "53"
|
|
40
40
|
NGSOLVE_VERSION_PATCH = "2405"
|
|
41
|
-
NGSOLVE_VERSION_HASH = "
|
|
41
|
+
NGSOLVE_VERSION_HASH = "g86b17e189"
|
|
42
42
|
|
|
43
43
|
CMAKE_CXX_COMPILER = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"
|
|
44
44
|
CMAKE_CUDA_COMPILER = ""
|
ngsolve/config.py
CHANGED
|
@@ -30,15 +30,15 @@ NGSOLVE_INSTALL_DIR_INCLUDE = "netgen/include"
|
|
|
30
30
|
NGSOLVE_INSTALL_DIR_CMAKE = "ngsolve/cmake"
|
|
31
31
|
NGSOLVE_INSTALL_DIR_RES = "share"
|
|
32
32
|
|
|
33
|
-
NGSOLVE_VERSION = "6.2.2405-
|
|
34
|
-
NGSOLVE_VERSION_GIT = "v6.2.2405-
|
|
35
|
-
NGSOLVE_VERSION_PYTHON = "6.2.2405.
|
|
33
|
+
NGSOLVE_VERSION = "6.2.2405-53-g86b17e189"
|
|
34
|
+
NGSOLVE_VERSION_GIT = "v6.2.2405-53-g86b17e189"
|
|
35
|
+
NGSOLVE_VERSION_PYTHON = "6.2.2405.post53.dev1"
|
|
36
36
|
|
|
37
37
|
NGSOLVE_VERSION_MAJOR = "6"
|
|
38
38
|
NGSOLVE_VERSION_MINOR = "2"
|
|
39
|
-
NGSOLVE_VERSION_TWEAK = "
|
|
39
|
+
NGSOLVE_VERSION_TWEAK = "53"
|
|
40
40
|
NGSOLVE_VERSION_PATCH = "2405"
|
|
41
|
-
NGSOLVE_VERSION_HASH = "
|
|
41
|
+
NGSOLVE_VERSION_HASH = "g86b17e189"
|
|
42
42
|
|
|
43
43
|
CMAKE_CXX_COMPILER = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"
|
|
44
44
|
CMAKE_CUDA_COMPILER = ""
|
|
File without changes
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from ngsolve.TensorProductTools import *
|
|
2
|
+
from ngsolve.comp import *
|
|
3
|
+
from ngsolve import *
|
|
4
|
+
import netgen.gui
|
|
5
|
+
|
|
6
|
+
mesh1 = Mesh(SegMesh(20,0,1,periodic=True) )
|
|
7
|
+
mesh2 = Mesh(SegMesh(20,0,1,periodic=True) )
|
|
8
|
+
|
|
9
|
+
tpmesh = Mesh(MakeTensorProductMesh(mesh1,mesh2))
|
|
10
|
+
Draw(tpmesh)
|
|
11
|
+
|
|
12
|
+
n=5
|
|
13
|
+
m=5
|
|
14
|
+
|
|
15
|
+
fesx = L2(mesh1,order=n)
|
|
16
|
+
fesy = L2(mesh2,order=m)
|
|
17
|
+
|
|
18
|
+
tpfes = TensorProductFESpace([fesx,fesy])
|
|
19
|
+
|
|
20
|
+
fes = L2(tpmesh,order=n)
|
|
21
|
+
u = tpfes.TrialFunction()
|
|
22
|
+
v = tpfes.TestFunction()
|
|
23
|
+
vx = v.Operator("gradx")
|
|
24
|
+
vy = v.Operator("grady")
|
|
25
|
+
b = (-1)*CoefficientFunction( (0.25,0.5) )
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
uin = ProlongateCoefficientFunction(IfPos((1.0-x)*(x-0.5),sin((x-0.5)*2*3.14159),0) + IfPos((x-0.0)*(0.5-x),sin((x)*2*3.14159),0) , 0 , tpfes)
|
|
29
|
+
|
|
30
|
+
gradv = CoefficientFunction((vx,vy))
|
|
31
|
+
|
|
32
|
+
a = BilinearForm(tpfes)
|
|
33
|
+
|
|
34
|
+
n = CoefficientFunction((ProlongateCoefficientFunction(specialcf.normal(1),1,tpfes),ProlongateCoefficientFunction(specialcf.normal(1),0,tpfes)))
|
|
35
|
+
bn = b*n
|
|
36
|
+
|
|
37
|
+
a += SymbolicTPBFI ( (-u * b*gradv).Compile() )
|
|
38
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other( )) * (v-v.Other()).Compile(), VOL, skeleton=True)
|
|
39
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = CoefficientFunction(uin) )) * (v).Compile(), BND, skeleton=True)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
u = GridFunction(tpfes)
|
|
44
|
+
v = GridFunction(tpfes)
|
|
45
|
+
|
|
46
|
+
uu = GridFunction(fes)
|
|
47
|
+
print("Setting")
|
|
48
|
+
u.Set(exp( ProlongateCoefficientFunction(-200*(x-0.4)*(x-0.4), 1, tpfes)+ ProlongateCoefficientFunction(-200*(x-0.4)*(x-0.4),0,tpfes) ) )
|
|
49
|
+
print("Done")
|
|
50
|
+
Transfer2StdMesh(u,uu)
|
|
51
|
+
|
|
52
|
+
Draw(uu,sd=2,autoscale=False)
|
|
53
|
+
|
|
54
|
+
h = u.vec.CreateVector()
|
|
55
|
+
#u.vec[:] = 1.0
|
|
56
|
+
print('To start the simulation type Run(n_steps)!')
|
|
57
|
+
|
|
58
|
+
def Step():
|
|
59
|
+
a.Apply(u.vec,v.vec)
|
|
60
|
+
h.data = 0.00125*v.vec.data
|
|
61
|
+
tpfes.SolveM(rho=CoefficientFunction(1), vec = h)
|
|
62
|
+
u.vec.data-=h.data
|
|
63
|
+
#Redraw()
|
|
64
|
+
|
|
65
|
+
def Run(nsteps):
|
|
66
|
+
count = 0
|
|
67
|
+
with TaskManager():
|
|
68
|
+
for i in range(nsteps):
|
|
69
|
+
print("Step ",i+1, "/",nsteps)
|
|
70
|
+
Step()
|
|
71
|
+
count += 1
|
|
72
|
+
if count % 1 == 0:
|
|
73
|
+
Transfer2StdMesh(u,uu)
|
|
74
|
+
count = 0
|
|
75
|
+
Redraw()
|
|
76
|
+
|
|
77
|
+
Transfer2StdMesh(u,uu)
|
|
78
|
+
Run(100)
|
|
79
|
+
for t in Timers():
|
|
80
|
+
print(t["counts"], t["time"], t["name"])
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from ngsolve.TensorProductTools import *
|
|
2
|
+
from ngsolve.comp import *
|
|
3
|
+
from ngsolve import *
|
|
4
|
+
from netgen.geom2d import unit_square
|
|
5
|
+
import netgen.gui
|
|
6
|
+
|
|
7
|
+
mesh1 = Mesh(SegMesh(20,0,1))
|
|
8
|
+
mesh2 = Mesh(unit_square.GenerateMesh(maxh=0.15))
|
|
9
|
+
|
|
10
|
+
tpmesh = Mesh(MakeTensorProductMesh(mesh1,mesh2))
|
|
11
|
+
Draw(tpmesh)
|
|
12
|
+
|
|
13
|
+
n=3
|
|
14
|
+
m=3
|
|
15
|
+
|
|
16
|
+
fesx = L2(mesh1,order=n)
|
|
17
|
+
fesy = L2(mesh2,order=m)
|
|
18
|
+
tpfes = TensorProductFESpace([fesx,fesy])
|
|
19
|
+
|
|
20
|
+
fes = L2(tpmesh,order=n)
|
|
21
|
+
|
|
22
|
+
u = tpfes.TrialFunction()
|
|
23
|
+
v = tpfes.TestFunction()
|
|
24
|
+
|
|
25
|
+
vx = v.Operator("gradx")
|
|
26
|
+
vy = v.Operator("grady")
|
|
27
|
+
|
|
28
|
+
b = CoefficientFunction( (ProlongateCoefficientFunction(x-0.5,0,tpfes),ProlongateCoefficientFunction(0.5-x,1,tpfes),0) )
|
|
29
|
+
|
|
30
|
+
uin = CoefficientFunction(0.0)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
gradv = CoefficientFunction((vx,vy))
|
|
34
|
+
|
|
35
|
+
a = BilinearForm(tpfes)
|
|
36
|
+
|
|
37
|
+
n = CoefficientFunction(( ProlongateCoefficientFunction(specialcf.normal(1)[0],1,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[0],0,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[1],0,tpfes)))
|
|
38
|
+
bn = b*n
|
|
39
|
+
|
|
40
|
+
a += SymbolicTPBFI ( -u * b*gradv )
|
|
41
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v-v.Other(bnd = 0.0)), VOL, skeleton=True)
|
|
42
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v), BND, skeleton=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
u = GridFunction(tpfes)
|
|
46
|
+
v = GridFunction(tpfes)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
uu = GridFunction(fes)
|
|
50
|
+
|
|
51
|
+
u.Set(exp(ProlongateCoefficientFunction( -70*(x-0.25)*(x-0.25),1,tpfes) + ProlongateCoefficientFunction(-70*(x-0.25)*(x-0.25)-70*(y-0.75)*(y-0.75),0,tpfes) ))
|
|
52
|
+
Transfer2StdMesh(u,uu)
|
|
53
|
+
Draw(uu,sd=3,autoscale=False)
|
|
54
|
+
|
|
55
|
+
h = u.vec.CreateVector()
|
|
56
|
+
print('To start the simulation type Run(n_steps)!')
|
|
57
|
+
def Step():
|
|
58
|
+
a.Apply(u.vec,v.vec)
|
|
59
|
+
h.data = 0.001*v.vec.data
|
|
60
|
+
tpfes.SolveM(rho=CoefficientFunction(1), vec = h)
|
|
61
|
+
u.vec.data-=h.data
|
|
62
|
+
Transfer2StdMesh(u,uu)
|
|
63
|
+
Redraw()
|
|
64
|
+
|
|
65
|
+
def Run(nsteps):
|
|
66
|
+
with TaskManager():
|
|
67
|
+
for i in range(nsteps):
|
|
68
|
+
print("Step ",i+1, "/",nsteps)
|
|
69
|
+
Step()
|
|
70
|
+
|
|
71
|
+
#Run(100)
|
|
72
|
+
for t in Timers():
|
|
73
|
+
print(t["counts"], t["time"], t["name"])
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from ngsolve.TensorProductTools import *
|
|
2
|
+
from ngsolve.comp import *
|
|
3
|
+
from ngsolve import *
|
|
4
|
+
from netgen.geom2d import unit_square
|
|
5
|
+
import netgen.gui
|
|
6
|
+
|
|
7
|
+
mesh1 = Mesh(unit_square.GenerateMesh(maxh=0.15))
|
|
8
|
+
mesh2 = Mesh(SegMesh(20,0,1))
|
|
9
|
+
|
|
10
|
+
tpmesh = Mesh(MakeTensorProductMesh(mesh1,mesh2))
|
|
11
|
+
Draw(tpmesh)
|
|
12
|
+
|
|
13
|
+
n=3
|
|
14
|
+
m=3
|
|
15
|
+
|
|
16
|
+
fesx = L2(mesh1,order=n)
|
|
17
|
+
fesy = L2(mesh2,order=m)
|
|
18
|
+
tpfes = TensorProductFESpace([fesx,fesy])
|
|
19
|
+
|
|
20
|
+
fes = L2(tpmesh,order=n)
|
|
21
|
+
|
|
22
|
+
u = tpfes.TrialFunction()
|
|
23
|
+
v = tpfes.TestFunction()
|
|
24
|
+
|
|
25
|
+
vx = v.Operator("gradx")
|
|
26
|
+
vy = v.Operator("grady")
|
|
27
|
+
|
|
28
|
+
b = CoefficientFunction( (0,0,1) )
|
|
29
|
+
|
|
30
|
+
uin = CoefficientFunction(0.0)
|
|
31
|
+
|
|
32
|
+
gradv = CoefficientFunction((vx,vy))
|
|
33
|
+
|
|
34
|
+
a = BilinearForm(tpfes)
|
|
35
|
+
|
|
36
|
+
n = CoefficientFunction((ProlongateCoefficientFunction(specialcf.normal(2)[0],1,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[1],1,tpfes),ProlongateCoefficientFunction(specialcf.normal(1)[0],0,tpfes)))
|
|
37
|
+
bn = b*n
|
|
38
|
+
|
|
39
|
+
a += SymbolicTPBFI ( -u * b*gradv )
|
|
40
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v-v.Other(bnd = 0.0)), VOL, skeleton=True)
|
|
41
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v), BND, skeleton=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
u = GridFunction(tpfes)
|
|
45
|
+
v = GridFunction(tpfes)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
uu = GridFunction(fes)
|
|
49
|
+
|
|
50
|
+
u.Set(exp(ProlongateCoefficientFunction(-70*(x-0.125)*(x-0.125)-70*(y-0.125)*(y-0.125),1,tpfes)+ProlongateCoefficientFunction(-70*(x-0.75)*(x-0.75),0,tpfes) ))
|
|
51
|
+
Transfer2StdMesh(u,uu)
|
|
52
|
+
Draw(uu,sd=3,autoscale=False)
|
|
53
|
+
|
|
54
|
+
h = u.vec.CreateVector()
|
|
55
|
+
print('To start the simulation type Run(n_steps)!')
|
|
56
|
+
def Step():
|
|
57
|
+
a.Apply(u.vec,v.vec)
|
|
58
|
+
h.data = 0.001*v.vec.data
|
|
59
|
+
tpfes.SolveM(rho=CoefficientFunction(1), vec = h)
|
|
60
|
+
u.vec.data-=h.data
|
|
61
|
+
Transfer2StdMesh(u,uu)
|
|
62
|
+
Redraw()
|
|
63
|
+
|
|
64
|
+
def Run(nsteps):
|
|
65
|
+
with TaskManager():
|
|
66
|
+
for i in range(nsteps):
|
|
67
|
+
print("Step ",i+1, "/",nsteps)
|
|
68
|
+
Step()
|
|
69
|
+
|
|
70
|
+
Run(100)
|
|
71
|
+
for t in Timers():
|
|
72
|
+
print(t["counts"], t["time"], t["name"])
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from ngsolve.TensorProductTools import *
|
|
2
|
+
from ngsolve.comp import *
|
|
3
|
+
from ngsolve import *
|
|
4
|
+
from netgen.geom2d import unit_square
|
|
5
|
+
import netgen.gui
|
|
6
|
+
|
|
7
|
+
mesh1 = Mesh(unit_square.GenerateMesh(maxh=0.15))
|
|
8
|
+
mesh2 = Mesh(MakeHexagonalMesh2D(maxh=0.2))
|
|
9
|
+
n=4
|
|
10
|
+
m=4
|
|
11
|
+
SetHeapSize(1000000000)
|
|
12
|
+
|
|
13
|
+
fesx = L2(mesh1,order=n)
|
|
14
|
+
fesy = L2(mesh2,order=m)
|
|
15
|
+
tpfes = TensorProductFESpace([fesx,fesy])
|
|
16
|
+
|
|
17
|
+
u = tpfes.TrialFunction()
|
|
18
|
+
v = tpfes.TestFunction()
|
|
19
|
+
|
|
20
|
+
vx = v.Operator("gradx")
|
|
21
|
+
vy = v.Operator("grady")
|
|
22
|
+
|
|
23
|
+
b = CoefficientFunction( ( ProlongateCoefficientFunction(y-0.5,1,tpfes),ProlongateCoefficientFunction(0.5-x,1,tpfes),1,1 ) )
|
|
24
|
+
|
|
25
|
+
uin = CoefficientFunction(0.0)
|
|
26
|
+
|
|
27
|
+
gradv = CoefficientFunction((vx,vy))
|
|
28
|
+
|
|
29
|
+
a = BilinearForm(tpfes)
|
|
30
|
+
|
|
31
|
+
n = CoefficientFunction((ProlongateCoefficientFunction(specialcf.normal(2)[0],1,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[1],1,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[0],0,tpfes),ProlongateCoefficientFunction(specialcf.normal(2)[1],0,tpfes)))
|
|
32
|
+
bn = b*n
|
|
33
|
+
|
|
34
|
+
a += SymbolicTPBFI ( -u * b*gradv )
|
|
35
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v-v.Other(bnd = 0.0)), VOL, skeleton=True)
|
|
36
|
+
a += SymbolicTPBFI ( (bn) *IfPos(bn, u, u.Other(bnd = uin )) * (v), BND, skeleton=True)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
u = GridFunction(tpfes)
|
|
40
|
+
v = GridFunction(tpfes)
|
|
41
|
+
print(1)
|
|
42
|
+
with TaskManager():
|
|
43
|
+
u.Set(exp(ProlongateCoefficientFunction(-90*(x-0.25)*(x-0.25)-90*(y-0.5)*(y-0.5),1,tpfes)+ProlongateCoefficientFunction(-70*(x-0.75)*(x-0.75)-70*(y-0.75)*(y-0.75),0,tpfes) ))
|
|
44
|
+
print(2)
|
|
45
|
+
rho = GridFunction(fesx,name="rho")
|
|
46
|
+
Draw(rho)
|
|
47
|
+
h = u.vec.CreateVector()
|
|
48
|
+
print('To start the simulation type Run(n_steps)!')
|
|
49
|
+
|
|
50
|
+
def Step():
|
|
51
|
+
a.Apply(u.vec,v.vec)
|
|
52
|
+
h.data = 0.005*v.vec.data
|
|
53
|
+
tpfes.SolveM(rho=CoefficientFunction(1), vec = h)
|
|
54
|
+
u.vec.data-=h.data
|
|
55
|
+
TensorProductIntegrate(u,rho)
|
|
56
|
+
Redraw()
|
|
57
|
+
|
|
58
|
+
def Run(nsteps):
|
|
59
|
+
with TaskManager():
|
|
60
|
+
for i in range(nsteps):
|
|
61
|
+
print("Step ",i+1, "/",nsteps)
|
|
62
|
+
Step()
|
|
63
|
+
|
|
64
|
+
Run(1000)
|
|
65
|
+
for t in Timers():
|
|
66
|
+
print(t["counts"], t["time"], t["name"])
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#
|
|
2
|
+
# The Hellan-Herrmann-Johnson method for a Kirchhoff plate
|
|
3
|
+
#
|
|
4
|
+
# M. I. Comodi: The Hellan–Herrmann-Johnson Method
|
|
5
|
+
# Some error estimates and postprocessing. Math. Comp. 52, 17–39, 1989
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
from ngsolve import *
|
|
9
|
+
from netgen.geom2d import unit_square
|
|
10
|
+
|
|
11
|
+
mesh = Mesh (unit_square.GenerateMesh(maxh=0.05))
|
|
12
|
+
order = 3
|
|
13
|
+
|
|
14
|
+
V = HDivDiv(mesh, order=order-1)
|
|
15
|
+
Q = H1(mesh, order=order, dirichlet="left|right|top|bottom")
|
|
16
|
+
X = V*Q
|
|
17
|
+
|
|
18
|
+
print ("ndof-V:", V.ndof, ", ndof-Q:", Q.ndof)
|
|
19
|
+
|
|
20
|
+
sigma, u = X.TrialFunction()
|
|
21
|
+
tau, v = X.TestFunction()
|
|
22
|
+
|
|
23
|
+
n = specialcf.normal(2)
|
|
24
|
+
|
|
25
|
+
def tang(u): return u-(u*n)*n
|
|
26
|
+
|
|
27
|
+
a = BilinearForm(X, symmetric=True)
|
|
28
|
+
a += (InnerProduct (sigma, tau) + div(sigma)*grad(v) + div(tau)*grad(u) - 1e-10*u*v)*dx
|
|
29
|
+
a += (-(sigma*n) * tang(grad(v)) - (tau*n)*tang(grad(u)))*dx(element_boundary=True)
|
|
30
|
+
a.Assemble()
|
|
31
|
+
|
|
32
|
+
f = LinearForm(X)
|
|
33
|
+
f += 1 * v * dx
|
|
34
|
+
# f += Trace(tau.Trace()) * ds("bottom")
|
|
35
|
+
f.Assemble()
|
|
36
|
+
|
|
37
|
+
u = GridFunction(X)
|
|
38
|
+
u.vec.data = a.mat.Inverse(X.FreeDofs()) * f.vec
|
|
39
|
+
|
|
40
|
+
Draw (u.components[0], mesh, name="sigma")
|
|
41
|
+
Draw (u.components[1], mesh, name="disp")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from netgen.geom2d import unit_square
|
|
2
|
+
from ngsolve import *
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
ngsglobals.msg_level = 1
|
|
6
|
+
mesh = Mesh(unit_square.GenerateMesh(maxh=0.4))
|
|
7
|
+
for k in range(5):
|
|
8
|
+
mesh.Refine()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
order = 3
|
|
12
|
+
fes1 = L2(mesh, order=order)
|
|
13
|
+
fes2 = FacetFESpace(mesh, order=order, dirichlet="bottom|right|top")
|
|
14
|
+
|
|
15
|
+
print ("element dofs: ", fes1.ndof)
|
|
16
|
+
print ("facet dofs: ", fes2.ndof)
|
|
17
|
+
|
|
18
|
+
fes = fes1*fes2
|
|
19
|
+
|
|
20
|
+
u,uhat = fes.TrialFunction()
|
|
21
|
+
v,vhat = fes.TestFunction()
|
|
22
|
+
|
|
23
|
+
n = specialcf.normal(mesh.dim)
|
|
24
|
+
h = specialcf.mesh_size
|
|
25
|
+
|
|
26
|
+
a = BilinearForm(fes, symmetric=True, condense = True)
|
|
27
|
+
a += grad(u) * grad(v) * dx
|
|
28
|
+
a += (grad(u)*n*(vhat-v)+grad(v)*n*(uhat-u)+10*order*order/h*(u-uhat)*(v-vhat))*dx(element_boundary=True)
|
|
29
|
+
|
|
30
|
+
c = Preconditioner(type="direct", bf=a, inverse = "sparsecholesky")
|
|
31
|
+
# c = Preconditioner(type="bddc", bf=a)
|
|
32
|
+
|
|
33
|
+
with TaskManager():
|
|
34
|
+
a.Assemble()
|
|
35
|
+
ainv = CGSolver(a.mat, c.mat)
|
|
36
|
+
|
|
37
|
+
f = LinearForm(fes)
|
|
38
|
+
f += 1*v*dx
|
|
39
|
+
f.Assemble()
|
|
40
|
+
|
|
41
|
+
u = GridFunction(fes)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
f.vec.data += a.harmonic_extension_trans * f.vec
|
|
45
|
+
|
|
46
|
+
u.vec.data = ainv * f.vec
|
|
47
|
+
|
|
48
|
+
u.vec.data += a.harmonic_extension * u.vec
|
|
49
|
+
u.vec.data += a.inner_solve * f.vec
|
|
50
|
+
|
|
51
|
+
Draw (u.components[0], mesh, "sol")
|
|
52
|
+
|
|
53
|
+
|