[[openfoam]]
 

https://www.openfoam.com

https://www.openfoam.org

https://gitlab.com/foam-for-nuclear/offbeat

https://dl.openfoam.com/repos/deb/dists/ (new versions)

OpenFOAM 9

GCC 12 problem

https://github.com/OpenFOAM/OpenFOAM-9/commit/b0c15bebd37142f3902901ed5e9a60e33ed456eb

file OpenFOAM-9/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H
class sha1streambuf 
method overflow

Install on Ubuntu 20.04 or 22.04

root

apt install mc git
 
sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
add-apt-repository http://dl.openfoam.org/ubuntu
apt-get update
apt-get -y install openfoam9

user

cd ~
git clone https://gitlab.com/foam-for-nuclear/offbeat
mv offbeat Offbeat
cd ~/Offbeat
source /opt/openfoam9/etc/bashrc
make -j
 
mkdir ~/test
 
cp -r /opt/openfoam9/tutorials/mesh/blockMesh/sphere ~/test/sphere
cd  ~/test/sphere
source /opt/openfoam9/etc/bashrc
./Allrun
paraFoam -builtin
 
cp -r ~/Offbeat/Cases/testCases/generic_pwr_2D_rTheta ~/test/generic_pwr_2D_rTheta
cd ~/test/generic_pwr_2D_rTheta
source /opt/openfoam9/etc/bashrc
./Allrun
paraFoam

offbeat-ubuntu-20-04.tgz

offbeat-ubuntu-22-04.tgz

( rename offbeat to Offbeat, rename uzivatel-9 to <username>-9 )

Live DVD Ubuntu 20.04

create new filesystem.squashfs

directories: modified, original, result

Copy from running Ubuntu to modified
   etc
   home
   opt
   usr
   var
   (root) 
mkdir original
mount -r -t squashfs casper/filesystem.squashfs original 

mkdir result

Copy files from original to result

Replace directories from modified

umount original

mksquashfs result filesystem.squashfs

data for new DVD

directories: old_disk, new_disk

mkdir old_disk
mount -r ubuntu-mate-20.04-desktop-amd64.iso old_disk
mkdir new_disk
copy files from old_disk, replace new filesystem.squashfs
umount old_disk
new_disk, isolinux/txt.cfg, 
add to line with command 'append'
fsck.mode=skip

append  file=/cdrom/preseed/ubuntu-mate.seed initrd=/casper/initrd fsck.mode=skip quiet splash ---

from https://askubuntu.com/questions/1313247/disable-integrity-check-on-ubuntu-server-20-04-1-iso

create .iso

without UEFI

genisoimage \
-cache-inodes \
-J \
-joliet-long \
-b 'isolinux/isolinux.bin' \
-c 'isolinux/boot.cat' \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-volid 'Custom' \
-o ubuntu-mate-20.04-openfoam-amd64.iso \
new_disk

from https://help.ubuntu.com/community/InstallCDCustomization#Preparing_the_bootable_medium

( pacman -S cdrkit )

grub.cfg

menuentry "Ubuntu Mate 20.04" {
    set dir="/ubuntu-20-04"
    linux $dir/casper/vmlinuz boot=casper iso-scan/filename=$dir showmounts
    initrd $dir/casper/initrd
}

menuentry "Ubuntu Mate 20.04 (from iso)" {
    set dir="/ubuntu-20-04"
    # set isofile="$dir/ubuntu-mate-22.04-desktop-amd64.iso"
    set isofile="$dir/ubuntu-mate-22.04-openfoam-amd64.iso"
    loopback loop $isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile showmounts noprompt noeject
    initrd (loop)/casper/initrd
}

Live DVD Ubuntu 22.04

mount -r original.squashfs /mnt/original
mksquashfs new_directory filesystem.squashfs
# xorriso -indev .../ubuntu-mate-22.04-desktop-amd64.iso -report_el_torito as_mkisofs

Do not use, DVD is not bootable

genisoimage \
-untranslated-filenames \
-J \
-joliet-long \
-rational-rock \
-translation-table \
-input-charset utf-8 \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-boot-load-size 8496 \
-eltorito-boot 'boot/grub/i386-pc/eltorito.img' \
-volid 'Ubuntu-MATE 22.04 LTS amd64' \
-o ubuntu-mate-22.04-prog-amd64.iso \
data_directory
menuentry "Ubuntu Mate 22.04" {
    set dir="/ubuntu-mate-22.04-prog"
    linux $dir/casper/vmlinuz boot=casper iso-scan/filename=$dir show-cow
    initrd $dir/casper/initrd
}

menuentry "Ubuntu Mate 22.04 (from iso)" {
    set dir="/ubuntu-mate-22.04-iso"
    # set isofile="$dir/ubuntu-mate-22.04-desktop-amd64.iso"
    set isofile="$dir/ubuntu-mate-22.04-prog-amd64.iso"
    loopback loop $isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile show-cow noprompt noeject
    initrd (loop)/casper/initrd
}

Compile on Archlinux

Compile OpenFoam-9

mkdir ~/OpenFOAM
cd ~/OpenFOAM
git clone https://github.com/OpenFOAM/OpenFOAM-9

less OpenFOAM-9/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H
# class sha1streambuf methods xsputn and overflow

cd ~/OpenFOAM/OpenFOAM-9
source ~/OpenFOAM/OpenFOAM-9/etc/bashrc
./Allwmake -j

Compile Offbeat

cd ~
git clone https://gitlab.com/foam-for-nuclear/offbeat

mv offbeat Offbeat
cd ~/Offbeat

source ~/OpenFOAM/OpenFOAM-9/etc/bashrc
make -j

OpenFoam example

cp -r ~/OpenFOAM/OpenFOAM-9/tutorials/mesh/blockMesh/sphere ~/test/sphere
cd  ~/test/sphere

source ~/OpenFOAM/OpenFOAM-9/etc/bashrc
./Allrun
# blockMesh
paraFoam -builtin
# click Apply button

Offbeat example

cp -r ~/Offbeat/Cases/testCases/generic_pwr_2D_rTheta ~/test/generic_pwr_2D_rTheta
cd ~/test/generic_pwr_2D_rTheta

source ~/OpenFOAM/OpenFOAM-9/etc/bashrc
./Allrun
paraFoam -builtin

Remote access

ssh -Y ...

Compile on Helios

problem with OpenFOAM-9/src/parallel/decompose/scotchDecomp

module add gcc/11.3

# module add openmpi/3.1.3-gcc_4.8.5-psm2
# sed -i -e 's/-std=c++14/-std=c++11/' ~/OpenFOAM/OpenFOAM-9/wmake/rules/linux64Gcc/c++

echo 'export SCOTCH_ARCH_PATH=""' >> ~/OpenFOAM/OpenFOAM-9/etc/config.sh/scotch

cd ~/OpenFOAM/OpenFOAM-9
source ~/OpenFOAM/OpenFOAM-9/etc/bashrc
./Allwmake -j 16

other instructions are same as for Arch Linux

paraview

module load paraview/5.5.1
paraview --mesa-llvm
paraFoam -builtin --mesa-llvm

https://stackoverflow.com/questions/37664786/gl-version-2-1-with-the-gpu-shader4-extension-is-not-supported-by-your-graphics

glxinfo | egrep -i 'Direct|String'

Neusporadane poznamky

Compile on AlmaLinux

dnf install git g++ flex zlib-devel boost-devel openmpi-devel

modify ~/OpenFOAM/OpenFOAM-9/etc/bashrc

export WM_MPLIB=OPENMPI

file ~/OpenFOAM/OpenFOAM-9/wmake/rules/General

PFLAGS     = -DOMPI_SKIP_MPICXX
PINC       = -isystem $(MPI_ARCH_PATH)/include -I /usr/include/openmpi-x86_64
PLIBS      = -L$(MPI_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) -L$(MPI_ARCH_PATH)/lib -L/usr/lib64/openmpi/lib/ -lmpi

problem with OpenFOAM-9/src/parallel/decompose/scotchDecomp

Compile on Fedora 38

dnf openmpi-devel

add to OpenFOAM-9/etc/bashrc

export PATH=/usr/lib64/openmpi/bin:$PATH
dnf install g++ flex zlib-devel openmpi-devel
cd OpenFOAM-9
source etc/bashrc
./Allwmake

problem with OpenFOAM-9/applications/solvers/multiphaseEulerFoam (removed)

Gas Pressure

input file with initial value

gasPressure 2.25e6;

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/Cases/testCases/generic_pwr_2D_rTheta/0/gapGas#L29

read variable from file

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/gapGasModel/gapFRAPCON.C#L1225

depends on gasPressureType

class variable gasP_ in class gapGasModel

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/gapGasModel/gapGasModel.H#L129

calculate value in gapFRAPCON::correct, gapFRAPCON is sub-class of gapGasModel

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/gapGasModel/gapFRAPCON.C#L1142

acces function p()

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/gapGasModel/gapFRAPCON.C#L1225

using acces function gapGas.p()

fixedDisplacement/plenumSpringFixedDisplacementFvPatchVectorField.C#L214

fixedDisplacement/topCladRingFixedDisplacementFvPatchVectorField.C#L269

tractionDisplacement/gapContactFvPatchVectorField.C#L374

tractionDisplacement/gapContactFvPatchVectorField.C#L374

tractionDisplacement/gapContactFvPatchVectorField.C#L374

tractionDisplacement/topCladRingPressureFvPatchVectorField.C#L190

rheologyByMaterial.C#L683

rheologyByMaterial.C#L693

class method with real calculation

void Foam::plenumSpringFixedDisplacementFvPatchVectorField::updateCoeffs()

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/fvPatchFields/fixedDisplacement/plenumSpringFixedDisplacementFvPatchVectorField.C#L89

descriptive comments in this method

https://gitlab.com/AlessandroScolaro/offbeat-official/-/blob/master/offbeatLib/fvPatchFields/fixedDisplacement/plenumSpringFixedDisplacementFvPatchVectorField.C#L160

    if(!planeStrain_)
    {
        // Assume plane stress --> local quantities:
        //         sigma_z * A 
        //      = (2mu+lambda)*A*gradD_z + Q*A = -k*D_s - p_g*A
        //      = (2mu+lambda)*A*(Dfz - Dpz)/delta + Q*A = -k*D_s - p_g*A
        //
        // Thus:
        //         Dfz = 1/((2mu+lambda)*A/delta)*[
        //         -k*D_s - p_g*A + (2mu+lambda)*Dpz*A*/delta - Q*A]
        //
        // (sign of gradient and of forces change depending on the patch being 
        // fuel top or top cap inner)
        twoMuLambdaA = sign(nAvg & pinDirection)*
            (twoMuLambda/delta)*gSum(magSf)/angularFraction;
        twoMuLambdaDfA = sign(nAvg & pinDirection)*
            (twoMuLambda*Dz/delta)*gSum(magSf)/angularFraction;
        QA = Q*gSum(magSf)/angularFraction;
    }
    else
    {
        // Apply plane strain --> integral quantities:
        //         sigma_z * A 
        //      = int((2mu+lambda)*gradD_z*dA) + int(Q*dA) = -k*D_s - p_g*A
        //      = int((2mu+lambda)*(Dfz - Dpz)/delta*dA) + int(Q*dA) = -k*D_s - p_g*A
        //
        // Thus:
        //         Dfz = 1/int((2mu+lambda)*dA/delta)*[
        //         -k*D_s - p_g*A + int((2mu+lambda)*Dpz*dA*/delta) - int(Q*dA)]
        //
        // (sign of gradient and of forces change depending on the patch being 
        // fuel top or top cap inner)
        // Calculate integrals
        twoMuLambdaA = (sign(nAvg & pinDirection)*(
            gSum(twoMuLambda*magSf/delta/angularFraction)));
        twoMuLambdaDfA = (sign(nAvg & pinDirection)*(
            gSum(twoMuLambda*Dz*magSf/delta/angularFraction)));
        QA = (gSum(Q*magSf/angularFraction));
    }
 
openfoam.txt · Last modified: 2024/01/27 20:54 by 88.103.111.44
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki