Random function in input file does not work?

Hi all,
I ran the continental extension prm file yesterday and I noticed that the randomized initial strain of the following function does not work (anymore). When looking at the paraview file I see that the plastic strain is constant and equal to 1.5 inside the designated area (see attached screen capture). Has the syntax changed? is this a (known) bug?
Cheers,
Cedric

subsection Initial composition model
set Model name = function
subsection Function
set Variable names = x,y
set Function expression = 0;
if(x>50.e3 && x<150.e3 && y>50.e3, 0.5 + rand_seed(1), 0);
if(y>=80.e3, 1, 0);
if(y<80.e3 && y>=60.e3, 1, 0);
if(y<60.e3, 1, 0);
end
end


– This is ASPECT, the Advanced Solver for Problems in Earth’s ConvecTion.
– . version 2.5.0-pre (main, 50d0c5740)
– . using deal.II 9.4.0
– . with 32 bit indices and vectorization level 1 (128 bits)
– . using Trilinos 12.18.1
– . using p4est 2.3.2
– . running in DEBUG mode
– . running with 1 MPI process

Hi Cedric,

Thanks for reporting the issue, that is really odd. I just ran the cookbook with the most recent ASPECT version and got the expected random distribution of initial plastic strain. This was done on an ubuntu workstation.

I’m not sure what the issue could be here? Just to be sure, can you try reloading and rescaling the color bar?

Cheers,
John

– This is ASPECT, the Advanced Solver for Problems in Earth’s ConvecTion.
– . version 2.5.0-pre (main, bb7beb982)
– . using deal.II 9.4.0
– . with 32 bit indices and vectorization level 0 (64 bits)
– . using Trilinos 13.2.0
– . using p4est 2.2.0
– . running in DEBUG mode
– . running with 4 MPI processes

hi John,
the strain field is really ‘flat’ I am afraid. I am also running ubuntu. I will reinstall everything from scratch on my other workstation then.
Ce/

Hi Cedric,

Oofta, that is really weird. There issue is likely with muparser, but that is built with deal.II and we are both on 9.4.0. What versions of gnu compilers are you on?

Cheers,
John

Cedric,
This is indeed weird. I have not seen anything like that before and I doubt recompiling everything would fix this. To be sure, this is the unmodified .prm file from the benchmarks folder?

(is always returning 1 not a decent random number generator?) :slight_smile:

So I changed computer (still ubuntu machine), and installed candi from scratch today and re-compiled aspect. I ran the prm file just now without changing anything and still the same problem.


– This is ASPECT, the Advanced Solver for Problems in Earth’s ConvecTion.
– . version 2.5.0-pre (main, bb7beb982)
– . using deal.II 9.4.1
– . with 32 bit indices and vectorization level 1 (128 bits)
– . using Trilinos 13.2.0
– . using p4est 2.3.2
– . running in DEBUG mode
– . running with 1 MPI process

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu 11.3.0-1ubuntu1~22.04’ --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

Thanks Cedric. I will try to reproduce.

I am not able to reproduce so far. Can you try the following small deal.II program and report the output (if it returns only 1.0 then we see the same bug):

Hi,
here is the output of the code:
./function_parser_09
0.298761
0.133475
0.49459
0.443015
OK

Hi Cedric,
I can reproduce the bug and we are working on a fix. It seems to be inside deal.II and unrelated to ASPECT (unsurprisingly).

Here is the proposed deal.II fix:

I am still not sure why it is only sometimes incorrectly optimized. As a workaround, you can replace rand_seed(1) by rand() (this might work) or update to the latest deal.II master once the PR is merged.

edit: Using rand() does not work either. You can go back to deal.II 9.3 and it should work too.

Odd model behavior that may be related to the fix Timo proposed:

  • I recently updated the compilers on Ubuntu 22.04 to gcc 11.
  • I reinstalled deal.II 9.4.0 via Candi. I was previously using the pre-built version of deal.II 9.4.0 for Ubuntu.
  • I ran two models, which are identical aside from one using particles and one using fields to track properties.
  • The model using the rand_seed() function in to generate initial random plastic strain (0.5 + rand_seed(1))
  • The model using particles has the correct randomized distribution of strain, while the model using fields has a constant value of 1.5, indicating rand_seed(1) always defaults to 1.

I have not tried Timo’s fix yet, but another data point to be aware of in case anyone runs into the same issue.

  • John

Hi John,
I think that is basically what @tjhei had observed. Can you try with an updated deal.II version?
Best
W.

Hi Wolfgang (and all)

I think that is basically what @tjhei had observed. Can you try with an updated deal.II version?

Yep, the correct randomized field appears using the latest deal.II development (main) branch.

Cheers,
John

Here is the issue that mentions the two ways to work around it: rand_seed always returns the same value · Issue #5114 · geodynamics/aspect · GitHub