CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

issue with mesh_.V()

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2020, 20:56
Default issue with mesh_.V()
  #1
Member
 
Sam
Join Date: May 2019
Posts: 60
Rep Power: 3
saj216 is on a distinguished road
Hey guys,

I found this here https://www.openfoam.com/documentati...ces-coded.html and I was wondering if there was an error here. This is regarding the treatment of V (heSource[i] += 1e5*sin(200*cellx[i])*V[i] surely this is should be divided instead. If not why? I just wish to check.

Usage
An example showing how to add a source to the energy equation of the form

Sh=1/V*100000sin(200Cx)
is shown below:

codedSource
{
type coded;
selectionMode all;

fields (h);
name sourceTime;

codeAddSup
#{
const Time& time = mesh().time();
const scalarField& V = mesh_.V();
scalarField& heSource = eqn.source();

// Start time
const scalar startTime = 2.0;

// Retrieve the x component of the cell centres
const scalarField& cellx = mesh_.C().component(0);

// Only apply when we have reached the start time
if (time.value() > startTime)
{
// Apply the source
forAll(cellx, i)
{
// cell volume specific source
heSource[i] += 1e5*sin(200*cellx[i])*V[i];
};
}
#};
}

Thanks,

Sam
saj216 is offline   Reply With Quote

Reply

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
[snappyHexMesh] SnappyHexMesh/splitMeshRegion : region1 in zone "-1" GuiMagyar OpenFOAM Meshing & Mesh Conversion 1 September 10, 2019 09:59
how to set periodic boundary conditions Ganesh FLUENT 14 November 26, 2018 11:26
[Gmsh] GMSH : structured mesh issue bibiboom OpenFOAM Meshing & Mesh Conversion 0 May 17, 2017 18:49
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 09:03


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