CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions > OpenFOAM CC Toolkits for Fluid-Structure Interaction

[solids4Foam] codeStream for pressure boundary condition in 0/solid/D

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2025, 22:59
Default codeStream for pressure boundary condition in 0/solid/D
  #1
New Member
 
Sam Mallinson
Join Date: Aug 2013
Posts: 9
Rep Power: 14
SamMallinson is on a distinguished road
I wish to express a pressure load on a solid wall as a function of location.


I have been using the traction BC in 0/solid/D to apply a fixed value pressure, but the case I am computing requires the pressure to be a function of distance from a point.


Is it possible to use codeStream to do this?


I think this might be tricky as the traction BC is for displacements, and I want to apply a pressure.


Details of system:
OpenFOAM: Build : _76d719d1e6-20220624 OPENFOAM=2206 version=v2206
solids4foam: installed March 2025 via repository
OS: Ubuntu 20.04

Last edited by SamMallinson; October 21, 2025 at 18:57. Reason: adding details
SamMallinson is offline   Reply With Quote

Old   October 21, 2025, 19:03
Default implementation
  #2
New Member
 
Sam Mallinson
Join Date: Aug 2013
Posts: 9
Rep Power: 14
SamMallinson is on a distinguished road
This is what I tried:


in `0/solid/D`, at the top of the file, I had


```
#include "pressureCondition"
```
then in the body


```
compression-force
{
type solidTraction;
traction uniform ( 0 0 0 );
value uniform (0 0 0);
pressure $pressureF;
}
```


The file `pressureCondition` is as follows:


```
pressureF #codeStream
{
code
#{
scalar D = 0.003;
scalar A = 2 * 3.14159 * 0.002 * D;

const IOdictionary& d = static_cast<const IOdictionary&>
(
dict.parent().parent()
);



const fvMesh& mesh = refCast<const fvMesh>(d.db());
const label id = mesh.boundary().findPatchID("compression-force");
const fvPatch& patch = mesh.boundary()[id];
scalarField myPatch(patch.size(), scalar(0) );
forAll(myPatch, celli)
{
scalar zc = patch.Cf()[celli][2];
myPatch[celli] = scalar(250 * pow(Foam::constant::mathematical::e, ((-4 * pow(zc,2))/(pow((4 * D),2))) ) / A);
}
operator == (myPatch);

#};

codeInclude
#{
#include "fvCFD.H"
#include "volFields.H"
#};

codeOptions
#{
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(FOAM_CASE)/system
#};

codeLibs
#{
-lfiniteVolume \
-lmeshTools
#};
};
#inputMode merge
```
SamMallinson is offline   Reply With Quote

Reply

Tags
codestream, solids4foam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to update Boundary Condition in the loop with #codeStream? TeddyL OpenFOAM 0 October 20, 2024 03:56
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
Radiation interface hinca CFX 15 January 26, 2014 18:11
CFX fails to calculate a diffuser pipe flow shenying0710 CFX 7 March 26, 2013 05:13


All times are GMT -4. The time now is 09:48.