CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to modify the name of a specific variable (https://www.cfd-online.com/Forums/openfoam-programming-development/142111-how-modify-name-specific-variable.html)

pizicai September 23, 2014 11:05

how to modify the name of a specific variable
 
Hello, everyone,

I am using openfoam-ext-3.0 and I am trying to combine two packages. my problem is described below:

in ~/foam/foam-extend-3.0/src/solidModels, which i think all the files inside are about solid simulation, there is a variable named 'sigma', which means the stress. I want to modify its name to 'SIGMA', so i could avoid conflicts when I want to combine two packages which both declare the term 'sigma' (same name but different meaning, that's why i have to change name to differentiate those two variable). to achieve this , I replace all the 'sigma' and 'Sigma' appeared in src/solidModels with 'SIGMA',
then i go the directory : ~/foam/foam-extend-3.0//src , and type: wmake libso solidModels
all the files could be compiled smoothly.

then I go to the directory where my own solver files locate, type: wmake

all the files could be compiled smoothly.

then I go to the directory where my test case files ( just a test example) locate, all the files have been modified according to the modification of the term 'sigma', e.g. in the file fvSchems, term 'div(sigma)' has changed to 'div(SIGMA)'.

then i run the case,

what confuses me is the terminal warns there is a error:

--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
--> FOAM FATAL ERROR:

request for volSymmTensorField sigma from objectRegistry solid failed
available objects of type volSymmTensorField are

2
(
DSIGMA
SIGMA
)


From function objectRegistry::lookupObject<Type>(const word&) const
in file /home/ellen/foam/foam-extend-3.0/src/foam/lnInclude/objectRegistryTemplates.C at line 139.

FOAM aborting
Aborted (core dumped)
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------


since the volSymmTensorField sigma is still requested, I think there should be other files that declare 'sigma', which i missed. i wonder if you know where are those files that declare sigma ( stress, not others like 'sigma' defined in interfoam is tension coefficient of water).

thanks a lot, and if you need anything, feel free to contact me, and i will send your relevant files.

Yalong

pizicai September 23, 2014 11:15

what i am sure is all 'sigma' appeared in ~/foam/foam-extend-3.0/src/solidModels has modified, so if there is some file contain 'sigma' (stress), it should be outside of solidModels, but what file also deals with solid problems and thus use stress term?

pizicai September 23, 2014 11:30

after my check, I found this error comes out when defining the DU equation (DU means displacement)

the corresponding equation is :

------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------

DU.storePrevIter();
Info << "HEHE7 " << endl;
fvVectorMatrix DUEqn
(
Cn*rho*fvm::ddt(DU)
- Co*rho*DV.oldTime()
+ Coo*rho*DV.oldTime().oldTime()
==
fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)")
- fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)")
+ fvc::div
(
mu*gradDU.T()
+ lambda*(I*tr(gradDU))
+ mu*(gradDU&gradDU.T())
+ 0.5*lambda*(I*tr(gradDU & gradDU.T()))
+ (SIGMA & DF.T())
+ (DSIGMA & DF.T()),
"div(SIGMA)"
)

);

------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------

pizicai September 23, 2014 14:14

right now, I narrow down the scale of the problem:

------------------------------------------------------------------------------
------------------------------------------------------------------------------
fvVectorMatrix DUEqn
(
Cn*rho*fvm::ddt(DU)
- Co*rho*DV.oldTime()
+ Coo*rho*DV.oldTime().oldTime()
==
fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)")
- fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)")
+ fvc::div
(
mu*gradDU.T()
+ lambda*(I*tr(gradDU))
+ mu*(gradDU&gradDU.T())
+ 0.5*lambda*(I*tr(gradDU & gradDU.T()))
+(SIGMA & DF.T())
+ (DSIGMA & DF.T()),
"div(SIGMA)"
)
------------------------------------------------------------------------------
------------------------------------------------------------------------------

the problem is caused by div(SIGMA)

it is this term that request 'sigma', is there anybody know something about div() ?


All times are GMT -4. The time now is 01:51.