Git Product home page Git Product logo

wall_modeling's Introduction

Development of wall functions for turbulent flows

The repository is structured as follows:

  • test_cases: OpenFOAM simulation setups
  • notebooks: Jupyter notebooks for post-processing of results and other visualizations

Getting started

Compiling the wall function and running the test cases requires an installation of OpenFOAM-v2012. Other releases might work as well but have not been tested.

To run a test case, create a run folder (ignored by version control), copy the case from test_cases to run, and execute the Allrun script.

mkdir -p run
cp -r test_cases/turbulentFlatPlate run/
cd run/turbulentFlatPlate
./Allrun

Singularity and SLURM

Singularity is a container tool that allows making results reproducible and performing simulations, to a large extent, platform independent. The only remaining dependencies are Singularity itself and Open-MPI (see next section for further comments). To build the image, run:

sudo singularity build of_v2012.sif docker://andreweiner/of_pytorch:of2012-py1.7.1-cpu

To run a simulation with Singularity, use the dedicated Allrun.singularity scripts. TU Braunschweig's HPC uses the SLURM scheduler. The repository contains an annotated example jobscript. The script expects the Singularity image in the top level directory of this repository and the simulation folder in run. To submit a job, run:

sbatch jobscript name_of_simulation

To show all running jobs of a user, use squeue -u $USER. Another helpful command is quota -s to check the available disk space.

References

The basic ideas of this work were first developed in the context of mass transfer at rising bubbles. Instead of the turbulent viscosity, the molecular diffusivity of a chemical species is corrected to mitigate the so-called high-Schmidt number problem. The profile function's parameter is determined by the species mass in an interface cell.

@article{weiner2017,
title = {Advanced subgrid-scale modeling for convection-dominated species transport at fluid interfaces with application to mass transfer from rising bubbles},
journal = {Journal of Computational Physics},
volume = {347},
pages = {261-289},
year = {2017},
issn = {0021-9991},
doi = {https://doi.org/10.1016/j.jcp.2017.06.040},
author = {Andre Weiner and Dieter Bothe}
}

In the following reference, the ideas above were first implemented in OpenFOAM and applied to surfactant adsorption rising bubbles.

@article{pesci2018,
title={Computational analysis of single rising bubbles influenced by soluble surfactant},
volume={856},
DOI={10.1017/jfm.2018.723},
journal={Journal of Fluid Mechanics},
publisher={Cambridge University Press},
author={Pesci, Chiara and Weiner, Andre and Marschall, Holger and Bothe, Dieter},
year={2018},
pages={709โ€“763}
}

Instead of an analytical profile function, one can also use a machine learning model to correct diffusive and convective fluxes.

@article{weiner2019,
author = {Weiner, Andre and Hillenbrand, Dennis and Marschall, Holger and Bothe, Dieter},
title = {Data-Driven Subgrid-Scale Modeling for Convection-Dominated Concentration Boundary Layers},
journal = {Chemical Engineering \& Technology},
volume = {42},
number = {7},
pages = {1349-1356},
keywords = {Data-driven modeling, High Schmidt numbers, Machine learning, Reactive mass transfer, Subgrid-scale modeling},
doi = {https://doi.org/10.1002/ceat.201900044},
year = {2019}
}

The following two PhD theses contain more detailed descriptions as well as more extensive parameter studies and applications than the references above. pesci2019 focuses more on surfactants and mass transfer while weiner2020 addresses the modeling principles and extensions to reactive mass transfer by means of machine learning.

@phdthesis{weiner2020,
          school = {Technical University of Darmstadt, Mathematical Modeling and Analysis},
         address = {Darmstadt},
           month = {February},
           title = {Modeling and simulation of convection-dominated species transfer at rising bubbles},
          author = {Andre Weiner},
            year = {2020},
             url = {http://tuprints.ulb.tu-darmstadt.de/11405/}
}
@phdthesis{pesci2019,
            year = {2019},
          author = {Chiara Pesci},
         address = {Darmstadt},
           title = {Computational Analysis of Fluid Interfaces Influenced by Soluble Surfactant},
           month = {July},
          school = {Technische Universit{\"a}t},
             url = {http://tuprints.ulb.tu-darmstadt.de/9303/}
}

Get in touch

The easiest and quickest way to get in touch is to open an issue in this repository.

wall_modeling's People

Contributors

jihookang-kor avatar andreweiner avatar

Stargazers

 avatar  avatar Cybersonix avatar Justin Kin Jun Hew avatar Sun avatar zhongsheng avatar  avatar scramjetFoam avatar Ramakant Gadhewal avatar Chandan Bose avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

wall_modeling's Issues

Further tests with the current setup

Hi @JihooKang-KOR,

I had some thoughts about further factors that could potentially influence the resulting friction coefficient. Therefore, I suggest the following tests:

  • test different schemes for div(phi,U) and the SA turbulence model (as discussed in the meeting)
  • take the mesh with the lowest y-plus value, double the number of cells along the plate (x-direction), and see if the results change (for both turbulence models, no wall functions, tolerance of 10^-5 for p and U)
  • plot c_f curves comparatively for different y-plus values (currently, they are not directly compared); I suggest using the curves obtained with the tolerance 10^-5; compare these curves between the two turbulence models

Best, Andre

Regarding Reset Commit

Dear Dr. Weiner,

From this week, a new test case without wall functions should be investigated. Therefore, I changed the folder name of the original test case that uses wall functions in order to distinguish each other, and subsequently I did a commit for it. However, all the related histories in this folder was vanished in Github. That is why I reset this commit, but I would like to ask questions as follows.

  1. Could you inform me if I can reset commit in this repository when I did any mistakes? I can revert it as well, but in this case (folder name change), we cannot revive all previous histories in Github.

  2. I could check that this commit history was deleted from all the other location except the reference tab in the issue (Getting started #1). I would like to know if this can be deleted in this reference tab as well. The SHA of the reset commits are 50d411f and 0008761 in the tab.

Thank you very much for your help.

Best regards,
Jihoo Kang

Getting started

Hi @JihooKang-KOR,

to get started with this project, I suggest the following:

  • study the flat plate test case carefully and execute it as described in the main README.md
  • improve the description of the test case in test_cases/turbulentFlatPlate/README (what happens in the Allrun script? Which function objects are executed? What is the purpose of the test case?)
  • add a function object to write out the residuals as described here; plot the initial residuals against the iterations
  • use Markdown syntax such that the description will be rendered properly on Github
  • create a Jupyter notebook for visualizing the results instead of using the plot script
  • in fvSolution, the SIMPLE solution control is currently commented out; use the solution control and check how the tolerance affects the results

If questions come up, feel free to use this issue to discuss them.

Best, Andre

Test workflow on Phoenix cluster

Hi Jihoo,

I added several files in the last commit to run simulations with Singularity on TU Braunschweig's Phoenix cluster. Have a look at the README and other new files.

To log in on phoenix, I recommend an alias, e.g., add the following line to your ~/.bashrc

alias phoenix="ssh -Y [email protected]"

and source the file again with source ~/.bashrc. Then you can type phoenix to start an ssh connection. I also recommend creating a key-pair to save some time logging in.

To copy a file to or from the cluster, use scp -r (-r for recursive copying of folders):

# copy image to home folder on cluster
scp -r of_v2012.sif [email protected]:/home/user_name/wall_modeling/
# copy file back to workstation
scp -r [email protected]:/home/user_name/wall_modeling/some_file.txt ./

To copy simulation results from the cluster, I typically synchronize the entire run folder:

# run from the repository's top-level folder
rsync -avz [email protected]:/home/user_name/wall_modeling/run ./

Let me know if these commands work for you.

Best, Andre

Code Interpretation of 'nutUSpaldingWallFunction'

Dear Andre,

With reference to the subject, I made a preliminary version of the LaTeX document for 'nutUSpaldingWallFunction'.

Here, I mention the link only for viewing the document because I am not sure whether the link for editing also works for all the people who have a overleaf account or any revision is possible only for the allowed people (for the sake of security or safety).

https://www.overleaf.com/read/gckxpqccjrxv

I already sent the sharing request to your e-mail, and therefore you will be able to see and edit the document when you login your overleaf account.

If there is something to revise or change, please kindly let me know about it. In addition, if you would like to delete or not to accept any link for the document, I will make the link sharing off and delete the above link for viewing.

Thank you very much for your help.

Best regards,
Jihoo Kang

Reference curves for skin friction coefficient

Hi Jihoo,
let's clear the doubts we have about the different c_f reference curves. I have digitized and uploaded Wieghardts c_f measurements for the flat plate without pressure gradient to the cloud folder. Next, I suggest the following:

  • plot the experimental data against the Reynolds number instead of x; curve 1 and 2 are the curves for U=17.8m/s and 33.0m/s, respectively; the kinematic viscosity needs to be extracted from Wieghardts article
  • plot eq. 26 from this reference for comparison
  • plot the correlation we have used so far for comparison
  • use the generic equation c_f = m / (log(Re)+p)^n, and try to find optimal values for m, p, and n; I suggest a simple brute force approach:
    • as metric you compare against the experimental data and compute the L2 norm
    • create arrays for m, p, and n ranging around the values given in eq. 26
    • loop over all permutations and select the one giving the lowest L2 error with respect to the experiments

If questions come up, simply reply here.

Best, Andre

Deriving an integral fitting method

Hi Jihoo,
let's use this issue to derive the integral fitting step by step; I'll update this post after each completed step. The basic idea is as follows:

Say u_p is the cell-centered velocity. We want to find the friction velocity u_tau based on Spalding's formula such that the average velocity computed using Spalding's equations equals u_p. u_tau needs to be found iteratively.

Let's start as follows:

  • based on Spalding's formula, plot U as a function of y for different values of u_tau
  • create a function that returns U for a given value of y and u_tau; I guess this function needs iterative searching; I suggest the bi-section method
  • integrate U from y=0 to y=Ly numerically for different values of u_tau; divide by Ly and visualize the resulting mean velocity
  • create a function that finds u_tau for a given mean velocity and Ly; I suggest the bi-section method, to begin with

Best, Andre

Access and Modify Turbulence Viscosity 'nut'

Dear Andre,

I would like to report the current status of the 'nut' issue. I thought of some possibilities to access and modify the whole field of turbulence viscosity as follows:

  1. Currently, in the new wall function code 'nutUIntegralSpaldingWallFunctionFvPatchScalarField.C', we can access the whole 'nut' field by tmp<volScalarField>& tnut = turbModel.nut(), but the modification of the value except the wall region is impossible because it is a read-only mode. Therefore, I tried to find where the variable 'nut' is located (in No.2).

  2. The class 'nutUIntegralSpaldingWallFunctionFvPatchScalarField' is inherited from the class 'nutWallFunctionFvPatchScalarField'. In the class 'nutWallFunctionFvPatchScalarField', there is the function called 'nutw', and it referred to 'turbulenceModel::nut()' by using turbModel.nut()().boundaryField()[patchi]. In the following link, we can see the diagram of caller graph for 'nut'.
    https://www.openfoam.com/documentation/guides/latest/api/classFoam_1_1turbulenceModel.html#a172707e93d70ead6d609ebf6138e46d9
    Among them, I chose one method called 'Foam::RASModels::continuousGasKEpsilon::correctNut' because the name of the method seems to be related to accessing the 'nut' field. In this method (the file 'continuousGasKEpsilon.C'), there is nothing special, but only the access of 'liquidTurbulence.nut()'. Thus, I checked the same method ('correctNut()') in the parent class 'kEpsilon'. I could find that there is an access of 'this->nut_'. However, there is no variable of 'this->nut_' in the class, and therefore I checked the parent class 'eddyViscosity'. Finally, 'volScalarField nut_' was found in 'eddyViscosity.H' as a protected variable in the class. In conclusion, we need to inherit the class 'eddyViscosity' in order to access the 'nut_' variable. From this point, I couldn't decide how to implement it since if we inherit 'eddyViscosity' as well as 'nutWallFunctionFvPatchScalarField' simultaneously in the class 'nutUIntegralSpaldingWallFunctionFvPatchScalarField', there might be problems for encapsulation and compilation of the code.

  3. In 'nutWallFunctionFvPatchScalarField.C', there is the method 'updateCoeffs()'. In the method, the code operator==(calcNut()); can be found. I thought we would be able to change the type of 'operator==' from passing 'scalarField' to passing 'volScalarField', but I lost the track to find the base operator overloading method. In addition, even if I find where it is, it would not be easy to update the whole 'nut' field only by changing 'operator=='.

I couldn't find any clear ways to modify 'nut' directly due to some limitations, but we might give it a try to write a code in terms of No.2 or No.3 if the approach is reasonable enough.

Thank you for reading this comment.

Best regards,
Jihoo Kang

Implementation of New Wall Function from 'nutUSpaldingWallFunction'

Dear Andre,

I would like to open a new issue regarding the modification of the wall function for 'nut'.

I realized that I have to add a template folder of a new wall function if I would like to thoroughly check and test how the C++ code works. Thus, I added the template folder in the repository, and it will be pushed to the Github soon referring this issue. The name of the new wall function is 'nutSGSWallFunction'. If you would like to change the name, I will delete the files with a commit and make them again with another commit.

I tried as possible as I can, but there was a dependency problem with the following files.

  • turbulenceModel.H and -.C
  • nutWallFunctionFvPatchScalarField.H and -.C

Therefore, I copied those files to the new wall function folder. Afterward, I found that at least wmake libso worked well. If you have any other idea to condense the contents in the folder, please kindly let me know.

In addition, I think we can use this issue for implementation of the new wall function. If you also think that this issue can be used for the new wall function, please kindly comment here when you would like to give any instructions for the new wall function later on.

Thank you very much for your help.

Best regards,
Jihoo Kang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.