|
[Sponsors] |
How to export parameter data (I'm using RheoTool)? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 9, 2022, 16:19 |
How to export parameter data (I'm using RheoTool)?
|
#1 |
New Member
IIIIKEK
Join Date: Oct 2022
Posts: 6
Rep Power: 4 |
Hi, I'm just student and touching OpenFOAM first time. I need to make model that can show shear rate and viscosity functions of Giesekus fluid. I used RheoTool libraly and made modified constitutive equation for my model.
I see in code that "tau_" parameter values prescibed to export here. How to export "L" and "etaP" values like them? C file: Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright held by original author \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \*---------------------------------------------------------------------------*/ #include "coupledSolver.H" #include "blockOperators.H" #include "GiesekusCY.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace constitutiveEqs { defineTypeNameAndDebug(GiesekusCY, 0); addToRunTimeSelectionTable(constitutiveEq, GiesekusCY, dictionary); } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::constitutiveEqs::GiesekusCY::GiesekusCY ( const word& name, const volVectorField& U, const surfaceScalarField& phi, const dictionary& dict ) : constitutiveEq(name, U, phi), tau_ ( IOobject ( "tau" + name, U.time().timeName(), U.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), U.mesh() ), rho_(dict.lookup("rho")), etaS_(dict.lookup("etaS")), etaP_(dict.lookup("etaP")), alpha_(dict.lookup("alpha")), lambda_(dict.lookup("lambda")), m_(dict.lookup("m")), n_(dict.lookup("n")), K_(dict.lookup("K")), L_(dict.lookup("L")), a_(dict.lookup("a")), b_(dict.lookup("b")), thermoLambdaPtr_(thermoFunction::New("thermoLambda", U.mesh(), dict)), thermoEtaPtr_(thermoFunction::New("thermoEta", U.mesh(), dict)) { checkForStab(dict); checkIfCoupledSolver(U.mesh().solutionDict(), tau_); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::constitutiveEqs::GiesekusCY::correct ( const volScalarField* alpha, const volTensorField* gradU ) { // Velocity gradient tensor volTensorField L(gradU == nullptr ? fvc::grad(U())() : *gradU); // Convected derivate term volTensorField C(tau_ & L); // Twice the rate of deformation tensor volSymmTensorField twoD(twoSymm(L)); // Effective viscosity and relaxation time volScalarField etaP ( etaP_*Foam::pow(1 + Foam::pow(K_* sqrt(2.0)*mag(symm(L)),a_), (n_- 1)/a_) ); volScalarField lambda ( lambda_*Foam::pow(1 + Foam::pow( L_* sqrt(2.0)*mag(symm(L)),b_), (m_- 1)/b_) ); // Update temperature-dependent properties thermoLambdaPtr_->multiply(lambda); thermoEtaPtr_->multiply(etaP); // Stress transport equation fvSymmTensorMatrix tauEqn ( fvm::ddt(tau_) + fvm::div(phi(), tau_) == twoSymm(C) - (alpha_/etaP)*(symm(tau_ & tau_)) - fvm::Sp(1/lambda, tau_) ); tauEqn.relax(); if (!solveCoupled_) { solve(tauEqn == etaP/lambda*twoD); } else { // Get the solver coupledSolver& cps = U().time().lookupObjectRef<coupledSolver>(word("Uptau."+U().mesh().name())); // Insert tauEqn cps.insertEquation ( tau_.name(), tau_.name(), tauEqn ); // Insert term (gradU + gradU.T) cps.insertEquation ( tau_.name(), U().name(), fvmb::twoSymmGrad(-etaP/lambda, U()) ); } } // ************************************************************************* // Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright held by original author \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class GiesekusCY SourceFiles GiesekusCY.C \*---------------------------------------------------------------------------*/ #ifndef GiesekusCY_H #define GiesekusCY_H #include "constitutiveEq.H" #include "thermoFunction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { namespace constitutiveEqs { /*---------------------------------------------------------------------------*\ Class GiesekusCY Declaration \*---------------------------------------------------------------------------*/ class GiesekusCY : public constitutiveEq { // Private data //- Transported viscoelastic stress volSymmTensorField tau_; // Model constants //- Density dimensionedScalar rho_; //- Solvent viscosity dimensionedScalar etaS_; //- Zero shear rate polymer viscosity dimensionedScalar etaP_; //- Mobility factor dimensionedScalar alpha_; //- Relaxation time dimensionedScalar lambda_; //- Fitted parameter for lambda dimensionedScalar m_; //- Fitted parameter for etaP dimensionedScalar n_; //- Fitted parameter for etaP dimensionedScalar K_; //- Fitted parameter for lambda dimensionedScalar L_; //- Fitted parameter for etaP dimensionedScalar a_; //- Fitted parameter for lambda dimensionedScalar b_; //- Thermofunction for temperature dependence of lambda autoPtr<thermoFunction> thermoLambdaPtr_; //- Thermofunction for temperature dependence of viscosity autoPtr<thermoFunction> thermoEtaPtr_; // Private Member Functions //- Disallow default bitwise copy construct GiesekusCY(const GiesekusCY&); //- Disallow default bitwise assignment void operator=(const GiesekusCY&); protected: //- Return the solvent viscosity virtual const dimensionedScalar etaS() const { return etaS_; } //- Return the polymeric viscosity virtual const dimensionedScalar etaP() const { return etaP_; } // Return etaS corrected for temperature virtual tmp<volScalarField> etaSThermo() const { return thermoEtaPtr_->createField(etaS_); } // Return etaP corrected for temperature virtual tmp<volScalarField> etaPThermo() const { return thermoEtaPtr_->createField(etaP_); } // Is the model prepared to work in non-isothermal conditions virtual bool hasThermo() const { return true; } public: //- Runtime type information TypeName("GiesekusCY"); // Constructors //- Construct from components GiesekusCY ( const word& name, const volVectorField& U, const surfaceScalarField& phi, const dictionary& dict ); // Destructor virtual ~GiesekusCY() {} // Member Functions //- Return the viscoelastic stress tensor virtual tmp<volSymmTensorField> tau() const { return tau_; } //- Return the density virtual const dimensionedScalar rho() const { return rho_; } //- Return true if GNF (non-elastic) virtual bool isGNF() const { return false; }; //- Correct the viscoelastic stress: alpha is the color function in two phase-flows virtual void correct ( const volScalarField* alpha = nullptr, const volTensorField* gradU = nullptr ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace constitutiveEqs } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // |
|
October 17, 2022, 10:05 |
|
#2 |
New Member
IIIIKEK
Join Date: Oct 2022
Posts: 6
Rep Power: 4 |
Ok, I found that I can insert tensors, like here:
Code:
C file: srate_ ( IOobject ( "srate" + name, U.time().timeName(), U.mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), U.mesh() ), Code:
volSymmTensorField srate_; |
|
Tags |
noob question |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Utility to export field data | tbrycekelly | OpenFOAM Post-Processing | 1 | November 23, 2024 08:48 |
[OpenFOAM.org] Compiling OpenFOAM 5.0 on the Titan Supercomputer | wildfire230 | OpenFOAM Installation | 20 | May 6, 2020 08:30 |
Parameter Set Export Data | Ansysauto | ANSYS | 0 | March 18, 2018 02:28 |
Unable to install OpenFOAM 1.6-ext | Maimouna | OpenFOAM Installation | 23 | May 8, 2014 06:47 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |