https://mooseframework.inl.gov
Loading...
Searching...
No Matches
phase_field
src
postprocessors
ObtainAvgContactAngle.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://www.mooseframework.inl.gov
3
//*
4
//* All rights reserved, see COPYRIGHT for full restrictions
5
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6
//*
7
//* Licensed under LGPL 2.1, please see LICENSE for details
8
//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10
#include "
ObtainAvgContactAngle.h
"
11
12
#include "libmesh/quadrature.h"
13
14
registerMooseObject
(
"PhaseFieldApp"
,
ObtainAvgContactAngle
);
15
16
InputParameters
17
ObtainAvgContactAngle::validParams
()
18
{
19
InputParameters
params =
SidePostprocessor::validParams
();
20
params.
addClassDescription
(
"Obtain contact angle"
);
21
params.
addRequiredCoupledVar
(
"pf"
,
"phase field variable"
);
22
return
params;
23
}
24
25
ObtainAvgContactAngle::ObtainAvgContactAngle
(
const
InputParameters
& parameters)
26
:
SidePostprocessor
(parameters), _pf(coupledValue(
"pf"
)), _grad_pf(coupledGradient(
"pf"
))
27
{
28
}
29
30
void
31
ObtainAvgContactAngle::initialize
()
32
{
33
_cos_theta_val
= 0.0;
34
_total_weight
= 0.0;
35
}
36
37
void
38
ObtainAvgContactAngle::execute
()
39
{
40
41
for
(
unsigned
int
qp = 0; qp <
_qrule
->n_points(); qp++)
42
{
43
if
(std::abs(
_pf
[qp]) < 0.5)
// Operating only within the interface
44
{
45
// Real tol_val = libMesh::TOLERANCE * libMesh::TOLERANCE;
46
const
Real weight =
_grad_pf
[qp].norm();
47
_cos_theta_val
+=
48
_grad_pf
[qp] *
_normals
[qp];
// weight * (_grad_pf[qp]/_grad_pf[qp].norm()) * _normals[qp]
49
_total_weight
+= weight;
50
}
51
}
52
}
53
54
Real
55
ObtainAvgContactAngle::getValue
()
const
56
{
57
return
_contact_angle
;
58
}
59
60
void
61
ObtainAvgContactAngle::threadJoin
(
const
UserObject
&
y
)
62
{
63
const
ObtainAvgContactAngle
& pps =
static_cast<
const
ObtainAvgContactAngle
&
>
(
y
);
64
_cos_theta_val
+= pps.
_cos_theta_val
;
65
_total_weight
+= pps.
_total_weight
;
66
}
67
68
void
69
ObtainAvgContactAngle::finalize
()
70
{
71
gatherSum
(
_cos_theta_val
);
72
gatherSum
(
_total_weight
);
73
_contact_angle
= std::acos(
_cos_theta_val
/
_total_weight
) * 180 /
libMesh::pi
;
74
}
y
const std::vector< double > y
Definition
EquilibriumConstantFitTest.C:18
registerMooseObject
registerMooseObject("PhaseFieldApp", ObtainAvgContactAngle)
ObtainAvgContactAngle.h
InputParameters::addRequiredCoupledVar
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
ObtainAvgContactAngle
This postprocessor computes displacements normal to a provided set of boundaries.
Definition
ObtainAvgContactAngle.h:19
ObtainAvgContactAngle::execute
virtual void execute() override
Definition
ObtainAvgContactAngle.C:38
ObtainAvgContactAngle::_total_weight
Real _total_weight
total weight
Definition
ObtainAvgContactAngle.h:46
ObtainAvgContactAngle::initialize
virtual void initialize() override
Definition
ObtainAvgContactAngle.C:31
ObtainAvgContactAngle::finalize
virtual void finalize() override
Definition
ObtainAvgContactAngle.C:69
ObtainAvgContactAngle::_pf
const VariableValue & _pf
Gradient of coupled variable.
Definition
ObtainAvgContactAngle.h:34
ObtainAvgContactAngle::_grad_pf
const VariableGradient & _grad_pf
Gradient of coupled variable.
Definition
ObtainAvgContactAngle.h:37
ObtainAvgContactAngle::_contact_angle
Real _contact_angle
Average contact angle.
Definition
ObtainAvgContactAngle.h:40
ObtainAvgContactAngle::_cos_theta_val
Real _cos_theta_val
cos theta value
Definition
ObtainAvgContactAngle.h:43
ObtainAvgContactAngle::getValue
virtual Real getValue() const override
Definition
ObtainAvgContactAngle.C:55
ObtainAvgContactAngle::validParams
static InputParameters validParams()
Definition
ObtainAvgContactAngle.C:17
ObtainAvgContactAngle::threadJoin
virtual void threadJoin(const UserObject &y) override
Definition
ObtainAvgContactAngle.C:61
ObtainAvgContactAngle::ObtainAvgContactAngle
ObtainAvgContactAngle(const InputParameters ¶meters)
Definition
ObtainAvgContactAngle.C:25
SidePostprocessor
SidePostprocessor::validParams
static InputParameters validParams()
SidePostprocessor::_qrule
const QBase *const & _qrule
SidePostprocessor::_normals
const MooseArray< Point > & _normals
SidePostprocessor::gatherSum
void gatherSum(T &value)
UserObject
libMesh::pi
const Real pi
InputParameters
Generated on Fri Aug 21 2026 13:41:26 for https://mooseframework.inl.gov by
1.9.8