Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
ea17556c
Commit
ea17556c
authored
Mar 07, 2024
by
shunbo
Browse files
Initial commit
parents
Changes
798
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1009 additions
and
0 deletions
+1009
-0
applications/solvers/electromagnetics/electromagneticsSolversDoc.H
...ons/solvers/electromagnetics/electromagneticsSolversDoc.H
+32
-0
applications/solvers/electromagnetics/electrostaticFoam/Make/files
...ons/solvers/electromagnetics/electrostaticFoam/Make/files
+3
-0
applications/solvers/electromagnetics/electrostaticFoam/Make/options
...s/solvers/electromagnetics/electrostaticFoam/Make/options
+7
-0
applications/solvers/electromagnetics/electrostaticFoam/createFields.H
...solvers/electromagnetics/electrostaticFoam/createFields.H
+72
-0
applications/solvers/electromagnetics/electrostaticFoam/electrostaticFoam.C
...rs/electromagnetics/electrostaticFoam/electrostaticFoam.C
+85
-0
applications/solvers/electromagnetics/magneticFoam/Make/files
...ications/solvers/electromagnetics/magneticFoam/Make/files
+3
-0
applications/solvers/electromagnetics/magneticFoam/Make/options
...ations/solvers/electromagnetics/magneticFoam/Make/options
+7
-0
applications/solvers/electromagnetics/magneticFoam/createFields.H
...ions/solvers/electromagnetics/magneticFoam/createFields.H
+80
-0
applications/solvers/electromagnetics/magneticFoam/magnet.H
applications/solvers/electromagnetics/magneticFoam/magnet.H
+165
-0
applications/solvers/electromagnetics/magneticFoam/magneticFoam.C
...ions/solvers/electromagnetics/magneticFoam/magneticFoam.C
+167
-0
applications/solvers/electromagnetics/mhdFoam/Make/files
applications/solvers/electromagnetics/mhdFoam/Make/files
+3
-0
applications/solvers/electromagnetics/mhdFoam/Make/options
applications/solvers/electromagnetics/mhdFoam/Make/options
+7
-0
applications/solvers/electromagnetics/mhdFoam/createControl.H
...ications/solvers/electromagnetics/mhdFoam/createControl.H
+2
-0
applications/solvers/electromagnetics/mhdFoam/createFields.H
applications/solvers/electromagnetics/mhdFoam/createFields.H
+118
-0
applications/solvers/electromagnetics/mhdFoam/createPhiB.H
applications/solvers/electromagnetics/mhdFoam/createPhiB.H
+49
-0
applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H
...tions/solvers/electromagnetics/mhdFoam/magneticFieldErr.H
+4
-0
applications/solvers/electromagnetics/mhdFoam/mhdFoam.C
applications/solvers/electromagnetics/mhdFoam/mhdFoam.C
+190
-0
applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H
...ions/solvers/electromagnetics/mhdFoam/readBPISOControls.H
+3
-0
applications/solvers/financial/financialFoam/Make/files
applications/solvers/financial/financialFoam/Make/files
+3
-0
applications/solvers/financial/financialFoam/Make/options
applications/solvers/financial/financialFoam/Make/options
+9
-0
No files found.
Too many changes to show.
To preserve performance only
798 of 798+
files are displayed.
Plain diff
Email patch
applications/solvers/electromagnetics/electromagneticsSolversDoc.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
\defgroup grpElectroMagneticsSolvers Electro-magnetics solvers
@{
\ingroup grpSolvers
This group contains electro-magnetics solvers.
@}
\*---------------------------------------------------------------------------*/
applications/solvers/electromagnetics/electrostaticFoam/Make/files
0 → 100644
View file @
ea17556c
electrostaticFoam.C
EXE = $(FOAM_APPBIN)/electrostaticFoam
applications/solvers/electromagnetics/electrostaticFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
applications/solvers/electromagnetics/electrostaticFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading physicalProperties
\n
"
<<
endl
;
IOdictionary
physicalProperties
(
IOobject
(
"physicalProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
epsilon0
(
"epsilon0"
,
dimensionSet
(
-
1
,
-
3
,
4
,
0
,
0
,
2
,
0
),
physicalProperties
);
dimensionedScalar
k
(
"k"
,
dimensionSet
(
-
1
,
0
,
2
,
0
,
0
,
1
,
0
),
physicalProperties
);
Info
<<
"Reading field phi
\n
"
<<
endl
;
volScalarField
phi
(
IOobject
(
"phi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading field rho
\n
"
<<
endl
;
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Calculating field rhoFlux
\n
"
<<
endl
;
surfaceScalarField
rhoFlux
(
IOobject
(
"rhoFlux"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
-
k
*
mesh
.
magSf
()
*
fvc
::
snGrad
(
phi
)
);
applications/solvers/electromagnetics/electrostaticFoam/electrostaticFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Application
electrostaticFoam
Group
grpElectroMagneticsSolvers
Description
Solver for electrostatics.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for electrostatics."
);
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting iteration loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Iteration = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
solve
(
fvm
::
laplacian
(
phi
)
+
rho
/
epsilon0
);
rhoFlux
=
-
k
*
mesh
.
magSf
()
*
fvc
::
snGrad
(
phi
);
solve
(
fvm
::
ddt
(
rho
)
+
fvm
::
div
(
rhoFlux
,
rho
)
);
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/electromagnetics/magneticFoam/Make/files
0 → 100644
View file @
ea17556c
magneticFoam.C
EXE = $(FOAM_APPBIN)/magneticFoam
applications/solvers/electromagnetics/magneticFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
applications/solvers/electromagnetics/magneticFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading field psi
\n
"
<<
endl
;
volScalarField
psi
(
IOobject
(
"psi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading transportProperties
\n
"
<<
endl
;
IOdictionary
transportProperties
(
IOobject
(
"transportProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
List
<
magnet
>
magnets
(
transportProperties
.
lookup
(
"magnets"
));
surfaceScalarField
murf
(
IOobject
(
"murf"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
"one"
,
dimless
,
1
.
0
)
);
surfaceScalarField
Mrf
(
IOobject
(
"Mrf"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
dimensionSet
(
0
,
1
,
0
,
0
,
0
,
1
,
0
),
Zero
)
);
Mrf
.
setOriented
(
true
);
forAll
(
magnets
,
i
)
{
label
magnetZonei
=
mesh
.
faceZones
().
findZoneID
(
magnets
[
i
].
name
());
if
(
magnetZonei
==
-
1
)
{
FatalIOErrorInFunction
(
transportProperties
)
<<
"Cannot find faceZone for magnet "
<<
magnets
[
i
].
name
()
<<
exit
(
FatalIOError
);
}
const
labelList
&
faces
=
mesh
.
faceZones
()[
magnetZonei
];
const
scalar
muri
=
magnets
[
i
].
mur
();
const
scalar
Mri
=
magnets
[
i
].
Mr
().
value
();
const
vector
&
orientationi
=
magnets
[
i
].
orientation
();
const
surfaceVectorField
&
Sf
=
mesh
.
Sf
();
for
(
const
label
facei
:
faces
)
{
murf
[
facei
]
=
muri
;
Mrf
[
facei
]
=
Mri
*
(
orientationi
&
Sf
[
facei
]);
}
}
applications/solvers/electromagnetics/magneticFoam/magnet.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::magnet
Description
Class to hold the defining data for a permanent magnet, in particular
the name, relative permeability and remanence.
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef magnet_H
#define magnet_H
#include "dimensionedVector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward Declarations
class
magnet
;
Istream
&
operator
>>
(
Istream
&
,
magnet
&
);
Ostream
&
operator
<<
(
Ostream
&
,
const
magnet
&
);
/*---------------------------------------------------------------------------*\
Class magnet Declaration
\*---------------------------------------------------------------------------*/
class
magnet
{
// Private data
word
name_
;
scalar
relativePermeability_
;
dimensionedScalar
remanence_
;
vector
orientation_
;
public:
// Constructors
//- Null constructor for lists
inline
magnet
()
:
remanence_
(
"Mr"
,
dimensionSet
(
0
,
-
1
,
0
,
0
,
0
,
1
,
0
),
0
),
orientation_
(
Zero
)
{}
//- Construct from components
inline
magnet
(
const
word
&
name
,
const
scalar
mur
,
const
scalar
Mr
,
const
vector
&
orientation
)
:
name_
(
name
),
relativePermeability_
(
mur
),
remanence_
(
"Mr"
,
dimensionSet
(
0
,
-
1
,
0
,
0
,
0
,
1
,
0
),
Mr
),
orientation_
(
orientation
)
{}
//- Construct from Istream
inline
magnet
(
Istream
&
is
)
:
remanence_
(
"Mr"
,
dimensionSet
(
0
,
-
1
,
0
,
0
,
0
,
1
,
0
),
0
),
orientation_
(
Zero
)
{
is
>>
*
this
;
}
// Member Functions
//- Return name
inline
const
word
&
name
()
const
{
return
name_
;
}
//- Return relative permeability
inline
scalar
mur
()
const
{
return
relativePermeability_
;
}
//- Return remenance
inline
const
dimensionedScalar
&
Mr
()
const
{
return
remanence_
;
}
//- Return orientation
inline
const
vector
&
orientation
()
const
{
return
orientation_
;
}
// IOstream operators
inline
friend
Istream
&
operator
>>
(
Istream
&
is
,
magnet
&
m
)
{
is
.
readBegin
(
"magnet"
);
is
>>
m
.
name_
>>
m
.
relativePermeability_
>>
m
.
remanence_
.
value
()
>>
m
.
orientation_
;
is
.
readEnd
(
"magnet"
);
is
.
check
(
FUNCTION_NAME
);
return
is
;
}
inline
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
magnet
&
m
)
{
os
<<
token
::
BEGIN_LIST
<<
m
.
name_
<<
token
::
SPACE
<<
m
.
relativePermeability_
<<
token
::
SPACE
<<
m
.
remanence_
.
value
()
<<
m
.
orientation_
<<
token
::
END_LIST
;
return
os
;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
applications/solvers/electromagnetics/magneticFoam/magneticFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Application
magneticFoam
Group
grpElectroMagneticsSolvers
Description
Solver for the magnetic field generated by permanent magnets.
A Poisson's equation for the magnetic scalar potential psi is solved
from which the magnetic field intensity H and magnetic flux density B
are obtained. The paramagnetic particle force field (H dot grad(H))
is optionally available.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "OSspecific.H"
#include "magnet.H"
#include "electromagneticConstants.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for the magnetic field generated by permanent magnets."
);
argList
::
addBoolOption
(
"noH"
,
"Do not write the magnetic field intensity field"
);
argList
::
addBoolOption
(
"noB"
,
"Do not write the magnetic flux density field"
);
argList
::
addBoolOption
(
"HdotGradH"
,
"Write the paramagnetic particle force field"
);
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
simpleControl
simple
(
mesh
);
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"Calculating the magnetic field potential"
<<
endl
;
++
runTime
;
while
(
simple
.
correctNonOrthogonal
())
{
solve
(
fvm
::
laplacian
(
murf
,
psi
)
+
fvc
::
div
(
murf
*
Mrf
));
}
psi
.
write
();
if
(
!
args
.
found
(
"noH"
)
||
args
.
found
(
"HdotGradH"
))
{
volVectorField
H
(
IOobject
(
"H"
,
runTime
.
timeName
(),
mesh
),
fvc
::
reconstruct
(
fvc
::
snGrad
(
psi
)
*
mesh
.
magSf
())
);
if
(
!
args
.
found
(
"noH"
))
{
Info
<<
nl
<<
"Creating field H for time "
<<
runTime
.
timeName
()
<<
endl
;
H
.
write
();
}
if
(
args
.
found
(
"HdotGradH"
))
{
Info
<<
nl
<<
"Creating field HdotGradH for time "
<<
runTime
.
timeName
()
<<
endl
;
volVectorField
HdotGradH
(
IOobject
(
"HdotGradH"
,
runTime
.
timeName
(),
mesh
),
H
&
fvc
::
grad
(
H
)
);
HdotGradH
.
write
();
}
}
if
(
!
args
.
found
(
"noB"
))
{
Info
<<
nl
<<
"Creating field B for time "
<<
runTime
.
timeName
()
<<
endl
;
volVectorField
B
(
IOobject
(
"B"
,
runTime
.
timeName
(),
mesh
),
constant
::
electromagnetic
::
mu0
*
fvc
::
reconstruct
(
murf
*
fvc
::
snGrad
(
psi
)
*
mesh
.
magSf
()
+
murf
*
Mrf
)
);
B
.
write
();
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/electromagnetics/mhdFoam/Make/files
0 → 100644
View file @
ea17556c
mhdFoam.C
EXE = $(FOAM_APPBIN)/mhdFoam
applications/solvers/electromagnetics/mhdFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
applications/solvers/electromagnetics/mhdFoam/createControl.H
0 → 100644
View file @
ea17556c
pisoControl
piso
(
mesh
);
pisoControl
bpiso
(
mesh
,
"BPISO"
);
applications/solvers/electromagnetics/mhdFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading transportProperties
\n
"
<<
endl
;
IOdictionary
transportProperties
(
IOobject
(
"transportProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
rho
(
"rho"
,
dimDensity
,
transportProperties
);
dimensionedScalar
nu
(
"nu"
,
dimViscosity
,
transportProperties
);
dimensionedScalar
mu
(
"mu"
,
dimensionSet
(
1
,
1
,
-
2
,
0
,
0
,
-
2
,
0
),
transportProperties
);
dimensionedScalar
sigma
(
"sigma"
,
dimensionSet
(
-
1
,
-
3
,
3
,
0
,
0
,
2
,
0
),
transportProperties
);
Info
<<
"Reading field p
\n
"
<<
endl
;
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "createPhi.H"
Info
<<
"Reading field pB
\n
"
<<
endl
;
volScalarField
pB
(
IOobject
(
"pB"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading field B
\n
"
<<
endl
;
volVectorField
B
(
IOobject
(
"B"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "createPhiB.H"
dimensionedScalar
DB
=
1
.
0
/
(
mu
*
sigma
);
DB
.
name
()
=
"DB"
;
dimensionedScalar
DBU
=
1
.
0
/
(
2
.
0
*
mu
*
rho
);
DBU
.
name
()
=
"DBU"
;
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
piso
.
dict
(),
pRefCell
,
pRefValue
);
mesh
.
setFluxRequired
(
p
.
name
());
mesh
.
setFluxRequired
(
pB
.
name
());
applications/solvers/electromagnetics/mhdFoam/createPhiB.H
0 → 100644
View file @
ea17556c
IOobject
phiBHeader
(
"phiB"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
);
surfaceScalarField
*
phiBPtr
=
nullptr
;
if
(
phiBHeader
.
typeHeaderOk
<
surfaceScalarField
>
(
true
))
{
Info
<<
"Reading face flux "
;
phiBPtr
=
new
surfaceScalarField
(
IOobject
(
"phiB"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
}
else
{
Info
<<
"Calculating face flux "
;
phiBPtr
=
new
surfaceScalarField
(
IOobject
(
"phiB"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
fvc
::
flux
(
B
)
);
}
surfaceScalarField
&
phiB
=
*
phiBPtr
;
Info
<<
phiB
.
name
()
<<
nl
<<
endl
;
applications/solvers/electromagnetics/mhdFoam/magneticFieldErr.H
0 → 100644
View file @
ea17556c
Info
<<
"magnetic flux divergence error = "
<<
runTime
.
deltaTValue
()
*
mag
(
fvc
::
div
(
phiB
))().
weightedAverage
(
mesh
.
V
()).
value
()
<<
endl
;
applications/solvers/electromagnetics/mhdFoam/mhdFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
Application
mhdFoam
Group
grpElectroMagneticsSolvers
Description
Solver for magnetohydrodynamics (MHD): incompressible, laminar flow of a
conducting fluid under the influence of a magnetic field.
An applied magnetic field H acts as a driving force,
at present boundary conditions cannot be set via the
electric field E or current density J. The fluid viscosity nu,
conductivity sigma and permeability mu are read in as uniform
constants.
A fictitous magnetic flux pressure pH is introduced in order to
compensate for discretisation errors and create a magnetic face flux
field which is divergence free as required by Maxwell's equations.
However, in this formulation discretisation error prevents the normal
stresses in UB from cancelling with those from BU, but it is unknown
whether this is a serious error. A correction could be introduced
whereby the normal stresses in the discretised BU term are replaced
by those from the UB term, but this would violate the boundedness
constraint presently observed in the present numerics which
guarantees div(U) and div(H) are zero.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for magnetohydrodynamics (MHD):"
" incompressible, laminar flow of a conducting fluid"
" under the influence of a magnetic field."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
nl
<<
"Starting time loop"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
#include "CourantNo.H"
{
fvVectorMatrix
UEqn
(
fvm
::
ddt
(
U
)
+
fvm
::
div
(
phi
,
U
)
-
fvc
::
div
(
phiB
,
2
.
0
*
DBU
*
B
)
-
fvm
::
laplacian
(
nu
,
U
)
+
fvc
::
grad
(
DBU
*
magSqr
(
B
))
);
if
(
piso
.
momentumPredictor
())
{
solve
(
UEqn
==
-
fvc
::
grad
(
p
));
}
// --- PISO loop
while
(
piso
.
correct
())
{
volScalarField
rAU
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rAUf
(
"rAUf"
,
fvc
::
interpolate
(
rAU
));
volVectorField
HbyA
(
constrainHbyA
(
rAU
*
UEqn
.
H
(),
U
,
p
));
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
rAUf
*
fvc
::
ddtCorr
(
U
,
phi
)
);
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p
,
U
,
phiHbyA
,
rAUf
);
while
(
piso
.
correctNonOrthogonal
())
{
fvScalarMatrix
pEqn
(
fvm
::
laplacian
(
rAUf
,
p
)
==
fvc
::
div
(
phiHbyA
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
pEqn
.
solve
(
mesh
.
solver
(
p
.
select
(
piso
.
finalInnerIter
())));
if
(
piso
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
pEqn
.
flux
();
}
}
#include "continuityErrs.H"
U
=
HbyA
-
rAU
*
fvc
::
grad
(
p
);
U
.
correctBoundaryConditions
();
}
}
// --- B-PISO loop
while
(
bpiso
.
correct
())
{
fvVectorMatrix
BEqn
(
fvm
::
ddt
(
B
)
+
fvm
::
div
(
phi
,
B
)
-
fvc
::
div
(
phiB
,
U
)
-
fvm
::
laplacian
(
DB
,
B
)
);
BEqn
.
solve
();
volScalarField
rAB
(
1
.
0
/
BEqn
.
A
());
surfaceScalarField
rABf
(
"rABf"
,
fvc
::
interpolate
(
rAB
));
phiB
=
fvc
::
flux
(
B
);
while
(
bpiso
.
correctNonOrthogonal
())
{
fvScalarMatrix
pBEqn
(
fvm
::
laplacian
(
rABf
,
pB
)
==
fvc
::
div
(
phiB
)
);
pBEqn
.
solve
(
mesh
.
solver
(
pB
.
select
(
bpiso
.
finalInnerIter
())));
if
(
bpiso
.
finalNonOrthogonalIter
())
{
phiB
-=
pBEqn
.
flux
();
}
}
#include "magneticFieldErr.H"
}
runTime
.
write
();
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H
0 → 100644
View file @
ea17556c
const
dictionary
&
Bpiso
=
mesh
.
solutionDict
().
subDict
(
"BPISO"
);
const
int
nBcorr
=
Bpiso
.
getOrDefault
<
int
>
(
"nCorrectors"
,
1
);
applications/solvers/financial/financialFoam/Make/files
0 → 100644
View file @
ea17556c
financialFoam.C
EXE = $(FOAM_APPBIN)/financialFoam
applications/solvers/financial/financialFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lsampling
Prev
1
…
12
13
14
15
16
17
18
19
20
…
40
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment