v0.15.0
Loading...
Searching...
No Matches
free_surface.cpp File Reference
#include <MoFEM.hpp>
#include <petsc/private/petscimpl.h>
#include <FreeSurfaceOps.hpp>

Go to the source code of this file.

Classes

struct  TSPrePostProc
 Set of functions called by PETSc solver used to refine and update mesh. More...
 
struct  FreeSurface
 
struct  Monitor
 [Push operators to pipeline] More...
 

Typedefs

template<int DIM>
using ElementsAndOps = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>
 
using DomainEle = ElementsAndOps<SPACE_DIM>::DomainEle
 
using DomianParentEle = ElementsAndOps<SPACE_DIM>::DomianParentEle
 
using BoundaryEle = ElementsAndOps<SPACE_DIM>::BoundaryEle
 
using BoundaryParentEle = ElementsAndOps<SPACE_DIM>::BoundaryParentEle
 
using SideEle = ElementsAndOps<SPACE_DIM>::FaceSideEle
 
using SideOp = SideEle::UserDataOperator
 
using PostProcEleDomain = PostProcBrokenMeshInMoab<DomainEle>
 
using PostProcEleDomainCont = PostProcBrokenMeshInMoabBaseCont<DomainEle>
 
using PostProcEleBdyCont = PostProcBrokenMeshInMoabBaseCont<BoundaryEle>
 
using AssemblyDomainEleOp = FormsIntegrators<DomainEleOp>::Assembly<A>::OpBase
 
using AssemblyBoundaryEleOp
 
using OpDomainMassU
 
using OpDomainMassH
 
using OpDomainMassP = OpDomainMassH
 
using OpDomainMassG = OpDomainMassH
 
using OpBoundaryMassL
 
using OpDomainAssembleVector
 
using OpDomainAssembleScalar
 
using OpBoundaryAssembleScalar
 
template<CoordinateTypes COORD_TYPE>
using OpMixScalarTimesDiv
 
using BoundaryNaturalBC = NaturalBC<BoundaryEleOp>::Assembly<A>::LinearForm<I>
 
using OpFluidFlux
 

Enumerations

enum  FR { F , R }
 

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 
int coord_type = EXECUTABLE_COORD_TYPE
 
constexpr int BASE_DIM = 1
 
constexpr int SPACE_DIM = 2
 
constexpr int U_FIELD_DIM = SPACE_DIM
 
constexpr AssemblyType A = AssemblyType::PETSC
 
constexpr IntegrationType I
 
FTensor::Index< 'i', SPACE_DIMi
 
FTensor::Index< 'j', SPACE_DIMj
 
FTensor::Index< 'k', SPACE_DIMk
 
FTensor::Index< 'l', SPACE_DIMl
 
constexpr auto t_kd = FTensor::Kronecker_Delta_symmetric<int>()
 
int order = 3
 approximation order
 
int nb_levels = 4
 
int refine_overlap = 4
 
constexpr bool debug = true
 
auto get_start_bit
 
auto get_current_bit
 dofs bit used to do calculations
 
auto get_skin_parent_bit = []() { return 2 * get_start_bit() + 2; }
 
auto get_skin_child_bit = []() { return 2 * get_start_bit() + 3; }
 
auto get_projection_bit = []() { return 2 * get_start_bit() + 4; }
 
auto get_skin_projection_bit = []() { return 2 * get_start_bit() + 5; }
 
double a0 = 980
 
double rho_m = 0.998
 
double mu_m = 0.010101 * 1e2
 
double rho_p = 0.0012
 
double mu_p = 0.000182 * 1e2
 
double lambda = 73
 surface tension
 
double W = 0.25
 
double h = 0.03
 
double eta = h
 
double eta2 = eta * eta
 
double md = 1e-2
 
double eps = 1e-12
 
double tol = std::numeric_limits<float>::epsilon()
 
double rho_ave = (rho_p + rho_m) / 2
 
double rho_diff = (rho_p - rho_m) / 2
 
double mu_ave = (mu_p + mu_m) / 2
 
double mu_diff = (mu_p - mu_m) / 2
 
double kappa = (3. / (4. * std::sqrt(2. * W))) * (lambda / eta)
 
auto integration_rule = [](int, int, int) { return 2 * order + 1; }
 
auto cylindrical
 
auto wetting_angle_sub_stepping
 
auto my_max = [](const double x) { return (x - 1 + std::abs(x + 1)) / 2; }
 
auto my_min = [](const double x) { return (x + 1 - std::abs(x - 1)) / 2; }
 
auto cut_off = [](const double h) { return my_max(my_min(h)); }
 
auto d_cut_off
 
auto phase_function
 
auto d_phase_function_h
 
auto get_f = [](const double h) { return 4 * W * h * (h * h - 1); }
 
auto get_f_dh = [](const double h) { return 4 * W * (3 * h * h - 1); }
 
auto get_M0 = [](auto h) { return md; }
 
auto get_M0_dh = [](auto h) { return 0; }
 
auto get_M2
 
auto get_M2_dh = [](auto h) { return -md * 2 * h; }
 
auto get_M3
 
auto get_M3_dh
 
auto get_M = [](auto h) { return get_M0(h); }
 
auto get_M_dh = [](auto h) { return get_M0_dh(h); }
 
auto get_D
 
auto kernel_oscillation
 
auto kernel_eye
 
auto capillary_tube
 
auto bubble_device
 
auto init_h
 Initialisation function.
 
auto wetting_angle = [](double water_level) { return water_level; }
 
auto bit = [](auto b) { return BitRefLevel().set(b); }
 
auto marker = [](auto b) { return BitRefLevel().set(BITREFLEVEL_SIZE - b); }
 
auto get_fe_bit
 
auto get_global_size
 
auto save_range
 
auto get_dofs_ents_by_field_name
 get entities of dofs in the problem - used for debugging
 
auto get_dofs_ents_all
 get entities of dofs in the problem - used for debugging
 
static boost::weak_ptr< TSPrePostProctsPrePostProc
 

Typedef Documentation

◆ AssemblyBoundaryEleOp

◆ AssemblyDomainEleOp

Definition at line 105 of file free_surface.cpp.

◆ BoundaryEle

◆ BoundaryNaturalBC

Definition at line 130 of file free_surface.cpp.

◆ BoundaryParentEle

◆ DomainEle

Definition at line 90 of file free_surface.cpp.

◆ DomianParentEle

◆ ElementsAndOps

template<int DIM>
using ElementsAndOps = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>

Definition at line 88 of file free_surface.cpp.

◆ OpBoundaryAssembleScalar

◆ OpBoundaryMassL

◆ OpDomainAssembleScalar

◆ OpDomainAssembleVector

◆ OpDomainMassG

Examples
free_surface.cpp.

Definition at line 114 of file free_surface.cpp.

◆ OpDomainMassH

◆ OpDomainMassP

Examples
free_surface.cpp.

Definition at line 113 of file free_surface.cpp.

◆ OpDomainMassU

◆ OpFluidFlux

◆ OpMixScalarTimesDiv

template<CoordinateTypes COORD_TYPE>
using OpMixScalarTimesDiv

◆ PostProcEleBdyCont

◆ PostProcEleDomain

◆ PostProcEleDomainCont

◆ SideEle

Definition at line 96 of file free_surface.cpp.

◆ SideOp

Definition at line 97 of file free_surface.cpp.

Enumeration Type Documentation

◆ FR

enum FR
Enumerator

Definition at line 396 of file free_surface.cpp.

396{ F, R }; // F - forward, and reverse
@ R
@ F

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

[Register MoFEM discrete manager in PETSc]

[Register MoFEM discrete manager in PETSc

[Create MoAB]

< mesh database

< mesh database interface

[Create MoAB]

[Create MoFEM]

< finite element database

< finite element database interface

[Create MoFEM]

[FreeSurface]

[FreeSurface]

Definition at line 2403 of file free_surface.cpp.

2403 {
2404
2405#ifdef PYTHON_INIT_SURFACE
2406 Py_Initialize();
2407#endif
2408
2409 // Initialisation of MoFEM/PETSc and MOAB data structures
2410 const char param_file[] = "param_file.petsc";
2411 MoFEM::Core::Initialize(&argc, &argv, param_file, help);
2412
2413 // Add logging channel for example
2414 auto core_log = logging::core::get();
2415 core_log->add_sink(LogManager::createSink(LogManager::getStrmWorld(), "FS"));
2416 LogManager::setLog("FS");
2417 MOFEM_LOG_TAG("FS", "free surface");
2418
2419 try {
2420
2421 //! [Register MoFEM discrete manager in PETSc]
2422 DMType dm_name = "DMMOFEM";
2423 CHKERR DMRegister_MoFEM(dm_name);
2424 //! [Register MoFEM discrete manager in PETSc
2425
2426 //! [Create MoAB]
2427 moab::Core mb_instance; ///< mesh database
2428 moab::Interface &moab = mb_instance; ///< mesh database interface
2429 //! [Create MoAB]
2430
2431 //! [Create MoFEM]
2432 MoFEM::Core core(moab); ///< finite element database
2433 MoFEM::Interface &m_field = core; ///< finite element database interface
2434 //! [Create MoFEM]
2435
2436 //! [FreeSurface]
2437 FreeSurface ex(m_field);
2438 CHKERR ex.runProblem();
2439 //! [FreeSurface]
2440 }
2442
2444
2445#ifdef PYTHON_INIT_SURFACE
2446 if (Py_FinalizeEx() < 0) {
2447 exit(120);
2448 }
2449#endif
2450}
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
static char help[]
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Core (interface) class.
Definition Core.hpp:82
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:72
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:118
Deprecated interface functions.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.

Variable Documentation

◆ A

AssemblyType A = AssemblyType::PETSC
constexpr

Definition at line 83 of file free_surface.cpp.

◆ a0

double a0 = 980
Examples
free_surface.cpp.

Definition at line 162 of file free_surface.cpp.

◆ BASE_DIM

int BASE_DIM = 1
constexpr

Definition at line 79 of file free_surface.cpp.

◆ bit

auto bit = [](auto b) { return BitRefLevel().set(b); }
Examples
free_surface.cpp.

Definition at line 314 of file free_surface.cpp.

314{ return BitRefLevel().set(b); };
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40

◆ bubble_device

auto bubble_device
Initial value:
= [](double x, double y, double z) {
return -tanh((-0.039 - x) / (eta * std::sqrt(2)));
}
double eta
Examples
free_surface.cpp.

Definition at line 286 of file free_surface.cpp.

286 {
287 return -tanh((-0.039 - x) / (eta * std::sqrt(2)));
288};

◆ capillary_tube

auto capillary_tube
Initial value:
= [](double x, double y, double z) {
constexpr double water_height = 0.;
return tanh((water_height - y) / (eta * std::sqrt(2)));
;
}
Examples
free_surface.cpp.

Definition at line 280 of file free_surface.cpp.

280 {
281 constexpr double water_height = 0.;
282 return tanh((water_height - y) / (eta * std::sqrt(2)));
283 ;
284};

◆ coord_type

int coord_type = EXECUTABLE_COORD_TYPE
Examples
free_surface.cpp.

Definition at line 77 of file free_surface.cpp.

◆ cut_off

auto cut_off = [](const double h) { return my_max(my_min(h)); }
Examples
free_surface.cpp.

Definition at line 205 of file free_surface.cpp.

205{ return my_max(my_min(h)); };
double h
auto my_max
auto my_min

◆ cylindrical

auto cylindrical
Initial value:
= [](const double r) {
return 2 * M_PI * r;
else
return 1.;
}
@ CYLINDRICAL
int coord_type
Examples
free_surface.cpp.

Definition at line 189 of file free_surface.cpp.

189 {
190 if (coord_type == CYLINDRICAL)
191 return 2 * M_PI * r;
192 else
193 return 1.;
194};
int r
Definition sdf.py:8

◆ d_cut_off

auto d_cut_off
Initial value:
= [](const double h) {
if (h >= -1 && h < 1)
return 1.;
else
return 0.;
}
Examples
free_surface.cpp.

Definition at line 206 of file free_surface.cpp.

206 {
207 if (h >= -1 && h < 1)
208 return 1.;
209 else
210 return 0.;
211};

◆ d_phase_function_h

auto d_phase_function_h
Initial value:
= [](const double h, const double diff) {
return diff;
}
Examples
free_surface.cpp.

Definition at line 217 of file free_surface.cpp.

217 {
218 return diff;
219};

◆ debug

bool debug = true
constexpr

Definition at line 146 of file free_surface.cpp.

◆ eps

double eps = 1e-12
Examples
free_surface.cpp.

Definition at line 177 of file free_surface.cpp.

◆ eta

double eta = h
Examples
free_surface.cpp, and plot_base.cpp.

Definition at line 172 of file free_surface.cpp.

◆ eta2

double eta2 = eta * eta
Examples
free_surface.cpp.

Definition at line 173 of file free_surface.cpp.

◆ get_current_bit

auto get_current_bit
Initial value:
= []() {
return 2 * get_start_bit() + 1;
}
auto get_start_bit

dofs bit used to do calculations

Examples
free_surface.cpp.

Definition at line 151 of file free_surface.cpp.

151 {
152 return 2 * get_start_bit() + 1;
153}; ///< dofs bit used to do calculations

◆ get_D

auto get_D
Initial value:
= [](const double A) {
t_D(i, j, k, l) = A * ((t_kd(i, k) ^ t_kd(j, l)) / 4.);
return t_D;
}
FTensor::Index< 'j', SPACE_DIM > j
FTensor::Index< 'k', SPACE_DIM > k
FTensor::Index< 'i', SPACE_DIM > i
constexpr auto t_kd
FTensor::Index< 'l', SPACE_DIM > l
constexpr AssemblyType A
Examples
free_surface.cpp.

Definition at line 254 of file free_surface.cpp.

254 {
256 t_D(i, j, k, l) = A * ((t_kd(i, k) ^ t_kd(j, l)) / 4.);
257 return t_D;
258};

◆ get_dofs_ents_all

auto get_dofs_ents_all
Initial value:
= [](auto dm) {
auto prb_ptr = getProblemPtr(dm);
std::vector<EntityHandle> ents_vec;
MoFEM::Interface *m_field_ptr;
CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
auto dofs = prb_ptr->numeredRowDofsPtr;
ents_vec.reserve(dofs->size());
for (auto d : *dofs) {
ents_vec.push_back(d->getEnt());
}
std::sort(ents_vec.begin(), ents_vec.end());
auto it = std::unique(ents_vec.begin(), ents_vec.end());
Range r;
r.insert_list(ents_vec.begin(), it);
return r;
}
PetscErrorCode DMoFEMGetInterfacePtr(DM dm, MoFEM::Interface **m_field_ptr)
Get pointer to MoFEM::Interface.
Definition DMMoFEM.cpp:410
auto getProblemPtr(DM dm)
get problem pointer from DM
Definition DMMoFEM.hpp:1047

get entities of dofs in the problem - used for debugging

Examples
free_surface.cpp.

Definition at line 370 of file free_surface.cpp.

370 {
371 auto prb_ptr = getProblemPtr(dm);
372 std::vector<EntityHandle> ents_vec;
373
374 MoFEM::Interface *m_field_ptr;
375 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
376
377 auto dofs = prb_ptr->numeredRowDofsPtr;
378 ents_vec.reserve(dofs->size());
379
380 for (auto d : *dofs) {
381 ents_vec.push_back(d->getEnt());
382 }
383
384 std::sort(ents_vec.begin(), ents_vec.end());
385 auto it = std::unique(ents_vec.begin(), ents_vec.end());
386 Range r;
387 r.insert_list(ents_vec.begin(), it);
388 return r;
389};

◆ get_dofs_ents_by_field_name

auto get_dofs_ents_by_field_name
Initial value:
= [](auto dm, auto field_name) {
auto prb_ptr = getProblemPtr(dm);
std::vector<EntityHandle> ents_vec;
MoFEM::Interface *m_field_ptr;
CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
auto bit_number = m_field_ptr->get_field_bit_number(field_name);
auto dofs = prb_ptr->numeredRowDofsPtr;
auto lo_it = dofs->lower_bound(FieldEntity::getLoBitNumberUId(bit_number));
auto hi_it = dofs->upper_bound(FieldEntity::getHiBitNumberUId(bit_number));
ents_vec.reserve(std::distance(lo_it, hi_it));
for (; lo_it != hi_it; ++lo_it) {
ents_vec.push_back((*lo_it)->getEnt());
}
std::sort(ents_vec.begin(), ents_vec.end());
auto it = std::unique(ents_vec.begin(), ents_vec.end());
Range r;
r.insert_list(ents_vec.begin(), it);
return r;
}
constexpr auto field_name
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
static UId getHiBitNumberUId(const FieldBitNumber bit_number)
static UId getLoBitNumberUId(const FieldBitNumber bit_number)

get entities of dofs in the problem - used for debugging

Examples
free_surface.cpp.

Definition at line 342 of file free_surface.cpp.

342 {
343 auto prb_ptr = getProblemPtr(dm);
344 std::vector<EntityHandle> ents_vec;
345
346 MoFEM::Interface *m_field_ptr;
347 CHKERR DMoFEMGetInterfacePtr(dm, &m_field_ptr);
348
349 auto bit_number = m_field_ptr->get_field_bit_number(field_name);
350 auto dofs = prb_ptr->numeredRowDofsPtr;
351 auto lo_it = dofs->lower_bound(FieldEntity::getLoBitNumberUId(bit_number));
352 auto hi_it = dofs->upper_bound(FieldEntity::getHiBitNumberUId(bit_number));
353 ents_vec.reserve(std::distance(lo_it, hi_it));
354
355 for (; lo_it != hi_it; ++lo_it) {
356 ents_vec.push_back((*lo_it)->getEnt());
357 }
358
359 std::sort(ents_vec.begin(), ents_vec.end());
360 auto it = std::unique(ents_vec.begin(), ents_vec.end());
361 Range r;
362 r.insert_list(ents_vec.begin(), it);
363 return r;
364};

◆ get_f

auto get_f = [](const double h) { return 4 * W * h * (h * h - 1); }
Examples
free_surface.cpp.

Definition at line 223 of file free_surface.cpp.

223{ return 4 * W * h * (h * h - 1); };
double W

◆ get_f_dh

auto get_f_dh = [](const double h) { return 4 * W * (3 * h * h - 1); }
Examples
free_surface.cpp.

Definition at line 224 of file free_surface.cpp.

224{ return 4 * W * (3 * h * h - 1); };

◆ get_fe_bit

auto get_fe_bit
Initial value:
= [](FEMethod *fe_ptr) {
return fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
}
structure for User Loop Methods on finite elements
Examples
free_surface.cpp.

Definition at line 316 of file free_surface.cpp.

316 {
317 return fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
318};

◆ get_global_size

auto get_global_size
Initial value:
= [](int l_size) {
int g_size;
MPI_Allreduce(&l_size, &g_size, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
return g_size;
}
Examples
free_surface.cpp.

Definition at line 320 of file free_surface.cpp.

320 {
321 int g_size;
322 MPI_Allreduce(&l_size, &g_size, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
323 return g_size;
324};

◆ get_M

auto get_M = [](auto h) { return get_M0(h); }
Examples
free_surface.cpp.

Definition at line 251 of file free_surface.cpp.

251{ return get_M0(h); };
auto get_M0

◆ get_M0

auto get_M0 = [](auto h) { return md; }
Examples
free_surface.cpp.

Definition at line 226 of file free_surface.cpp.

226{ return md; };
double md

◆ get_M0_dh

auto get_M0_dh = [](auto h) { return 0; }
Examples
free_surface.cpp.

Definition at line 227 of file free_surface.cpp.

227{ return 0; };

◆ get_M2

auto get_M2
Initial value:
= [](auto h) {
return md * (1 - h * h);
}
Examples
free_surface.cpp.

Definition at line 229 of file free_surface.cpp.

229 {
230 return md * (1 - h * h);
231};

◆ get_M2_dh

auto get_M2_dh = [](auto h) { return -md * 2 * h; }
Examples
free_surface.cpp.

Definition at line 233 of file free_surface.cpp.

233{ return -md * 2 * h; };

◆ get_M3

auto get_M3
Initial value:
= [](auto h) {
const double h2 = h * h;
const double h3 = h2 * h;
if (h >= 0)
return md * (2 * h3 - 3 * h2 + 1);
else
return md * (-2 * h3 - 3 * h2 + 1);
}
Examples
free_surface.cpp.

Definition at line 235 of file free_surface.cpp.

235 {
236 const double h2 = h * h;
237 const double h3 = h2 * h;
238 if (h >= 0)
239 return md * (2 * h3 - 3 * h2 + 1);
240 else
241 return md * (-2 * h3 - 3 * h2 + 1);
242};

◆ get_M3_dh

auto get_M3_dh
Initial value:
= [](auto h) {
if (h >= 0)
return md * (6 * h * (h - 1));
else
return md * (-6 * h * (h + 1));
}
Examples
free_surface.cpp.

Definition at line 244 of file free_surface.cpp.

244 {
245 if (h >= 0)
246 return md * (6 * h * (h - 1));
247 else
248 return md * (-6 * h * (h + 1));
249};

◆ get_M_dh

auto get_M_dh = [](auto h) { return get_M0_dh(h); }
Examples
free_surface.cpp.

Definition at line 252 of file free_surface.cpp.

252{ return get_M0_dh(h); };
auto get_M0_dh

◆ get_projection_bit

auto get_projection_bit = []() { return 2 * get_start_bit() + 4; }
Examples
free_surface.cpp.

Definition at line 156 of file free_surface.cpp.

156{ return 2 * get_start_bit() + 4; };

◆ get_skin_child_bit

auto get_skin_child_bit = []() { return 2 * get_start_bit() + 3; }
Examples
free_surface.cpp.

Definition at line 155 of file free_surface.cpp.

155{ return 2 * get_start_bit() + 3; };

◆ get_skin_parent_bit

auto get_skin_parent_bit = []() { return 2 * get_start_bit() + 2; }
Examples
free_surface.cpp.

Definition at line 154 of file free_surface.cpp.

154{ return 2 * get_start_bit() + 2; };

◆ get_skin_projection_bit

auto get_skin_projection_bit = []() { return 2 * get_start_bit() + 5; }
Examples
free_surface.cpp.

Definition at line 157 of file free_surface.cpp.

157{ return 2 * get_start_bit() + 5; };

◆ get_start_bit

auto get_start_bit
Initial value:
= []() {
return nb_levels + 1;
}
int nb_levels
Examples
free_surface.cpp.

Definition at line 148 of file free_surface.cpp.

148 {
149 return nb_levels + 1;
150}; //< first refinement level for computational mesh

◆ h

double h = 0.03
Examples
free_surface.cpp.

Definition at line 171 of file free_surface.cpp.

◆ help

char help[] = "...\n\n"
static

Definition at line 17 of file free_surface.cpp.

◆ I

IntegrationType I
constexpr
Initial value:
=
IntegrationType::GAUSS

Definition at line 84 of file free_surface.cpp.

◆ i

Definition at line 134 of file free_surface.cpp.

◆ init_h

auto init_h
Initial value:
= [](double r, double y, double theta) {
return capillary_tube(r, y, theta);
}
auto capillary_tube

Initialisation function.

Note
If UMs are compiled with Python to initialise phase field "H" surface.py function is used, which has to be present in execution folder.
Examples
free_surface.cpp, and shallow_wave.cpp.

Definition at line 297 of file free_surface.cpp.

297 {
298#ifdef PYTHON_INIT_SURFACE
299 double s = 1;
300 if (auto ptr = surfacePythonWeakPtr.lock()) {
301 CHK_THROW_MESSAGE(ptr->evalSurface(r, y, theta, eta, s),
302 "error eval python");
303 }
304 return s;
305#else
306 // return bubble_device(r, y, theta);
307 return capillary_tube(r, y, theta);
308 // return kernel_eye(r, y, theta);
309#endif
310};
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.

◆ integration_rule

◆ j

Definition at line 135 of file free_surface.cpp.

◆ k

Definition at line 136 of file free_surface.cpp.

◆ kappa

double kappa = (3. / (4. * std::sqrt(2. * W))) * (lambda / eta)
Examples
free_surface.cpp.

Definition at line 185 of file free_surface.cpp.

◆ kernel_eye

auto kernel_eye
Initial value:
= [](double r, double y, double) {
constexpr double y0 = 0.5;
constexpr double R = 0.4;
y -= y0;
const double d = std::sqrt(r * r + y * y);
return tanh((R - d) / (eta * std::sqrt(2)));
}
Examples
free_surface.cpp.

Definition at line 272 of file free_surface.cpp.

272 {
273 constexpr double y0 = 0.5;
274 constexpr double R = 0.4;
275 y -= y0;
276 const double d = std::sqrt(r * r + y * y);
277 return tanh((R - d) / (eta * std::sqrt(2)));
278};

◆ kernel_oscillation

auto kernel_oscillation
Initial value:
= [](double r, double y, double) {
constexpr int n = 3;
constexpr double R = 0.0125;
constexpr double A = R * 0.2;
const double theta = atan2(r, y);
const double w = R + A * cos(n * theta);
const double d = std::sqrt(r * r + y * y);
return tanh((w - d) / (eta * std::sqrt(2)));
}
const double n
refractive index of diffusive medium
Examples
free_surface.cpp.

Definition at line 262 of file free_surface.cpp.

262 {
263 constexpr int n = 3;
264 constexpr double R = 0.0125;
265 constexpr double A = R * 0.2;
266 const double theta = atan2(r, y);
267 const double w = R + A * cos(n * theta);
268 const double d = std::sqrt(r * r + y * y);
269 return tanh((w - d) / (eta * std::sqrt(2)));
270};

◆ l

Examples
free_surface.cpp.

Definition at line 137 of file free_surface.cpp.

◆ lambda

double lambda = 73

surface tension

Examples
free_surface.cpp.

Definition at line 167 of file free_surface.cpp.

◆ marker

auto marker = [](auto b) { return BitRefLevel().set(BITREFLEVEL_SIZE - b); }

Definition at line 315 of file free_surface.cpp.

315{ return BitRefLevel().set(BITREFLEVEL_SIZE - b); };
#define BITREFLEVEL_SIZE
max number of refinements

◆ md

double md = 1e-2
Examples
free_surface.cpp.

Definition at line 176 of file free_surface.cpp.

◆ mu_ave

double mu_ave = (mu_p + mu_m) / 2
Examples
free_surface.cpp.

Definition at line 182 of file free_surface.cpp.

◆ mu_diff

double mu_diff = (mu_p - mu_m) / 2
Examples
free_surface.cpp.

Definition at line 183 of file free_surface.cpp.

◆ mu_m

double mu_m = 0.010101 * 1e2
Examples
free_surface.cpp.

Definition at line 164 of file free_surface.cpp.

◆ mu_p

double mu_p = 0.000182 * 1e2
Examples
free_surface.cpp.

Definition at line 166 of file free_surface.cpp.

◆ my_max

auto my_max = [](const double x) { return (x - 1 + std::abs(x + 1)) / 2; }
Examples
free_surface.cpp.

Definition at line 203 of file free_surface.cpp.

203{ return (x - 1 + std::abs(x + 1)) / 2; };

◆ my_min

auto my_min = [](const double x) { return (x + 1 - std::abs(x - 1)) / 2; }
Examples
free_surface.cpp.

Definition at line 204 of file free_surface.cpp.

204{ return (x + 1 - std::abs(x - 1)) / 2; };

◆ nb_levels

int nb_levels = 4
Examples
free_surface.cpp.

Definition at line 143 of file free_surface.cpp.

◆ order

int order = 3

approximation order

Examples
free_surface.cpp.

Definition at line 142 of file free_surface.cpp.

◆ phase_function

auto phase_function
Initial value:
= [](const double h, const double diff, const double ave) {
return diff * h + ave;
}
Examples
free_surface.cpp.

Definition at line 213 of file free_surface.cpp.

213 {
214 return diff * h + ave;
215};

◆ refine_overlap

int refine_overlap = 4
Examples
free_surface.cpp.

Definition at line 144 of file free_surface.cpp.

◆ rho_ave

double rho_ave = (rho_p + rho_m) / 2
Examples
free_surface.cpp.

Definition at line 180 of file free_surface.cpp.

◆ rho_diff

double rho_diff = (rho_p - rho_m) / 2
Examples
free_surface.cpp.

Definition at line 181 of file free_surface.cpp.

◆ rho_m

double rho_m = 0.998
Examples
free_surface.cpp.

Definition at line 163 of file free_surface.cpp.

◆ rho_p

double rho_p = 0.0012
Examples
free_surface.cpp.

Definition at line 165 of file free_surface.cpp.

◆ save_range

auto save_range
Initial value:
= [](moab::Interface &moab, const std::string name,
const Range r) {
if (get_global_size(r.size())) {
auto out_meshset = get_temp_meshset_ptr(moab);
CHKERR moab.add_entities(*out_meshset, r);
CHKERR moab.write_file(name.c_str(), "MOAB", "PARALLEL=WRITE_PART",
out_meshset->get_ptr(), 1);
}
}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
auto get_global_size
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
Examples
free_surface.cpp.

Definition at line 326 of file free_surface.cpp.

327 {
329 if (get_global_size(r.size())) {
330 auto out_meshset = get_temp_meshset_ptr(moab);
331 CHKERR moab.add_entities(*out_meshset, r);
332 CHKERR moab.write_file(name.c_str(), "MOAB", "PARALLEL=WRITE_PART",
333 out_meshset->get_ptr(), 1);
334 }
336};

◆ SPACE_DIM

int SPACE_DIM = 2
constexpr
Examples
free_surface.cpp.

Definition at line 80 of file free_surface.cpp.

◆ t_kd

◆ tol

double tol = std::numeric_limits<float>::epsilon()

Definition at line 178 of file free_surface.cpp.

◆ tsPrePostProc

boost::weak_ptr<TSPrePostProc> tsPrePostProc
static
Examples
dynamic_first_order_con_law.cpp, and free_surface.cpp.

Definition at line 469 of file free_surface.cpp.

◆ U_FIELD_DIM

int U_FIELD_DIM = SPACE_DIM
constexpr
Examples
free_surface.cpp.

Definition at line 81 of file free_surface.cpp.

◆ W

double W = 0.25
Examples
free_surface.cpp.

Definition at line 168 of file free_surface.cpp.

◆ wetting_angle

auto wetting_angle = [](double water_level) { return water_level; }
Examples
free_surface.cpp.

Definition at line 312 of file free_surface.cpp.

312{ return water_level; };

◆ wetting_angle_sub_stepping

auto wetting_angle_sub_stepping
Initial value:
= [](auto ts_step) {
constexpr int sub_stepping = 16;
return std::min(1., static_cast<double>(ts_step) / sub_stepping);
}
Examples
free_surface.cpp.

Definition at line 196 of file free_surface.cpp.

196 {
197 constexpr int sub_stepping = 16;
198 return std::min(1., static_cast<double>(ts_step) / sub_stepping);
199};