CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Creating a new volScalarField (Calulated)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2019, 07:06
Default Creating a new volScalarField (Calulated)
  #1
Senior Member
 
Ashwani
Join Date: Sep 2013
Location: Hyderabad
Posts: 154
Rep Power: 12
AshwaniAssam is on a distinguished road
Hi,


I am trying to modify sonicFOAM. I am trying to create a source term (phi_g) to momentum equation which is d(phi_g)/dx. Where phi_g is function of coordinate x. It is created in the createFields.h in the following manner.

Quote:
volScalarField phi_g
(
IOobject
(
"phi_g",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
(mesh.C().component(0))*dummy
);
Now, in the pressure equation it will become Laplacian(phi_g).


Now, when I compile the code it compiles fine. But while running a case it gives the following error:


Quote:
--> FOAM FATAL ERROR:
cannot be called for a calculatedFvPatchField
on patch sides of field phi_g in file "/home/asd/OpenFOAM/asd-v1906/run/shockTube/constant/phi_g"
You are probably trying to solve for a field with a default boundary condition.

From function Foam::tmp<Foam::Field<Type> > Foam::calculatedFvPatchField<Type>::gradientIntern alCoeffs() const [with Type = double]
in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 188.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::calculatedFvPatchField<double>::gradientInte rnalCoeffs() const at ??:?
#3 Foam::fv::gaussLaplacianScheme<double, Foam::SymmTensor<double> >::fvmLaplacianUncorrected(Foam::GeometricField<do uble, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#4 Foam::fv::gaussLaplacianScheme<double, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#5 ? at ??:?
#6 ? at ??:?
#7 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#8 ? at ??:?
Aborted (core dumped)
My question is that the boundary condition for the new scalar field should be calculated in the same manner as its definition.

Do I need to specify a boundary condition for phi_g in 0 folder with types calculated?
AshwaniAssam is offline   Reply With Quote

Reply


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
Error message Bruno_Jorge Main CFD Forum 1 February 5, 2019 11:12
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 4 December 4, 2016 12:31
using chemkin JMDag2004 OpenFOAM Pre-Processing 2 March 8, 2016 22:38
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 06:16


All times are GMT -4. The time now is 00:28.