45int main(
int argc,
char *argv[])
51 bool visualization =
true;
54 args.
AddOption(&nx,
"-nx",
"--num-elements-x",
55 "Number of elements in x-direction.");
56 args.
AddOption(&ny,
"-ny",
"--num-elements-y",
57 "Number of elements in y-direction.");
58 args.
AddOption(&order,
"-o",
"--mesh-order",
59 "Order (polynomial degree) of the mesh elements.");
61 "Frequency of the x-component.");
63 "Frequency of the y-component.");
65 "Phase angle of the x-component.");
66 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
68 "Enable or disable GLVis visualization.");
69 args.
AddOption(&visport,
"-p",
"--send-port",
"Socket for GLVis.");
78 delta *= M_PI / 180.0;
93 u.ProjectCoefficient(ufc);
98 soutv <<
"solution\n" << mesh <<
u;
99 soutv <<
"keys 'ARRj" << std::string(90,
'7') <<
"'\n";
100 soutv <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
101 soutv <<
"window_title 'V' window_geometry 0 0 500 500\n";
116 u.ProjectCoefficient(ufc);
121 south <<
"solution\n" << mesh <<
u;
122 south <<
"keys 'ARRj'\n";
123 south <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
124 south <<
"window_title 'H' window_geometry 500 0 500 500\n";
128 ofstream mesh_ofs(
"lissajous.mesh");
129 mesh_ofs.precision(8);
130 mesh.
Print(mesh_ofs);
131 ofstream sol_ofs(
"lissajous.gf");
132 sol_ofs.precision(8);
136 soutv <<
"keys '.0" << std::string((
int)
b,
'0') <<
"'\n" << flush;
137 south <<
"keys '.0" << std::string((
int)
a,
'0') <<
"'\n" << flush;
139 cout <<
"Which direction(s) are the two curves spinning in?\n";
166 p[2] = A*sin(a_*t + delta_);
174 real_t normal[3] = { cos(b_*t), sin(b_*t), 0 };
180#ifdef MFEM_USE_SINGLE
182#elif defined MFEM_USE_DOUBLE
186 MFEM_ABORT(
"Floating point type undefined");
188 real_t cross[3] = { A*a_*sin(b_*t)*cos(a_*t+delta_), -A*a_*cos(b_*t)*cos(a_*t+delta_), b_*B };
189 for (
int i = 0; i < 3; i++) { cn += cross[i]*cross[i]; }
190 for (
int i = 0; i < 3; i++) { cross[i] /= sqrt(cn); }
194 for (
int i = 0; i < 3; i++)
196 p[i] += R * (cos(theta)*normal[i] + sin(theta)*cross[i]);
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
A general function coefficient.
Class for grid function - Vector with associated FE space.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
static Mesh MakeCartesian2D(int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATER...
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
void Transform(void(*f)(const Vector &, Vector &))
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
bool Good() const
Return true if the command line options were parsed successfully.
void SetSize(int s)
Resize the vector to size s.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
void lissajous_trans_v(const Vector &x, Vector &p)
void lissajous_trans(const Vector &x, Vector &p, real_t a_, real_t b_, real_t delta_)
void lissajous_trans_h(const Vector &x, Vector &p)
real_t u_function(const Vector &x)
real_t u(const Vector &xvec)
real_t p(const Vector &x, real_t t)