ddfem 1.0.10__py3-none-any.whl → 1.0.11__py3-none-any.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.
- ddfem/__init__.py +9 -5
- ddfem/__main__.py +11 -12
- ddfem/boundary.py +2 -2
- ddfem/data/2.11.dev20250709/extra.modules +14 -0
- ddfem/data/2.11.dev20250709/femscheme_0bb54cd4f1cd1df2477f5f59393c6a2e.cc +43 -0
- ddfem/data/2.11.dev20250709/femscheme_5c9e2700386c07226eb4db155fa5ef14.cc +43 -0
- ddfem/data/2.11.dev20250709/femscheme_765ef00d995a939c34bdc0d0cc4847ca.cc +43 -0
- ddfem/data/2.11.dev20250709/femspace_11b3436cb033df683615c50d5d4239bd_f14dd0b3b474c0cd816334330f55ad72.cc +45 -0
- ddfem/data/2.11.dev20250709/femspace_f4f043307753c8e74af23c94c28a3b0d_438586e783f51d84a82e82b0d8daceea.cc +45 -0
- ddfem/data/2.11.dev20250709/{integrands_3bde0abfafcf45a3cff4d1029568ab5cv1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_0003e4cbb961fd653fe295d2c4fa50a7v1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +367 -14
- ddfem/data/2.11.dev20250709/{integrands_2e6d4e3b5cff269867d26022ac7cee09v1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_0fa4a1c37449cf574971977e10cf682av1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +8 -8
- ddfem/data/2.11.dev20250709/{integrands_96ea175da69be26acf1a8d94dc0b3c93v1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_29b696aa653181a57d036f771efa8be9v1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +8 -8
- ddfem/data/2.11.dev20250709/integrands_536f9ba0ea4ecd1f7d4e2bc43ef29d08v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +453 -0
- ddfem/data/2.11.dev20250709/{integrands_008eefa148b772fa3192dd3c1728c140v1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_5907ab5c70328c21dd308abf09e529aev1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +8 -8
- ddfem/data/2.11.dev20250709/{integrands_59ef814e4fbd86ef9c0aeac61e84e9a7v1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_68eba4e963a61031a52da3365f515585v1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +8 -8
- ddfem/data/2.11.dev20250709/integrands_83927be37e79b291517b827b9ddc1983v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
- ddfem/data/2.11.dev20250709/integrands_8ed2f23c088e3a3d82a3259b663796c7v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
- ddfem/data/2.11.dev20250709/integrands_af3bbe7d629df162ef8c570e1503bf62v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +762 -0
- ddfem/data/2.11.dev20250709/{integrands_00ee9b3b89e4e44212e5b7ad7948a24ev1_3_a524c1196983e65de1c06d7d6afdeb44.cc → integrands_d0634430f14d3432dae186e57ec5aecav1_3_a524c1196983e65de1c06d7d6afdeb44.cc} +8 -8
- ddfem/data/2.11.dev20250709/intro.modules +33 -102
- ddfem/data/2.11.dev20250709/localfunction_10f9d7a54f79c12d6ca923b9ee56b80d_a524c1196983e65de1c06d7d6afdeb44.cc +324 -0
- ddfem/data/2.11.dev20250709/localfunction_10f9d7a54f79c12d6ca923b9ee56b80d_af122c1df944c95cd395ec0f91d0f970.cc +322 -0
- ddfem/data/2.11.dev20250709/localfunction_1c20e613977d8cea4cf5227c12aa68a6_a524c1196983e65de1c06d7d6afdeb44.cc +164 -0
- ddfem/data/2.11.dev20250709/{localfunction_191355e6250b2d2e260d96f519ad9976_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_217e4bf8b368a7768c4897cf58f71d84_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/localfunction_22e797a8f3e8c322f33c41e07bd15165_a524c1196983e65de1c06d7d6afdeb44.cc +1445 -0
- ddfem/data/2.11.dev20250709/localfunction_2e2afc8df6107683d574a8d96d5249f4_af122c1df944c95cd395ec0f91d0f970.cc +512 -0
- ddfem/data/2.11.dev20250709/localfunction_32613626342183eafa360dc1f0f18924_a524c1196983e65de1c06d7d6afdeb44.cc +1425 -0
- ddfem/data/2.11.dev20250709/localfunction_37174cfc9d6bf565336cac0d2ea785f5_a524c1196983e65de1c06d7d6afdeb44.cc +786 -0
- ddfem/data/2.11.dev20250709/{localfunction_d75993d7ae5919d23117b153e900840d_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_3d957c5b2628e5120636b8e3f461bc0d_a524c1196983e65de1c06d7d6afdeb44.cc} +64 -29
- ddfem/data/2.11.dev20250709/localfunction_3ecaa105be9e3abddf3a85d8adc5d36f_a524c1196983e65de1c06d7d6afdeb44.cc +697 -0
- ddfem/data/2.11.dev20250709/{localfunction_f626cd43dc8558135fe0b32cde016644_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_3ecaf7de7505b53bb0b5fb6d78549387_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/{localfunction_1d27a90a52b9053192c9cc902283f79b_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_4192604521151252f1c8fa56a1f9f226_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/localfunction_4976bbef3267846b59f3a26497ffe9db_a524c1196983e65de1c06d7d6afdeb44.cc +474 -0
- ddfem/data/2.11.dev20250709/{localfunction_a8c726f728cd35d137188b33301aeef1_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_4adfaf8a08fac23151af0b1e790db1f7_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/{localfunction_00f2e5593eeb23f01906255d67244f6e_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_4f6a526abfe63959f81b09a5796c5eb1_a524c1196983e65de1c06d7d6afdeb44.cc} +44 -29
- ddfem/data/2.11.dev20250709/localfunction_5591a2c803b9658084d8f11d44bf3ae1_a524c1196983e65de1c06d7d6afdeb44.cc +485 -0
- ddfem/data/2.11.dev20250709/localfunction_6363af791dde11d699a9a3d876cc5d9a_a524c1196983e65de1c06d7d6afdeb44.cc +549 -0
- ddfem/data/2.11.dev20250709/localfunction_6363af791dde11d699a9a3d876cc5d9a_af122c1df944c95cd395ec0f91d0f970.cc +547 -0
- ddfem/data/2.11.dev20250709/localfunction_6eccfc8fd91ce34d81e7c3962ece5d94_a524c1196983e65de1c06d7d6afdeb44.cc +766 -0
- ddfem/data/2.11.dev20250709/localfunction_762aa49bc5a47ad3d8d8bbde36b42ee5_a524c1196983e65de1c06d7d6afdeb44.cc +723 -0
- ddfem/data/2.11.dev20250709/localfunction_76e8db0f046ac9e37a793e0bb13eea7b_a524c1196983e65de1c06d7d6afdeb44.cc +292 -0
- ddfem/data/2.11.dev20250709/localfunction_7792f4273b0fd848c5a0fc9d6f12683e_a524c1196983e65de1c06d7d6afdeb44.cc +280 -0
- ddfem/data/2.11.dev20250709/localfunction_7f7ef99c50708814ba5a82b0956b0aed_a524c1196983e65de1c06d7d6afdeb44.cc +461 -0
- ddfem/data/2.11.dev20250709/localfunction_898de4ae138e0ed305ef1399c66aa10a_a524c1196983e65de1c06d7d6afdeb44.cc +313 -0
- ddfem/data/2.11.dev20250709/{localfunction_1d13146d4bff10e178aba773fe2a9f1d_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_a99a0c7f35b06ac5a1fa7f081b5e64f9_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/{localfunction_82d7cb9338bf118426fac2abf41a91a4_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_cda923259a47bb19861404a9fdb64303_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -14
- ddfem/data/2.11.dev20250709/localfunction_d3d9b8a21e3075c9ff40117c5244f28e_a524c1196983e65de1c06d7d6afdeb44.cc +381 -0
- ddfem/data/2.11.dev20250709/localfunction_d4b9ca85d48735ee01f395a42eaa0cee_af122c1df944c95cd395ec0f91d0f970.cc +774 -0
- ddfem/data/2.11.dev20250709/localfunction_dd1fb4bd60f2d8b3a062dbbdaedb9fee_a524c1196983e65de1c06d7d6afdeb44.cc +869 -0
- ddfem/data/2.11.dev20250709/localfunction_dd5ab085a9d94f578c1f3d337ea360a3_a524c1196983e65de1c06d7d6afdeb44.cc +161 -0
- ddfem/data/2.11.dev20250709/{localfunction_aeb3d963412cdc65630e0a4c3c0dde0f_a524c1196983e65de1c06d7d6afdeb44.cc → localfunction_e2b19c5987f9b6fb0cd5453bfa7f4f9f_a524c1196983e65de1c06d7d6afdeb44.cc} +14 -30
- ddfem/data/extra.modules +13 -0
- ddfem/examples/beam.py +43 -50
- ddfem/examples/chemical_reaction.py +1 -1
- ddfem/examples/five_circle_flat.py +42 -28
- ddfem/examples/linear_elasticity.py +5 -1
- ddfem/examples/triple_circle.py +86 -83
- ddfem/examples/triple_circle_beam.py +71 -61
- ddfem-1.0.11.dist-info/METADATA +78 -0
- ddfem-1.0.11.dist-info/RECORD +124 -0
- ddfem/data/2.11.dev20250709/boundary.modules +0 -9
- ddfem/data/2.11.dev20250709/femspace_90f0a9524a8cb701e8ee5027b7658a0e_0faf32f13b591f4f60f83c591507b9be.cc +0 -40
- ddfem/data/2.11.dev20250709/geometry.modules +0 -84
- ddfem/data/2.11.dev20250709/hierarchicalgrid_472c2c2d007bf5604887ab2f16b7eb13.cc +0 -30
- ddfem/data/2.11.dev20250709/hierarchicalgrid_966e2a5c8356c5b278ccd3acad180f0a.cc +0 -30
- ddfem/data/2.11.dev20250709/localfunction_10ad0a2d88c74db5f4bf5f81e138974f_a524c1196983e65de1c06d7d6afdeb44.cc +0 -135
- ddfem/data/2.11.dev20250709/localfunction_1460b632dc5919e94a2147108f4f34f4_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -468
- ddfem/data/2.11.dev20250709/localfunction_161bbe6dde741c6e3f90c2919b8d17a4_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -171
- ddfem/data/2.11.dev20250709/localfunction_268716e3e3ec528038367ee04d335ea1_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -289
- ddfem/data/2.11.dev20250709/localfunction_29566243d89228735978e58471af60be_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -246
- ddfem/data/2.11.dev20250709/localfunction_2a890b2a64788a92607670296c0d37ac_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -311
- ddfem/data/2.11.dev20250709/localfunction_2bbefabe87db948827d02bdb8d69a7d1_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -240
- ddfem/data/2.11.dev20250709/localfunction_34a46b87fa5c0a5a4f0bc44949f2eda9_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -239
- ddfem/data/2.11.dev20250709/localfunction_3c10414582133a0fa8e341c4544a97c7_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -220
- ddfem/data/2.11.dev20250709/localfunction_3dfb73430ddb90a26b6f50f85e52e2a4_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -216
- ddfem/data/2.11.dev20250709/localfunction_3e323e81c52891c0ecb656eac273e52f_a524c1196983e65de1c06d7d6afdeb44.cc +0 -135
- ddfem/data/2.11.dev20250709/localfunction_465e17370f4344b8997151adacf7aec6_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -403
- ddfem/data/2.11.dev20250709/localfunction_57e9651c5364ef528f41cf138e126115_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -272
- ddfem/data/2.11.dev20250709/localfunction_5c2a00bf7ec417475a0a378ed462beeb_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -350
- ddfem/data/2.11.dev20250709/localfunction_5d71e054c405bc6584738437908af804_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -364
- ddfem/data/2.11.dev20250709/localfunction_6343878b30d190cc70b631d882009dec_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -342
- ddfem/data/2.11.dev20250709/localfunction_639a3f3873411f43337e687cb070368f_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -230
- ddfem/data/2.11.dev20250709/localfunction_6661b21a0e1340a9a9f7b32da595f130_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -468
- ddfem/data/2.11.dev20250709/localfunction_75e876499fa3b7abc096aa08f88a1c2d_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -213
- ddfem/data/2.11.dev20250709/localfunction_8647b4efdf8a37595f73652bc1905df2_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -335
- ddfem/data/2.11.dev20250709/localfunction_86a0670f34bf2ac8155423a1c1bc2e75_a524c1196983e65de1c06d7d6afdeb44.cc +0 -135
- ddfem/data/2.11.dev20250709/localfunction_98b32c4b5bc0d8083f3d2c394aa33429_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -340
- ddfem/data/2.11.dev20250709/localfunction_9b741917efb5aa6a09e375272e4ae3aa_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -317
- ddfem/data/2.11.dev20250709/localfunction_a369aff055312b472a92ee7e257534ff_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -392
- ddfem/data/2.11.dev20250709/localfunction_a6cc88a79948487ce95a6c3f22487b36_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -395
- ddfem/data/2.11.dev20250709/localfunction_aa506761997f291dfd2e62b678f010b2_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -280
- ddfem/data/2.11.dev20250709/localfunction_b5edf0c36f0fc96cc6f5f3677c6557a1_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -214
- ddfem/data/2.11.dev20250709/localfunction_bdfb7ddf42a423f7d0791458634d4b8f_a524c1196983e65de1c06d7d6afdeb44.cc +0 -135
- ddfem/data/2.11.dev20250709/localfunction_c3d0902cf8bb4b86b62a2293de2b74e9_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -1131
- ddfem/data/2.11.dev20250709/localfunction_cf4a29dc25e72137baf2f8fb8b8d3c50_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -267
- ddfem/data/2.11.dev20250709/localfunction_d40efa41ac661ff77278d2ae4812b06d_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -377
- ddfem/data/2.11.dev20250709/localfunction_e69118a51208cfab8a028711e966e76c_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -236
- ddfem/data/2.11.dev20250709/localfunction_e9c8d4f4cedd30cab76a588b95bbccab_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -325
- ddfem/data/2.11.dev20250709/localfunction_f0d3fe89de368f7ea295a1982a807bd8_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -281
- ddfem/data/2.11.dev20250709/localfunction_f4b1d42cbb447375f39ed834570cd3f0_a524c1196983e65de1c06d7d6afdeb44.cc +0 -135
- ddfem/data/2.11.dev20250709/localfunction_fb15e1ad2c62e6660c67949fcf166d81_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -339
- ddfem/data/2.11.dev20250709/localfunction_fb17410b0b5d479dce9ffc6f9d61ab37_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -317
- ddfem/data/2.11.dev20250709/localfunction_fc22d5adaf3b9563160dc2aec55e8ba1_19659fe2f2f74bcfb5d532f1a0d38be9.cc +0 -113
- ddfem/data/2.11.dev20250709/referenceelements_fe266b8abf61f4601198949ea6b0dfd3.cc +0 -24
- ddfem/data/2.11.dev20250709/transformers.modules +0 -13
- ddfem/data/2.11.dev20250709/yaspcoordinates_dim2_ctdouble.cc +0 -55
- ddfem/data/2.11.dev20250709/yaspcoordinates_dim3_ctdouble.cc +0 -55
- ddfem-1.0.10.dist-info/METADATA +0 -101
- ddfem-1.0.10.dist-info/RECORD +0 -138
- {ddfem-1.0.10.dist-info → ddfem-1.0.11.dist-info}/WHEEL +0 -0
- {ddfem-1.0.10.dist-info → ddfem-1.0.11.dist-info}/licenses/LICENSE +0 -0
- {ddfem-1.0.10.dist-info → ddfem-1.0.11.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
#ifndef GUARD_dd5ab085a9d94f578c1f3d337ea360a3
|
2
|
+
#define GUARD_dd5ab085a9d94f578c1f3d337ea360a3
|
3
|
+
|
4
|
+
#define USING_DUNE_PYTHON 1
|
5
|
+
#include <config.h>
|
6
|
+
#include <dune/alugrid/dgf.hh>
|
7
|
+
#include <dune/alugrid/grid.hh>
|
8
|
+
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
|
9
|
+
#include <dune/fem/gridpart/filter/simple.hh>
|
10
|
+
#include <dune/fem/gridpart/filteredgridpart.hh>
|
11
|
+
#include <dune/fempy/py/gridview.hh>
|
12
|
+
#include <dune/python/grid/gridview.hh>
|
13
|
+
#include <dune/python/grid/hierarchical.hh>
|
14
|
+
#include <dune/fem/function/localfunction/bindable.hh>
|
15
|
+
#include <dune/fem/common/intersectionside.hh>
|
16
|
+
#include <dune/python/pybind11/pybind11.h>
|
17
|
+
#include <dune/python/pybind11/extensions.h>
|
18
|
+
#include <dune/fempy/py/grid/gridpart.hh>
|
19
|
+
#include <dune/common/exceptions.hh>
|
20
|
+
#include <dune/fempy/function/virtualizedgridfunction.hh>
|
21
|
+
#include <dune/fempy/py/ufllocalfunction.hh>
|
22
|
+
|
23
|
+
namespace UFLLocalFunctions_dd5ab085a9d94f578c1f3d337ea360a3
|
24
|
+
{
|
25
|
+
|
26
|
+
// UFLLocalFunction
|
27
|
+
// ----------------
|
28
|
+
|
29
|
+
template< class GridPart, class Coeffu_h >
|
30
|
+
struct UFLLocalFunction
|
31
|
+
: public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<2>>
|
32
|
+
{
|
33
|
+
typedef GridPart GridPartType;
|
34
|
+
typedef typename GridPartType::GridViewType GridView;
|
35
|
+
typedef typename GridView::ctype ctype;
|
36
|
+
typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<2>> BaseType;
|
37
|
+
typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<2>> FunctionSpaceType;
|
38
|
+
typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
|
39
|
+
typedef typename GridPartType::IntersectionType IntersectionType;
|
40
|
+
typedef typename EntityType::Geometry Geometry;
|
41
|
+
typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
|
42
|
+
typedef Dune::Fem::IntersectionSide Side;
|
43
|
+
typedef std::tuple<> ConstantTupleType;
|
44
|
+
typedef std::tuple< Dune::Fem::GridFunctionSpace< GridPartType, Dune::FieldVector< double, 2 > > > CoefficientFunctionSpaceTupleType;
|
45
|
+
typedef std::tuple< Coeffu_h > CoefficientTupleType;
|
46
|
+
template< std::size_t i >
|
47
|
+
using CoefficientFunctionSpaceType = std::tuple_element_t< i, CoefficientFunctionSpaceTupleType >;
|
48
|
+
template< std::size_t i >
|
49
|
+
using CoefficientRangeType = typename CoefficientFunctionSpaceType< i >::RangeType;
|
50
|
+
template< std::size_t i >
|
51
|
+
using CoefficientJacobianRangeType = typename CoefficientFunctionSpaceType< i >::JacobianRangeType;
|
52
|
+
static constexpr bool gridPartValid = Dune::Fem::checkGridPartValid<GridPartType,Dune::Fem::ConstLocalFunction<Coeffu_h>>();
|
53
|
+
template< std::size_t i >
|
54
|
+
using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
|
55
|
+
template< std::size_t i >
|
56
|
+
using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
|
57
|
+
using BaseType::entity;
|
58
|
+
using BaseType::geometry;
|
59
|
+
|
60
|
+
UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Coeffu_h &coeffu_h, const Dune::Fem::ParameterReader ¶meter = Dune::Fem::Parameter::container() )
|
61
|
+
: BaseType(gridPart,name,order),
|
62
|
+
coefficients_( Dune::Fem::ConstLocalFunction< Coeffu_h >( coeffu_h ) )
|
63
|
+
{}
|
64
|
+
|
65
|
+
void bind ( const IntersectionType &intersection, Side side )
|
66
|
+
{
|
67
|
+
BaseType::bind(intersection, side);
|
68
|
+
std::get< 0 >( coefficients_ ).bind( this->entity() );
|
69
|
+
}
|
70
|
+
|
71
|
+
void bind ( const EntityType &entity )
|
72
|
+
{
|
73
|
+
BaseType::bind(entity);
|
74
|
+
std::get< 0 >( coefficients_ ).bind( this->entity() );
|
75
|
+
}
|
76
|
+
|
77
|
+
void unbind ()
|
78
|
+
{
|
79
|
+
BaseType::unbind();
|
80
|
+
std::get< 0 >( coefficients_ ).unbind();
|
81
|
+
}
|
82
|
+
|
83
|
+
template< class Point >
|
84
|
+
void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
|
85
|
+
{
|
86
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp0 = jacobianCoefficient< 0 >( x );
|
87
|
+
result[ 0 ] = (tmp0[ 0 ])[ 0 ];
|
88
|
+
result[ 1 ] = (tmp0[ 0 ])[ 1 ];
|
89
|
+
}
|
90
|
+
|
91
|
+
template< class Point >
|
92
|
+
void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
|
93
|
+
{
|
94
|
+
typename CoefficientFunctionSpaceType< 0 >::HessianRangeType tmp0 = hessianCoefficient< 0 >( x );
|
95
|
+
(result[ 0 ])[ 0 ] = ((tmp0[ 0 ])[ 0 ])[ 0 ];
|
96
|
+
(result[ 0 ])[ 1 ] = ((tmp0[ 0 ])[ 0 ])[ 1 ];
|
97
|
+
(result[ 1 ])[ 0 ] = ((tmp0[ 0 ])[ 1 ])[ 0 ];
|
98
|
+
(result[ 1 ])[ 1 ] = ((tmp0[ 0 ])[ 1 ])[ 1 ];
|
99
|
+
}
|
100
|
+
|
101
|
+
template< class Point >
|
102
|
+
void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
|
103
|
+
{
|
104
|
+
DUNE_THROW(Dune::NotImplemented,"hessian method could not be generated for local function (TooHighDerivative('CodeGenerator does not allow for third order derivatives, yet.'))");
|
105
|
+
result=typename FunctionSpaceType::HessianRangeType(0);
|
106
|
+
}
|
107
|
+
|
108
|
+
template< std::size_t i >
|
109
|
+
const ConstantType< i > &constant () const
|
110
|
+
{
|
111
|
+
return *std::get< i >( constants_ );
|
112
|
+
}
|
113
|
+
|
114
|
+
template< std::size_t i >
|
115
|
+
ConstantType< i > &constant ()
|
116
|
+
{
|
117
|
+
return *std::get< i >( constants_ );
|
118
|
+
}
|
119
|
+
|
120
|
+
template< std::size_t i, class Point >
|
121
|
+
typename CoefficientFunctionSpaceType< i >::RangeType evaluateCoefficient ( const Point &x ) const
|
122
|
+
{
|
123
|
+
typename CoefficientFunctionSpaceType< i >::RangeType result;
|
124
|
+
std::get< i >( coefficients_ ).evaluate( x, result );;
|
125
|
+
return result;
|
126
|
+
}
|
127
|
+
|
128
|
+
template< std::size_t i, class Point >
|
129
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType jacobianCoefficient ( const Point &x ) const
|
130
|
+
{
|
131
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType result;
|
132
|
+
std::get< i >( coefficients_ ).jacobian( x, result );;
|
133
|
+
return result;
|
134
|
+
}
|
135
|
+
|
136
|
+
template< std::size_t i, class Point >
|
137
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType hessianCoefficient ( const Point &x ) const
|
138
|
+
{
|
139
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType result;
|
140
|
+
std::get< i >( coefficients_ ).hessian( x, result );;
|
141
|
+
return result;
|
142
|
+
}
|
143
|
+
ConstantTupleType constants_;
|
144
|
+
std::tuple< Dune::Fem::ConstLocalFunction< Coeffu_h > > coefficients_;
|
145
|
+
};
|
146
|
+
|
147
|
+
} // namespace UFLLocalFunctions_dd5ab085a9d94f578c1f3d337ea360a3
|
148
|
+
|
149
|
+
PYBIND11_MODULE( localfunction_dd5ab085a9d94f578c1f3d337ea360a3_a524c1196983e65de1c06d7d6afdeb44, module )
|
150
|
+
{
|
151
|
+
typedef UFLLocalFunctions_dd5ab085a9d94f578c1f3d337ea360a3::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > >, Dune::FemPy::VirtualizedGridFunction< Dune::FemPy::GridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>, Dune::FieldVector< double, 2 > > > LocalFunctionType;
|
152
|
+
if constexpr( LocalFunctionType::gridPartValid )
|
153
|
+
{
|
154
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_dd5ab085a9d94f578c1f3d337ea360a3::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > >, Dune::FemPy::VirtualizedGridFunction< Dune::FemPy::GridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>, Dune::FieldVector< double, 2 > > >"), Dune::Python::IncludeFiles({"python/dune/generated/localfunction_dd5ab085a9d94f578c1f3d337ea360a3_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
155
|
+
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
156
|
+
cls.def( pybind11::init( [] ( pybind11::object gridView, const std::string &name, int order, const Dune::FemPy::VirtualizedGridFunction< Dune::FemPy::GridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>, Dune::FieldVector< double, 2 > > &coeffu_h ) {return new LocalFunctionType( Dune::FemPy::gridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>(gridView),name,order, coeffu_h); } ), pybind11::keep_alive< 1, 2 >(), pybind11::keep_alive< 1, 3 >() );
|
157
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
#endif
|
@@ -1,5 +1,5 @@
|
|
1
|
-
#ifndef
|
2
|
-
#define
|
1
|
+
#ifndef GUARD_e2b19c5987f9b6fb0cd5453bfa7f4f9f
|
2
|
+
#define GUARD_e2b19c5987f9b6fb0cd5453bfa7f4f9f
|
3
3
|
|
4
4
|
#define USING_DUNE_PYTHON 1
|
5
5
|
#include <config.h>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
#include <dune/common/exceptions.hh>
|
20
20
|
#include <dune/fempy/py/ufllocalfunction.hh>
|
21
21
|
|
22
|
-
namespace
|
22
|
+
namespace UFLLocalFunctions_e2b19c5987f9b6fb0cd5453bfa7f4f9f
|
23
23
|
{
|
24
24
|
|
25
25
|
// UFLLocalFunction
|
@@ -27,22 +27,19 @@ namespace UFLLocalFunctions_aeb3d963412cdc65630e0a4c3c0dde0f
|
|
27
27
|
|
28
28
|
template< class GridPart >
|
29
29
|
struct UFLLocalFunction
|
30
|
-
: public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<
|
30
|
+
: public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<2>>
|
31
31
|
{
|
32
32
|
typedef GridPart GridPartType;
|
33
33
|
typedef typename GridPartType::GridViewType GridView;
|
34
34
|
typedef typename GridView::ctype ctype;
|
35
|
-
typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<
|
36
|
-
typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<
|
35
|
+
typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<2>> BaseType;
|
36
|
+
typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<2>> FunctionSpaceType;
|
37
37
|
typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
|
38
38
|
typedef typename GridPartType::IntersectionType IntersectionType;
|
39
39
|
typedef typename EntityType::Geometry Geometry;
|
40
40
|
typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
|
41
41
|
typedef Dune::Fem::IntersectionSide Side;
|
42
|
-
typedef
|
43
|
-
typedef std::tuple< std::shared_ptr< Conc0 > > ConstantTupleType;
|
44
|
-
template< std::size_t i >
|
45
|
-
using ConstantsRangeType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
|
42
|
+
typedef std::tuple<> ConstantTupleType;
|
46
43
|
typedef std::tuple<> CoefficientTupleType;
|
47
44
|
static constexpr bool gridPartValid = true;
|
48
45
|
template< std::size_t i >
|
@@ -54,9 +51,7 @@ struct UFLLocalFunction
|
|
54
51
|
|
55
52
|
UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Dune::Fem::ParameterReader ¶meter = Dune::Fem::Parameter::container() )
|
56
53
|
: BaseType(gridPart,name,order)
|
57
|
-
{
|
58
|
-
std::get< 0 >( constants_ ) = std::make_shared< Conc0 >( (Conc0(0)) );
|
59
|
-
}
|
54
|
+
{}
|
60
55
|
|
61
56
|
void bind ( const IntersectionType &intersection, Side side )
|
62
57
|
{
|
@@ -76,8 +71,8 @@ struct UFLLocalFunction
|
|
76
71
|
template< class Point >
|
77
72
|
void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
|
78
73
|
{
|
79
|
-
|
80
|
-
result[
|
74
|
+
result[ 0 ] = 0.0;
|
75
|
+
result[ 1 ] = 0.0;
|
81
76
|
}
|
82
77
|
|
83
78
|
template< class Point >
|
@@ -103,31 +98,20 @@ struct UFLLocalFunction
|
|
103
98
|
{
|
104
99
|
return *std::get< i >( constants_ );
|
105
100
|
}
|
106
|
-
|
107
|
-
const Conc0 &conc0 () const
|
108
|
-
{
|
109
|
-
return *std::get< 0 >( constants_ );
|
110
|
-
}
|
111
|
-
|
112
|
-
Conc0 &conc0 ()
|
113
|
-
{
|
114
|
-
return *std::get< 0 >( constants_ );
|
115
|
-
}
|
116
101
|
ConstantTupleType constants_;
|
117
102
|
std::tuple< > coefficients_;
|
118
103
|
};
|
119
104
|
|
120
|
-
} // namespace
|
105
|
+
} // namespace UFLLocalFunctions_e2b19c5987f9b6fb0cd5453bfa7f4f9f
|
121
106
|
|
122
|
-
PYBIND11_MODULE(
|
107
|
+
PYBIND11_MODULE( localfunction_e2b19c5987f9b6fb0cd5453bfa7f4f9f_a524c1196983e65de1c06d7d6afdeb44, module )
|
123
108
|
{
|
124
|
-
typedef
|
109
|
+
typedef UFLLocalFunctions_e2b19c5987f9b6fb0cd5453bfa7f4f9f::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > > LocalFunctionType;
|
125
110
|
if constexpr( LocalFunctionType::gridPartValid )
|
126
111
|
{
|
127
|
-
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("
|
112
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_e2b19c5987f9b6fb0cd5453bfa7f4f9f::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > >"), Dune::Python::IncludeFiles({"python/dune/generated/localfunction_e2b19c5987f9b6fb0cd5453bfa7f4f9f_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
128
113
|
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
129
114
|
cls.def( pybind11::init( [] ( pybind11::object gridView, const std::string &name, int order ) {return new LocalFunctionType( Dune::FemPy::gridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>(gridView),name,order); } ), pybind11::keep_alive< 1, 2 >() );
|
130
|
-
cls.def_property( "c0", [] ( LocalFunctionType &self ) -> UFLLocalFunctions_aeb3d963412cdc65630e0a4c3c0dde0f::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > >::Conc0 { return self.conc0(); }, [] ( LocalFunctionType &self, const UFLLocalFunctions_aeb3d963412cdc65630e0a4c3c0dde0f::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > >::Conc0 &v ) { self.conc0() = v; } );
|
131
115
|
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
132
116
|
}
|
133
117
|
}
|
ddfem/data/extra.modules
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
femspace_11b3436cb033df683615c50d5d4239bd_f14dd0b3b474c0cd816334330f55ad72.cc
|
2
|
+
localfunction_3d957c5b2628e5120636b8e3f461bc0d_a524c1196983e65de1c06d7d6afdeb44.cc
|
3
|
+
localfunction_6363af791dde11d699a9a3d876cc5d9a_a524c1196983e65de1c06d7d6afdeb44.cc
|
4
|
+
localfunction_762aa49bc5a47ad3d8d8bbde36b42ee5_a524c1196983e65de1c06d7d6afdeb44.cc
|
5
|
+
localfunction_e2b19c5987f9b6fb0cd5453bfa7f4f9f_a524c1196983e65de1c06d7d6afdeb44.cc
|
6
|
+
femscheme_765ef00d995a939c34bdc0d0cc4847ca.cc
|
7
|
+
localfunction_22e797a8f3e8c322f33c41e07bd15165_a524c1196983e65de1c06d7d6afdeb44.cc
|
8
|
+
localfunction_32613626342183eafa360dc1f0f18924_a524c1196983e65de1c06d7d6afdeb44.cc
|
9
|
+
localfunction_4976bbef3267846b59f3a26497ffe9db_a524c1196983e65de1c06d7d6afdeb44.cc
|
10
|
+
localfunction_5591a2c803b9658084d8f11d44bf3ae1_a524c1196983e65de1c06d7d6afdeb44.cc
|
11
|
+
localfunction_6363af791dde11d699a9a3d876cc5d9a_af122c1df944c95cd395ec0f91d0f970.cc
|
12
|
+
localfunction_d4b9ca85d48735ee01f395a42eaa0cee_af122c1df944c95cd395ec0f91d0f970.cc
|
13
|
+
localfunction_dd1fb4bd60f2d8b3a062dbbdaedb9fee_a524c1196983e65de1c06d7d6afdeb44.cc
|
ddfem/examples/beam.py
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
import numpy as np
|
2
2
|
import pygmsh
|
3
|
-
from dune.alugrid import aluConformGrid as leafGridView
|
4
|
-
from dune.fem import adapt, mark, markNeighbors
|
5
|
-
from dune.fem.function import gridFunction
|
6
|
-
from dune.fem.space import lagrange
|
7
|
-
from dune.fem.view import adaptiveLeafGridView
|
8
3
|
from dune.grid import cartesianDomain
|
9
4
|
from dune.ufl import Constant, Space
|
10
5
|
from ufl import SpatialCoordinate, sqrt
|
11
6
|
|
7
|
+
from ddfem import GridView
|
12
8
|
from ddfem import geometry as gm
|
13
9
|
from ddfem.geometry.domain_dune import DomainDune
|
14
10
|
|
@@ -45,31 +41,42 @@ def getDomain(initialRefine, version, adaptLevels=0, epsFactor=4.5, *args, **kwa
|
|
45
41
|
r_min = epsilon.value
|
46
42
|
r_max = radius * epsilon.value
|
47
43
|
dist = np.abs(sdf((x, y)))
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
|
45
|
+
gmax = geom.characteristic_length_max
|
46
|
+
gmin = geom.characteristic_length_min
|
47
|
+
|
48
|
+
if False:
|
53
49
|
# Linear
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
if dist <= r_min:
|
51
|
+
return gmin
|
52
|
+
elif dist >= r_max:
|
53
|
+
return gmax
|
54
|
+
else:
|
55
|
+
m = (gmax - gmin) / (r_max - r_min)
|
56
|
+
return m * (dist - r_min) + gmin
|
57
|
+
|
58
|
+
else:
|
59
|
+
# Exponential
|
60
|
+
R = int(2 * np.log2(gmax / gmin))
|
61
|
+
j = max(0, min(R, (dist * R) / r_max - 0.5))
|
62
|
+
# j = max(0, min(R, np.floor(dist * R / r_max)))
|
63
|
+
return gmax * 0.5 ** ((R - j) / 2)
|
64
|
+
|
65
|
+
omega.epsilon = get_eps(h_min)
|
58
66
|
|
59
67
|
if version == "cartesian":
|
68
|
+
omega.epsilon = get_eps(h)
|
60
69
|
domain = cartesianDomain(*domain_range, initial_gridsize)
|
61
|
-
epsilon = get_eps(h)
|
62
70
|
|
63
71
|
elif version == "fitted":
|
64
72
|
with pygmsh.occ.Geometry() as geom:
|
65
|
-
geom.characteristic_length_max = h_max
|
66
|
-
geom.characteristic_length_min = h_min
|
67
|
-
epsilon = get_eps(h_min)
|
73
|
+
geom.characteristic_length_max = h_max / sqrt(2)
|
74
|
+
geom.characteristic_length_min = h_min / sqrt(2)
|
68
75
|
|
69
76
|
rec = geom.add_rectangle([0, 0, 0], 1, 0.15)
|
70
77
|
|
71
78
|
geom.set_mesh_size_callback(
|
72
|
-
lambda dim, tag, x, y, z, lc: spacing(x, y, epsilon),
|
79
|
+
lambda dim, tag, x, y, z, lc: spacing(x, y, omega.epsilon),
|
73
80
|
ignore_other_mesh_sizes=True,
|
74
81
|
)
|
75
82
|
|
@@ -86,12 +93,11 @@ def getDomain(initialRefine, version, adaptLevels=0, epsFactor=4.5, *args, **kwa
|
|
86
93
|
|
87
94
|
elif version == "gmsh_adaptive":
|
88
95
|
with pygmsh.occ.Geometry() as geom:
|
89
|
-
geom.characteristic_length_max = h_max
|
90
|
-
geom.characteristic_length_min = h_min
|
91
|
-
epsilon = get_eps(h_min)
|
96
|
+
geom.characteristic_length_max = h_max / sqrt(2)
|
97
|
+
geom.characteristic_length_min = h_min / sqrt(2)
|
92
98
|
|
93
99
|
geom.set_mesh_size_callback(
|
94
|
-
lambda dim, tag, x, y, z, lc: spacing(x, y, epsilon),
|
100
|
+
lambda dim, tag, x, y, z, lc: spacing(x, y, omega.epsilon),
|
95
101
|
ignore_other_mesh_sizes=True,
|
96
102
|
)
|
97
103
|
|
@@ -111,37 +117,24 @@ def getDomain(initialRefine, version, adaptLevels=0, epsFactor=4.5, *args, **kwa
|
|
111
117
|
else:
|
112
118
|
raise ValueError("invalid mesh type")
|
113
119
|
|
114
|
-
gridView = adaptiveLeafGridView(leafGridView(domain))
|
115
|
-
|
116
120
|
if version == "dune_adaptive":
|
117
|
-
omega.epsilon = get_eps(h_min)
|
118
|
-
omega.epsilon.value *= radius
|
119
|
-
epsilon_value = omega.epsilon.value
|
120
|
-
|
121
|
-
marker = mark
|
122
|
-
|
123
121
|
refinements = int(2 * np.log2(h_max / h_min))
|
124
|
-
|
125
|
-
|
126
|
-
omega
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
h_min = h_max * 0.5 ** (j / 2)
|
137
|
-
epsilon = get_eps(h_min)
|
138
|
-
|
139
|
-
omega.epsilon = epsilon
|
140
|
-
domain = omega
|
122
|
+
gridView = GridView(
|
123
|
+
domain,
|
124
|
+
omega,
|
125
|
+
factor=radius,
|
126
|
+
refinements=refinements,
|
127
|
+
adaptLevels=adaptLevels,
|
128
|
+
)
|
129
|
+
h_min = h_max * 0.5 ** (refinements / 2)
|
130
|
+
omega.epsilon = get_eps(h_min)
|
131
|
+
else:
|
132
|
+
gridView = GridView(domain)
|
141
133
|
|
142
134
|
domain = DomainDune(omega, gridView)
|
143
|
-
# domain.adapt(level=adaptLevels)
|
144
135
|
|
145
|
-
print(
|
136
|
+
print(
|
137
|
+
f"h_max={h_max}, h_min={h_min * 0.5 ** (adaptLevels / 2)}, epsilon={omega.epsilon.value}"
|
138
|
+
)
|
146
139
|
|
147
140
|
return gridView, domain
|
@@ -37,7 +37,7 @@ def crModel():
|
|
37
37
|
|
38
38
|
def setup(u_h, DDMPotentialModel, psi_h):
|
39
39
|
ChemModel.u_h_n = u_h.copy(name="u_h_n")
|
40
|
-
ChemModel.u_h_n.
|
40
|
+
ChemModel.u_h_n.clear()
|
41
41
|
|
42
42
|
ChemModel.dpsi_h = lambda x: DDMPotentialModel.sigma(
|
43
43
|
0, x, psi_h, grad(psi_h)
|
@@ -15,14 +15,12 @@ pip install dune-fem
|
|
15
15
|
"""
|
16
16
|
)
|
17
17
|
|
18
|
-
from dune.fem.function import gridFunction
|
19
|
-
from dune.fem.space import lagrange
|
20
18
|
from dune.grid import cartesianDomain
|
21
19
|
from dune.ufl import Constant, Space
|
22
20
|
from ufl import SpatialCoordinate, sqrt
|
23
21
|
|
24
|
-
from ddfem import geometry as gm
|
25
22
|
from ddfem import GridView
|
23
|
+
from ddfem import geometry as gm
|
26
24
|
from ddfem.geometry.domain_dune import DomainDune
|
27
25
|
|
28
26
|
|
@@ -75,7 +73,7 @@ def getDomain(
|
|
75
73
|
|
76
74
|
h_max = h * 3
|
77
75
|
h_min = h / 2
|
78
|
-
radius =
|
76
|
+
radius = 4
|
79
77
|
|
80
78
|
x = SpatialCoordinate(Space(2))
|
81
79
|
sdf = omega(x)
|
@@ -84,28 +82,40 @@ def getDomain(
|
|
84
82
|
r_min = epsilon.value
|
85
83
|
r_max = radius * epsilon.value
|
86
84
|
dist = np.abs(sdf((x, y)))
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
|
86
|
+
gmax = geom.characteristic_length_max
|
87
|
+
gmin = geom.characteristic_length_min
|
88
|
+
|
89
|
+
if False:
|
92
90
|
# Linear
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
91
|
+
if dist <= r_min:
|
92
|
+
return gmin
|
93
|
+
elif dist >= r_max:
|
94
|
+
return gmax
|
95
|
+
else:
|
96
|
+
m = (gmax - gmin) / (r_max - r_min)
|
97
|
+
return m * (dist - r_min) + gmin
|
97
98
|
|
98
|
-
|
99
|
+
else:
|
100
|
+
# Exponential
|
101
|
+
R = int(2 * np.log2(gmax / gmin))
|
102
|
+
j = max(0, min(R, (dist * R) / r_max - 0.5))
|
103
|
+
# j = max(0, min(R, np.floor(dist * R / r_max)))
|
104
|
+
return gmax * 0.5 ** ((R - j) / 2)
|
105
|
+
|
106
|
+
omega.epsilon = get_eps(h_min)
|
99
107
|
|
100
108
|
if version == "cartesian":
|
101
|
-
|
109
|
+
omega.epsilon = get_eps(h)
|
110
|
+
# domain = cartesianDomain(*domain_range, initial_gridsize)
|
111
|
+
domain = [*domain_range, initial_gridsize]
|
102
112
|
|
103
113
|
elif version == "fitted":
|
104
114
|
if pygmsh is None:
|
105
115
|
raise AttributeError("'fitted' requires install pygmsh")
|
106
116
|
with pygmsh.occ.Geometry() as geom:
|
107
|
-
geom.characteristic_length_max = h_max
|
108
|
-
geom.characteristic_length_min = h_min
|
117
|
+
geom.characteristic_length_max = h_max / sqrt(2)
|
118
|
+
geom.characteristic_length_min = h_min / sqrt(2)
|
109
119
|
|
110
120
|
disks = [geom.add_disk([c[1][0], c[1][1], 0.0], c[0]) for c in balls]
|
111
121
|
|
@@ -136,8 +146,8 @@ def getDomain(
|
|
136
146
|
if pygmsh is None:
|
137
147
|
raise AttributeError("'gmsh_adaptive' requires install pygmsh")
|
138
148
|
with pygmsh.occ.Geometry() as geom:
|
139
|
-
geom.characteristic_length_max = h_max
|
140
|
-
geom.characteristic_length_min = h_min
|
149
|
+
geom.characteristic_length_max = h_max / sqrt(2)
|
150
|
+
geom.characteristic_length_min = h_min / sqrt(2)
|
141
151
|
|
142
152
|
geom.add_rectangle(
|
143
153
|
[domain_range[0][0], domain_range[0][1], 0.0],
|
@@ -158,18 +168,22 @@ def getDomain(
|
|
158
168
|
else:
|
159
169
|
raise ValueError("invalid mesh type")
|
160
170
|
|
161
|
-
if
|
162
|
-
gridView = GridView(domain)
|
163
|
-
else:
|
171
|
+
if version == "dune_adaptive":
|
164
172
|
refinements = int(2 * np.log2(h_max / h_min))
|
165
|
-
gridView = GridView(
|
166
|
-
|
167
|
-
|
168
|
-
|
173
|
+
gridView = GridView(
|
174
|
+
domain,
|
175
|
+
omega,
|
176
|
+
filterTolerance=10 * omega.epsilon.value,
|
177
|
+
factor=radius,
|
178
|
+
refinements=refinements,
|
179
|
+
adaptLevels=adaptLevels,
|
180
|
+
)
|
169
181
|
h_min = h_max * 0.5 ** (refinements / 2)
|
170
|
-
omega.epsilon
|
182
|
+
omega.epsilon = get_eps(h_min)
|
183
|
+
else:
|
184
|
+
gridView = GridView(domain)
|
171
185
|
|
172
|
-
domain = DomainDune(omega, gridView)
|
186
|
+
domain = DomainDune(omega, gridView, filterTolerance=10 * omega.epsilon.value)
|
173
187
|
|
174
188
|
print(
|
175
189
|
f"h_max={h_max}, h_min={h_min * 0.5 ** (adaptLevels / 2)}, epsilon={omega.epsilon.value}"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from dune.ufl import Constant
|
2
|
-
from ufl import Identity, as_vector,
|
2
|
+
from ufl import Identity, as_vector, inner, sqrt, sym, tr
|
3
3
|
|
4
4
|
from ddfem.boundary import BndFlux_v, BndValue
|
5
5
|
|
@@ -28,6 +28,10 @@ def leModel():
|
|
28
28
|
def S_i(t, x, U, DU):
|
29
29
|
return as_vector([0.0, -Model.rho * Model.g])
|
30
30
|
|
31
|
+
def von_Mises(U, DU):
|
32
|
+
s = Model.sigma(U, DU) - (1.0 / 3) * tr(Model.sigma(U, DU)) * Identity(2)
|
33
|
+
return sqrt(3.0 / 2 * inner(s, s))
|
34
|
+
|
31
35
|
valD = lambda t, x, U: Model.vd
|
32
36
|
|
33
37
|
valN = lambda t, x, U, DU, n: Model.vn
|