diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35334a054358079da90b0d5e3d5f9abf6cab6661..3df7670d7e87a132c2f698b0c8447795a671e16a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,9 @@ # Path to the example grid files in dune-grid add_definitions(-DDUNE_GRID_EXAMPLE_GRIDS_PATH=\"${DUNE_GRID_EXAMPLE_GRIDS_PATH}\") +# Path to the grid files in this module +set(GRID_PATH "${CMAKE_CURRENT_SOURCE_DIR}/grids/") + set(TESTS averagedistanceassemblertest cosseratrodenergytest @@ -40,7 +43,8 @@ if(dune-foamgrid_FOUND) endif() foreach(_test ${TESTS}) - dune_add_test(SOURCES ${_test}.cc) + dune_add_test(SOURCES ${_test}.cc + COMPILE_DEFINITIONS "GRID_PATH=\"${GRID_PATH}\"") target_compile_options(${_test} PRIVATE -g) endforeach() diff --git a/test/grids/sphere_order2.msh b/test/grids/sphere_order2.msh new file mode 100644 index 0000000000000000000000000000000000000000..8eb80252975e9b4add07916639e7410bbfa3b1f2 --- /dev/null +++ b/test/grids/sphere_order2.msh @@ -0,0 +1,1276 @@ +$MeshFormat +4.1 0 8 +$EndMeshFormat +$Entities +7 12 8 1 +1 0 0 0 0 +2 1 0 0 0 +3 0 1 0 0 +4 -1 0 0 0 +5 0 -1 0 0 +6 0 0 -1 0 +7 0 0 1 0 +1 5.551115123125783e-17 0 0 1 1 0 0 2 2 -3 +2 -1 5.551115123125783e-17 0 0 1 0 0 2 3 -4 +3 -1 -1 0 -5.551115123125783e-17 0 0 0 2 4 -5 +4 0 -1 0 1 -5.551115123125783e-17 0 0 2 5 -2 +5 0 5.551115123125783e-17 -1 0 1 0 0 2 3 -6 +6 0 -1 -1 0 0 -5.551115123125783e-17 0 2 6 -5 +7 0 -1 0 0 -5.551115123125783e-17 1 0 2 5 -7 +8 0 0 5.551115123125783e-17 0 1 1 0 2 7 -3 +9 5.551115123125783e-17 0 0 1 0 1 0 2 2 -7 +10 -1 0 5.551115123125783e-17 0 0 1 0 2 7 -4 +11 -1 0 -1 -5.551115123125783e-17 0 0 0 2 4 -6 +12 0 0 -1 1 0 -5.551115123125783e-17 0 2 6 -2 +14 -1 0 0 0 1 1 0 3 2 -10 8 +16 -1 -1 0 0 0 1 0 3 10 3 7 +18 0 0 0 1 1 1 0 3 -8 -9 1 +20 -1 0 -1 0 1 0 0 3 -11 -2 5 +22 0 0 -1 1 1 0 0 3 -5 -1 -12 +24 -1 -1 -1 0 0 0 0 3 -3 11 6 +26 0 -1 0 1 0 1 0 3 -7 4 9 +28 0 -1 -1 1 0 0 0 3 -4 -6 12 +30 -1 -1 -1 1 1 1 0 8 28 26 16 14 20 24 22 18 +$EndEntities +$Nodes +28 451 1 451 +0 1 0 1 +1 +0 0 0 +0 2 0 1 +2 +1 0 0 +0 3 0 1 +3 +0 1 0 +0 4 0 1 +4 +-1 0 0 +0 5 0 1 +5 +0 -1 0 +0 6 0 1 +6 +0 0 -1 +0 7 0 1 +7 +0 0 1 +1 1 0 7 +8 +9 +10 +116 +117 +118 +119 +0.923879532082714 0.382683433399756 0 +0.7071067795767627 0.7071067827963323 0 +0.3826834312295725 0.9238795329816334 0 +0.9807852803058363 0.1950903225057617 0 +0.8314696113269344 0.5555702344797071 0 +0.5555702315644191 0.8314696132748676 0 +0.1950903214881709 0.9807852805082476 0 +1 2 0 7 +11 +12 +13 +120 +121 +122 +123 +-0.382683433399756 0.923879532082714 0 +-0.7071067827963323 0.7071067795767627 0 +-0.9238795329816334 0.3826834312295725 0 +-0.1950903225057617 0.9807852803058363 0 +-0.5555702344797071 0.8314696113269344 0 +-0.8314696132748676 0.5555702315644191 0 +-0.9807852805082476 0.1950903214881709 0 +1 3 0 7 +14 +15 +16 +124 +125 +126 +127 +-0.923879532082714 -0.382683433399756 0 +-0.7071067795767627 -0.7071067827963323 0 +-0.3826834312295725 -0.9238795329816334 0 +-0.9807852803058363 -0.1950903225057617 0 +-0.8314696113269344 -0.5555702344797071 0 +-0.5555702315644191 -0.8314696132748676 0 +-0.1950903214881709 -0.9807852805082476 0 +1 4 0 7 +17 +18 +19 +128 +129 +130 +131 +0.382683433399756 -0.923879532082714 0 +0.7071067827963323 -0.7071067795767627 0 +0.9238795329816334 -0.3826834312295725 0 +0.1950903225057617 -0.9807852803058363 0 +0.5555702344797071 -0.8314696113269344 0 +0.8314696132748676 -0.5555702315644191 0 +0.9807852805082476 -0.1950903214881709 0 +1 5 0 7 +20 +21 +22 +132 +133 +134 +135 +0 0.923879532082714 -0.382683433399756 +0 0.7071067795767627 -0.7071067827963323 +0 0.3826834312295725 -0.9238795329816334 +0 0.9807852803058363 -0.1950903225057617 +0 0.8314696113269344 -0.5555702344797071 +0 0.5555702315644191 -0.8314696132748676 +0 0.1950903214881709 -0.9807852805082476 +1 6 0 7 +23 +24 +25 +136 +137 +138 +139 +0 -0.382683433399756 -0.923879532082714 +0 -0.7071067827963323 -0.7071067795767627 +0 -0.9238795329816334 -0.3826834312295725 +0 -0.1950903225057617 -0.9807852803058363 +0 -0.5555702344797071 -0.8314696113269344 +0 -0.8314696132748676 -0.5555702315644191 +0 -0.9807852805082476 -0.1950903214881709 +1 7 0 7 +26 +27 +28 +140 +141 +142 +143 +0 -0.923879532082714 0.382683433399756 +0 -0.7071067795767627 0.7071067827963323 +0 -0.3826834312295725 0.9238795329816334 +0 -0.9807852803058363 0.1950903225057617 +0 -0.8314696113269344 0.5555702344797071 +0 -0.5555702315644191 0.8314696132748676 +0 -0.1950903214881709 0.9807852805082476 +1 8 0 7 +29 +30 +31 +144 +145 +146 +147 +0 0.382683433399756 0.923879532082714 +0 0.7071067827963323 0.7071067795767627 +0 0.9238795329816334 0.3826834312295725 +0 0.1950903225057617 0.9807852803058363 +0 0.5555702344797071 0.8314696113269344 +0 0.8314696132748676 0.5555702315644191 +0 0.9807852805082476 0.1950903214881709 +1 9 0 7 +32 +33 +34 +148 +149 +150 +151 +0.923879532082714 0 0.382683433399756 +0.7071067795767627 0 0.7071067827963323 +0.3826834312295725 0 0.9238795329816334 +0.9807852803058363 0 0.1950903225057617 +0.8314696113269344 0 0.5555702344797071 +0.5555702315644191 0 0.8314696132748676 +0.1950903214881709 0 0.9807852805082476 +1 10 0 7 +35 +36 +37 +152 +153 +154 +155 +-0.382683433399756 0 0.923879532082714 +-0.7071067827963323 0 0.7071067795767627 +-0.9238795329816334 0 0.3826834312295725 +-0.1950903225057617 0 0.9807852803058363 +-0.5555702344797071 0 0.8314696113269344 +-0.8314696132748676 0 0.5555702315644191 +-0.9807852805082476 0 0.1950903214881709 +1 11 0 7 +38 +39 +40 +156 +157 +158 +159 +-0.923879532082714 0 -0.382683433399756 +-0.7071067795767627 0 -0.7071067827963323 +-0.3826834312295725 0 -0.9238795329816334 +-0.9807852803058363 0 -0.1950903225057617 +-0.8314696113269344 0 -0.5555702344797071 +-0.5555702315644191 0 -0.8314696132748676 +-0.1950903214881709 0 -0.9807852805082476 +1 12 0 7 +41 +42 +43 +160 +161 +162 +163 +0.382683433399756 0 -0.923879532082714 +0.7071067827963323 0 -0.7071067795767627 +0.9238795329816334 0 -0.3826834312295725 +0.1950903225057617 0 -0.9807852803058363 +0.5555702344797071 0 -0.8314696113269344 +0.8314696132748676 0 -0.5555702315644191 +0.9807852805082476 0 -0.1950903214881709 +2 14 0 45 +44 +45 +46 +47 +48 +49 +50 +51 +52 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +-0.415961558938104 0.8086729639274099 0.4159615594001928 +-0.3513492819509157 0.5457652364897508 0.7607193889417189 +-0.8086729650694494 0.4159615580604771 0.4159615580575751 +-0.5469711171766888 0.3483177506778902 0.7612472276055789 +-0.683386533121198 0.6659151537738685 0.2992321077740738 +-0.5884601166351738 0.5858478252116919 0.5572225918108927 +-0.2710534737310408 0.2754376988783996 0.922314527921418 +-0.2377861023671402 0.9408046350285552 0.2415458718956523 +-0.9468433920703524 0.2274968556512286 0.2274483931829651 +-0.3935661823842039 0.6931011246908895 0.6039176194115781 +-0.1791189423058796 0.6387178043730846 0.7483020585860023 +-0.2159444375257923 0.7846962578984894 0.581050585355334 +-0.2152316477586513 0.8880697575903765 0.4062110823900125 +-0.7846601264589276 0.2153018134829401 0.5813377805169873 +-0.8877581809579371 0.2144777442607579 0.4072894663001628 +-0.64066989622485 0.1798789650514131 0.7464486867851481 +-0.6952285573077134 0.391041707144909 0.6031116284544932 +-0.5502600093503964 0.8205844519621066 0.1544508961053669 +-0.5600508664824316 0.7450525298829305 0.3622702784763363 +-0.409096883564026 0.8872457208738871 0.2131543352812185 +-0.7042915194371814 0.693672485015863 0.1509699943060991 +-0.7547405952383163 0.5472544993628281 0.3617722305905365 +-0.832040941713886 0.5329948499225731 0.1537021836796195 +-0.8877581808153857 0.4072894669155769 0.2144777436821405 +-0.3305434169468569 0.1392682908227538 0.9334588328814533 +-0.4146155806266799 0.3161503104435636 0.8533128977743389 +-0.4753270578600186 0.178092875040523 0.8615956800761824 +-0.509146939975206 0.7065198419235289 0.4915273201788843 +-0.4758445717310666 0.5729586586432448 0.6673007710469182 +-0.1796874698531291 0.4748283289455292 0.861539593523465 +-0.1202221975598521 0.9414224224509923 0.3150721278062933 +-0.3301771477183117 0.883577541478883 0.332074960391073 +-0.9444173357284856 0.3080439252973007 0.1148252414016184 +-0.8882470059893809 0.32483298093261 0.324808852787813 +-0.3134214605784661 0.9417700199034541 0.1218040133161 +-0.9444217997129519 0.1148502502748928 0.3080209152618427 +-0.3153939186352389 0.4161331367090292 0.852853966761375 +-0.4538735382749148 0.4509953370765944 0.768506354683537 +-0.1383021826614453 0.1404720375379773 0.9803775359222635 +-0.1369896198570827 0.3326124608894895 0.9330609813471196 +-0.1206926544816171 0.9850899424365984 0.1226013395703329 +-0.9866213638644227 0.1152908171957007 0.1152662649549036 +-0.574930848869429 0.4730190535415634 0.6676132817768992 +-0.7097596847836821 0.5054878438751113 0.4906355363712042 +-0.6431558100544389 0.6314909487555367 0.4330932759037601 +2 16 0 45 +53 +54 +55 +56 +57 +58 +59 +60 +61 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +-0.4159615589381042 -0.415961559400193 0.8086729639274099 +-0.3513492812904227 -0.7607193888061874 0.5457652371038708 +-0.8086729639231932 -0.4159615589421272 0.4159615594043674 +-0.5469711167842398 -0.7612472273380482 0.3483177518788492 +-0.6833865325208754 -0.2992321075254806 0.6659151545016477 +-0.5884601164668629 -0.5572225903712388 0.5858478267500636 +-0.2710534729146807 -0.922314527658134 0.2754377005633823 +-0.2377861022439332 -0.2415458719129071 0.9408046350552653 +-0.9468433913210873 -0.2274483949520381 0.2274968570009796 +-0.3935661821357354 -0.6039176190665856 0.6931011251325794 +-0.1791189418712257 -0.7483020583680496 0.6387178047503236 +-0.215944437687618 -0.5810505852463088 0.7846962579346867 +-0.7846601245366975 -0.5813377827255778 0.2153018145250128 +-0.8877581798248866 -0.4072894686541396 0.2144777444804766 +-0.2152316477586182 -0.4062110823900296 0.8880697575903768 +-0.6406698944213219 -0.7464486881532948 0.1798789657975526 +-0.6952285563835858 -0.603111628662981 0.3910417084663498 +-0.5502600090046537 -0.1544508961594966 0.8205844521837633 +-0.5600508661395556 -0.3622702783421446 0.7450525302059167 +-0.4090968835051902 -0.2131543355316491 0.8872457208408513 +-0.7042915189605282 -0.1509699942563357 0.6936724855106435 +-0.7547405944350799 -0.3617722308942539 0.547254500269826 +-0.832040941521648 -0.1537021835645149 0.5329948502558628 +-0.8877581806242931 -0.2144777447201293 0.4072894667854938 +-0.3305434154858528 -0.9334588332630303 0.1392682917327877 +-0.4146155800214213 -0.8533128975303668 0.3161503118958292 +-0.4753270568569339 -0.8615956803987153 0.1780928761573584 +-0.5091469396891045 -0.4915273197572164 0.7065198424230607 +-0.4758445731314365 -0.6673007697160708 0.5729586590302135 +-0.1796874695502333 -0.8615395931362974 0.4748283297626387 +-0.1202221974768857 -0.3150721279322809 0.9414224224194221 +-0.3301771477298296 -0.3320749605537268 0.8835775414134488 +-0.9444173354058495 -0.1148252423440808 0.3080439259351467 +-0.8882470049201591 -0.3248088542401155 0.3248329824041734 +-0.3134214606421615 -0.121804012758627 0.9417700199543572 +-0.9444217989683066 -0.3080209173006747 0.1148502509301504 +-0.3153939179176888 -0.8528539665630314 0.416133137659372 +-0.4538735375415756 -0.7685063547322879 0.4509953377315409 +-0.1383021819326626 -0.9803775359018377 0.1404720383980571 +-0.1369896194260846 -0.9330609810731251 0.3326124618356235 +-0.1206926546456856 -0.1226013397157307 0.9850899423984011 +-0.9866213636784659 -0.1152662659404205 0.1152908178017511 +-0.5749308486387945 -0.6676132808594172 0.4730190551168107 +-0.709759683993898 -0.4906355360377664 0.5054878453076943 +-0.6431558095727471 -0.4330932750732666 0.6314909498157008 +2 18 0 41 +62 +63 +64 +65 +66 +67 +68 +69 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +0.4159615594014651 0.4159615589450291 0.8086729639231933 +0.758782979125179 0.5608503593763251 0.3312027550872202 +0.3898497269017617 0.745547033613041 0.5405338205010088 +0.7174092469569007 0.3509791682729025 0.6017786933908464 +0.536664390949363 0.8031750231598166 0.2586526892556447 +0.9174466667407223 0.292741083040234 0.2694332421709853 +0.2708248681120411 0.929987912297321 0.2485485340792938 +0.2274483941486833 0.2274968568884106 0.946843391541114 +0.5730779144668525 0.5675282320663921 0.5911796763742121 +0.7493235125444836 0.4628498193748312 0.4735866533726255 +0.5965365170918011 0.6665127814580778 0.4471072532726346 +0.4123540722712462 0.5943734052967912 0.6904233296733361 +0.202621305591877 0.7417414707867637 0.6393466954910548 +0.215332660822953 0.581360471911059 0.7846348493931796 +0.2132262989375409 0.4091224273229124 0.8872166504878088 +0.5829433553983069 0.2133896531831734 0.7839910078000438 +0.4091289859247101 0.2132217662309255 0.8872147154334078 +0.5792343797832683 0.3884696078396837 0.7166441913962427 +0.7245342400628726 0.1785117125389157 0.6657204394210376 +0.6571043932775676 0.6918835631776679 0.2991838086192062 +0.4711966052674891 0.7833629954129243 0.4053593178922677 +0.2003963839444631 0.8574725613029446 0.4739009347052939 +0.9322209812041404 0.1482081128454834 0.3301490534433955 +0.8348034735195801 0.3261976242886421 0.4435067874430892 +0.8476750471398038 0.1772774000153416 0.5000197375107626 +0.3359891705762084 0.8521011517402342 0.4012915454609999 +0.1370002808657191 0.9377259078858128 0.3192194303648228 +0.7456143446471957 0.6448757469961878 0.1679122389596474 +0.8623918553644833 0.4776107941280363 0.1678338974503976 +0.1148252873550821 0.308043961207611 0.9444173184283241 +0.325393977240433 0.3254183378137244 0.8878184865107311 +0.3092410703017528 0.1156232804034876 0.9439286082471293 +0.8498477053502357 0.4314293186884272 0.302700546228411 +0.6329912803176195 0.7631020929843566 0.1303734433262969 +0.9791783421214619 0.1498989741044417 0.1368943822174633 +0.9300995977337903 0.3411519853884021 0.1361251672579068 +0.1382465771117551 0.9823505366682244 0.1259972500673519 +0.3317024918098061 0.9350555147195274 0.1250785406045546 +0.4675666423771431 0.8741933797908256 0.1310243094469797 +0.1152761279043759 0.115300653625855 0.9866190620542583 +0.4085476045192215 0.8762176528977281 0.2556002339435588 +2 20 0 41 +70 +71 +72 +73 +74 +75 +76 +77 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +-0.8086729639231933 0.4159615594014651 -0.4159615589450291 +-0.331202754324082 0.7587829796006039 -0.5608503591837767 +-0.5405338205010088 0.3898497269017615 -0.7455470336130411 +-0.6017786921276245 0.7174092477019985 -0.3509791689157893 +-0.2586526869761673 0.5366643912884629 -0.8031750236673152 +-0.2694332424264601 0.9174466664542416 -0.2927410837029271 +-0.2485485354492085 0.2708248715254906 -0.9299879109371557 +-0.9468433915408873 0.2274483941572331 -0.2274968568808061 +-0.5913000201591198 0.5722347880648077 -0.568253142083921 +-0.4770036073293505 0.7457394473659547 -0.4651238923524648 +-0.4503698190289505 0.5906974882402037 -0.6695098979810116 +-0.690423382092888 0.4123541993253133 -0.5943732562609102 +-0.6399476401079226 0.2020524246272956 -0.7413783350102238 +-0.7846601238756394 0.2153018136566747 -0.5813377839394345 +-0.887758180074027 0.2144777449183253 -0.4072894678805247 +-0.7846601257101951 0.5813377813499115 -0.215301813962687 +-0.8877581803794257 0.4072894675107815 -0.214477744356367 +-0.7182104232608366 0.5767176120759918 -0.3893206696809914 +-0.6660133081980701 0.7243259456949063 -0.178264403895567 +-0.2991963417965819 0.6570984774264818 -0.6918837619277838 +-0.4083243719551745 0.4708976174109869 -0.782001688734793 +-0.4741436652389991 0.2002180719368581 -0.8573800256500119 +-0.3301569608773713 0.9322175954035596 -0.1482117944167174 +-0.4445542576962946 0.833428878280436 -0.3282800889671968 +-0.5059392024339181 0.8434985097192307 -0.1803767932467145 +-0.4022056386408229 0.3348373607335072 -0.8521235626964828 +-0.3194604102861211 0.1364343200436582 -0.9377263580459109 +-0.1684416354028925 0.745515563815409 -0.6448518896396226 +-0.1692096335234375 0.8596496890352767 -0.4820482466148137 +-0.944417335088355 0.1148252418567118 -0.3080439270902081 +-0.8882470051072854 0.3248088541070272 -0.3248329820255604 +-0.94442179947684 0.308020915739572 -0.1148502509352188 +-0.3041778758238466 0.848886805908192 -0.4322811707838777 +-0.131163187543655 0.6302190007610711 -0.7652582762134003 +-0.1376563164119855 0.979134675222136 -0.1494858733443577 +-0.1360969450587202 0.9300962176393575 -0.3411724600237315 +-0.1265626915833704 0.1378449537413736 -0.9823342882273891 +-0.1255185524470763 0.3297796781147728 -0.9356764702043689 +-0.1318928391938922 0.4662360794803355 -0.8747732261335964 +-0.9866213637338795 0.1152662655090786 -0.1152908177587882 +-0.2564116144263623 0.4082316887395076 -0.8761278287419914 +2 22 0 45 +78 +79 +80 +81 +82 +83 +84 +85 +86 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +0.8086729639165581 0.415961558951558 -0.415961559407836 +0.5430630994175535 0.3281019341489998 -0.7729369902253909 +0.5429778564933904 0.7669540826273032 -0.3419890093250876 +0.2735074671702702 0.5396063693541514 -0.7962528691028589 +0.2845750104554785 0.7908280487799344 -0.5418561254495387 +0.2637376809693576 0.9231112293883201 -0.2798358336848404 +0.5782123939126311 0.578202487072993 -0.5756320973229602 +0.2694052845970259 0.2699756494285361 -0.9244100504358636 +0.9408046356421613 0.2415458731726819 -0.2377860986421759 +0.6934862618776509 0.6066929993610801 -0.3885877109652571 +0.6375224507313543 0.750652121058777 -0.1734546567937774 +0.7846418529966417 0.5813549472090189 -0.2153220561893178 +0.6400318631686437 0.1672407332297412 -0.749926497249999 +0.6939861564536182 0.3817779102966318 -0.6104333230257595 +0.7848579638236904 0.2138891717906872 -0.5815921240983448 +0.8877902147448991 0.4071946434856368 -0.2145251894762268 +0.8880476578745103 0.2132673042039399 -0.4072940145658669 +0.7054938783057576 0.5018056153475067 -0.5004692918439761 +0.5671165042376901 0.6804014668381322 -0.4641472983286017 +0.5679779877137299 0.4590851304016987 -0.6831118857966952 +0.4721822007186928 0.1673497234873861 -0.8654698373560731 +0.47282281980219 0.8636685535805101 -0.174686034445961 +0.941443181306571 0.3150969776464726 -0.1199942959036839 +0.8841049993166824 0.3311525131842222 -0.3296913150130326 +0.941762816506033 0.1219932715306678 -0.3133694930076457 +0.3280955847949989 0.9338227912580173 -0.1425772834820216 +0.1345050241486663 0.9805846720749799 -0.1426958281463429 +0.1451258524202688 0.8710279097759887 -0.4693067944858272 +0.1444002638803366 0.7599908733655688 -0.6336895424356701 +0.1377226282095203 0.1370836449846438 -0.9809386076390235 +0.3316595562165304 0.1360890679646705 -0.9335318443153191 +0.1364475020463333 0.329958853129909 -0.9340820276755735 +0.4092116336923283 0.8563830359921939 -0.3148871774392351 +0.4404377229245929 0.6960098645429584 -0.5670845445644698 +0.4335424374472546 0.5684550095707647 -0.6992137420175573 +0.2836143091629968 0.6761190010444195 -0.6800191321313631 +0.4176528560370158 0.4405628008933785 -0.7946511878258944 +0.1387987124388905 0.6321735866950351 -0.7622935613728093 +0.1387758533506601 0.4679636559750658 -0.8727836382593606 +0.1332099519871895 0.9328873658132236 -0.3346285573552193 +0.9851091379556606 0.1222810206167382 -0.1208608220772302 +0.4115369722615859 0.3027789224336607 -0.8596291320050048 +0.277172735363483 0.8663983736776455 -0.415366263507107 +0.4196434958143728 0.789560169416814 -0.4477656477345984 +0.2745327695013721 0.4093782202393834 -0.8700811636069024 +2 24 0 45 +87 +88 +89 +90 +91 +92 +93 +94 +95 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +-0.752690446999476 -0.344965850330655 -0.5607634555687246 +-0.4159615580535521 -0.808672965073666 -0.4159615580563027 +-0.4159615594108959 -0.415961558948498 -0.8086729639165581 +-0.7627417501010839 -0.5597797462933912 -0.3238389388144085 +-0.2992321077523647 -0.6833865331535546 -0.6659151537504179 +-0.5625700278711022 -0.5819739606832606 -0.5872148438414564 +-0.9187229508124976 -0.2793977453656012 -0.2790789127379488 +-0.2377861002175336 -0.9408046356177686 -0.2415458717168535 +-0.2415458720975941 -0.2377861010076962 -0.940804635320304 +-0.5834545504169254 -0.2189971561939839 -0.7820620392121914 +-0.6010462672022246 -0.3867436907993984 -0.6994088234424349 +-0.7433873086275626 -0.1746908992754269 -0.6456457225768725 +-0.583454549241826 -0.7820620405611886 -0.2189971545072841 +-0.4090968818432282 -0.8872457218111922 -0.213154334682371 +-0.4090968825302697 -0.2131543355298468 -0.8872457212908069 +-0.7470360991696947 -0.6443127641618933 -0.1637013392595988 +-0.6076627473441065 -0.6992037744700286 -0.3766431563921983 +-0.1571204611089466 -0.5489581645965208 -0.8209495077187946 +-0.3636296322586041 -0.557292106855128 -0.7464576332119893 +-0.2152316480932357 -0.4062110833683225 -0.8880697570617994 +-0.1522446024506958 -0.7029994797212155 -0.6947037588327344 +-0.3626118786006027 -0.7543416175857806 -0.5472488917081605 +-0.1563539045947749 -0.8277933786701094 -0.5388056966550119 +-0.2152316472997767 -0.8880697580090158 -0.4062110817179077 +-0.9316749143645194 -0.3347680402822825 -0.1411106415173048 +-0.8528008751170314 -0.4249095506050936 -0.3036157789117731 +-0.8635961701073053 -0.4763279091370663 -0.1652675949879617 +-0.4955854402186609 -0.5045895039194079 -0.7069543860657787 +-0.6669186943829639 -0.470034552505658 -0.5781755568452617 +-0.8608401208926343 -0.1764012971209252 -0.4773226043627199 +-0.3152130125964734 -0.1198238045007216 -0.9414260526269858 +-0.3320794171400803 -0.3301763214608931 -0.8835761752437972 +-0.1202221963864387 -0.9414224226605846 -0.3150721276277798 +-0.3301771463459194 -0.8835775422569612 -0.3320749596853294 +-0.3134214582881271 -0.9417700207105955 -0.1218040129688193 +-0.122175971564846 -0.3132830514429271 -0.9417678916011069 +-0.8488192660762165 -0.3143097268853645 -0.4251061621796144 +-0.7685042038453483 -0.4574450643552472 -0.4473760183213346 +-0.9794700381440761 -0.1426268157017552 -0.1424641562668297 +-0.9317039782036856 -0.1412762595562687 -0.334617267165363 +-0.122601171234006 -0.1206927334792192 -0.9850899537084742 +-0.1206928237739446 -0.9850899555286854 -0.122601067719511 +-0.6735827205981744 -0.5758554663157114 -0.463332278635836 +-0.4958548413360291 -0.7046992367215092 -0.5074711440936749 +-0.4379399219250809 -0.6390276347176821 -0.632338759567511 +2 26 0 49 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +0.3130090706651065 -0.7856217931301513 0.5336887855673305 +0.7856154590230008 -0.3221183472142142 0.528250055307203 +0.3178325135269092 -0.5187427131040454 0.7936551461098335 +0.546013463533105 -0.3134754486941342 0.7769185547447002 +0.5335672221903445 -0.7936307970700706 0.2923288855826673 +0.7772820686048685 -0.5538201711159975 0.2985227024706557 +0.9287192057011995 -0.2679553352792744 0.2562822179884996 +0.5719308004781175 -0.5761984038046547 0.5838583380559259 +0.2664079727525482 -0.9272249566171067 0.2632122183339557 +0.2588075257629718 -0.2613572206159219 0.9298984180222961 +0.7599640924071688 -0.1639945108179727 0.6289359098297076 +0.8727630827262035 -0.162735852561794 0.4602191257664546 +0.1599206958475328 -0.8701501260351854 0.4661160040168025 +0.1592095097335162 -0.7592031327686161 0.631080767576332 +0.3210413600238357 -0.6638035699976553 0.6754977909752286 +0.1618606709270737 -0.6242581606646562 0.764266231133247 +0.1617014399098354 -0.4586053633614218 0.8738041914681023 +0.9366360755606044 -0.1354727436617242 0.3230479804660519 +0.9820453698041197 -0.136005421645712 0.130726496661012 +0.6858228303341829 -0.5732607032374556 0.4483516605479546 +0.5622279467681756 -0.6966600290866912 0.4456058120646227 +0.6657091749760465 -0.6834701490421671 0.2994993317538275 +0.8672545648730844 -0.4749348692518467 0.1493532379144429 +0.7533452082548618 -0.6399356031420834 0.1515038647382193 +0.4730954531510532 -0.1596899623881894 0.8664178022872442 +0.6406299130667116 -0.159524018882289 0.7510961335832986 +0.135709709844694 -0.9816333462914667 0.1340852270106079 +0.1346466747082609 -0.935576594795087 0.3264455670730377 +0.3289952488362957 -0.9347907055860255 0.1338972105501995 +0.4503170323424316 -0.6905907438568912 0.5659496398810507 +0.4299221356415421 -0.7993983111393642 0.4196776113077126 +0.8685449304981343 -0.2974048566486819 0.3964593988642061 +0.1320995542169629 -0.1325486217249174 0.9823342458931706 +0.3262477149255694 -0.1316369524484197 0.9360737904972752 +0.1307547660458919 -0.3253104045902184 0.9365235351135776 +0.4512407821955172 -0.5552866468074545 0.6985975210097091 +0.6309456592836843 -0.7617112935215483 0.1473210112401029 +0.4654670625656714 -0.8725171384146776 0.1485067568804457 +0.6758842371747648 -0.322287675795655 0.6628055159463604 +0.9355684152155788 -0.3285747021004944 0.1294233579790815 +0.4079873652364213 -0.2913995399644331 0.8652355852113109 +0.2932264665628803 -0.8668200097667765 0.4032881227794506 +0.6902644862624601 -0.4551038014441024 0.5625081945322653 +0.7920675026995421 -0.443921306413778 0.4190023208518005 +0.8650873036835114 -0.4157649243286126 0.2806483292371704 +0.5665994210270184 -0.450906817212855 0.6896724862446092 +0.4397952111786331 -0.4212963674679917 0.7931516519447062 +0.2916609018946494 -0.3941243311434642 0.8715503025681974 +0.4049229862326437 -0.8701504892471716 0.2808478258476393 +2 28 0 49 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +0.538053125082038 -0.3083817544043235 -0.784474045548968 +0.5211554492868533 -0.7931621792199559 -0.3151043559420731 +0.7990752178334859 -0.3223894898289964 -0.5074877467409107 +0.7855356110657611 -0.5406627370140992 -0.3010275876924976 +0.2790725544226984 -0.5376257364254065 -0.7956614084527598 +0.2852089917372906 -0.7941420923698037 -0.5366508810751252 +0.256310035984433 -0.927432976914512 -0.2723476432524154 +0.5858759320131174 -0.5796320993683363 -0.5663709223376643 +0.2525047701013874 -0.252504770101611 -0.9340678145359564 +0.9307259248704715 -0.2576936713923973 -0.2595057311473344 +0.6368816772351364 -0.1567994633115497 -0.7548481022744706 +0.4685621656253821 -0.1569350640496759 -0.8693795963882383 +0.4597771973438307 -0.8734480626216155 -0.1602916426555013 +0.626181534301119 -0.7632509135445542 -0.1592002797538368 +0.7678884374318646 -0.1644481451422025 -0.6191156234644205 +0.6810260573750806 -0.3212643385261688 -0.6580218339595553 +0.8783575235154668 -0.1627968094977559 -0.4494277024184505 +0.130569108904107 -0.9816863915781161 -0.1387210740670819 +0.3242897031052827 -0.9357320607155161 -0.1387144513343193 +0.4407288638590699 -0.568222941734106 -0.6948962203441115 +0.4449431570198256 -0.6988474959382616 -0.5600337172367857 +0.2869489642480052 -0.677231621521068 -0.6775083931059024 +0.1447732297996825 -0.761933636962745 -0.6312668570407381 +0.1453838761657661 -0.8724649299503712 -0.466549541375523 +0.7582728296120413 -0.6337626194514082 -0.1528635275604936 +0.8709454907237661 -0.4677815378493163 -0.1504472832432228 +0.5708415242770194 -0.4510204818215999 -0.6860907222361347 +0.4182765115938533 -0.4297557573055552 -0.8002216873539517 +0.3935546477859859 -0.8700129858758242 -0.2969716208890696 +0.9370773546090869 -0.3235636335868789 -0.1311205799975416 +0.9825499103615929 -0.1307737539897644 -0.1322645036124587 +0.9369115028287704 -0.1301819552831198 -0.3244217846967103 +0.7039215325945368 -0.4563170841612444 -0.5443061589329465 +0.3228691860852707 -0.1271501318874306 -0.9378637068559822 +0.1287282837162772 -0.1279451521494493 -0.9833916142681488 +0.1275589352526404 -0.32080183624562 -0.9385173945637082 +0.1416471168655956 -0.4671155874000933 -0.8727766737783097 +0.1416634470174834 -0.6314664365442191 -0.7623526790779123 +0.6652293911754713 -0.6777750481517074 -0.3131945740578246 +0.1294211499323892 -0.9348014500975974 -0.3307512885018094 +0.8698802476133356 -0.4037175711698727 -0.2834086758390797 +0.4007448160425578 -0.2841493923469021 -0.8710124656076413 +0.5614980403779416 -0.6962956841876418 -0.4470931344064628 +0.4089260418511004 -0.8038844942822415 -0.4319134313130081 +0.273803958018305 -0.8704662927554239 -0.4090474614884423 +0.6961613141961122 -0.5674296079727369 -0.4397534134178474 +0.8014196360176534 -0.4364816048290705 -0.4089136530505808 +0.8748233046846993 -0.2918950528892273 -0.3866283275696918 +0.2692145491669128 -0.4001574517935146 -0.8760122946003537 +3 30 0 0 +$EndNodes +$Elements +27 279 1 551 +0 1 15 1 +1 1 +0 2 15 1 +2 2 +0 3 15 1 +3 3 +0 4 15 1 +4 4 +0 5 15 1 +5 5 +0 6 15 1 +6 6 +0 7 15 1 +7 7 +1 1 8 4 +280 2 8 116 +281 8 9 117 +282 9 10 118 +283 10 3 119 +1 2 8 4 +284 3 11 120 +285 11 12 121 +286 12 13 122 +287 13 4 123 +1 3 8 4 +288 4 14 124 +289 14 15 125 +290 15 16 126 +291 16 5 127 +1 4 8 4 +292 5 17 128 +293 17 18 129 +294 18 19 130 +295 19 2 131 +1 5 8 4 +296 3 20 132 +297 20 21 133 +298 21 22 134 +299 22 6 135 +1 6 8 4 +300 6 23 136 +301 23 24 137 +302 24 25 138 +303 25 5 139 +1 7 8 4 +304 5 26 140 +305 26 27 141 +306 27 28 142 +307 28 7 143 +1 8 8 4 +308 7 29 144 +309 29 30 145 +310 30 31 146 +311 31 3 147 +1 9 8 4 +312 2 32 148 +313 32 33 149 +314 33 34 150 +315 34 7 151 +1 10 8 4 +316 7 35 152 +317 35 36 153 +318 36 37 154 +319 37 4 155 +1 11 8 4 +320 4 38 156 +321 38 39 157 +322 39 40 158 +323 40 6 159 +1 12 8 4 +324 6 41 160 +325 41 42 161 +326 42 43 162 +327 43 2 163 +2 14 9 28 +328 44 45 30 164 165 166 +329 31 44 30 167 166 146 +330 36 46 37 168 169 154 +331 36 47 46 170 171 168 +332 11 48 44 172 173 174 +333 12 48 11 175 172 121 +334 46 48 13 176 177 178 +335 35 50 47 179 180 181 +336 35 47 36 181 170 153 +337 13 48 12 177 175 122 +338 44 49 45 182 183 164 +339 30 45 29 165 184 145 +340 31 51 44 185 186 167 +341 13 52 46 187 188 178 +342 44 51 11 186 189 174 +343 46 52 37 188 190 169 +344 47 50 45 180 191 192 +345 7 50 35 193 179 152 +346 29 50 7 194 193 144 +347 11 51 3 189 195 120 +348 37 52 4 190 196 155 +349 3 51 31 195 185 147 +350 4 52 13 196 187 123 +351 45 50 29 191 194 184 +352 45 49 47 183 197 192 +353 47 49 46 197 198 171 +354 46 49 48 198 199 176 +355 48 49 44 199 182 173 +2 16 9 28 +356 53 54 27 200 201 202 +357 15 55 14 203 204 125 +358 28 53 27 205 202 142 +359 15 56 55 206 207 203 +360 35 57 53 208 209 210 +361 36 57 35 211 208 153 +362 55 57 37 212 213 214 +363 16 59 56 215 216 217 +364 16 56 15 217 206 126 +365 37 57 36 213 211 154 +366 53 58 54 218 219 200 +367 27 54 26 201 220 141 +368 28 60 53 221 222 205 +369 37 61 55 223 224 214 +370 53 60 35 222 225 210 +371 55 61 14 224 226 204 +372 56 59 54 216 227 228 +373 5 59 16 229 215 127 +374 26 59 5 230 229 140 +375 35 60 7 225 231 152 +376 14 61 4 226 232 124 +377 7 60 28 231 221 143 +378 4 61 37 232 223 155 +379 54 59 26 227 230 220 +380 54 58 56 219 233 228 +381 56 58 55 233 234 207 +382 55 58 57 234 235 212 +383 57 58 53 235 218 209 +2 18 9 26 +384 64 65 63 236 237 238 +385 62 64 30 239 240 241 +386 29 62 30 242 241 145 +387 33 62 34 243 244 150 +388 62 65 64 245 236 239 +389 33 65 62 246 245 243 +390 63 66 64 247 248 238 +391 30 64 31 240 249 146 +392 32 67 65 250 251 252 +393 32 65 33 252 246 149 +394 64 68 31 253 254 249 +395 9 63 8 255 256 117 +396 29 69 62 257 258 242 +397 62 69 34 258 259 244 +398 65 67 63 251 260 237 +399 9 66 63 261 247 255 +400 2 67 32 262 250 148 +401 8 67 2 263 262 116 +402 31 68 3 254 264 147 +403 3 68 10 264 265 119 +404 10 66 9 266 261 118 +405 34 69 7 259 267 151 +406 7 69 29 267 257 144 +407 63 67 8 260 263 256 +408 66 68 64 268 253 248 +409 10 68 66 265 268 266 +2 20 9 26 +410 72 73 71 269 270 271 +411 70 72 39 272 273 274 +412 38 70 39 275 274 157 +413 12 70 13 276 277 122 +414 70 73 72 278 269 272 +415 12 73 70 279 278 276 +416 71 74 72 280 281 271 +417 39 72 40 273 282 158 +418 11 75 73 283 284 285 +419 11 73 12 285 279 121 +420 72 76 40 286 287 282 +421 21 71 20 288 289 133 +422 38 77 70 290 291 275 +423 70 77 13 291 292 277 +424 73 75 71 284 293 270 +425 21 74 71 294 280 288 +426 3 75 11 295 283 120 +427 20 75 3 296 295 132 +428 40 76 6 287 297 159 +429 6 76 22 297 298 135 +430 22 74 21 299 294 134 +431 13 77 4 292 300 123 +432 4 77 38 300 290 156 +433 71 75 20 293 296 289 +434 74 76 72 301 286 281 +435 22 76 74 298 301 299 +2 22 9 28 +436 78 80 9 302 303 304 +437 42 79 78 305 306 307 +438 8 78 9 308 304 117 +439 42 78 43 307 309 162 +440 78 84 80 310 311 302 +441 79 84 78 312 310 306 +442 41 79 42 313 305 161 +443 9 80 10 303 314 118 +444 8 86 78 315 316 308 +445 78 86 43 316 317 309 +446 10 83 3 318 319 119 +447 20 82 21 320 321 133 +448 6 85 41 322 323 160 +449 22 85 6 324 322 135 +450 80 83 10 325 318 314 +451 82 84 81 326 327 328 +452 81 84 79 327 312 329 +453 21 81 22 330 331 134 +454 3 83 20 319 332 132 +455 43 86 2 317 333 163 +456 2 86 8 333 315 116 +457 41 85 79 323 334 313 +458 82 83 80 335 325 336 +459 20 83 82 332 335 320 +460 80 84 82 311 326 336 +461 21 82 81 321 328 330 +462 79 85 81 334 337 329 +463 81 85 22 337 324 331 +2 24 9 28 +464 39 89 87 338 339 340 +465 15 88 16 341 342 126 +466 40 89 39 343 338 158 +467 15 90 88 344 345 341 +468 23 91 89 346 347 348 +469 24 91 23 349 346 137 +470 88 91 25 350 351 352 +471 14 93 90 353 354 355 +472 14 90 15 355 344 125 +473 25 91 24 351 349 138 +474 89 92 87 356 357 339 +475 39 87 38 340 358 157 +476 40 95 89 359 360 343 +477 25 94 88 361 362 352 +478 88 94 16 362 363 342 +479 89 95 23 360 364 348 +480 90 93 87 354 365 366 +481 4 93 14 367 353 124 +482 38 93 4 368 367 156 +483 23 95 6 364 369 136 +484 16 94 5 363 370 127 +485 5 94 25 370 361 139 +486 6 95 40 369 359 159 +487 87 93 38 365 368 358 +488 87 92 90 357 371 366 +489 90 92 88 371 372 345 +490 88 92 91 372 373 350 +491 91 92 89 373 356 347 +2 26 9 30 +492 33 97 32 374 375 149 +493 26 96 27 376 377 141 +494 96 98 27 378 379 377 +495 27 98 28 379 380 142 +496 32 102 2 381 382 148 +497 101 103 100 383 384 385 +498 19 101 18 386 387 130 +499 34 99 33 388 389 150 +500 5 104 26 390 391 140 +501 17 104 5 392 390 128 +502 100 103 96 384 393 394 +503 97 102 32 395 381 375 +504 7 105 34 396 397 151 +505 28 105 7 398 396 143 +506 96 103 98 393 399 378 +507 18 100 17 400 401 129 +508 33 99 97 389 402 374 +509 2 102 19 382 403 131 +510 34 105 99 397 404 388 +511 26 104 96 391 405 376 +512 97 103 101 406 383 407 +513 101 102 97 408 395 407 +514 19 102 101 403 408 386 +515 98 103 99 399 409 410 +516 99 105 98 404 411 410 +517 18 101 100 387 385 400 +518 99 103 97 409 406 402 +519 98 105 28 411 398 380 +520 96 104 100 405 412 394 +521 100 104 17 412 392 401 +2 28 9 30 +522 42 106 41 413 414 161 +523 17 107 18 415 416 129 +524 42 108 106 417 418 413 +525 43 108 42 419 417 162 +526 5 112 17 420 421 128 +527 110 113 111 422 423 424 +528 24 111 25 425 426 138 +529 18 109 19 427 428 130 +530 106 113 110 429 422 430 +531 17 112 107 421 431 415 +532 19 115 2 432 433 131 +533 2 115 43 433 434 163 +534 108 113 106 435 429 418 +535 41 114 6 436 437 160 +536 6 114 23 437 438 136 +537 23 110 24 439 440 137 +538 107 109 18 441 427 416 +539 25 112 5 442 420 139 +540 109 115 19 443 432 428 +541 106 114 41 444 436 414 +542 111 113 107 423 445 446 +543 107 112 111 431 447 446 +544 111 112 25 447 442 426 +545 109 113 108 448 435 449 +546 108 115 109 450 443 449 +547 110 111 24 424 425 440 +548 107 113 109 445 448 441 +549 43 115 108 434 450 419 +550 110 114 106 451 444 430 +551 23 114 110 438 451 439 +$EndElements diff --git a/test/nonplanarcosseratenergytest.cc b/test/nonplanarcosseratenergytest.cc index 9a55a5fce727e4597956120888f43e9e878e211d..a23461d45a888b5b536b4888d2d05a903a2eb843 100644 --- a/test/nonplanarcosseratenergytest.cc +++ b/test/nonplanarcosseratenergytest.cc @@ -1,15 +1,18 @@ #include "config.h" -#include <math.h> +#include <dune/common/test/testsuite.hh> +#include <dune/curvedgrid/curvedgrid.hh> #include <dune/foamgrid/foamgrid.hh> -#include <dune/geometry/type.hh> -#include <dune/geometry/quadraturerules.hh> +#include <dune/gmsh4/gmsh4reader.hh> +#include <dune/gmsh4/gridcreators/lagrangegridcreator.hh> #include <dune/functions/functionspacebases/interpolate.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/powerbasis.hh> +#include <dune/functions/gridfunctions/analyticgridviewfunction.hh> +#include <dune/functions/gridfunctions/composedgridfunction.hh> #include <dune/gfe/cosseratvtkwriter.hh> #include <dune/gfe/assemblers/nonplanarcosseratshellenergy.hh> @@ -17,46 +20,17 @@ #include <dune/gfe/spaces/realtuple.hh> #include <dune/gfe/spaces/rotation.hh> -#include "multiindex.hh" -#include "valuefactory.hh" using namespace Dune; -static const int dim = 2; -static const int dimworld = 3; -using GridType = FoamGrid<dim,dimworld>; -using TargetSpace = GFE::ProductManifold<RealTuple<double,dimworld>,Rotation<double,dimworld> >; - -////////////////////////////////////////////////////////// -// Make a test grid consisting of a single triangle -////////////////////////////////////////////////////////// - -template <class GridType> -std::unique_ptr<GridType> makeSingleElementGrid() -{ - constexpr auto triangle = Dune::GeometryTypes::triangle; - GridFactory<GridType> factory; - - //Create a triangle that is not parallel to the planes formed by the coordinate axes - FieldVector<double,dimworld> vertex0{0,0,0}; - FieldVector<double,dimworld> vertex1{0,1,1}; - FieldVector<double,dimworld> vertex2{1,0,0}; - factory.insertVertex(vertex0); - factory.insertVertex(vertex1); - factory.insertVertex(vertex2); - - factory.insertElement(triangle, {0,1,2}); - - return std::unique_ptr<GridType>(factory.createGrid()); -} - - -////////////////////////////////////////////////////////////////////////////////////// -// Test energy computation for the same grid with different refinement levels -////////////////////////////////////////////////////////////////////////////////////// -template <class F1, class F2> -double calculateEnergy(const int numLevels, const F1 referenceConfigurationFunction, const F2 configurationFunction) +template <typename FlatGridView, typename CurvedGridView, typename GridGeometry, + typename DeformationFunction, typename OrientationFunction> +double calculateEnergy(const FlatGridView& flatGridView, + const CurvedGridView& curvedGridView, + const GridGeometry curvedGridGeometry, + const DeformationFunction deformationFunction, + const OrientationFunction orientationFunction) { ParameterTree materialParameters; materialParameters["thickness"] = "0.1"; @@ -70,121 +44,239 @@ double calculateEnergy(const int numLevels, const F1 referenceConfigurationFunct materialParameters["b2"] = "1"; materialParameters["b3"] = "1"; - const std::unique_ptr<GridType> grid = makeSingleElementGrid<GridType>(); - grid->globalRefine(numLevels-1); - GridType::LeafGridView gridView = grid->leafGridView(); - - using FEBasis = Dune::Functions::LagrangeBasis<typename GridType::LeafGridView,2>; - FEBasis feBasis(gridView); + using FlatFEBasis = Functions::LagrangeBasis<FlatGridView,2>; + FlatFEBasis flatFEBasis(flatGridView); using namespace Dune::Functions::BasisFactory; using namespace Dune::Indices; - auto deformationPowerBasis = makeBasis( - gridView, - power<dimworld>( + TupleVector<std::vector<RealTuple<double,3> >, std::vector<Rotation<double,3> > > configuration; + configuration[_0].resize(flatFEBasis.size()); + configuration[_1].resize(flatFEBasis.size()); + + ///////////////////////////////////////////////////////////////////////// + // FE representation of the deformation field + ///////////////////////////////////////////////////////////////////////// + + auto curvedGridDeformationBasis = makeBasis( + curvedGridView, + power<3>( lagrange<2>() )); - BlockVector<FieldVector<double,3> > helperVector1(feBasis.size()); - Dune::Functions::interpolate(deformationPowerBasis, helperVector1, referenceConfigurationFunction); - auto stressFreeConfiguration = Dune::Functions::makeDiscreteGlobalBasisFunction<FieldVector<double,dimworld> >(deformationPowerBasis, helperVector1); - - NonplanarCosseratShellEnergy<FEBasis, 3, double, decltype(stressFreeConfiguration)> nonplanarCosseratShellEnergy(materialParameters, - &stressFreeConfiguration, - nullptr, - nullptr, - nullptr); - BlockVector<TargetSpace> sol(feBasis.size()); - TupleVector<std::vector<RealTuple<double,3> >, - std::vector<Rotation<double,3> > > solTuple; - solTuple[_0].resize(feBasis.size()); - solTuple[_1].resize(feBasis.size()); - - BlockVector<FieldVector<double,3> > helperVector2(feBasis.size()); - Dune::Functions::interpolate(deformationPowerBasis, helperVector2, configurationFunction); - for (std::size_t i = 0; i < feBasis.size(); i++) { - sol[i][_0].globalCoordinates() = helperVector2[i]; - - FieldVector<double,4> idRotation = {0, 0, 0, 1}; //set rotation = Id everywhere - Rotation<double,dimworld> rotation(idRotation); - FieldMatrix<double,dimworld,dimworld> rotationMatrix(0); - rotation.matrix(rotationMatrix); - sol[i][_1].set(rotationMatrix); - solTuple[_0][i] = sol[i][_0]; - solTuple[_1][i] = sol[i][_1]; - } - CosseratVTKWriter<decltype(gridView)>::write<FEBasis>(feBasis, solTuple, "configuration_l" + std::to_string(numLevels)); + BlockVector<FieldVector<double,3> > deformationAsVector(flatFEBasis.size()); + Functions::interpolate(curvedGridDeformationBasis, deformationAsVector, deformationFunction); + for (std::size_t i = 0; i < flatFEBasis.size(); i++) + configuration[_0][i].globalCoordinates() = deformationAsVector[i]; + + ///////////////////////////////////////////////////////////////////////// + // FE representation of the microrotation field + ///////////////////////////////////////////////////////////////////////// + + auto curvedGridQuaternionBasis = makeBasis( + curvedGridView, + power<4>( + lagrange<2>() + )); + + // The orientation function needs to become a GridViewFunction, otherwise it cannot be composed. + auto orientationGridViewFunction = Functions::makeAnalyticGridViewFunction(orientationFunction, curvedGridView); + + auto matrixToQuaternion = [](FieldMatrix<double,3,3> matrix) -> FieldVector<double,4> + { + Rotation<double,3> rotation; + rotation.set(matrix); + return rotation; + }; + + auto orientationQuaternionFunction = Functions::makeComposedGridFunction(matrixToQuaternion, + orientationGridViewFunction); + + BlockVector<FieldVector<double,4> > orientationAsVector(flatFEBasis.size()); + Functions::interpolate(curvedGridQuaternionBasis, orientationAsVector, orientationQuaternionFunction); + for (std::size_t i = 0; i < flatFEBasis.size(); i++) + configuration[_1][i] = orientationAsVector[i]; + + ///////////////////////////////////////////////////////////////////////// + // Write the configuration to a file (just for debugging) + ///////////////////////////////////////////////////////////////////////// + + auto directorBasis = makeBasis( + flatGridView, + power<3>( + lagrange<2>() + )); + + // TODO: Write the curved grid, not the flat one + CosseratVTKWriter<FlatGridView>::write(flatGridView, + curvedGridGeometry, + directorBasis, + configuration[_1], + 2, // VTK output element order + "nonplanarcosseratenergytest-result.vtu"); + + /////////////////////////////////////////////////// + // Construct the energy functional + /////////////////////////////////////////////////// + + using ShellEnergy = NonplanarCosseratShellEnergy<FlatFEBasis, + 3, // Dimension of the target space + double, + GridGeometry>; + + ShellEnergy nonplanarCosseratShellEnergy(materialParameters, + &curvedGridGeometry, + nullptr, + nullptr, + nullptr); + + /////////////////////////////////////////////////// + // Compute the energy + /////////////////////////////////////////////////// + + using TargetSpace = GFE::ProductManifold<RealTuple<double,3>,Rotation<double,3> >; double energy = 0; + // A view on the FE basis on a single element - auto localView = feBasis.localView(); + auto localView = flatFEBasis.localView(); + // Loop over all elements - for (const auto& element : elements(feBasis.gridView(), Dune::Partitions::interior)) { + for (const auto& element : elements(flatGridView)) + { localView.bind(element); + // Number of degrees of freedom on this element size_t nDofs = localView.tree().size(); - std::vector<TargetSpace> localSolution(nDofs); + std::vector<TargetSpace> localConfiguration(nDofs); for (size_t i=0; i<nDofs; i++) - localSolution[i] = sol[localView.index(i)[0]]; - energy += nonplanarCosseratShellEnergy.energy(localView, localSolution); + { + localConfiguration[i][_0] = configuration[_0][localView.index(i)[0]]; + localConfiguration[i][_1] = configuration[_1][localView.index(i)[0]]; + } + energy += nonplanarCosseratShellEnergy.energy(localView, localConfiguration); } return energy; } + + int main(int argc, char** argv) { MPIHelper::instance(argc, argv); - auto configurationId = [](FieldVector<double,dimworld> x){ - return x; - }; - auto configurationStretchY = [](FieldVector<double,dimworld> x){ - auto out = x; - out[1] *= 2; - return out; - }; - - auto configurationTwist = [](FieldVector<double,dimworld> x){ - auto out = x; - out[1] = x[2]; - out[2] = -x[1]; - return out; - }; - auto configurationCurved = [](FieldVector<double,dimworld> x){ - auto out = x; - out[1] = x[2]; - out[2] = -x[1]; - return out; + ////////////////////////////////// + // Create the grid + ////////////////////////////////// + + using FlatGrid = FoamGrid<2,3>; + + GridFactory<FlatGrid> factory; + Gmsh4::LagrangeGridCreator gridGeometry{factory}; + + Gmsh4Reader reader{gridGeometry}; + reader.read(GRID_PATH "/sphere_order2.msh"); + auto flatGrid = factory.createGrid(); + + // Wrap the flat grid to build a curved grid, with Lagrange elements of order 2 + CurvedGrid curvedGrid{*flatGrid, gridGeometry, 2}; + + /////////////////////////////////////////////////////// + // Create configurations and check their energies + /////////////////////////////////////////////////////// + + TestSuite test; + + // The reference configuration + // --------------------------------- + auto deformationIdentity = [](FieldVector<double,3> x){ + return x; + }; + + auto orientationIdentity = [](FieldVector<double,3> x) -> FieldMatrix<double,3,3> + { + return {{1,0,0}, {0,1,0}, {0,0,1}}; + }; + + double energyIdentity = calculateEnergy(flatGrid->leafGridView(), curvedGrid.leafGridView(), gridGeometry, + deformationIdentity, orientationIdentity); + + test.check(std::fabs(energyIdentity) < 1e-12, "reference configuration has zero energy"); + + // A translation + // --------------------------------- + auto deformationTranslation = [](FieldVector<double,3> x){ + return x + FieldVector<double,3>{1.5,1.5,1.5}; + }; + + double energyTranslation = calculateEnergy(flatGrid->leafGridView(), curvedGrid.leafGridView(), gridGeometry, + deformationTranslation, orientationIdentity); + + test.check(std::fabs(energyTranslation) < 1e-12, "translated configuration has zero energy"); + + // A rotation -- for simplicity about an axis + // --------------------------------- + double angle = M_PI/4; + FieldMatrix<double,3,3> globalRotation = {{1,0,0}, + {0,cos(angle),-sin(angle)}, + {0,sin(angle),cos(angle)}}; + + // A translation + auto deformationRotation = [&globalRotation](FieldVector<double,3> x){ + FieldVector<double,3> result; + globalRotation.mv(x,result); + return result; + }; + + auto orientationRotation = [&globalRotation](FieldVector<double,3> x) -> FieldMatrix<double,3,3> + { + return globalRotation; }; - auto configurationSquare = [](FieldVector<double,dimworld> x){ - auto out = x; - out[1] += x[1]*x[1]; - return out; + + + double energyRotation = calculateEnergy(flatGrid->leafGridView(), curvedGrid.leafGridView(), gridGeometry, + deformationRotation, orientationRotation); + + test.check(std::fabs(energyRotation) < 1e-12, "rotated configuration has zero energy"); + + // Stretching + // --------------------------------- + auto deformationStretchY = [](FieldVector<double,3> x) -> FieldVector<double,3> + { + return {x[0], 2*x[1], x[2]}; }; - auto configurationSin = [](FieldVector<double,dimworld> x){ - auto out = x; - out[2] = sin(x[2]); - return out; - }; + double energyStretchY = calculateEnergy(flatGrid->leafGridView(), curvedGrid.leafGridView(), gridGeometry, + deformationStretchY, orientationIdentity); + + test.check(std::fabs(energyStretchY-357163.4280328181) < 1e-6, + "stretched configuration has energy 357163.4280328181"); + + - double energyFine = calculateEnergy(2, configurationId, configurationStretchY); - double energyCoarse = calculateEnergy(1, configurationId, configurationStretchY); - assert(std::abs(energyFine - energyCoarse) < 1e-3); + // Something wild + // ---------------------------------------- + auto deformationIrregular = [](FieldVector<double,3> x) -> FieldVector<double,3> + { + return {x[0] + sin(3*M_PI*(x[1]+x[2])), + x[1] + sin(5*M_PI*(x[0]+x[2])), + x[2] + sin(2*M_PI*(x[0]+x[1]))}; + }; - double energyForZeroDifference = calculateEnergy(1,configurationId,configurationId); - assert(std::abs(energyForZeroDifference) < 1e-3); + auto orientationIrregular = [](FieldVector<double,3> x) -> FieldMatrix<double,3> + { + double angle = sqrt(x[0]*x[0] + x[1]*x[1]); - double energyForZeroDifference2 = calculateEnergy(1,configurationStretchY,configurationStretchY); - assert(std::abs(energyForZeroDifference2) < 1e-3); + return {{1,0,0}, + {0,cos(angle),-sin(angle)}, + {0,sin(angle),cos(angle)}}; + }; - double energyForZeroDifference3 = calculateEnergy(1,configurationTwist,configurationTwist); - assert(std::abs(energyForZeroDifference3) < 1e-3); + double energyIrregular = calculateEnergy(flatGrid->leafGridView(), curvedGrid.leafGridView(), gridGeometry, + deformationIrregular, orientationIdentity); - double energyForZeroDifference4 = calculateEnergy(1,configurationSquare,configurationSquare); - assert(std::abs(energyForZeroDifference4) < 1e-3); + test.check(std::fabs(energyIrregular-51489391.39400836) < 1e-6, + "irregular configuration has energy 51489391.39400836"); - double energyForZeroDifference5 = calculateEnergy(1,configurationSin,configurationSin); - assert(std::abs(energyForZeroDifference5) < 1e-3); + return test.exit(); }