Главная » Просмотр файлов » Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab

Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab (811443), страница 83

Файл №811443 Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab (Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab.pdf) 83 страницаMoukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab2020-08-25СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 83)

Sincethe equations are solved in residual form, their under-relaxation (Listing 14.2)requires modifying their diagonal coefficients only, as demonstrated by Eq. (14.26).55014Discretization of the Source Term, Relaxation, and Other Detailsfunction cfdApplyURF(theEquationName)%===================================================% written by the CFD Group @ AUB, Fall 2006%===================================================theEquation = cfdGetModel(theEquationName);urf = theEquation.urf;theCoefficients = cfdGetCoefficients;theCoefficients.ac = theCoefficients.ac/urf;cfdSetCoefficients(theCoefficients);Listing 14.2 Implementation of Patankar’s implicit under-relaxation method14.5.2 OpenFOAM®14.5.2.1Source Term LinearizationIn Sect. 14.1, the treatment of the source in the transport equation of a genericvariable / was discussed.

The suggested linearization (or implicit treatment) can beviewed as imposing an artificial time step onto the matrix of coefficients, thusaffecting the characteristic time of advancing the solution. In addition it increasesdiagonal dominance and enhances the solution robustness of the algebraic system ofequations by allowing for an inherent relaxation to come into action when needed.That is, whenever the negative source term changes substantially, the systemself-adapt the time step resolution in order to capture the characteristics of themodeled phenomenon. This is in contrast with the non-linearization approach(explicit treatment), which necessitates heavier under-relaxation of the system ofequations with the relaxation factor being generally not optimal.For the discretization of the source term OpenFOAM® [5] uses the implicit fvm::and explicit fvc: : operators.

Specifically the implementation of the fvc:: operatorcan be found in the directory “$FOAM_SRC/finiteVolume/finiteVolume/fvc/” inthe corresponding files fvcSup.H and fvcSup.C. However it is usually the norm todefine the explicit source term into the equation without the need for using the fvc::operator. For example considering the case of a generic scalar transport equationwith a source term that does not depend directly on the main variable and thuscannot be linearized, given byr ðqU/Þ r ðkrð/ÞÞ ¼ aU 2ð14:35ÞIn OpenFOAM® Eq. (14.35) can be implemented, as shown in Listing 14.3,14.5Computational Pointers551fvMatrix<scalar> phiEqn(fvm::div(mDot,phi) - laplacian(k,phi) == a*magSqr(U));Listing 14.3 Defining an explicit source term without invoking the fvc operatorwith the source term not requiring any special wrapping function or operator.The implementation of the fvm:: functions can be found in the directory“$FOAM_SRC/finiteVolume/finiteVolume/fvm/” in the corresponding filesfvmSup.H and fvmSup.C.

The discretization of the linearized source is set infunction fvm::Sp. As per Eq. (14.5), the implicit part of the source term is added asa contribution to the main diagonal of the coefficient matrix. For that purpose thefunction Sp is defined in Listing 14.4.template<class Type>Foam::tmp<Foam::fvMatrix<Type> >Foam::fvm::Sp(const DimensionedField<scalar, volMesh>& sp,const GeometricField<Type, fvPatchField, volMesh>& vf){const fvMesh& mesh = vf.mesh();tmp<fvMatrix<Type> > tfvm(new fvMatrix<Type>(vf,dimVol*sp.dimensions()*vf.dimensions()));fvMatrix<Type>& fvm = tfvm();fvm.diag() += mesh.V()*sp.field();return tfvm;}Listing 14.4 Script used for the definition and implementation of the Sp functionIt is worth mentioning that the function Sp treats the source term irrespective ofthe sign of the slope of its linearized form.

This means that for the case when theslope of the linearized term is positive the operation may lead to divergence of thesolution algorithm as it destroys the diagonal dominance of the set of algebraicequations. Thus it is always important to ensure that the implicit treatment is usedonly when it results in a negative slope of the linearized term.

For the case when the55214Discretization of the Source Term, Relaxation, and Other Detailsslope of the linearized source term can assume, in different regions of the domain,different values (positive and negative), the negative contributions should be treatedas implicit and positive contribution as explicit. For that purpose OpenFOAM®provides a special source term function denoted by fvm::SuSp in which theimplicit/explicit treatment is automatically performed. The script of this function isgiven in Listing 14.5.template<class Type>Foam::tmp<Foam::fvMatrix<Type> >Foam::fvm::SuSp(const DimensionedField<scalar, volMesh>& susp,const GeometricField<Type, fvPatchField, volMesh>& vf){const fvMesh& mesh = vf.mesh();tmp<fvMatrix<Type> > tfvm(new fvMatrix<Type>(vf,dimVol*susp.dimensions()*vf.dimensions()));fvMatrix<Type>& fvm = tfvm();fvm.diag() += mesh.V()*max(susp.field(), scalar(0));fvm.source() -= mesh.V()*min(susp.field(), scalar(0))*vf.internalField();return tfvm;}Listing 14.5 Script used for the definition and implementation of the SuSp functionIn this function both diagonal and source term vectors are filled depending on thelocal sign of the slope of the linearized source term.

In fact the use of the max/minfunction achieves the selective discretization. For instance, if in a generic cell of thedomain the slope of the linearized source term assumes a negative value (here takenas positive) the contribution to the source vector is zero (i.e., min(SuSp.field(),scalar(0)) = 0) and the opposite for the diagonal contribution.14.5.2.2Under-RelaxationThe under-relaxation methods used in OpenFOAM® include both the implicittechnique of Patankar and the explicit variable relaxation. More specifically the14.5Computational Pointers553implicit under relaxation is applied only to the fvMatrix object (i.e., the actual finitevolume discretization matrix) while the explicit relaxation is defined only forGeometricField objects.The explicit relaxation described by Eq.

(14.6) can be found in the fileGeometricField.C in the “$FOAM_SRC/OpenFOAM/fields/GeometricFields/GeometricField” directory. The dedicated function (Listing 14.6) inside theGeometricField class for performing this task is given bytemplate<class Type, template<class> class PatchField, class GeoMesh>voidFoam::GeometricField<Type,PatchField,GeoMesh>::relax(constscalar alpha){if (debug){InfoIn("GeometricField<Type, PatchField, GeoMesh>::relax""(const scalar alpha)") << "Relaxing" << endl << this->info() << " by " << alpha <<endl;}operator==(prevIter() + alpha*(*this - prevIter()));}Listing 14.6 Script of the function in the GeometricField class for explicit under relaxationwhere the operator “==” defines the new value of the GeometricField itself basedon the current value and the previous one in accordance with Eq.

(14.6).In general to explicitly relax a variable, first its value is stored in the prevIter()array, after that calculations are performed to obtain the new predicted value, andfinally relaxation is applied. For example, using the pressure “p” as theGeometricField variable the following should be written (Listing 14.7):volScalarField p(IOobject("p",runTime.timeName(),mesh,IOobject::MUST_READ,IOobject::AUTO_WRITE),mesh);any preliminary operationp.storePrevIter();Perform the operation for the new predicted pressurep=p.relax();Listing 14.7 Explicit under relaxation of the pressure field55414Discretization of the Source Term, Relaxation, and Other DetailsIn this case the value of the relaxation factor is directly read from the fvSolutiondictionary. In case the developer requires a certain constant value, say 0.5, the lastline in Listing 14.5 should be replaced by “p.relax(0.5);”.The Patankar relaxation is applied directly to the matrix of coefficients and inOpenFOAM® it is implemented inside the fvMatrix class.

The file fvMatrix.C inthe directory “$FOAM_SRC/finiteVolume/fvMatrices/fvMatrix” contains the definition of the implicit relaxation given in Listing 14.8.template<class Type>void Foam::fvMatrix<Type>::relax(const scalar alpha){if (alpha <= 0){return;}Listing 14.8 Script for the definition of implicit relaxationThe function definition is quite long, mainly due to the constraints imposed bythe diagonal dominance requirement of the matrix of coefficients, but the relevantcode reads (Listing 14.9)Field<Type>& S = source();scalarField& D = diag();// Store the current unrelaxed diagonal for use in updating thesourcescalarField D0(D);// ... then relaxD /= alpha;// Finally add the relaxation contribution to the source.S += (D - D0)*psi_.internalField();Listing 14.9 Excerpts of the script used for implicit under relaxationIn the first part, after checking the sign of the slope of the linearized source,references to the diagonal and source vectors are setup.

The original diagonal isstored under the “D0” scalar field and then divided by the relaxation factor “alpha”.An additional contribution is added to the source vector of the matrix where “psi_”is the variable associated with the fvMatrix class. The source term looks slightlydifferent from the right hand side of Eq. (14.4) but defines exactly the same contribution, as shown in the following equation:14.5Computational Pointers555að 1 kÞCaC /C ¼ aC /Ckk14.6ð14:36ÞClosureThe chapter dealt with the treatment of the source term in the general conservationequation and discussed several methods used for under-relaxing the algebraicsystem of equations. The chapter also discussed some of the indicators used forchecking convergence.

The next chapter is devote for the solution of incompressible flow problems.14.7ExercisesExercise 1Linearize the following source term where the dependent variable is /:Q/C ¼ A þ Bj/C j/CExercise 2Consider the following equation:@/ r Cr/ ¼ bð/ 1Þ1=3 j /4 1@tDerive the algebraic equation for an element C. Use a first order Euler schemefor the transient term and linearize the source terms given that b and j are bothpositive.Exercise 3Consider the steady convection diffusion equation given byr ðqv/Þ r Cr/ ¼ 2 /3a. Discretize the above equation using the SMART scheme with a deferred correction approach for the convection term, and linearize the source term.b.

Характеристики

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6455
Авторов
на СтудИзбе
305
Средний доход
с одного платного файла
Обучение Подробнее