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

How can I access the time value in constant/g?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2024, 21:35
Default How can I access the time value in constant/g?
  #1
New Member
 
zzt
Join Date: Dec 2021
Posts: 7
Rep Power: 5
binnnnn is on a distinguished road
How can I access the time value in constant/g? I used codeStream:

Code:

FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -2 0 0 0 0];
value #codeStream
{
codeInclude
#{
#include "fvCFD.H"
#};

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

codeLibs
#{
-lmeshTools \
-lfiniteVolume
#};

code
#{
const scalar omega=1.27e7;
const scalar delta=1.04e-06;
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
scalar t = d.db().time().value();

vector g=vector(0,-delta*t*sin(omega*t),0);

os << g; //g.writeEntry("",os);

#};
};

Error:

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigSegv::sigHandler(int) at ??:?
#2 ? in /lib/x86_64-linux-gnu/libc.so.6
#3 codeStream_70b6e73f8f7979e019f35082d4980f6a16aa34d f at constant/g.#codeStream:44
#4 Foam::functionEntries::codeStream::evaluate(Foam:: dictionary const&, Foam::Istream&) at ??:?
#5 Foam::functionEntries::codeStream::execute(Foam::d ictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?
#6 Foam::functionEntry::execute(Foam::word const&, Foam::dictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?
#7 Foam:rimitiveEntry::acceptToken(Foam::token const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#8 Foam:rimitiveEntry::read(Foam::dictionary const&, Foam::Istream&) at ??:?
#9 Foam:rimitiveEntry::readEntry(Foam::dictionary const&, Foam::Istream&) at ??:?
#10 Foam:rimitiveEntry:rimitiveEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
#11 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?
#12 Foam::dictionary::read(Foam::Istream&, bool) at ??:?
#13 Foam::dictionary::dictionary(Foam::Istream&, bool) at ??:?
#14 Foam::UniformDimensionedField<Foam::Vector<double> >::readData(Foam::Istream&) in ~/OpenFOAM/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/interIsoFoam
#15 Foam::fileOperations::uncollatedFileOperation::rea d(Foam::regIOobject&, bool, Foam::IOstreamOption::streamFormat, Foam::word const&) const at ??:?
#16 Foam::regIOobject::readHeaderOk(Foam::IOstreamOpti on::streamFormat, Foam::word const&) at ??:?
#17 Foam::meshObjects::gravity::gravity(Foam::Time const&) in ~/OpenFOAM/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/interIsoFoam
#18 Foam::meshObjects::gravity const& Foam::MeshObject<Foam::Time, Foam::TopologicalMeshObject, Foam::meshObjects::gravity>::New<>(Foam::Time const&) in ~/OpenFOAM/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/interIsoFoam
#19 ? in ~/OpenFOAM/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/interIsoFoam
#20 ? in /lib/x86_64-linux-gnu/libc.so.6
#21 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#22 ? in ~/OpenFOAM/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/interIsoFoam

Best
binnnnn is offline   Reply With Quote

Reply

Tags
codestream


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
bash script for pseudo-parallel usage of reconstructPar kwardle OpenFOAM Post-Processing 42 May 8, 2024 00:17
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 6, 2023 00:48
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 10:10
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50


All times are GMT -4. The time now is 11:06.