Главная » Просмотр файлов » 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), страница 35

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

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

The scriptused is shown in Listing 7.47 in which one of the several constructors of the classGeometricField is used (other constructors can be found in the header file of thespecific class GeometricField.H).volScalarField T(IOobject("T",runTime.timeName(),mesh,IOobject::NO_READ,IOobject::AUTO_WRITE),mesh,dimensionedScalar("DTVol", dimensionSet(0,0,0,1,0,0,0), 300.0),"zeroGradient");volVectorField U(IOobject("U",runTime.timeName(),mesh,IOobject::NO_READ,IOobject::AUTO_WRITE),mesh,dimensionedVector("U",dimensionSet(0,1,-1,0,0,0,0),vector::zero),"zeroGradient");Listing 7.47 Script used to define the two variables U and T in OpenFOAM®As can be seen in the code, both fields are linked to the mesh.

Both requirespecifying the following four arguments: (i) field name, (ii) field dimension,(iii) initialization, and (iv) boundary conditions. Specific boundary conditions haveto be defined for the field and in this case a zero order extrapolation (i.e.,“zeroGradient”) is specified for the full set of boundaries and for both variables.7.2 OpenFOAM®199Similar constructors can be used for variables defined at faces of the mesh. Forexample, the script needed to define the mass flux (volume flow rate) field at cellfaces is shown in Listing 7.48.surfaceScalarField mdot(IOobject("mdot",runTime.timeName(),mesh,IOobject::READ_IF_PRESENT,IOobject::AUTO_WRITE),linearInterpolate(U) & blockMesh.Sf());Listing 7.48 Script used to define the mass flux field at mesh facesIn this case the field is constructed with a scalar product between velocity(interpolated at the face) and face area vectors.

This field represents the volumeflow rate at control volume faces. It also represents the mass flow rate field forincompressible flows with a density value of one.Once fields are defined, access to specific data in different parts of the mesh ispossible as shown in the scripts below.7.2.2 InternalField DataInternal field data can be accessed (Listing 7.49) using// internal accessforAll(T.internalField(), cellI){scalar cellT = T.internalField()[cellI];}// internal accessforAll(U.internalField(), cellI){vector cellU = U.internalField()[cellI];}Listing 7.49 Accessing internal field data2007 The Finite Volume Mesh in OpenFOAM® and uFVM7.2.3 BoundaryField DataBoundary field data can be accessed (Listing 7.50) usingconst volVectorField::GeometricBoundaryField& UBoundaryList =U.boundaryField();// boundary accessforAll(UBoundaryList, patchI){const fvPatchField<vector>& fieldBoundary = UBoundaryList[patchI];forAll(fieldBoundary, faceI){vector faceU = fieldBoundary[faceI];}}Listing 7.50 Accessing boundary field dataor in a more compact form via (Listing 7.51)// boundary accessforAll(T.boundaryField(), patchI){forAll(T.boundaryField()[patchI], faceI){scalar faceT = T.boundaryField()[patchI][faceI];}}Listing 7.51 A more compact script to access boundary field data7.2.4 lduAddressingOpenFOAM® uses exclusively face addressing in its discretization loops andcoefficients storage.

It also uses arbitrary polyhedral elements in its meshes.A polyhedron element can have any number of faces with a neighbor elementassociated with each interior face. The storage of coefficients in OpenFOAM® isbased on the face addressing scheme. In this approach, coefficients are storedfollowing the interior face ordering, with access to elements and their coefficients,based on the owner/neighbor indices associated with interior faces.

As mentioned inthe previous section, the element with the lower index is the owner while theneighbor is the element with the higher index. For boundary faces the owner isalways the cell to which the face is attached while no neighbor is defined by settingthe neighbour index to −1. The list of owner or neighbor indices thus define theorder in which the element-to-element coefficients are assembled for the variousintegral operators.7.2 OpenFOAM®201The above described scheme is denoted by lduAddressing and is implementedin the lduMatrix class displayed in Fig.

7.10 that includes 5 arrays representing thediagonal, upper, and lower coefficients and the lower and upper indices of the faceowner and neighbor, respectively. In this scheme, owners represent the lower triangular part of the matrix (lower addressing) while neighbors refer to the uppertriangular part (upper addressing). It is worth mentioning that given a face for anowner element the lower and upper addressing provide respectively the column androw where the coefficient of the face flux is stored in the matrix while it is theopposite for a neighbor cell. For the domain shown on the upper left side ofFig.

7.10, the owner and neighbor of each face are displayed in the lowerAddr()and upperAddr() array, respectively. The face number is the position of the owneror neighbor in the array plus one (since numbering starts with 0). Consideringinternal face number 4, for example, its related information is stored in the fifth row(in C++ indexing starts from 0) of the lower(), upper(), lowerAddr(), andupperAddr() array, respectively.

The stored data indicate that its owner is elementnumber 2 (lowerAddr() array), its neighbor is element number 4 (upperAddr()array), the coefficient multiplying /4 in the algebraic equation for element number 2Fig. 7.10 The lduAddressing and lduMatrix2027 The Finite Volume Mesh in OpenFOAM® and uFVMis stored in the fifth row of the array upper(), and the coefficient multiplying /2 inthe algebraic equation for element number 4 is stored in the fifth row of the arraylower().Thus the lduAdressing provides information about the addresses of the offdiagonal coefficients in relation to the faces to which they are related. This meansthat while the computational efficiency for various operations on the matrix is highwhen they are mainly based on loops over all faces of the mesh, direct access to aspecific row-column matrix element is difficult and inefficient.

One example is thesummation of the off-diagonal coefficients for each row given byXac ¼anð7:1ÞnnbðCÞIn this case the use of face addressing does not allow direct looping over theoff-diagonal elements of each row and performing such operation requires loopingover all elements because it can only be done, as shown in Listing 7.52, following aface based approach.for (label faceI=0; faceI<l.size(); faceI++){ac[l[faceI]] -= Lower[faceI];ac[u[faceI]] -= Upper[faceI];}Listing 7.52 Summation of the off-diagonal coefficientsIn Listing 7.52 ac is the sum of the off-diagonals coefficients, l and u are theupper and lower addressing while Lower and Upper stores the correspondingcoefficients.

As can be noticed the summation is performed looping through all thefaces and the summation of each row is not sequential, depending only on theowner-neighbor numeration of the mesh.So in general the lduAddressing introduces a more complex handling of thematrix operations and it will be reflected also in the implementation of linear solversbut with the advantage of higher computational speed.7.2.5 Computing the GradientThe script used to compute the Green-Gauss gradient in OpenFOAM® is shown inListing 7.53.7.2 OpenFOAM®Foam::fv::gaussGrad<Type>::gradf(const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf,const word& name){typedef typename outerProduct<vector, Type>::type GradType;const fvMesh& mesh = ssf.mesh();tmp<GeometricField<GradType, fvPatchField, volMesh> > tgGrad(new GeometricField<GradType, fvPatchField, volMesh>(IOobject(name,ssf.instance(),mesh,IOobject::NO_READ,IOobject::NO_WRITE),mesh,dimensioned<GradType>("0",ssf.dimensions()/dimLength,pTraits<GradType>::zero),zeroGradientFvPatchField<GradType>::typeName));GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad();const labelUList& owner = mesh.owner();const labelUList& neighbour = mesh.neighbour();const vectorField& Sf = mesh.Sf();//Field<GradType>& igGrad = gGrad;const Field<Type>& issf = ssf;forAll(owner, facei){GradType Sfssf = Sf[facei]*issf[facei];igGrad[owner[facei]] += Sfssf;igGrad[neighbour[facei]] -= Sfssf;}forAll(mesh.boundary(), patchi){const labelUList& pFaceCells =mesh.boundary()[patchi].faceCells();const vectorField& pSf = mesh.Sf().boundaryField()[patchi];const fvsPatchField<Type>& pssf = ssf.boundaryField()[patchi];forAll(mesh.boundary()[patchi], facei){igGrad[pFaceCells[facei]] += pSf[facei]*pssf[facei];}}igGrad /= mesh.V();gGrad.correctBoundaryConditions();return tgGrad;}Listing 7.53 Script used to compute a gradient field in OpenFOAM®2032047 The Finite Volume Mesh in OpenFOAM® and uFVMThe small introduction reported above is neither intended as a replacement ofOpenFOAM® user’s manual [1] nor a replacement of a C++ manual.

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

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

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