We looked for a solution to the problem:

with:

for given . This represents, in nondimensional form, a certain set of viscous boundary conditions for velocity/temperature. In practice, is a wall-function. The solution is given by:

Where, is given by:

and is given by a (typically) straightforward integration:

In practice, given above, the integral in is easily computable for in the form of a polynomial of arbitrary degree. For the sake of conciseness we only considered as constant, the resulting integral being times the following function:

https://www.wolframalpha.com/input/?...Batan(b%2Fc)))

The whole procedure is implemented in the attached MATLAB/Octave script, where the analytical solution above (ta) is compared with the numerical one (tn), obtained by numerically integrating .

The usage should be straightforward:

1) Pick up values for ,, and (lines 8-11).

2) Choose plotting options (lines 5-6)

3) Choose how many points you want to use to integrate numerically (line 7).

4) Run the script.

Note that the constant has been calibrated using as reference the mixing length model with a constant . The relative turbulent mixing length viscosity has been left commented in the script (line 60), so that you can use it to calibrate the model for different values of the constant (line 13). Note that the calibration is always done once using and . After that, any value of those parameters will be taken into account automatically by the formula.

In general, the value is such that at .

with:

I added all the explicit functional dependencies here because we know ( given by Monkewitz et al. and reported in the previous post), and would be great to use that solution directly. Indeed, while the above integral is still directly solvable by partial fractions (check yourself with Wolfram alpha), the solution is not really appealing, because it involves 3 non trivial roots of a cubic equation.

In order to avoid that, we absorb the ratio in the definition, and multiply both numerator and denumerator by , obtaining:

Note that, if all the instances of were multiplied by we would have done, as the trick would have been to replace with in the Monkewitz solution (that, for example, would happen for the mixing length formulation, but unfortunately it is not integrable).

In order to arrive at this case, we can assume that and , with the value obtained by calibration with the velocity profile (11.489 for us, 10.306 for Monkewitz et al.). Then we request for to be a solution of the following equation:

It turns out that for meaningful values of and the solution is:

with:

So, with the value computed as above, we have that is just the Mokewitz et al. solution given in the previous post. Thus, to complete our solution, we just need an expression for . I won't report it here, as i just got it from Wolfram alpha (sometimes you need to add the last 3 right parentheses to the Wolfram formula, still don't know why):

https://www.wolframalpha.com/input/?...Batan(b%2Fc))))))

This is for the case constant. The fact that this is extendable to in the form of a polynomial can be rapidly checked by integrating the separate terms multiplied by a certain power of x (i used x in place of y in Wolfram)... but i leave this as exercise for the reader :D.

In part 3 of this post (the last one) i'll sum up the steps required to compute the whole solution and give a MATLAB/Octave script that compares it with the numerical one. ]]>

with:

the pressure gradient sensitized formula for the velocity is given by:

where is the nondimensional pressure gradient.

However, while useful for its purpose, this formulation turns out to have at least two drawbacks, both of which depending, somehow, on the fact that Reichardt didn't actually solved the underlying problem exactly. The first one is that the base profile (i.e., even without the pressure gradient effect) does not even reproduce the correct profile derivatives at the wall. Hence, as a main consequence, the formula might not be suitable as toy model for certain theoretical purposes. The second drawback, which is also another consequence of the same fact, is that it can be used as thermal wall function only for , as higher values will tend to amplify the part of the profile which is uncorrect.

To overcome such issues, i follow here the same steps as before but with a different formulation for , using one which can be integrated exactly. We start from the temperature equation, which is more general:

where (constant pressure specific heat), (dynamic viscosity), (Prandtl number), (turbulent Prandtl number) and (defined in the following) are all constant. The fact that this equation correctly represents a large set of velocity/temperature viscous boundary conditions should be self-evident. For example, gives the classical linear relationship for the temperature (which becomes the one for the velocity when ). Also, with leads to the classical wall-function formulation (for certain forms of ). According to the specific equation form, can have different meanings. For example, in the case of the velocity, it can include the wall-parallel pressure gradient (note that y is assumed to be the wall-normal coordinate, x the wall parallel one), the buoyancy term, etc. In general, it can include any of the terms that have been neglected in the LHS for the given equation. The only assumption here is that they are assumed constant along y (as will be shown in the following, it turns out that this can be actually relaxed).

The first step to proceed is integrating the equation above once. This produces (using ):

where (the underscore meaning that it is evaluated at the wall, i.e., for ). Multiplying by and rearranging, we obtain:

where:

The same equation, interpreted for the velocity, would read:

where . This confirms that the temperature solution can also be used for the velocity by a proper interpretation of the terms. Going back to the temperature equation, we then end up with the following equation for the nondimensional temperature derivative:

Then, by a further integration:

Note that i temporarily suspended the hypothesis that is constant. Now, let us also assume that we know the first integral, that is:

is a known function. Then, the solution becomes:

And after integration by parts:

For the sake of conciseness, let us also assume:

so that the full solution is:

While we have just moved the original problem to that of solving the two integrals for and , those will actually turn out to be easier to solve. Note also that the parenthesis in is a polynomial of the same order of (assuming that it is approximated with a certain degree polynomial). Particularly relevant is the case with constant (as is typically assumed). However, note that ,for the that we are going to derive below, a linear approximation is also integrable, as well as any other polynomial of higher degree. Obviously, things rapidly become cumbersome, with the degree of the polynomial, so for the present purposes it is sufficient to go back to the case constant. In this case is simply the integral of times . Note that Popovac and Hanjalic have shown (for the velocity) that this is actually relevant for several practical cases. Nonetheless, is worth remembering that this is not a costriction of the present approach (probably it wasn't neither when was based on the Reichardt profile).

So, at this point we are left with determining . To this end, we need a model for . Note that this is not different from the approach used by Van Driest to determine his velocity profile. It's just that the mixing length hypothesis he used led to a non integrable function. The same also happened to Reichardt, who then started modificating his function until something integrable came out.

To overcome this limit, here we abandon those formulations and use instead the one from Musker:

with being, in its original formulation, a constant (see below). It is worth mentioning that this functional form respects both the behavior for and the behavior for .

Note also that the Spalart-Allmaras model has a simlar behavior near the wall (see Allmaras et al., ICCFD 2012):

which then fails to recover the correct behavior for (However, Spalart and Allmaras explicitly mention in their original 1994 work that thay didn't notice any meaningful difference deriving from using this specific form instead of a correct one, say, the mixing length). This just to say that the Musker form is not only meaningful, but also representative of the near wall behavior of the Spalart-Allmaras model.

To solve for with the Musker turbulent viscosity, we first consider the case , as this already has a known solution, provided in its most general form by Monkewitz et al. (POF 20, 105102, 2008):

where:

The constant is found by calibration with the turbulent velocity profile. Monkewitz et al. use . In contrast, i calibrated the constant using the mixing length model with a constant , resulting in .

Now, the whole point of the procedure is: how to extend such formulation to the case ? See part 2 ]]>

But, why is that a problem needs boundary condition for U and p and all the other possible variables?

pisoFoam has relaxation coef while icoFoam does not have this.

Quote:

UEqn.relax(); |

Quote:

Hi
icoFoam is transient solver for incompressible, laminar flow of Newtonian fluids. pimpleFoam is large time-step transient solver for incompressible, flow using the PIMPLE(merged PISO-SIMPLE) algorithm. pisoFoam is transient solver for incompressible flow. Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. simpleFoam is steady-state solver for compressible, turbulent flow Regards Ata |

Quote:

Dear ata
I appreciate your quick answer :) I compiled everything and I changed fvSolutions as you mentioned in forum but when I want to run a case (FENE-P): the error is: mam@ubuntu:~/OpenFOAM/mam-2.0.0/RUN/tutorials/incompressible/viscoelasticFluidFoam/FENE-P$ viscoelasticFluidFoam /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.0 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.0.0-a317a4e7cd55 Exec : viscoelasticFluidFoam Date : Aug 22 2011 Time : 01:39:04 Host : ubuntu PID : 2568 Case : /home/mam/OpenFOAM/mam-2.0.0/RUN/tutorials/incompressible/viscoelasticFluidFoam/FENE-P nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 // using new solver syntax: p { solver PCG; preconditioner { type AMG; cycle W-cycle; policy AAMG; nPreSweeps 0; nPostSweeps 2; groupSize 4; minCoarseEqns 20; nMaxLevels 100; scale off; smoother ILU; } tolerance 1e-07; relTol 0; minIter 0; maxIter 800; } // using new solver syntax: U { solver PBiCG; preconditioner { type Cholesky; } minIter 0; maxIter 1000; tolerance 1e-06; relTol 0; } // using new solver syntax: taufirst { solver PBiCG; preconditioner { type Cholesky; } minIter 0; maxIter 1000; tolerance 1e-06; relTol 0; } Reading field p Reading field U Reading/calculating face flux field phi Selecting viscoelastic model multiMode Selecting viscoelastic model FENE-P Starting time loop Courant Number mean: 6.54561e-07 max: 1.84912e-05 deltaT = 1.1999e-05 Time = 1.1999e-05 --> FOAM FATAL IO ERROR: keyword preconditioner is undefined in dictionary "::preconditioner" file: ::preconditioner from line 57 to line 57. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting |

The maximum velocity is approximately 18m/s at the top. and if the time step is 0.15s, the courant no. is 1.08 (dx = 2.5m). So the time step indeed should be decreased. But the time step in the last step is 0.015s, the courant no. is 0.108. It is pretty small. So I slightly increased the time step to 0.05s. I got 1000s physical time after 1 day, so I expect I can get 300-400s physical time after 1 day running. ]]>

The case works pretty well before 3035s. From 3035s, the max courant no. increased instantly from 0.75 to 2.6e+25. I used adaptive time step and the maximum time step is set to be 0.5 (it is normally 0.15 because of max courant no.) and maximum courant no. is 0.75. I am now trying maximum time step 0.015s with maximum courant no. 0.1. I hope it will work well.:)

The current max courant no. is 0.087. ]]>

So far CFD is very interesting and I am excited to learn more about it so I can use it for my senior design project. I am working on a device to provide internal cooling to a pancreas during a diseased state. ]]>

Win7 writes in MBR something to control boot and linux uses grub to control boot which will be able to boot windows.

Why not in the reverse order?

A complete re-installtion of win7 may over write ALL in MBR meaning the part that will call the actual grub configuration (in /boot or /etc/grub.d not sure...), therefore the repair of the linux booting is needed.

Result: grub boot first, if you choose "windows" then the machine will boot windows.

From this point. (A)

If linux system needs to re-install by totally erasing the linux part of the disk : Configure boot because after erasing the disk the grub (principle boot) now will encounter error and stocked.

Solution : boot the linux (which will be erased) with windows using EasyBCD.

{

1. Add New Entry

Type: Grub2

Name: [write the name of the system]

Drive: [the partition on which the current linux system is installed]

2. BCD Deployment

Use defaut and click "Wirte MBR"

}

After the step2, windows will be able to replace grub as the principle boot. Then after this, it won't be a problem with booting if we erase completely the linux system.

If from point (A), want to re-install windows ?

Maybe have to repair the linux booting after a complete windows re-installation.

But I tried ghost recovery. And it won't touch the MBR so this is an alternative. ]]>

Quote:

Hi Frog,
Meindert already mentioned, the difference between a PCG or a PBiCG,... you can find in any textbook about linear iterative solvers like Wessling, Saad, Trefethen, Stran,.... I think the book from Saad you find free on the www. But I think your problems are a bit different. Sine OF is a segregated solver, for every field (variable) there has to be solved a linear system (i.e. for U, p,...) you have AU=b, Bp=c, A;B matrices.Your choice of the numerical schemes (entries for the operator discretization in fvSchemes, i.e. (linear, upwind, limitedLinear,...) for the operators is respobsible of the coefficients of this matrices. So the choice of operators regarding f.i. U are responsible for the properties/coefficients of the matrix AThe choice of your solution/solving algorithm (i.e. entries in fvSolution) is responsible which iterative solver is used to solve your linear system. So choosing f.i. PCG for U and PBiCG for p, AU=b is solved iteratively bc PCG, Bp=c with PBiCGand so forth. Being also a mathematician, as a book enlighting CFD and numerics, I would also recommend Ferziger/Peric: Computational methods for fluid dynamics Th. |

Tried to compile from $FOAM_RUN, using laplacianFoam1. After comparing with authentic one, success. ]]>

Note: The proposed approach might be overcomplicated. If it is so, please let me know what is the "proper way".

Problem description: You run a steady state simulation (e.g. simpleFOAM) and you control the endTime (number of iterations) via the residualControl. Thus, the number of iterations needed for the solution to converge is not a priori known.

Goal: Write out the last iteration, no matter what is its number. Furthermore, you do not want to (cannot) write all the iterations (time steps) and keep only the last one using purgeWrite.

Solution: As I wrote above, there might be a simple and totaly evident solution, but I did not find it. So, my proposition is to combine different functionObjects in controlDict to achieve the wanted outcome. Id est, add to the end of the controlDict file the following code:

Code:

functions { sysCall { type systemCall; functionObjectLibs ( "libsystemCall.so" ); executeCalls 0(); endCalls 1("touch writeOnEnd"); writeCalls 0(); outputControl outputTime; } writeOnEnd { type abort; functionObjectLibs ( "libjobControl.so" ); action writeNow; fileName "writeOnEnd"; } }

Quote:

Thank you all for your help,
I was able to implement my boundary condition as well. I used the following code to access the internal velocity field and the mesh two layers of cells inward from the boundary: Code:
// Set up access to the internal velocity field and mesh const volVectorField& U = db().objectRegistry::lookupObject<volVectorField>(UName_); const fvMesh& mesh = patch().boundaryMesh().mesh(); forAll(patch(), facei) { // get global cell indices for cells adjacent to patch label celli = patch().faceCells()[facei]; // get global face indices for faces opposite patch face label oppFacei = mesh.cells()[celli].opposingFaceLabel(facei+patch().patch().start(),mesh.faces()); // get coordinates of center of cell adjacent to patch (patch cells) vector cellCentreO = mesh.cellCentres()[mesh.owner()[oppFacei]]; // get coordinates of center of cell on the side opposite the patch of // the patch cell vector cellCentreN = mesh.cellCentres()[mesh.neighbour()[oppFacei]]; // get coordinates of center of face opposite the patch boundary face vector faceCentre = mesh.faceCentres()[oppFacei]; // get coordinates of center of patch boundary face; vector patchFaceCentre = mesh.faceCentres()[facei+patch().patch().start()]; } |

if you are interested in the calculation of polynomial coefficients to fit some data, you can check the method of least squares on my homepage. Here I explained everything in detail and also gave an example how to build the matrix

How to build the matrix

The only difficulty is to calculate the inverse of

http://www.holzmann-cfd.de/index.php...omcoefficients ]]>