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

Adding constant temperture scalar value in stressAnalyisis solver

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 10, 2013, 15:05
Default Adding constant temperture scalar value in stressAnalyisis solver
  #1
Member
 
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 5
Sargam05 is on a distinguished road
Hello all,

I am using solidDisplacementFoam solver for the thermal stress analysis. I do not want to solve ddt equation for the temperature. I need to give a constant scalar value of temperature, T (e.g. 1073 K) for every cell id instead of solving ddt equation. Therefore I have made following changes in solidDisplacementFoam.C file :

#include "fvCFD.H"
#include "Switch.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"
#include "createMesh.H"
#include "readMechanicalProperties.H"
#include "readThermalProperties.H"
#include "readSolidDisplacementFoamControls.H"
#include "createFields.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nCalculating displacement field\n" << endl;

while (runTime.loop())
{
Info<< "Iteration: " << runTime.value() << nl << endl;

#include "readSolidDisplacementFoamControls.H"

int iCorr = 0;
scalar initialResidual = 0;

do
{
if (thermalStress)

{
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
mesh,
dimensionedScalar Onethousandseventyfive
(
"Onethousandseventyfive",
dimensionSet(0, 0, 0, -1, 0, 0 ,0),
1075
)
);
forAll(mesh.C(),celli)
{
T[celli]=1073;

}

{
fvVectorMatrix DEqn
(
fvm::d2dt2(D)
==
fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
+ divSigmaExp
);

if (thermalStress)
{
const volScalarField& T = Tptr();
DEqn += fvc::grad(threeKalpha*T);
}

//DEqn.setComponentReference(1, 0, vector::X, 0);
//DEqn.setComponentReference(1, 0, vector::Z, 0);

initialResidual = DEqn.solve().initialResidual();

if (!compactNormalStress)
{
divSigmaExp = fvc::div(DEqn.flux());
}
}

{
volTensorField gradD = fvc::grad(D);
sigmaD = mu*twoSymm(gradD) + (lambda*I)*tr(gradD);

if (compactNormalStress)
{
divSigmaExp = fvc::div
(
sigmaD - (2*mu + lambda)*gradD,
"div(sigmaD)"
);
}
else
{
divSigmaExp += fvc::div(sigmaD);
}
}

} while (initialResidual > convergenceTolerance && ++iCorr < nCorr);

#include "calculateStress.H"

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}

But following error is coming during compilation:

Making dependency list for source file tractionDisplacement/tractionDisplacementFvPatchVectorField.C
Making dependency list for source file solidDisplacementFoam.C
SOURCE=tractionDisplacement/tractionDisplacementFvPatchVectorField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/finiteVolume/lnInclude -ItractionDisplacement/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/tractionDisplacementFvPatchVectorField.o
SOURCE=solidDisplacementFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/finiteVolume/lnInclude -ItractionDisplacement/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/solidDisplacementFoam.o
solidDisplacementFoam.C: In function ‘int main(int, char**)’:
solidDisplacementFoam.C:82: error: expected primary-expression before ‘Onethousandseventyfive’
solidDisplacementFoam.C:154: error: expected ‘while’ before ‘Info’
solidDisplacementFoam.C:154: error: expected ‘(’ before ‘Info’
solidDisplacementFoam.C:154: error: expected ‘)’ before ‘;’ token
readSolidDisplacementFoamControls.H:3: warning: unused variable ‘nCorr’
readSolidDisplacementFoamControls.H:4: warning: unused variable ‘convergenceTolerance’
solidDisplacementFoam.C:157: error: expected ‘}’ at end of input
make: *** [Make/linuxGccDPOpt/solidDisplacementFoam.o] Error 1

Does anyone have any idea why this error is coming during compilation of solver? I appreciate if you would help me to fix it!

Best regards,
Sangeeta
Sargam05 is offline   Reply With Quote

Old   May 11, 2013, 12:14
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 278
Rep Power: 9
kmooney is on a distinguished road
I would just follow what the compiler errors say and check your brackets, particularly around the 'while' statement. That's what the compiler errors are for...

If you don't follow due diligence when posting problems or questions to this forum a lot of people will ignore the post. I'm not trying to be mean or cold but its the truth.
kmooney is offline   Reply With Quote

Old   May 11, 2013, 13:35
Default
  #3
Member
 
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 5
Sargam05 is on a distinguished road
Hi Kyle,

Thank you for your straight-forward comment. Actually I was supposed to include a note to ignore the bracket error but I forgot to do that.

Now I have corrected the bracket error but only error which is coming is:

solidDisplacementFoam.C:82: error: expected primary-expression before ‘Onethousandseventyfive’

I really appreciate if any member of has any suggestion about this error.
Sargam05 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45
compressible two phase flow in CFX4.4 youngan CFX 0 July 1, 2003 23:32
CFX 5.5 Roued CFX 1 October 2, 2001 16:49
Setting a B.C using UserFortran in 4.3 tokai CFX 10 July 17, 2001 16:25


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