|
[Sponsors] |
Adding constant temperture scalar value in stressAnalyisis solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 10, 2013, 15:05 |
Adding constant temperture scalar value in stressAnalyisis solver
|
#1 |
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 13 |
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 |
|
May 11, 2013, 12:14 |
|
#2 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17 |
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. |
|
May 11, 2013, 13:35 |
|
#3 |
Member
Sangeeta
Join Date: Jul 2012
Location: Kingston, Canada
Posts: 70
Rep Power: 13 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 20: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 |