|
[Sponsors] |
August 14, 2024, 09:56 |
Help with linear boundary condition
|
#1 |
New Member
Mateus Marques Brainer
Join Date: Mar 2024
Posts: 2
Rep Power: 0 |
Hello, everyone.
I'm new to OpenFOAM and i'm trying to make a linear function as a boundary condition, something like T = 100 - x I tried this, but it doesn't work:Code:
patch1 { type fixedValue; value #codeStream { codeInclude #{ #include "fvModels.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict.parent().parent()); const fvMesh& mesh = refCast<const fvMesh>(d.db()); const label id = mesh.boundary().findPatchID("patch1"); const fvPatch& patch = mesh.boundary()[id]; scalarField T(patch.size(), 0.); forAll(T, i) { const scalar x = patch.Cf()[i].x(); T[i] = 100 - x; } writeEntry(os, "", T); #}; }; } I'm looking for a cube with 2 faces with fixed values: 100 and 0 and the lateral faces using this function. Any help is welcome. |
|
Tags |
boundary condition, openfoam 11 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
sliding mesh problem in CFX | Saima | CFX | 46 | September 11, 2021 08:38 |
Optimal tolerance and variables scaling settings | 4513645ygq | Main CFD Forum | 0 | July 28, 2020 09:56 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |